Commit 0f3fc78c authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Pre-merge code cleanup

parent 429be319
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
# 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__)
#Initiate the QoSProfileClient

class _Resource(Resource):
    def __init__(self) -> None:
        super().__init__()
+1 −1
Original line number Diff line number Diff line
# 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.
+6 −7
Original line number Diff line number Diff line
# 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,16 +13,15 @@
# 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_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>'),
]