diff --git a/manifests/qkdappservice.yaml b/manifests/qkdappservice.yaml index 1be816b8e342f3686417e5e80b55c85f86b7477a..13f16f4e501b20208b93e3edcff9c161744632d2 100644 --- a/manifests/qkdappservice.yaml +++ b/manifests/qkdappservice.yaml @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI OSG/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/my_deploy.sh b/my_deploy.sh index 7cf57a6cb01840ec7414de7cf378b7ddf968a5b7..ee17cb3679f6390115917a005cfaf670585c28c7 100755 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -20,7 +20,7 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. -export TFS_COMPONENTS="context device app pathcomp service slice nbi webui load_generator" +export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" # Uncomment to activate Monitoring (old) #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" @@ -29,7 +29,7 @@ export TFS_COMPONENTS="context device app pathcomp service slice nbi webui load_ #export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager kpi_value_writer kpi_value_api" # Uncomment to activate BGP-LS Speaker -export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" +#export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" # Uncomment to activate Optical Controller # To manage optical connections, "service" requires "opticalcontroller" to be deployed @@ -71,7 +71,14 @@ export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" #fi # Uncomment to activate QKD App -#export TFS_COMPONENTS="${TFS_COMPONENTS} app" +# To manage QKD Apps, "service" requires "qkd_app" to be deployed +# before "service", thus we "hack" the TFS_COMPONENTS environment variable prepending the +# "qkd_app" only if "service" is already in TFS_COMPONENTS, and re-export it. +#if [[ "$TFS_COMPONENTS" == *"service"* ]]; then +# BEFORE="${TFS_COMPONENTS% service*}" +# AFTER="${TFS_COMPONENTS#* service}" +# export TFS_COMPONENTS="${BEFORE} qkd_app service ${AFTER}" +#fi # Set the tag you want to use for your images. @@ -115,7 +122,6 @@ export CRDB_PASSWORD="tfs123" # Set the database name to be used by Context. export CRDB_DATABASE="tfs" -export CRDB_DATABASE_APP="tfs_app" # Set CockroachDB installation mode to 'single'. This option is convenient for development and testing. # See ./deploy/all.sh or ./deploy/crdb.sh for additional details diff --git a/src/common/tools/object_factory/QKDApp.py b/src/common/tools/object_factory/QKDApp.py index e2ea688b9d7212162ec383b848857c6c4b197747..936a0f228302469ec51321623f8d8050f3daced0 100644 --- a/src/common/tools/object_factory/QKDApp.py +++ b/src/common/tools/object_factory/QKDApp.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI OSG/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/qkd_app/service/QKDAppServiceServicerImpl.py b/src/qkd_app/service/QKDAppServiceServicerImpl.py index ceda50029ea7acb014fba4bcbf87641edba919bb..df7a885c47eda9d7a6137c9905388da49c698e7e 100644 --- a/src/qkd_app/service/QKDAppServiceServicerImpl.py +++ b/src/qkd_app/service/QKDAppServiceServicerImpl.py @@ -13,7 +13,7 @@ # limitations under the License. import grpc, logging, sqlalchemy -from typing import Iterator, Optional +#from typing import Iterator, Optional from common.message_broker.MessageBroker import MessageBroker import grpc, json, logging #, deepdiff from common.proto.context_pb2 import ( @@ -21,20 +21,20 @@ from common.proto.context_pb2 import ( from common.proto.qkd_app_pb2 import (App, AppId, AppList, QKDAppTypesEnum) from common.proto.qkd_app_pb2_grpc import AppServiceServicer from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method -from common.tools.context_queries.InterDomain import is_inter_domain #, is_multi_domain -from common.tools.grpc.ConfigRules import copy_config_rules -from common.tools.grpc.Constraints import copy_constraints -from common.tools.grpc.EndPointIds import copy_endpoint_ids -from common.tools.grpc.ServiceIds import update_service_ids +#from common.tools.context_queries.InterDomain import is_inter_domain #, is_multi_domain +#from common.tools.grpc.ConfigRules import copy_config_rules +#from common.tools.grpc.Constraints import copy_constraints +#from common.tools.grpc.EndPointIds import copy_endpoint_ids +#from common.tools.grpc.ServiceIds import update_service_ids #from common.tools.grpc.Tools import grpc_message_to_json_string -from context.client.ContextClient import ContextClient -from qkd_app.client.QKDAppClient import QKDAppClient +#from context.client.ContextClient import ContextClient +#from qkd_app.client.QKDAppClient import QKDAppClient from .database.QKDApp import app_set, app_list_objs, app_get, app_get_by_server from common.method_wrappers.ServiceExceptions import NotFoundException LOGGER = logging.getLogger(__name__) -METRICS_POOL = MetricsPool('App', 'RPC') +METRICS_POOL = MetricsPool('QkdApp', 'RPC') # Optare: This file must be edited based on app's logic diff --git a/src/qkd_app/service/__main__.py b/src/qkd_app/service/__main__.py index db09b91f852e02bff2e08fe6606027d8d3c75fbc..ed7e554728eb2de6240dd4facb7f084337a026a4 100644 --- a/src/qkd_app/service/__main__.py +++ b/src/qkd_app/service/__main__.py @@ -14,15 +14,15 @@ import logging, signal, sys, threading from prometheus_client import start_http_server -from common.Constants import ServiceNameEnum +#from common.Constants import ServiceNameEnum from common.Settings import ( - ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_log_level, get_metrics_port, - wait_for_environment_variables) + #ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, + get_log_level, get_metrics_port, wait_for_environment_variables) from qkd_app.service.QKDAppService import AppService from qkd_app.service.rest_server.RestServer import RestServer from qkd_app.service.rest_server.qkd_app import register_qkd_app -from common.message_broker.Factory import get_messagebroker_backend -from common.message_broker.MessageBroker import MessageBroker +#from common.message_broker.Factory import get_messagebroker_backend +#from common.message_broker.MessageBroker import MessageBroker from qkd_app.service.database.Engine import Engine from qkd_app.service.database.models._Base import rebuild_database @@ -41,8 +41,8 @@ def main(): LOGGER = logging.getLogger(__name__) wait_for_environment_variables([ - get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST ), - get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC), + #get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST ), + #get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC), ]) signal.signal(signal.SIGINT, signal_handler) diff --git a/src/qkd_app/service/database/Engine.py b/src/qkd_app/service/database/Engine.py index 8120cd1534af0bfbeb8fc1072610e9ddf8cbbffc..8f528f9a1b3cacca2ea260901ab808461dd3183d 100644 --- a/src/qkd_app/service/database/Engine.py +++ b/src/qkd_app/service/database/Engine.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI OSG/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/qkd_app/service/database/QKDApp.py b/src/qkd_app/service/database/QKDApp.py index 16f1264c55199a8177e13e3deb2fea9ec77efde6..b1fb90d4efcd0770bcc4c48c1f00deb0e95687ad 100644 --- a/src/qkd_app/service/database/QKDApp.py +++ b/src/qkd_app/service/database/QKDApp.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI OSG/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/qkd_app/service/database/__init__.py b/src/qkd_app/service/database/__init__.py index b6826c7c5b10c9f427bdc50267bedfdb4ba7cb92..07d08814021ef82220611ee21c01ba01806682e9 100644 --- a/src/qkd_app/service/database/__init__.py +++ b/src/qkd_app/service/database/__init__.py @@ -10,4 +10,4 @@ # distributed under the License is distributed on an "AS IS" BASIS, # 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. \ No newline at end of file +# limitations under the License. diff --git a/src/qkd_app/service/database/models/QKDAppModel.py b/src/qkd_app/service/database/models/QKDAppModel.py index 1677a35e525c0d1613e6b7104a9728bb523c7442..c32b4e28c95105d8659cb52790f51b330764c2cf 100644 --- a/src/qkd_app/service/database/models/QKDAppModel.py +++ b/src/qkd_app/service/database/models/QKDAppModel.py @@ -1,4 +1,4 @@ -# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) +# Copyright 2022-2024 ETSI OSG/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/qkd_app/service/database/models/_Base.py b/src/qkd_app/service/database/models/_Base.py index 83cad6861bc5a263af1e2adde4da61605ebd8a2b..51863e1d5c06a875c298eab726cfdc3b7fcb75ca 100644 --- a/src/qkd_app/service/database/models/_Base.py +++ b/src/qkd_app/service/database/models/_Base.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI OSG/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/qkd_app/service/database/models/__init__.py b/src/qkd_app/service/database/models/__init__.py index b6826c7c5b10c9f427bdc50267bedfdb4ba7cb92..07d08814021ef82220611ee21c01ba01806682e9 100644 --- a/src/qkd_app/service/database/models/__init__.py +++ b/src/qkd_app/service/database/models/__init__.py @@ -10,4 +10,4 @@ # distributed under the License is distributed on an "AS IS" BASIS, # 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. \ No newline at end of file +# limitations under the License. diff --git a/src/qkd_app/service/database/models/enums/_GrpcToEnum.py b/src/qkd_app/service/database/models/enums/_GrpcToEnum.py index 0cde8ac5eebdb724d749b63663f30afd02435884..0dcad039f7be240acbbec418d12475557e4c42c1 100644 --- a/src/qkd_app/service/database/models/enums/_GrpcToEnum.py +++ b/src/qkd_app/service/database/models/enums/_GrpcToEnum.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI OSG/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/qkd_app/service/database/uuids/QKDApp.py b/src/qkd_app/service/database/uuids/QKDApp.py index acc31250ac187cd73f9106a4e83ffdc67f8e6b60..175f1d5f3cf4ceda12a022b4afadb376e11ae5a5 100644 --- a/src/qkd_app/service/database/uuids/QKDApp.py +++ b/src/qkd_app/service/database/uuids/QKDApp.py @@ -1,3 +1,17 @@ +# Copyright 2022-2024 ETSI OSG/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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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 common.proto.qkd_app_pb2 import AppId from common.method_wrappers.ServiceExceptions import InvalidArgumentsException from ._Builder import get_uuid_from_string, get_uuid_random diff --git a/src/qkd_app/service/database/uuids/_Builder.py b/src/qkd_app/service/database/uuids/_Builder.py index 75fe51bc060f57e68db6b3b0b00ca647c3b61bc7..39c98de69d577ce2722693e57c4ee678124f9e30 100644 --- a/src/qkd_app/service/database/uuids/_Builder.py +++ b/src/qkd_app/service/database/uuids/_Builder.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2022-2024 ETSI OSG/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/qkd_app/service/rest_server/__init__.py b/src/qkd_app/service/rest_server/__init__.py index b6826c7c5b10c9f427bdc50267bedfdb4ba7cb92..07d08814021ef82220611ee21c01ba01806682e9 100644 --- a/src/qkd_app/service/rest_server/__init__.py +++ b/src/qkd_app/service/rest_server/__init__.py @@ -10,4 +10,4 @@ # distributed under the License is distributed on an "AS IS" BASIS, # 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. \ No newline at end of file +# limitations under the License. diff --git a/src/service/Dockerfile b/src/service/Dockerfile index cfb9900ae000ef8e542fc9bb4a208b5609057164..6f23f0a89387e2db3802ee20e003ccb6482844ff 100644 --- a/src/service/Dockerfile +++ b/src/service/Dockerfile @@ -70,8 +70,8 @@ COPY src/pathcomp/frontend/__init__.py pathcomp/frontend/__init__.py COPY src/pathcomp/frontend/client/. pathcomp/frontend/client/ COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ -COPY src/app/__init__.py app/__init__.py -COPY src/app/client/. app/client/ +COPY src/qkd_app/__init__.py qkd_app/__init__.py +COPY src/qkd_app/client/. qkd_app/client/ COPY src/service/. service/ # Start the service diff --git a/src/service/service/__main__.py b/src/service/service/__main__.py index 9e7e7b46bb2e8bc4242e795250b6162c730951d5..5f9f2fa3afb2b708068423f70f764ffc61d29d9c 100644 --- a/src/service/service/__main__.py +++ b/src/service/service/__main__.py @@ -44,9 +44,8 @@ def main(): get_env_var_name(ServiceNameEnum.DEVICE, ENVVAR_SUFIX_SERVICE_PORT_GRPC), get_env_var_name(ServiceNameEnum.PATHCOMP, ENVVAR_SUFIX_SERVICE_HOST ), get_env_var_name(ServiceNameEnum.PATHCOMP, ENVVAR_SUFIX_SERVICE_PORT_GRPC), - get_env_var_name(ServiceNameEnum.APP, ENVVAR_SUFIX_SERVICE_HOST ), - get_env_var_name(ServiceNameEnum.APP, ENVVAR_SUFIX_SERVICE_PORT_GRPC), - + get_env_var_name(ServiceNameEnum.QKD_APP, ENVVAR_SUFIX_SERVICE_HOST ), + get_env_var_name(ServiceNameEnum.QKD_APP, ENVVAR_SUFIX_SERVICE_PORT_GRPC), ]) signal.signal(signal.SIGINT, signal_handler) @@ -75,4 +74,4 @@ def main(): return 0 if __name__ == '__main__': - sys.exit(main()) \ No newline at end of file + sys.exit(main()) diff --git a/src/service/service/task_scheduler/TaskExecutor.py b/src/service/service/task_scheduler/TaskExecutor.py index cff9d3aaa6233ce1e189d81e5147c4ed7c014099..cb27993702963b4aac88ec04eca2a1c796d0c364 100644 --- a/src/service/service/task_scheduler/TaskExecutor.py +++ b/src/service/service/task_scheduler/TaskExecutor.py @@ -28,7 +28,7 @@ from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Device import json_device_id from context.client.ContextClient import ContextClient from device.client.DeviceClient import DeviceClient -from app.client.QKDAppClient import QKDAppClient +from qkd_app.client.QKDAppClient import QKDAppClient from service.service.service_handler_api.Exceptions import ( UnsatisfiedFilterException, UnsupportedFilterFieldException, UnsupportedFilterFieldValueException ) @@ -46,7 +46,7 @@ class CacheableObjectType(Enum): CONNECTION = 'connection' DEVICE = 'device' SERVICE = 'service' - APP = 'app' + QKD_APP = 'qkd-app' class TaskExecutor: def __init__(self, service_handler_factory : ServiceHandlerFactory) -> None: @@ -227,10 +227,10 @@ class TaskExecutor: ) - # ----- App-related methods --------------------------------------------------------------------------------------- + # ----- QkdApp-related methods ------------------------------------------------------------------------------------- def register_app(self, app: App) -> None: app_key = get_app_key(app.app_id) self._qkd_app_client.RegisterApp(app) LOGGER.info("reg registered") - self._store_grpc_object(CacheableObjectType.APP, app_key, app) \ No newline at end of file + self._store_grpc_object(CacheableObjectType.QKD_APP, app_key, app) diff --git a/src/webui/service/templates/service/configure_QKD.html b/src/webui/service/templates/service/configure_QKD.html index 4f3da37dab3a47f04d657d8501be8e3d834c4718..a01f4519d7f4b09732fba6d24db034f143be9943 100644 --- a/src/webui/service/templates/service/configure_QKD.html +++ b/src/webui/service/templates/service/configure_QKD.html @@ -1,5 +1,5 @@ <!-- - Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) + Copyright 2022-2024 ETSI OSG/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.