I have started the simple_switch on an ubuntu server with the command (sudo simple_switch_grpc -i 0@enp0s25 app.json (where app.json is the json got from the compilation of p4 program from p4c)).
The interface that I am using is enp0s25 (which is physical ethernet on the server) I have loaded the ICMP program from p4pi on the switch (p4pi/arp_icmp.p4 at master · p4lang/p4pi · GitHub).
I am trying to have a physical wlan (AP) also attached to this switch at port 1 and connect my laptop to it and ping the enp0s25 from my laptop. Do you think such a setting would be possible? How do I assign IP addresses to enp0s25 from the switch? If I run DHCP from my server to assign an IP to my laptop - how to communicate this information to my switch and make it aware that such an address is reachable from WLAN?
If you add more options when you start siple_switch_grpc, e.g.
simple_switch_grpc -i 0@enp0s25 -i 1@wlan app.json, then it should start with port 1 sending packets to and receiving packets from port
By default, any interface configuration done via Linux on interfaces has NO EFFECT on the behavior of your P4 program. You could configure your P4 program tables so that its view of IPv4, IPv6, and Ethernet address configuration has no resemblance to the configuration of the interfaces done by Linux. It is up to you and any control plane software you write for your P4 program to make its address configuration what you want.
@andyfingerhut thanks for your reply. Like you mentioned I was trying to use P4runtime shell to assign IP addresses to one of my interface bound to the switch. However I cannot seem to find any clear instructions on how to do so. If you could help me point to command that would enable me to do so/let me know if it possible to do it with p4rt shell or I should use something else please let me know. I am thankful for all the help
There are no P4 APIs that “assign an IPv4 address to an interface”, partly because it is possible to write P4 programs that do not use IPv4 addresses at all. It is intended to be a protocol-independent programming language, and while most useful P4 programs use IPv4 headers and addresses, they need not.
There are APIs for adding entries to tables that you define in your P4 program. If those have IPv4 addresses as keys or action parameters, then it is up to you and your control plane software to know whether those IPv4 addresses are “assigned to a local port”, or not. For example, some IPv4 addresses in a P4 program might be IPv4 addresses of other devices in the network, e.g. in a routing table.