Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • ONOS karaf process (from now on it will be called T1)

  • ONOS shell (T2), identified by onos> shell

  • Docker P4+Mininet emulator (T3), identified by mininet> shell

  • Utility (T4)

So, first of all, open 3 4 terminal windows on your machine.

...

Now ONOS is running, the needed apps are correctly running and the network configuration is pushed in ONOS, we are ready to run the emulated trellis topology on P4+Mininet Docker container.


In T3 start the previously downloaded Docker container with the topology available in the "routing" repository. You can do it running the following command:.

The mininet topology of trellisp4.py python script is the one presented above with:

  • 2 by 2 leaf-spine topology using 4 BMv2 devices

  • 4 bidirectional links between leaf and spine

  • 4 hosts, 2 hosts per leaf device

You can run the topology with the following command:

Code Block
$ docker run --rm -
Code Block
$ 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

The output should look like something like this (do not bother at the error you'll see in the first rows, they are related to the fact that the Mininet Python script is not able to submit its Network Configuration to the ONOS controller)::

Code Block
Unable to contact the remote controller 
Code Block
Unable to contact the remote controller at 127.0.0.1:6653
Unable to contact the remote controller at 127.0.0.1:6633
Setting remote controller to 127.0.0.1:6653
*** Error setting resource limits. Mininet's performance may be affected.
*** Creating network
*** Adding hosts:
h1 h2 h3 h4
*** Adding switches:
s204 s205 s226 s227
*** Adding links:
(h1, s204) (h2, s204) (h3, s205) (h4, s205) (s226, s204) (s226, s205) (s227, s204) (s227, s205)
*** Configuring hosts
h1 h2 h3 h4
*** Starting controller	
c0
*** Starting 4 switches
s204 .........⚡️ simple_switch_grpc @ 50001
s205 .........⚡️ simple_switch_grpc @ 50002
s226 ......⚡️ simple_switch_grpc @ 50003
s227 .....⚡️ simple_switch_grpc @ 50004

*** Starting CLI:
mininet>

Start mininet topology on new terminal using trellisp4.py python script
trellisp4.py creates:

  • 2 by 2 leaf-spine topology using 4 bmv2 devices

  • 4 bidirectional links between leaf and spine

  • 4 hosts, 2 hosts per leaf device

Code Block
$ sudo -E env PYTHONPATH=$PYTHONPATH:$ONOS_ROOT/tools/dev/mininet ./trellisp4.py --onos-ip 127.0.0.1;

After started, ONOS should discover 4 devices and 8 links

Since the Mininet Python script running inside the Container is not able to contact the ONOS controller (as you can see from the first 2 rows of the output above), we need to submit the Network Configuration on our own using the onos-netcfg command as we have done before.

To do so, on T4, run the following commands:

Code Block
$ 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

On T1 you should see that ONOS received the configuration and has configured the device.

To check we can run the following commands on T2 (onos shell):

Code Block
onos> devices -s
id=device:bmv2:204, available=true, role=MASTER, type=SWITCH, driver=bmv2:org.onosproject.pipelines.fabric
id=device:bmv2:205, available=true, role=MASTER, type=SWITCH, driver=bmv2:org.onosproject.pipelines.fabric
id=device:bmv2:226, available=true, role=MASTER, type=SWITCH, driver=bmv2:org.onosproject.pipelines.fabric
id=device:bmv2:227, available=true, role=MASTER, type=SWITCH, driver=bmv2:org.onosproject.pipelines.fabric
onos> links
src=device:bmv2:204/1, dst=device:bmv2:226/1, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:204/2, dst=device:bmv2:227/1, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:205/1, dst=device:bmv2:226/2, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:205/2, dst=device:bmv2:227/2, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:226/1, dst=device:bmv2:204/1, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:226/2, dst=device:bmv2:205/1, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:227/1, dst=device:bmv2:204/2, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:227/2
Code Block
onos> devices -s
id=device:bmv2:204, available=true, role=MASTER, type=SWITCH, driver=bmv2:org.onosproject.pipelines.fabric
id=device:bmv2:205, available=true, role=MASTER, type=SWITCH, driver=bmv2:org.onosproject.pipelines.fabric
id=device:bmv2:226, available=true, role=MASTER, type=SWITCH, driver=bmv2:org.onosproject.pipelines.fabric
id=device:bmv2:227, available=true, role=MASTER, type=SWITCH, driver=bmv2:org.onosproject.pipelines.fabric
onos> links
src=device:bmv2:204/1, dst=device:bmv2:226205/12, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:204/2, dst=device:bmv2:227/1, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:205/1, dst=device:bmv2:226/2, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:205/2, dst=device:bmv2:227/2, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:226/1, dst=device:bmv2:204/1, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:226/2, dst=device:bmv2:205/1, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:227/1, dst=device:bmv2:204/2, type=DIRECT, state=ACTIVE, expected=false
src=device:bmv2:227/2, dst=device:bmv2:205/2, type=DIRECT, state=ACTIVE, expected=false

Now you should be able to ping the hosts from the Mininet shell (T3):

Code Block
mininet> h1 ping h2
PING 10.0.2.2 (10.0.2.2) 56(84) bytes of data.
64 bytes from 10.0.2.2: icmp_seq=1 ttl=63 time=2.90 ms
64 bytes from 10.0.2.2: icmp_seq=2 ttl=63 time=1.86 ms
...
mininet> h3 ping h4
PING 10.0.3.2 (10.0.3.2) 56(84) bytes of data.
64 bytes from 10.0.3.2: icmp_seq=1 ttl=63 time=3.69 ms
64 bytes from 10.0.3.2: icmp_seq=2 ttl=63 time=1.29 ms
...

If any host was not discovered by ONOS, try send arp request by using arping tool from Mininet shell (T3):

Code Block
mininet> h1 arping 10.0.2.254


Hosts should be learned by ONOS

...