Commit d0d1e2aa authored by Waleed Akbar's avatar Waleed Akbar
Browse files

feat: Add deployment and cleanup scripts for AI Analytics Engine and SIMAP components

parent dd69461b
Loading
Loading
Loading
Loading
+35 −0
Original line number Original line 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.

# SIMAP Connector Integration Tests
#
# This test does NOT require:
# - TFS Context service
# - SIMAP server
# - Any external services
#
# Uses in-memory context store and mock HTTP server.

PROJECTDIR=`pwd`

cd $PROJECTDIR/src

export PYTHONPATH=$PROJECTDIR/src

# Run the mocked integration test (no external dependencies)
python3 -m pytest --verbose \
    --log-cli-level=DEBUG -v -s \
    tests/mwc26-f5ga/AI_analytics_engine/tests/test_api.py
+45 −0
Original line number Original line 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.

# Run AI Analytics Engine API tests
#
# Usage: ./run_test.sh

# Navigate to TFS root directory
cd "$(dirname "$0")/../../../../.."

# Set Python path to include TFS src and AI Analytics Engine
export PYTHONPATH="${PWD}/src:${PWD}/src/tests/mwc26-f5ga"

# Activate virtual environment if not already activated
if [ -z "$VIRTUAL_ENV" ]; then
    if [ -d "$HOME/.env-simap" ]; then
        source "$HOME/.env-simap/bin/activate"
    fi
fi

# Define log file path
LOG_FILE="${PWD}/src/tests/mwc26-f5ga/AI_analytics_engine/tests/test_api.log"

# Run the test with logging enabled and capture output
pytest src/tests/mwc26-f5ga/AI_analytics_engine/tests/test_api.py::test_analyze_endpoint \
    -v -s \
    --log-cli-level=DEBUG \
    --log-file="${LOG_FILE}" \
    --log-file-level=DEBUG \
    "$@"

echo ""
echo "Test logs saved to: ${LOG_FILE}"
+40 −0
Original line number Original line Diff line number Diff line

echo "Building SIMAP Server..."
cd ~/tfs-ctrl/
docker buildx build -t simap-server:mock -f ./src/tests/tools/simap_server/Dockerfile .

echo "Building NCE-FAN Controller..."
cd ~/tfs-ctrl/
docker buildx build -t nce-fan-ctrl:mock -f ./src/tests/tools/mock_nce_fan_ctrl/Dockerfile .

echo "Building NCE-T Controller..."
cd ~/tfs-ctrl/
docker buildx build -t nce-t-ctrl:mock -f ./src/tests/tools/mock_nce_t_ctrl/Dockerfile .

echo "Building AI Analytics Engine..."
cd ~/tfs-ctrl/
docker buildx build -t ai-engine:latest -f ./src/tests/mwc26-f5ga/AI_analytics_engine/Dockerfile .

# echo "Building Traffic Changer..."
# cd ~/tfs-ctrl/
# docker buildx build -t traffic-changer:mock -f ./src/tests/tools/traffic_changer/Dockerfile .

# echo "Cleaning up..."
# docker rm --force simap-server
# docker rm --force nce-fan-ctrl
# docker rm --force nce-t-ctrl
# docker rm --force ai-engine
# docker rm --force traffic-changer

echo "Deploying support services..."
docker run --detach --name simap-server    --publish 8080:8080 simap-server:mock
docker run --detach --name nce-fan-ctrl    --publish 8081:8080 --env SIMAP_ADDRESS=172.17.0.1 --env SIMAP_PORT=8080 nce-fan-ctrl:mock
docker run --detach --name nce-t-ctrl      --publish 8082:8080 --env SIMAP_ADDRESS=172.17.0.1 --env SIMAP_PORT=8080 nce-t-ctrl:mock

echo "Deploying AI Analytics Engine..."
docker run --detach --name ai-engine       --publish 8084:8080 --env SIMAP_SERVER_ADDRESS=172.17.0.1 --env SIMAP_SERVER_PORT=8080 ai-engine:latest
# docker run --detach --name traffic-changer --publish 8083:8080 traffic-changer:mock

sleep 2
docker ps -a
echo "Deployment complete."
+9 −0
Original line number Original line Diff line number Diff line

echo "Cleaning up..."
docker rm --force simap-server
docker rm --force nce-fan-ctrl
docker rm --force nce-t-ctrl
docker rm --force ai-engine
docker rm --force traffic-changer
sleep 2
docker ps -a
 No newline at end of file