Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rfr] Map network fields #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Networking/v2/Models/Network.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,17 @@ class Network extends OperatorResource implements Listable, Retrievable, Creatab
/** @var string */
public $tenantId;

/** @var bool */
public $routerExternal;

/** @var string */
public $providerNetworkType;

protected $aliases = [
'admin_state_up' => 'adminStateUp',
'tenant_id' => 'tenantId',
'admin_state_up' => 'adminStateUp',
'tenant_id' => 'tenantId',
'router:external' => 'routerExternal',
'provider:network_type' => 'providerNetworkType',
];

protected $resourceKey = 'network';
Expand Down
12 changes: 9 additions & 3 deletions tests/unit/Networking/v2/Fixtures/network-get.resp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ Content-Type: application/json
"network": {
"status": "ACTIVE",
"subnets": [
"subnetId"
"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
],
"name": "fakenetwork",
"tenant_id": "openstack",
"admin_state_up": true,
"router:external": true,
"admin_state_up": false,
"tenant_id": "4fd44f30292945e481c7b8a0c8908869",
"qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
"created_at": "2016-03-08T20:19:41",
"mtu": 0,
"shared": true,
"port_security_enabled": true,
"updated_at": "2016-03-08T20:19:41",
"id": "networkId"
}
}
3 changes: 3 additions & 0 deletions tests/unit/Networking/v2/Models/NetworkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class NetworkTest extends TestCase
{
/** @var Network */
private $network;

public function setUp()
Expand Down Expand Up @@ -105,6 +106,8 @@ public function test_it_retrieves()
$this->assertEquals('networkId', $this->network->id);
$this->assertEquals('fakenetwork', $this->network->name);
$this->assertEquals('ACTIVE', $this->network->status);
$this->assertEquals(true, $this->network->routerExternal);
$this->assertEquals(false, $this->network->adminStateUp);
}

public function test_it_deletes()
Expand Down