diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py index e5c60a9e..73e8f0ed 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py @@ -4026,7 +4026,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'): + ip_pool_id='external-ip-pool', ls_id=None): name = 'test' description = 'desc' subnets = [core_defs.Subnet(gateway_address="2.2.2.0/24")] @@ -4048,6 +4048,9 @@ class TestPolicySegment(NsxPolicyLibTestCase): if admin_state: kwargs['admin_state'] = admin_state + if ls_id: + kwargs['ls_id'] = ls_id + with mock.patch.object(self.policy_api, "create_or_update") as api_call: result = self.resourceApi.create_or_overwrite(name, **kwargs) @@ -4098,6 +4101,9 @@ class TestPolicySegment(NsxPolicyLibTestCase): def test_create_without_ip_pool(self): self._test_create(ip_pool_id=None) + def test_create_with_ls_id(self): + self._test_create(ls_id='lsid1') + def test_delete(self): segment_id = '111' with mock.patch.object(self.policy_api, "delete") as api_call: diff --git a/vmware_nsxlib/v3/policy/core_defs.py b/vmware_nsxlib/v3/policy/core_defs.py index 75866813..d605e8a3 100644 --- a/vmware_nsxlib/v3/policy/core_defs.py +++ b/vmware_nsxlib/v3/policy/core_defs.py @@ -908,7 +908,8 @@ class BaseSegmentDef(ResourceDef): self._set_attr_if_specified(body, 'ip_pool_id', body_attr='advanced_config', 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 @staticmethod diff --git a/vmware_nsxlib/v3/policy/core_resources.py b/vmware_nsxlib/v3/policy/core_resources.py index af2b0bd8..b42f00ec 100644 --- a/vmware_nsxlib/v3/policy/core_resources.py +++ b/vmware_nsxlib/v3/policy/core_resources.py @@ -1940,6 +1940,7 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase): metadata_proxy_id=IGNORE, dhcp_server_config_id=IGNORE, admin_state=IGNORE, + ls_id=IGNORE, tags=IGNORE, tenant=constants.POLICY_INFRA_TENANT): @@ -1963,6 +1964,7 @@ class NsxPolicySegmentApi(NsxPolicyResourceBase): metadata_proxy_id=metadata_proxy_id, dhcp_server_config_id=dhcp_server_config_id, admin_state=admin_state, + ls_id=ls_id, tags=tags, tenant=tenant) self._create_or_store(segment_def)