NSP4 is still under developing so that many functions are not supported in NSP4 yet. We invite you to extend NSP4 to create a better environment for learning the P4 language.
1、In the directory of src/
,change the path information from /home/wpq
to the NSP4 directory information. The code need to modify contain the following file:
- show_sw_tables.py
- show_table_entry.py
- show_table_info.py
- table_add_entry.py
- table_delete_entry.py
Example, for the show_sw_tables.py
, you should change the sentence from
cmd = "python /home/wpq/NSP4/src/simple_switch_CLI --thrift-port %d < /home/wpq/NSP4/src/cmd/show_tables.txt" % thrift_port
to
cmd = "python <path for NSP4>/src/simple_switch_CLI --thrift-port %d < /home/wpq/NSP4/src/cmd/show_tables.txt" % thrift_port
2、In the directory of p4web, change some path information in the code of the file p4web.py
.
Like 1, you just modify the information from /home/wpq
to the NSP4 directory, the line number of code includes 70、77、94、118、162、177、201.
1、Put the P4 code which is correct to the directory of p4src/. Note that the P4 program which contains the control flows "ingress" and "egress" must be given with the name "switch.p4".
2、Start up the p4web.py
by the Ryu command ryu-manager.
ryu-manager ./p4web.py
3、Type 127.0.0.1:8080 on your browser,you will see the following interface.
4、Input the information of topology on the interface, and click the button of 提交, you will find the GUI of topology appear the browser. Then start up the mininet with P4 by the following command.
cd init
sudo ./run_demo.sh
5、Then you can choose the switch by the switch number to config the P4 switch table.
For example:
5-1、Choose S1
5-2、Add flow entry to the table of dmac
5-3、Then you can fine the flow entry just downloaded appear the interface
5-4、Delete the flow entry
- The path information is complex
- Some function such as counter is not supported
- Non-support of P4-16 language