tutorials
tutorials copied to clipboard
move next_thrift_port to class P4Switch
I want to start a network that has several switches with simple_switch, and load p4 program by setting 'program' option in topology.json:
···
"switches": {
"s1": { "program": "build/basic.json",
"cli_input" : "linear-topo/s1-cli.txt" },
"s2": { "program": "build/basic.json",
"cli_input" : "linear-topo/s2-cli.txt" }
},
"links": [
["h1", "s1-p1"], ["h2", "s2-p1"], ["s1-p2", "s2-p2"] ]
···
However, both thrift port of s1 and s2 will be set to 9090, as the function configureP4Switch in run_exercise.py does not return the same object of class ConfiguredP4Switch .
I move the next_thrift_port property to class P4Switch, so that the thrift port number will be incremented just like grpc port.