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

OFC25 end-to-end integration test:

- Removed old unneeded/wrong files
- Renamed descriptors
- Fixed bootstrap/cleanup functional test scripts
- Fixed run_tests script
- Fixed Dockerfile
- Fixed GitLab CI pipeline
parent 08f618d8
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -199,6 +199,10 @@ end2end_test ofc25:
    - mv manifests/contextservice.yaml.bak manifests/contextservice.yaml
    - mv tfs_runtime_env_vars.sh tfs_runtime_env_vars_opt.sh

    # Wait for Context to be subscribed to NATS
    - while ! kubectl --namespace ${TFS_K8S_NAMESPACE} logs deployment/contextservice -c server 2>&1 | grep -q 'Subscriber is Ready? True'; do sleep 1; done
    - kubectl --namespace ${TFS_K8S_NAMESPACE} logs deployment/contextservice -c server


    # ===== Deploy Packet TeraFlowSDN ===================================================
    - source src/tests/${TEST_NAME}/deploy_specs_ip.sh
@@ -221,7 +225,10 @@ end2end_test ofc25:

    - mv manifests/contextservice.yaml.bak manifests/contextservice.yaml
    - mv tfs_runtime_env_vars.sh tfs_runtime_env_vars_ip.sh
    #- ./src/tests/${TEST_NAME}/subscription_ws_ip.sh

    # Wait for Context to be subscribed to NATS
    - while ! kubectl --namespace ${TFS_K8S_NAMESPACE} logs deployment/contextservice -c server 2>&1 | grep -q 'Subscriber is Ready? True'; do sleep 1; done
    - kubectl --namespace ${TFS_K8S_NAMESPACE} logs deployment/contextservice -c server


    # ===== Deploy End-to-End TeraFlowSDN ===============================================
@@ -245,20 +252,21 @@ end2end_test ofc25:

    - mv manifests/contextservice.yaml.bak manifests/contextservice.yaml
    - mv tfs_runtime_env_vars.sh tfs_runtime_env_vars_e2e.sh
    #- ./src/tests/${TEST_NAME}/subscription_ws_e2e.sh

    # Wait for Context to be subscribed to NATS
    - while ! kubectl --namespace ${TFS_K8S_NAMESPACE} logs deployment/contextservice -c server 2>&1 | grep -q 'Subscriber is Ready? True'; do sleep 1; done
    - kubectl --namespace ${TFS_K8S_NAMESPACE} logs deployment/contextservice -c server

    # Configure Subscription WS
    - ./src/tests/${TEST_NAME}/subscription_ws_e2e.sh


    # Run end-to-end tests
    # ===== Run End-to-End tests ========================================================
    - if docker ps -a | grep ${TEST_NAME}; then docker rm -f ${TEST_NAME}; fi
    #- >
    #  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"
    #  $CI_REGISTRY_IMAGE/${TEST_NAME}:latest
    - >
      docker run -t --rm --name ${TEST_NAME} --network=host 
      --volume "$PWD/tfs_runtime_env_vars_opt.sh:/var/teraflow/tfs_runtime_env_vars_opt.sh"
      --volume "$PWD/tfs_runtime_env_vars_ip.sh:/var/teraflow/tfs_runtime_env_vars_ip.sh"
      --volume "$PWD/tfs_runtime_env_vars_e2e.sh:/var/teraflow/tfs_runtime_env_vars_e2e.sh"
      --volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
      $CI_REGISTRY_IMAGE/${TEST_NAME}:latest

  after_script:
    # Dump Optical Device Node Agents container status and logs
+31 −33
Original line number Diff line number Diff line
@@ -22,6 +22,11 @@ RUN apt-get --yes --quiet --quiet update && \
# Set Python to show logs as they occur
ENV PYTHONUNBUFFERED=0

# Download the gRPC health probe
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
    wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
    chmod +x /bin/grpc_health_probe

# Get generic Python packages
RUN python3 -m pip install --upgrade 'pip==25.2'
RUN python3 -m pip install --upgrade 'setuptools==79.0.0' 'wheel==0.45.1'
@@ -51,27 +56,8 @@ 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
WORKDIR /var/teraflow/tests/ofc25

# Copy all component requirements
COPY src/context/requirements.in context_requirements.in
COPY src/device/requirements.in device_requirements.in
COPY src/monitoring/requirements.in monitoring_requirements.in
COPY src/e2e_orchestrator/requirements.in e2e_orchestrator_requirements.in
COPY src/service/requirements.in service_requirements.in
COPY src/slice/requirements.in slice_requirements.in
COPY src/vnt_manager/requirements.in vnt_manager_requirements.in

# Compile all requirements together to avoid conflicts
RUN pip-compile --quiet --output-file=requirements.txt \
    context_requirements.in \
    device_requirements.in \
    monitoring_requirements.in \
    e2e_orchestrator_requirements.in \
    service_requirements.in \
    slice_requirements.in \
    vnt_manager_requirements.in

