Browse Source

Merge "Add MTU attribute for OS::Neutron::Net"

changes/15/202515/3
Jenkins 6 years ago
committed by Gerrit Code Review
parent
commit
9d6c60ea95
  1. 9
      heat/engine/resources/openstack/neutron/net.py
  2. 16
      heat/tests/neutron/test_neutron_net.py

9
heat/engine/resources/openstack/neutron/net.py

@ -29,10 +29,10 @@ class Net(neutron.NeutronResource):
ATTRIBUTES = (
STATUS, NAME_ATTR, SUBNETS, ADMIN_STATE_UP_ATTR, TENANT_ID_ATTR, SHOW,
PORT_SECURITY_ENABLED_ATTR,
PORT_SECURITY_ENABLED_ATTR, MTU_ATTR,
) = (
"status", "name", "subnets", "admin_state_up", "tenant_id", "show",
"port_security_enabled",
"port_security_enabled", "mtu",
)
properties_schema = {
@ -118,6 +118,11 @@ class Net(neutron.NeutronResource):
support_status=support.SupportStatus(version='5.0.0'),
type=attributes.Schema.BOOLEAN
),
MTU_ATTR: attributes.Schema(
_("The maximum transmission unit size(in bytes) for the network."),
support_status=support.SupportStatus(version='5.0.0'),
type=attributes.Schema.INTEGER
),
}
def handle_create(self):

16
heat/tests/neutron/test_neutron_net.py

@ -112,7 +112,8 @@ class NeutronNetTest(common.HeatTestCase):
"admin_state_up": True,
"shared": True,
"tenant_id": "c1210485b2424d48804aad5d39c61b8f",
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766",
"mtu": 0
}})
neutronclient.Client.list_dhcp_agent_hosting_networks(
@ -133,7 +134,8 @@ class NeutronNetTest(common.HeatTestCase):
"admin_state_up": True,
"shared": True,
"tenant_id": "c1210485b2424d48804aad5d39c61b8f",
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766",
"mtu": 0
}})
neutronclient.Client.show_network(
@ -145,7 +147,8 @@ class NeutronNetTest(common.HeatTestCase):
"admin_state_up": True,
"shared": True,
"tenant_id": "c1210485b2424d48804aad5d39c61b8f",
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766",
"mtu": 0
}})
neutronclient.Client.show_network(
@ -161,7 +164,8 @@ class NeutronNetTest(common.HeatTestCase):
"admin_state_up": True,
"shared": True,
"tenant_id": "c1210485b2424d48804aad5d39c61b8f",
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766",
"mtu": 0
}})
neutronclient.Client.show_network(
@ -173,7 +177,8 @@ class NeutronNetTest(common.HeatTestCase):
"admin_state_up": True,
"shared": True,
"tenant_id": "c1210485b2424d48804aad5d39c61b8f",
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766",
"mtu": 0
}})
# Update script
@ -254,6 +259,7 @@ class NeutronNetTest(common.HeatTestCase):
self.assertIsNone(rsrc.FnGetAtt('status'))
self.assertEqual('ACTIVE', rsrc.FnGetAtt('status'))
self.assertEqual(0, rsrc.FnGetAtt('mtu'))
self.assertRaises(
exception.InvalidTemplateAttribute, rsrc.FnGetAtt, 'Foo')
prop_diff = {

Loading…
Cancel
Save