1 ==== How to provision virtual L2 Network
5 This page explains how to provision virtual L2 network using VTN Manager. This page targets Beryllium release, so the procedure described here does not work in other releases.
7 .EXAMPLE DEMONSTRATING SINGLE CONTROLLER
8 image::vtn/vtn-single-controller-topology-example.png[EXAMPLE DEMONSTRATING SINGLE CONTROLLER]
14 * To provision OpenFlow switches, this page uses Mininet. Mininet details and set-up can be referred at the following page:
15 https://wiki.opendaylight.org/view/OpenDaylight_Controller:Installation#Using_Mininet
17 * Start Mininet and create three switches(s1, s2, and s3) and four hosts(h1, h2, h3, and h4) in it.
20 mininet@mininet-vm:~$ sudo mn --controller=remote,ip=192.168.0.100 --topo tree,2
24 Replace "192.168.0.100" with the IP address of OpenDaylight controller based on your environment.
26 * you can check the topology that you have created by executing "net" command in the Mininet console.
34 s1 lo: s1-eth1:s2-eth3 s1-eth2:s3-eth3
35 s2 lo: s2-eth1:h1-eth0 s2-eth2:h2-eth0 s2-eth3:s1-eth1
36 s3 lo: s3-eth1:h3-eth0 s3-eth2:h4-eth0 s3-eth3:s1-eth2
39 * In this guide, you will provision the virtual L2 network to establish communication between h1 and h3.
41 * You need to manually add flow entries to OpenFlow switches in the Mininet. The flow entries are needed to forward packets to controller when there is a table-miss. This configuration is required only in case of Openflow 1.3 or using OVS version(>2.1.1).
44 sudo ovs-ofctl add-flow s1 priority=0,actions=output:CONTROLLER
45 sudo ovs-ofctl add-flow s2 priority=0,actions=output:CONTROLLER
46 sudo ovs-ofctl add-flow s3 priority=0,actions=output:CONTROLLER
51 To provision the virtual L2 network for the two hosts (h1 and h3), execute REST API provided by VTN Manager as follows. It uses curl command to call the REST API.
53 * Create a virtual tenant named vtn1 by executing
54 https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#update-vtn[the update-vtn RPC].
57 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:update-vtn -d '{"input":{"tenant-name":"vtn1"}}'
60 * Create a virtual bridge named vbr1 in the tenant vtn1 by executing
61 https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge[the update-vbridge RPC].
64 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"}}'
67 * Create two interfaces into the virtual bridge by executing
68 https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface[the update-vinterface RPC].
71 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"}}'
76 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"}}'
79 * Configure two mappings on the created interfaces by executing
80 https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-port-map.html#set-port-map[the set-port-map RPC].
82 ** The interface if1 of the virtual bridge will be mapped to the port "s2-eth1" of the switch "openflow:2" of the Mininet.
83 *** The h1 is connected to the port "s2-eth1".
85 ** The interface if2 of the virtual bridge will be mapped to the port "s3-eth1" of the switch "openflow:3" of the Mininet.
86 *** The h3 is connected to the port "s3-eth1".
89 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:2", "port-name":"s2-eth1"}}'
94 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-eth1"}}'
99 * Please execute ping from h1 to h3 to verify if the virtual L2 network for h1 and h3 is provisioned successfully.
103 PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
104 64 bytes from 10.0.0.3: icmp_seq=1 ttl=64 time=243 ms
105 64 bytes from 10.0.0.3: icmp_seq=2 ttl=64 time=0.341 ms
106 64 bytes from 10.0.0.3: icmp_seq=3 ttl=64 time=0.078 ms
107 64 bytes from 10.0.0.3: icmp_seq=4 ttl=64 time=0.079 ms
110 * You can also verify the configuration by executing the following REST API. It shows all configuration in VTN Manager.
113 curl --user "admin":"admin" -H "Content-type: application/json" -X GET http://localhost:8181/restconf/operational/vtn:vtns/
116 * The result of the command should be like this.
141 "vinterface-status": {
142 "entity-state": "UP",
144 "mapped-port": "openflow:3:3"
146 "vinterface-config": {
151 "port-name": "s3-eth1",
157 "vinterface-status": {
158 "entity-state": "UP",
160 "mapped-port": "openflow:2:1"
162 "vinterface-config": {
167 "port-name": "s2-eth1",
182 * You can delete the virtual tenant vtn1 by executing
183 https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#remove-vtn[the remove-vtn RPC].
186 curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"vtn1"}}'