Merge "Add ipv6 ndra profile to Tier1Interface" into stable/stein

This commit is contained in:
Zuul 2019-04-15 18:19:43 +00:00 committed by Gerrit Code Review
commit 4d6520fa63
3 changed files with 18 additions and 1 deletions

View File

@ -2566,12 +2566,14 @@ class TestPolicyTier1(NsxPolicyLibTestCase):
segment_id = 'seg'
ip_addr = '1.1.1.1'
prefix_len = '24'
ndra_profile = 'slaac'
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],
ipv6_ndra_profile_id=ndra_profile,
tenant=TEST_TENANT)
expected_def = core_defs.Tier1InterfaceDef(
@ -2580,6 +2582,7 @@ class TestPolicyTier1(NsxPolicyLibTestCase):
interface_id=interface_id,
segment_id=segment_id,
subnets=[subnet],
ipv6_ndra_profile_id=ndra_profile,
tenant=TEST_TENANT)
self.assert_called_with_def(api_call, expected_def)

View File

@ -476,6 +476,18 @@ class Tier1InterfaceDef(ResourceDef):
self._set_attr_if_specified(body, 'segment_id',
body_attr='segment_path',
value=path)
if self.has_attr('ipv6_ndra_profile_id'):
paths = None
if self.get_attr('ipv6_ndra_profile_id'):
ndra_profile = Ipv6NdraProfileDef(
profile_id=self.get_attr('ipv6_ndra_profile_id'),
tenant=self.get_tenant())
paths = [ndra_profile.get_resource_full_path()]
self._set_attr_if_specified(body, 'ipv6_ndra_profile_id',
body_attr='ipv6_profile_paths',
value=paths)
return body
@property

View File

@ -951,13 +951,15 @@ class NsxPolicyTier1Api(NsxPolicyResourceBase):
return
def add_segment_interface(self, tier1_id, interface_id, segment_id,
subnets, tenant=constants.POLICY_INFRA_TENANT):
subnets, ipv6_ndra_profile_id=IGNORE,
tenant=constants.POLICY_INFRA_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)
self.policy_api.create_or_update(t1interface_def)