Add ipv6 ndra profile to Tier1Interface
Change-Id: I00e5e019cc123ba52c4f0cb9811bce1006b43eeb
This commit is contained in:
@@ -2566,12 +2566,14 @@ class TestPolicyTier1(NsxPolicyLibTestCase):
|
|||||||
segment_id = 'seg'
|
segment_id = 'seg'
|
||||||
ip_addr = '1.1.1.1'
|
ip_addr = '1.1.1.1'
|
||||||
prefix_len = '24'
|
prefix_len = '24'
|
||||||
|
ndra_profile = 'slaac'
|
||||||
subnet = core_defs.InterfaceSubnet([ip_addr], prefix_len)
|
subnet = core_defs.InterfaceSubnet([ip_addr], prefix_len)
|
||||||
with mock.patch.object(self.policy_api,
|
with mock.patch.object(self.policy_api,
|
||||||
"create_or_update") as api_call:
|
"create_or_update") as api_call:
|
||||||
self.resourceApi.add_segment_interface(
|
self.resourceApi.add_segment_interface(
|
||||||
tier1_id, interface_id, segment_id,
|
tier1_id, interface_id, segment_id,
|
||||||
subnets=[subnet],
|
subnets=[subnet],
|
||||||
|
ipv6_ndra_profile_id=ndra_profile,
|
||||||
tenant=TEST_TENANT)
|
tenant=TEST_TENANT)
|
||||||
|
|
||||||
expected_def = core_defs.Tier1InterfaceDef(
|
expected_def = core_defs.Tier1InterfaceDef(
|
||||||
@@ -2580,6 +2582,7 @@ class TestPolicyTier1(NsxPolicyLibTestCase):
|
|||||||
interface_id=interface_id,
|
interface_id=interface_id,
|
||||||
segment_id=segment_id,
|
segment_id=segment_id,
|
||||||
subnets=[subnet],
|
subnets=[subnet],
|
||||||
|
ipv6_ndra_profile_id=ndra_profile,
|
||||||
tenant=TEST_TENANT)
|
tenant=TEST_TENANT)
|
||||||
|
|
||||||
self.assert_called_with_def(api_call, expected_def)
|
self.assert_called_with_def(api_call, expected_def)
|
||||||
|
|||||||
@@ -476,6 +476,18 @@ class Tier1InterfaceDef(ResourceDef):
|
|||||||
self._set_attr_if_specified(body, 'segment_id',
|
self._set_attr_if_specified(body, 'segment_id',
|
||||||
body_attr='segment_path',
|
body_attr='segment_path',
|
||||||
value=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
|
return body
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -951,13 +951,15 @@ class NsxPolicyTier1Api(NsxPolicyResourceBase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def add_segment_interface(self, tier1_id, interface_id, segment_id,
|
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(
|
t1interface_def = core_defs.Tier1InterfaceDef(
|
||||||
tier1_id=tier1_id,
|
tier1_id=tier1_id,
|
||||||
service_id=self._locale_service_id(tier1_id),
|
service_id=self._locale_service_id(tier1_id),
|
||||||
interface_id=interface_id,
|
interface_id=interface_id,
|
||||||
segment_id=segment_id,
|
segment_id=segment_id,
|
||||||
subnets=subnets,
|
subnets=subnets,
|
||||||
|
ipv6_ndra_profile_id=ipv6_ndra_profile_id,
|
||||||
tenant=tenant)
|
tenant=tenant)
|
||||||
self.policy_api.create_or_update(t1interface_def)
|
self.policy_api.create_or_update(t1interface_def)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user