# Network X 22 Demo - P4 driver, Basic connectivity functionality This functional test shows the P4 driver with a basic connectivity test between 2 hosts connected to a single P4 switch, using the TeraFlow Cloud-native SDN Controller. ## Functional test folder This functional test can be found in folder `src/tests/netx22-p4/`. ## P4 source and Mininet topology This test is designed to operate with a mininet deployment that contains 2 hosts and a BMv2 switch, such a topology can be found in the 'src/tests/netx22-p4/mininet' folder. Additionally the P4 source code, along with its compiled artifacts are present in the 'src/tests/netx22-p4/mininet' folder. ## Deployment and Dependencies To run this functional test, it is assumed you have deployed a MicroK8s-based Kubernetes environment and a TeraFlowSDN controller instance as described in the [Tutorial: Deployment Guide](./1-0-deployment.md), and you configured the Python environment as described in [Tutorial: Run Experiments Guide > 2.1. Configure Python Environment](./2-1-python-environment.md). Remember to source the scenario settings appropriately, e.g., `cd ~/tfs-ctrl && source my_deploy.sh` in each terminal you open. Additionally mininet should be installed, we suggest using the mininet packaged in the [Next-Gen SDN Tutorial][https://github.com/opennetworkinglab/ngsdn-tutorial], as it provides an easy way to deploy mininet dockerized and comes with the BMv2Stratum software switch. ## Test Execution ### Mininet To execute this functional test, first make sure that mininet is running the correct topology. If you have used the Next-Gen SDN Tutorial for it, you may add the topology provided in the mininet folder of the ngsdn tutorial and add the following make rule to its Makefile ``` start-simple: NGSDN_TOPO_PY := topo-simple.py start-simple: _start ``` After that run ``` make start-simple make mn-cli ``` You will be prompted with the mininet cli. Run the following and let it run until the end of the experiment ``` client ping server ``` ### Teraflow In another terminal cd to the teraflow directory and run the following ``` src/tests/netx22-p4/setup.sh ``` This will copy the p4 artifacts to the device pod. Then you can bootstrap the device to the Teraflow Controller ``` src/tests/netx22-p4/run_test_01_bootstrap.sh ``` Install the required rules to the p4 switch ``` src/tests/netx22-p4/run_test_02_create_service.sh ``` You should now check the mininet terminal. The two hosts should be pinging each other as intended. You can remove the rules from the p4 switch ``` src/tests/netx22-p4/run_test_03_delete_service.sh ``` The two hosts on the mininet terminal, should stop pinging. And remove the device from the Teraflow Controller ``` src/tests/netx22-p4/run_test_04_cleanup.sh ```