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

Merge branch...

Merge branch 'feat/251-cttc-update-nbi-websocket-endpoints-to-flask-socketio-and-use-guvicorn' into 'feat/216-cttc-implement-integration-test-between-e2e-ip-optical-sdn-controllers'

Resolve "(CTTC) Update NBI WebSocket endpoints to Flask-SocketIO and use gunicorn"

See merge request !322
parents e94c8d32 ea34a7da
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ stages:
include:
#  #- local: '/manifests/.gitlab-ci.yml'
#  - local: '/src/monitoring/.gitlab-ci.yml'
#  - local: '/src/nbi/.gitlab-ci.yml'
  - local: '/src/nbi/.gitlab-ci.yml'
#  - local: '/src/context/.gitlab-ci.yml'
#  - local: '/src/device/.gitlab-ci.yml'
#  - local: '/src/service/.gitlab-ci.yml'
@@ -54,6 +54,6 @@ include:
#  - local: '/src/qos_profile/.gitlab-ci.yml'
#  - local: '/src/vnt_manager/.gitlab-ci.yml'
#  - local: '/src/e2e_orchestrator/.gitlab-ci.yml'

#
  # This should be last one: end-to-end integration tests
  - local: '/src/tests/.gitlab-ci.yml'
+25 −24
Original line number Diff line number Diff line
@@ -23,9 +23,6 @@ spec:
  replicas: 1
  template:
    metadata:
      annotations:
        config.linkerd.io/skip-inbound-ports: "8762"
        config.linkerd.io/skip-outbound-ports: "8762"
      labels:
        app: nbiservice
    spec:
@@ -36,22 +33,31 @@ spec:
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
            - containerPort: 9090
            - containerPort: 9192
            - containerPort: 8761
            # Metrics disabled for now. No NBI endpoint uses it and
            # causes "address already in use" when deploying multiple
            # gunicorn workers.
            #- containerPort: 9192
          env:
            - name: LOG_LEVEL
              value: "INFO"
            - name: FLASK_ENV
              value: "production"  # change to "development" if developing
            - name: IETF_NETWORK_RENDERER
              value: "LIBYANG"
            - name: WS_IP_PORT
              value: "8761"
          readinessProbe:
            exec:
              command: ["/bin/grpc_health_probe", "-addr=:9090"]
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 10
            failureThreshold: 3
          livenessProbe:
            exec:
              command: ["/bin/grpc_health_probe", "-addr=:9090"]
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 10
            failureThreshold: 3
          resources:
            requests:
              cpu: 50m
@@ -75,15 +81,10 @@ spec:
      protocol: TCP
      port: 8080
      targetPort: 8080
    - name: grpc
      protocol: TCP
      port: 9090
      targetPort: 9090
    - name: metrics
      protocol: TCP
      port: 9192
      targetPort: 9192
    - name: websocket
      protocol: TCP
      port: 8761
      targetPort: 8761
    # Metrics disabled for now. No NBI endpoint uses it and
    # causes "address already in use" when deploying multiple
    # gunicorn workers.
    #- name: metrics
    #  protocol: TCP
    #  port: 9192
    #  targetPort: 9192

proto/nbi.proto

deleted100644 → 0
+0 −28
Original line number Diff line number Diff line
// 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.
// 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.

syntax = "proto3";
package nbi;

import "context.proto";

service NbiService {
  rpc CheckCredentials                 (context.TeraFlowController) returns (context.AuthenticationResult) {}
  rpc GetConnectivityServiceStatus     (context.ServiceId         ) returns (context.ServiceStatus       ) {}
  rpc CreateConnectivityService        (context.Service           ) returns (context.ServiceId           ) {}
  rpc EditConnectivityService          (context.Service           ) returns (context.ServiceId           ) {}
  rpc DeleteConnectivityService        (context.Service           ) returns (context.Empty               ) {}
  rpc GetAllActiveConnectivityServices (context.Empty             ) returns (context.ServiceIdList       ) {}
  rpc ClearAllConnectivityServices     (context.Empty             ) returns (context.Empty               ) {}
}
+10 −8
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,12 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from common.Constants import ServiceNameEnum
from common.Settings import get_service_baseurl_http, get_service_port_http
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.NBI)
        base_url = get_service_baseurl_http(ServiceNameEnum.NBI)
        super().__init__(bind_port, base_url, cls_name=cls_name)
PROJECTDIR=`pwd`

cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc

# Run unitary tests and analyze coverage of code at same time
# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    nbi/tests/test_core.py
+0 −1
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ DEFAULT_SERVICE_GRPC_PORTS = {
    ServiceNameEnum.POLICY                 .value :  6060,
    ServiceNameEnum.MONITORING             .value :  7070,
    ServiceNameEnum.DLT                    .value :  8080,
    ServiceNameEnum.NBI                    .value :  9090,
    ServiceNameEnum.L3_CAD                 .value : 10001,
    ServiceNameEnum.L3_AM                  .value : 10002,
    ServiceNameEnum.DBSCANSERVING          .value : 10008,
Loading