Merge "Pass NDRA profile id only when specified"

This commit is contained in:
Zuul 2019-05-27 09:20:28 +00:00 committed by Gerrit Code Review
commit d29dd11e2e
2 changed files with 35 additions and 16 deletions

View File

@ -2755,11 +2755,6 @@ class TestPolicyTier1(NsxPolicyLibTestCase):
ipv6_ndra_profile_id=ndra_profile,
tenant=TEST_TENANT)
verify_def = core_defs.Tier1LocaleServiceDef(
tier1_id=tier1_id,
service_id=self.resourceApi._locale_service_id(tier1_id),
tenant=TEST_TENANT)
expected_def = core_defs.Tier1InterfaceDef(
tier1_id=tier1_id,
service_id=self.resourceApi._locale_service_id(tier1_id),
@ -2769,8 +2764,31 @@ class TestPolicyTier1(NsxPolicyLibTestCase):
ipv6_ndra_profile_id=ndra_profile,
tenant=TEST_TENANT)
self.assert_called_with_def(api_call, verify_def)
self.assert_called_with_def(api_call, expected_def, 1)
self.assert_called_with_def(api_call, expected_def)
def test_add_router_interface_no_ndra(self):
tier1_id = '111'
interface_id = 'seg-if'
segment_id = 'seg'
ip_addr = '1.1.1.1'
prefix_len = '24'
subnet = core_defs.InterfaceSubnet([ip_addr], prefix_len)
with mock.patch.object(self.policy_api,
"create_or_update") as api_call:
self.resourceApi.add_segment_interface(
tier1_id, interface_id, segment_id,
subnets=[subnet],
tenant=TEST_TENANT)
expected_def = core_defs.Tier1InterfaceDef(
tier1_id=tier1_id,
service_id=self.resourceApi._locale_service_id(tier1_id),
interface_id=interface_id,
segment_id=segment_id,
subnets=[subnet],
tenant=TEST_TENANT)
self.assert_called_with_def(api_call, expected_def)
def test_remove_router_interface(self):
tier1_id = '111'

View File

@ -1047,16 +1047,17 @@ class NsxPolicyTier1Api(NsxPolicyResourceBase):
def add_segment_interface(self, tier1_id, interface_id, segment_id,
subnets, ipv6_ndra_profile_id=IGNORE,
tenant=constants.POLICY_INFRA_TENANT):
self.create_locale_service(tier1_id, tenant)
args = {'tier1_id': tier1_id,
'service_id': self._locale_service_id(tier1_id),
'interface_id': interface_id,
'segment_id': segment_id,
'subnets': subnets,
'tenant': tenant}
t1interface_def = core_defs.Tier1InterfaceDef(
tier1_id=tier1_id,
service_id=self._locale_service_id(tier1_id),
interface_id=interface_id,
segment_id=segment_id,
subnets=subnets,
ipv6_ndra_profile_id=ipv6_ndra_profile_id,
tenant=tenant)
if ipv6_ndra_profile_id != IGNORE:
args['ipv6_ndra_profile_id'] = ipv6_ndra_profile_id
t1interface_def = core_defs.Tier1InterfaceDef(**args)
self.policy_api.create_or_update(t1interface_def)
def remove_segment_interface(self, tier1_id, interface_id,