[P4-dev] Two questions from a rookie

Antonin Bas antonin at barefootnetworks.com
Wed Jun 24 14:57:01 EDT 2015


Hi Sergio,

See answer inline

On Tue, Jun 23, 2015 at 6:30 PM, Sergio Gutierrez <saguti at gmail.com> wrote:

> Hello all.
>
> I am new to P4 development, and I have a couple questions that I could not
> solve by reading the documentation and tutorials:
>
> - Is there any process/daemon/service that I need to start previous to run
> the behavioral models? I am trying to run the built in tests and I receive
> an error of connection refused.
>

If you followed the steps written down in the p4factory README, everything
should work fine. Could you send the exact commands you ran and their
respective output?
There is no deamon involved. To run the unit tests on basic routing, you
only need to execute these 2 steps (assuming you have compiled the switch
already):
1) sudo ./behavioral_model (which will start the switch process)
2) sudo python run_tests.py --test-dir of-tests/tests/ (which will
configure the match tables and send test packets)


> - I am trying to extend the simple_router example to use two switches. Is
> there any advice about how to do it?
>

We are still working on improving multi-device support at the moment.
However it should not be too difficult to run 2 instances of simple_router.
The behavioral model executable accepts a few command line arguments, which
we do not use for unit testing and are not very well documented. If you go
to the simple_router target directory and run ./behavioral-model -h, you
will get the following output:

ivs: Barefoot Networks Virtual Switch
Usage: ivs [OPTION]...

 -v, --verbose Verbose logging
 -t, --trace Very verbose logging
 -l, --listener=IP:PORT Listen for bfnctl connections
 --p4nsdb=IP:PORT Connect to the P4NSDB
* --pd-server=IP:PORT Listen for PD RPC calls*
 --no-veth No veth interfaces
 --no-pcap Do not dump to pcap files
* -i, --interface=INTERFACE Attach a network interface at startup*
 --name=NAME Set the name of the datapath (default p4ns)
 --dpid=DPID Set datapath ID (default autogenerated)
 -h,--help Display this help message and exit
 --version Display version information and exit

I highlighted the important options in your case.
1) --pd-server will let you specify on which port you want to run the
Thrift RPC server which listens for control plane updates. For example:
127.0.0.1:4567

2) --interface will let you choose which interfaces you want to attach to
your switch (we use libpcap to listen for traffic). For example
--interface veth1 --interface veth3

Using these command line argument you can spawn 2 instances of
simple_router, managing different interfaces and listening on a different
TCP port for control plane updates.
To send control plane updates, you can either write a Python script (as is
done for unit tests) or -and this is the preferred way in this case- use
the CLI:
https://github.com/p4lang/p4factory/blob/master/targets/simple_router/run_add_demo_entries.bash
By leveraging the -c option, you can connect to the correct RPC server.

Hope this helps.



>
> Thanks in advance for the attention.
>
> PS: I am running P4 on Linux Ubuntu 14.04
>
> --
> Sergio Gutiérrez
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at p4.org
> Listinfo - http://mail.p4.org/mailman/listinfo/p4-dev_p4.org
> Archives - http://mail.p4.org/pipermail/p4-dev_p4.org/
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150624/b59852cb/attachment-0001.html>


More information about the P4-dev mailing list