NSXv: prevent host route creation
The backend does not support host route injection. So we need to fail this on the API level. Change-Id: Id8203719a90823cb8332671fea8eca492d690e43 Closes-bug: #1484803
This commit is contained in:
parent
87c9b39288
commit
9e56b2ef0c
|
@ -1036,6 +1036,9 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||
the subnet is attached is not bound to an DHCP Edge, nsx_v will
|
||||
create the Edge and make sure the network is bound to the Edge
|
||||
"""
|
||||
if subnet['subnet']['host_routes'] != attr.ATTR_NOT_SPECIFIED:
|
||||
err_msg = _("Host routes not supported by plugin")
|
||||
raise n_exc.InvalidInput(error_message=err_msg)
|
||||
if subnet['subnet']['enable_dhcp']:
|
||||
filters = {'id': [subnet['subnet']['network_id']],
|
||||
'router:external': [True]}
|
||||
|
@ -1060,6 +1063,10 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||
return s
|
||||
|
||||
def update_subnet(self, context, id, subnet):
|
||||
s = subnet['subnet']
|
||||
if "host_routes" in s:
|
||||
err_msg = _("Host routes not supported by plugin")
|
||||
raise n_exc.InvalidInput(error_message=err_msg)
|
||||
orig = self._get_subnet(context, id)
|
||||
gateway_ip = orig['gateway_ip']
|
||||
enable_dhcp = orig['enable_dhcp']
|
||||
|
|
|
@ -998,6 +998,27 @@ class TestSubnetsV2(NsxVPluginV2TestCase,
|
|||
kwargs.update({'override': overrides})
|
||||
return self._create_bulk(fmt, number, 'subnet', base_data, **kwargs)
|
||||
|
||||
def test_create_subnet_with_two_host_routes(self):
|
||||
self.skipTest("Skip test for not implemented host_routes feature")
|
||||
|
||||
def test_delete_subnet_with_route(self):
|
||||
self.skipTest("Skip test for not implemented host_routes feature")
|
||||
|
||||
def test_update_subnet_adding_additional_host_routes_and_dns(self):
|
||||
self.skipTest("Skip test for not implemented host_routes feature")
|
||||
|
||||
def test_delete_subnet_with_dns_and_route(self):
|
||||
self.skipTest("Skip test for not implemented host_routes feature")
|
||||
|
||||
def test_update_subnet_route(self):
|
||||
self.skipTest("Skip test for not implemented host_routes feature")
|
||||
|
||||
def test_update_subnet_route_to_None(self):
|
||||
self.skipTest("Skip test for not implemented host_routes feature")
|
||||
|
||||
def test_create_subnet_with_one_host_route(self):
|
||||
self.skipTest("Skip test for not implemented host_routes feature")
|
||||
|
||||
def test_create_subnet_nonzero_cidr(self):
|
||||
awkward_cidrs = [{'nonezero': '10.129.122.5/8',
|
||||
'corrected': '10.0.0.0/8'},
|
||||
|
|
Loading…
Reference in New Issue