From 27c6b54a5cabe085fc043ae2b0ca238ed3eb9336 Mon Sep 17 00:00:00 2001
From: Laskaratos Dimitris <dlaskaratos@intracomtel.com>
Date: Fri, 25 Apr 2025 10:55:49 +0300
Subject: [PATCH] Fixed bug with application ports when registering app
---
.../Dockerfile | 4 +-
.../requirements.txt | 2 +-
.../edgecloud/clients/aeros/client.py | 2 +-
.../clients/eurecom_platform/client.py | 2 +-
.../edgecloud/clients/i2edge/client.py | 2 +-
.../edgecloud/clients/isi_platform/client.py | 2 +-
.../edgecloud/clients/piedge/client.py | 27 +-
.../controllers/nodes_controller.py | 9 +-
.../service_functions_catalogue_controller.py | 95 +-
.../service_functions_instances_controller.py | 13 +-
.../swagger_server/core/piedge_encoder.py | 23 +-
.../swagger_server/models/app_manifest.py | 247 +++++
.../models/app_manifest_app_repo.py | 217 +++++
.../models/app_manifest_component_spec.py | 97 ++
.../models/app_manifest_network_interfaces.py | 165 ++++
.../swagger_server/models/deploy_app.py | 87 ++
.../models/edge_cloud_provider.py | 36 +
.../models/edge_cloud_region.py | 36 +
.../swagger_server/models/edge_cloud_zone.py | 171 ++++
.../models/edge_cloud_zone_id.py | 36 +
.../models/edge_cloud_zone_name.py | 36 +
.../models/edge_cloud_zone_status.py | 43 +
.../swagger_server/models/edge_cloud_zones.py | 37 +
.../swagger_server/models/gpu_info.py | 96 ++
.../swagger_server/models/operating_system.py | 172 ++++
.../models/required_resources.py | 155 ++++
.../swagger_server/models/uri.py | 36 +
.../swagger_server/swagger/swagger.yaml | 862 +++++++++---------
.../utils/auxiliary_functions.py | 2 +-
.../swagger_server/utils/connector_db.py | 29 +-
.../utils/kubernetes_connector.py | 111 +--
.../swagger_server/utils/mec_connector.py | 144 +--
.../swagger_server/utils/nodes_monitoring.py | 698 +++++++-------
srm-deployment.yaml | 339 +++++--
34 files changed, 2981 insertions(+), 1052 deletions(-)
create mode 100644 service-resource-manager-implementation/swagger_server/models/app_manifest.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/app_manifest_app_repo.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/app_manifest_component_spec.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/app_manifest_network_interfaces.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/deploy_app.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/edge_cloud_provider.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/edge_cloud_region.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/edge_cloud_zone.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_id.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_name.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_status.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/edge_cloud_zones.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/gpu_info.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/operating_system.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/required_resources.py
create mode 100644 service-resource-manager-implementation/swagger_server/models/uri.py
diff --git a/service-resource-manager-implementation/Dockerfile b/service-resource-manager-implementation/Dockerfile
index 1c4a5bd..826f23e 100644
--- a/service-resource-manager-implementation/Dockerfile
+++ b/service-resource-manager-implementation/Dockerfile
@@ -13,7 +13,7 @@ WORKDIR /usr/src/app
#THIS SOLVED THE ISSUE WITH CFFI: building wheel for cffi (setup.py) finished with status 'error'!
-RUN apk add --no-cache libffi-dev build-base
+#RUN apk add --no-cache libffi-dev build-base
#
COPY requirements.txt /usr/src/app/
#RUN pip3 install connexion
@@ -34,7 +34,7 @@ RUN pip3 install --upgrade pip
RUN pip3 install wheel
#RUN pip3 install --no-cache --upgrade setuptools
-RUN pip3 install --no-cache-dir -r requirements.txt
+RUN pip3 install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org --no-cache-dir -r requirements.txt
COPY . /usr/src/app
diff --git a/service-resource-manager-implementation/requirements.txt b/service-resource-manager-implementation/requirements.txt
index 51f99ca..c211cb2 100644
--- a/service-resource-manager-implementation/requirements.txt
+++ b/service-resource-manager-implementation/requirements.txt
@@ -25,7 +25,7 @@ kubernetes==18.20.0
python-jose[cryptography]
cffi==1.15.1
#bcrypt
-bcrypt==3.1.7 #used in python 3.5 running server for dev
+#bcrypt==3.1.7 #used in python 3.5 running server for dev
psycopg2-binary
#psycopg2==2.7.7 #used in python 3.5 running server for dev
diff --git a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/aeros/client.py b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/aeros/client.py
index 2d47c44..f3efafa 100644
--- a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/aeros/client.py
+++ b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/aeros/client.py
@@ -1,6 +1,6 @@
# Mocked API for testing purposes
from typing import Dict, List, Optional
-from edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
+from swagger_server.adapters.edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
class EdgeApplicationManager(EdgeCloudManagementInterface):
def onboard_app(self, app_manifest: Dict) -> Dict:
diff --git a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/eurecom_platform/client.py b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/eurecom_platform/client.py
index 2d47c44..f3efafa 100644
--- a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/eurecom_platform/client.py
+++ b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/eurecom_platform/client.py
@@ -1,6 +1,6 @@
# Mocked API for testing purposes
from typing import Dict, List, Optional
-from edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
+from swagger_server.adapters.edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
class EdgeApplicationManager(EdgeCloudManagementInterface):
def onboard_app(self, app_manifest: Dict) -> Dict:
diff --git a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/i2edge/client.py b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/i2edge/client.py
index 2d47c44..f3efafa 100644
--- a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/i2edge/client.py
+++ b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/i2edge/client.py
@@ -1,6 +1,6 @@
# Mocked API for testing purposes
from typing import Dict, List, Optional
-from edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
+from swagger_server.adapters.edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
class EdgeApplicationManager(EdgeCloudManagementInterface):
def onboard_app(self, app_manifest: Dict) -> Dict:
diff --git a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/isi_platform/client.py b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/isi_platform/client.py
index 2d47c44..f3efafa 100644
--- a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/isi_platform/client.py
+++ b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/isi_platform/client.py
@@ -1,6 +1,6 @@
# Mocked API for testing purposes
from typing import Dict, List, Optional
-from edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
+from swagger_server.adapters.edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
class EdgeApplicationManager(EdgeCloudManagementInterface):
def onboard_app(self, app_manifest: Dict) -> Dict:
diff --git a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/piedge/client.py b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/piedge/client.py
index 17d0dc9..f3f04fe 100644
--- a/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/piedge/client.py
+++ b/service-resource-manager-implementation/swagger_server/adapters/edgecloud/clients/piedge/client.py
@@ -3,23 +3,30 @@ from typing import Dict, List, Optional
import os
import logging
import requests
-from edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
+from swagger_server.adapters.edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface
from swagger_server.utils import kubernetes_connector, connector_db
from swagger_server.models.service_function_registration_request import ServiceFunctionRegistrationRequest
from swagger_server.models.deploy_service_function import DeployServiceFunction
+from swagger_server.models.app_manifest import AppManifest
from swagger_server.core.piedge_encoder import deploy_service_function
-piedge_ip = os.environ['EDGE_CLOUD_ADAPTER']
+# piedge_ip = os.environ['EDGE_CLOUD_ADAPTER_IP']
edge_cloud_provider = os.environ['PLATFORM_PROVIDER']
class EdgeApplicationManager(EdgeCloudManagementInterface):
- def onboard_app(self, app_manifest: Dict) -> Dict:
+ def onboard_app(self, app_manifest: AppManifest) -> Dict:
print(f"Submitting application: {app_manifest}")
logging.info('Extracting variables from payload...')
app_name = app_manifest.get('name')
image = app_manifest.get('appRepo').get('imagePath')
- sf = ServiceFunctionRegistrationRequest(service_function_image=image, service_function_name=app_name)
- return sf
+ package_type = app_manifest.get('packageType')
+ network_interfaces = app_manifest.get('componentSpec')[0].get('networkInterfaces')
+ ports = []
+ for ni in network_interfaces:
+ ports.append(ni.get('port'))
+ insert_doc = ServiceFunctionRegistrationRequest(service_function_image=image, service_function_name=app_name, service_function_type=package_type, application_ports=ports)
+ result = connector_db.insert_document_service_function(insert_doc.to_dict())
+ return {'appId': str(result.inserted_id)}
def get_all_onboarded_apps(self) -> List[Dict]:
logging.info('Retrieving all registered apps from database...')
@@ -34,8 +41,8 @@ class EdgeApplicationManager(EdgeCloudManagementInterface):
def delete_onboarded_app(self, app_id: str) -> None:
logging.info('Deleting registered app with ID: '+ app_id+' from database...')
- result = connector_db.delete_document_service_function(app_id)
- return result
+ result, code = connector_db.delete_document_service_function(_id=app_id)
+ return result, code
# print(f"Deleting application: {app_id}")
def deploy_app(self, app_id: str, app_zones: List[Dict]) -> Dict:
@@ -44,8 +51,8 @@ class EdgeApplicationManager(EdgeCloudManagementInterface):
success_response = []
if app is not None:
for zone in app_zones:
- sf = DeployServiceFunction(service_function_name=app.get('name'),
- service_function_instance_name=app.get('name')+zone.get('edgeCloudZoneName'),
+ sf = DeployServiceFunction(service_function_name=app[0].get('name'),
+ service_function_instance_name=app[0].get('name')+'-'+zone.get('edgeCloudZoneName'),
location=zone.get('edgeCloudZoneName'))
result = deploy_service_function(service_function=sf)
success_response.append(result)
@@ -74,7 +81,7 @@ class EdgeApplicationManager(EdgeCloudManagementInterface):
nodes_response = kubernetes_connector.get_PoPs()
zone_list =[]
- for node in nodes_response.json().get('nodes'):
+ for node in nodes_response:
zone = {}
zone['edgeCloudZoneId'] = node.get('uid')
zone['edgeCloudZoneName'] = node.get('name')
diff --git a/service-resource-manager-implementation/swagger_server/controllers/nodes_controller.py b/service-resource-manager-implementation/swagger_server/controllers/nodes_controller.py
index 9cd1807..46b4892 100644
--- a/service-resource-manager-implementation/swagger_server/controllers/nodes_controller.py
+++ b/service-resource-manager-implementation/swagger_server/controllers/nodes_controller.py
@@ -31,20 +31,19 @@ logger=logging.getLogger(__name__)
# driver=os.environ['DRIVER'].strip()
adapter_name = os.environ['EDGE_CLOUD_ADAPTER_NAME']
-edge_cloud_provider = os.environ['PLATFORM_PROVIDER']
adapter = None
if adapter_name=='aeros':
- from adapters.edgecloud.clients.aeros.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.aeros.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='i2edge':
- from adapters.edgecloud.clients.i2edge.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.i2edge.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='eurecom_platform':
- from adapters.edgecloud.clients.eurecom_platform.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.eurecom_platform.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='piedge':
- from adapters.edgecloud.clients.piedge.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.piedge.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
diff --git a/service-resource-manager-implementation/swagger_server/controllers/service_functions_catalogue_controller.py b/service-resource-manager-implementation/swagger_server/controllers/service_functions_catalogue_controller.py
index 7393e9c..72764b4 100644
--- a/service-resource-manager-implementation/swagger_server/controllers/service_functions_catalogue_controller.py
+++ b/service-resource-manager-implementation/swagger_server/controllers/service_functions_catalogue_controller.py
@@ -2,7 +2,8 @@ import connexion
import six
from swagger_server.models.apps_response import AppsResponse # noqa: E501
from swagger_server.models.apps_response_apps import AppsResponseApps # noqa: E501
-from swagger_server.models.service_function_registration_request import ServiceFunctionRegistrationRequest # noqa: E501
+# from swagger_server.models.service_function_registration_request import ServiceFunctionRegistrationRequest # noqa: E501
+from swagger_server.models.app_manifest import AppManifest
from swagger_server import util
from swagger_server.utils import connector_db
from swagger_server.utils import kubernetes_connector, user_authentication
@@ -16,19 +17,19 @@ edge_cloud_provider = os.environ['PLATFORM_PROVIDER']
adapter = None
if adapter_name=='aeros':
- from adapters.edgecloud.clients.aeros.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.aeros.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='i2edge':
- from adapters.edgecloud.clients.i2edge.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.i2edge.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='eurecom_platform':
- from adapters.edgecloud.clients.eurecom_platform.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.eurecom_platform.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='piedge':
- from adapters.edgecloud.clients.piedge.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.piedge.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
-def deregister_service_function(id: str): # noqa: E501
+def deregister_service_function(service_function_id: str): # noqa: E501
"""Deregister service.
# noqa: E501
@@ -40,21 +41,21 @@ def deregister_service_function(id: str): # noqa: E501
"""
- role = user_authentication.check_role()
- if role is not None and role == "admin":
- try:
+ # role = user_authentication.check_role()
+ # if role is not None and role == "admin":
+ try:
# status_deregistration=connector_db.delete_document_service_function(service_function_name)
- status_deregistration = adapter.delete_onboarded_app(id)
- return status_deregistration
- except Exception as ce_:
+ status_deregistration, code = adapter.delete_onboarded_app(service_function_id)
+ return status_deregistration, code
+ except Exception as ce_:
raise Exception("An exception occurred :", ce_)
- else:
- return "You are not authorized to access the URL requested", 401
+ # else:
+ # return "You are not authorized to access the URL requested", 401
-def get_service_function(id: str): # noqa: E501
+def get_service_function(service_function_id: str): # noqa: E501
"""Returns a specific service function from the catalogue.
# noqa: E501
@@ -68,7 +69,7 @@ def get_service_function(id: str): # noqa: E501
try:
# service_function = connector_db.get_documents_from_collection("service_functions", input_type="name",
# input_value=service_function_name)
- service_function = adapter.get_onboarded_app(id)
+ service_function = adapter.get_onboarded_app(service_function_id)
return service_function
# else:
# return service_function[0]
@@ -92,7 +93,6 @@ def get_service_functions(): # noqa: E501
raise Exception("An exception occurred :", ce_)
-
def register_service_function(body=None): # noqa: E501
"""Register Service.
@@ -104,22 +104,25 @@ def register_service_function(body=None): # noqa: E501
:rtype: None
"""
- role = user_authentication.check_role()
- if role is not None and role == "admin":
- if connexion.request.is_json:
- body = adapter.onboard_app(connexion.request.get_json())
+ # role = user_authentication.check_role()
+ # if role is not None and role == "admin":
+ if connexion.request.is_json:
+ # body = AppManifest.from_dict(connexion.request.get_json())
+ # body = adapter.onboard_app(app_manifest)
# body = ServiceFunctionRegistrationRequest.from_dict(connexion.request.get_json()) # noqa: E501
- insert_doc = body.to_dict()
+ insert_doc = connexion.request.get_json()
+ # insert_doc = body.to_dict()
try:
- result=connector_db.insert_document_service_function(insert_doc)
- if result.acknowledged is True:
- return {'appId': str(result.inserted_id)}
- else:
- return 'Error inserting new application', 400
+ return adapter.onboard_app(insert_doc)
+ # result=connector_db.insert_document_service_function(insert_doc)
+ # if result.acknowledged is True:
+ # return {'appId': str(result.inserted_id)}
+ # else:
+ # return 'Error inserting new application', 400
except Exception as ce_:
return ce_
- else:
- return "You are not authorized to access the URL requested", 401
+ # else:
+ # return "You are not authorized to access the URL requested", 401
#TODO!!!!
def update_service_function(body=None): # noqa: E501
@@ -130,20 +133,20 @@ def update_service_function(body=None): # noqa: E501
:param body: Registration method to update service function into database
:type body: dict | bytes
- :rtype: None
- """
- role = user_authentication.check_role()
- if role is not None and role == "admin":
- if connexion.request.is_json:
- body = ServiceFunctionRegistrationRequest.from_dict(connexion.request.get_json()) # noqa: E501
-
- insert_doc = body.to_dict()
- # insert_doc["kubernetesPlatformName"] = body.kubernetes_platform_name
- # insert_doc["kubernetesAuthCredentials"] = body.kubernetes_auth_credentials.to_dict()
- try:
- response_status = connector_db.update_document_service_function(insert_doc)
- return response_status
- except Exception as ce_:
- raise Exception("An exception occurred :", ce_)
- else:
- return "You are not authorized to access the URL requested", 401
+# :rtype: None
+# """
+# role = user_authentication.check_role()
+# if role is not None and role == "admin":
+# if connexion.request.is_json:
+# body = ServiceFunctionRegistrationRequest.from_dict(connexion.request.get_json()) # noqa: E501
+
+# insert_doc = body.to_dict()
+# # insert_doc["kubernetesPlatformName"] = body.kubernetes_platform_name
+# # insert_doc["kubernetesAuthCredentials"] = body.kubernetes_auth_credentials.to_dict()
+# try:
+# response_status = connector_db.update_document_service_function(insert_doc)
+# return response_status
+# except Exception as ce_:
+# raise Exception("An exception occurred :", ce_)
+# else:
+# return "You are not authorized to access the URL requested", 401
diff --git a/service-resource-manager-implementation/swagger_server/controllers/service_functions_instances_controller.py b/service-resource-manager-implementation/swagger_server/controllers/service_functions_instances_controller.py
index 8c8dc56..76319a3 100644
--- a/service-resource-manager-implementation/swagger_server/controllers/service_functions_instances_controller.py
+++ b/service-resource-manager-implementation/swagger_server/controllers/service_functions_instances_controller.py
@@ -4,6 +4,8 @@ import six
from swagger_server.models.deploy_chain import DeployChain # noqa: E501
from swagger_server.models.deploy_service_function import DeployServiceFunction # noqa: E501
from swagger_server.models.deployedapps_response import DeployedappsResponse # noqa: E501
+from swagger_server.models.edge_cloud_zone import EdgeCloudZone
+from swagger_server.models.deploy_app import DeployApp
from swagger_server import util
from swagger_server.core import piedge_encoder
from swagger_server.utils import connector_db, nodes_monitoring
@@ -20,16 +22,16 @@ edge_cloud_provider = os.environ['PLATFORM_PROVIDER']
adapter = None
if adapter_name=='aeros':
- from adapters.edgecloud.clients.aeros.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.aeros.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='i2edge':
- from adapters.edgecloud.clients.i2edge.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.i2edge.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='eurecom_platform':
- from adapters.edgecloud.clients.eurecom_platform.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.eurecom_platform.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
elif adapter_name=='piedge':
- from adapters.edgecloud.clients.piedge.client import EdgeApplicationManager
+ from swagger_server.adapters.edgecloud.clients.piedge.client import EdgeApplicationManager
adapter = EdgeApplicationManager()
def delete_chain(chain_service_name): # noqa: E501
@@ -112,8 +114,9 @@ def deploy_service_function(): # noqa: E501
# if role is not None and role == "admin":
if connexion.request.is_json:
try:
+ # body = DeployApp.from_dict(connexion.request.get_json())
body = connexion.request.get_json()
- response = adapter.deploy_app(app_id=body.get('appId'), app_zones=body.get('appZones'))
+ response = adapter.deploy_app(app_id=body.get("appId"), app_zones=body.get("appZones"))
# body = DeployServiceFunction.from_dict(connexion.request.get_json())
# response = piedge_encoder.deploy_service_function(body)
return response
diff --git a/service-resource-manager-implementation/swagger_server/core/piedge_encoder.py b/service-resource-manager-implementation/swagger_server/core/piedge_encoder.py
index bb9e4fe..ad33309 100644
--- a/service-resource-manager-implementation/swagger_server/core/piedge_encoder.py
+++ b/service-resource-manager-implementation/swagger_server/core/piedge_encoder.py
@@ -43,11 +43,11 @@ def deploy_service_function(service_function: DeployServiceFunction, paas_name=N
# search if node exists in the node catalogue
- if service_function.location is not None:
- node_ = connector_db.get_documents_from_collection("points_of_presence", input_type="location",
- input_value=service_function.location)
- if not node_:
- return "The given location does not exist in the node catalogue"
+ # if service_function.location is not None:
+ # node_ = connector_db.get_documents_from_collection("points_of_presence", input_type="location",
+ # input_value=service_function.location)
+ # if not node_:
+ # return "The given location does not exist in the node catalogue"
final_deploy_descriptor = {}
# final_deploy_descriptor["name"]=app_[0]["name"]
@@ -84,7 +84,8 @@ def deploy_service_function(service_function: DeployServiceFunction, paas_name=N
#con_["imagePullPolicy"] = "Always"
#ports
- application_ports = ser_function_[0]["application_ports"]
+
+ application_ports = ser_function_[0].get("application_ports")
con_["application_ports"] = application_ports
if service_function.all_node_ports is not None:
@@ -119,7 +120,7 @@ def deploy_service_function(service_function: DeployServiceFunction, paas_name=N
#check volumes!!
req_volumes = []
if "required_volumes" in ser_function_[0]:
- if ser_function_[0]["required_volumes"] is not None:
+ if ser_function_[0].get("required_volumes") is not None:
for required_volumes in ser_function_[0]["required_volumes"]:
req_volumes.append(required_volumes["name"])
vol_mount = []
@@ -138,7 +139,7 @@ def deploy_service_function(service_function: DeployServiceFunction, paas_name=N
if (len(vol_mount) != len(req_volumes)):
return "The selected service function requires " + str(len(req_volumes)) +" volume/ volumes "
else:
- if ser_function_[0]["required_volumes"] is not None:
+ if ser_function_[0].get("required_volumes") is not None:
result = auxiliary_functions.equal_ignore_order(req_volumes, vol_mount)
@@ -163,7 +164,7 @@ def deploy_service_function(service_function: DeployServiceFunction, paas_name=N
if "required_env_parameters" in ser_function_[0]:
- if ser_function_[0]["required_env_parameters"] is not None:
+ if ser_function_[0].get("required_env_parameters") is not None:
for required_env_parameters in ser_function_[0]["required_env_parameters"]:
req_env_parameters.append(required_env_parameters["name"])
env_names = []
@@ -182,7 +183,7 @@ def deploy_service_function(service_function: DeployServiceFunction, paas_name=N
if (len(env_names) != len(req_env_parameters)):
return "The selected service function requires " + str(len(req_env_parameters)) + " env parameters"
else:
- if ser_function_[0]["required_env_parameters"] is not None:
+ if ser_function_[0].get("required_env_parameters") is not None:
result = auxiliary_functions.equal_ignore_order(req_env_parameters, env_names)
@@ -207,7 +208,7 @@ def deploy_service_function(service_function: DeployServiceFunction, paas_name=N
#check autoscaling policies
if "autoscaling_policies" in ser_function_[0]:
- if ser_function_[0]["autoscaling_policies"] is not None:
+ if ser_function_[0].get("autoscaling_policies") is not None:
if service_function.autoscaling_metric is not None:
for scaling_method in ser_function_[0]["autoscaling_policies"]:
if service_function.autoscaling_policy is not None:
diff --git a/service-resource-manager-implementation/swagger_server/models/app_manifest.py b/service-resource-manager-implementation/swagger_server/models/app_manifest.py
new file mode 100644
index 0000000..0e5fa06
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/app_manifest.py
@@ -0,0 +1,247 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server.models.app_manifest_app_repo import AppManifestAppRepo # noqa: F401,E501
+from swagger_server.models.app_manifest_component_spec import AppManifestComponentSpec # noqa: F401,E501
+from swagger_server.models.operating_system import OperatingSystem # noqa: F401,E501
+from swagger_server.models.required_resources import RequiredResources # noqa: F401,E501
+import re # noqa: F401,E501
+from swagger_server import util
+
+
+class AppManifest(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, name: str=None, version: int=None, package_type: str=None, operating_system: OperatingSystem=None, app_repo: AppManifestAppRepo=None, required_resources: RequiredResources=None, component_spec: List[AppManifestComponentSpec]=None): # noqa: E501
+ """AppManifest - a model defined in Swagger
+
+ :param name: The name of this AppManifest. # noqa: E501
+ :type name: str
+ :param version: The version of this AppManifest. # noqa: E501
+ :type version: int
+ :param package_type: The package_type of this AppManifest. # noqa: E501
+ :type package_type: str
+ :param operating_system: The operating_system of this AppManifest. # noqa: E501
+ :type operating_system: OperatingSystem
+ :param app_repo: The app_repo of this AppManifest. # noqa: E501
+ :type app_repo: AppManifestAppRepo
+ :param required_resources: The required_resources of this AppManifest. # noqa: E501
+ :type required_resources: RequiredResources
+ :param component_spec: The component_spec of this AppManifest. # noqa: E501
+ :type component_spec: List[AppManifestComponentSpec]
+ """
+ self.swagger_types = {
+ 'name': str,
+ 'version': int,
+ 'package_type': str,
+ 'operating_system': OperatingSystem,
+ 'app_repo': AppManifestAppRepo,
+ 'required_resources': RequiredResources,
+ 'component_spec': List[AppManifestComponentSpec]
+ }
+
+ self.attribute_map = {
+ 'name': 'name',
+ 'version': 'version',
+ 'package_type': 'packageType',
+ 'operating_system': 'operatingSystem',
+ 'app_repo': 'appRepo',
+ 'required_resources': 'requiredResources',
+ 'component_spec': 'componentSpec'
+ }
+ self._name = name
+ self._version = version
+ self._package_type = package_type
+ self._operating_system = operating_system
+ self._app_repo = app_repo
+ self._required_resources = required_resources
+ self._component_spec = component_spec
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'AppManifest':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The AppManifest of this AppManifest. # noqa: E501
+ :rtype: AppManifest
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def name(self) -> str:
+ """Gets the name of this AppManifest.
+
+ Name of the application. # noqa: E501
+
+ :return: The name of this AppManifest.
+ :rtype: str
+ """
+ return self._name
+
+ @name.setter
+ def name(self, name: str):
+ """Sets the name of this AppManifest.
+
+ Name of the application. # noqa: E501
+
+ :param name: The name of this AppManifest.
+ :type name: str
+ """
+ if name is None:
+ raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
+
+ self._name = name
+
+ @property
+ def version(self) -> int:
+ """Gets the version of this AppManifest.
+
+ Application version information # noqa: E501
+
+ :return: The version of this AppManifest.
+ :rtype: int
+ """
+ return self._version
+
+ @version.setter
+ def version(self, version: int):
+ """Sets the version of this AppManifest.
+
+ Application version information # noqa: E501
+
+ :param version: The version of this AppManifest.
+ :type version: int
+ """
+ if version is None:
+ raise ValueError("Invalid value for `version`, must not be `None`") # noqa: E501
+
+ self._version = version
+
+ @property
+ def package_type(self) -> str:
+ """Gets the package_type of this AppManifest.
+
+ Format of the application image package # noqa: E501
+
+ :return: The package_type of this AppManifest.
+ :rtype: str
+ """
+ return self._package_type
+
+ @package_type.setter
+ def package_type(self, package_type: str):
+ """Sets the package_type of this AppManifest.
+
+ Format of the application image package # noqa: E501
+
+ :param package_type: The package_type of this AppManifest.
+ :type package_type: str
+ """
+ allowed_values = ["QCOW2", "OVA", "CONTAINER", "HELM"] # noqa: E501
+ if package_type not in allowed_values:
+ raise ValueError(
+ "Invalid value for `package_type` ({0}), must be one of {1}"
+ .format(package_type, allowed_values)
+ )
+
+ self._package_type = package_type
+
+ @property
+ def operating_system(self) -> OperatingSystem:
+ """Gets the operating_system of this AppManifest.
+
+
+ :return: The operating_system of this AppManifest.
+ :rtype: OperatingSystem
+ """
+ return self._operating_system
+
+ @operating_system.setter
+ def operating_system(self, operating_system: OperatingSystem):
+ """Sets the operating_system of this AppManifest.
+
+
+ :param operating_system: The operating_system of this AppManifest.
+ :type operating_system: OperatingSystem
+ """
+
+ self._operating_system = operating_system
+
+ @property
+ def app_repo(self) -> AppManifestAppRepo:
+ """Gets the app_repo of this AppManifest.
+
+
+ :return: The app_repo of this AppManifest.
+ :rtype: AppManifestAppRepo
+ """
+ return self._app_repo
+
+ @app_repo.setter
+ def app_repo(self, app_repo: AppManifestAppRepo):
+ """Sets the app_repo of this AppManifest.
+
+
+ :param app_repo: The app_repo of this AppManifest.
+ :type app_repo: AppManifestAppRepo
+ """
+ if app_repo is None:
+ raise ValueError("Invalid value for `app_repo`, must not be `None`") # noqa: E501
+
+ self._app_repo = app_repo
+
+ @property
+ def required_resources(self) -> RequiredResources:
+ """Gets the required_resources of this AppManifest.
+
+
+ :return: The required_resources of this AppManifest.
+ :rtype: RequiredResources
+ """
+ return self._required_resources
+
+ @required_resources.setter
+ def required_resources(self, required_resources: RequiredResources):
+ """Sets the required_resources of this AppManifest.
+
+
+ :param required_resources: The required_resources of this AppManifest.
+ :type required_resources: RequiredResources
+ """
+ if required_resources is None:
+ raise ValueError("Invalid value for `required_resources`, must not be `None`") # noqa: E501
+
+ self._required_resources = required_resources
+
+ @property
+ def component_spec(self) -> List[AppManifestComponentSpec]:
+ """Gets the component_spec of this AppManifest.
+
+ Information defined in \"appRepo\" point to the application descriptor e.g. Helm chart, docker-compose yaml file etc. The descriptor may contain one or more containers and their associated meta-data. A component refers to additional details about these containers to expose the instances of the containers to external client applications. App provider can define one or more components (via the associated network port) in componentSpec corresponding to the containers in helm charts or docker-compose yaml file as part of app descriptors. # noqa: E501
+
+ :return: The component_spec of this AppManifest.
+ :rtype: List[AppManifestComponentSpec]
+ """
+ return self._component_spec
+
+ @component_spec.setter
+ def component_spec(self, component_spec: List[AppManifestComponentSpec]):
+ """Sets the component_spec of this AppManifest.
+
+ Information defined in \"appRepo\" point to the application descriptor e.g. Helm chart, docker-compose yaml file etc. The descriptor may contain one or more containers and their associated meta-data. A component refers to additional details about these containers to expose the instances of the containers to external client applications. App provider can define one or more components (via the associated network port) in componentSpec corresponding to the containers in helm charts or docker-compose yaml file as part of app descriptors. # noqa: E501
+
+ :param component_spec: The component_spec of this AppManifest.
+ :type component_spec: List[AppManifestComponentSpec]
+ """
+ if component_spec is None:
+ raise ValueError("Invalid value for `component_spec`, must not be `None`") # noqa: E501
+
+ self._component_spec = component_spec
diff --git a/service-resource-manager-implementation/swagger_server/models/app_manifest_app_repo.py b/service-resource-manager-implementation/swagger_server/models/app_manifest_app_repo.py
new file mode 100644
index 0000000..37c3d85
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/app_manifest_app_repo.py
@@ -0,0 +1,217 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server.models.uri import Uri # noqa: F401,E501
+from swagger_server import util
+
+
+class AppManifestAppRepo(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, type: str=None, image_path: Uri=None, user_name: str=None, credentials: str=None, auth_type: str=None, checksum: str=None): # noqa: E501
+ """AppManifestAppRepo - a model defined in Swagger
+
+ :param type: The type of this AppManifestAppRepo. # noqa: E501
+ :type type: str
+ :param image_path: The image_path of this AppManifestAppRepo. # noqa: E501
+ :type image_path: Uri
+ :param user_name: The user_name of this AppManifestAppRepo. # noqa: E501
+ :type user_name: str
+ :param credentials: The credentials of this AppManifestAppRepo. # noqa: E501
+ :type credentials: str
+ :param auth_type: The auth_type of this AppManifestAppRepo. # noqa: E501
+ :type auth_type: str
+ :param checksum: The checksum of this AppManifestAppRepo. # noqa: E501
+ :type checksum: str
+ """
+ self.swagger_types = {
+ 'type': str,
+ 'image_path': Uri,
+ 'user_name': str,
+ 'credentials': str,
+ 'auth_type': str,
+ 'checksum': str
+ }
+
+ self.attribute_map = {
+ 'type': 'type',
+ 'image_path': 'imagePath',
+ 'user_name': 'userName',
+ 'credentials': 'credentials',
+ 'auth_type': 'authType',
+ 'checksum': 'checksum'
+ }
+ self._type = type
+ self._image_path = image_path
+ self._user_name = user_name
+ self._credentials = credentials
+ self._auth_type = auth_type
+ self._checksum = checksum
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'AppManifestAppRepo':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The AppManifest_appRepo of this AppManifestAppRepo. # noqa: E501
+ :rtype: AppManifestAppRepo
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def type(self) -> str:
+ """Gets the type of this AppManifestAppRepo.
+
+ Application repository and image URI information. PUBLICREPO is used of public urls like github, helm repo etc. PRIVATEREPO is used for private repo managed by the application developer. Private repo can be accessed by using the app developer provided userName and password. Password is recommended to be the personal access token created by developer e.g. in Github repo. # noqa: E501
+
+ :return: The type of this AppManifestAppRepo.
+ :rtype: str
+ """
+ return self._type
+
+ @type.setter
+ def type(self, type: str):
+ """Sets the type of this AppManifestAppRepo.
+
+ Application repository and image URI information. PUBLICREPO is used of public urls like github, helm repo etc. PRIVATEREPO is used for private repo managed by the application developer. Private repo can be accessed by using the app developer provided userName and password. Password is recommended to be the personal access token created by developer e.g. in Github repo. # noqa: E501
+
+ :param type: The type of this AppManifestAppRepo.
+ :type type: str
+ """
+ allowed_values = ["PRIVATEREPO", "PUBLICREPO"] # noqa: E501
+ if type not in allowed_values:
+ raise ValueError(
+ "Invalid value for `type` ({0}), must be one of {1}"
+ .format(type, allowed_values)
+ )
+
+ self._type = type
+
+ @property
+ def image_path(self) -> Uri:
+ """Gets the image_path of this AppManifestAppRepo.
+
+
+ :return: The image_path of this AppManifestAppRepo.
+ :rtype: Uri
+ """
+ return self._image_path
+
+ @image_path.setter
+ def image_path(self, image_path: Uri):
+ """Sets the image_path of this AppManifestAppRepo.
+
+
+ :param image_path: The image_path of this AppManifestAppRepo.
+ :type image_path: Uri
+ """
+ if image_path is None:
+ raise ValueError("Invalid value for `image_path`, must not be `None`") # noqa: E501
+
+ self._image_path = image_path
+
+ @property
+ def user_name(self) -> str:
+ """Gets the user_name of this AppManifestAppRepo.
+
+ Username to acces the Helm chart, docker-compose file or VM image repository # noqa: E501
+
+ :return: The user_name of this AppManifestAppRepo.
+ :rtype: str
+ """
+ return self._user_name
+
+ @user_name.setter
+ def user_name(self, user_name: str):
+ """Sets the user_name of this AppManifestAppRepo.
+
+ Username to acces the Helm chart, docker-compose file or VM image repository # noqa: E501
+
+ :param user_name: The user_name of this AppManifestAppRepo.
+ :type user_name: str
+ """
+
+ self._user_name = user_name
+
+ @property
+ def credentials(self) -> str:
+ """Gets the credentials of this AppManifestAppRepo.
+
+ Password or personal access token created by developer to acces the app repository. API users can generate a personal access token e.g. docker clients to use them as password. # noqa: E501
+
+ :return: The credentials of this AppManifestAppRepo.
+ :rtype: str
+ """
+ return self._credentials
+
+ @credentials.setter
+ def credentials(self, credentials: str):
+ """Sets the credentials of this AppManifestAppRepo.
+
+ Password or personal access token created by developer to acces the app repository. API users can generate a personal access token e.g. docker clients to use them as password. # noqa: E501
+
+ :param credentials: The credentials of this AppManifestAppRepo.
+ :type credentials: str
+ """
+
+ self._credentials = credentials
+
+ @property
+ def auth_type(self) -> str:
+ """Gets the auth_type of this AppManifestAppRepo.
+
+ The credentials can also be formatted as a Basic auth or Bearer auth in HTTP \"Authorization\" header. # noqa: E501
+
+ :return: The auth_type of this AppManifestAppRepo.
+ :rtype: str
+ """
+ return self._auth_type
+
+ @auth_type.setter
+ def auth_type(self, auth_type: str):
+ """Sets the auth_type of this AppManifestAppRepo.
+
+ The credentials can also be formatted as a Basic auth or Bearer auth in HTTP \"Authorization\" header. # noqa: E501
+
+ :param auth_type: The auth_type of this AppManifestAppRepo.
+ :type auth_type: str
+ """
+ allowed_values = ["DOCKER", "HTTP_BASIC", "HTTP_BEARER", "NONE"] # noqa: E501
+ if auth_type not in allowed_values:
+ raise ValueError(
+ "Invalid value for `auth_type` ({0}), must be one of {1}"
+ .format(auth_type, allowed_values)
+ )
+
+ self._auth_type = auth_type
+
+ @property
+ def checksum(self) -> str:
+ """Gets the checksum of this AppManifestAppRepo.
+
+ MD5 checksum for VM and file-based images, sha256 digest for containers # noqa: E501
+
+ :return: The checksum of this AppManifestAppRepo.
+ :rtype: str
+ """
+ return self._checksum
+
+ @checksum.setter
+ def checksum(self, checksum: str):
+ """Sets the checksum of this AppManifestAppRepo.
+
+ MD5 checksum for VM and file-based images, sha256 digest for containers # noqa: E501
+
+ :param checksum: The checksum of this AppManifestAppRepo.
+ :type checksum: str
+ """
+
+ self._checksum = checksum
diff --git a/service-resource-manager-implementation/swagger_server/models/app_manifest_component_spec.py b/service-resource-manager-implementation/swagger_server/models/app_manifest_component_spec.py
new file mode 100644
index 0000000..69d3e20
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/app_manifest_component_spec.py
@@ -0,0 +1,97 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server.models.app_manifest_network_interfaces import AppManifestNetworkInterfaces # noqa: F401,E501
+from swagger_server import util
+
+
+class AppManifestComponentSpec(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, component_name: str=None, network_interfaces: List[AppManifestNetworkInterfaces]=None): # noqa: E501
+ """AppManifestComponentSpec - a model defined in Swagger
+
+ :param component_name: The component_name of this AppManifestComponentSpec. # noqa: E501
+ :type component_name: str
+ :param network_interfaces: The network_interfaces of this AppManifestComponentSpec. # noqa: E501
+ :type network_interfaces: List[AppManifestNetworkInterfaces]
+ """
+ self.swagger_types = {
+ 'component_name': str,
+ 'network_interfaces': List[AppManifestNetworkInterfaces]
+ }
+
+ self.attribute_map = {
+ 'component_name': 'componentName',
+ 'network_interfaces': 'networkInterfaces'
+ }
+ self._component_name = component_name
+ self._network_interfaces = network_interfaces
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'AppManifestComponentSpec':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The AppManifest_componentSpec of this AppManifestComponentSpec. # noqa: E501
+ :rtype: AppManifestComponentSpec
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def component_name(self) -> str:
+ """Gets the component_name of this AppManifestComponentSpec.
+
+ Component name must be unique with an application # noqa: E501
+
+ :return: The component_name of this AppManifestComponentSpec.
+ :rtype: str
+ """
+ return self._component_name
+
+ @component_name.setter
+ def component_name(self, component_name: str):
+ """Sets the component_name of this AppManifestComponentSpec.
+
+ Component name must be unique with an application # noqa: E501
+
+ :param component_name: The component_name of this AppManifestComponentSpec.
+ :type component_name: str
+ """
+ if component_name is None:
+ raise ValueError("Invalid value for `component_name`, must not be `None`") # noqa: E501
+
+ self._component_name = component_name
+
+ @property
+ def network_interfaces(self) -> List[AppManifestNetworkInterfaces]:
+ """Gets the network_interfaces of this AppManifestComponentSpec.
+
+ Each application component exposes some ports either for external users or for inter component communication. Application provider is required to specify which ports are to be exposed and the type of traffic that will flow through these ports.The underlying platform may assign a dynamic port against the \"extPort\" that the application clients will use to connect with edge application instance. # noqa: E501
+
+ :return: The network_interfaces of this AppManifestComponentSpec.
+ :rtype: List[AppManifestNetworkInterfaces]
+ """
+ return self._network_interfaces
+
+ @network_interfaces.setter
+ def network_interfaces(self, network_interfaces: List[AppManifestNetworkInterfaces]):
+ """Sets the network_interfaces of this AppManifestComponentSpec.
+
+ Each application component exposes some ports either for external users or for inter component communication. Application provider is required to specify which ports are to be exposed and the type of traffic that will flow through these ports.The underlying platform may assign a dynamic port against the \"extPort\" that the application clients will use to connect with edge application instance. # noqa: E501
+
+ :param network_interfaces: The network_interfaces of this AppManifestComponentSpec.
+ :type network_interfaces: List[AppManifestNetworkInterfaces]
+ """
+ if network_interfaces is None:
+ raise ValueError("Invalid value for `network_interfaces`, must not be `None`") # noqa: E501
+
+ self._network_interfaces = network_interfaces
diff --git a/service-resource-manager-implementation/swagger_server/models/app_manifest_network_interfaces.py b/service-resource-manager-implementation/swagger_server/models/app_manifest_network_interfaces.py
new file mode 100644
index 0000000..be8283e
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/app_manifest_network_interfaces.py
@@ -0,0 +1,165 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+import re # noqa: F401,E501
+from swagger_server import util
+
+
+class AppManifestNetworkInterfaces(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, interface_id: str=None, protocol: str=None, port: int=None, visibility_type: str=None): # noqa: E501
+ """AppManifestNetworkInterfaces - a model defined in Swagger
+
+ :param interface_id: The interface_id of this AppManifestNetworkInterfaces. # noqa: E501
+ :type interface_id: str
+ :param protocol: The protocol of this AppManifestNetworkInterfaces. # noqa: E501
+ :type protocol: str
+ :param port: The port of this AppManifestNetworkInterfaces. # noqa: E501
+ :type port: int
+ :param visibility_type: The visibility_type of this AppManifestNetworkInterfaces. # noqa: E501
+ :type visibility_type: str
+ """
+ self.swagger_types = {
+ 'interface_id': str,
+ 'protocol': str,
+ 'port': int,
+ 'visibility_type': str
+ }
+
+ self.attribute_map = {
+ 'interface_id': 'interfaceId',
+ 'protocol': 'protocol',
+ 'port': 'port',
+ 'visibility_type': 'visibilityType'
+ }
+ self._interface_id = interface_id
+ self._protocol = protocol
+ self._port = port
+ self._visibility_type = visibility_type
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'AppManifestNetworkInterfaces':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The AppManifest_networkInterfaces of this AppManifestNetworkInterfaces. # noqa: E501
+ :rtype: AppManifestNetworkInterfaces
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def interface_id(self) -> str:
+ """Gets the interface_id of this AppManifestNetworkInterfaces.
+
+ Each Port and corresponding traffic protocol exposed by the component is identified by a name. Application client on user device requires this to uniquley idenify the interface. # noqa: E501
+
+ :return: The interface_id of this AppManifestNetworkInterfaces.
+ :rtype: str
+ """
+ return self._interface_id
+
+ @interface_id.setter
+ def interface_id(self, interface_id: str):
+ """Sets the interface_id of this AppManifestNetworkInterfaces.
+
+ Each Port and corresponding traffic protocol exposed by the component is identified by a name. Application client on user device requires this to uniquley idenify the interface. # noqa: E501
+
+ :param interface_id: The interface_id of this AppManifestNetworkInterfaces.
+ :type interface_id: str
+ """
+ if interface_id is None:
+ raise ValueError("Invalid value for `interface_id`, must not be `None`") # noqa: E501
+
+ self._interface_id = interface_id
+
+ @property
+ def protocol(self) -> str:
+ """Gets the protocol of this AppManifestNetworkInterfaces.
+
+ Defines the IP transport communication protocol i.e., TCP, UDP or ANY # noqa: E501
+
+ :return: The protocol of this AppManifestNetworkInterfaces.
+ :rtype: str
+ """
+ return self._protocol
+
+ @protocol.setter
+ def protocol(self, protocol: str):
+ """Sets the protocol of this AppManifestNetworkInterfaces.
+
+ Defines the IP transport communication protocol i.e., TCP, UDP or ANY # noqa: E501
+
+ :param protocol: The protocol of this AppManifestNetworkInterfaces.
+ :type protocol: str
+ """
+ allowed_values = ["TCP", "UDP", "ANY"] # noqa: E501
+ if protocol not in allowed_values:
+ raise ValueError(
+ "Invalid value for `protocol` ({0}), must be one of {1}"
+ .format(protocol, allowed_values)
+ )
+
+ self._protocol = protocol
+
+ @property
+ def port(self) -> int:
+ """Gets the port of this AppManifestNetworkInterfaces.
+
+ Port number exposed by the component. Edge Cloud Provider may generate a dynamic port towards the component instance which forwards external traffic to the component port. # noqa: E501
+
+ :return: The port of this AppManifestNetworkInterfaces.
+ :rtype: int
+ """
+ return self._port
+
+ @port.setter
+ def port(self, port: int):
+ """Sets the port of this AppManifestNetworkInterfaces.
+
+ Port number exposed by the component. Edge Cloud Provider may generate a dynamic port towards the component instance which forwards external traffic to the component port. # noqa: E501
+
+ :param port: The port of this AppManifestNetworkInterfaces.
+ :type port: int
+ """
+ if port is None:
+ raise ValueError("Invalid value for `port`, must not be `None`") # noqa: E501
+
+ self._port = port
+
+ @property
+ def visibility_type(self) -> str:
+ """Gets the visibility_type of this AppManifestNetworkInterfaces.
+
+ Defines whether the interface is exposed to outer world or not i.e., external, or internal. If this is set to \"external\", then it is exposed to external applications otherwise it is exposed internally to edge application components within edge cloud. When exposed to external world, an external dynamic port is assigned for UC traffic and mapped to the extPort # noqa: E501
+
+ :return: The visibility_type of this AppManifestNetworkInterfaces.
+ :rtype: str
+ """
+ return self._visibility_type
+
+ @visibility_type.setter
+ def visibility_type(self, visibility_type: str):
+ """Sets the visibility_type of this AppManifestNetworkInterfaces.
+
+ Defines whether the interface is exposed to outer world or not i.e., external, or internal. If this is set to \"external\", then it is exposed to external applications otherwise it is exposed internally to edge application components within edge cloud. When exposed to external world, an external dynamic port is assigned for UC traffic and mapped to the extPort # noqa: E501
+
+ :param visibility_type: The visibility_type of this AppManifestNetworkInterfaces.
+ :type visibility_type: str
+ """
+ allowed_values = ["VISIBILITY_EXTERNAL", "VISIBILITY_INTERNAL"] # noqa: E501
+ if visibility_type not in allowed_values:
+ raise ValueError(
+ "Invalid value for `visibility_type` ({0}), must be one of {1}"
+ .format(visibility_type, allowed_values)
+ )
+
+ self._visibility_type = visibility_type
diff --git a/service-resource-manager-implementation/swagger_server/models/deploy_app.py b/service-resource-manager-implementation/swagger_server/models/deploy_app.py
new file mode 100644
index 0000000..13a5ce6
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/deploy_app.py
@@ -0,0 +1,87 @@
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+from swagger_server.models.base_model_ import Model
+from swagger_server.models.edge_cloud_zone import EdgeCloudZone
+from swagger_server import util
+
+from typing import List
+
+class DeployApp(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, app_id: str, app_zones: List[EdgeCloudZone]): # noqa: E501
+ """EdgeCloudZone - a model defined in Swagger
+
+ :param appId: The appId of this DeployApp. # noqa: E501
+ :type appId: Deploy App Id
+ :param edge_cloud_zone_name: The edge_cloud_zone_name of this EdgeCloudZone. # noqa: E501
+ :type edge_cloud_zone_name: EdgeCloudZoneName
+
+ """
+ self.swagger_types = {
+ 'app_id': str,
+ 'app_zones': List
+ }
+
+ self.attribute_map = {
+ 'app_id': 'appId',
+ 'app_zones': 'appZones'
+ }
+ self._app_id = app_id
+ self._app_zones = app_zones
+
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'DeployApp':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The EdgeCloudZone of this EdgeCloudZone. # noqa: E501
+ :rtype: EdgeCloudZone
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def app_id(self) -> str:
+ """Gets the edge_cloud_zone_id of this EdgeCloudZone.
+
+
+ :return: The edge_cloud_zone_id of this EdgeCloudZone.
+ :rtype: EdgeCloudZoneId
+ """
+ return self._app_id
+
+ @app_id.setter
+ def app_id(self, app_id: str):
+ """Sets the edge_cloud_zone_id of this EdgeCloudZone.
+
+
+ :param edge_cloud_zone_id: The edge_cloud_zone_id of this EdgeCloudZone.
+ :type edge_cloud_zone_id: EdgeCloudZoneId
+ """
+
+ self._app_id = app_id
+
+ @property
+ def app_zones(self) -> List[EdgeCloudZone]:
+ """Gets the edge_cloud_zone_name of this EdgeCloudZone.
+
+
+ :return: The edge_cloud_zone_name of this EdgeCloudZone.
+ :rtype: EdgeCloudZoneName
+ """
+ return self._app_zones
+
+ @app_zones.setter
+ def app_zones(self, app_zones: List[EdgeCloudZone]):
+ """Sets the edge_cloud_zone_name of this EdgeCloudZone.
+
+
+ :param edge_cloud_zone_name: The edge_cloud_zone_name of this EdgeCloudZone.
+ :type edge_cloud_zone_name: EdgeCloudZoneName
+ """
+
+ self._app_zones = app_zones
\ No newline at end of file
diff --git a/service-resource-manager-implementation/swagger_server/models/edge_cloud_provider.py b/service-resource-manager-implementation/swagger_server/models/edge_cloud_provider.py
new file mode 100644
index 0000000..4e14675
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/edge_cloud_provider.py
@@ -0,0 +1,36 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server import util
+
+
+class EdgeCloudProvider(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self): # noqa: E501
+ """EdgeCloudProvider - a model defined in Swagger
+
+ """
+ self.swagger_types = {
+ }
+
+ self.attribute_map = {
+ }
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'EdgeCloudProvider':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The EdgeCloudProvider of this EdgeCloudProvider. # noqa: E501
+ :rtype: EdgeCloudProvider
+ """
+ return util.deserialize_model(dikt, cls)
diff --git a/service-resource-manager-implementation/swagger_server/models/edge_cloud_region.py b/service-resource-manager-implementation/swagger_server/models/edge_cloud_region.py
new file mode 100644
index 0000000..2ae421c
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/edge_cloud_region.py
@@ -0,0 +1,36 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server import util
+
+
+class EdgeCloudRegion(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self): # noqa: E501
+ """EdgeCloudRegion - a model defined in Swagger
+
+ """
+ self.swagger_types = {
+ }
+
+ self.attribute_map = {
+ }
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'EdgeCloudRegion':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The EdgeCloudRegion of this EdgeCloudRegion. # noqa: E501
+ :rtype: EdgeCloudRegion
+ """
+ return util.deserialize_model(dikt, cls)
diff --git a/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone.py b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone.py
new file mode 100644
index 0000000..741b686
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone.py
@@ -0,0 +1,171 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server.models.edge_cloud_provider import EdgeCloudProvider # noqa: F401,E501
+from swagger_server.models.edge_cloud_region import EdgeCloudRegion # noqa: F401,E501
+from swagger_server.models.edge_cloud_zone_id import EdgeCloudZoneId # noqa: F401,E501
+from swagger_server.models.edge_cloud_zone_name import EdgeCloudZoneName # noqa: F401,E501
+from swagger_server.models.edge_cloud_zone_status import EdgeCloudZoneStatus # noqa: F401,E501
+from swagger_server import util
+
+
+class EdgeCloudZone(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, edge_cloud_zone_id: str=None, edge_cloud_zone_name: str=None, edge_cloud_zone_status: str=None, edge_cloud_provider: str=None, edge_cloud_region: str=None): # noqa: E501
+ """EdgeCloudZone - a model defined in Swagger
+
+ :param edge_cloud_zone_id: The edge_cloud_zone_id of this EdgeCloudZone. # noqa: E501
+ :type edge_cloud_zone_id: EdgeCloudZoneId
+ :param edge_cloud_zone_name: The edge_cloud_zone_name of this EdgeCloudZone. # noqa: E501
+ :type edge_cloud_zone_name: EdgeCloudZoneName
+ :param edge_cloud_zone_status: The edge_cloud_zone_status of this EdgeCloudZone. # noqa: E501
+ :type edge_cloud_zone_status: EdgeCloudZoneStatus
+ :param edge_cloud_provider: The edge_cloud_provider of this EdgeCloudZone. # noqa: E501
+ :type edge_cloud_provider: EdgeCloudProvider
+ :param edge_cloud_region: The edge_cloud_region of this EdgeCloudZone. # noqa: E501
+ :type edge_cloud_region: EdgeCloudRegion
+ """
+ self.swagger_types = {
+ 'edge_cloud_zone_id': str,
+ 'edge_cloud_zone_name': str,
+ 'edge_cloud_zone_status': str,
+ 'edge_cloud_provider': str,
+ 'edge_cloud_region': str
+ }
+
+ self.attribute_map = {
+ 'edge_cloud_zone_id': 'edgeCloudZoneId',
+ 'edge_cloud_zone_name': 'edgeCloudZoneName',
+ 'edge_cloud_zone_status': 'edgeCloudZoneStatus',
+ 'edge_cloud_provider': 'edgeCloudProvider',
+ 'edge_cloud_region': 'edgeCloudRegion'
+ }
+ self._edge_cloud_zone_id = edge_cloud_zone_id
+ self._edge_cloud_zone_name = edge_cloud_zone_name
+ self._edge_cloud_zone_status = edge_cloud_zone_status
+ self._edge_cloud_provider = edge_cloud_provider
+ self._edge_cloud_region = edge_cloud_region
+
+ @classmethod
+ def from_dict(cls, dikt) -> str:
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The EdgeCloudZone of this EdgeCloudZone. # noqa: E501
+ :rtype: EdgeCloudZone
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def edge_cloud_zone_id(self) -> str:
+ """Gets the edge_cloud_zone_id of this EdgeCloudZone.
+
+
+ :return: The edge_cloud_zone_id of this EdgeCloudZone.
+ :rtype: EdgeCloudZoneId
+ """
+ return self._edge_cloud_zone_id
+
+ @edge_cloud_zone_id.setter
+ def edge_cloud_zone_id(self, edge_cloud_zone_id: str):
+ """Sets the edge_cloud_zone_id of this EdgeCloudZone.
+
+
+ :param edge_cloud_zone_id: The edge_cloud_zone_id of this EdgeCloudZone.
+ :type edge_cloud_zone_id: EdgeCloudZoneId
+ """
+
+ self._edge_cloud_zone_id = edge_cloud_zone_id
+
+ @property
+ def edge_cloud_zone_name(self) -> str:
+ """Gets the edge_cloud_zone_name of this EdgeCloudZone.
+
+
+ :return: The edge_cloud_zone_name of this EdgeCloudZone.
+ :rtype: EdgeCloudZoneName
+ """
+ return self._edge_cloud_zone_name
+
+ @edge_cloud_zone_name.setter
+ def edge_cloud_zone_name(self, edge_cloud_zone_name: str):
+ """Sets the edge_cloud_zone_name of this EdgeCloudZone.
+
+
+ :param edge_cloud_zone_name: The edge_cloud_zone_name of this EdgeCloudZone.
+ :type edge_cloud_zone_name: EdgeCloudZoneName
+ """
+
+ self._edge_cloud_zone_name = edge_cloud_zone_name
+
+ @property
+ def edge_cloud_zone_status(self) -> str:
+ """Gets the edge_cloud_zone_status of this EdgeCloudZone.
+
+
+ :return: The edge_cloud_zone_status of this EdgeCloudZone.
+ :rtype: EdgeCloudZoneStatus
+ """
+ return self._edge_cloud_zone_status
+
+ @edge_cloud_zone_status.setter
+ def edge_cloud_zone_status(self, edge_cloud_zone_status: str):
+ """Sets the edge_cloud_zone_status of this EdgeCloudZone.
+
+
+ :param edge_cloud_zone_status: The edge_cloud_zone_status of this EdgeCloudZone.
+ :type edge_cloud_zone_status: EdgeCloudZoneStatus
+ """
+
+ self._edge_cloud_zone_status = edge_cloud_zone_status
+
+ @property
+ def edge_cloud_provider(self) -> str:
+ """Gets the edge_cloud_provider of this EdgeCloudZone.
+
+
+ :return: The edge_cloud_provider of this EdgeCloudZone.
+ :rtype: EdgeCloudProvider
+ """
+ return self._edge_cloud_provider
+
+ @edge_cloud_provider.setter
+ def edge_cloud_provider(self, edge_cloud_provider: str):
+ """Sets the edge_cloud_provider of this EdgeCloudZone.
+
+
+ :param edge_cloud_provider: The edge_cloud_provider of this EdgeCloudZone.
+ :type edge_cloud_provider: EdgeCloudProvider
+ """
+
+ self._edge_cloud_provider = edge_cloud_provider
+
+ @property
+ def edge_cloud_region(self) -> str:
+ """Gets the edge_cloud_region of this EdgeCloudZone.
+
+
+ :return: The edge_cloud_region of this EdgeCloudZone.
+ :rtype: EdgeCloudRegion
+ """
+ return self._edge_cloud_region
+
+ @edge_cloud_region.setter
+ def edge_cloud_region(self, edge_cloud_region: str):
+ """Sets the edge_cloud_region of this EdgeCloudZone.
+
+
+ :param edge_cloud_region: The edge_cloud_region of this EdgeCloudZone.
+ :type edge_cloud_region: EdgeCloudRegion
+ """
+
+ self._edge_cloud_region = edge_cloud_region
diff --git a/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_id.py b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_id.py
new file mode 100644
index 0000000..0528c90
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_id.py
@@ -0,0 +1,36 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server import util
+
+
+class EdgeCloudZoneId(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self): # noqa: E501
+ """EdgeCloudZoneId - a model defined in Swagger
+
+ """
+ self.swagger_types = {
+ }
+
+ self.attribute_map = {
+ }
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'EdgeCloudZoneId':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The EdgeCloudZoneId of this EdgeCloudZoneId. # noqa: E501
+ :rtype: EdgeCloudZoneId
+ """
+ return util.deserialize_model(dikt, cls)
diff --git a/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_name.py b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_name.py
new file mode 100644
index 0000000..c1ab928
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_name.py
@@ -0,0 +1,36 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server import util
+
+
+class EdgeCloudZoneName(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self): # noqa: E501
+ """EdgeCloudZoneName - a model defined in Swagger
+
+ """
+ self.swagger_types = {
+ }
+
+ self.attribute_map = {
+ }
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'EdgeCloudZoneName':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The EdgeCloudZoneName of this EdgeCloudZoneName. # noqa: E501
+ :rtype: EdgeCloudZoneName
+ """
+ return util.deserialize_model(dikt, cls)
diff --git a/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_status.py b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_status.py
new file mode 100644
index 0000000..f60d1be
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zone_status.py
@@ -0,0 +1,43 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server import util
+
+
+class EdgeCloudZoneStatus(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+
+ """
+ allowed enum values
+ """
+ ACTIVE = "active"
+ INACTIVE = "inactive"
+ UNKNOWN = "unknown"
+ def __init__(self): # noqa: E501
+ """EdgeCloudZoneStatus - a model defined in Swagger
+
+ """
+ self.swagger_types = {
+ }
+
+ self.attribute_map = {
+ }
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'EdgeCloudZoneStatus':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The EdgeCloudZoneStatus of this EdgeCloudZoneStatus. # noqa: E501
+ :rtype: EdgeCloudZoneStatus
+ """
+ return util.deserialize_model(dikt, cls)
diff --git a/service-resource-manager-implementation/swagger_server/models/edge_cloud_zones.py b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zones.py
new file mode 100644
index 0000000..0e087f8
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/edge_cloud_zones.py
@@ -0,0 +1,37 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server.models.edge_cloud_zone import EdgeCloudZone # noqa: F401,E501
+from swagger_server import util
+
+
+class EdgeCloudZones(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self): # noqa: E501
+ """EdgeCloudZones - a model defined in Swagger
+
+ """
+ self.swagger_types = {
+ }
+
+ self.attribute_map = {
+ }
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'EdgeCloudZones':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The EdgeCloudZones of this EdgeCloudZones. # noqa: E501
+ :rtype: EdgeCloudZones
+ """
+ return util.deserialize_model(dikt, cls)
diff --git a/service-resource-manager-implementation/swagger_server/models/gpu_info.py b/service-resource-manager-implementation/swagger_server/models/gpu_info.py
new file mode 100644
index 0000000..b480f2b
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/gpu_info.py
@@ -0,0 +1,96 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server import util
+
+
+class GpuInfo(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, gpu_memory: int=None, num_gpu: int=None): # noqa: E501
+ """GpuInfo - a model defined in Swagger
+
+ :param gpu_memory: The gpu_memory of this GpuInfo. # noqa: E501
+ :type gpu_memory: int
+ :param num_gpu: The num_gpu of this GpuInfo. # noqa: E501
+ :type num_gpu: int
+ """
+ self.swagger_types = {
+ 'gpu_memory': int,
+ 'num_gpu': int
+ }
+
+ self.attribute_map = {
+ 'gpu_memory': 'gpuMemory',
+ 'num_gpu': 'numGPU'
+ }
+ self._gpu_memory = gpu_memory
+ self._num_gpu = num_gpu
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'GpuInfo':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The GpuInfo of this GpuInfo. # noqa: E501
+ :rtype: GpuInfo
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def gpu_memory(self) -> int:
+ """Gets the gpu_memory of this GpuInfo.
+
+ GPU memory in mega bytes # noqa: E501
+
+ :return: The gpu_memory of this GpuInfo.
+ :rtype: int
+ """
+ return self._gpu_memory
+
+ @gpu_memory.setter
+ def gpu_memory(self, gpu_memory: int):
+ """Sets the gpu_memory of this GpuInfo.
+
+ GPU memory in mega bytes # noqa: E501
+
+ :param gpu_memory: The gpu_memory of this GpuInfo.
+ :type gpu_memory: int
+ """
+ if gpu_memory is None:
+ raise ValueError("Invalid value for `gpu_memory`, must not be `None`") # noqa: E501
+
+ self._gpu_memory = gpu_memory
+
+ @property
+ def num_gpu(self) -> int:
+ """Gets the num_gpu of this GpuInfo.
+
+ Number of GPUs # noqa: E501
+
+ :return: The num_gpu of this GpuInfo.
+ :rtype: int
+ """
+ return self._num_gpu
+
+ @num_gpu.setter
+ def num_gpu(self, num_gpu: int):
+ """Sets the num_gpu of this GpuInfo.
+
+ Number of GPUs # noqa: E501
+
+ :param num_gpu: The num_gpu of this GpuInfo.
+ :type num_gpu: int
+ """
+ if num_gpu is None:
+ raise ValueError("Invalid value for `num_gpu`, must not be `None`") # noqa: E501
+
+ self._num_gpu = num_gpu
diff --git a/service-resource-manager-implementation/swagger_server/models/operating_system.py b/service-resource-manager-implementation/swagger_server/models/operating_system.py
new file mode 100644
index 0000000..b732e86
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/operating_system.py
@@ -0,0 +1,172 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server import util
+
+
+class OperatingSystem(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, architecture: str=None, family: str=None, version: str=None, license: str=None): # noqa: E501
+ """OperatingSystem - a model defined in Swagger
+
+ :param architecture: The architecture of this OperatingSystem. # noqa: E501
+ :type architecture: str
+ :param family: The family of this OperatingSystem. # noqa: E501
+ :type family: str
+ :param version: The version of this OperatingSystem. # noqa: E501
+ :type version: str
+ :param license: The license of this OperatingSystem. # noqa: E501
+ :type license: str
+ """
+ self.swagger_types = {
+ 'architecture': str,
+ 'family': str,
+ 'version': str,
+ 'license': str
+ }
+
+ self.attribute_map = {
+ 'architecture': 'architecture',
+ 'family': 'family',
+ 'version': 'version',
+ 'license': 'license'
+ }
+ self._architecture = architecture
+ self._family = family
+ self._version = version
+ self._license = license
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'OperatingSystem':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The OperatingSystem of this OperatingSystem. # noqa: E501
+ :rtype: OperatingSystem
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def architecture(self) -> str:
+ """Gets the architecture of this OperatingSystem.
+
+ Type of the OS Architecture # noqa: E501
+
+ :return: The architecture of this OperatingSystem.
+ :rtype: str
+ """
+ return self._architecture
+
+ @architecture.setter
+ def architecture(self, architecture: str):
+ """Sets the architecture of this OperatingSystem.
+
+ Type of the OS Architecture # noqa: E501
+
+ :param architecture: The architecture of this OperatingSystem.
+ :type architecture: str
+ """
+ allowed_values = ["x86_64", "x86"] # noqa: E501
+ if architecture not in allowed_values:
+ raise ValueError(
+ "Invalid value for `architecture` ({0}), must be one of {1}"
+ .format(architecture, allowed_values)
+ )
+
+ self._architecture = architecture
+
+ @property
+ def family(self) -> str:
+ """Gets the family of this OperatingSystem.
+
+ Family to which OS belongs # noqa: E501
+
+ :return: The family of this OperatingSystem.
+ :rtype: str
+ """
+ return self._family
+
+ @family.setter
+ def family(self, family: str):
+ """Sets the family of this OperatingSystem.
+
+ Family to which OS belongs # noqa: E501
+
+ :param family: The family of this OperatingSystem.
+ :type family: str
+ """
+ allowed_values = ["RHEL", "UBUNTU", "COREOS", "WINDOWS", "OTHER"] # noqa: E501
+ if family not in allowed_values:
+ raise ValueError(
+ "Invalid value for `family` ({0}), must be one of {1}"
+ .format(family, allowed_values)
+ )
+
+ self._family = family
+
+ @property
+ def version(self) -> str:
+ """Gets the version of this OperatingSystem.
+
+ Version of the OS # noqa: E501
+
+ :return: The version of this OperatingSystem.
+ :rtype: str
+ """
+ return self._version
+
+ @version.setter
+ def version(self, version: str):
+ """Sets the version of this OperatingSystem.
+
+ Version of the OS # noqa: E501
+
+ :param version: The version of this OperatingSystem.
+ :type version: str
+ """
+ allowed_values = ["OS_VERSION_UBUNTU_2204_LTS", "OS_VERSION_RHEL_8", "OS_MS_WINDOWS_2022", "OTHER"] # noqa: E501
+ if version not in allowed_values:
+ raise ValueError(
+ "Invalid value for `version` ({0}), must be one of {1}"
+ .format(version, allowed_values)
+ )
+
+ self._version = version
+
+ @property
+ def license(self) -> str:
+ """Gets the license of this OperatingSystem.
+
+ License needed to activate the OS # noqa: E501
+
+ :return: The license of this OperatingSystem.
+ :rtype: str
+ """
+ return self._license
+
+ @license.setter
+ def license(self, license: str):
+ """Sets the license of this OperatingSystem.
+
+ License needed to activate the OS # noqa: E501
+
+ :param license: The license of this OperatingSystem.
+ :type license: str
+ """
+ allowed_values = ["OS_LICENSE_TYPE_FREE", "OS_LICENSE_TYPE_ON_DEMAND", "OTHER"] # noqa: E501
+ if license not in allowed_values:
+ raise ValueError(
+ "Invalid value for `license` ({0}), must be one of {1}"
+ .format(license, allowed_values)
+ )
+
+ self._license = license
diff --git a/service-resource-manager-implementation/swagger_server/models/required_resources.py b/service-resource-manager-implementation/swagger_server/models/required_resources.py
new file mode 100644
index 0000000..42bf7a4
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/required_resources.py
@@ -0,0 +1,155 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server.models.gpu_info import GpuInfo # noqa: F401,E501
+from swagger_server import util
+
+
+class RequiredResources(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self, num_cpu: int=None, memory: int=None, storage: int=None, gpu: List[GpuInfo]=None): # noqa: E501
+ """RequiredResources - a model defined in Swagger
+
+ :param num_cpu: The num_cpu of this RequiredResources. # noqa: E501
+ :type num_cpu: int
+ :param memory: The memory of this RequiredResources. # noqa: E501
+ :type memory: int
+ :param storage: The storage of this RequiredResources. # noqa: E501
+ :type storage: int
+ :param gpu: The gpu of this RequiredResources. # noqa: E501
+ :type gpu: List[GpuInfo]
+ """
+ self.swagger_types = {
+ 'num_cpu': int,
+ 'memory': int,
+ 'storage': int,
+ 'gpu': List[GpuInfo]
+ }
+
+ self.attribute_map = {
+ 'num_cpu': 'numCPU',
+ 'memory': 'memory',
+ 'storage': 'storage',
+ 'gpu': 'gpu'
+ }
+ self._num_cpu = num_cpu
+ self._memory = memory
+ self._storage = storage
+ self._gpu = gpu
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'RequiredResources':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The RequiredResources of this RequiredResources. # noqa: E501
+ :rtype: RequiredResources
+ """
+ return util.deserialize_model(dikt, cls)
+
+ @property
+ def num_cpu(self) -> int:
+ """Gets the num_cpu of this RequiredResources.
+
+ Number of virtual CPUs # noqa: E501
+
+ :return: The num_cpu of this RequiredResources.
+ :rtype: int
+ """
+ return self._num_cpu
+
+ @num_cpu.setter
+ def num_cpu(self, num_cpu: int):
+ """Sets the num_cpu of this RequiredResources.
+
+ Number of virtual CPUs # noqa: E501
+
+ :param num_cpu: The num_cpu of this RequiredResources.
+ :type num_cpu: int
+ """
+ if num_cpu is None:
+ raise ValueError("Invalid value for `num_cpu`, must not be `None`") # noqa: E501
+
+ self._num_cpu = num_cpu
+
+ @property
+ def memory(self) -> int:
+ """Gets the memory of this RequiredResources.
+
+ Memory in giga bytes # noqa: E501
+
+ :return: The memory of this RequiredResources.
+ :rtype: int
+ """
+ return self._memory
+
+ @memory.setter
+ def memory(self, memory: int):
+ """Sets the memory of this RequiredResources.
+
+ Memory in giga bytes # noqa: E501
+
+ :param memory: The memory of this RequiredResources.
+ :type memory: int
+ """
+ if memory is None:
+ raise ValueError("Invalid value for `memory`, must not be `None`") # noqa: E501
+
+ self._memory = memory
+
+ @property
+ def storage(self) -> int:
+ """Gets the storage of this RequiredResources.
+
+ Storage in giga bytes # noqa: E501
+
+ :return: The storage of this RequiredResources.
+ :rtype: int
+ """
+ return self._storage
+
+ @storage.setter
+ def storage(self, storage: int):
+ """Sets the storage of this RequiredResources.
+
+ Storage in giga bytes # noqa: E501
+
+ :param storage: The storage of this RequiredResources.
+ :type storage: int
+ """
+ if storage is None:
+ raise ValueError("Invalid value for `storage`, must not be `None`") # noqa: E501
+
+ self._storage = storage
+
+ @property
+ def gpu(self) -> List[GpuInfo]:
+ """Gets the gpu of this RequiredResources.
+
+ Number of GPUs # noqa: E501
+
+ :return: The gpu of this RequiredResources.
+ :rtype: List[GpuInfo]
+ """
+ return self._gpu
+
+ @gpu.setter
+ def gpu(self, gpu: List[GpuInfo]):
+ """Sets the gpu of this RequiredResources.
+
+ Number of GPUs # noqa: E501
+
+ :param gpu: The gpu of this RequiredResources.
+ :type gpu: List[GpuInfo]
+ """
+
+ self._gpu = gpu
diff --git a/service-resource-manager-implementation/swagger_server/models/uri.py b/service-resource-manager-implementation/swagger_server/models/uri.py
new file mode 100644
index 0000000..aabb790
--- /dev/null
+++ b/service-resource-manager-implementation/swagger_server/models/uri.py
@@ -0,0 +1,36 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+from datetime import date, datetime # noqa: F401
+
+from typing import List, Dict # noqa: F401
+
+from swagger_server.models.base_model_ import Model
+from swagger_server import util
+
+
+class Uri(Model):
+ """NOTE: This class is auto generated by the swagger code generator program.
+
+ Do not edit the class manually.
+ """
+ def __init__(self): # noqa: E501
+ """Uri - a model defined in Swagger
+
+ """
+ self.swagger_types = {
+ }
+
+ self.attribute_map = {
+ }
+
+ @classmethod
+ def from_dict(cls, dikt) -> 'Uri':
+ """Returns the dict as a model
+
+ :param dikt: A dict.
+ :type: dict
+ :return: The Uri of this Uri. # noqa: E501
+ :rtype: Uri
+ """
+ return util.deserialize_model(dikt, cls)
diff --git a/service-resource-manager-implementation/swagger_server/swagger/swagger.yaml b/service-resource-manager-implementation/swagger_server/swagger/swagger.yaml
index 14a2de8..fba02e0 100644
--- a/service-resource-manager-implementation/swagger_server/swagger/swagger.yaml
+++ b/service-resource-manager-implementation/swagger_server/swagger/swagger.yaml
@@ -78,6 +78,7 @@ paths:
tags:
- Artifact Management
summary: Copies artifact from source repository to destination repository
+ operationId: copy_artifact
requestBody:
description: Artifact details including image name, tag, source repository username and password tec
content:
@@ -95,6 +96,7 @@ paths:
tags:
- Artifact Management
summary: Check if artifact exists in given repository
+ operationId: artifact_exists
requestBody:
description: Artifact details including image name, tag, source repository username and password tec
content:
@@ -114,8 +116,8 @@ paths:
tags:
- Service Functions Catalogue
summary: Register Service.
- security:
- - jwt: [ ]
+ # security:
+ # - jwt: [ ]
operationId: register_service_function
requestBody:
description: Registration method to save service function into database
@@ -153,8 +155,8 @@ paths:
- Service Functions Catalogue
summary: Returns service functions from the catalogue.
operationId: get_service_functions
- security:
- - jwt: [ ]
+ # security:
+ # - jwt: [ ]
responses:
"200":
description: Returns service functions from the catalogue.
@@ -165,16 +167,16 @@ paths:
"405":
description: Method not allowed
x-openapi-router-controller: swagger_server.controllers.service_functions_catalogue_controller
- /serviceFunction/{serviceFunctionName}:
+ /serviceFunction/{serviceFunctionId}:
delete:
tags:
- Service Functions Catalogue
summary: Deregister service.
- security:
- - jwt: [ ]
+ # security:
+ # - jwt: [ ]
operationId: deregister_service_function
parameters:
- - name: serviceFunctionName
+ - name: serviceFunctionId
in: path
description: Returns a specific service function from the catalogue.
required: true
@@ -192,11 +194,11 @@ paths:
tags:
- Service Functions Catalogue
summary: Returns a specific service function from the catalogue.
- security:
- - jwt: [ ]
+ # security:
+ # - jwt: [ ]
operationId: get_service_function
parameters:
- - name: serviceFunctionName
+ - name: serviceFunctionId
in: path
description: Returns a specific service function from the catalogue.
required: true
@@ -214,302 +216,302 @@ paths:
"405":
description: Method not allowed
x-openapi-router-controller: swagger_server.controllers.service_functions_catalogue_controller
- /paasService:
- post:
- tags:
- - PaaS Services Catalogue
- summary: Register PaaS.
- security:
- - jwt: [ ]
- operationId: register_paas
- requestBody:
- description: Registration method to save paas service into database
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/PaasRegistrationRequest'
- responses:
- "200":
- description: Paas service registered
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
- patch:
- tags:
- - PaaS Services Catalogue
- summary: Update PaaS registration.
- operationId: update_paas
- security:
- - jwt: [ ]
- requestBody:
- description: Registration method to update paas service into database
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/PaasRegistrationRequest'
- responses:
- "200":
- description: Paas service registered
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
- get:
- tags:
- - PaaS Services Catalogue
- summary: Returns PaaS Services from the catalogue.
- security:
- - jwt: [ ]
- operationId: get_paas_services
- responses:
- "200":
- description: Returns PaaS Services from the catalogue.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/appsResponse'
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
- /paasService/{paasServiceName}:
- delete:
- tags:
- - PaaS Services Catalogue
- summary: Deregister PaaS.
- operationId: deregister_paas
- security:
- - jwt: [ ]
- parameters:
- - name: paasServiceName
- in: path
- description: Returns a specific paas service from the catalogue.
- required: true
- style: simple
- explode: false
- schema:
- type: string
- responses:
- "200":
- description: Paas service unregistered
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
- get:
- tags:
- - PaaS Services Catalogue
- summary: Returns a specific PaaS service from the catalogue.
- security:
- - jwt: [ ]
- operationId: get_paas_service
- parameters:
- - name: paasServiceName
- in: path
- description: Returns a specific PaaS service from the catalogue.
- required: true
- style: simple
- explode: false
- schema:
- type: string
- responses:
- "200":
- description: Returns the paas info status.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/appsResponse_apps'
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
- /deployedPaas:
- get:
- tags:
- - PaaS Services Instances
- summary: Returns edge paas services status.
- security:
- - jwt: [ ]
- operationId: deployed_paas_services_status
- responses:
- "200":
- description: Returns the edge PaaS services status per node.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/deployedappsResponse'
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
- post:
- tags:
- - PaaS Services Instances
- summary: Request to deploy a PaaS (from the catalogue) to an edge node.
- security:
- - jwt: [ ]
- operationId: deploy_paas
- requestBody:
- description: Deploy PaaS.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/deployPaas'
- responses:
- "200":
- description: App deployed.
- x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
- patch:
- tags:
- - PaaS Services Instances
- summary: Request to update the status of a deployed PaaS.
- security:
- - jwt: [ ]
- operationId: update_deployed_paas
- requestBody:
- description: update a running paas.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/deployChain'
- responses:
- "200":
- description: App updated.
- x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
- /deployedPaas/{deployedPaasServiceName}:
- delete:
- tags:
- - PaaS Services Instances
- summary: Deletes a deployed PaaS service.
- security:
- - jwt: [ ]
- operationId: delete_deployed_paas_service
- parameters:
- - name: deployedPaasServiceName
- in: path
- description: Represents a paas from the running deployments.
- required: true
- style: simple
- explode: false
- schema:
- type: string
- responses:
- "200":
- description: Deployed app deleted
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
- get:
- tags:
- - PaaS Services Instances
- summary: Returns the requested edge paas service status.
- security:
- - jwt: [ ]
- operationId: deployed_paas_service_status
- parameters:
- - name: deployedPaasServiceName
- in: path
- description: Represents a paas from the running deployments.
- required: true
- style: simple
- explode: false
- schema:
- type: string
- responses:
- "200":
- description: Returns the status of the deployed app.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/deployedappsResponse'
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
- /deployedServiceFunction/chain:
- post:
- tags:
- - Service Functions Instances
- summary: Request to deploy a chain of function services.
- security:
- - jwt: [ ]
- operationId: deploy_chain
- requestBody:
- description: Deploy chain.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/deployChain'
- responses:
- "200":
- description: App deployed.
- x-openapi-router-controller: swagger_server.controllers.service_functions_instances_controller
- patch:
- tags:
- - Service Functions Instances
- summary: Request to update a chain of function services.
- operationId: update_chain
- security:
- - jwt: [ ]
- requestBody:
- description: Deploy chain.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/deployChain'
- responses:
- "200":
- description: App deployed.
- x-openapi-router-controller: swagger_server.controllers.service_functions_instances_controller
- /deployedServiceFunction/chain/{chainServiceName}:
- delete:
- tags:
- - Service Functions Instances
- summary: Deletes a deployed chain.
- security:
- - jwt: [ ]
- operationId: delete_chain
- parameters:
- - name: chainServiceName
- in: path
- description: Represents a chain Service from the running deployments.
- required: true
- style: simple
- explode: false
- schema:
- type: string
- responses:
- "200":
- description: Deployed chain deleted
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.service_functions_instances_controller
- /initNodes:
- get:
- tags:
- - Nodes
- summary: Initiliaze nodes. Scan nodes in the edge cluster.
- security:
- - jwt: [ ]
- operationId: init_nodes
- responses:
- "200":
- description: Nodes initialized
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.nodes_controller
- /activateTandemNode:
- post:
- tags:
- - Nodes
- summary: Request to create a "PaaS-enabled" node.
- operationId: activate_paas_node
- security:
- - jwt: [ ]
- requestBody:
- description: activate TANDEM node.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/deployPaaSNode'
- responses:
- "200":
- description: Node activated.
- x-openapi-router-controller: swagger_server.controllers.nodes_controller
+ # /paasService:
+ # post:
+ # tags:
+ # - PaaS Services Catalogue
+ # summary: Register PaaS.
+ # security:
+ # - jwt: [ ]
+ # operationId: register_paas
+ # requestBody:
+ # description: Registration method to save paas service into database
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/PaasRegistrationRequest'
+ # responses:
+ # "200":
+ # description: Paas service registered
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
+ # patch:
+ # tags:
+ # - PaaS Services Catalogue
+ # summary: Update PaaS registration.
+ # operationId: update_paas
+ # security:
+ # - jwt: [ ]
+ # requestBody:
+ # description: Registration method to update paas service into database
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/PaasRegistrationRequest'
+ # responses:
+ # "200":
+ # description: Paas service registered
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
+ # get:
+ # tags:
+ # - PaaS Services Catalogue
+ # summary: Returns PaaS Services from the catalogue.
+ # security:
+ # - jwt: [ ]
+ # operationId: get_paas_services
+ # responses:
+ # "200":
+ # description: Returns PaaS Services from the catalogue.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/appsResponse'
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
+ # /paasService/{paasServiceName}:
+ # delete:
+ # tags:
+ # - PaaS Services Catalogue
+ # summary: Deregister PaaS.
+ # operationId: deregister_paas
+ # security:
+ # - jwt: [ ]
+ # parameters:
+ # - name: paasServiceName
+ # in: path
+ # description: Returns a specific paas service from the catalogue.
+ # required: true
+ # style: simple
+ # explode: false
+ # schema:
+ # type: string
+ # responses:
+ # "200":
+ # description: Paas service unregistered
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
+ # get:
+ # tags:
+ # - PaaS Services Catalogue
+ # summary: Returns a specific PaaS service from the catalogue.
+ # security:
+ # - jwt: [ ]
+ # operationId: get_paas_service
+ # parameters:
+ # - name: paasServiceName
+ # in: path
+ # description: Returns a specific PaaS service from the catalogue.
+ # required: true
+ # style: simple
+ # explode: false
+ # schema:
+ # type: string
+ # responses:
+ # "200":
+ # description: Returns the paas info status.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/appsResponse_apps'
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_catalogue_controller
+ # /deployedPaas:
+ # get:
+ # tags:
+ # - PaaS Services Instances
+ # summary: Returns edge paas services status.
+ # security:
+ # - jwt: [ ]
+ # operationId: deployed_paas_services_status
+ # responses:
+ # "200":
+ # description: Returns the edge PaaS services status per node.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/deployedappsResponse'
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
+ # post:
+ # tags:
+ # - PaaS Services Instances
+ # summary: Request to deploy a PaaS (from the catalogue) to an edge node.
+ # security:
+ # - jwt: [ ]
+ # operationId: deploy_paas
+ # requestBody:
+ # description: Deploy PaaS.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/deployPaas'
+ # responses:
+ # "200":
+ # description: App deployed.
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
+ # patch:
+ # tags:
+ # - PaaS Services Instances
+ # summary: Request to update the status of a deployed PaaS.
+ # security:
+ # - jwt: [ ]
+ # operationId: update_deployed_paas
+ # requestBody:
+ # description: update a running paas.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/deployChain'
+ # responses:
+ # "200":
+ # description: App updated.
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
+ # /deployedPaas/{deployedPaasServiceName}:
+ # delete:
+ # tags:
+ # - PaaS Services Instances
+ # summary: Deletes a deployed PaaS service.
+ # security:
+ # - jwt: [ ]
+ # operationId: delete_deployed_paas_service
+ # parameters:
+ # - name: deployedPaasServiceName
+ # in: path
+ # description: Represents a paas from the running deployments.
+ # required: true
+ # style: simple
+ # explode: false
+ # schema:
+ # type: string
+ # responses:
+ # "200":
+ # description: Deployed app deleted
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
+ # get:
+ # tags:
+ # - PaaS Services Instances
+ # summary: Returns the requested edge paas service status.
+ # security:
+ # - jwt: [ ]
+ # operationId: deployed_paas_service_status
+ # parameters:
+ # - name: deployedPaasServiceName
+ # in: path
+ # description: Represents a paas from the running deployments.
+ # required: true
+ # style: simple
+ # explode: false
+ # schema:
+ # type: string
+ # responses:
+ # "200":
+ # description: Returns the status of the deployed app.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/deployedappsResponse'
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.paas_services_instances_controller
+ # /deployedServiceFunction/chain:
+ # post:
+ # tags:
+ # - Service Functions Instances
+ # summary: Request to deploy a chain of function services.
+ # security:
+ # - jwt: [ ]
+ # operationId: deploy_chain
+ # requestBody:
+ # description: Deploy chain.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/deployChain'
+ # responses:
+ # "200":
+ # description: App deployed.
+ # x-openapi-router-controller: swagger_server.controllers.service_functions_instances_controller
+ # patch:
+ # tags:
+ # - Service Functions Instances
+ # summary: Request to update a chain of function services.
+ # operationId: update_chain
+ # security:
+ # - jwt: [ ]
+ # requestBody:
+ # description: Deploy chain.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/deployChain'
+ # responses:
+ # "200":
+ # description: App deployed.
+ # x-openapi-router-controller: swagger_server.controllers.service_functions_instances_controller
+ # /deployedServiceFunction/chain/{chainServiceName}:
+ # delete:
+ # tags:
+ # - Service Functions Instances
+ # summary: Deletes a deployed chain.
+ # security:
+ # - jwt: [ ]
+ # operationId: delete_chain
+ # parameters:
+ # - name: chainServiceName
+ # in: path
+ # description: Represents a chain Service from the running deployments.
+ # required: true
+ # style: simple
+ # explode: false
+ # schema:
+ # type: string
+ # responses:
+ # "200":
+ # description: Deployed chain deleted
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.service_functions_instances_controller
+ # /initNodes:
+ # get:
+ # tags:
+ # - Nodes
+ # summary: Initiliaze nodes. Scan nodes in the edge cluster.
+ # security:
+ # - jwt: [ ]
+ # operationId: init_nodes
+ # responses:
+ # "200":
+ # description: Nodes initialized
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.nodes_controller
+ # /activateTandemNode:
+ # post:
+ # tags:
+ # - Nodes
+ # summary: Request to create a "PaaS-enabled" node.
+ # operationId: activate_paas_node
+ # security:
+ # - jwt: [ ]
+ # requestBody:
+ # description: activate TANDEM node.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/deployPaaSNode'
+ # responses:
+ # "200":
+ # description: Node activated.
+ # x-openapi-router-controller: swagger_server.controllers.nodes_controller
/node:
get:
tags:
@@ -616,22 +618,22 @@ paths:
"200":
description: Node Deleted.
x-openapi-router-controller: swagger_server.controllers.nodes_controller
- /targets:
- get:
- tags:
- - Nodes
- summary: Returns IP of all nodes for Prometheus.
- operationId: prometheus_targets
- responses:
- "200":
- description: Returns the targets for Prometheus service.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/nodesResponse'
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.nodes_controller
+ # /targets:
+ # get:
+ # tags:
+ # - Nodes
+ # summary: Returns IP of all nodes for Prometheus.
+ # operationId: prometheus_targets
+ # responses:
+ # "200":
+ # description: Returns the targets for Prometheus service.
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/nodesResponse'
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.nodes_controller
/deployedServiceFunction:
post:
tags:
@@ -639,14 +641,14 @@ paths:
summary: Request to deploy a Service function (from the catalogue) to an edge
node.
operationId: deploy_service_function
- security:
- - jwt: [ ]
+ # security:
+ # - jwt: [ ]
requestBody:
description: Deploy Service Function.
content:
application/json:
schema:
- $ref: '#/components/schemas/deployServiceFunction'
+ $ref: '#/components/schemas/DeployApp'
responses:
"200":
description: App deployed.
@@ -656,8 +658,8 @@ paths:
- Service Functions Instances
summary: Returns the edge service functions status per node.
operationId: deployed_service_functions_status
- security:
- - jwt: [ ]
+ # security:
+ # - jwt: [ ]
responses:
"200":
description: Returns the edge service functions status per node.
@@ -691,8 +693,8 @@ paths:
- Service Functions Instances
summary: Returns the requested edge service status per node.
operationId: deployed_service_function_status
- security:
- - jwt: [ ]
+ # security:
+ # - jwt: [ ]
parameters:
- name: deployedServiceFunctionName
in: path
@@ -717,8 +719,8 @@ paths:
- Service Functions Instances
summary: Deletes a deployed Service function.
operationId: delete_deployed_service_function
- security:
- - jwt: [ ]
+ # security:
+ # - jwt: [ ]
parameters:
- name: deployedServiceFunctionName
in: path
@@ -734,91 +736,91 @@ paths:
"405":
description: Method not allowed
x-openapi-router-controller: swagger_server.controllers.service_functions_instances_controller
- /securedSlice:
- post:
- tags:
- - Security Automation
- summary: Enables a secured slice
- security:
- - jwt: [ ]
- operationId: activate_secured_slice
- requestBody:
- description: Creates a secured slice
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/activateSecuredSlice'
- responses:
- "200":
- description: Deployed chain deleted
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.security_automation_controller
- /securedSlice/{sliceName}:
- delete:
- tags:
- - Security Automation
- summary: Disables security monitoring over a slice
- security:
- - jwt: [ ]
- operationId: delete_secured_slice
- parameters:
- - name: sliceName
- in: path
- description: Represents a slice from the running slices.
- required: true
- style: simple
- explode: false
- schema:
- type: string
- responses:
- "200":
- description: Deployed chain deleted
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.security_automation_controller
+ # /securedSlice:
+ # post:
+ # tags:
+ # - Security Automation
+ # summary: Enables a secured slice
+ # security:
+ # - jwt: [ ]
+ # operationId: activate_secured_slice
+ # requestBody:
+ # description: Creates a secured slice
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/activateSecuredSlice'
+ # responses:
+ # "200":
+ # description: Deployed chain deleted
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.security_automation_controller
+ # /securedSlice/{sliceName}:
+ # delete:
+ # tags:
+ # - Security Automation
+ # summary: Disables security monitoring over a slice
+ # security:
+ # - jwt: [ ]
+ # operationId: delete_secured_slice
+ # parameters:
+ # - name: sliceName
+ # in: path
+ # description: Represents a slice from the running slices.
+ # required: true
+ # style: simple
+ # explode: false
+ # schema:
+ # type: string
+ # responses:
+ # "200":
+ # description: Deployed chain deleted
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.security_automation_controller
- /addIotDevice:
- post:
- tags:
- - IoT Devices
- summary: Adds an IoT Device
- security:
- - jwt: [ ]
- operationId: add_iot_device
- requestBody:
- description: Adds an IoT Device
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/addIotDevice'
- responses:
- "200":
- description: Deployed chain deleted
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.iot_devices_controller
+ # /addIotDevice:
+ # post:
+ # tags:
+ # - IoT Devices
+ # summary: Adds an IoT Device
+ # security:
+ # - jwt: [ ]
+ # operationId: add_iot_device
+ # requestBody:
+ # description: Adds an IoT Device
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/addIotDevice'
+ # responses:
+ # "200":
+ # description: Deployed chain deleted
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.iot_devices_controller
- /serviceFunctionNodeMigration:
- post:
- tags:
- - Node Migration
- summary: Migrates service function from one node to another
- security:
- - jwt: []
- operationId: service_function_node_migration
- requestBody:
- description: Migrates service function from one node to another
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/serviceFunctionNodeMigration'
- responses:
- "200":
- description: Service function migrated successfully
- "405":
- description: Method not allowed
- x-openapi-router-controller: swagger_server.controllers.node_migration_controller
+ # /serviceFunctionNodeMigration:
+ # post:
+ # tags:
+ # - Node Migration
+ # summary: Migrates service function from one node to another
+ # security:
+ # - jwt: []
+ # operationId: service_function_node_migration
+ # requestBody:
+ # description: Migrates service function from one node to another
+ # content:
+ # application/json:
+ # schema:
+ # $ref: '#/components/schemas/serviceFunctionNodeMigration'
+ # responses:
+ # "200":
+ # description: Service function migrated successfully
+ # "405":
+ # description: Method not allowed
+ # x-openapi-router-controller: swagger_server.controllers.node_migration_controller
components:
@@ -1609,7 +1611,35 @@ components:
example: user123
password:
type: string
- example: 1234
+ example: 1234
+ DeployApp:
+ type: object
+ properties:
+ appId:
+ type: string
+ example: "123456789"
+ appZones:
+ type: array
+ items:
+ $ref: '#/components/schemas/EdgeCloudZone'
+ EdgeCloudZone:
+ type: object
+ properties:
+ edgeCloudZoneId:
+ type: string
+ example: "123456789"
+ edgeCloudZoneName:
+ type: string
+ example: Test
+ edgeCloudZoneStatus:
+ type: string
+ example: active
+ edgeCloudProvider:
+ type: string
+ example: Test
+ edgeCloudRegion:
+ type: string
+ example: Test
securitySchemes:
registry_auth:
diff --git a/service-resource-manager-implementation/swagger_server/utils/auxiliary_functions.py b/service-resource-manager-implementation/swagger_server/utils/auxiliary_functions.py
index 85e1772..cf9224b 100644
--- a/service-resource-manager-implementation/swagger_server/utils/auxiliary_functions.py
+++ b/service-resource-manager-implementation/swagger_server/utils/auxiliary_functions.py
@@ -36,6 +36,6 @@ def prepare_name(name, driver):
# deployed_name = deployed_name.replace("-", "")
name = name.replace("_", "")
deployed_name_ = ''.join([i for i in name if not i.isdigit()])
- return deployed_name_
+ return deployed_name_.rstrip('-')
else:
return name
\ No newline at end of file
diff --git a/service-resource-manager-implementation/swagger_server/utils/connector_db.py b/service-resource-manager-implementation/swagger_server/utils/connector_db.py
index 6bc9df5..8e05556 100644
--- a/service-resource-manager-implementation/swagger_server/utils/connector_db.py
+++ b/service-resource-manager-implementation/swagger_server/utils/connector_db.py
@@ -3,6 +3,7 @@ import string
import yaml
import pymongo
+from bson.objectid import ObjectId
import logging
from bson import json_util
from typing import List
@@ -175,13 +176,15 @@ def insert_document_service_function(document=None, _id=None):
insert_doc["name"] = document["service_function_name"]
insert_doc["type"] = document["service_function_type"]
insert_doc["image"] = document["service_function_image"]
- insert_doc["application_ports"] = document["application_ports"]
- insert_doc["autoscaling_policies"] = document["autoscaling_policies"]
- if "required_volumes" in document:
- insert_doc["required_volumes"] = document["required_volumes"]
- if "privileged" in document:
- insert_doc["privileged"] = document["privileged"]
- insert_doc["required_env_parameters"] = document["required_env_parameters"]
+ if document.get("application_ports") is not None:
+ insert_doc["application_ports"] = document.get("application_ports")
+ if document.get("autoscaling_policies") is not None:
+ insert_doc["autoscaling_policies"] = document.get("autoscaling_policies")
+ # if "required_volumes" in document:
+ # insert_doc["required_volumes"] = document["required_volumes"]
+ # if "privileged" in document:
+ # insert_doc["privileged"] = document["privileged"]
+ # insert_doc["required_env_parameters"] = document["required_env_parameters"]
result=mycol.insert_one(insert_doc)
return result
@@ -250,23 +253,25 @@ def update_document_service_function(document=None, _id=None):
else:
return "Service function not found in the catalogue"
-def delete_document_service_function(service_function_input_name=None, _id=None):
+def delete_document_service_function(service_function_input_name=None, _id: str=None):
+ _id = ObjectId(_id)
collection = "service_functions"
myclient = pymongo.MongoClient(storage_url)
mydbmongo = myclient[mydb_mongo]
mycol = mydbmongo[collection]
- myquery = {"_id": id}
+ myquery = {"_id": _id}
+ print(myquery)
mydoc = mycol.find_one(myquery)
if mydoc is None:
- return "Service function not found in the database"
+ return "Service function not found in the database", 404
try:
delete_doc = {}
- delete_doc["_id"] = id
+ delete_doc["_id"] = _id
mycol.delete_one(delete_doc)
- return "Service function deregistered successfully"
+ return "Service function deregistered successfully", 200
except Exception as ce_:
raise Exception("An exception occurred :", ce_)
diff --git a/service-resource-manager-implementation/swagger_server/utils/kubernetes_connector.py b/service-resource-manager-implementation/swagger_server/utils/kubernetes_connector.py
index 420f9e4..563f415 100644
--- a/service-resource-manager-implementation/swagger_server/utils/kubernetes_connector.py
+++ b/service-resource-manager-implementation/swagger_server/utils/kubernetes_connector.py
@@ -18,7 +18,7 @@ import json
#K8S AUTH
-adapter_name = os.environ['ADAPTER_NAME']
+adapter_name = os.environ['EDGE_CLOUD_ADAPTER_NAME']
if adapter_name=='piedge':
master_node_password=os.environ["KUBERNETES_MASTER_PASSWORD"].strip()
@@ -27,17 +27,25 @@ if adapter_name=='piedge':
master_node_port=os.environ["KUBERNETES_MASTER_PORT"].strip()
token_k8s=os.environ["KUBERNETES_MASTER_TOKEN"].strip()
kube_config_path=os.environ["KUBE_CONFIG_PATH"].strip()
+ username = os.environ["KUBERNETES_USERNAME"].strip()
host="https://"+master_node_ip+":"+master_node_port
+ configuration.api_key['authorization'] = token_k8s
+ configuration.api_key_prefix['authorization'] = 'Bearer'
- config.load_kube_config(config_file=kube_config_path)
- v1 = client.CoreV1Api(client.ApiClient())
+ configuration.host = host
+
+ configuration.username = username
+ configuration.verify_ssl=False
+
+ # config.load_kube_config(config_file=kube_config_path)
+ v1 = client.CoreV1Api(client.ApiClient(configuration))
# config.lod
#client.Configuration.set_default(configuration)
#Defining host is optional and default to http://localhost
# Enter a context with an instance of the API kubernetes.client
- with client.ApiClient() as api_client:
+ with client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = client.AdmissionregistrationApi(api_client)
api_instance_appsv1 = client.AppsV1Api(api_client)
@@ -219,7 +227,7 @@ def get_PoP_statistics(nodeName):
x1=x.json()
except requests.exceptions.HTTPError as e:
# logging.error(traceback.format_exc())
- return ("Exception when calling CoreV1Api->/api/v1/namespaces/pi-edge/persistentvolumeclaims: %s\n" % e)
+ return ("Exception when calling CoreV1Api->/api/v1/namespaces/sunrise6g/persistentvolumeclaims: %s\n" % e)
k8s_nodes = api_custom.list_cluster_custom_object("metrics.k8s.io", "v1beta1", "nodes")
@@ -328,7 +336,7 @@ def get_PoPs():
# x1 = x.json()
except requests.exceptions.HTTPError as e:
# logging.error(traceback.format_exc())
- return ("Exception when calling CoreV1Api->/api/v1/namespaces/pi-edge/persistentvolumeclaims: %s\n" % e)
+ return ("Exception when calling CoreV1Api->/api/v1/namespaces/sunrise6g/persistentvolumeclaims: %s\n" % e)
# client.models.v1_node_list.V1NodeList
@@ -355,23 +363,23 @@ def get_PoPs():
def delete_service_function(service_function_name):
- deleted_app = api_instance_appsv1.delete_namespaced_deployment(name=service_function_name, namespace="pi-edge")
+ deleted_app = api_instance_appsv1.delete_namespaced_deployment(name=service_function_name, namespace="sunrise6g")
- deleted_service = v1.delete_namespaced_service(name=service_function_name, namespace="pi-edge")
+ deleted_service = v1.delete_namespaced_service(name=service_function_name, namespace="sunrise6g")
- hpa_list = api_instance_v1autoscale.list_namespaced_horizontal_pod_autoscaler("pi-edge")
+ hpa_list = api_instance_v1autoscale.list_namespaced_horizontal_pod_autoscaler("sunrise6g")
#hpas=hpa_list["items"]
for hpa in hpa_list.items:
if hpa.metadata.name==service_function_name:
- deleted_hpa = api_instance_v1autoscale.delete_namespaced_horizontal_pod_autoscaler(name=service_function_name, namespace="pi-edge")
+ deleted_hpa = api_instance_v1autoscale.delete_namespaced_horizontal_pod_autoscaler(name=service_function_name, namespace="sunrise6g")
break
#deletevolume
- volume_list = v1.list_namespaced_persistent_volume_claim("pi-edge")
+ volume_list = v1.list_namespaced_persistent_volume_claim("sunrise6g")
for volume in volume_list.items:
name_v=service_function_name+str("-")
if name_v in volume.metadata.name:
@@ -379,7 +387,7 @@ def delete_service_function(service_function_name):
name=volume.spec.volume_name)
deleted_pvc = v1.delete_namespaced_persistent_volume_claim(
- name=volume.metadata.name, namespace="pi-edge")
+ name=volume.metadata.name, namespace="sunrise6g")
doc = {}
doc["instance_name"] = service_function_name
@@ -406,12 +414,13 @@ def delete_chain(chain_name):
def deploy_service_function(descriptor_service_function):
#deploys a Deployment yaml file, a service, a pvc and a hpa
- logging.info('DESCRIPTOR: '+descriptor_service_function)
+ # logging.info('DESCRIPTOR: '+descriptor_service_function)
+ logging.info(descriptor_service_function)
if "volumes" in descriptor_service_function:
for volume in descriptor_service_function["volumes"]:
- #first solution (python k8s client arises error without reason!)
+ #first solution (python k8s client raises error without reason!)
#body_volume = create_pvc(descriptor_service_function["name"], volume)
- #api_response_pvc = v1.create_namespaced_persistent_volume_claim("pi-edge", body_volume)
+ #api_response_pvc = v1.create_namespaced_persistent_volume_claim("sunrise6g", body_volume)
# #deploy pv
@@ -433,13 +442,13 @@ def deploy_service_function(descriptor_service_function):
if volume.get("hostpath") is None:
try:
- url = host+"/api/v1/namespaces/pi-edge/persistentvolumeclaims"
+ url = host+"/api/v1/namespaces/sunrise6g/persistentvolumeclaims"
body_volume = create_pvc_dict(descriptor_service_function["name"], volume)
headers = {"Authorization": "Bearer "+token_k8s}
requests.post(url, headers=headers, json=body_volume, verify=False)
except requests.exceptions.HTTPError as e:
# logging.error(traceback.format_exc())
- return ("Exception when calling CoreV1Api->/api/v1/namespaces/pi-edge/persistentvolumeclaims: %s\n" % e)
+ return ("Exception when calling CoreV1Api->/api/v1/namespaces/sunrise6g/persistentvolumeclaims: %s\n" % e)
#api_response_pvc = api_instance_corev1api.create_namespaced_persistent_volume_claim
body_deployment = create_deployment(descriptor_service_function)
@@ -448,16 +457,16 @@ def deploy_service_function(descriptor_service_function):
try:
- api_response_deployment = api_instance_appsv1.create_namespaced_deployment("pi-edge", body_deployment)
+ api_response_deployment = api_instance_appsv1.create_namespaced_deployment("sunrise6g", body_deployment)
#api_response_service = api_instance_apiregv1.create_api_service(body_service)
- api_response_service=v1.create_namespaced_service("pi-edge",body_service)
+ api_response_service=v1.create_namespaced_service("sunrise6g",body_service)
if "autoscaling_policies" in descriptor_service_function:
#V1 AUTOSCALER
body_hpa = create_hpa(descriptor_service_function)
- api_instance_v1autoscale.create_namespaced_horizontal_pod_autoscaler("pi-edge",body_hpa)
+ api_instance_v1autoscale.create_namespaced_horizontal_pod_autoscaler("sunrise6g",body_hpa)
# V2beta1 AUTOSCALER
#body_hpa = create_hpa(descriptor_paas)
- #api_instance_v2beta1autoscale.create_namespaced_horizontal_pod_autoscaler("pi-edge",body_hpa)
+ #api_instance_v2beta1autoscale.create_namespaced_horizontal_pod_autoscaler("sunrise6g",body_hpa)
body_r = "Service " + descriptor_service_function["name"] + " deployed successfully"
return body_r
except ApiException as e:
@@ -478,11 +487,11 @@ def patch_service_function(descriptor_paas):
try:
- api_response_deployment = api_instance_appsv1.patch_namespaced_deployment(namespace="pi-edge", name=descriptor_paas["name"], body=body_deployment)
+ api_response_deployment = api_instance_appsv1.patch_namespaced_deployment(namespace="sunrise6g", name=descriptor_paas["name"], body=body_deployment)
#api_response_service = api_instance_apiregv1.create_api_service(body_service)
- api_response_service=v1.patch_namespaced_service(namespace="pi-edge", name=descriptor_paas["name"], body=body_service)
+ api_response_service=v1.patch_namespaced_service(namespace="sunrise6g", name=descriptor_paas["name"], body=body_service)
if "autoscaling_policies" in descriptor_paas:
- api_response_hpa = api_instance_v1autoscale.patch_namespaced_horizontal_pod_autoscaler(namespace="pi-edge", name=descriptor_paas["name"], body=body_hpa)
+ api_response_hpa = api_instance_v1autoscale.patch_namespaced_horizontal_pod_autoscaler(namespace="sunrise6g", name=descriptor_paas["name"], body=body_hpa)
body_r="PaaS service "+descriptor_paas["name"] +" updated successfuly"
return body_r
@@ -500,7 +509,7 @@ def create_deployment(descriptor_service_function):
metadata = client.V1ObjectMeta(name=descriptor_service_function["name"])
# selector
dict_label = {}
- dict_label['pi-edge'] = descriptor_service_function["name"]
+ dict_label['sunrise6g'] = descriptor_service_function["name"]
selector = client.V1LabelSelector(match_labels=dict_label)
# create spec
@@ -640,7 +649,7 @@ def create_deployment(descriptor_service_function):
def create_service(descriptor_service_function):
dict_label = {}
- dict_label['pi-edge'] = descriptor_service_function["name"]
+ dict_label['sunrise6g'] = descriptor_service_function["name"]
metadata = client.V1ObjectMeta(name=descriptor_service_function["name"], labels=dict_label)
# spec
@@ -680,7 +689,7 @@ def create_service(descriptor_service_function):
def create_pvc(name, volumes):
dict_label = {}
name_vol=name+str("-")+volumes["name"]
- dict_label['pi-edge'] = name_vol
+ dict_label['sunrise6g'] = name_vol
#metadata = client.V1ObjectMeta(name=name_vol)
metadata = client.V1ObjectMeta(name=name_vol, labels=dict_label)
api_version = 'v1',
@@ -710,7 +719,7 @@ def create_pvc_dict(name, volumes, storage_class='microk8s-hostpath', volume_nam
body={"api_version": "v1",
"kind": "PersistentVolumeClaim",
"metadata": {
- "labels": {"pi-edge": name_vol},
+ "labels": {"sunrise6g": name_vol},
"name": name_vol},
"spec": {
"accessModes": ["ReadWriteOnce"],
@@ -733,7 +742,7 @@ def create_pv_dict(name, volumes, storage_class, node=None):
"metadata": {
"name": name_vol,
"labels": {
- "pi-edge": name_vol,
+ "sunrise6g": name_vol,
}
},
"spec": {
@@ -797,7 +806,7 @@ def check_for_update_hpas(deployed_hpas):
policies.append(policy)
desc_paas["autoscaling_policies"]=policies
body_hpa = create_hpa(desc_paas)
- api_instance_v1autoscale.patch_namespaced_horizontal_pod_autoscaler(namespace="pi-edge",
+ api_instance_v1autoscale.patch_namespaced_horizontal_pod_autoscaler(namespace="sunrise6g",
name=desc_paas["name"],
body=body_hpa)
break
@@ -886,9 +895,9 @@ def create_hpa(descriptor_service_function):
def get_deployed_dataspace_connector(instance_name):
label_selector = {}
- api_response = api_instance_appsv1.list_namespaced_deployment("pi-edge")
+ api_response = api_instance_appsv1.list_namespaced_deployment("sunrise6g")
- api_response_service = v1.list_namespaced_service("pi-edge")
+ api_response_service = v1.list_namespaced_service("sunrise6g")
app_ = {}
for app in api_response.items:
metadata = app.metadata
@@ -949,15 +958,15 @@ def get_deployed_service_functions():
# if deployed_hpas:
# check_for_update_hpas(deployed_hpas)
##########
- api_response = api_instance_appsv1.list_namespaced_deployment("pi-edge")
+ api_response = api_instance_appsv1.list_namespaced_deployment("sunrise6g")
- api_response_service= v1.list_namespaced_service("pi-edge")
- api_response_pvc= v1.list_namespaced_persistent_volume_claim("pi-edge")
+ api_response_service= v1.list_namespaced_service("sunrise6g")
+ api_response_pvc= v1.list_namespaced_persistent_volume_claim("sunrise6g")
#
- # hpa_list = api_instance_v1autoscale.list_namespaced_horizontal_pod_autoscaler("pi-edge")
- # api_response_pod = v1.list_namespaced_pod("pi-edge")
+ # hpa_list = api_instance_v1autoscale.list_namespaced_horizontal_pod_autoscaler("sunrise6g")
+ # api_response_pod = v1.list_namespaced_pod("sunrise6g")
#
apps=[]
for app in api_response.items:
@@ -1054,7 +1063,7 @@ def get_deployed_hpas():
label_selector={}
#APPV1 Implementation!
- api_response = api_instance_v1autoscale.list_namespaced_horizontal_pod_autoscaler("pi-edge")
+ api_response = api_instance_v1autoscale.list_namespaced_horizontal_pod_autoscaler("sunrise6g")
hpas=[]
for hpa in api_response.items:
@@ -1117,7 +1126,7 @@ def get_deployed_hpas():
def operate_service_function_node_migration(service_function_to_migrate: ServiceFunctionNodeMigration):
try:
instance_name = service_function_to_migrate.service_function_instance_name
- api_response_current = api_instance_appsv1.read_namespaced_deployment(instance_name, 'pi-edge')
+ api_response_current = api_instance_appsv1.read_namespaced_deployment(instance_name, 'sunrise6g')
source_location = api_response_current.spec.template.spec.node_selector['location']
destination_location = service_function_to_migrate.destination_location
@@ -1142,7 +1151,7 @@ def operate_service_function_node_migration(service_function_to_migrate: Service
#scale down deployment; should stop writing in the volume until migration
replicas_before_scale_down = api_response_current.spec.replicas
api_response_current.spec.replicas = 0
- api_response_scaled_down = api_instance_appsv1.patch_namespaced_deployment(instance_name, namespace='pi-edge', body=api_response_current)
+ api_response_scaled_down = api_instance_appsv1.patch_namespaced_deployment(instance_name, namespace='sunrise6g', body=api_response_current)
for volume in volumes:
pvc_name = volume.persistent_volume_claim.claim_name
@@ -1156,7 +1165,7 @@ def operate_service_function_node_migration(service_function_to_migrate: Service
new_pvc_name = f'{instance_name}-{destination_node}-pvc'
new_pv_name = f'{instance_name}-{destination_node}-pv'
- pvc_body = v1.read_namespaced_persistent_volume_claim(pvc_name, 'pi-edge')
+ pvc_body = v1.read_namespaced_persistent_volume_claim(pvc_name, 'sunrise6g')
pv_name = pvc_body.spec.volume_name
@@ -1169,12 +1178,12 @@ def operate_service_function_node_migration(service_function_to_migrate: Service
new_pvc_name_final = new_pvc["metadata"]["name"]
pv_created = v1.create_persistent_volume(body=new_pv)
- pvc_created = v1.create_namespaced_persistent_volume_claim(body=new_pvc, namespace='pi-edge')
+ pvc_created = v1.create_namespaced_persistent_volume_claim(body=new_pvc, namespace='sunrise6g')
#create a k8s job that will perform the persistent volume migration
job_body = create_pv_migration_job(pvc_name, new_pvc_name_final, source_location)
- job_created = api_instance_batchv1.create_namespaced_job(namespace='pi-edge', body=job_body)
+ job_created = api_instance_batchv1.create_namespaced_job(namespace='sunrise6g', body=job_body)
job_name = job_body["metadata"]["name"]
@@ -1182,31 +1191,31 @@ def operate_service_function_node_migration(service_function_to_migrate: Service
if is_job_completed(job_name):
print(f"Job {job_name} completed successfully")
- api_instance_batchv1.delete_namespaced_job(job_name, namespace='pi-edge')
+ api_instance_batchv1.delete_namespaced_job(job_name, namespace='sunrise6g')
break
else:
print(f"Waiting for job {job_name} to be completed...")
time.sleep(5)
#migrating deployment to destination node and scaling up to previous number of replicas
- api_response_scaled_down_read = api_instance_appsv1.read_namespaced_deployment(name=instance_name, namespace='pi-edge')
+ api_response_scaled_down_read = api_instance_appsv1.read_namespaced_deployment(name=instance_name, namespace='sunrise6g')
api_response_scaled_down_read.spec.template.spec.node_selector = {'location': service_function_to_migrate.destination_location}
api_response_scaled_down_read.spec.template.spec.volumes[0].persistent_volume_claim.claim_name = new_pvc_name_final
api_response_scaled_down_read.spec.replicas = replicas_before_scale_down
print(f"Replicas before scale down were: {replicas_before_scale_down}")
- api_response_scaled_up = api_instance_appsv1.patch_namespaced_deployment(instance_name, namespace='pi-edge',
+ api_response_scaled_up = api_instance_appsv1.patch_namespaced_deployment(instance_name, namespace='sunrise6g',
body=api_response_scaled_down_read)
- api_response_pvc_removal = api_instance_corev1api.delete_namespaced_persistent_volume_claim(pvc_name, namespace='pi-edge')
+ api_response_pvc_removal = api_instance_corev1api.delete_namespaced_persistent_volume_claim(pvc_name, namespace='sunrise6g')
api_response_pv_removal = api_instance_corev1api.delete_persistent_volume(pv_name)
else:
api_response_current.spec.template.spec.node_selector = {'location': service_function_to_migrate.destination_location}
- api_response_new = api_instance_appsv1.patch_namespaced_deployment(name=service_function_to_migrate.service_function_instance_name, namespace='pi-edge',
+ api_response_new = api_instance_appsv1.patch_namespaced_deployment(name=service_function_to_migrate.service_function_instance_name, namespace='sunrise6g',
body=api_response_current)
body_r = f"Service function {service_function_to_migrate.service_function_instance_name} successfully migrated from {source_location} to {destination_location}!"
@@ -1242,8 +1251,8 @@ def create_pv_migration_job(source_pvc, destination_pvc, source_location):
"args": [
"pv-migrate", "migrate", f"{source_pvc}", f"{destination_pvc}",
"-k", "/root/.kube/config",
- "-n", "pi-edge",
- "-N", "pi-edge",
+ "-n", "sunrise6g",
+ "-N", "sunrise6g",
"-i", "-s", "svc,lbsvc", "-b"
],
"volumeMounts": [
@@ -1275,7 +1284,7 @@ def create_pv_migration_job(source_pvc, destination_pvc, source_location):
return job_manifest
def is_job_completed(job_name):
- job = api_instance_batchv1.read_namespaced_job(name=job_name, namespace="pi-edge")
+ job = api_instance_batchv1.read_namespaced_job(name=job_name, namespace="sunrise6g")
if job.status.succeeded is not None and job.status.succeeded > 0:
return True
return False
diff --git a/service-resource-manager-implementation/swagger_server/utils/mec_connector.py b/service-resource-manager-implementation/swagger_server/utils/mec_connector.py
index 60ddb3c..9d5f666 100644
--- a/service-resource-manager-implementation/swagger_server/utils/mec_connector.py
+++ b/service-resource-manager-implementation/swagger_server/utils/mec_connector.py
@@ -1,83 +1,83 @@
-from __future__ import print_function
-import os
-import time
-from swagger_server.utils import connector_db
-import requests
-from requests.structures import CaseInsensitiveDict
-# import traceback
-# import logging
+# from __future__ import print_function
+# import os
+# import time
+# from swagger_server.utils import connector_db
+# import requests
+# from requests.structures import CaseInsensitiveDict
+# # import traceback
+# # import logging
-mec_ip=os.environ["MEC_PLATFORM_IP"].strip()
-mec_port=os.environ["MEC_PLATFORM_PORT"].strip()
-host = "http://" + mec_ip + ":" + mec_port
+# mec_ip=os.environ["MEC_PLATFORM_IP"].strip()
+# mec_port=os.environ["MEC_PLATFORM_PORT"].strip()
+# host = "http://" + mec_ip + ":" + mec_port
-def get_services(serviceid):
+# def get_services(serviceid):
- if serviceid is None:
- url = host + "/mec_platform/applications/mec_dataspace_connectors/services"
- else:
- url=host + "/mec_platform/applications/mec_dataspace_connectors/services/"+serviceid
+# if serviceid is None:
+# url = host + "/mec_platform/applications/mec_dataspace_connectors/services"
+# else:
+# url=host + "/mec_platform/applications/mec_dataspace_connectors/services/"+serviceid
- response = requests.post(url, verify=False)
- return response
+# response = requests.post(url, verify=False)
+# return response
-def deregister_service(service_id):
- url = host + "/mec_platform/applications/mec_dataspace_connectors/services/"+service_id
- response = requests.delete(url, verify=False)
- return response
+# def deregister_service(service_id):
+# url = host + "/mec_platform/applications/mec_dataspace_connectors/services/"+service_id
+# response = requests.delete(url, verify=False)
+# return response
-def register_service(service_url, service_name, service_id):
+# def register_service(service_url, service_name, service_id):
- json_body= {
- "serInstanceId": service_id,
- "serName": service_name,
- "serCategory": {
- "href": "string",
- "id": "1",
- "name": "dataspace_connector",
- "version": "string"
- },
- "version": "1.0",
- "state": "ACTIVE",
- "transportInfo": {
- "id": "string",
- "name": "string",
- "description": "string",
- "type": "REST_HTTP",
- "protocol": "string",
- "version": "string",
- "security": {
- "oAuth2Info": {
- "grantTypes": [
- "OAUTH2_AUTHORIZATION_CODE"
- ],
- "tokenEndpoint": "string"
- }
- },
- "implSpecificInfo": {}
- },
- "serializer": "JSON",
- "scopeOfLocality": "MEC_SYSTEM",
- "consumedLocalOnly": True,
- "isLocal": True,
- "livenessInterval": 0,
- "_links": {
- "self": {
- "href": service_url
- },
- "liveness": {
- "href": "string"
- }
- }
- }
- try:
- url = host + "/mec_platform/applications/mec_dataspace_connectors/services"
- #headers = {"Authorization": "Bearer " + token_k8s}
- response = requests.post(url, json=json_body, verify=False)
- return response
- except requests.exceptions.HTTPError as e:
- return ("Exception when calling POST at mec_platform/applications/mec_dataspace_connectors/services\n" % e)
\ No newline at end of file
+# json_body= {
+# "serInstanceId": service_id,
+# "serName": service_name,
+# "serCategory": {
+# "href": "string",
+# "id": "1",
+# "name": "dataspace_connector",
+# "version": "string"
+# },
+# "version": "1.0",
+# "state": "ACTIVE",
+# "transportInfo": {
+# "id": "string",
+# "name": "string",
+# "description": "string",
+# "type": "REST_HTTP",
+# "protocol": "string",
+# "version": "string",
+# "security": {
+# "oAuth2Info": {
+# "grantTypes": [
+# "OAUTH2_AUTHORIZATION_CODE"
+# ],
+# "tokenEndpoint": "string"
+# }
+# },
+# "implSpecificInfo": {}
+# },
+# "serializer": "JSON",
+# "scopeOfLocality": "MEC_SYSTEM",
+# "consumedLocalOnly": True,
+# "isLocal": True,
+# "livenessInterval": 0,
+# "_links": {
+# "self": {
+# "href": service_url
+# },
+# "liveness": {
+# "href": "string"
+# }
+# }
+# }
+# try:
+# url = host + "/mec_platform/applications/mec_dataspace_connectors/services"
+# #headers = {"Authorization": "Bearer " + token_k8s}
+# response = requests.post(url, json=json_body, verify=False)
+# return response
+# except requests.exceptions.HTTPError as e:
+# return ("Exception when calling POST at mec_platform/applications/mec_dataspace_connectors/services\n" % e)
\ No newline at end of file
diff --git a/service-resource-manager-implementation/swagger_server/utils/nodes_monitoring.py b/service-resource-manager-implementation/swagger_server/utils/nodes_monitoring.py
index 76b2fb7..d715b04 100644
--- a/service-resource-manager-implementation/swagger_server/utils/nodes_monitoring.py
+++ b/service-resource-manager-implementation/swagger_server/utils/nodes_monitoring.py
@@ -1,426 +1,426 @@
-from __future__ import print_function
-import os
-import time
-import copy
-import requests
-import logging
-from threading import Thread
+# from __future__ import print_function
+# import os
+# import time
+# import copy
+# import requests
+# import logging
+# from threading import Thread
-from requests.structures import CaseInsensitiveDict
-# import traceback
-# import logging
-#scaling_type="minimize_cost"
+# from requests.structures import CaseInsensitiveDict
+# # import traceback
+# # import logging
+# #scaling_type="minimize_cost"
-#K8S AUTH
-import json
-#import pandas as pd
-from urllib.request import urlopen
+# #K8S AUTH
+# import json
+# #import pandas as pd
+# from urllib.request import urlopen
-#host="http://grafana.monitoring:3000"
-node_ip=os.environ["MONITORING_IP"].strip()
-node_port=os.environ["MONITORING_NODE_PORT"].strip()
+# #host="http://grafana.monitoring:3000"
+# node_ip=os.environ["MONITORING_IP"].strip()
+# node_port=os.environ["MONITORING_NODE_PORT"].strip()
-node_ip_proxy=os.environ["MONITORING_IP_PROXY"].strip()
-node_port_proxy=os.environ["MONITORING_PORT_PROXY"].strip()
+# node_ip_proxy=os.environ["MONITORING_IP_PROXY"].strip()
+# node_port_proxy=os.environ["MONITORING_PORT_PROXY"].strip()
-driver = os.environ["DRIVER"].strip()
+# driver = os.environ["DRIVER"].strip()
-host="http://"+node_ip+":"+node_port
-#node_ip="203.0.113.172"
-#node_port="3000"
+# host="http://"+node_ip+":"+node_port
+# #node_ip="203.0.113.172"
+# #node_port="3000"
-if node_ip!=node_ip_proxy:
- node_for_responce=node_ip_proxy
- port_for_responce=node_port_proxy
-else:
- node_for_responce = node_ip
- port_for_responce = node_port
+# if node_ip!=node_ip_proxy:
+# node_for_responce=node_ip_proxy
+# port_for_responce=node_port_proxy
+# else:
+# node_for_responce = node_ip
+# port_for_responce = node_port
-username = "admin"
-password = os.environ["MONITORING_SERVICE_PASSWORD"].strip()
-#!!!!!!!!!!!!!!!!
-# Configure API key authorization: BearerToken
-#configuration.api_key['authorization'] = token_k8s
-#!!!!!!!!!!!!!!!!
+# username = "admin"
+# password = os.environ["MONITORING_SERVICE_PASSWORD"].strip()
+# #!!!!!!!!!!!!!!!!
+# # Configure API key authorization: BearerToken
+# #configuration.api_key['authorization'] = token_k8s
+# #!!!!!!!!!!!!!!!!
-# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+# # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
-def get_monitoring_ip():
- return node_ip
+# def get_monitoring_ip():
+# return node_ip
-def get_monitoring_port():
- return node_port
+# def get_monitoring_port():
+# return node_port
-#works for grafana/grafana:8.1.3
-def create_monitoring_for_all_infra(nodes):
- #public url for retrieving infra url
+# #works for grafana/grafana:8.1.3
+# def create_monitoring_for_all_infra(nodes):
+# #public url for retrieving infra url
- if driver == "docker":
- f=open(os.path.join(os.path.split(os.path.dirname(__file__))[0], 'monitoring_files/infra_metric_with_throughput_beautified_docker.json'))
- else:
- f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0], 'monitoring_files/infra_metric_with_throughput.json'))
+# if driver == "docker":
+# f=open(os.path.join(os.path.split(os.path.dirname(__file__))[0], 'monitoring_files/infra_metric_with_throughput_beautified_docker.json'))
+# else:
+# f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0], 'monitoring_files/infra_metric_with_throughput.json'))
- data = json.load(f)
+# data = json.load(f)
- # url = "https://raw.githubusercontent.com/tandem-project/TANDEM-project/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/infra_metrics_plus_throughput.json"
- ### #url = "https://github.com/tandem-project/TANDEM-project/blob/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/Infrastructure%20Metrics.json"
- #r = requests.get(url)
- grafana_dashboard = data
- #print(grafana_dashboard)
- init_panels = grafana_dashboard["dashboard"]["panels"].copy()
- grafana_dashboard["dashboard"]["panels"]=[].copy()
- #check number of nodes
- new_panels = []
- # if len(nodes)==1:
- # for panel in init_panels:
- # panel_={}
- # expr=panel["targets"][0]["expr"]
- # panel_=panel
- #
- # panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", nodes[0]["name"])
- #
- # panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", "1")
- # panel_["title"] = panel["title"].replace("NODE_NUMBER", "1")
- # new_panels.append(panel_)
- # else:
+# # url = "https://raw.githubusercontent.com/tandem-project/TANDEM-project/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/infra_metrics_plus_throughput.json"
+# ### #url = "https://github.com/tandem-project/TANDEM-project/blob/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/Infrastructure%20Metrics.json"
+# #r = requests.get(url)
+# grafana_dashboard = data
+# #print(grafana_dashboard)
+# init_panels = grafana_dashboard["dashboard"]["panels"].copy()
+# grafana_dashboard["dashboard"]["panels"]=[].copy()
+# #check number of nodes
+# new_panels = []
+# # if len(nodes)==1:
+# # for panel in init_panels:
+# # panel_={}
+# # expr=panel["targets"][0]["expr"]
+# # panel_=panel
+# #
+# # panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", nodes[0]["name"])
+# #
+# # panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", "1")
+# # panel_["title"] = panel["title"].replace("NODE_NUMBER", "1")
+# # new_panels.append(panel_)
+# # else:
- node_number = 0
+# node_number = 0
- for node in nodes:
+# for node in nodes:
- # node_number = node_number + 1
- panel_number=0
- for panel in init_panels:
+# # node_number = node_number + 1
+# panel_number=0
+# for panel in init_panels:
- panel_number=panel_number+1
- expr = panel["targets"][0]["expr"]
- panel_ = copy.deepcopy(panel)
+# panel_number=panel_number+1
+# expr = panel["targets"][0]["expr"]
+# panel_ = copy.deepcopy(panel)
- if driver == "docker":
- panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", node["serial"]+":9323")
- panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", node['name'])
- panel_["title"] = panel["title"].replace("NODE_NUMBER", node['name'])
- else:
- panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", node["name"])
- panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", str(node_number))
- panel_["title"] = panel["title"].replace("NODE_NUMBER", str(node_number))
+# if driver == "docker":
+# panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", node["serial"]+":9323")
+# panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", node['name'])
+# panel_["title"] = panel["title"].replace("NODE_NUMBER", node['name'])
+# else:
+# panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", node["name"])
+# panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", str(node_number))
+# panel_["title"] = panel["title"].replace("NODE_NUMBER", str(node_number))
- panel_["id"] = str(node_number) +""+ str(panel_number)
- new_panels.append(panel_)
+# panel_["id"] = str(node_number) +""+ str(panel_number)
+# new_panels.append(panel_)
- grafana_dashboard["dashboard"]["panels"]=new_panels
+# grafana_dashboard["dashboard"]["panels"]=new_panels
- #send request to grafana!
- try:
-
- url = host + "/api/dashboards/import"
- #body_ = grafana_dashboard
- body_ = grafana_dashboard.copy()
+# #send request to grafana!
+# try:
+
+# url = host + "/api/dashboards/import"
+# #body_ = grafana_dashboard
+# body_ = grafana_dashboard.copy()
- #headers = {"Authorization": "Bearer " + token_k8s}
-
- x = requests.post(host + "/api/dashboards/import", json=body_, verify=False, auth=(username, password))
- if x.status_code == 200 or x.status_code == 201:
- json_response=x.json()
- # final_mon_url="http://" + node_ip_proxy + ":" + node_port_proxy + json_response["importedUrl"]
- final_mon_url = f"{host}{json_response['importedUrl']}"
- else:
- final_mon_url = "An Error occured, Please try again"
-
- return final_mon_url
- except requests.exceptions.HTTPError as e:
- # logging.error(traceback.format_exc())
- return ("Exception when calling /api/dashboards/import %s\n" % e)
-
-
-
-
-
-#works for grafana/grafana:8.1.3
-def create_monitoring_infra_per_node(node,node_number):
- #public url for retrieving infra url
- if driver == "docker":
- f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0],
- 'monitoring_files/infra_metric_with_throughput_beautified_docker.json'))
- else:
- f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0],
- 'monitoring_files/infra_metric_with_throughput.json'))
- data = json.load(f)
- #url = "https://raw.githubusercontent.com/tandem-project/TANDEM-project/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/infra_metrics_plus_throughput.json"
- ###url = "https://github.com/tandem-project/TANDEM-project/blob/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/Infrastructure%20Metrics.json"
- #r = requests.get(url)
- grafana_dashboard = data
- init_panels = grafana_dashboard["dashboard"]["panels"].copy()
- grafana_dashboard["dashboard"]["panels"]=[].copy()
- #check number of nodes
- new_panels = []
- for panel in init_panels:
- #panel_={}
- expr=panel["targets"][0]["expr"]
- #panel_=panel
- panel_ = copy.deepcopy(panel)
-
- if driver == "docker":
- panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", node["serial"]+":9323")
- panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", node['name'])
- panel_["title"] = panel["title"].replace("NODE_NUMBER", node['name'])
- else:
- panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", node["name"])
- panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", str(node_number))
- panel_["title"] = panel["title"].replace("NODE_NUMBER", str(node_number))
- new_panels.append(panel_)
-
- grafana_dashboard["dashboard"]["panels"]=new_panels
-
- old_title=grafana_dashboard["dashboard"]["title"]
- grafana_dashboard["dashboard"]["title"]= old_title + " Node " + str(node_number)
- old_uid=grafana_dashboard["dashboard"]["uid"]
- grafana_dashboard["dashboard"]["uid"] = old_uid + "-node-" + str(node_number)
-
-
- #send request to grafana!
- try:
- url = host + "/api/dashboards/import"
- #body_ = grafana_dashboard
- #body_ = grafana_dashboard
-
- body_=grafana_dashboard
- #headers = {"Authorization": "Bearer " + token_k8s}
- x = requests.post(url, json=body_, verify=False, auth=(username, password))
-
- if x.status_code==200 or x.status_code==201:
- json_response=x.json()
- # final_mon_url="http://"+node_ip_proxy+":"+node_port_proxy+json_response["importedUrl"]
- final_mon_url=f"{host}{json_response['importedUrl']}"
- else:
- final_mon_url = "An Error occured, Please try again"
-
- return final_mon_url
- except requests.exceptions.HTTPError as e:
- # logging.error(traceback.format_exc())
- return ("Exception when calling /api/dashboards/import %s\n" % e)
-
-
-
-def create_monitoring_for_all_service_functions(service_functions, node_name):
- #public url for retrieving infra url
-
- f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0], 'monitoring_files/service_function_metrics_with_throughput.json'))
- data = json.load(f)
-
- #url = "https://raw.githubusercontent.com/tandem-project/TANDEM-project/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/basic_service_function_monitoring.json"
- #url = "https://github.com/tandem-project/TANDEM-project/blob/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/Infrastructure%20Metrics.json"
- #r = requests.get(url)
- grafana_dashboard = data
- init_panels = grafana_dashboard["dashboard"]["panels"].copy()
- grafana_dashboard["dashboard"]["panels"]=[].copy()
- #check number of nodes
- new_panels = []
- # if len(nodes)==1:
- # for panel in init_panels:
- # panel_={}
- # expr=panel["targets"][0]["expr"]
- # panel_=panel
- #
- # panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", nodes[0]["name"])
- #
- # panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", "1")
- # panel_["title"] = panel["title"].replace("NODE_NUMBER", "1")
- # new_panels.append(panel_)
- # else:
-
-
-
- sf_number=0
- for sf in service_functions:
- for panel in init_panels:
- if node_name==sf.get('node_name'):
- sf_number=sf_number+1
- expr = panel["targets"][0]["expr"]
- panel_ = copy.deepcopy(panel) #VERY IMPORTAND!!!!!!!!!!!!!!
- #panel_["id"]=sf_number
- panel_["targets"][0]["expr"] = expr.replace("SERVICE_FUNCTION_INSTANCE_NAME", sf["service_function_instance_name"])
- panel_["title"] = panel["title"].replace("SERVICE_FUNCTION_INSTANCE_NAME", sf["service_function_instance_name"])
- panel_["id"] = panel_["title"]
- new_panels.append(panel_)
- #panel_.clear()
-
- grafana_dashboard["dashboard"]["panels"]=new_panels.copy()
-
- #grafana_dashboard["dashboard"]["title"]="Node: "+node_name+ " "+ grafana_dashboard["dashboard"]["title"]
- grafana_dashboard["dashboard"]["title"]=grafana_dashboard["dashboard"]["title"] +" node: "+node_name
- grafana_dashboard["dashboard"]["uid"]=grafana_dashboard["dashboard"]["uid"]+"-"+node_name
- #send request to grafana!
-
-
- try:
-
- url = host + "/api/dashboards/import"
- body_ = grafana_dashboard
+# #headers = {"Authorization": "Bearer " + token_k8s}
+
+# x = requests.post(host + "/api/dashboards/import", json=body_, verify=False, auth=(username, password))
+# if x.status_code == 200 or x.status_code == 201:
+# json_response=x.json()
+# # final_mon_url="http://" + node_ip_proxy + ":" + node_port_proxy + json_response["importedUrl"]
+# final_mon_url = f"{host}{json_response['importedUrl']}"
+# else:
+# final_mon_url = "An Error occured, Please try again"
+
+# return final_mon_url
+# except requests.exceptions.HTTPError as e:
+# # logging.error(traceback.format_exc())
+# return ("Exception when calling /api/dashboards/import %s\n" % e)
+
+
+
+
+
+# #works for grafana/grafana:8.1.3
+# def create_monitoring_infra_per_node(node,node_number):
+# #public url for retrieving infra url
+# if driver == "docker":
+# f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0],
+# 'monitoring_files/infra_metric_with_throughput_beautified_docker.json'))
+# else:
+# f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0],
+# 'monitoring_files/infra_metric_with_throughput.json'))
+# data = json.load(f)
+# #url = "https://raw.githubusercontent.com/tandem-project/TANDEM-project/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/infra_metrics_plus_throughput.json"
+# ###url = "https://github.com/tandem-project/TANDEM-project/blob/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/Infrastructure%20Metrics.json"
+# #r = requests.get(url)
+# grafana_dashboard = data
+# init_panels = grafana_dashboard["dashboard"]["panels"].copy()
+# grafana_dashboard["dashboard"]["panels"]=[].copy()
+# #check number of nodes
+# new_panels = []
+# for panel in init_panels:
+# #panel_={}
+# expr=panel["targets"][0]["expr"]
+# #panel_=panel
+# panel_ = copy.deepcopy(panel)
+
+# if driver == "docker":
+# panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", node["serial"]+":9323")
+# panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", node['name'])
+# panel_["title"] = panel["title"].replace("NODE_NUMBER", node['name'])
+# else:
+# panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", node["name"])
+# panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", str(node_number))
+# panel_["title"] = panel["title"].replace("NODE_NUMBER", str(node_number))
+# new_panels.append(panel_)
+
+# grafana_dashboard["dashboard"]["panels"]=new_panels
+
+# old_title=grafana_dashboard["dashboard"]["title"]
+# grafana_dashboard["dashboard"]["title"]= old_title + " Node " + str(node_number)
+# old_uid=grafana_dashboard["dashboard"]["uid"]
+# grafana_dashboard["dashboard"]["uid"] = old_uid + "-node-" + str(node_number)
+
+
+# #send request to grafana!
+# try:
+# url = host + "/api/dashboards/import"
+# #body_ = grafana_dashboard
+# #body_ = grafana_dashboard
+
+# body_=grafana_dashboard
+# #headers = {"Authorization": "Bearer " + token_k8s}
+# x = requests.post(url, json=body_, verify=False, auth=(username, password))
+
+# if x.status_code==200 or x.status_code==201:
+# json_response=x.json()
+# # final_mon_url="http://"+node_ip_proxy+":"+node_port_proxy+json_response["importedUrl"]
+# final_mon_url=f"{host}{json_response['importedUrl']}"
+# else:
+# final_mon_url = "An Error occured, Please try again"
+
+# return final_mon_url
+# except requests.exceptions.HTTPError as e:
+# # logging.error(traceback.format_exc())
+# return ("Exception when calling /api/dashboards/import %s\n" % e)
+
+
+
+# def create_monitoring_for_all_service_functions(service_functions, node_name):
+# #public url for retrieving infra url
+
+# f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0], 'monitoring_files/service_function_metrics_with_throughput.json'))
+# data = json.load(f)
+
+# #url = "https://raw.githubusercontent.com/tandem-project/TANDEM-project/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/basic_service_function_monitoring.json"
+# #url = "https://github.com/tandem-project/TANDEM-project/blob/Master/TANDEM%20Edge/Edge%20Monitoring/grafana_templates/Infrastructure%20Metrics.json"
+# #r = requests.get(url)
+# grafana_dashboard = data
+# init_panels = grafana_dashboard["dashboard"]["panels"].copy()
+# grafana_dashboard["dashboard"]["panels"]=[].copy()
+# #check number of nodes
+# new_panels = []
+# # if len(nodes)==1:
+# # for panel in init_panels:
+# # panel_={}
+# # expr=panel["targets"][0]["expr"]
+# # panel_=panel
+# #
+# # panel_["targets"][0]["expr"] = expr.replace("NODE_NAME", nodes[0]["name"])
+# #
+# # panel_["targets"][0]["legendFormat"] = panel["targets"][0]["legendFormat"].replace("NODE_NUMBER", "1")
+# # panel_["title"] = panel["title"].replace("NODE_NUMBER", "1")
+# # new_panels.append(panel_)
+# # else:
+
+
+
+# sf_number=0
+# for sf in service_functions:
+# for panel in init_panels:
+# if node_name==sf.get('node_name'):
+# sf_number=sf_number+1
+# expr = panel["targets"][0]["expr"]
+# panel_ = copy.deepcopy(panel) #VERY IMPORTAND!!!!!!!!!!!!!!
+# #panel_["id"]=sf_number
+# panel_["targets"][0]["expr"] = expr.replace("SERVICE_FUNCTION_INSTANCE_NAME", sf["service_function_instance_name"])
+# panel_["title"] = panel["title"].replace("SERVICE_FUNCTION_INSTANCE_NAME", sf["service_function_instance_name"])
+# panel_["id"] = panel_["title"]
+# new_panels.append(panel_)
+# #panel_.clear()
+
+# grafana_dashboard["dashboard"]["panels"]=new_panels.copy()
+
+# #grafana_dashboard["dashboard"]["title"]="Node: "+node_name+ " "+ grafana_dashboard["dashboard"]["title"]
+# grafana_dashboard["dashboard"]["title"]=grafana_dashboard["dashboard"]["title"] +" node: "+node_name
+# grafana_dashboard["dashboard"]["uid"]=grafana_dashboard["dashboard"]["uid"]+"-"+node_name
+# #send request to grafana!
+
+
+# try:
+
+# url = host + "/api/dashboards/import"
+# body_ = grafana_dashboard
- #headers = {"Authorization": "Bearer " + token_k8s}
+# #headers = {"Authorization": "Bearer " + token_k8s}
- logging.info("reeady to send post request for monitoring")
+# logging.info("reeady to send post request for monitoring")
- x = requests.post(url, json=body_, verify=False, auth=(username, password))
+# x = requests.post(url, json=body_, verify=False, auth=(username, password))
- #x = requests.post(url, json=body_, verify=False, auth=(username, password))
- if x.status_code==200 or x.status_code==201:
- json_response=x.json()
+# #x = requests.post(url, json=body_, verify=False, auth=(username, password))
+# if x.status_code==200 or x.status_code==201:
+# json_response=x.json()
- # final_mon_url="http://"+node_ip_proxy+":"+node_port_proxy+json_response["importedUrl"]
- final_mon_url = f"{host}{json_response['importedUrl']}"
- else:
- final_mon_url="An Error occured, Please try again"
+# # final_mon_url="http://"+node_ip_proxy+":"+node_port_proxy+json_response["importedUrl"]
+# final_mon_url = f"{host}{json_response['importedUrl']}"
+# else:
+# final_mon_url="An Error occured, Please try again"
- return final_mon_url
- except requests.exceptions.HTTPError as e:
- # logging.error(traceback.format_exc())
- return ("Exception when calling /api/dashboards/import %s\n" % e)
+# return final_mon_url
+# except requests.exceptions.HTTPError as e:
+# # logging.error(traceback.format_exc())
+# return ("Exception when calling /api/dashboards/import %s\n" % e)
-def create_monitoring_for_service_function(service_function):
- f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0],
- 'monitoring_files/service_function_metrics_with_throughput.json'))
- data = json.load(f)
- grafana_dashboard = data
- init_panels = grafana_dashboard["dashboard"]["panels"].copy()
- grafana_dashboard["dashboard"]["panels"] = [].copy()
- new_panels = []
+# def create_monitoring_for_service_function(service_function):
+# f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0],
+# 'monitoring_files/service_function_metrics_with_throughput.json'))
+# data = json.load(f)
+# grafana_dashboard = data
+# init_panels = grafana_dashboard["dashboard"]["panels"].copy()
+# grafana_dashboard["dashboard"]["panels"] = [].copy()
+# new_panels = []
- deployed_name = service_function.service_function_instance_name
+# deployed_name = service_function.service_function_instance_name
- for panel in init_panels:
- expr = panel["targets"][0]["expr"]
- panel_ = copy.deepcopy(panel)
+# for panel in init_panels:
+# expr = panel["targets"][0]["expr"]
+# panel_ = copy.deepcopy(panel)
- panel_["targets"][0]["expr"] = expr.replace("SERVICE_FUNCTION_INSTANCE_NAME", deployed_name)
+# panel_["targets"][0]["expr"] = expr.replace("SERVICE_FUNCTION_INSTANCE_NAME", deployed_name)
- panel_["title"] = panel["title"].replace("SERVICE_FUNCTION_INSTANCE_NAME", deployed_name)
- panel_["id"] = panel_["title"]
+# panel_["title"] = panel["title"].replace("SERVICE_FUNCTION_INSTANCE_NAME", deployed_name)
+# panel_["id"] = panel_["title"]
- new_panels.append(panel_)
+# new_panels.append(panel_)
- grafana_dashboard["dashboard"]["panels"] = new_panels.copy()
- grafana_dashboard["dashboard"]["title"] = "Service Function: " + deployed_name
- grafana_dashboard["dashboard"]["uid"] = "sf" + "-" + deployed_name
+# grafana_dashboard["dashboard"]["panels"] = new_panels.copy()
+# grafana_dashboard["dashboard"]["title"] = "Service Function: " + deployed_name
+# grafana_dashboard["dashboard"]["uid"] = "sf" + "-" + deployed_name
- print(f"UID: {grafana_dashboard['dashboard']['uid']}")
+# print(f"UID: {grafana_dashboard['dashboard']['uid']}")
- # send request to grafana!
- try:
- url = host + "/api/dashboards/import"
- body_ = grafana_dashboard
- # headers = {"Authorization": "Bearer " + token_k8s}
+# # send request to grafana!
+# try:
+# url = host + "/api/dashboards/import"
+# body_ = grafana_dashboard
+# # headers = {"Authorization": "Bearer " + token_k8s}
- logging.info("reeady to send post request \ monitoring")
- x = requests.post(url, json=body_, verify=False, auth=(username, password))
- if x.status_code == 200 or x.status_code == 201:
- json_response = x.json()
- # final_mon_url = "http://" + node_dip_proxy + ":" + node_port_proxy + json_response["importedUrl"]
- final_mon_url = f"{host}{json_response['importedUrl']}"
- else:
- final_mon_url = "An Error occured, Please try again"
+# logging.info("reeady to send post request \ monitoring")
+# x = requests.post(url, json=body_, verify=False, auth=(username, password))
+# if x.status_code == 200 or x.status_code == 201:
+# json_response = x.json()
+# # final_mon_url = "http://" + node_dip_proxy + ":" + node_port_proxy + json_response["importedUrl"]
+# final_mon_url = f"{host}{json_response['importedUrl']}"
+# else:
+# final_mon_url = "An Error occured, Please try again"
- return final_mon_url
+# return final_mon_url
- except requests.exceptions.HTTPError as e:
- # logging.error(traceback.format_exc())
- return ("Exception when calling /api/dashboards/import %s\n" % e)
+# except requests.exceptions.HTTPError as e:
+# # logging.error(traceback.format_exc())
+# return ("Exception when calling /api/dashboards/import %s\n" % e)
-def create_monitoring_for_paas(service_functions, paas_name):
+# def create_monitoring_for_paas(service_functions, paas_name):
- f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0], 'monitoring_files/service_function_metrics_with_throughput.json'))
- data = json.load(f)
- grafana_dashboard=data
- init_panels = grafana_dashboard["dashboard"]["panels"].copy()
- grafana_dashboard["dashboard"]["panels"]=[].copy()
- new_panels = []
- sf_number=0
- for sf in service_functions:
+# f = open(os.path.join(os.path.split(os.path.dirname(__file__))[0], 'monitoring_files/service_function_metrics_with_throughput.json'))
+# data = json.load(f)
+# grafana_dashboard=data
+# init_panels = grafana_dashboard["dashboard"]["panels"].copy()
+# grafana_dashboard["dashboard"]["panels"]=[].copy()
+# new_panels = []
+# sf_number=0
+# for sf in service_functions:
- name_container=paas_name+"-"+sf["name"].replace('_', '')
- for panel in init_panels:
- sf_number=sf_number+1
- expr = panel["targets"][0]["expr"]
- panel_ = copy.deepcopy(panel)
- #panel_["id"]=sf_number
+# name_container=paas_name+"-"+sf["name"].replace('_', '')
+# for panel in init_panels:
+# sf_number=sf_number+1
+# expr = panel["targets"][0]["expr"]
+# panel_ = copy.deepcopy(panel)
+# #panel_["id"]=sf_number
- panel_["targets"][0]["expr"] = expr.replace("SERVICE_FUNCTION_INSTANCE_NAME", name_container)
+# panel_["targets"][0]["expr"] = expr.replace("SERVICE_FUNCTION_INSTANCE_NAME", name_container)
- panel_["title"] = panel["title"].replace("SERVICE_FUNCTION_INSTANCE_NAME", name_container)
- panel_["id"] = panel_["title"]
+# panel_["title"] = panel["title"].replace("SERVICE_FUNCTION_INSTANCE_NAME", name_container)
+# panel_["id"] = panel_["title"]
- new_panels.append(panel_)
- #panel_.clear()
+# new_panels.append(panel_)
+# #panel_.clear()
- grafana_dashboard["dashboard"]["panels"]=new_panels.copy()
- grafana_dashboard["dashboard"]["title"]="PaaS: "+paas_name
+# grafana_dashboard["dashboard"]["panels"]=new_panels.copy()
+# grafana_dashboard["dashboard"]["title"]="PaaS: "+paas_name
- #grafana_dashboard["dashboard"]["title"]="PaaS: "+paas_name+ " "+ grafana_dashboard["dashboard"]["title"]
- grafana_dashboard["dashboard"]["uid"]="paas"+"-"+paas_name
+# #grafana_dashboard["dashboard"]["title"]="PaaS: "+paas_name+ " "+ grafana_dashboard["dashboard"]["title"]
+# grafana_dashboard["dashboard"]["uid"]="paas"+"-"+paas_name
- #send request to grafana!
- try:
- url = host + "/api/dashboards/import"
- body_ = grafana_dashboard
- #headers = {"Authorization": "Bearer " + token_k8s}
+# #send request to grafana!
+# try:
+# url = host + "/api/dashboards/import"
+# body_ = grafana_dashboard
+# #headers = {"Authorization": "Bearer " + token_k8s}
- logging.info("reeady to send post request \ monitoring")
- x = requests.post(url, json=body_, verify=False, auth=(username, password))
- if x.status_code == 200 or x.status_code == 201:
- json_response = x.json()
- # final_mon_url = "http://" + node_ip_proxy + ":" + node_port_proxy + json_response["importedUrl"]
- final_mon_url = f"{host}{json_response['importedUrl']}"
- else:
- final_mon_url = "An Error occured, Please try again"
+# logging.info("reeady to send post request \ monitoring")
+# x = requests.post(url, json=body_, verify=False, auth=(username, password))
+# if x.status_code == 200 or x.status_code == 201:
+# json_response = x.json()
+# # final_mon_url = "http://" + node_ip_proxy + ":" + node_port_proxy + json_response["importedUrl"]
+# final_mon_url = f"{host}{json_response['importedUrl']}"
+# else:
+# final_mon_url = "An Error occured, Please try again"
- return final_mon_url
- except requests.exceptions.HTTPError as e:
- # logging.error(traceback.format_exc())
- return ("Exception when calling /api/dashboards/import %s\n" % e)
+# return final_mon_url
+# except requests.exceptions.HTTPError as e:
+# # logging.error(traceback.format_exc())
+# return ("Exception when calling /api/dashboards/import %s\n" % e)
-def delete_monitoring_for_service_function(sf_name):
- try:
- print(f"UID TO DELETE: sf-{sf_name}")
- url = host + f"/api/dashboards/uid/sf-{sf_name}"
- x = requests.delete(url, verify=False, auth=(username, password))
- json_response = x.json()
+# def delete_monitoring_for_service_function(sf_name):
+# try:
+# print(f"UID TO DELETE: sf-{sf_name}")
+# url = host + f"/api/dashboards/uid/sf-{sf_name}"
+# x = requests.delete(url, verify=False, auth=(username, password))
+# json_response = x.json()
- if x.status_code == 200:
- return "Dashboard deleted"
- except requests.exceptions.HTTPError as e:
- # logging.error(traceback.format_exc())
- return ("Exception when calling /api/dashboards/import %s\n" % e)
+# if x.status_code == 200:
+# return "Dashboard deleted"
+# except requests.exceptions.HTTPError as e:
+# # logging.error(traceback.format_exc())
+# return ("Exception when calling /api/dashboards/import %s\n" % e)
-def delete_monitoring_for_paas(paas_name):
+# def delete_monitoring_for_paas(paas_name):
- try:
+# try:
- url = host + "/api/dashboards/uid/paas-"+paas_name
- #headers = {"Authorization": "Bearer " + token_k8s}
- x = requests.delete(url, verify=False, auth=(username, password))
- json_response=x.json()
+# url = host + "/api/dashboards/uid/paas-"+paas_name
+# #headers = {"Authorization": "Bearer " + token_k8s}
+# x = requests.delete(url, verify=False, auth=(username, password))
+# json_response=x.json()
- if x.status_code==200:
- return "Dashboard deleted"
- except requests.exceptions.HTTPError as e:
- # logging.error(traceback.format_exc())
- return ("Exception when calling /api/dashboards/import %s\n" % e)
+# if x.status_code==200:
+# return "Dashboard deleted"
+# except requests.exceptions.HTTPError as e:
+# # logging.error(traceback.format_exc())
+# return ("Exception when calling /api/dashboards/import %s\n" % e)
diff --git a/srm-deployment.yaml b/srm-deployment.yaml
index d2c9682..2143373 100644
--- a/srm-deployment.yaml
+++ b/srm-deployment.yaml
@@ -1,3 +1,4 @@
+---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -6,13 +7,13 @@ metadata:
kompose.version: 1.26.0 (40646f47)
creationTimestamp: null
labels:
- io.kompose.service: piedgecontroller
- name: piedgecontroller
+ io.kompose.service: srmcontroller
+ name: srmcontroller
spec:
replicas: 1
selector:
matchLabels:
- io.kompose.service: piedgecontroller
+ io.kompose.service: srmcontroller
strategy: {}
template:
metadata:
@@ -21,52 +22,45 @@ spec:
kompose.version: 1.26.0 (40646f47)
creationTimestamp: null
labels:
- #io.kompose.network/netEMPkub: "true"
- io.kompose.service: piedgecontroller
+ io.kompose.service: srmcontroller
spec:
containers:
- env:
- name: KUBERNETES_MASTER_HOSTNAME
- value: "sunrise6gsrv"
+ value: k3d-sunriseop-server-0
- name: KUBERNETES_MASTER_PASSWORD
- value: "dLask"
+ value: ameThyst23!
- name: KUBERNETES_MASTER_IP
- value: "146.124.106.229"
+ value: k3d-sunriseop-server-0
- name: KUBERNETES_MASTER_PORT
- value: "16443"
- - name: KUBE_CONFIG_PATH
- value: "kubeconfig/config.yaml"
+ value: "6443"
+ - name: KUBERNETES_USERNAME
+ value: cluster-admin
+ - name: KUBE_CONFIG_PATH
+ value: ../.kube/config
- name: EMP_STORAGE_URI
value: mongodb://mongopiedge:27017
- name: KUBERNETES_MASTER_TOKEN
- value: TVVGV1FJb3l0alNUOUdEeVRvbnZKdGhZS3FXUXg2aG5mMGVxekRqRnZhWT0K
- - name: MONITORING_SERVICE_PASSWORD
- value: "tandem"
- - name: MEC_PLATFORM_IP
- value: "146.124.106.209"
- - name: MEC_PLATFORM_PORT
- value: "32500"
- - name: MONITORING_IP_PROXY
- value: "146.124.106.220"
- - name: MONITORING_PORT_PROXY
- value: "31000"
- - name: MONITORING_IP
- value: "146.124.106.209"
- - name: MONITORING_NODE_PORT
- value: "443"
+ value: eyJhbGciOiJSUzI1NiIsImtpZCI6IkRRS3VMNktkc1BOYk5ZeDhfSnFvVmJQdkJ6em1FODhPeHNIMHFya3JEQzgifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6InNybS1zZWNyZXQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiY2x1c3Rlci1hZG1pbiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImU1MjUxZjhiLWY2ODItNDU0Ni1hOTgxLWNlNTk0YTg2NmZiNCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0OmNsdXN0ZXItYWRtaW4ifQ.rnZyHFEE1ywceWqcio0UKQrp5GdfVGQOCXxx3RJpb_vvDj65GvNwN0VgA_anOlzj8kKJ9JQjWrA7an2k-5w0ycjeu8Ei_5Z0dvgRSpvKc4O5kCHddOB1kJl480hKWtZqgL0Vi6YbOziFGqvPd8hxHSTquxUgXEN2BStqII8MpVEK8z8iU2pJE5CNIaukGBozjlgc1Vb6HiEU4_UhlqG61uO6ReRVrzaYa4T1j4Zvvx1JN8t2HYcuv50QlHPrEAfW2F3ed0SBbb_X8AT0pGJrVas_uqZgMcN1j5BLO51RNmCY27ADHwCbj8HWuiHhyuLKQxYw8yKB-iMNQmq2fk3ezw
- name: DRIVER
- value: "kubernetes"
+ value: kubernetes
- name: ARTIFACT_MANAGER_ADDRESS
- value: "artifact-manager"
-
- image: piedge/pi_edge:ectf
- name: piedgecontroller
+ value: artifact-manager
+ - name: EDGE_CLOUD_ADAPTER_NAME
+ value: piedge
+ - name: PLATFORM_PROVIDER
+ value: ISI
+ image: ghcr.io/openoperatorplatform/srm/srm:1.0.0
+ name: srmcontroller
ports:
- containerPort: 8080
resources: {}
imagePullPolicy: Always
restartPolicy: Always
+ imagePullSecrets:
+ - name: ghcr-login-secret
status: {}
+
---
apiVersion: v1
kind: Service
@@ -76,8 +70,8 @@ metadata:
kompose.version: 1.26.0 (40646f47)
creationTimestamp: null
labels:
- io.kompose.service: piedgecontroller
- name: piedgecontroller
+ io.kompose.service: srm
+ name: srm
spec:
type: NodePort
ports:
@@ -86,10 +80,61 @@ spec:
port: 8080
targetPort: 8080
selector:
- io.kompose.service: piedgecontroller
+ io.kompose.service: srmcontroller
status:
loadBalancer: {}
+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+ name: srm-ingress
+ namespace: piedge
+ annotations:
+ #traefik.ingress.kubernetes.io/router.entrypoints: web
+spec:
+ ingressClassName: nginx
+ rules:
+ - http:
+ paths:
+ - path: /srm
+ pathType: Prefix
+ backend:
+ service:
+ name: srm
+ port:
+ number: 8080
+---
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+ name: mongodb-pv-volume # Sets PV's name
+ labels:
+ type: local # Sets PV's type to local
+ app: mongopiedge
+spec:
+ storageClassName: manual
+ capacity:
+ storage: 200Mi # Sets PV Volume
+ accessModes:
+ - ReadWriteOnce
+ hostPath:
+ path: "/mnt/data/mongodb_srm"
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ creationTimestamp: null
+ labels:
+ io.kompose.service: mongo-db
+ name: mongo-db
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 200Mi
+status: {}
---
apiVersion: apps/v1
kind: Deployment
@@ -99,14 +144,15 @@ metadata:
kompose.version: 1.26.0 (40646f47)
creationTimestamp: null
labels:
- io.kompose.service: service-resource-manager
- name: service-resource-manager
+ io.kompose.service: mongopiedge
+ name: mongopiedge
spec:
replicas: 1
selector:
matchLabels:
- io.kompose.service: service-resource-manager
- strategy: {}
+ io.kompose.service: mongopiedge
+ strategy:
+ type: Recreate
template:
metadata:
annotations:
@@ -115,22 +161,90 @@ spec:
creationTimestamp: null
labels:
#io.kompose.network/netEMPkub: "true"
- io.kompose.service: service-resource-manager
+ io.kompose.service: mongopiedge
+ spec:
+ containers:
+ - image: mongo
+ name: mongopiedge
+ ports:
+ - containerPort: 27017
+ resources: {}
+ volumeMounts:
+ - mountPath: /data/db
+ name: mongo-db
+ restartPolicy: Always
+ volumes:
+ - name: mongo-db
+ persistentVolumeClaim:
+ claimName: mongo-db
+status: {}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ annotations:
+ kompose.cmd: kompose convert
+ kompose.version: 1.26.0 (40646f47)
+ creationTimestamp: null
+ labels:
+ io.kompose.service: mongopiedge
+ name: mongopiedge
+spec:
+ type: ClusterIP
+ ports:
+ - name: "27017"
+ port: 27017
+ targetPort: 27017
+ selector:
+ io.kompose.service: mongopiedge
+status:
+ loadBalancer: {}
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ annotations:
+ kompose.cmd: kompose convert
+ kompose.version: 1.26.0 (40646f47)
+ creationTimestamp: null
+ labels:
+ io.kompose.service: oegcontroller
+ name: oegcontroller
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ io.kompose.service: oegcontroller
+ strategy: {}
+ template:
+ metadata:
+ annotations:
+ kompose.cmd: kompose convert
+ kompose.version: 1.26.0 (40646f47)
+ creationTimestamp: null
+ labels:
+ io.kompose.service: oegcontroller
spec:
containers:
- env:
- - name: K8S_ADAPTER_ADDRESS
- value: "piedgecontroller:8080"
- - name: PLATFORM_PROVIDER
- value: "ICOM"
-
- image: piedge/pi_edge:srm
- name: service-resource-manager
+ - name: MONGO_URI
+ value: mongodb://oegmongo/sample_db?authSource=admin
+ - name: SRM_HOST
+ value: http://srm
+ - name: PI_EDGE_USERNAME
+ value: username
+ - name: PI_EDGE_PASSWORD
+ value: password
+ - name: HTTP_PROXY
+ value: http://proxy
+ image: geop4p/oeg:1.0.0
+ name: oegcontroller
ports:
- containerPort: 8080
resources: {}
imagePullPolicy: Always
restartPolicy: Always
+
status: {}
---
apiVersion: v1
@@ -141,8 +255,8 @@ metadata:
kompose.version: 1.26.0 (40646f47)
creationTimestamp: null
labels:
- io.kompose.service: service-resource-manager
- name: srm
+ io.kompose.service: oeg
+ name: oeg
spec:
type: NodePort
ports:
@@ -151,31 +265,122 @@ spec:
port: 8080
targetPort: 8080
selector:
- io.kompose.service: service-resource-manager
+ io.kompose.service: oegcontroller
status:
loadBalancer: {}
+
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: srm-ingress
- namespace: sunrise
+ name: oeg-ingress
+ namespace: piedge
annotations:
- #nginx.ingress.kubernetes.io/use-regex: "true"
- nginx.ingress.kubernetes.io/rewrite-target: /$2
- managedFields:
- - manager: nginx-ingress-controller
- operation: Update
- apiVersion: networking.k8s.io/v1
+ #traefik.ingress.kubernetes.io/router.entrypoints: web
spec:
- ingressClassName: nginx
- rules:
- - http:
+ ingressClassName: nginx
+ rules:
+ - http:
paths:
- - path: /srm(/|$)(.*)
- pathType: Prefix
- backend:
- service:
- name: srm
- port:
- number: 8080
\ No newline at end of file
+ - path: /
+ pathType: Prefix
+ backend:
+ service:
+ name: oeg
+ port:
+ number: 8080
+---
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+ name: oegmongodb-pv-volume # Sets PV's name
+ labels:
+ type: local # Sets PV's type to local
+ app: oegmongo
+spec:
+ storageClassName: manual
+ capacity:
+ storage: 200Mi # Sets PV Volume
+ accessModes:
+ - ReadWriteOnce
+ hostPath:
+ path: "/mnt/data/mongodb_oeg"
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ creationTimestamp: null
+ labels:
+ io.kompose.service: oegmongo
+ name: oeg-mongo-db
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 200Mi
+status: {}
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ annotations:
+ kompose.cmd: kompose convert
+ kompose.version: 1.26.0 (40646f47)
+ creationTimestamp: null
+ labels:
+ io.kompose.service: oegmongo
+ name: oegmongo
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ io.kompose.service: oegmongo
+ strategy:
+ type: Recreate
+ template:
+ metadata:
+ annotations:
+ kompose.cmd: kompose convert
+ kompose.version: 1.26.0 (40646f47)
+ creationTimestamp: null
+ labels:
+ #io.kompose.network/netEMPkub: "true"
+ io.kompose.service: oegmongo
+ spec:
+ containers:
+ - image: mongo
+ name: oegmongo
+ ports:
+ - containerPort: 27017
+ resources: {}
+ volumeMounts:
+ - mountPath: /data/db
+ name: mongo-db
+ restartPolicy: Always
+ volumes:
+ - name: mongo-db
+ persistentVolumeClaim:
+ claimName: oeg-mongo-db
+status: {}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ annotations:
+ kompose.cmd: kompose convert
+ kompose.version: 1.26.0 (40646f47)
+ creationTimestamp: null
+ labels:
+ io.kompose.service: oegmongo
+ name: oegmongo
+spec:
+ type: ClusterIP
+ ports:
+ - name: "27018"
+ port: 27018
+ targetPort: 27017
+ selector:
+ io.kompose.service: oegmongo
+status:
+ loadBalancer: {}
\ No newline at end of file
--
GitLab