[P4-dev] simple_switch on mininet sends all to port 0

Antonin Bas antonin at barefootnetworks.com
Mon May 1 14:24:16 EDT 2017


Hi Regis,

switch.p4 is a pretty complex program. While it is possible to run it
inside 1sw_demo.py like you are doing, you will have to configure all the
relevant tables manually: set the default action appropriately and possibly
add table entries. Configuring multicast is just a part of it. That may be
a big effort. By looking at the simple_switch packet logs, you can figure
out all the tables visited by the packet and determine whether this is what
you wanted.

This is why we provide semantic libraries (i.e. not at the P4 table level,
but exposing L2/L3 control functions) in the switch repository:
https://github.com/p4lang/switch. In particular, the switchsai library
implements the SAI standard. Usually these semantic libraries are used when
integrating with a NOS to control the switch. The switchlink library is an
attempt as very light-weight NOS that leverages the linux kernel by
reacting to netlink events.
We provide a framework, called NTF, to run tests on simple_switch using
switch.p4 & switchlink. I suggest you try following the instructions in
this part of the switch README:
https://github.com/p4lang/switch#running-switch-ntf-tests. In particular
there is a L2 STP test that you should be able to reproduce.

Thanks,

Antonin

On Sat, Apr 29, 2017 at 3:31 AM, Regis Martins <regisftm at gmail.com> wrote:

> Hi Antonin,
>
> Thank you so much for your prompt answer!
> Actually, I was expecting the switch.p4 working as a L2 switch with STP.
> I thought it would multicast the ARP to all ports and forward the packet
> to the right one.
>
> The switch.p4, as it is, doesn't work like that, apparently...
>
> I tried to create a multicast group and add ports to this but it didn't
> work. Still the same behavior...
>
> ubuntu at p4lab01:~/behavioral-model/tools$ sudo bm_CLI --pre SimplePreLAG
> Obtaining JSON from switch...
> Done
> Control utility for runtime P4 table manipulation
> RuntimeCmd: mc_mgrp_create 1
> Creating multicast group 1
> RuntimeCmd: show_ports
>   port #       iface name       status  extra info
> ==================================================
>     1           s1-eth1           UP
>     2           s1-eth2           UP
> RuntimeCmd: mc_node_create 0 1
> Creating node with rid 0 , port map 10 and lag map
> node was created with handle 0
> RuntimeCmd: mc_node_create 1 2
> Creating node with rid 1 , port map 100 and lag map
> node was created with handle 1
> RuntimeCmd: mc_node_associate 1 0
> Associating node 0 to multicast group 1
> RuntimeCmd: mc_node_associate 1 1
> Associating node 1 to multicast group 1
> RuntimeCmd: mc_dump
> ==========
> MC ENTRIES
> **********
> mgrp(1)
>   -> (L1h=0, rid=0) -> (ports=[1], lags=[])
>   -> (L1h=1, rid=1) -> (ports=[2], lags=[])
> ==========
> LAGS
> ==========
> RuntimeCmd:
>
>
> What do I need to configure in the switch.p4 to get it working like that?
>
> Thanks 1st,
>
> *Regis Martins*
>
> On Fri, Apr 28, 2017 at 10:37 PM, Antonin Bas <
> antonin at barefootnetworks.com> wrote:
>
>> This is the default behavior if you do not set a unicast port in the
>> ingress pipeline, i.e. if you do not write the desired port value to the
>> standard_metadata.egress_spec field.
>>
>> On Fri, Apr 28, 2017 at 5:47 PM, Regis Martins <regisftm at gmail.com>
>> wrote:
>>
>>> Hello everyone!
>>>
>>> I'm trying to run the 1sw_demo.py using simple_switch.
>>>
>>> sudo python 1sw_demo.py --behavioral-exe /usr/local/bin/simple_switch
>>> --json ../../switch/p4-build/bmpd/switch.json
>>>
>>> It starts mininet with no problem... however no ping between h1 and h2.
>>>
>>> Looking in the nanomsg I could see that all packets are sent to
>>> port_out: 0, which does not exists.
>>>
>>>
>>> mininet> pingall
>>> *** Ping: testing ping reachability
>>> h1 -> X
>>>
>>> type: PACKET_IN, switch_id: 0, cxt_id: 0, sig: 8913935704055548682, id:
>>> 13, copy_id: 0, port_in: 1
>>> ...
>>> type: PACKET_OUT, switch_id: 0, cxt_id: 0, sig: 8913935704055548682, id:
>>> 13, copy_id: 0, port_out: 0
>>>
>>>
>>> h2 -> X
>>>
>>> type: PACKET_IN, switch_id: 0, cxt_id: 0, sig: 7739991354702958702, id:
>>> 14, copy_id: 0, port_in: 2
>>> ...
>>> type: PACKET_OUT, switch_id: 0, cxt_id: 0, sig: 7739991354702958702, id:
>>> 14, copy_id: 0, port_out: 0
>>>
>>> Any clue about what is happening?
>>>
>>> Thank you so much,
>>>
>>>
>>> *Regis Martins*
>>>
>>> _______________________________________________
>>> P4-dev mailing list
>>> P4-dev at lists.p4.org
>>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>>
>>
>>
>>
>> --
>> Antonin
>>
>
>


-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170501/5a1f074b/attachment-0002.html>


More information about the P4-dev mailing list