From b73715a36b8f226224c34d67c1bde0498eb49e23 Mon Sep 17 00:00:00 2001 From: Janet Yu Date: Tue, 8 Dec 2015 21:05:46 -0800 Subject: [PATCH] Rename os-tid tag to os-project-id Align name of tenant/project id tag with how it appears in Horizon and vCenter. Change-Id: I5cf79b41e0830d22f8fab78c4e04f54a56b0bbe8 --- devstack/tools/nsxt_cleanup.py | 3 ++- vmware_nsx/common/utils.py | 4 ++-- vmware_nsx/tests/unit/nsx_v3/test_plugin.py | 2 +- vmware_nsx/tests/unit/nsxlib/v3/test_resources.py | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/devstack/tools/nsxt_cleanup.py b/devstack/tools/nsxt_cleanup.py index e72f04f3a4..ae7b6afe5c 100755 --- a/devstack/tools/nsxt_cleanup.py +++ b/devstack/tools/nsxt_cleanup.py @@ -180,7 +180,8 @@ class NSXClient(object): Get all logical resources created by OpenStack """ os_resources = [r for r in resources if 'tags' in r - for tag in r['tags'] if 'os-tid' in tag.values()] + for tag in r['tags'] + if 'os-project-id' in tag.values()] return os_resources def get_logical_switches(self): diff --git a/vmware_nsx/common/utils.py b/vmware_nsx/common/utils.py index 4015efe59b..dfed4bb84e 100644 --- a/vmware_nsx/common/utils.py +++ b/vmware_nsx/common/utils.py @@ -91,12 +91,12 @@ def check_and_truncate(display_name): def build_v3_tags_payload(logical_entity): """ Construct the tags payload that will be pushed to NSX-v3 - Add os-tid:, os-api-version:, + Add os-project-id:, os-api-version:, os-neutron-id: """ return [{"scope": "os-neutron-id", "tag": logical_entity.get("id", "")}, - {"scope": "os-tid", + {"scope": "os-project-id", "tag": logical_entity.get("tenant_id", "")}, {"scope": "os-api-version", "tag": version.version_info.release_string()}] diff --git a/vmware_nsx/tests/unit/nsx_v3/test_plugin.py b/vmware_nsx/tests/unit/nsx_v3/test_plugin.py index a959b742b8..2b0d1c9774 100644 --- a/vmware_nsx/tests/unit/nsx_v3/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v3/test_plugin.py @@ -353,7 +353,7 @@ class TestNsxV3Utils(NsxV3PluginTestCaseMixin): {'id': 'fake_id', 'tenant_id': 'fake_tenant_id'}) expected = [{'scope': 'os-neutron-id', 'tag': 'fake_id'}, - {'scope': 'os-tid', 'tag': 'fake_tenant_id'}, + {'scope': 'os-project-id', 'tag': 'fake_tenant_id'}, {'scope': 'os-api-version', 'tag': version.version_info.release_string()}] self.assertEqual(expected, result) diff --git a/vmware_nsx/tests/unit/nsxlib/v3/test_resources.py b/vmware_nsx/tests/unit/nsxlib/v3/test_resources.py index 8645074e2f..ca39f4e35d 100644 --- a/vmware_nsx/tests/unit/nsxlib/v3/test_resources.py +++ b/vmware_nsx/tests/unit/nsxlib/v3/test_resources.py @@ -53,7 +53,7 @@ class TestSwitchingProfileTestCase(nsxlib_testcase.NsxClientTestCase): tags = [ { - 'scope': 'os-tid', + 'scope': 'os-project-id', 'tag': 'tenant-1' }, { @@ -79,7 +79,7 @@ class TestSwitchingProfileTestCase(nsxlib_testcase.NsxClientTestCase): tags = [ { - 'scope': 'os-tid', + 'scope': 'os-project-id', 'tag': 'tenant-1' }, { @@ -109,7 +109,7 @@ class TestSwitchingProfileTestCase(nsxlib_testcase.NsxClientTestCase): tags = [ { - 'scope': 'os-tid', + 'scope': 'os-project-id', 'tag': 'tenant-1' }, {