From e2c94012be3706110b79ccca3dcb5aceefacfbfb Mon Sep 17 00:00:00 2001 From: Sangwook Ha Date: Thu, 28 Oct 2021 14:04:59 -0700 Subject: [PATCH] Support OVSDB entity ownership ID format Entity type 'ovsdb' has its own entity ID format, different from the one for ServiceEntityType & AsyncServiceCloseEntityType. Add entity ID template for for 'ovsdb' entity type. Signed-off-by: Sangwook Ha Change-Id: I8d1383d1ce1e53e290dfd25c9473acb36738a576 --- csit/libraries/ClusterEntities.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/csit/libraries/ClusterEntities.py b/csit/libraries/ClusterEntities.py index b8023f105f..bf7c017931 100644 --- a/csit/libraries/ClusterEntities.py +++ b/csit/libraries/ClusterEntities.py @@ -141,6 +141,15 @@ def get_entity_type_data(restconf_url, e_type): auth=("admin", "admin"), ) + info( + "Response %s ", + resp, + ) + info( + "Entity json %s", + resp.json(), + ) + return resp.json()["entity-owners:entity-type"][0] @@ -153,12 +162,15 @@ def get_entity_data(restconf_url, e_type, e_name): :param e_name: entity name :return: entity owner & candidates """ + id_templates = { + "org.opendaylight.mdsal.ServiceEntityType": "/odl-general-entity:entity[name='%s']", + "org.opendaylight.mdsal.AsyncServiceCloseEntityType": "/odl-general-entity:entity[name='%s']", + "ovsdb": "/network-topology:network-topology/topology[topology-id='ovsdb:1']/node[node-id='%s']", + } + id_template = id_templates[e_type] + entity_type = get_entity_type_data(restconf_url, e_type) - entity = [ - e - for e in entity_type["entity"] - if e["id"] == "/odl-general-entity:entity[name='%s']" % e_name - ][0] + entity = [e for e in entity_type["entity"] if e["id"] == id_template % e_name][0] result = { "candidates": [c["name"] for c in entity["candidate"]], -- 2.36.6