Migrate hybrid functional tests to RFC8040
[transportpce.git] / tests / transportpce_tests / common / test_utils_rfc8040.py
index 1536a2b7bc0ff358cbee0fcc9a57b5eeebe7a137..9f0c3371022a9f3506105304795576914f437b2c 100644 (file)
@@ -575,6 +575,21 @@ def get_ordm_serv_list_attr_request(attribute: str, value: str):
             attribute: response_attribute}
 
 
+def get_serv_path_list_attr(attribute: str, value: str):
+    url = {'rfc8040': '{}/data/transportpce-service-path:service-path-list/{}={}?content=nonconfig',
+           'draft-bierman02': '{}/operational/transportpce-service-path:service-path-list/{}/{}'}
+    response = get_request(url[RESTCONF_VERSION].format('{}', attribute, value))
+    res = response.json()
+    return_key = {'rfc8040': 'transportpce-service-path:' + attribute,
+                  'draft-bierman02': attribute}
+    if return_key[RESTCONF_VERSION] in res.keys():
+        response_attribute = res[return_key[RESTCONF_VERSION]]
+    else:
+        response_attribute = res['errors']['error'][0]
+    return {'status_code': response.status_code,
+            attribute: response_attribute}
+
+
 #
 # TransportPCE internal API RPCs
 #