Skip to content
Snippets Groups Projects
Commit a4da1f0f authored by Carlos Natalino Da Silva's avatar Carlos Natalino Da Silva
Browse files

Improvements to the scripts and tutorial of the OFC'22

parent feea6f16
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!27New Descriptor Loader Framework and OFC'22 code migrations
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
export TFS_REGISTRY_IMAGE="http://localhost:32000/tfs/" export TFS_REGISTRY_IMAGE="http://localhost:32000/tfs/"
# Set the list of components, separated by spaces, you want to build images for, and deploy. # Set the list of components, separated by spaces, you want to build images for, and deploy.
# Supported components are:
# context device automation policy service compute monitoring webui
# interdomain slice pathcomp dlt
# dbscanserving opticalattackmitigator opticalattackdetector
# l3_attackmitigator l3_centralizedattackdetector l3_distributedattackdetector
export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui" export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui"
# Set the tag you want to use for your images. # Set the tag you want to use for your images.
...@@ -13,5 +18,9 @@ export TFS_K8S_NAMESPACE="tfs" ...@@ -13,5 +18,9 @@ export TFS_K8S_NAMESPACE="tfs"
# Set additional manifest files to be applied after the deployment # Set additional manifest files to be applied after the deployment
export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml" export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml"
# Set the neew Grafana admin password # Set the new Grafana admin password
export TFS_GRAFANA_PASSWORD="admin123+" export TFS_GRAFANA_PASSWORD="admin123+"
# If not already set, disable skip-build flag.
# If TFS_SKIP_BUILD is "YES", the containers are not rebuilt-retagged-repushed and existing ones are used.
export TFS_SKIP_BUILD=${TFS_SKIP_BUILD:-""}
...@@ -13,9 +13,5 @@ ...@@ -13,9 +13,5 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# make sure to source the following scripts:
# - my_deploy.sh
# - tfs_runtime_env_vars.sh
source tfs_runtime_env_vars.sh source tfs_runtime_env_vars.sh
pytest --verbose src/tests/ofc22/tests/test_functional_bootstrap.py pytest --verbose src/tests/ofc22/tests/test_functional_bootstrap.py
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
PROJECTDIR=`pwd` PROJECTDIR=`pwd`
# cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc RCFILE=$PROJECTDIR/coverage/.coveragerc
COVERAGEFILE=$PROJECTDIR/coverage/.coverage COVERAGEFILE=$PROJECTDIR/coverage/.coverage
...@@ -31,15 +30,15 @@ source tfs_runtime_env_vars.sh ...@@ -31,15 +30,15 @@ source tfs_runtime_env_vars.sh
# Force a flush of Context database # Force a flush of Context database
kubectl --namespace $TFS_K8S_NAMESPACE exec -it deployment/contextservice --container redis -- redis-cli FLUSHALL kubectl --namespace $TFS_K8S_NAMESPACE exec -it deployment/contextservice --container redis -- redis-cli FLUSHALL
# Run functional tests and analyze code coverage at the same time # Run functional tests
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ pytest --log-level=INFO --verbose \
src/tests/ofc22/tests/test_functional_bootstrap.py src/tests/ofc22/tests/test_functional_bootstrap.py
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ pytest --log-level=INFO --verbose \
src/tests/ofc22/tests/test_functional_create_service.py src/tests/ofc22/tests/test_functional_create_service.py
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ pytest --log-level=INFO --verbose \
src/tests/ofc22/tests/test_functional_delete_service.py src/tests/ofc22/tests/test_functional_delete_service.py
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ pytest --log-level=INFO --verbose \
src/tests/ofc22/tests/test_functional_cleanup.py src/tests/ofc22/tests/test_functional_cleanup.py
#!/bin/sh
export CONTEXTSERVICE_SERVICE_HOST=$(kubectl get service/contextservice --namespace tfs --template '{{.spec.clusterIP}}')
export CONTEXTSERVICE_SERVICE_PORT_GRPC=$(kubectl get service/contextservice --namespace tfs -o jsonpath='{.spec.ports[?(@.name=="grpc")].port}')
export COMPUTESERVICE_SERVICE_HOST=$(kubectl get service/computeservice --namespace tfs --template '{{.spec.clusterIP}}')
export COMPUTESERVICE_SERVICE_PORT_HTTP=$(kubectl get service/computeservice --namespace tfs -o jsonpath='{.spec.ports[?(@.name=="http")].port}')
echo "CONTEXTSERVICE_SERVICE_HOST=$CONTEXTSERVICE_SERVICE_HOST"
echo "CONTEXTSERVICE_SERVICE_PORT_GRPC=$CONTEXTSERVICE_SERVICE_PORT_GRPC"
echo "COMPUTESERVICE_SERVICE_HOST=$COMPUTESERVICE_SERVICE_HOST"
echo "COMPUTESERVICE_SERVICE_PORT_HTTP=$COMPUTESERVICE_SERVICE_PORT_HTTP"
...@@ -37,9 +37,6 @@ environment and a TeraFlowSDN controller instance as described in the ...@@ -37,9 +37,6 @@ environment and a TeraFlowSDN controller instance as described in the
[Tutorial: Deployment Guide](./1-0-deployment.md), and you configured the Python [Tutorial: Deployment Guide](./1-0-deployment.md), and you configured the Python
environment as described in environment as described in
[Tutorial: Run Experiments Guide > 2.1. Configure Python Environment](./2-1-python-environment.md). [Tutorial: Run Experiments Guide > 2.1. Configure Python Environment](./2-1-python-environment.md).
Remember to source the scenario settings, e.g., `cd ~/tfs-ctrl && source ofc22/deploy_specs.sh` in each terminal you open.
Then, re-build the protocol buffers code from the proto files:
`./proto/generate_code_python.sh`
## 2.2.4. Access to the WebUI and Dashboard ## 2.2.4. Access to the WebUI and Dashboard
...@@ -55,25 +52,33 @@ Notes: ...@@ -55,25 +52,33 @@ Notes:
## 2.2.5. Test execution ## 2.2.5. Test execution
Before executing the tests, the environment variables need to be prepared. Before executing the tests, we need to prepare a few things.
First, make sure to load your deployment variables by:
First, you need to make sure that you have all the gRPC-generate code in your folder.
To do so, run:
``` ```
source my_deploy.sh proto/generate_code_python.sh
``` ```
Then, you also need to load the environment variables to support the execution of the Then, it is time to deploy TeraFlowSDN with the correct specification for this scenario.
tests by: Make sure to load your deployment variables for this scenario by:
``` ```
source tfs_runtime_env_vars.sh source ofc22/deploy_specs.sh
``` ```
You also need to make sure that you have all the gRPC-generate code in your folder. Then, you need to deploy the components by running:
To do so, run:
``` ```
proto/generate_code_python.sh ./deploy.sh
```
After the deployment is finished, you need to load the environment variables to support
the execution of the tests by:
```
source tfs_runtime_env_vars.sh
``` ```
To execute this functional test, four main steps needs to be carried out: To execute this functional test, four main steps needs to be carried out:
...@@ -90,8 +95,24 @@ See the troubleshooting section if needed. ...@@ -90,8 +95,24 @@ See the troubleshooting section if needed.
You can check the logs of the different components using the appropriate `scripts/show_logs_[component].sh` scripts You can check the logs of the different components using the appropriate `scripts/show_logs_[component].sh` scripts
after you execute each step. after you execute each step.
There are two ways to execute the functional tests, *running all the tests with a single script* or *running each test independently*.
In the following we start with the first option, then we comment on how to run each test independently.
### 2.2.5.1. Running all tests with a single script
We have a script that executes all the steps at once.
It is meant for being used to test if all components involved in this scenario are working correct.
To run all the functional tests, you can run:
```
ofc22/run_tests_and_coverage.sh
```
The following sections explain each one of the steps.
### 2.2.5.1. Device bootstrapping
### 2.2.5.2. Device bootstrapping
This step configures some basic entities (Context and Topology), the devices, and the This step configures some basic entities (Context and Topology), the devices, and the
links in the topology. links in the topology.
...@@ -103,7 +124,11 @@ The expected results are: ...@@ -103,7 +124,11 @@ The expected results are:
To run this step, you can do it from the WebUI by uploading the file `./ofc22/tests/descriptors_emulated.json` that To run this step, you can do it from the WebUI by uploading the file `./ofc22/tests/descriptors_emulated.json` that
contains the descriptors of the contexts, topologies, devices, and links, or by contains the descriptors of the contexts, topologies, devices, and links, or by
executing the `./ofc22/run_test_01_bootstrap.sh` script. executing the script:
```
./ofc22/run_test_01_bootstrap.sh
```
When the bootstrapping finishes, check in the Grafana L3-Monitoring Dashboard and you When the bootstrapping finishes, check in the Grafana L3-Monitoring Dashboard and you
should see the monitoring data being plotted and updated every 5 seconds (by default). should see the monitoring data being plotted and updated every 5 seconds (by default).
...@@ -117,12 +142,16 @@ Note here that the emulated devices produce synthetic randomly-generated monitor ...@@ -117,12 +142,16 @@ Note here that the emulated devices produce synthetic randomly-generated monitor
and do not represent any particularservices configured. and do not represent any particularservices configured.
### 2.2.5.2. L3VPN Service creation ### 2.2.5.3. L3VPN Service creation
This step configures a new service emulating the request an OSM WIM would make by means This step configures a new service emulating the request an OSM WIM would make by means
of a Mock OSM instance. of a Mock OSM instance.
To run this step, execute the `./ofc22/run_test_02_create_service.sh` script. To run this step, execute the script:
```
./ofc22/run_test_02_create_service.sh
```
When the script finishes, check the WebUI *Services* tab. You should see that two When the script finishes, check the WebUI *Services* tab. You should see that two
services have been created, one for the optical layer and another for the packet layer. services have been created, one for the optical layer and another for the packet layer.
...@@ -133,13 +162,18 @@ the plots with the monitored data for the device. ...@@ -133,13 +162,18 @@ the plots with the monitored data for the device.
By default, device R1-EMU is selected. By default, device R1-EMU is selected.
### 2.2.5.3. L3VPN Service removal ### 2.2.5.4. L3VPN Service removal
This step deconfigures the previously created services emulating the request an OSM WIM This step deconfigures the previously created services emulating the request an OSM WIM
would make by means of a Mock OSM instance. would make by means of a Mock OSM instance.
To run this step, execute the `./ofc22/run_test_03_delete_service.sh` script, or delete To run this step, execute the script:
the L3NM service from the WebUI.
```
./ofc22/run_test_03_delete_service.sh
```
or delete the L3NM service from the WebUI.
When the script finishes, check the WebUI *Services* tab. When the script finishes, check the WebUI *Services* tab.
You should see that the two services have been removed. You should see that the two services have been removed.
...@@ -149,12 +183,16 @@ In the Grafana Dashboard, given that there is no service configured, you should ...@@ -149,12 +183,16 @@ In the Grafana Dashboard, given that there is no service configured, you should
0-valued flat plot again. 0-valued flat plot again.
### 2.2.5.4. Cleanup ### 2.2.5.5. Cleanup
This last step performs a cleanup of the scenario removing all the TeraFlowSDN entities This last step performs a cleanup of the scenario removing all the TeraFlowSDN entities
for completeness. for completeness.
To run this step, execute the `./ofc22/run_test_04_cleanup.sh` script. To run this step, execute the script:
```
./ofc22/run_test_04_cleanup.sh
```
When the script finishes, check the WebUI *Devices* tab, you should see that the devices When the script finishes, check the WebUI *Devices* tab, you should see that the devices
have been removed. have been removed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment