Commit 7b95aca5 authored by Pablo Armingol's avatar Pablo Armingol
Browse files

first version of PCEP module

parent c4288010
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -179,3 +179,16 @@ export GRAF_EXT_PORT_HTTP=${GRAF_EXT_PORT_HTTP:-"3000"}
./deploy/show.sh

echo "Done!"


TFS_NAMESPACE="tfs"
PCEP_EXT_PORT_HTTP="4189"
 
PCEP_PORT_HTTP=$(kubectl --namespace ${TFS_NAMESPACE} get service pcepservice -o 'jsonpath={.spec.ports[?(@.name=="pcep")].port}')
PATCH='{"data": {"'${PCEP_EXT_PORT_HTTP}'": "'${TFS_NAMESPACE}'/pcepservice:'${PCEP_PORT_HTTP}'"}}'
kubectl patch configmap nginx-ingress-tcp-microk8s-conf --namespace ingress --patch "${PATCH}"
 
PORT_MAP='{"containerPort": '${PCEP_EXT_PORT_HTTP}', "hostPort": '${PCEP_EXT_PORT_HTTP}'}'
CONTAINER='{"name": "nginx-ingress-microk8s", "ports": ['${PORT_MAP}']}'
PATCH='{"spec": {"template": {"spec": {"containers": ['${CONTAINER}']}}}}'
kubectl patch daemonset nginx-ingress-microk8s-controller --namespace ingress --patch "${PATCH}"
 No newline at end of file

deploy/expose_pcep.sh

0 → 100755
+11 −0
Original line number Diff line number Diff line
TFS_NAMESPACE="tfs"
PCEP_EXT_PORT_HTTP="4189"
 
PCEP_PORT_HTTP=$(kubectl --namespace ${TFS_NAMESPACE} get service pcepservice -o 'jsonpath={.spec.ports[?(@.name=="pcep")].port}')
PATCH='{"data": {"'${PCEP_EXT_PORT_HTTP}'": "'${TFS_NAMESPACE}'/pcepservice:'${PCEP_PORT_HTTP}'"}}'
kubectl patch configmap nginx-ingress-tcp-microk8s-conf --namespace ingress --patch "${PATCH}"
 
PORT_MAP='{"containerPort": '${PCEP_EXT_PORT_HTTP}', "hostPort": '${PCEP_EXT_PORT_HTTP}'}'
CONTAINER='{"name": "nginx-ingress-microk8s", "ports": ['${PORT_MAP}']}'
PATCH='{"spec": {"template": {"spec": {"containers": ['${CONTAINER}']}}}}'
kubectl patch daemonset nginx-ingress-microk8s-controller --namespace ingress --patch "${PATCH}"
 No newline at end of file
+103 −0
Original line number Diff line number Diff line
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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: pcepservice
spec:
  selector:
    matchLabels:
      app: pcepservice
  replicas: 1
  template:
    metadata:
      annotations:
        config.linkerd.io/skip-outbound-ports: "4189"
      labels:
        app: pcepservice
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: localhost:32000/tfs/pcep:dev
        imagePullPolicy: Always
        ports:
        - containerPort: 20050
        - containerPort: 9192
        - containerPort: 6666
        - containerPort: 4189
        env:
        - name: LOG_LEVEL
          value: "DEBUG"
        readinessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:20050"]
        livenessProbe:
          exec:
            command: ["/bin/grpc_health_probe", "-addr=:20050"]
        resources:
          requests:
            cpu: 50m
            memory: 64Mi
          limits:
            cpu: 500m
            memory: 512Mi
---
#Internal ClusterIP service
apiVersion: v1
kind: Service
metadata:
  name: pcepservice
  labels:
    app: pcepservice
spec:
  type: ClusterIP
  selector:
    app: pcepservice
  ports:
  - name: grpc
    protocol: TCP
    port: 20050
    targetPort: 20050
  - name: metrics
    protocol: TCP
    port: 9192
    targetPort: 9192
  - name: pcep
    protocol: TCP
    port: 4189
    targetPort: 4189
  - name: managm
    protocol: TCP
    port: 6666
    targetPort: 6666

#NodePortService
# apiVersion: v1
# kind: Service
# metadata:
#   name: pceservice-ext
#   labels:
#     app: pceservice
# spec:
#   type: NodePort
#   externalTrafficPolicy: Local
#   selector:
#     app: pceservice
#   ports:
#   - name: pcep
#     protocol: TCP
#     port: 4189
#     targetPort: 4189
+2 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ class ServiceNameEnum(Enum):
    TE                     = 'te'
    FORECASTER             = 'forecaster'
    E2EORCHESTRATOR        = 'e2eorchestrator'
    PCEP                   = 'pcep'

    # Used for test and debugging only
    DLT_GATEWAY    = 'dltgateway'
@@ -86,6 +87,7 @@ DEFAULT_SERVICE_GRPC_PORTS = {
    ServiceNameEnum.TE                     .value : 10030,
    ServiceNameEnum.FORECASTER             .value : 10040,
    ServiceNameEnum.E2EORCHESTRATOR        .value : 10050,
    ServiceNameEnum.PCEP                   .value : 20050,

    # Used for test and debugging only
    ServiceNameEnum.DLT_GATEWAY   .value : 50051,
+20 −0
Original line number Diff line number Diff line
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.

Flask==2.1.3
Flask-HTTPAuth==4.5.0
Flask-RESTful==0.3.9
jsonschema==4.4.0
requests==2.27.1
werkzeug==2.3.7
Loading