Merge "Add ipv6 ndra profile to Tier1Interface"
This commit is contained in:
commit
c07abaa9a9
@ -2637,12 +2637,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(
|
||||
@ -2651,6 +2653,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)
|
||||
|
@ -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
|
||||
|
@ -970,13 +970,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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user