Created
March 8, 2016 22:18
-
-
Save gvranganvtn/41cd2e050566384ad001 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mininet script | |
gvrangan@openstack-controlnode:~$ cat path_test.py | |
#!/usr/bin/python | |
from mininet.topo import Topo | |
class MyTopo( Topo ): | |
"Simple topology example." | |
def __init__( self ): | |
"Create custom topo." | |
# Initialize topology | |
Topo.__init__( self ) | |
# Add hosts and switches | |
leftHost = self.addHost( 'h1' ) | |
rightHost = self.addHost( 'h2' ) | |
leftSwitch = self.addSwitch( 's1' ) | |
middleSwitch = self.addSwitch( 's2' ) | |
middleSwitch2 = self.addSwitch( 's4' ) | |
rightSwitch = self.addSwitch( 's3' ) | |
pathSwitch = self.addSwitch( 's5' ) | |
# Add links | |
self.addLink( leftHost, leftSwitch ) | |
self.addLink( leftSwitch, middleSwitch ) | |
self.addLink( leftSwitch, middleSwitch2 ) | |
self.addLink( middleSwitch, pathSwitch ) | |
self.addLink( pathSwitch, rightSwitch ) | |
self.addLink( middleSwitch2, rightSwitch ) | |
self.addLink( rightSwitch, rightHost ) | |
topos = { 'mytopo': ( lambda: MyTopo() ) } | |
Launch VTN Manager in KAraf | |
1. Created the below VTN configuration | |
2. ngan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ curl --user "admin":"admin" -H "Content-type: application/json" -X POST \ | |
> http://localhost:8181/restconf/operations/vtn:update-vtn \ | |
> -d '{"input":{"tenant-name":"vtn1"}}' | |
{"output":{"status":"CREATED"}}gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ curl --user "admin":"admin" -H "Content-type: application/json" -X POST \ | |
> http://localhost:8181/restconf/operations/vtn-vbridge:update-vbridge \ | |
> -d '{"input":{"tenant-name":"vtn1", "bridge-name":"vbr1"}}' | |
{"output":{"status":"CREATED"}}gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ curl --user "admin":"admin" -H "Content-type: application/json" -X POST \ | |
> http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface \ | |
> -d '{"input":{"tenant-name":"vtn1", "bridge-name":"vbr1", "interface-name":"if1"}}' | |
{"output":{"status":"CREATED"}}gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ curl --user "admin":"admin" -H "Content-type: application/json" -X POST \ | |
> http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface \ | |
> -d '{"input":{"tenant-name":"vtn1", "bridge-name":"vbr1", "interface-name":"if2"}}' | |
{"output":{"status":"CREATED"}}gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ curl --user "admin":"admin" -H "Content-type: application/json" -X POST \ | |
> http://localhost:8181/restconf/operations/vtn-port-map:set-port-map \ | |
> -d '{"input":{"tenant-name":"vtn1", "bridge-name":"vbr1", "interface-name":"if1", "node":"openflow:1", "port-name":"s1-eth1"}}' | |
{"output":{"status":"CREATED"}}gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ | |
gvrangan@odl-dev1:~$ curl --user "admin":"admin" -H "Content-type: application/json" -X POST \ | |
> http://localhost:8181/restconf/operations/vtn-port-map:set-port-map \ | |
> -d '{"input":{"tenant-name":"vtn1", "bridge-name":"vbr1", "interface-name":"if2", "node":"openflow:3", "port-name":"s3-eth3"}}' | |
{"output":{"status":"CREATED"}}gvrangan@odl-dev1:~$ | |
---------- | |
Tried ping and the flow entries were installed | |
mininet> dpctl dump-flows | |
*** s1 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=756.474s, table=0, n_packets=304, n_bytes=25810, idle_age=4, priority=0 actions=CONTROLLER:65535 | |
cookie=0x7f56000000000001, duration=182.224s, table=0, n_packets=2, n_bytes=140, idle_age=177, priority=10,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=72:37:af:cb:f4:49,dl_d | |
st=72:c8:a4:9e:9e:69 actions=output:1 | |
cookie=0x7f56000000000002, duration=182.216s, table=0, n_packets=2, n_bytes=140, idle_timeout=300, idle_age=177, priority=10,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=72:c | |
8:a4:9e:9e:69,dl_dst=72:37:af:cb:f4:49 actions=output:3 | |
*** s2 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=750.451s, table=0, n_packets=300, n_bytes=25500, idle_age=4, priority=0 actions=CONTROLLER:65535 | |
*** s3 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=745.707s, table=0, n_packets=300, n_bytes=25470, idle_age=4, priority=0 actions=CONTROLLER:65535 | |
cookie=0x7f56000000000001, duration=182.222s, table=0, n_packets=2, n_bytes=140, idle_timeout=300, idle_age=177, priority=10,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=72:3 | |
7:af:cb:f4:49,dl_dst=72:c8:a4:9e:9e:69 actions=output:2 | |
cookie=0x7f56000000000002, duration=182.221s, table=0, n_packets=2, n_bytes=140, idle_age=177, priority=10,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=72:c8:a4:9e:9e:69,dl_d | |
st=72:37:af:cb:f4:49 actions=output:3 | |
*** s4 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=740.973s, table=0, n_packets=296, n_bytes=25160, idle_age=4, priority=0 actions=CONTROLLER:65535 | |
cookie=0x7f56000000000002, duration=182.223s, table=0, n_packets=2, n_bytes=140, idle_age=177, priority=10,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=72:c8:a4:9e:9e:69,dl_d | |
st=72:37:af:cb:f4:49 actions=output:2 | |
cookie=0x7f56000000000001, duration=182.230s, table=0, n_packets=2, n_bytes=140, idle_age=177, priority=10,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=72:37:af:cb:f4:49,dl_d | |
st=72:c8:a4:9e:9e:69 actions=output:1 | |
*** s5 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=736.050s, table=0, n_packets=294, n_bytes=24990, idle_age=4, priority=0 actions=CONTROLLER:65535 | |
mininet> | |
mininet> h1 ping h2 | |
--------------- | |
mininet> link s4 s3 down | |
mininet> | |
mininet> | |
mininet> h1 ping h2 | |
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. | |
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=14.7 ms | |
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.434 ms | |
64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.096 ms | |
^C | |
--- 10.0.0.2 ping statistics --- | |
3 packets transmitted, 3 received, 0% packet loss, time 2002ms | |
rtt min/avg/max/mdev = 0.096/5.106/14.788/6.847 ms | |
mininet> dpctl dump-flows | |
*** s1 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=955.872s, table=0, n_packets=386, n_bytes=32750, idle_age=3, priority=0 actions=CONTROLLER:65535 | |
cookie=0x7f56000000000003, duration=6.078s, table=0, n_packets=3, n_bytes=238, idle_timeout=300, idle_age=1, priority=10,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=72:c8:a4 | |
:9e:9e:69,dl_dst=72:37:af:cb:f4:49 actions=output:2 | |
cookie=0x7f56000000000004, duration=6.074s, table=0, n_packets=3, n_bytes=238, idle_age=1, priority=10,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=72:37:af:cb:f4:49,dl_dst=7 | |
2:c8:a4:9e:9e:69 actions=output:1 | |
*** s2 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=949.849s, table=0, n_packets=380, n_bytes=32300, idle_age=3, priority=0 actions=CONTROLLER:65535 | |
cookie=0x7f56000000000003, duration=6.083s, table=0, n_packets=3, n_bytes=238, idle_age=1, priority=10,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=72:c8:a4:9e:9e:69,dl_dst=7 | |
2:37:af:cb:f4:49 actions=output:2 | |
cookie=0x7f56000000000004, duration=6.077s, table=0, n_packets=3, n_bytes=238, idle_age=1, priority=10,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=72:37:af:cb:f4:49,dl_dst=7 | |
2:c8:a4:9e:9e:69 actions=output:1 | |
*** s3 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=945.105s, table=0, n_packets=380, n_bytes=32240, idle_age=3, priority=0 actions=CONTROLLER:65535 | |
cookie=0x7f56000000000003, duration=6.085s, table=0, n_packets=3, n_bytes=238, idle_age=1, priority=10,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=72:c8:a4:9e:9e:69,dl_dst=7 | |
2:37:af:cb:f4:49 actions=output:3 | |
cookie=0x7f56000000000004, duration=6.072s, table=0, n_packets=3, n_bytes=238, idle_timeout=300, idle_age=1, priority=10,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=72:37:af | |
:cb:f4:49,dl_dst=72:c8:a4:9e:9e:69 actions=output:1 | |
*** s4 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=940.371s, table=0, n_packets=374, n_bytes=31790, idle_age=3, priority=0 actions=CONTROLLER:65535 | |
*** s5 ------------------------------------------------------------------------ | |
NXST_FLOW reply (xid=0x4): | |
cookie=0x0, duration=935.447s, table=0, n_packets=374, n_bytes=31790, idle_age=3, priority=0 actions=CONTROLLER:65535 | |
cookie=0x7f56000000000003, duration=6.088s, table=0, n_packets=3, n_bytes=238, idle_age=1, priority=10,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=72:c8:a4:9e:9e:69,dl_dst=7 | |
2:37:af:cb:f4:49 actions=output:2 | |
cookie=0x7f56000000000004, duration=6.082s, table=0, n_packets=3, n_bytes=238, idle_age=1, priority=10,in_port=2,vlan_tci=0x0000/0x1fff,dl_src=72:37:af:cb:f4:49,dl_dst=7 | |
2:c8:a4:9e:9e:69 actions=output:1 | |
--------- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment