[P4-dev] How to connect two different P4 switch via veths

David Hancock dhancock at cs.utah.edu
Thu Mar 10 15:07:55 EST 2016


You can certainly modify topo.py to permit more command line arguments 
so that you can specify a different .json for each switch.  Once you've 
done this, you'll be able to add those new command line arguments to 
run_demo.sh.  If it is not clear how to do this, you'll need to take a 
step back and learn more python, specifically, the argparse module.

BUT you want to do this without using mininet.  Also certainly 
possible.  Yes, start each switch on a different port.  I haven't 
connected switches outside of mininet before.  But after glancing at 
veth_setup.sh and googling "linux virtual interface" I start getting the 
idea that when veths are created, pairs of veths can be set up as peers, 
which makes them act like two ends of a pipe.  So you either make use of 
the peer pairs already created by the veth_setup script and assign veths 
to your switches accordingly, or you make your own version of the 
veth_setup script to wire things the way you want.

--David

On 03/06/2016 07:02 PM, Swaroop Thool wrote:
> Hello Antonin and all,
>
> Thank you very much. I got few pointers for my project. When I looked 
> at topo.py which creates topology as mentioned in topo.txt and when we 
> do ./run_demo.sh it uses source_routing.json file only. This means I 
> can use the same single program on three different switch as per 
> example. However, I want to use different .json file (means different 
> p4 programs) on different switches. Is this possible by any 
> modification? I want to keep copy_to_cpu like running procedure (not 
> involving mininet) for real traffic that's why I want to find a way to 
> run two different switches having different program which are 
> connected by veth. Should I run switches with different thrift ports 
> but how to connects there veths?...I am bit confuse.
> Thank you for your time.
>
> Thanks,
> Swaroop
> ------------------------------------------------------------------------
> Date: Fri, 4 Mar 2016 10:06:12 -0800
> Subject: Re: [P4-dev] How to connect two different P4 switch via veths
> From: antonin at barefootnetworks.com
> To: swaroopthool1991 at outlook.com
> CC: p4-dev at lists.p4.org
>
> If you want to run multiple switches, using Mininet is your best 
> option. You don't need to use Docker images though, you can just 
> reproduce what is done in the source routing tutorial exercise: 
> https://github.com/p4lang/tutorials/blob/master/SIGCOMM_2015/source_routing/topo.py. 
> This exercise uses a 3-switch & 3-host Mininet topology 
> (https://github.com/p4lang/tutorials/blob/master/SIGCOMM_2015/resources/images/source_routing_topology.png). 
> You can still use scapy on the 3 hosts to inject individual packets. 
> As a matter of fact, that is exactly how the source_routing exercise 
> operates.
> Of course you don't need to do that, you can always do your plumbing 
> manually even though that would be shooting yourself in the foot. If 
> you have a veth0-veth1 pair, you can connect veth0 to your first 
> switch and veth1 to your second switch. Mininet has the advantage that 
> it takes care of the plumbing for you, as well as start linux 
> containers for the hosts which lets you do more interesting things 
> than just send individual packets with scapy (e.g. you can run a tcp 
> flow).
>
> On Thu, Mar 3, 2016 at 12:24 PM, Swaroop Thool 
> <swaroopthool1991 at outlook.com <mailto:swaroopthool1991 at outlook.com>> 
> wrote:
>
>     Hello John and All,
>
>     Can you please elaborate? I never used it before.How Docker gonna
>     help ? I dont want to use mininet now as I am using scapy.
>     Moreover, I am able to run two different P4 program only after
>     mentioning different thrift-port while starting each switch. So
>     how to connect this two switches via veth?
>
>     Thanks,
>     Swaroop
>
>
>     ------------------------------------------------------------------------
>     Subject: Re: [P4-dev] How to connect two different P4 switch via veths
>     From: john at barefootnetworks.com <mailto:john at barefootnetworks.com>
>     Date: Wed, 2 Mar 2016 11:00:52 -0800
>     CC: p4-dev at lists.p4.org <mailto:p4-dev at lists.p4.org>
>     To: swaroopthool1991 at outlook.com
>     <mailto:swaroopthool1991 at outlook.com>
>
>
>     See
>
>     https://github.com/p4lang/p4factory#integration-with-mininet
>     https://github.com/p4lang/p4factory#integration-with-mininet-and-docker
>
>     John
>
>
>         On Mar 2, 2016, at 10:51 AM, Swaroop Thool
>         <swaroopthool1991 at outlook.com
>         <mailto:swaroopthool1991 at outlook.com>> wrote:
>
>         Hello All,
>
>         I want to know, How to connect two veths(ports) of two
>         different P4 switch?
>         I want to send data process by one P4 switch to another P4
>         switch which implements different P4 programs. As of now, we
>         can send packets from veth1(port1) and  sniff on veth6(port3)
>         by scapy (from copy_to_cpu example).
>         How to connect same port 3 of veth6 of 1st P4 switch to some
>         incoming port of 2nd P4 switch?
>
>         Moreover, as I cannot run two instances (programs)on same P4
>         switch. Do I need to make another copy or folder of that
>         switch (/targets/simple_switch)? and how to connect to
>         other?Please help
>
>
>         Thanks,
>         Swaroop Thool
>         _______________________________________________
>         P4-dev mailing list
>         P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org>
>         http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
>
>
>     _______________________________________________
>     P4-dev mailing list
>     P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org>
>     http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
>
>
>
> -- 
> Antonin
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20160310/d3d4a580/attachment-0002.html>


More information about the P4-dev mailing list