Merge "Adding support for customzing ep value in segement creation" into stable/ussuri
This commit is contained in:
commit
fa1379dda8
|
@ -4185,7 +4185,8 @@ 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):
|
||||
ip_pool_id='external-ip-pool', ls_id=None,
|
||||
tz_id=None, ep_id=None):
|
||||
name = 'test'
|
||||
description = 'desc'
|
||||
subnets = [core_defs.Subnet(gateway_address="2.2.2.0/24")]
|
||||
|
@ -4210,6 +4211,11 @@ class TestPolicySegment(NsxPolicyLibTestCase):
|
|||
if ls_id:
|
||||
kwargs['ls_id'] = ls_id
|
||||
|
||||
if tz_id:
|
||||
kwargs['transport_zone_id'] = tz_id
|
||||
if ep_id:
|
||||
kwargs['ep_id'] = ep_id
|
||||
|
||||
with mock.patch.object(self.policy_api,
|
||||
"create_or_update") as api_call:
|
||||
result = self.resourceApi.create_or_overwrite(name, **kwargs)
|
||||
|
@ -4263,6 +4269,12 @@ class TestPolicySegment(NsxPolicyLibTestCase):
|
|||
def test_create_with_ls_id(self):
|
||||
self._test_create(ls_id='lsid1')
|
||||
|
||||
def test_create_with_transport_zone_id(self):
|
||||
self._test_create(tz_id='tz_id1', ep_id='ep_id1')
|
||||
|
||||
def test_create_with_transport_zone_id_and_default_ep(self):
|
||||
self._test_create(tz_id='tz_id1')
|
||||
|
||||
def test_delete(self):
|
||||
segment_id = '111'
|
||||
with mock.patch.object(self.policy_api, "delete") as api_call:
|
||||
|
|
|
@ -996,7 +996,8 @@ class SegmentDef(BaseSegmentDef):
|
|||
if self.get_attr('transport_zone_id'):
|
||||
tz = TransportZoneDef(
|
||||
tz_id=self.get_attr('transport_zone_id'),
|
||||
ep_id=constants.DEFAULT_ENFORCEMENT_POINT,
|
||||
ep_id=self.get_attr(
|
||||
'ep_id') or constants.DEFAULT_ENFORCEMENT_POINT,
|
||||
tenant=self.get_tenant())
|
||||
path = tz.get_resource_full_path()
|
||||
self._set_attr_if_specified(body, 'transport_zone_id',
|
||||
|
|
|
@ -1976,6 +1976,7 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase):
|
|||
dhcp_server_config_id=IGNORE,
|
||||
admin_state=IGNORE,
|
||||
ls_id=IGNORE,
|
||||
ep_id=IGNORE,
|
||||
tags=IGNORE,
|
||||
tenant=constants.POLICY_INFRA_TENANT):
|
||||
|
||||
|
@ -2000,6 +2001,7 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase):
|
|||
dhcp_server_config_id=dhcp_server_config_id,
|
||||
admin_state=admin_state,
|
||||
ls_id=ls_id,
|
||||
ep_id=ep_id,
|
||||
tags=tags,
|
||||
tenant=tenant)
|
||||
self._create_or_store(segment_def)
|
||||
|
|
Loading…
Reference in New Issue