diff --git a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py index 2f1afef1..6cf7815c 100644 --- a/vmware_nsxlib/tests/unit/v3/policy/test_resources.py +++ b/vmware_nsxlib/tests/unit/v3/policy/test_resources.py @@ -2647,6 +2647,11 @@ class TestPolicyTier1(NsxPolicyLibTestCase): ipv6_ndra_profile_id=ndra_profile, tenant=TEST_TENANT) + verify_def = core_defs.Tier1LocaleServiceDef( + tier1_id=tier1_id, + service_id=self.resourceApi._locale_service_id(tier1_id), + tenant=TEST_TENANT) + expected_def = core_defs.Tier1InterfaceDef( tier1_id=tier1_id, service_id=self.resourceApi._locale_service_id(tier1_id), @@ -2656,7 +2661,8 @@ class TestPolicyTier1(NsxPolicyLibTestCase): ipv6_ndra_profile_id=ndra_profile, tenant=TEST_TENANT) - self.assert_called_with_def(api_call, expected_def) + self.assert_called_with_def(api_call, verify_def) + self.assert_called_with_def(api_call, expected_def, 1) def test_remove_router_interface(self): tier1_id = '111' diff --git a/vmware_nsxlib/v3/policy/core_resources.py b/vmware_nsxlib/v3/policy/core_resources.py index f619cc82..0a2aa2dc 100644 --- a/vmware_nsxlib/v3/policy/core_resources.py +++ b/vmware_nsxlib/v3/policy/core_resources.py @@ -940,6 +940,14 @@ class NsxPolicyTier1Api(NsxPolicyResourceBase): # with the same id as the router id with a constant suffix return tier1_id + self.LOCALE_SERVICE_SUFF + def _ensure_locale_service(self, tier1_id, + tenant=constants.POLICY_INFRA_TENANT): + t1service_def = core_defs.Tier1LocaleServiceDef( + tier1_id=tier1_id, + service_id=self._locale_service_id(tier1_id), + tenant=tenant) + self.policy_api.create_or_update(t1service_def) + def set_edge_cluster_path(self, tier1_id, edge_cluster_path, tenant=constants.POLICY_INFRA_TENANT): t1service_def = core_defs.Tier1LocaleServiceDef( @@ -972,6 +980,8 @@ class NsxPolicyTier1Api(NsxPolicyResourceBase): def add_segment_interface(self, tier1_id, interface_id, segment_id, subnets, ipv6_ndra_profile_id=IGNORE, tenant=constants.POLICY_INFRA_TENANT): + self._ensure_locale_service(tier1_id, tenant) + t1interface_def = core_defs.Tier1InterfaceDef( tier1_id=tier1_id, service_id=self._locale_service_id(tier1_id),