Migrate ALTO user docs to rst
[docs.git] / manuals / user-guide / src / main / asciidoc / vtn / VTN_How_To_configure_L2_Network_with_Single_Controller.adoc
1 ==== How to configure L2 Network with Single Controller
2
3 ===== Overview
4
5 This example provides the procedure to demonstrate configuration of VTN Coordinator with L2 network using VTN Virtualization(single controller). Here is the Example for vBridge Interface Mapping with Single Controller using mininet. mininet details and set-up can be referred at below URL:
6 https://wiki.opendaylight.org/view/OpenDaylight_Controller:Installation#Using_Mininet
7
8 .EXAMPLE DEMONSTRATING SINGLE CONTROLLER
9 image::vtn/vtn-single-controller-topology-example.png[EXAMPLE DEMONSTRATING SINGLE CONTROLLER]
10
11 ===== Requirements
12
13 * Configure mininet and create a topology:
14
15 ----
16 mininet@mininet-vm:~$ sudo mn --controller=remote,ip=<controller-ip> --topo tree,2
17 ----
18
19 * mininet> net
20
21 ----
22  s1 lo:  s1-eth1:h1-eth0 s1-eth2:s2-eth1
23  s2 lo:  s2-eth1:s1-eth2 s2-eth2:h2-eth0
24  h1 h1-eth0:s1-eth1
25  h2 h2-eth0:s2-eth2
26 ----
27
28 ===== Configuration
29
30 * Create a Controller named controllerone and mention its ip-address in the below create-controller command.
31
32 ----
33 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.json
34 ----
35
36 * Create a VTN named vtn1 by executing the create-vtn command
37 ----
38 curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"vtn" : {"vtn_name":"vtn1","description":"test VTN" }}' http://127.0.0.1:8083/vtn-webapi/vtns.json
39 ----
40
41 * Create a vBridge named vBridge1 in the vtn1 by executing the create-vbr command.
42
43 ----
44  curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"vbridge" : {"vbr_name":"vBridge1","controller_id":"controllerone","domain_id":"(DEFAULT)" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges.json
45 ----
46
47 * Create two Interfaces named if1 and if2 into the vBridge1
48
49
50 ----
51 curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"interface": {"if_name": "if1","description": "if_desc1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces.json
52 ----
53
54
55 ----
56 curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"interface": {"if_name": "if2","description": "if_desc2"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces.json
57 ----
58
59 * Get the list of logical ports configured
60
61 ----
62 Curl --user admin:adminpass -H 'content-type: application/json' -X GET http://127.0.0.1:8083/vtn-webapi/controllers/controllerone/domains/\(DEFAULT\)/logical_ports.json
63 ----
64 * Configure two mappings on each of the interfaces by executing the below command.
65
66 The interface if1 of the virtual bridge will be mapped to the port "s2-eth1" of the switch "openflow:2" of the Mininet.
67 The h1 is connected to the port "s2-eth1".
68
69 The interface if2 of the virtual bridge will be mapped to the port "s3-eth1" of the switch "openflow:3" of the Mininet.
70 The h3 is connected to the port "s3-eth1".
71
72 ----
73 curl --user admin:adminpass -H 'content-type: application/json' -X PUT -d '{"portmap":{"logical_port_id": "PP-OF:00:00:00:00:00:00:00:03-s3-eth1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces/if1/portmap.json
74 curl --user admin:adminpass -H 'content-type: application/json' -X PUT -d '{"portmap":{"logical_port_id": "PP-OF:00:00:00:00:00:00:00:02-s2-eth1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces/if2/portmap.json
75 ----
76
77 ===== Verification
78
79 Please verify whether the Host1 and Host3 are pinging.
80
81 * Send packets from Host1 to Host3
82
83 ----
84  mininet> h1 ping h3
85  PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
86  64 bytes from 10.0.0.3: icmp_req=1 ttl=64 time=0.780 ms
87  64 bytes from 10.0.0.3: icmp_req=2 ttl=64 time=0.079 ms
88 ----
89