VTN Beryllium - Adoc changes.
[docs.git] / manuals / user-guide / src / main / asciidoc / vtn / VTN_How_To_test_vlanmap_using_mininet.adoc
1 ==== How To Test Vlan-Map In Mininet Environment
2
3 ===== Overview
4 This example explains how to test vlan-map in a multi host scenario.
5
6 .Example that demonstrates vlanmap testing in Mininet Environment
7 image::vtn/vlanmap_using_mininet.png[Example that demonstrates vlanmap testing in Mininet Environment]
8
9 ===== Requirements
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.
11
12
13 ===== Mininet Script
14 https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:Mininet#Network_with_hosts_in_different_vlan
15
16 * Run the mininet script
17
18 ----
19 sudo mn --controller=remote,ip=192.168.64.13 --custom vlan_vtn_test.py --topo mytopo
20 ----
21
22 NOTE: Add the default flow to OVS to forward packets to controller when there is a table-miss:
23
24 ----
25 ovs-ofctl --protocols=OpenFlow13 add-flow <switch-name> priority=0,actions=output:CONTROLLER
26 ----
27
28 These flows need to be added only in case of OpenFlow1.3 or using OVS versions (>2.1.1).
29
30 Here the switch name is the switches in the topology such as s1,s2,s3.
31
32 ===== Configuration
33
34 Please follow the below steps to test a vlan map using mininet:
35
36 * Create a controller
37
38 ----
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
40 ----
41
42 * Create a VTN
43
44 ----
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
46 ----
47
48 * Create a vBridge(vBridge1)
49
50 ----
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
52 ----
53
54 * Create a vlan map with vlanid 200 for vBridge vBridge1
55
56 ----
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
58 ----
59
60 * Create a vBridge (vBridge2)
61
62 ----
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
64 ----
65
66 * Create a vlan map with vlanid 300 for vBridge vBridge2
67
68 ----
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
70 ----
71
72 ===== Verification
73
74 Ping all in mininet environment to view the host reachability.
75
76
77 ----
78 mininet> pingall
79 Ping: testing ping reachability
80 h1 -> X h3 X h5 X
81 h2 -> X X h4 X h6
82 h3 -> h1 X X h5 X
83 h4 -> X h2 X X h6
84 h5 -> h1 X h3 X X
85 h6 -> X h2 X h4 X
86 ----
87