Commit 1446f0c9 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

NBI Component:

- Corrected unitary tests
- Removed unneeded scripts
- Implemented Unitary test for Camara NBI
- Corrected logic for CAMARA NBI
- Added missing HTTP Status Codes
- Added CAMARA NBI to GitLab CI/CD tests
parent de40a865
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -47,9 +47,7 @@ KAFKA_IP=$(docker inspect kafka --format "{{.NetworkSettings.Networks.teraflowbr
echo "Kafka IP: $KAFKA_IP"

docker run --name mock_tfs_nbi_dependencies -d -p 10000:10000 \
    --network=teraflowbridge \
    --env BIND_ADDRESS=0.0.0.0 \
    --env BIND_PORT=10000 \
    --network=teraflowbridge --env BIND_ADDRESS=0.0.0.0 --env BIND_PORT=10000 \
    --env LOG_LEVEL=INFO \
    mock_tfs_nbi_dependencies:test

@@ -69,23 +67,25 @@ printf "\n"
sleep 5 # Give extra time to NBI to get ready

docker ps -a
docker logs kafka
#docker logs kafka
docker logs mock_tfs_nbi_dependencies
docker logs nbi

# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_core.py --junitxml=/opt/results/${IMAGE_NAME}_report_core.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_tfs_api.py --junitxml=/opt/results/${IMAGE_NAME}_report_tfs_api.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_ietf_l2vpn.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_l2vpn.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_ietf_network.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_network.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_ietf_l3vpn.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_l3vpn.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_etsi_bwm.py --junitxml=/opt/results/${IMAGE_NAME}_report_etsi_bwm.xml"
docker exec -i nbi bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_core.py --junitxml=/opt/results/nbi_report_core.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_tfs_api.py --junitxml=/opt/results/nbi_report_tfs_api.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_ietf_l2vpn.py --junitxml=/opt/results/nbi_report_ietf_l2vpn.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_ietf_network.py --junitxml=/opt/results/nbi_report_ietf_network.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_ietf_l3vpn.py --junitxml=/opt/results/nbi_report_ietf_l3vpn.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_etsi_bwm.py --junitxml=/opt/results/nbi_report_etsi_bwm.xml"
docker exec -i nbi bash -c "coverage run --append -m pytest --log-level=INFO --verbose nbi/tests/test_camara_qod.py --junitxml=/opt/results/nbi_report_camara_qod.xml"
docker exec -i nbi bash -c "coverage report --include='nbi/*' --show-missing"

#docker logs mock_tfs_nbi_dependencies
#docker logs nbi
docker logs nbi
#docker logs kafka
docker rm -f mock_tfs_nbi_dependencies nbi
docker rm -f nbi
docker rm -f mock_tfs_nbi_dependencies
docker rm -f kafka
docker network rm teraflowbridge

+0 −30
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/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.

PROJECTDIR=`pwd`

cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc
COVERAGEFILE=$PROJECTDIR/coverage/.coverage

# Destroy old coverage file and configure the correct folder on the .coveragerc file
rm -f $COVERAGEFILE
cat $PROJECTDIR/coverage/.coveragerc.template | sed s+~/tfs-ctrl+$PROJECTDIR+g > $RCFILE


# Run unitary tests and analyze coverage of code at same time
# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    nbi/tests/test_camara_qod.py
+0 −25
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2024 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.


PROJECTDIR=`pwd`

cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc

# Run unitary tests and analyze coverage of code at same time
# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    nbi/tests/test_core.py
+0 −25
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2024 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.


PROJECTDIR=`pwd`

cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc

# Run unitary tests and analyze coverage of code at same time
# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    nbi/tests/test_etsi_bwm.py
+0 −25
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2024 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.


PROJECTDIR=`pwd`

cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc

# Run unitary tests and analyze coverage of code at same time
# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    nbi/tests/test_ietf_l2vpn.py
Loading