Resolve "(CTTC) IETF SIMAP Basic support with Kafka YANG-push"

Closes #320 (closed)

Merge request reports

Loading

deploy/build-only.sh

0 → 100755
+143 −0
Changes for deploy/build-only.sh: 143 added lines, 0 removed lines.
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.


########################################################################################################################
# Read deployment settings
########################################################################################################################


# ----- TeraFlowSDN ------------------------------------------------------------

# If not already set, set the URL of the Docker registry where the images will be uploaded to.
# By default, assume internal MicroK8s registry is used.
export TFS_REGISTRY_IMAGES=${TFS_REGISTRY_IMAGES:-"http://localhost:32000/tfs/"}

# If not already set, set the list of components, separated by spaces, you want to build images for, and deploy.
# By default, only basic components are deployed
export TFS_COMPONENTS=${TFS_COMPONENTS:-"context device pathcomp service slice nbi webui load_generator"}

# If not already set, set the tag you want to use for your images.
export TFS_IMAGE_TAG=${TFS_IMAGE_TAG:-"dev"}


########################################################################################################################
# Automated steps start here
########################################################################################################################

# Create a tmp folder for files modified during the deployment
TMP_LOGS_FOLDER="./tmp/build"
mkdir -p $TMP_LOGS_FOLDER

DOCKER_BUILD="docker build"
DOCKER_MAJOR_VERSION=$(docker --version | grep -o -E "Docker version [0-9]+\." | grep -o -E "[0-9]+" | cut -c 1-3)
if [[ $DOCKER_MAJOR_VERSION -ge 23 ]]; then
    # If Docker version >= 23, build command was migrated to docker-buildx
    # In Ubuntu, in practice, means to install package docker-buildx together with docker.io
    # Check if docker-buildx plugin is installed
    docker buildx version 1>/dev/null 2>/dev/null
    if [[ $? -ne 0 ]]; then
        echo "Docker buildx command is not installed. Check: https://docs.docker.com/build/architecture/#install-buildx"
        echo "If you installed docker through APT package docker.io, consider installing also package docker-buildx"
        exit 1;
    fi
    DOCKER_BUILD="docker buildx build"
fi

