Add Network mtu and port_security_enabled properties

Explicitly parse the mtu and port_security_enabled properties
for a Network object based on the property definitions in the
networking v2 API [1].

[1] http://developer.openstack.org/api-ref-networking-v2-ext.html

Change-Id: I45fa298e86afa31c7d63762dca004d14692def31
This commit is contained in:
Richard Theis
2015-12-17 09:48:01 -06:00
parent 27f044df4f
commit 21708663ca
2 changed files with 12 additions and 0 deletions

View File

@@ -56,6 +56,13 @@ class Network(resource.Resource):
status = resource.prop('status')
#: The associated subnets.
subnets = resource.prop('subnets')
#: Read-only. The maximum transmission unit (MTU) of the network resource.
mtu = resource.prop('mtu', type=int)
#: The port security status, which is enabled ``True`` or disabled
#: ``False``. *Type: bool* *Default: False*
is_port_security_enabled = resource.prop('port_security_enabled',
type=bool,
default=False)
def is_external(self):
if self.router_external is not None:

View File

@@ -28,6 +28,8 @@ EXAMPLE = {
'shared': True,
'status': '11',
'subnets': '12',
'mtu': 1400,
'port_security_enabled': True,
}
@@ -62,6 +64,9 @@ class TestNetwork(testtools.TestCase):
self.assertEqual(EXAMPLE['shared'], sot.shared)
self.assertEqual(EXAMPLE['status'], sot.status)
self.assertEqual(EXAMPLE['subnets'], sot.subnets)
self.assertEqual(EXAMPLE['mtu'], sot.mtu)
self.assertEqual(EXAMPLE['port_security_enabled'],
sot.is_port_security_enabled)
def test_external(self):
sot = network.Network(EXAMPLE)