Commit d5b05abd authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/134-opt-qkd-application-register-new-component' into 'develop'

Resolve: "(OPT) QKD Application Register (new component)"

See merge request !265
parents d8b1d0b9 9f0227b0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -62,3 +62,10 @@ spec:
                name: nbiservice
                port:
                  number: 8080
                    - path: /()(qkd_app/.*)
          - pathType: Prefix
            backend:
              service:
                name: qkdappservice
                port:
                  number: 8005
+85 −0
Original line number Diff line number Diff line
# 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.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: qkdappservice
spec:
  selector:
    matchLabels:
      app: qkdappservice
  #replicas: 1
  template:
    metadata:
      labels:
        app: qkdappservice
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: labs.etsi.org:5050/tfs/controller/qkd_app:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 10060
        - containerPort: 9192
        - containerPort: 8005
        env:
        - name: MB_BACKEND
          value: "nats"
        - name: LOG_LEVEL
          value: "INFO"
        - name: CRDB_DATABASE_APP
          value: "qkd_app"
        envFrom:
        - secretRef:
            name: crdb-data
        - secretRef:
            name: nats-data
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10060"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:10060"]
        resources:
          requests:
            cpu: 150m
            memory: 128Mi
          limits:
            cpu: 500m
            memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
  name: qkdappservice
  labels:
    app: qkdappservice
spec:
  type: ClusterIP
  selector:
    app: qkdappservice
  ports:
  - name: grpc
    protocol: TCP
    port: 10060
    targetPort: 10060
  - name: metrics
    protocol: TCP
    port: 9192
    targetPort: 9192
  - name: http
    port: 8005
    targetPort: 8005
+8 −1
Original line number Diff line number Diff line
@@ -71,7 +71,14 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_gene
#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.

proto/qkd_app.proto

0 → 100644
+53 −0
Original line number Diff line number Diff line
syntax = "proto3";
package qkd_app;

import "context.proto";

// Optare: Change this if you want to change App's structure or enums. 
// Optare: If a message (structure) is changed it must be changed in src/app/service/database

enum QKDAppStatusEnum {
  QKDAPPSTATUS_ON = 0;
  QKDAPPSTATUS_DISCONNECTED = 1;
  QKDAPPSTATUS_OUT_OF_TIME = 2;
  QKDAPPSTATUS_ZOMBIE = 3;
}

enum QKDAppTypesEnum {
  QKDAPPTYPES_INTERNAL = 0;
  QKDAPPTYPES_CLIENT = 1;
}

message QKDLId {
  context.Uuid qkdl_uuid = 1;
}


message App {
  AppId app_id = 1;
  QKDAppStatusEnum app_status = 2;
  QKDAppTypesEnum app_type = 3;
  string server_app_id = 4;
  repeated string client_app_id = 5;
  repeated QKDLId backing_qkdl_id = 6;
  context.DeviceId local_device_id = 7;
  context.DeviceId remote_device_id = 8;
}


message AppId {
  context.ContextId context_id = 1;
  context.Uuid app_uuid = 2;
}


service AppService {
  rpc RegisterApp(App) returns (context.Empty) {}
  rpc ListApps       (context.ContextId     ) returns (       AppList     ) {}
 }
 


 message AppList {
  repeated App apps = 1;
}
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ class ServiceNameEnum(Enum):
    E2EORCHESTRATOR        = 'e2e-orchestrator'
    OPTICALCONTROLLER      = 'opticalcontroller'
    BGPLS                  = 'bgpls-speaker'
    QKD_APP                = 'qkd_app'
    KPIMANAGER             = 'kpi-manager'
    KPIVALUEAPI            = 'kpi-value-api'
    KPIVALUEWRITER         = 'kpi-value-writer'
@@ -96,6 +97,7 @@ DEFAULT_SERVICE_GRPC_PORTS = {
    ServiceNameEnum.FORECASTER             .value : 10040,
    ServiceNameEnum.E2EORCHESTRATOR        .value : 10050,
    ServiceNameEnum.OPTICALCONTROLLER      .value : 10060,
    ServiceNameEnum.QKD_APP                .value : 10070,
    ServiceNameEnum.BGPLS                  .value : 20030,
    ServiceNameEnum.KPIMANAGER             .value : 30010,
    ServiceNameEnum.KPIVALUEAPI            .value : 30020,
@@ -115,10 +117,12 @@ DEFAULT_SERVICE_HTTP_PORTS = {
    ServiceNameEnum.CONTEXT   .value : 8080,
    ServiceNameEnum.NBI       .value : 8080,
    ServiceNameEnum.WEBUI     .value : 8004,
    ServiceNameEnum.QKD_APP   .value : 8005,
}

# Default HTTP/REST-API service base URLs
DEFAULT_SERVICE_HTTP_BASEURLS = {
    ServiceNameEnum.NBI       .value : None,
    ServiceNameEnum.WEBUI     .value : None,
    ServiceNameEnum.QKD_APP   .value : None,
}
Loading