for COMPONENT in $TFS_COMPONENTS; do
    echo "Processing '$COMPONENT' component..."

    echo "  Building Docker image..."
    BUILD_LOG="$TMP_LOGS_FOLDER/build_${COMPONENT}.log"

    if [ "$COMPONENT" == "ztp" ] || [ "$COMPONENT" == "policy" ]; then
        $DOCKER_BUILD -t "$COMPONENT:$TFS_IMAGE_TAG" -f ./src/"$COMPONENT"/Dockerfile ./src/"$COMPONENT"/ > "$BUILD_LOG"
    elif [ "$COMPONENT" == "pathcomp" ] || [ "$COMPONENT" == "telemetry" ] || [ "$COMPONENT" == "analytics" ]; then
        BUILD_LOG="$TMP_LOGS_FOLDER/build_${COMPONENT}-frontend.log"
        $DOCKER_BUILD -t "$COMPONENT-frontend:$TFS_IMAGE_TAG" -f ./src/"$COMPONENT"/frontend/Dockerfile . > "$BUILD_LOG"

        BUILD_LOG="$TMP_LOGS_FOLDER/build_${COMPONENT}-backend.log"
        $DOCKER_BUILD -t "$COMPONENT-backend:$TFS_IMAGE_TAG" -f ./src/"$COMPONENT"/backend/Dockerfile . > "$BUILD_LOG"
        if [ "$COMPONENT" == "pathcomp" ]; then
            # next command is redundant, but helpful to keep cache updated between rebuilds
            IMAGE_NAME="$COMPONENT-backend:$TFS_IMAGE_TAG-builder"
            $DOCKER_BUILD -t "$IMAGE_NAME" --target builder -f ./src/"$COMPONENT"/backend/Dockerfile . >> "$BUILD_LOG"
        fi
    elif [ "$COMPONENT" == "dlt" ]; then
        BUILD_LOG="$TMP_LOGS_FOLDER/build_${COMPONENT}-connector.log"
        $DOCKER_BUILD -t "$COMPONENT-connector:$TFS_IMAGE_TAG" -f ./src/"$COMPONENT"/connector/Dockerfile . > "$BUILD_LOG"

        BUILD_LOG="$TMP_LOGS_FOLDER/build_${COMPONENT}-gateway.log"
        $DOCKER_BUILD -t "$COMPONENT-gateway:$TFS_IMAGE_TAG" -f ./src/"$COMPONENT"/gateway/Dockerfile . > "$BUILD_LOG"
    else
        $DOCKER_BUILD -t "$COMPONENT:$TFS_IMAGE_TAG" -f ./src/"$COMPONENT"/Dockerfile . > "$BUILD_LOG"
    fi

    echo "  Pushing Docker image to '$TFS_REGISTRY_IMAGES'..."

    if [ "$COMPONENT" == "pathcomp" ] || [ "$COMPONENT" == "telemetry" ] || [ "$COMPONENT" == "analytics" ] ; then
        IMAGE_URL=$(echo "$TFS_REGISTRY_IMAGES/$COMPONENT-frontend:$TFS_IMAGE_TAG" | sed 's,//,/,g' | sed 's,http:/,,g')

        TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}-frontend.log"
        docker tag "$COMPONENT-frontend:$TFS_IMAGE_TAG" "$IMAGE_URL" > "$TAG_LOG"

        PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}-frontend.log"
        docker push "$IMAGE_URL" > "$PUSH_LOG"

        IMAGE_URL=$(echo "$TFS_REGISTRY_IMAGES/$COMPONENT-backend:$TFS_IMAGE_TAG" | sed 's,//,/,g' | sed 's,http:/,,g')

        TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}-backend.log"
        docker tag "$COMPONENT-backend:$TFS_IMAGE_TAG" "$IMAGE_URL" > "$TAG_LOG"

        PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}-backend.log"
        docker push "$IMAGE_URL" > "$PUSH_LOG"
    elif [ "$COMPONENT" == "dlt" ]; then
        IMAGE_URL=$(echo "$TFS_REGISTRY_IMAGES/$COMPONENT-connector:$TFS_IMAGE_TAG" | sed 's,//,/,g' | sed 's,http:/,,g')

        TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}-connector.log"
        docker tag "$COMPONENT-connector:$TFS_IMAGE_TAG" "$IMAGE_URL" > "$TAG_LOG"

        PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}-connector.log"
        docker push "$IMAGE_URL" > "$PUSH_LOG"

        IMAGE_URL=$(echo "$TFS_REGISTRY_IMAGES/$COMPONENT-gateway:$TFS_IMAGE_TAG" | sed 's,//,/,g' | sed 's,http:/,,g')

        TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}-gateway.log"
        docker tag "$COMPONENT-gateway:$TFS_IMAGE_TAG" "$IMAGE_URL" > "$TAG_LOG"

        PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}-gateway.log"
        docker push "$IMAGE_URL" > "$PUSH_LOG"
    else
        IMAGE_URL=$(echo "$TFS_REGISTRY_IMAGES/$COMPONENT:$TFS_IMAGE_TAG" | sed 's,//,/,g' | sed 's,http:/,,g')

        TAG_LOG="$TMP_LOGS_FOLDER/tag_${COMPONENT}.log"
        docker tag "$COMPONENT:$TFS_IMAGE_TAG" "$IMAGE_URL" > "$TAG_LOG"

        PUSH_LOG="$TMP_LOGS_FOLDER/push_${COMPONENT}.log"
        docker push "$IMAGE_URL" > "$PUSH_LOG"
    fi

    printf "\n"
done

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
    printf "\n\n"
fi
+7 −0
Changes for manifests/nginx_ingress_http.yaml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -57,6 +57,13 @@ spec:
                name: webuiservice
                port:
                  number: 3000
          - path: /()(.well-known/.*)
            pathType: Prefix
            backend:
              service:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(restconf/.*)
            pathType: Prefix
            backend:
