+
+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})
+
+