+ return post_request(url, data)
+
+
+def connect_rdm_to_xpdr_request(xpdr_node: str, xpdr_num: str, network_num: str,
+ rdm_node: str, srg_num: str, termination_num: str):
+ url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links"
+ data = {
+ "networkutils:input": {
+ "networkutils:links-input": {
+ "networkutils:xpdr-node": xpdr_node,
+ "networkutils:xpdr-num": xpdr_num,
+ "networkutils:network-num": network_num,
+ "networkutils:rdm-node": rdm_node,
+ "networkutils:srg-num": srg_num,
+ "networkutils:termination-point-num": termination_num
+ }
+ }
+ }
+ return post_request(url, data)
+
+
+def check_netconf_node_request(node: str, suffix: str):
+ url = URL_CONFIG_NETCONF_TOPO + (
+ "node/" + node + "/yang-ext:mount/org-openroadm-device:org-openroadm-device/" + suffix
+ )
+ return get_request(url)
+
+
+def get_netconf_oper_request(node: str):
+ url = "{}/operational/network-topology:network-topology/topology/topology-netconf/node/" + node
+ return get_request(url)
+
+
+def get_ordm_topo_request(suffix: str):
+ url = URL_CONFIG_ORDM_TOPO + suffix
+ return get_request(url)
+
+
+def add_oms_attr_request(link: str, attr):
+ url = URL_CONFIG_ORDM_TOPO + (
+ "ietf-network-topology:link/" + link + "/org-openroadm-network-topology:OMS-attributes/span"
+ )
+ return put_request(url, attr)
+
+
+def del_oms_attr_request(link: str):
+ url = URL_CONFIG_ORDM_TOPO + (
+ "ietf-network-topology:link/" + link + "/org-openroadm-network-topology:OMS-attributes/span"
+ )
+ return delete_request(url)
+
+
+def get_clli_net_request():
+ return get_request(URL_CONFIG_CLLI_NET)
+
+
+def get_ordm_net_request():
+ return get_request(URL_CONFIG_ORDM_NET)
+
+
+def get_otn_topo_request():
+ return get_request(URL_CONFIG_OTN_TOPO)
+
+
+def del_link_request(link: str):
+ url = URL_CONFIG_ORDM_TOPO + ("ietf-network-topology:link/" + link)
+ return delete_request(url)
+
+
+def del_node_request(node: str):
+ url = URL_CONFIG_CLLI_NET + ("node/" + node)
+ return delete_request(url)
+
+
+def portmapping_request(suffix: str):
+ url = URL_PORTMAPPING + suffix
+ return get_request(url)
+
+
+def get_service_list_request(suffix: str):
+ url = URL_OPER_SERV_LIST + suffix
+ return get_request(url)
+
+
+def service_create_request(attr):
+ return post_request(URL_SERV_CREATE, attr)
+
+
+def service_delete_request(servicename: str,
+ requestid="e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+ notificationurl="http://localhost:8585/NotificationServer/notify"):
+ attr = {"input": {
+ "sdnc-request-header": {
+ "request-id": requestid,
+ "rpc-action": "service-delete",
+ "request-system-id": "appname",
+ "notification-url": notificationurl},
+ "service-delete-req-info": {
+ "service-name": servicename,
+ "tail-retention": "no"}}}
+ return post_request(URL_SERV_DELETE, attr)
+
+
+def service_path_request(operation: str, servicename: str, wavenumber: str, nodes):
+ attr = {"renderer:input": {
+ "renderer:service-name": servicename,
+ "renderer:wave-number": wavenumber,
+ "renderer:modulation-format": "qpsk",
+ "renderer:operation": operation,
+ "renderer:nodes": nodes}}
+ return post_request(URL_SERVICE_PATH, attr)
+
+
+def otn_service_path_request(operation: str, servicename: str, servicerate: str, servicetype: str, nodes,
+ eth_attr=None):
+ attr = {"service-name": servicename,
+ "operation": operation,
+ "service-rate": servicerate,
+ "service-type": servicetype,
+ "nodes": nodes}
+ if eth_attr:
+ attr.update(eth_attr)
+ return post_request(URL_OTN_SERVICE_PATH, {"renderer:input": attr})
+
+
+def create_ots_oms_request(nodeid: str, lcp: str):
+ attr = {"input": {
+ "node-id": nodeid,
+ "logical-connection-point": lcp}}
+ return post_request(URL_CREATE_OTS_OMS, attr)
+
+
+def path_computation_request(requestid: str, servicename: str, serviceaend, servicezend,
+ hardconstraints=None, softconstraints=None, metric="hop-count", other_attr=None):
+ attr = {"service-name": servicename,
+ "resource-reserve": "true",
+ "service-handler-header": {"request-id": requestid},
+ "service-a-end": serviceaend,
+ "service-z-end": servicezend,
+ "pce-metric": metric}
+ if hardconstraints:
+ attr.update({"hard-constraints": hardconstraints})
+ if softconstraints:
+ attr.update({"soft-constraints": softconstraints})
+ if other_attr:
+ attr.update(other_attr)
+ return post_request(URL_PATH_COMPUTATION_REQUEST, {"input": attr})