diff --git a/vmware_nsxlib/tests/unit/v3/test_resources.py b/vmware_nsxlib/tests/unit/v3/test_resources.py index 750b1af4..4c40be63 100644 --- a/vmware_nsxlib/tests/unit/v3/test_resources.py +++ b/vmware_nsxlib/tests/unit/v3/test_resources.py @@ -1996,11 +1996,13 @@ class TransportNode(BaseTestResource): tn = self.get_mocked_resource() self.nsxlib.feature_supported = mock.MagicMock() with mock.patch.object(tn.client, 'url_get', return_value=fake_tn): + # Test the api with its 2 versions self.nsxlib.feature_supported.side_effect = [False, True] tzs = tn.get_transport_zones(fake_tn['id']) self.assertEqual([test_constants.FAKE_TZ_UUID], tzs) tzs = tn.get_transport_zones(fake_tn['id']) - self.assertEqual([test_constants.FAKE_TZ_EP_UUID], tzs) + self.assertEqual([test_constants.FAKE_TZ_EP_UUID, + test_constants.FAKE_TZ_EP_UUID2], tzs) class MetadataProxy(BaseTestResource): diff --git a/vmware_nsxlib/v3/core_resources.py b/vmware_nsxlib/v3/core_resources.py index a704d9aa..efa33366 100644 --- a/vmware_nsxlib/v3/core_resources.py +++ b/vmware_nsxlib/v3/core_resources.py @@ -948,9 +948,11 @@ class NsxLibTransportNode(utils.NsxLibApiBase): return [] host_switches = tn.get('host_switch_spec').get('host_switches', []) - - return [ep.get('transport_zone_id') for ep in - host_switches[0].get('transport_zone_endpoints', [])] + tzs = [] + for host_switch in host_switches: + tzs.extend([ep.get('transport_zone_id') for ep in + host_switch.get('transport_zone_endpoints', [])]) + return tzs else: return [ep.get('transport_zone_id') for ep in tn.get('transport_zone_endpoints', [])]