1 ==== How To Test Vlan-Map In Mininet Environment
4 This example explains how to test vlan-map in a multi host scenario.
6 .Example that demonstrates vlanmap testing in Mininet Environment
7 image::vtn/vlanmap_using_mininet.png[Example that demonstrates vlanmap testing in Mininet Environment]
10 * Save the mininet script given below as vlan_vtn_test.py and run the mininet script in the mininet environment where Mininet is installed.
14 https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:Mininet#Network_with_hosts_in_different_vlan
16 * Run the mininet script
19 sudo mn --controller=remote,ip=192.168.64.13 --custom vlan_vtn_test.py --topo mytopo
22 NOTE: Add the default flow to OVS to forward packets to controller when there is a table-miss:
25 ovs-ofctl --protocols=OpenFlow13 add-flow <switch-name> priority=0,actions=output:CONTROLLER
28 These flows need to be added only in case of OpenFlow1.3 or using OVS versions (>2.1.1).
30 Here the switch name is the switches in the topology such as s1,s2,s3.
34 Please follow the below steps to test a vlan map using mininet:
39 curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"controller": {"controller_id": "controllerone", "ipaddr":"10.0.0.2", "type": "odc", "version": "1.0", "auditstatus":"enable"}}' http://127.0.0.1:8083/vtn-webapi/controllers
45 curl -X POST -H 'content-type: application/json' -H 'username: admin' -H 'password: adminpass' -d '{"vtn" : {"vtn_name":"vtn1","description":"test VTN" }}' http://127.0.0.1:8083/vtn-webapi/vtns.json
48 * Create a vBridge(vBridge1)
51 curl -X POST -H 'content-type: application/json' -H 'username: admin' -H 'password: adminpass' -d '{"vbridge" : {"vbr_name":"vBridge1","controller_id":"controllerone","domain_id":"(DEFAULT)" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges.json
54 * Create a vlan map with vlanid 200 for vBridge vBridge1
57 curl -X POST -H 'content-type: application/json' -H 'username: admin' -H 'password: adminpass' -d '{"vlanmap" : {"vlan_id": 200 }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/vlanmaps.json
60 * Create a vBridge (vBridge2)
63 curl -X POST -H 'content-type: application/json' -H 'username: admin' -H 'password: adminpass' -d '{"vbridge" : {"vbr_name":"vBridge2","controller_id":"controllerone","domain_id":"(DEFAULT)" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges.json
66 * Create a vlan map with vlanid 300 for vBridge vBridge2
69 curl -X POST -H 'content-type: application/json' -H 'username: admin' -H 'password: adminpass' -d '{"vlanmap" : {"vlan_id": 300 }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge2/vlanmaps.json
74 Ping all in mininet environment to view the host reachability.
79 Ping: testing ping reachability