New api to get policy edge cluster nsx node ids
Change-Id: I6881782d0fc8ea5fb2d1423dc514a10bb2aa482e
This commit is contained in:
parent
8207afbc81
commit
64c44d9161
@ -2646,6 +2646,21 @@ class TestPolicyEdgeCluster(NsxPolicyLibTestCase):
|
||||
self.assert_called_with_def(api_call, expected_def)
|
||||
self.assertEqual([node_id], result)
|
||||
|
||||
def test_get_nodes_nsx_ids(self):
|
||||
obj_id = '111'
|
||||
node_id = 'node1'
|
||||
node_nsx_id = 'nsx1'
|
||||
with mock.patch.object(
|
||||
self.policy_api, "list",
|
||||
return_value={'results': [{'id': node_id,
|
||||
'nsx_id': node_nsx_id}]}) as api_call:
|
||||
result = self.resourceApi.get_edge_node_nsx_ids(
|
||||
obj_id, tenant=TEST_TENANT)
|
||||
expected_def = core_defs.EdgeClusterNodeDef(
|
||||
ec_id=obj_id, tenant=TEST_TENANT)
|
||||
self.assert_called_with_def(api_call, expected_def)
|
||||
self.assertEqual([node_nsx_id], result)
|
||||
|
||||
|
||||
class TestPolicyMetadataProxy(NsxPolicyLibTestCase):
|
||||
|
||||
|
@ -3937,6 +3937,14 @@ class NsxPolicyEdgeClusterApi(NsxPolicyResourceBase):
|
||||
nodes = self._list(nodes_def)
|
||||
return [node['id'] for node in nodes]
|
||||
|
||||
def get_edge_node_nsx_ids(self, ec_id,
|
||||
ep_id=constants.DEFAULT_ENFORCEMENT_POINT,
|
||||
tenant=constants.POLICY_INFRA_TENANT):
|
||||
nodes_def = core_defs.EdgeClusterNodeDef(
|
||||
ep_id=ep_id, ec_id=ec_id, tenant=tenant)
|
||||
nodes = self._list(nodes_def)
|
||||
return [node.get('nsx_id', node['id']) for node in nodes]
|
||||
|
||||
|
||||
class NsxPolicyMetadataProxyApi(NsxPolicyResourceBase):
|
||||
# Currently this is used as a ready only Api
|
||||
|
Loading…
x
Reference in New Issue
Block a user