Merge "Add ls_id property for SegmentApi"
This commit is contained in:
commit
f7505ae6dc
|
@ -4026,7 +4026,7 @@ class TestPolicySegment(NsxPolicyLibTestCase):
|
||||||
|
|
||||||
def _test_create(self, tier1_id=None, tier0_id=None, mdproxy=None,
|
def _test_create(self, tier1_id=None, tier0_id=None, mdproxy=None,
|
||||||
dhcp_server=None, admin_state=None,
|
dhcp_server=None, admin_state=None,
|
||||||
ip_pool_id='external-ip-pool'):
|
ip_pool_id='external-ip-pool', ls_id=None):
|
||||||
name = 'test'
|
name = 'test'
|
||||||
description = 'desc'
|
description = 'desc'
|
||||||
subnets = [core_defs.Subnet(gateway_address="2.2.2.0/24")]
|
subnets = [core_defs.Subnet(gateway_address="2.2.2.0/24")]
|
||||||
|
@ -4048,6 +4048,9 @@ class TestPolicySegment(NsxPolicyLibTestCase):
|
||||||
if admin_state:
|
if admin_state:
|
||||||
kwargs['admin_state'] = admin_state
|
kwargs['admin_state'] = admin_state
|
||||||
|
|
||||||
|
if ls_id:
|
||||||
|
kwargs['ls_id'] = ls_id
|
||||||
|
|
||||||
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:
|
||||||
result = self.resourceApi.create_or_overwrite(name, **kwargs)
|
result = self.resourceApi.create_or_overwrite(name, **kwargs)
|
||||||
|
@ -4098,6 +4101,9 @@ class TestPolicySegment(NsxPolicyLibTestCase):
|
||||||
def test_create_without_ip_pool(self):
|
def test_create_without_ip_pool(self):
|
||||||
self._test_create(ip_pool_id=None)
|
self._test_create(ip_pool_id=None)
|
||||||
|
|
||||||
|
def test_create_with_ls_id(self):
|
||||||
|
self._test_create(ls_id='lsid1')
|
||||||
|
|
||||||
def test_delete(self):
|
def test_delete(self):
|
||||||
segment_id = '111'
|
segment_id = '111'
|
||||||
with mock.patch.object(self.policy_api, "delete") as api_call:
|
with mock.patch.object(self.policy_api, "delete") as api_call:
|
||||||
|
|
|
@ -908,7 +908,8 @@ class BaseSegmentDef(ResourceDef):
|
||||||
self._set_attr_if_specified(body, 'ip_pool_id',
|
self._set_attr_if_specified(body, 'ip_pool_id',
|
||||||
body_attr='advanced_config',
|
body_attr='advanced_config',
|
||||||
value=adv_cfg)
|
value=adv_cfg)
|
||||||
self._set_attrs_if_specified(body, ['domain_name', 'vlan_ids'])
|
self._set_attrs_if_specified(
|
||||||
|
body, ['domain_name', 'vlan_ids', 'ls_id'])
|
||||||
return body
|
return body
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -1940,6 +1940,7 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase):
|
||||||
metadata_proxy_id=IGNORE,
|
metadata_proxy_id=IGNORE,
|
||||||
dhcp_server_config_id=IGNORE,
|
dhcp_server_config_id=IGNORE,
|
||||||
admin_state=IGNORE,
|
admin_state=IGNORE,
|
||||||
|
ls_id=IGNORE,
|
||||||
tags=IGNORE,
|
tags=IGNORE,
|
||||||
tenant=constants.POLICY_INFRA_TENANT):
|
tenant=constants.POLICY_INFRA_TENANT):
|
||||||
|
|
||||||
|
@ -1963,6 +1964,7 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase):
|
||||||
metadata_proxy_id=metadata_proxy_id,
|
metadata_proxy_id=metadata_proxy_id,
|
||||||
dhcp_server_config_id=dhcp_server_config_id,
|
dhcp_server_config_id=dhcp_server_config_id,
|
||||||
admin_state=admin_state,
|
admin_state=admin_state,
|
||||||
|
ls_id=ls_id,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
tenant=tenant)
|
tenant=tenant)
|
||||||
self._create_or_store(segment_def)
|
self._create_or_store(segment_def)
|
||||||
|
|
Loading…
Reference in New Issue