# Install all requirements
COPY src/tests/ofc25/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
@@ -98,35 +84,47 @@ COPY src/tests/*.py ./tests/
COPY src/tests/ofc25/__init__.py ./tests/ofc25/__init__.py
COPY src/tests/ofc25/descriptors/topology_ip.json ./tests/ofc25/descriptors/topology_ip.json
COPY src/tests/ofc25/descriptors/topology_opt.json ./tests/ofc25/descriptors/topology_opt.json
COPY src/tests/ofc25/descriptors/topology_e2e-netorch.json ./tests/ofc25/descriptors/topology_e2e.json
COPY src/tests/ofc25/descriptors/topology_e2e.json ./tests/ofc25/descriptors/topology_e2e.json
COPY src/tests/ofc25/tests/. ./tests/ofc25/tests/

# Copy runtime environment variables (generated by deploy/tfs.sh)
COPY tfs_runtime_env_vars_opt.sh ./tfs_runtime_env_vars_opt.sh
COPY tfs_runtime_env_vars_ip.sh ./tfs_runtime_env_vars_ip.sh
COPY tfs_runtime_env_vars_e2e.sh ./tfs_runtime_env_vars_e2e.sh

RUN tee ./run_tests.sh <<EOF
#!/bin/bash
set -e
export PYTHONPATH=/var/teraflow

# Test optical layer
echo "Initialize optical layer controller"
source /var/teraflow/tfs_runtime_env_vars_opt.sh
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_bootstrap_opt.py --junitxml=/opt/results/report_bootstrap_opt.xml

# Test IP layer
echo "Initialize IP/packet layer controller"
source /var/teraflow/tfs_runtime_env_vars_ip.sh
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_bootstrap_ip.py --junitxml=/opt/results/report_bootstrap_ip.xml

# Test E2E orchestration
sleep 5
echo "Initialize E2E layer orchestrator"
source /var/teraflow/tfs_runtime_env_vars_e2e.sh
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_bootstrap_e2e.py --junitxml=/opt/results/report_bootstrap_e2e.xml

echo "Create IP virtual links"
source /var/teraflow/tfs_runtime_env_vars_ip.sh
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_create_service.py --junitxml=/opt/results/report_create_service.xml

echo "Delete IP virtual links"
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_delete_service.py --junitxml=/opt/results/report_delete_service.xml
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_cleanup.py        --junitxml=/opt/results/report_cleanup.xml

echo "Cleanup E2E layer orchestrator"
source /var/teraflow/tfs_runtime_env_vars_e2e.sh
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_cleanup_e2e.py --junitxml=/opt/results/report_cleanup_e2e.xml

echo "Cleanup IP/packet layer controller"
source /var/teraflow/tfs_runtime_env_vars_ip.sh
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_cleanup_ip.py --junitxml=/opt/results/report_cleanup_ip.xml

echo "Cleanup optical layer controller"
source /var/teraflow/tfs_runtime_env_vars_opt.sh
pytest --verbose --log-level=INFO /var/teraflow/tests/ofc25/tests/test_functional_cleanup_opt.py --junitxml=/opt/results/report_cleanup_opt.xml

EOF
RUN chmod ug+x ./run_tests.sh

#ENTRYPOINT ["./run_tests.sh"]
# Run the tests
ENTRYPOINT ["./run_tests.sh"]
+0 −38
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.


# Delete old namespaces
kubectl delete namespace tfs-e2e

# Delete secondary ingress controllers
kubectl delete -f src/tests/ofc25/nginx-ingress-controller-e2e.yaml

# Create secondary ingress controllers
kubectl apply -f src/tests/ofc25/nginx-ingress-controller-e2e.yaml

# Deploy TFS for E2E
source src/tests/ofc25/deploy_specs_e2e.sh

# Change the name for the database
cp manifests/contextservice.yaml manifests/contextservice.yaml.bak
sed -i '/name: CRDB_DATABASE/{n;s/value: .*/value: "tfs_e2e_context"/}' manifests/contextservice.yaml
./deploy/all.sh
mv manifests/contextservice.yaml.bak manifests/contextservice.yaml

#Configure Subscription WS
./src/tests/ofc25/subscription_ws_e2e.sh

mv tfs_runtime_env_vars.sh tfs_runtime_env_vars_e2e.sh

src/tests/ofc25/_old/deploy_ip.sh

deleted100755 → 0
+0 −38
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.


# Delete old namespaces
kubectl delete namespace tfs-ip

# Delete secondary ingress controllers
kubectl delete -f src/tests/ofc25/nginx-ingress-controller-ip.yaml

# Create secondary ingress controllers
kubectl apply -f src/tests/ofc25/nginx-ingress-controller-ip.yaml

# Deploy TFS for IP
source src/tests/ofc25/deploy_specs_ip.sh

# Change the name for the database
cp manifests/contextservice.yaml manifests/contextservice.yaml.bak
sed -i '/name: CRDB_DATABASE/{n;s/value: .*/value: "tfs_ip_context"/}' manifests/contextservice.yaml
./deploy/all.sh
mv manifests/contextservice.yaml.bak manifests/contextservice.yaml

#Configure Subscription WS
./src/tests/ofc25/subscription_ws_ip.sh

mv tfs_runtime_env_vars.sh tfs_runtime_env_vars_ip.sh
+0 −35
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.


# Delete old namespaces
kubectl delete namespace tfs-opt

# Delete secondary ingress controllers
kubectl delete -f src/tests/ofc25/nginx-ingress-controller-opt.yaml

# Create secondary ingress controllers
kubectl apply -f src/tests/ofc25/nginx-ingress-controller-opt.yaml

# Deploy TFS for OPT
source src/tests/ofc25/deploy_specs_opt.sh

# Change the name for the database
cp manifests/contextservice.yaml manifests/contextservice.yaml.bak
sed -i '/name: CRDB_DATABASE/{n;s/value: .*/value: "tfs_opt_context"/}' manifests/contextservice.yaml
./deploy/all.sh
mv manifests/contextservice.yaml.bak manifests/contextservice.yaml

mv tfs_runtime_env_vars.sh tfs_runtime_env_vars_opt.sh
Loading