Merge "fix nvp version validation for distributed router creation"
This commit is contained in:
commit
07e3ce927b
@ -383,7 +383,7 @@ def create_explicit_routing_lrouter(cluster, tenant_id,
|
|||||||
def create_lrouter(cluster, *args, **kwargs):
|
def create_lrouter(cluster, *args, **kwargs):
|
||||||
if kwargs.get('distributed', None):
|
if kwargs.get('distributed', None):
|
||||||
v = cluster.api_client.get_nvp_version()
|
v = cluster.api_client.get_nvp_version()
|
||||||
if (v.major < 3) or (v.major >= 3 and v.minor < 1):
|
if (v.major < 3) or (v.major == 3 and v.minor < 1):
|
||||||
raise nvp_exc.NvpInvalidVersion(version=v)
|
raise nvp_exc.NvpInvalidVersion(version=v)
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
@ -175,8 +175,11 @@ class FakeClient:
|
|||||||
fake_lrouter['tenant_id'] = self._get_tag(fake_lrouter, 'os_tid')
|
fake_lrouter['tenant_id'] = self._get_tag(fake_lrouter, 'os_tid')
|
||||||
default_nexthop = fake_lrouter['routing_config'].get(
|
default_nexthop = fake_lrouter['routing_config'].get(
|
||||||
'default_route_next_hop')
|
'default_route_next_hop')
|
||||||
|
if default_nexthop:
|
||||||
fake_lrouter['default_next_hop'] = default_nexthop.get(
|
fake_lrouter['default_next_hop'] = default_nexthop.get(
|
||||||
'gateway_ip_address', '0.0.0.0')
|
'gateway_ip_address', '0.0.0.0')
|
||||||
|
else:
|
||||||
|
fake_lrouter['default_next_hop'] = '0.0.0.0'
|
||||||
# NOTE(salv-orlando): We won't make the Fake NVP API client
|
# NOTE(salv-orlando): We won't make the Fake NVP API client
|
||||||
# aware of NVP version. The long term plan is to replace it
|
# aware of NVP version. The long term plan is to replace it
|
||||||
# with behavioral mocking of NVP API requests
|
# with behavioral mocking of NVP API requests
|
||||||
|
@ -593,9 +593,15 @@ class TestNiciraL3NatTestCase(NiciraL3NatTest,
|
|||||||
if res.status_int == 201:
|
if res.status_int == 201:
|
||||||
self._delete('routers', router['router']['id'])
|
self._delete('routers', router['router']['id'])
|
||||||
|
|
||||||
def test_router_create_distributed(self):
|
def test_router_create_distributed_with_3_1(self):
|
||||||
self._test_router_create_with_distributed(True, True)
|
self._test_router_create_with_distributed(True, True)
|
||||||
|
|
||||||
|
def test_router_create_distributed_with_new_nvp_versions(self):
|
||||||
|
with mock.patch.object(nvplib, 'create_explicit_route_lrouter'):
|
||||||
|
self._test_router_create_with_distributed(True, True, '3.2')
|
||||||
|
self._test_router_create_with_distributed(True, True, '4.0')
|
||||||
|
self._test_router_create_with_distributed(True, True, '4.1')
|
||||||
|
|
||||||
def test_router_create_not_distributed(self):
|
def test_router_create_not_distributed(self):
|
||||||
self._test_router_create_with_distributed(False, False)
|
self._test_router_create_with_distributed(False, False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user