Loading service-resource-manager-implementation/src/controllers/network_functions_controller.py +16 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ from os import environ import logging import connexion from sunrise6g_opensdk.common.sdk import Sdk as sdkclient from sunrise6g_opensdk.network.core.common import CoreHttpError from sunrise6g_opensdk.network.core.schemas import RetrievalLocationRequest logger = logging.getLogger(__name__) Loading Loading @@ -49,6 +50,15 @@ def _safe_http_json_response(response): return {"error": "Invalid response from adapter", "details": str(e)}, 502 def _map_core_http_error(err: CoreHttpError): status_code = err.status_code or 502 if isinstance(err.body, (dict, list)): return err.body, status_code if err.body: return {"error": err.body}, status_code return {"error": str(err)}, status_code def create_qod_session(): if connexion.request.is_json: try: Loading Loading @@ -79,6 +89,9 @@ def get_qod_session(session_id: str): "code": "UNAVAILABLE", "message": "Service unavailable: Network Adapter", }, 503 except CoreHttpError as ce_: logger.error(ce_) return _map_core_http_error(ce_) except Exception as ce_: logger.error(ce_) return {"error": str(ce_)}, 500 Loading @@ -95,6 +108,9 @@ def delete_qod_session(session_id: str): "code": "UNAVAILABLE", "message": "Service unavailable: Network Adapter", }, 503 except CoreHttpError as ce_: logger.error(ce_) return _map_core_http_error(ce_) except Exception as ce_: logger.error(ce_) return {"error": str(ce_)}, 500 Loading Loading
service-resource-manager-implementation/src/controllers/network_functions_controller.py +16 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ from os import environ import logging import connexion from sunrise6g_opensdk.common.sdk import Sdk as sdkclient from sunrise6g_opensdk.network.core.common import CoreHttpError from sunrise6g_opensdk.network.core.schemas import RetrievalLocationRequest logger = logging.getLogger(__name__) Loading Loading @@ -49,6 +50,15 @@ def _safe_http_json_response(response): return {"error": "Invalid response from adapter", "details": str(e)}, 502 def _map_core_http_error(err: CoreHttpError): status_code = err.status_code or 502 if isinstance(err.body, (dict, list)): return err.body, status_code if err.body: return {"error": err.body}, status_code return {"error": str(err)}, status_code def create_qod_session(): if connexion.request.is_json: try: Loading Loading @@ -79,6 +89,9 @@ def get_qod_session(session_id: str): "code": "UNAVAILABLE", "message": "Service unavailable: Network Adapter", }, 503 except CoreHttpError as ce_: logger.error(ce_) return _map_core_http_error(ce_) except Exception as ce_: logger.error(ce_) return {"error": str(ce_)}, 500 Loading @@ -95,6 +108,9 @@ def delete_qod_session(session_id: str): "code": "UNAVAILABLE", "message": "Service unavailable: Network Adapter", }, 503 except CoreHttpError as ce_: logger.error(ce_) return _map_core_http_error(ce_) except Exception as ce_: logger.error(ce_) return {"error": str(ce_)}, 500 Loading