Support segment overlay-id

Change-Id: If873748ccced944efd62e4b7ed5753c864b662b8
This commit is contained in:
asarfaty 2021-01-06 08:11:35 +02:00
parent b880e4e3e9
commit 54308ced90
5 changed files with 13 additions and 4 deletions

View File

@ -4246,7 +4246,7 @@ class TestPolicySegment(NsxPolicyLibTestCase):
def _test_create(self, tier1_id=None, tier0_id=None, mdproxy=None,
dhcp_server=None, admin_state=None,
ip_pool_id='external-ip-pool', ls_id=None,
unique_id=None, tz_id=None, ep_id=None):
unique_id=None, tz_id=None, ep_id=None, overlay_id=None):
name = 'test'
description = 'desc'
subnets = [core_defs.Subnet(gateway_address="2.2.2.0/24")]
@ -4267,6 +4267,8 @@ class TestPolicySegment(NsxPolicyLibTestCase):
kwargs['dhcp_server_config_id'] = dhcp_server
if admin_state:
kwargs['admin_state'] = admin_state
if overlay_id:
kwargs['overlay_id'] = overlay_id
if ls_id:
kwargs['ls_id'] = ls_id
@ -4340,6 +4342,9 @@ class TestPolicySegment(NsxPolicyLibTestCase):
def test_create_with_transport_zone_id_and_default_ep(self):
self._test_create(tz_id='tz_id1')
def test_create_with_overlay_id(self):
self._test_create(overlay_id=100)
def test_delete(self):
segment_id = '111'
with mock.patch.object(self.policy_api, "delete") as api_call:

View File

@ -153,6 +153,7 @@ NSX_VERSION_2_5_0 = '2.5.0'
NSX_VERSION_3_0_0 = '3.0.0'
NSX_VERSION_3_0_2 = '3.0.2'
NSX_VERSION_3_1_0 = '3.1.0'
NSX_VERSION_3_2_0 = '3.2.0'
# Features available depending on the NSX Manager backend version
FEATURE_MAC_LEARNING = 'MAC Learning'

View File

@ -984,7 +984,8 @@ class SegmentDef(BaseSegmentDef):
return {'metadata_proxy_id': nsx_constants.NSX_VERSION_3_0_0,
'dhcp_server_config_id': nsx_constants.NSX_VERSION_3_0_0,
'admin_state': nsx_constants.NSX_VERSION_3_0_0,
'unique_id': nsx_constants.NSX_VERSION_3_1_0}
'unique_id': nsx_constants.NSX_VERSION_3_1_0,
'overlay_id': nsx_constants.NSX_VERSION_3_1_0}
def get_obj_dict(self):
body = super(SegmentDef, self).get_obj_dict()
@ -1058,7 +1059,7 @@ class SegmentDef(BaseSegmentDef):
value=admin_state)
self._set_attr_if_supported(body, 'unique_id')
self._set_attr_if_supported(body, 'overlay_id')
return body

View File

@ -2072,6 +2072,7 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase):
ls_id=IGNORE,
unique_id=IGNORE,
ep_id=IGNORE,
overlay_id=IGNORE,
tags=IGNORE,
tenant=constants.POLICY_INFRA_TENANT):
@ -2098,6 +2099,7 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase):
ls_id=ls_id,
unique_id=unique_id,
ep_id=ep_id,
overlay_id=overlay_id,
tags=tags,
tenant=tenant)
self._create_or_store(segment_def)

View File

@ -105,7 +105,7 @@ class NsxLibTrustManagement(utils.NsxLibApiBase):
if cert['pem_encoded'] == cert_pem]
if not cert_ids:
raise nsxlib_exc.ResourceNotFound(
manager=self.client.nsx_api_managers,
manager=getattr(self.client, 'nsx_api_managers'),
operation="find_certificate")
identities = self.get_identities(name)