diff --git a/src/nbi/service/rest_server/nbi_plugins/camara_qod/Resources.py b/src/nbi/service/rest_server/nbi_plugins/camara_qod/Resources.py index 25382354542a9bbbd90d2d202c3a8fbcc7d568a6..cd89c02fbf97304d1ee655cd43b0e47a964b300b 100644 --- a/src/nbi/service/rest_server/nbi_plugins/camara_qod/Resources.py +++ b/src/nbi/service/rest_server/nbi_plugins/camara_qod/Resources.py @@ -1,4 +1,4 @@ -# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,31 +11,26 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from flask.json import jsonify -from flask_restful import Resource, request -from enum import Enum -import grpc._channel -from qos_profile.client.QoSProfileClient import QoSProfileClient -from werkzeug.exceptions import UnsupportedMediaType -from common.proto.context_pb2 import QoSProfileId, Uuid,Empty -from common.proto.qos_profile_pb2 import QoDConstraintsRequest + + +import copy, grpc, grpc._channel, logging from typing import Dict from uuid import uuid4 -import grpc, logging -import copy, deepmerge, json, logging -from typing import Dict +from flask.json import jsonify from flask_restful import Resource, request -from werkzeug.exceptions import UnsupportedMediaType +from common.proto.context_pb2 import QoSProfileId, Uuid,Empty from common.Constants import DEFAULT_CONTEXT_NAME from context.client.ContextClient import ContextClient +from qos_profile.client.QoSProfileClient import QoSProfileClient from service.client.ServiceClient import ServiceClient from .Tools import ( - format_grpc_to_json, grpc_context_id, grpc_service_id, QOD_2_service, service_2_qod,grpc_message_to_qos_table_data,create_qos_profile_from_json + format_grpc_to_json, grpc_context_id, grpc_service_id, + QOD_2_service, service_2_qod, grpc_message_to_qos_table_data, + create_qos_profile_from_json ) +LOGGER = logging.getLogger(__name__) -LOGGER = logging.getLogger(__name__) -#Initiate the QoSProfileClient class _Resource(Resource): def __init__(self) -> None: super().__init__() @@ -43,7 +38,7 @@ class _Resource(Resource): self.client = ContextClient() self.service_client = ServiceClient() -#ProfileList Endpoint for posting +#ProfileList Endpoint for posting class ProfileList(_Resource): def post(self): if not request.is_json: diff --git a/src/nbi/service/rest_server/nbi_plugins/camara_qod/Tools.py b/src/nbi/service/rest_server/nbi_plugins/camara_qod/Tools.py index feec71cb6bc126b325b692ddc6b9c53c8bb99c02..e0d19efffe90c1790042c71a09b37db6de0382c3 100644 --- a/src/nbi/service/rest_server/nbi_plugins/camara_qod/Tools.py +++ b/src/nbi/service/rest_server/nbi_plugins/camara_qod/Tools.py @@ -1,4 +1,4 @@ -# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/nbi/service/rest_server/nbi_plugins/camara_qod/__init__.py b/src/nbi/service/rest_server/nbi_plugins/camara_qod/__init__.py index ab4fe2bbd7af47a08604ac887d5015ff83e82191..19c4529559de7e768b6685fb71ff0de3f14315b3 100644 --- a/src/nbi/service/rest_server/nbi_plugins/camara_qod/__init__.py +++ b/src/nbi/service/rest_server/nbi_plugins/camara_qod/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,18 +13,17 @@ # limitations under the License. from nbi.service.rest_server.RestServer import RestServer -from .Resources import ProfileList, ProfileDetail, qodinfo, qodinfoId +from .Resources import ProfileList, ProfileDetail, QodInfo, QodInfoID URL_PREFIX = '/camara/qod/v0' # Use 'path' type since some identifiers might contain char '/' and Flask is unable to recognize them in 'string' type. RESOURCES = [ # (endpoint_name, resource_class, resource_url) - # TODO: Add appropriate endpoints - ('camara.qod_session_info', qodinfo, '/sessions'), - ('camara.qod_info_session_id', qodinfoId, '/sessions/<sessionId>'), - ('camara.qod.profile_list',ProfileList,'/profiles'), - ('camara.qod.profile_detail',ProfileDetail,'/profiles/<string:qos_profile_id>'), + ('camara.qod_session_info', QodInfo, '/sessions'), + ('camara.qod_info_session_id', QodInfoID, '/sessions/<sessionId>'), + ('camara.qod.profile_list', ProfileList, '/profiles'), + ('camara.qod.profile_detail', ProfileDetail, '/profiles/<string:qos_profile_id>'), ] def register_camara_qod(rest_server : RestServer):