+ if resp.status_code == status_codes["bad_request"]:
+ info(
+ "Status code is '%s' - trying operational data instead.",
+ resp.status_code,
+ )
+ result = get_entities_data(restconf_url)
+ else:
+ result = resp.json()
+
+ return result
+
+
+def get_entity_name(e_type, e_name):
+ """
+ Get the effective entity name for the given entity type.
+ If the entity type is not for odl-general-entity, entity name
+ should be the full instance identifier.
+ :param e_type: entity type
+ :param e_name: entity name
+ :return: updated entity name
+ """
+ name_templates = {
+ "ovsdb": "/network-topology:network-topology/topology[topology-id='ovsdb:1']/node[node-id='%s']",
+ }
+
+ if e_type in name_templates:
+ return name_templates[e_type] % e_name
+ else:
+ return e_name