|
| 1 | +== Overview |
| 2 | +This example demonstrates on how to create a specific VTN Path Map information. |
| 3 | + |
| 4 | +image::pathmap.PNG[600px-pathmap] |
| 5 | + |
| 6 | +== Requirement |
| 7 | +* Save the mininet script given below as pathmap_test.py and run the mininet script in the mininet environment where Mininet is installed. |
| 8 | + |
| 9 | +* Create topology using the below mininet script: |
| 10 | +[cols=*3,2a,^,options="header",width="75%"] |
| 11 | +|=== |
| 12 | + |from mininet.topo import Topo |
| 13 | + class MyTopo( Topo ): |
| 14 | + "Simple topology example." |
| 15 | + def __init__( self ): |
| 16 | + "Create custom topo." |
| 17 | + # Initialize topology |
| 18 | + Topo.__init__( self ) |
| 19 | + # Add hosts and switches |
| 20 | + leftHost = self.addHost( 'h1' ) |
| 21 | + rightHost = self.addHost( 'h2' ) |
| 22 | + leftSwitch = self.addSwitch( 's1' ) |
| 23 | + middleSwitch = self.addSwitch( 's2' ) |
| 24 | + middleSwitch2 = self.addSwitch( 's4' ) |
| 25 | + rightSwitch = self.addSwitch( 's3' ) |
| 26 | + # Add links |
| 27 | + self.addLink( leftHost, leftSwitch ) |
| 28 | + self.addLink( leftSwitch, middleSwitch ) |
| 29 | + self.addLink( leftSwitch, middleSwitch2 ) |
| 30 | + self.addLink( middleSwitch, rightSwitch ) |
| 31 | + self.addLink( middleSwitch2, rightSwitch ) |
| 32 | + self.addLink( rightSwitch, rightHost ) |
| 33 | + topos = { 'mytopo': ( lambda: MyTopo() ) } |
| 34 | +|=== |
| 35 | + |
| 36 | +* mininet> net |
| 37 | + c0 |
| 38 | + s1 lo: s1-eth1:h1-eth0 s1-eth2:s2-eth1 s1-eth3:s4-eth1 |
| 39 | + s2 lo: s2-eth1:s1-eth2 s2-eth2:s3-eth1 |
| 40 | + s3 lo: s3-eth1:s2-eth2 s3-eth2:s4-eth2 s3-eth3:h2-eth0 |
| 41 | + s4 lo: s4-eth1:s1-eth3 s4-eth2:s3-eth2 |
| 42 | + h1 h1-eth0:s1-eth1 |
| 43 | + h2 h2-eth0:s3-eth3 |
| 44 | + |
| 45 | +* Generate traffic by pinging between hosts h1 and h2 before creating the portmaps respectively |
| 46 | + mininet> h1 ping h2 |
| 47 | + PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. |
| 48 | + From 10.0.0.1 icmp_seq=1 Destination Host Unreachable |
| 49 | + From 10.0.0.1 icmp_seq=2 Destination Host Unreachable |
| 50 | + From 10.0.0.1 icmp_seq=3 Destination Host Unreachable |
| 51 | + From 10.0.0.1 icmp_seq=4 Destination Host Unreachable |
| 52 | + |
| 53 | +== Configuration |
| 54 | +* .Create Controller |
| 55 | +[cols=*3,2a,^,options="header",width="75%"] |
| 56 | +|=== |
| 57 | +{ |
| 58 | +|curl --user admin:adminpass -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X POST -d '{"controller": {"controller_id": "odc", "ipaddr":"10.100.9.42", "type": "odc", "version": "1.0", "auditstatus":"enable"}}' http://127.0.0.1:8083/vtn-webapi/controllers.json |
| 59 | +|} |
| 60 | +|=== |
| 61 | +* .Create a VTN |
| 62 | +[cols=*3,2a,^,options="header",width="75%"] |
| 63 | +|=== |
| 64 | +{ |
| 65 | +|curl --user admin:adminpass -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X POST -d '{"vtn" : {"vtn_name":"vtn1","description":"test VTN" }}' http://127.0.0.1:8083/vtn-webapi/vtns.json |
| 66 | +|} |
| 67 | +|=== |
| 68 | +* .Create a vBridge in the VTN |
| 69 | +[cols=*3,2a,^,options="header",width="75%"] |
| 70 | +|=== |
| 71 | +{ |
| 72 | +|curl --user admin:adminpass -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X POST -d '{"vbridge" : {"vbr_name":"vBridge1","controller_id":"odc","domain_id":"(DEFAULT)" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges.json |
| 73 | +|} |
| 74 | +|=== |
| 75 | +* .Create two Interfaces into the vBridge |
| 76 | +[cols=*3,2a,^,options="header",width="75%"] |
| 77 | +|=== |
| 78 | +{ |
| 79 | +|curl --user admin:adminpass -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X POST -d '{"interface": {"if_name": "if1","description": "if_desc1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces.json |
| 80 | +|- |
| 81 | +|curl --user admin:adminpass -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X POST -d '{"interface": {"if_name": "if2","description": "if_desc2"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces.json |
| 82 | +|} |
| 83 | +|=== |
| 84 | +* .Configure two mappings on the interfaces |
| 85 | +[cols=*3,2a,^,options="header",width="75%"] |
| 86 | +|=== |
| 87 | +{ |
| 88 | +|curl --user admin:adminpass -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X PUT -d '{"portmap":{"logical_port_id": "PP-OF:00:00:00:00:00:00:00:01-s1-eth1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces/if1/portmap.json |
| 89 | +|- |
| 90 | +|curl --user admin:adminpass -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X PUT -d '{"portmap":{"logical_port_id": "PP-OF:00:00:00:00:00:00:00:03-s3-eth3"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces/if2/portmap.json |
| 91 | +|} |
| 92 | +|=== |
| 93 | +* .Generate traffic by pinging between hosts h1 and h2 after creating the portmaps respectively |
| 94 | + mininet> h1 ping h2 |
| 95 | + PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. |
| 96 | + 64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=36.4 ms |
| 97 | + 64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.880 ms |
| 98 | + 64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=0.073 ms |
| 99 | + 64 bytes from 10.0.0.2: icmp_req=4 ttl=64 time=0.081 ms |
| 100 | +* .Get the VTN Dataflows information |
| 101 | +[cols=*3,2a,^,options="header",width="75%"] |
| 102 | +|=== |
| 103 | +{ |
| 104 | +|curl -X GET -H 'content-type: application/json' --user 'admin:adminpass' -H 'ipaddr:127.0.0.1' "http://127.0.0.1:8083/vtn-webapi/dataflows?&switch_id=00:00:00:00:00:00:00:01&port_name=s1-eth1&controller_id=odc&srcmacaddr=de3d.7dec.e4d2&no_vlan_id=true" |
| 105 | +|} |
| 106 | +|=== |
| 107 | +* .Create a Flowcondition in the VTN |
| 108 | +[cols=*3,2a,^,options="header",width="75%"] |
| 109 | +|=== |
| 110 | +{|curl --user admin:admin -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X PUT -d '{"name": "flowcond_1","match": [{"index": 1,"ethernet": {"src": "ca:9e:58:0c:1e:f0","dst": "ba:bd:0f:e3:a8:c8","type": 2048},"inetMatch": {"inet4": {"src": "10.0.0.1","dst": "10.0.0.2","protocol": 1}}}]}' http://10.100.9.42:8080/controller/nb/v2/vtn/default/flowconditions/flowcond_1 |
| 111 | +|} |
| 112 | +|=== |
| 113 | +* .Create a Pathmap in the VTN |
| 114 | +[cols=*3,2a,^,options="header",width="75%"] |
| 115 | +|=== |
| 116 | +{ |
| 117 | +|curl --user admin:admin -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X PUT -d '{"index": 10, "condition":"flowcond_1", "policy":1, "idleTimeout": 300, "hardTimeout": 0}' http://10.100.9.42:8080/controller/nb/v2/vtn/default/pathmaps/1 |
| 118 | +|} |
| 119 | +|=== |
| 120 | +* .Get the Path policy information |
| 121 | +[cols=*3,2a,^,options="header",width="75%"] |
| 122 | +|=== |
| 123 | +{ |
| 124 | +|curl --user admin:admin -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X GET -d '{"id": 1,"default": 100000,"cost": [{"location": {"node": {"type": "OF","id": "00:00:00:00:00:00:00:01"},"port": {"type": "OF","id": "3","name": "s1-eth3"}},"cost": 1000},{"location": {"node": {"type": "OF","id": "00:00:00:00:00:00:00:04"},"port": {"type": "OF","id": "2","name": "s4-eth2"}},"cost": 1000},{"location": {"node": {"type": "OF", "id": "00:00:00:00:00:00:00:03"},"port": {"type": "OF","id": "3","name": "s3-eth3"}},"cost": 100000}]}' http://10.100.9.42:8080/controller/nb/v2/vtn/default/pathpolicies/1 |
| 125 | +|} |
| 126 | +|=== |
| 127 | +== Verification |
| 128 | +== Before applying Path policy information in the VTN |
| 129 | +[cols=*3,2a,^,options="header",width="75%"] |
| 130 | +|=== |
| 131 | +{ |
| 132 | + "pathinfos": [ |
| 133 | + { |
| 134 | + "in_port_name": "s1-eth1", |
| 135 | + "out_port_name": "s1-eth2", |
| 136 | + "switch_id": "00:00:00:00:00:00:00:01" |
| 137 | + }, |
| 138 | + { |
| 139 | + "in_port_name": "s2-eth1", |
| 140 | + "out_port_name": "s2-eth2", |
| 141 | + "switch_id": "00:00:00:00:00:00:00:02" |
| 142 | + }, |
| 143 | + { |
| 144 | + "in_port_name": "s3-eth1", |
| 145 | + "out_port_name": "s3-eth3", |
| 146 | + "switch_id": "00:00:00:00:00:00:00:03" |
| 147 | + } |
| 148 | + ] |
| 149 | +} |
| 150 | +|=== |
| 151 | +== After applying Path policy information in the VTN |
| 152 | +[cols=*3,2a,^,options="header",width="75%"] |
| 153 | +|=== |
| 154 | +{ |
| 155 | + "pathinfos": [ |
| 156 | + { |
| 157 | + "in_port_name": "s1-eth1", |
| 158 | + "out_port_name": "s1-eth3", |
| 159 | + "switch_id": "00:00:00:00:00:00:00:01" |
| 160 | + }, |
| 161 | + { |
| 162 | + "in_port_name": "s4-eth1", |
| 163 | + "out_port_name": "s4-eth2", |
| 164 | + "switch_id": "00:00:00:00:00:00:00:04" |
| 165 | + }, |
| 166 | + { |
| 167 | + "in_port_name": "s3-eth2", |
| 168 | + "out_port_name": "s3-eth3", |
| 169 | + "switch_id": "00:00:00:00:00:00:00:03" |
| 170 | + } |
| 171 | + ] |
| 172 | +} |
| 173 | +|=== |
0 commit comments