[P4-dev] Does simple router support user-defined p4 source file? If so, how to use it correctly?

Wu, Xiaoban Xiaoban_Wu at student.uml.edu
Thu Aug 10 01:13:12 EDT 2017


Hi,


I am trying to run the behavioral model simple router https://github.com/p4lang/behavioral-model/tree/master/targets/simple_router, it is of version 1.5.0, but I am facing an unknown issue.


Traffic flow: eth1 at machine1-->eth1 at machine2-->eth2 at machine2-->eth2 at machine1


The simple router is running on machine2, with "sudo ./simple_router -i 0 at eth1 -i 1 at eth2 forward.json", where the forward.json is generated by "python /p4c-bm/p4c_bm/__main__.py --json forward.json forward.p4". The p4c-bm is also of version 1.5.0. The forward.p4 is in the attached.


After the simple router is running, I open another terminal on machine2 and run "./runtime_CLI < commands.txt", where the commands.txt in the attached.


Then I use scapy on machine1 to send packet out of interface eth1,

p = Ether(dst="aa:bb:cc:dd:ee:ff", src="aa:bb:cc:dd:ee:ff") / IP(src="10.0.1.1", dst="10.0.0.1") / TCP() / "aaaaaaaaaaaaaaaaaaa"

sendp(p, iface = "eth1")


Then on machine1, I use "tcpdump -i eth2" to monitor the traffic. However, I see nothing.


Some debugging info,

(1) I have tested the attached forward.p4 and commands.txt in the simple_switch, it works just fine.

(2)In the function "transmit_thread" of the simple_router.cpp

    1.The "packet->get_egress_port()" always return 0.

    2. If I manually change it with 1, then "transmit_fn(1, packet->data(), packet->get_data_size())" just works fine, since I can see the traffic with "tcpdump -i eth2" on machine2. This means all the connections are good.


Hence I am wondering if some issues are in the ingress match-action pipeline, but I could not find a clue. Hence I am wondering if the simple router support user-defined p4 source file?


Can anybody please explain what are the main differences between simple_router and simple_switch? I could not understand why forward.p4 works fine in simple_switch but not the simple_router.


Thank you very for your help.


Warm regards,

Xiaoban

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170810/157b8f68/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: forward.p4
Type: application/octet-stream
Size: 832 bytes
Desc: forward.p4
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170810/157b8f68/attachment.p4>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: commands.txt
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170810/157b8f68/attachment-0002.txt>


More information about the P4-dev mailing list