diff --git a/deploy/tfs.sh b/deploy/tfs.sh index 189ae11e16e77196d6728482b7f16443149b60a9..da078a4f3d9b4c441085a9ae0b8c532ca1f66032 100755 --- a/deploy/tfs.sh +++ b/deploy/tfs.sh @@ -669,6 +669,10 @@ if [[ "$TFS_COMPONENTS" == *"monitoring"* ]] && [[ "$TFS_COMPONENTS" == *"webui" printf "\n\n" fi +echo "Pruning Docker Images..." +docker image prune --force +printf "\n\n" + if [ "$DOCKER_BUILD" == "docker buildx build" ]; then echo "Pruning Docker Buildx Cache..." docker buildx prune --force diff --git a/manifests/nginx_ingress_http.yaml b/manifests/nginx_ingress_http.yaml index c0a0875e2b0afdc0f18e1578370dbbcce5b88cde..ed713bf29ad8228ab3f5b051af24519c2fb9ef09 100644 --- a/manifests/nginx_ingress_http.yaml +++ b/manifests/nginx_ingress_http.yaml @@ -62,10 +62,10 @@ spec: name: nbiservice port: number: 8080 - - path: /()(qkd_app/.*) - - pathType: Prefix + - path: /()(qkd_app/.*) + pathType: Prefix backend: service: - name: qkdappservice + name: qkd-appservice port: number: 8005 diff --git a/manifests/qkdappservice.yaml b/manifests/qkd_appservice.yaml similarity index 89% rename from manifests/qkdappservice.yaml rename to manifests/qkd_appservice.yaml index 13f16f4e501b20208b93e3edcff9c161744632d2..4f89d6c6f8400b509dc595f551e8f181e70b2f51 100644 --- a/manifests/qkdappservice.yaml +++ b/manifests/qkd_appservice.yaml @@ -15,16 +15,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: qkdappservice + name: qkd-appservice spec: selector: matchLabels: - app: qkdappservice + app: qkd-appservice #replicas: 1 template: metadata: labels: - app: qkdappservice + app: qkd-appservice spec: terminationGracePeriodSeconds: 5 containers: @@ -36,10 +36,8 @@ spec: - containerPort: 9192 - containerPort: 8005 env: - - name: MB_BACKEND - value: "nats" - name: LOG_LEVEL - value: "INFO" + value: "DEBUG" - name: CRDB_DATABASE_APP value: "qkd_app" envFrom: @@ -64,13 +62,13 @@ spec: apiVersion: v1 kind: Service metadata: - name: qkdappservice + name: qkd-appservice labels: - app: qkdappservice + app: qkd-appservice spec: type: ClusterIP selector: - app: qkdappservice + app: qkd-appservice ports: - name: grpc protocol: TCP diff --git a/scripts/show_logs_qkd_app.sh b/scripts/show_logs_qkd_app.sh new file mode 100755 index 0000000000000000000000000000000000000000..f4f9ee6a13367c8d50eb4401a5d5f357726e5966 --- /dev/null +++ b/scripts/show_logs_qkd_app.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# 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. + +######################################################################################################################## +# Define your deployment settings here +######################################################################################################################## + +# If not already set, set the name of the Kubernetes namespace to deploy to. +export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"} + +######################################################################################################################## +# Automated steps start here +######################################################################################################################## + +kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/qkd-appservice -c server diff --git a/src/device/.gitlab-ci.yml b/src/device/.gitlab-ci.yml index 9106c96a8bed2cea406dd150fe656927311958cf..3ae6b2b20d22d0a91d10b61acd20fd0d2d4a28ac 100644 --- a/src/device/.gitlab-ci.yml +++ b/src/device/.gitlab-ci.yml @@ -38,6 +38,30 @@ build device: - manifests/${IMAGE_NAME}service.yaml - .gitlab-ci.yml +## Start Mock QKD Nodes before unit testing +#start_mock_nodes: +# stage: deploy +# script: +# - bash src/tests/tools/mock_qkd_nodes/start.sh & +# - sleep 10 # wait for nodes to spin up +# artifacts: +# paths: +# - mock_nodes.log +# rules: +# - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' +# - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + +## Prepare Scenario (Start NBI, mock services) +#prepare_scenario: +# stage: deploy +# script: +# - pytest src/tests/qkd/unit/PrepareScenario.py +# needs: +# - start_mock_nodes +# rules: +# - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' +# - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + # Apply unit test to the component unit_test device: variables: @@ -46,6 +70,8 @@ unit_test device: stage: unit_test needs: - build device + #- start_mock_nodes + #- prepare_scenario before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - > @@ -68,6 +94,7 @@ unit_test device: - docker logs $IMAGE_NAME - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary_emulated.py --junitxml=/opt/results/${IMAGE_NAME}_report_emulated.xml" - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary_ietf_actn.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_actn.xml" + #- docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/qkd/unit/test_*.py" - docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing" coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' after_script: diff --git a/src/device/tests/qkd/unit/descriptorQKD_links.json b/src/device/tests/qkd/unit/descriptorQKD_links.json new file mode 100644 index 0000000000000000000000000000000000000000..28a9e7d5ae014f78cfa0e554ee73a53449bba03c --- /dev/null +++ b/src/device/tests/qkd/unit/descriptorQKD_links.json @@ -0,0 +1,77 @@ +{ + "contexts": [ + {"context_id": {"context_uuid": {"uuid": "admin"}}} + ], + "topologies": [ + {"topology_id": {"topology_uuid": {"uuid": "admin"}, "context_id": {"context_uuid": {"uuid": "admin"}}}} + ], + "devices": [ + { + "device_id": {"device_uuid": {"uuid": "QKD1"}}, "device_type": "qkd-node", + "device_operational_status": 0, "device_drivers": [12], "device_endpoints": [], + "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.10"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "11111"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": { + "scheme": "http" + }}} + ]} + + }, + { + "device_id": {"device_uuid": {"uuid": "QKD2"}}, "device_type": "qkd-node", + "device_operational_status": 0, "device_drivers": [12], "device_endpoints": [], + "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.10"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "22222"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": { + "scheme": "http" + }}} + ]} + + }, + { + "device_id": {"device_uuid": {"uuid": "QKD3"}}, "device_type": "qkd-node", + "device_operational_status": 0, "device_drivers": [12], "device_endpoints": [], + "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.10"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "33333"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": { + "scheme": "http" + }}} + ]} + + } + ], + "links": [ + { + "link_id": {"link_uuid": {"uuid": "QKD1/10.0.2.10:1001==QKD2/10.0.2.10:2001"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "QKD1"}}, "endpoint_uuid": {"uuid": "10.0.2.10:1001"}}, + {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.0.2.10:2001"}} + ] + }, + { + "link_id": {"link_uuid": {"uuid": "QKD2/10.0.2.10:2001==QKD1/10.0.2.10:1001"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.0.2.10:2001"}}, + {"device_id": {"device_uuid": {"uuid": "QKD1"}}, "endpoint_uuid": {"uuid": "10.0.2.10:1001"}} + ] + }, + { + "link_id": {"link_uuid": {"uuid": "QKD2/10.0.2.10:2002==QKD3/10.0.2.10:3001"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.0.2.10:2002"}}, + {"device_id": {"device_uuid": {"uuid": "QKD3"}}, "endpoint_uuid": {"uuid": "10.0.2.10:3001"}} + ] + }, + { + "link_id": {"link_uuid": {"uuid": "QKD3/10.0.2.10:3001==QKD2/10.0.2.10:2002"}}, + "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "QKD3"}}, "endpoint_uuid": {"uuid": "10.0.2.10:3001"}}, + {"device_id": {"device_uuid": {"uuid": "QKD2"}}, "endpoint_uuid": {"uuid": "10.0.2.10:2002"}} + ] + } + + ] +} diff --git a/src/device/tests/qkd/unit/test_application_deployment.py b/src/device/tests/qkd/unit/test_application_deployment.py index 92e16663b41556563aab884be2ee48518cd15ff7..d10ddc523062e1377c7621edfdd42b57c32bad56 100644 --- a/src/device/tests/qkd/unit/test_application_deployment.py +++ b/src/device/tests/qkd/unit/test_application_deployment.py @@ -14,9 +14,11 @@ import pytest import json +import os +os.environ['DEVICE_EMULATED_ONLY'] = 'YES' from device.service.drivers.qkd.QKDDriver2 import QKDDriver -MOCK_QKD_ADDRRESS = '127.0.0.1' +MOCK_QKD_ADDRRESS = '10.0.2.10' MOCK_PORT = 11111 @pytest.fixture diff --git a/src/device/tests/qkd/unit/test_create_apps.py b/src/device/tests/qkd/unit/test_create_apps.py new file mode 100644 index 0000000000000000000000000000000000000000..4724e5c4abd04e28586d54ae6dbbbf0be3c7dc5c --- /dev/null +++ b/src/device/tests/qkd/unit/test_create_apps.py @@ -0,0 +1,40 @@ +# 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. + +import requests + +QKD_ADDRESS = '10.0.2.10' +QKD_URL = 'http://{:s}/qkd_app/create_qkd_app'.format(QKD_ADDRESS) + +QKD_REQUEST_1 = { + 'app': { + 'server_app_id': '1', + 'client_app_id': [], + 'app_status': 'ON', + 'local_qkdn_id': '00000001-0000-0000-0000-0000000000', + 'backing_qkdl_id': ['00000003-0002-0000-0000-0000000000'] + } +} +print(requests.post(QKD_URL, json=QKD_REQUEST_1)) + +QKD_REQUEST_2 = { + 'app': { + 'server_app_id': '1', + 'client_app_id': [], + 'app_status': 'ON', + 'local_qkdn_id': '00000003-0000-0000-0000-0000000000', + 'backing_qkdl_id': ['00000003-0002-0000-0000-0000000000'] + } +} +print(requests.post(QKD_URL, json=QKD_REQUEST_2)) diff --git a/src/qkd_app/client/QKDAppClient.py b/src/qkd_app/client/QKDAppClient.py index b8c09329f9511868a1013ea41a0d8890da499218..1a174df6adc69ab9ce88b0d8878c92b9b9e7820e 100644 --- a/src/qkd_app/client/QKDAppClient.py +++ b/src/qkd_app/client/QKDAppClient.py @@ -28,8 +28,8 @@ RETRY_DECORATOR = retry(max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, class QKDAppClient: def __init__(self, host=None, port=None): - if not host: host = get_service_host(ServiceNameEnum.APP) - if not port: port = get_service_port_grpc(ServiceNameEnum.APP) + if not host: host = get_service_host(ServiceNameEnum.QKD_APP) + if not port: port = get_service_port_grpc(ServiceNameEnum.QKD_APP) self.endpoint = '{:s}:{:s}'.format(str(host), str(port)) LOGGER.debug('Creating channel to {:s}...'.format(self.endpoint)) self.channel = None diff --git a/src/qkd_app/service/QKDAppService.py b/src/qkd_app/service/QKDAppService.py index fcf63efba3b390e0cb58e82430b2a2ce9feeef8d..a6c93cd811a72594804fe8e8e86a9586533a1317 100644 --- a/src/qkd_app/service/QKDAppService.py +++ b/src/qkd_app/service/QKDAppService.py @@ -29,7 +29,7 @@ class AppService(GenericGrpcService): def __init__( self, db_engine : sqlalchemy.engine.Engine, messagebroker : MessageBroker, cls_name: str = __name__ ) -> None: - port = get_service_port_grpc(ServiceNameEnum.APP) + port = get_service_port_grpc(ServiceNameEnum.QKD_APP) super().__init__(port, max_workers=GRPC_MAX_WORKERS, cls_name=cls_name) self.app_servicer = AppServiceServicerImpl(db_engine, messagebroker) diff --git a/src/qkd_app/service/rest_server/RestServer.py b/src/qkd_app/service/rest_server/RestServer.py index 4302a0562337ad9af8c28ef037d4fb64ec1e53bf..e21531c5bcf0e1cf15a8f08952d6325a8349f398 100644 --- a/src/qkd_app/service/rest_server/RestServer.py +++ b/src/qkd_app/service/rest_server/RestServer.py @@ -18,6 +18,6 @@ from common.tools.service.GenericRestServer import GenericRestServer class RestServer(GenericRestServer): def __init__(self, cls_name: str = __name__) -> None: - bind_port = get_service_port_http(ServiceNameEnum.APP) - base_url = get_service_baseurl_http(ServiceNameEnum.APP) + bind_port = get_service_port_http(ServiceNameEnum.QKD_APP) + base_url = get_service_baseurl_http(ServiceNameEnum.QKD_APP) super().__init__(bind_port, base_url, cls_name=cls_name) diff --git a/src/tests/tools/mock_qkd_nodes/start.sh b/src/tests/tools/mock_qkd_nodes/start.sh index b1bc56d5a7f90809e81c73a54803fb2dc11bacd9..faf2f84baf61f16565b497b53bf5f41f45007c00 100755 --- a/src/tests/tools/mock_qkd_nodes/start.sh +++ b/src/tests/tools/mock_qkd_nodes/start.sh @@ -23,8 +23,8 @@ killbg() { trap killbg EXIT pids=() -flask --app mock run --host 0.0.0.0 --port 11111 & +flask run --host 0.0.0.0 --port 11111 & pids+=($!) -flask --app mock run --host 0.0.0.0 --port 22222 & +flask run --host 0.0.0.0 --port 22222 & pids+=($!) -flask --app mock run --host 0.0.0.0 --port 33333 +flask run --host 0.0.0.0 --port 33333 diff --git a/src/tests/tools/mock_qkd_nodes/mock.py b/src/tests/tools/mock_qkd_nodes/wsgi.py similarity index 97% rename from src/tests/tools/mock_qkd_nodes/mock.py rename to src/tests/tools/mock_qkd_nodes/wsgi.py index 7a606f6cac855fee9852f620c595908fbb3d36da..3f8847849337fbfb1a9f84c783786218db4fb04d 100644 --- a/src/tests/tools/mock_qkd_nodes/mock.py +++ b/src/tests/tools/mock_qkd_nodes/wsgi.py @@ -23,7 +23,7 @@ yang_validator = YangValidator('etsi-qkd-sdn-node', ['etsi-qkd-node-types']) nodes = { - '127.0.0.1:11111': {'node': { + '10.0.2.10:11111': {'node': { 'qkdn_id': '00000001-0000-0000-0000-000000000000', }, 'qkdn_capabilities': { @@ -54,7 +54,7 @@ nodes = { { 'qkdi_id': '101', 'qkdi_att_point': { - 'device':'127.0.0.1', + 'device':'10.0.2.10', 'port':'1001' }, 'qkdi_capabilities': { @@ -69,7 +69,7 @@ nodes = { } }, - '127.0.0.1:22222': {'node': { + '10.0.2.10:22222': {'node': { 'qkdn_id': '00000002-0000-0000-0000-000000000000', }, 'qkdn_capabilities': { @@ -100,7 +100,7 @@ nodes = { { 'qkdi_id': '201', 'qkdi_att_point': { - 'device':'127.0.0.1', + 'device':'10.0.2.10', 'port':'2001' }, 'qkdi_capabilities': { @@ -109,7 +109,7 @@ nodes = { { 'qkdi_id': '202', 'qkdi_att_point': { - 'device':'127.0.0.1', + 'device':'10.0.2.10', 'port':'2002' }, 'qkdi_capabilities': { @@ -124,7 +124,7 @@ nodes = { } }, - '127.0.0.1:33333': {'node': { + '10.0.2.10:33333': {'node': { 'qkdn_id': '00000003-0000-0000-0000-000000000000', }, 'qkdn_capabilities': { @@ -155,7 +155,7 @@ nodes = { { 'qkdi_id': '301', 'qkdi_att_point': { - 'device':'127.0.0.1', + 'device':'10.0.2.10', 'port':'3001' }, 'qkdi_capabilities': { diff --git a/src/webui/Dockerfile b/src/webui/Dockerfile index 204b6f7311d4d182d830ef5483204790e165599b..8295087667a6a25b209c584fc9627a5457f47f4d 100644 --- a/src/webui/Dockerfile +++ b/src/webui/Dockerfile @@ -84,11 +84,11 @@ COPY --chown=webui:webui src/service/__init__.py service/__init__.py COPY --chown=webui:webui src/service/client/. service/client/ COPY --chown=webui:webui src/slice/__init__.py slice/__init__.py COPY --chown=webui:webui src/slice/client/. slice/client/ -COPY --chown=webui:webui src/app/__init__.py app/__init__.py -COPY --chown=webui:webui src/app/client/. app/client/ -COPY --chown=webui:webui src/webui/. webui/ +COPY --chown=webui:webui src/qkd_app/__init__.py qkd_app/__init__.py +COPY --chown=webui:webui src/qkd_app/client/. qkd_app/client/ COPY --chown=webui:webui src/bgpls_speaker/__init__.py bgpls_speaker/__init__.py COPY --chown=webui:webui src/bgpls_speaker/client/. bgpls_speaker/client/ +COPY --chown=webui:webui src/webui/. webui/ # Start the service ENTRYPOINT ["python", "-m", "webui.service"] diff --git a/src/webui/service/__init__.py b/src/webui/service/__init__.py index 990792069597f9116ad999487a8982708e978d40..f269408e4450de87bd33a3b075250f47f9123df8 100644 --- a/src/webui/service/__init__.py +++ b/src/webui/service/__init__.py @@ -83,32 +83,32 @@ def create_app(use_config=None, web_app_root=None): app.register_blueprint(healthz, url_prefix='/healthz') - from webui.service.js.routes import js # pylint: disable=import-outside-toplevel + from webui.service.js.routes import js # pylint: disable=import-outside-toplevel app.register_blueprint(js) - from webui.service.main.routes import main # pylint: disable=import-outside-toplevel + from webui.service.main.routes import main # pylint: disable=import-outside-toplevel app.register_blueprint(main) - from webui.service.load_gen.routes import load_gen # pylint: disable=import-outside-toplevel + from webui.service.load_gen.routes import load_gen # pylint: disable=import-outside-toplevel app.register_blueprint(load_gen) - from webui.service.service.routes import service # pylint: disable=import-outside-toplevel + from webui.service.service.routes import service # pylint: disable=import-outside-toplevel app.register_blueprint(service) - from webui.service.slice.routes import slice # pylint: disable=import-outside-toplevel,redefined-builtin + from webui.service.slice.routes import slice # pylint: disable=import-outside-toplevel,redefined-builtin app.register_blueprint(slice) - from webui.service.device.routes import device # pylint: disable=import-outside-toplevel + from webui.service.device.routes import device # pylint: disable=import-outside-toplevel app.register_blueprint(device) - from webui.service.bgpls.routes import bgpls # pylint: disable=import-outside-toplevel + from webui.service.bgpls.routes import bgpls # pylint: disable=import-outside-toplevel app.register_blueprint(bgpls) - from webui.service.link.routes import link # pylint: disable=import-outside-toplevel + from webui.service.link.routes import link # pylint: disable=import-outside-toplevel app.register_blueprint(link) - from webui.service.qkd_app.routes import qkd_app as _qkd_app # pylint: disable=import-outside-toplevel - app.register_blueprint(_qkd_app) + from webui.service.qkd_app.routes import qkd_app # pylint: disable=import-outside-toplevel + app.register_blueprint(qkd_app) from webui.service.policy_rule.routes import policy_rule # pylint: disable=import-outside-toplevel app.register_blueprint(policy_rule) diff --git a/src/webui/service/__main__.py b/src/webui/service/__main__.py index 8cb577d7149f08fa05c11961945f2b8d98beaa00..8ec8dcb64d55c7a4c4d699601fe97a7d6432ce05 100644 --- a/src/webui/service/__main__.py +++ b/src/webui/service/__main__.py @@ -43,8 +43,8 @@ def main(): get_env_var_name(ServiceNameEnum.SERVICE, ENVVAR_SUFIX_SERVICE_PORT_GRPC), get_env_var_name(ServiceNameEnum.SLICE, ENVVAR_SUFIX_SERVICE_HOST ), get_env_var_name(ServiceNameEnum.SLICE, 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), ]) logger.info('Starting...') diff --git a/src/webui/service/qkd_app/routes.py b/src/webui/service/qkd_app/routes.py index 5cbe715dcfe6de16d84706b28799e22018737f29..71243fb75e552ec5568eedacdcadabbc39516b4e 100644 --- a/src/webui/service/qkd_app/routes.py +++ b/src/webui/service/qkd_app/routes.py @@ -25,12 +25,12 @@ from qkd_app.client.QKDAppClient import QKDAppClient LOGGER = logging.getLogger(__name__) -app = Blueprint('qkd_app', __name__, url_prefix='/qkd_app') +qkd_app = Blueprint('qkd_app', __name__, url_prefix='/qkd_app') qkd_app_client = QKDAppClient() context_client = ContextClient() -@app.get('/') +@qkd_app.get('/') def home(): if 'context_uuid' not in session or 'topology_uuid' not in session: flash("Please select a context!", "warning") @@ -68,10 +68,10 @@ def home(): context_client.close() return render_template( - 'app/home.html', apps=apps, device_names=device_names, ate=QKDAppTypesEnum, ase=QKDAppStatusEnum) + 'qkd_app/home.html', apps=apps, device_names=device_names, ate=QKDAppTypesEnum, ase=QKDAppStatusEnum) -@app.route('detail/', methods=('GET', 'POST')) +@qkd_app.route('detail/', methods=('GET', 'POST')) def detail(app_uuid: str): ''' context_client.connect() @@ -87,7 +87,7 @@ def detail(app_uuid: str): ''' pass -@app.get('/delete') +@qkd_app.get('/delete') def delete(app_uuid): ''' try: diff --git a/src/webui/service/templates/base.html b/src/webui/service/templates/base.html index f59e534bdd94b31b246051333e60d380a3e3bc91..9cea0a59dff935aab3018ac0652cd7c96182f4e9 100644 --- a/src/webui/service/templates/base.html +++ b/src/webui/service/templates/base.html @@ -105,9 +105,9 @@