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

Merge branch 'camara-demo-integration' into 'develop'

Resolve: "(CTTC) CAMARA Demo Integration tests"

See merge request !321
parents c061494a 3c7cfb59
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -21,4 +21,6 @@ include:
  #- local: '/src/tests/ofc23/.gitlab-ci.yml'
  - local: '/src/tests/ofc24/.gitlab-ci.yml'
  - local: '/src/tests/eucnc24/.gitlab-ci.yml'
  - local: '/src/tests/ofc25-camara-agg-net-controller/.gitlab-ci.yml'
  - local: '/src/tests/ofc25-camara-e2e-controller/.gitlab-ci.yml'
  #- local: '/src/tests/ecoc24/.gitlab-ci.yml'
+5 −0
Original line number Diff line number Diff line
clab-*/
images/
*.clab.yml.bak
*.tar
*.tar.gz
+90 −0
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.

# Deploy TeraFlowSDN and Execute end-2-end test
end2end_test ofc25_camara_agg_net:
  variables:
    TEST_NAME: 'ofc25-camara-agg-net-controller'
    IP_NAME: 'ip'
    IP_PORT: '9092'
  stage: end2end_test
  # Disable to force running it after all other tasks
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
    - HOST_IP=$(kubectl get nodes -o json | jq -r '.items[].status.addresses[] | select(.type=="InternalIP") | .address')
    - sed -i "s/IP_NET_IP/${HOST_IP}/g" src/tests/${TEST_NAME}/data/agg-net-descriptor.json
    - sed -i "s/IP_NET_PORT/${IP_PORT}/g" src/tests/${TEST_NAME}/data/agg-net-descriptor.json
    - docker buildx build -t "${TEST_NAME}:latest" -f ./src/tests/${TEST_NAME}/Dockerfile .
    - docker buildx build -t "${IP_NAME}:latest" -f ./src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/Dockerfile ./src/tests/tools/mock_ietf_l3vpn_sdn_ctrl
    - docker rm -f ${TEST_NAME} || true
    - docker rm -f ${IP_NAME} || true
    - docker run -d --name ${IP_NAME} -p ${IP_PORT}:8443 ${IP_NAME}:latest

  script:
    # Check MicroK8s is ready
    - microk8s status --wait-ready
    - kubectl get pods --all-namespaces

    - source src/tests/${TEST_NAME}/deploy_specs.sh

    # Deploy TeraFlowSDN
    - ./deploy/crdb.sh
    - ./deploy/nats.sh
    - ./deploy/qdb.sh
    - ./deploy/kafka.sh
    - ./deploy/tfs.sh
    - ./deploy/show.sh

    - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server

    # Run end-to-end test: onboard scenario
    - >
      docker run -t --rm --name ${TEST_NAME} --network=host
      --volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh"
      --volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
      ${TEST_NAME}:latest /var/teraflow/run-onboarding.sh

    # Run end-to-end test: configure service TFS
    - >
      docker run -t --rm --name ${TEST_NAME} --network=host
      --volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh"
      --volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
      ${TEST_NAME}:latest /var/teraflow/run-agg-net-ietf-slice-operations.sh

  after_script:
    - kubectl --namespace tfs logs deployment/contextservice -c server
    - kubectl --namespace tfs logs deployment/deviceservice -c server
    - kubectl --namespace tfs logs deployment/pathcompservice -c frontend
    - kubectl --namespace tfs logs deployment/serviceservice -c server
    - kubectl --namespace tfs logs deployment/sliceservice -c server
    - kubectl --namespace tfs logs deployment/nbiservice -c server
    - docker logs ${IP_NAME}

    # Destroy Scenario
    - kubectl delete namespaces tfs || true

    - docker rm -f ${TEST_NAME} || true
    - docker rm -f ${IP_NAME} || true

    # Clean old docker images
    - docker images --filter="dangling=true" --quiet | xargs -r docker rmi

  #coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
  artifacts:
      when: always
      reports:
        junit: ./src/tests/${TEST_NAME}/report_*.xml
+84 −0
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.

FROM python:3.9-slim

# Install dependencies
RUN apt-get --yes --quiet --quiet update && \
    apt-get --yes --quiet --quiet install wget g++ git && \
    rm -rf /var/lib/apt/lists/*

# Set Python to show logs as they occur
ENV PYTHONUNBUFFERED=0

# Get generic Python packages
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade setuptools wheel
RUN python3 -m pip install --upgrade pip-tools

# Get common Python packages
# Note: this step enables sharing the previous Docker build steps among all the Python components
WORKDIR /var/teraflow
COPY common_requirements.in common_requirements.in
RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in
RUN python3 -m pip install -r common_requirements.txt

# Add common files into working directory
WORKDIR /var/teraflow/common
COPY src/common/. ./
RUN rm -rf proto

# Create proto sub-folder, copy .proto files, and generate Python code
RUN mkdir -p /var/teraflow/common/proto
WORKDIR /var/teraflow/common/proto
RUN touch __init__.py
COPY proto/*.proto ./
RUN python3 -m grpc_tools.protoc -I=. --python_out=. --grpc_python_out=. *.proto
RUN rm *.proto
RUN find . -type f -exec sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' {} \;

# Create component sub-folders, get specific Python packages
RUN mkdir -p /var/teraflow/tests/ofc25-camara-agg-net-controller
WORKDIR /var/teraflow/tests/ofc25-camara-agg-net-controller
COPY src/tests/ofc25-camara-agg-net-controller/requirements.in requirements.in
RUN pip-compile --quiet --output-file=requirements.txt requirements.in
RUN python3 -m pip install -r requirements.txt

# Add component files into working directory
WORKDIR /var/teraflow
COPY src/__init__.py ./__init__.py
COPY src/common/*.py ./common/
COPY src/common/tests/. ./common/tests/
COPY src/common/tools/. ./common/tools/
COPY src/context/__init__.py context/__init__.py
COPY src/context/client/. context/client/
COPY src/device/__init__.py device/__init__.py
COPY src/device/client/. device/client/
COPY src/monitoring/__init__.py monitoring/__init__.py
COPY src/monitoring/client/. monitoring/client/
COPY src/service/__init__.py service/__init__.py
COPY src/service/client/. service/client/
COPY src/slice/__init__.py slice/__init__.py
COPY src/slice/client/. slice/client/
COPY src/tests/*.py ./tests/
COPY src/tests/ofc25-camara-agg-net-controller/__init__.py ./tests/ofc25-camara-agg-net-controller/__init__.py
COPY src/tests/ofc25-camara-agg-net-controller/data/. ./tests/ofc25-camara-agg-net-controller/data/
COPY src/tests/ofc25-camara-agg-net-controller/tests/. ./tests/ofc25-camara-agg-net-controller/tests/
COPY src/tests/ofc25-camara-agg-net-controller/scripts/. ./

RUN apt-get --yes --quiet --quiet update && \
    apt-get --yes --quiet --quiet install tree && \
    rm -rf /var/lib/apt/lists/*

RUN tree -la /var/teraflow
+14 −0
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.
Loading