Running Trellis with P4Runtime with P4 Switch

64 views
Skip to first unread message

Sreenivasulu Saya

unread,
Sep 2, 2019, 1:22:47 PM9/2/19
to Trellis Developers
Hi All,

I am trying to run Trellis topology with a P4 switches controlled by ONOS. I have ONOS ver 2.3.0 running on my local machine.

I have cloned the routing repo and I see that there is Python script trellis.py in routing/routing/trellis directory. I also see there is a trellisp4.py as well in the same directory.

I tried to run the command:

   $ sudo -E ./trellisp4.py --onos-ip=127.0.0.1

expecting it to connect to ONOS running on the local machine. I got the following error:
------------
*** Starting 4 switches
s204 .......................................................................................................................................................................................................
--------------------------------------------------------------------------------
s204 log (from /tmp/bmv2-s204-log):
simple_switch_grpc --device-id 1 -i 1@s204-eth1 -i 2@s204-eth2 -i 3@s204-eth3 -i 4@s204-eth4 --thrift-port 33805 --log-console -Lwarn --no-p4 -- --cpu-port 255 --grpc-server-addr 0.0.0.0:49657
--------------------------------------------------------------------------------
simple_switch_grpc: No such file or directory
Traceback (most recent call last):
  File "./trellisp4.py", line 103, in <module>
    main(args)
  File "./trellisp4.py", line 88, in main
    net.start()
  File "build/bdist.linux-x86_64/egg/mininet/net.py", line 549, in start
  File "/home/sayasree/Work/onos/tools/dev/mininet/bmv2.py", line 341, in start
    self.waitBmv2Start()
  File "/home/sayasree/Work/onos/tools/dev/mininet/bmv2.py", line 427, in waitBmv2Start
--------------------------------------------------------------------------------

From the above log, I see that it is not able to find the 'simple_switch_grpc'. I tried building th  'simple_switch_grpc' from the P4C Behaviral-Model repo, I got some compile errors.

Is there any easier way to get the Trellis topology with P4 switches simulated by Mininet?

Any pointers would be greatly appreciated.

Regards,
  --Sreeni Saya

Carmelo Cascone

unread,
Sep 2, 2019, 2:11:03 PM9/2/19
to Sreenivasulu Saya, Trellis Developers
Hi Sreeni,

Here's a guide to run Trellis with Mininet and BMv2 (P4 software switch):

Hope it helps,
Carmelo

--
You received this message because you are subscribed to the Google Groups "Trellis Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trellis-dev...@opennetworking.org.
To view this discussion on the web visit https://groups.google.com/a/opennetworking.org/d/msgid/trellis-dev/17007a40-8858-46a1-8877-0d2a20b9a221%40opennetworking.org.

Sreenivasulu Saya

unread,
Sep 3, 2019, 9:53:00 AM9/3/19
to Carmelo Cascone, Trellis Developers
Hi Carmelo,


When I tried to start the VM in VirtualBox, I am getting the following error:
---------------
Failed to open a session for the virtual machine ONOS+P4 Dev (2019-05-16) 1:
RawFile#0 failed to create the raw output file /Users/carmelo/workspace/onos/tools/dev/p4vm/ubuntu-bionic-18.04-cloudimg-console.log (VERR_FILE_NOT_FOUND).
Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
ConsoleWrap
Interface:
IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
---------------
Looks like the directory /Users/carmelo ha sbeen hardcoded in the VM and hence it is failing to start.

Regards,
  --Sreeni Saya



Sreenivasulu Saya

unread,
Sep 3, 2019, 11:31:54 AM9/3/19
to Carmelo Cascone, Trellis Developers
Hi Carmelo,

I ran the following docker command:

docker run --rm -it --privileged -v /tmp/p4mn:/tmp \
    -v${WORKSPACE}/routing:/routing -w/routing/trellis \
    --name p4trellis --hostname p4trellis \
    -p 50001-50030:50001-50030 \
    --env PYTHONPATH=/root \
    --entrypoint python opennetworking/p4mn:stable trellisp4.py --onos-ip 127.0.0.1

and the I got the mininet prompt. At the prompt, the 'pingall' command is failing for all the hosts. I am able ot see the Trellis topology in the ONOS Web GUI2. 

I ran the following commands as well:
-------------
$ cd /tmp/p4mn
$ onos-netcfg localhost bmv2-s204-netcfg.json
$ onos-netcfg localhost bmv2-s205-netcfg.json
$ onos-netcfg localhost bmv2-s226-netcfg.json
$ onos-netcfg localhost bmv2-s227-netcfg.json
-----

I suspect that the configuration  in trellisp4.json or the IP addresses assigned to h1, h2, h3, h4 in the trellisp4.py file might be incorrect.

I had cloned the repo with the command: git clone https://github.com/opennetworkinglab/routing/

In the mininet h1, h2 has the following IP addresses:
mininet> py h1.IP()
10.0.0.1
mininet> py h2.IP()
10.0.0.2
 but in the trellisp4.py, the h1 is created with the folllowing:
        h1 = self.addHost('h1', cls=RoutedHost, mac='00:aa:00:00:00:01', ips=['10.0.2.1/24'], gateway='10.0.2.254')
        h2 = self.addHost('h2', cls=TaggedRoutedHost, mac='00:aa:00:00:00:02', ips=['10.0.2.2/24'], gateway='10.0.2.254', vlan=10)

I think, the ping is failing due to the mismatch of the IP subnets. I would greatly appreciate if you could confirm whether the configuration and the IP addresses are correctly configured.

Regards,
  --Sreeni Saya



On Mon, Sep 2, 2019 at 11:41 PM Carmelo Cascone <car...@opennetworking.org> wrote:
Reply all
Reply to author
Forward
0 new messages