+100 −0
Changes for manifests/simap_connectorservice.yaml: 100 added lines, 0 removed lines.
Original line number Diff line number Diff line
# 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.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: simap-connectorservice
spec:
  selector:
    matchLabels:
      app: simap-connectorservice
  replicas: 1
  template:
    metadata:
      labels:
        app: simap-connectorservice
    spec:
      terminationGracePeriodSeconds: 5
      containers:
        - name: server
          image: labs.etsi.org:5050/tfs/controller/simap_connector:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 9090
            - containerPort: 9192
          env:
            - name: LOG_LEVEL
              value: "INFO"
            - name: SIMAP_SERVER_SCHEME
              value: "http"
            - name: SIMAP_SERVER_ADDRESS
              # Assuming SIMAP Server is deployed in a local Docker container, as per:
              # - ./src/tests/tools/simap_server/build.sh
              # - ./src/tests/tools/simap_server/deploy.sh
              value: "172.17.0.1"
            - name: SIMAP_SERVER_PORT
              # Assuming SIMAP Server is deployed in a local Docker container, as per:
              # - ./src/tests/tools/simap_server/build.sh
              # - ./src/tests/tools/simap_server/deploy.sh
              value: "8080"
            - name: SIMAP_SERVER_USERNAME
              value: "admin"
            - name: SIMAP_SERVER_PASSWORD
              value: "admin"
            - name: CRDB_DATABASE
              value: "tfs_simap_connector"
          envFrom:
            - secretRef:
                name: crdb-data
            - secretRef:
                name: kfk-kpi-data
          startupProbe:
            grpc:
              port: 9090
            failureThreshold: 30
            periodSeconds: 1
          readinessProbe:
            grpc:
              port: 9090
          livenessProbe:
            grpc:
              port: 9090
          resources:
            requests:
              cpu: 250m
              memory: 128Mi
            limits:
              cpu: 1000m
              memory: 1024Mi
---
apiVersion: v1
kind: Service
metadata:
  name: simap-connectorservice
  labels:
    app: simap-connectorservice
spec:
  type: ClusterIP
  selector:
    app: simap-connectorservice
  ports:
    - name: grpc
      protocol: TCP
      port: 9090
      targetPort: 9090
    - name: metrics
      protocol: TCP
      port: 9192
      targetPort: 9192
+17 −2
Changes for proto/context.proto: 17 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ service ContextService {
  rpc RemoveConnection   (ConnectionId  ) returns (       Empty           ) {}
  rpc GetConnectionEvents(Empty         ) returns (stream ConnectionEvent ) {}

  rpc GetAllEvents       (Empty         ) returns (stream AnyEvent        ) {}

  // ------------------------------ Experimental -----------------------------
  rpc GetOpticalConfig       (Empty            ) returns (OpticalConfigList) {}
@@ -118,6 +119,18 @@ message Event {
  EventTypeEnum event_type = 2;
}

message AnyEvent {
  oneof event {
    ContextEvent    context    = 1;
    TopologyEvent   topology   = 2;
    DeviceEvent     device     = 3;
    LinkEvent       link       = 4;
    ServiceEvent    service    = 5;
    SliceEvent      slice      = 6;
    ConnectionEvent connection = 7;
  }
}

// ----- Context -------------------------------------------------------------------------------------------------------
message ContextId {
  Uuid context_uuid = 1;
@@ -274,11 +287,13 @@ enum LinkTypeEnum {
  LINKTYPE_RADIO      = 3;
  LINKTYPE_VIRTUAL    = 4;
  LINKTYPE_MANAGEMENT = 5;
  LINKTYPE_REMOTE     = 6;  // imported from remote topology
}

message LinkAttributes {
  float total_capacity_gbps = 1;
  float used_capacity_gbps  = 2;
  bool  is_bidirectional    = 1;
  float total_capacity_gbps = 2;
  float used_capacity_gbps  = 3;
}

message Link {
+1 −0
Changes for proto/device.proto: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ service DeviceService {
  rpc DeleteDevice         (context.DeviceId                          ) returns (context.Empty                                ) {}
  rpc GetInitialConfig     (context.DeviceId                          ) returns (context.DeviceConfig                         ) {}
  rpc MonitorDeviceKpi     (MonitoringSettings                        ) returns (context.Empty                                ) {}
  rpc SSETelemetrySubscribe(monitoring.SSEMonitoringSubscriptionConfig) returns (monitoring.SSEMonitoringSubscriptionResponse ) {}
}

message MonitoringSettings {
Loading
Loading