Commit 57ee1448 authored by Antonio Gines Buendia Lopez's avatar Antonio Gines Buendia Lopez
Browse files

Fix gRPC channel and deployment trigger of PCE

parent d5bc9583
Loading
Loading
Loading
Loading
+64 −0
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2025 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.

# Save previous TFS_COMPONENTS to revert them after the compilation is successful
PREV_TFS_COMPONENTS="${TFS_COMPONENTS:-}"

# Function to restore the original TFS_COMPONENTS value
restore_tfs_components() {
    if [ -n "$PREV_TFS_COMPONENTS" ]; then
        export TFS_COMPONENTS="$PREV_TFS_COMPONENTS"
        echo "Restored TFS_COMPONENTS to: $TFS_COMPONENTS"
    else
        unset TFS_COMPONENTS
        echo "Unset TFS_COMPONENTS (was not set previously)"
    fi
}

# Set trap to restore TFS_COMPONENTS on exit (success or failure)
trap restore_tfs_components EXIT

# Read input: list of TFS components to compile
if [ $# -eq 0 ]; then
    echo "Usage: $0 <component1> [component2] [component3] ..."
    echo "Example: $0 context device pathcomp service"
    echo ""
    echo "Or provide components as a single string:"
    echo "Example: $0 \"context device pathcomp service\""
    exit 1
fi

# Join all arguments into a single string (handles both formats)
NEW_TFS_COMPONENTS="$*"

# Set the new TFS_COMPONENTS value
export TFS_COMPONENTS="$NEW_TFS_COMPONENTS"

echo "Previous TFS_COMPONENTS: ${PREV_TFS_COMPONENTS:-<not set>}"
echo "New TFS_COMPONENTS: $TFS_COMPONENTS"
echo ""

# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Execute build-only.sh
echo "Executing build-only.sh..."
"$SCRIPT_DIR/build-only.sh"
BUILD_EXIT_CODE=$?

# Note: restore_tfs_components will be called automatically via the trap on exit

# Exit with the same code as build-only.sh
exit $BUILD_EXIT_CODE
+8 −34
Original line number Diff line number Diff line
@@ -28,23 +28,21 @@ spec:
    spec:
      terminationGracePeriodSeconds: 5
      containers:
        - name: frontend
          image: labs.etsi.org:5050/tfs/controller/pathcompextended-frontend:latest
        - name: service-pce
          image: labs.etsi.org:5050/tfs/controller/pathcompextended:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 10020
            - containerPort: 30230
            - containerPort: 9192
          env:
            - name: LOG_LEVEL
              value: "INFO"
            - name: ENABLE_FORECASTER
              value: "NO"
              value: "DEBUG"
          readinessProbe:
            exec:
              command: ["/bin/grpc_health_probe", "-addr=:10020"]
              command: ["/bin/grpc_health_probe", "-addr=:30230"]
          livenessProbe:
            exec:
              command: ["/bin/grpc_health_probe", "-addr=:10020"]
              command: ["/bin/grpc_health_probe", "-addr=:30230"]
          resources:
            requests:
              cpu: 250m
@@ -52,30 +50,6 @@ spec:
            limits:
              cpu: 1000m
              memory: 1024Mi
        - name: backend
          image: labs.etsi.org:5050/tfs/controller/pathcompextended-backend:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8081
          #readinessProbe:
          #  httpGet:
          #    path: /health
          #    port: 8081
          #  initialDelaySeconds: 5
          #  timeoutSeconds: 5
          #livenessProbe:
          #  httpGet:
          #    path: /health
          #    port: 8081
          #  initialDelaySeconds: 5
          #  timeoutSeconds: 5
          resources:
            requests:
              cpu: 250m
              memory: 256Mi
            limits:
              cpu: 1000m
              memory: 1024Mi
---
apiVersion: v1
kind: Service
@@ -90,8 +64,8 @@ spec:
  ports:
    - name: grpc
      protocol: TCP
      port: 10020
      targetPort: 10020
      port: 30230
      targetPort: 30230
    - name: http
      protocol: TCP
      port: 8081
+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ export TFS_COMPONENTS="context device pathcomp service nbi webui"
#export TFS_COMPONENTS="${TFS_COMPONENTS} pluggables"

# Uncomment to activate PathCompExtended Component
#export TFS_COMPONENTS="${TFS_COMPONENTS} pathcompextended"
export TFS_COMPONENTS="${TFS_COMPONENTS} pathcompextended"



+27 −0
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2025 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.

########################################################################################################################
# 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/pathcompextendedservice -c service-pce
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,6 @@ DEFAULT_SERVICE_GRPC_PORTS = {
    ServiceNameEnum.OPTICALATTACKMANAGER   .value : 10005,
    ServiceNameEnum.INTERDOMAIN            .value : 10010,
    ServiceNameEnum.PATHCOMP               .value : 10020,
    ServiceNameEnum.PATHCOMPEXTENDED       .value : 10021,
    ServiceNameEnum.TE                     .value : 10030,
    ServiceNameEnum.FORECASTER             .value : 10040,
    ServiceNameEnum.E2EORCHESTRATOR        .value : 10050,
@@ -121,6 +120,7 @@ DEFAULT_SERVICE_GRPC_PORTS = {
    ServiceNameEnum.AUTOMATION             .value : 30200,
    ServiceNameEnum.OSMCLIENT              .value : 30210,
    ServiceNameEnum.PLUGGABLES             .value : 30220,
    ServiceNameEnum.PATHCOMPEXTENDED       .value : 30230,

    # Used for test and debugging only
    ServiceNameEnum.DLT_GATEWAY   .value : 50051,
Loading