Hello,
I am having this topology which has two switches and two routers. I wanted to implement in p4 the l2_forwarding in switches and routers but also functionalities which are used only in routers like IP protocol and ARP.
Firstly, i was going to implement both the functionality of switch and router with arp protocol in the same p4 file, but i was able to see that i could not distinguish the switch from the router in order the switch not to support the arp protocol.(Correct me if i am wrong!).
So my second thought was to implement the switch in different p4 file from router and then load these files using the run_exercise.py from the tutorials of p4 and p4runtime_lib.
I changed the Makefile of these tutorials to support multiple .p4 files which will be end up to .json after compilation.
My problem now is inside run_exercise.py in this function:
def create_network(self):
""" Create the mininet network object, and store it as self.net.
Side effects:
- Mininet topology instance stored as self.topo
- Mininet instance stored as self.net
"""
self.logger("Building mininet topology.")
defaultSwitchClass = configureP4Switch(
sw_path=self.bmv2_exe,
json_path=self.switch_json,
log_console=True,
pcap_dump=self.pcap_dir)
self.topo = ExerciseTopo(self.hosts, self.switches, self.links, self.log_dir, self.bmv2_exe, self.pcap_dir)
self.net = Mininet(topo = self.topo,
link = TCLink,
host = P4Host,
switch = defaultSwitchClass,
controller = None)
Because of two switches and two routers of the topology i think that i am needing two instances of configureP4Switch function one for the routers and one for the switches.
But my problem is in the Mininet(), how can i have in the same mininet enviroment both the switches and routers?
In the Mininet() the switch variable will be assigned either the router part or switch part and the other part stays undeclared.
Excuse me for the large post.
Thanks in advance!