Merge "Remove TBD-only NEMO user docs"
[docs.git] / docs / user-guide / virtual-tenant-network-(vtn).rst
1 Virtual Tenant Network (VTN)
2 ============================
3
4 VTN Overview
5 ------------
6
7 OpenDaylight Virtual Tenant Network (VTN) is an application that
8 provides multi-tenant virtual network on an SDN controller.
9
10 Conventionally, huge investment in the network systems and operating
11 expenses are needed because the network is configured as a silo for each
12 department and system. So, various network appliances must be installed
13 for each tenant and those boxes cannot be shared with others. It is a
14 heavy work to design, implement and operate the entire complex network.
15
16 The uniqueness of VTN is a logical abstraction plane. This enables the
17 complete separation of logical plane from physical plane. Users can
18 design and deploy any desired network without knowing the physical
19 network topology or bandwidth restrictions.
20
21 VTN allows the users to define the network with a look and feel of
22 conventional L2/L3 network. Once the network is designed on VTN, it will
23 automatically be mapped into underlying physical network, and then
24 configured on the individual switch leveraging SDN control protocol. The
25 definition of logical plane makes it possible not only to hide the
26 complexity of the underlying network but also to better manage network
27 resources. It achieves reducing reconfiguration time of network services
28 and minimizing network configuration errors.
29
30 .. figure:: ./images/vtn/VTN_Overview.jpg
31    :alt: VTN Overview
32
33    VTN Overview
34
35 It is implemented as two major components
36
37 -  `VTN Manager <#_vtn_manager>`__
38
39 -  `VTN Coordinator <#_vtn_coordinator>`__
40
41 VTN Manager
42 ~~~~~~~~~~~
43
44 An OpenDaylight Plugin that interacts with other modules to implement
45 the components of the VTN model. It also provides a REST interface to
46 configure VTN components in OpenDaylight. VTN Manager is implemented as
47 one plugin to the OpenDaylight. This provides a REST interface to
48 create/update/delete VTN components. The user command in VTN Coordinator
49 is translated as REST API to VTN Manager by the OpenDaylight Driver
50 component. In addition to the above mentioned role, it also provides an
51 implementation to the OpenStack L2 Network Functions API.
52
53 Features Overview
54 ^^^^^^^^^^^^^^^^^
55
56 -  **odl-vtn-manager** provides VTN Manager’s JAVA API.
57
58 -  **odl-vtn-manager-rest** provides VTN Manager’s REST API.
59
60 -  **odl-vtn-manager-neutron** provides the integration with Neutron
61    interface.
62
63 REST API
64 ^^^^^^^^
65
66 VTN Manager provides REST API for virtual network functions.
67
68 Here is an example of how to create a virtual tenant network.
69
70 ::
71
72      curl --user "admin":"admin" -H "Accept: application/json" -H \
73      "Content-type: application/json" -X POST \
74      http://localhost:8181/restconf/operations/vtn:update-vtn \
75      -d '{"input":{"tenant-name":"vtn1"}}'
76
77 You can check the list of all tenants by executing the following
78 command.
79
80 ::
81
82      curl --user "admin":"admin" -H "Accept: application/json" -H \
83      "Content-type: application/json" -X GET \
84      http://localhost:8181/restconf/operational/vtn:vtns
85
86 REST API documentation for VTN Manager, please refer to:
87 https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/
88
89 VTN Coordinator
90 ~~~~~~~~~~~~~~~
91
92 The VTN Coordinator is an external application that provides a REST
93 interface for an user to use OpenDaylight VTN Virtualization. It
94 interacts with VTN Manager plugin to implement the user configuration.
95 It is also capable of multiple OpenDaylight orchestration. It realizes
96 Virtual Tenant Network (VTN) provisioning in OpenDaylight instances. In
97 the OpenDaylight architecture VTN Coordinator is part of the network
98 application, orchestration and services layer. VTN Coordinator will use
99 the REST interface exposed by the VTN Manger to realize the virtual
100 network using OpenDaylight. It uses OpenDaylight APIs (REST) to
101 construct the virtual network in OpenDaylight instances. It provides
102 REST APIs for northbound VTN applications and supports virtual networks
103 spanning across multiple OpenDaylight by coordinating across
104 OpenDaylight.
105
106 For VTN Coordinator REST API, please refer to:
107 https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_%28VTN%29:VTN_Coordinator:RestApi
108
109 Network Virtualization Function
110 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111
112 The user first defines a VTN. Then, the user maps the VTN to a physical
113 network, which enables communication to take place according to the VTN
114 definition. With the VTN definition, L2 and L3 transfer functions and
115 flow-based traffic control functions (filtering and redirect) are
116 possible.
117
118 Virtual Network Construction
119 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
120
121 The following table shows the elements which make up the VTN. In the
122 VTN, a virtual network is constructed using virtual nodes (vBridge,
123 vRouter) and virtual interfaces and links. It is possible to configure a
124 network which has L2 and L3 transfer function, by connecting the virtual
125 intrefaces made on virtual nodes via virtual links.
126
127 +--------------------------------------+--------------------------------------+
128 | vBridge                              | The logical representation of L2     |
129 |                                      | switch function.                     |
130 +--------------------------------------+--------------------------------------+
131 | vRouter                              | The logical representation of router |
132 |                                      | function.                            |
133 +--------------------------------------+--------------------------------------+
134 | vTep                                 | The logical representation of Tunnel |
135 |                                      | End Point - TEP.                     |
136 +--------------------------------------+--------------------------------------+
137 | vTunnel                              | The logical representation of        |
138 |                                      | Tunnel.                              |
139 +--------------------------------------+--------------------------------------+
140 | vBypass                              | The logical representation of        |
141 |                                      | connectivity between controlled      |
142 |                                      | networks.                            |
143 +--------------------------------------+--------------------------------------+
144 | Virtual interface                    | The representation of end point on   |
145 |                                      | the virtual node.                    |
146 +--------------------------------------+--------------------------------------+
147 | Virtual Linkv(vLink)                 | The logical representation of L1     |
148 |                                      | connectivity between virtual         |
149 |                                      | interfaces.                          |
150 +--------------------------------------+--------------------------------------+
151
152 The following figure shows an example of a constructed virtual network.
153 VRT is defined as the vRouter, BR1 and BR2 are defined as vBridges.
154 interfaces of the vRouter and vBridges are connected using vLinks.
155
156 .. figure:: ./images/vtn/VTN_Construction.jpg
157    :alt: VTN Construction
158
159    VTN Construction
160
161 Mapping of Physical Network Resources
162 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163
164 Map physical network resources to the constructed virtual network.
165 Mapping identifies which virtual network each packet transmitted or
166 received by an OpenFlow switch belongs to, as well as which interface in
167 the OpenFlow switch transmits or receives that packet. There are two
168 mapping methods. When a packet is received from the OFS, port mapping is
169 first searched for the corresponding mapping definition, then VLAN
170 mapping is searched, and the packet is mapped to the relevant vBridge
171 according to the first matching mapping.
172
173 +--------------------------------------+--------------------------------------+
174 | Port mapping                         | Maps physical network resources to   |
175 |                                      | an interface of vBridge using Switch |
176 |                                      | ID, Port ID and VLAN ID of the       |
177 |                                      | incoming L2 frame. Untagged frame    |
178 |                                      | mapping is also supported.           |
179 +--------------------------------------+--------------------------------------+
180 | VLAN mapping                         | Maps physical network resources to a |
181 |                                      | vBridge using VLAN ID of the         |
182 |                                      | incoming L2 frame.Maps physical      |
183 |                                      | resources of a particular switch to  |
184 |                                      | a vBridge using switch ID and VLAN   |
185 |                                      | ID of the incoming L2 frame.         |
186 +--------------------------------------+--------------------------------------+
187 | MAC mapping                          | Maps physical resources to an        |
188 |                                      | interface of vBridge using MAC       |
189 |                                      | address of the incoming L2 frame(The |
190 |                                      | initial contribution does not        |
191 |                                      | include this method).                |
192 +--------------------------------------+--------------------------------------+
193
194 VTN can learn the terminal information from a terminal that is connected
195 to a switch which is mapped to VTN. Further, it is possible to refer
196 that terminal information on the VTN.
197
198 -  Learning terminal information VTN learns the information of a
199    terminal that belongs to VTN. It will store the MAC address and VLAN
200    ID of the terminal in relation to the port of the switch.
201
202 -  Aging of terminal information Terminal information, learned by the
203    VTN, will be maintained until the packets from terminal keep flowing
204    in VTN. If the terminal gets disconnected from the VTN, then the
205    aging timer will start clicking and the terminal information will be
206    maintained till timeout.
207
208 The following figure shows an example of mapping. An interface of BR1 is
209 mapped to port GBE0/1 of OFS1 using port mapping. Packets received from
210 GBE0/1 of OFS1 are regarded as those from the corresponding interface of
211 BR1. BR2 is mapped to VLAN 200 using VLAN mapping. Packets with VLAN tag
212 200 received from any ports of any OFSs are regarded as those from an
213 interface of BR2.
214
215 .. figure:: ./images/vtn/VTN_Mapping.jpg
216    :alt: VTN Mapping
217
218    VTN Mapping
219
220 vBridge Functions
221 ~~~~~~~~~~~~~~~~~
222
223 The vBridge provides the bridge function that transfers a packet to the
224 intended virtual port according to the destination MAC address. The
225 vBridge looks up the MAC address table and transmits the packet to the
226 corresponding virtual interface when the destination MAC address has
227 been learned. When the destination MAC address has not been learned, it
228 transmits the packet to all virtual interfaces other than the receiving
229 port (flooding). MAC addresses are learned as follows.
230
231 -  MAC address learning The vBridge learns the MAC address of the
232    connected host. The source MAC address of each received frame is
233    mapped to the receiving virtual interface, and this MAC address is
234    stored in the MAC address table created on a per-vBridge basis.
235
236 -  MAC address aging The MAC address stored in the MAC address table is
237    retained as long as the host returns the ARP reply. After the host is
238    disconnected, the address is retained until the aging timer times
239    out. To have the vBridge learn MAC addresses statically, you can
240    register MAC addresses manually.
241
242 vRouter Functions
243 ~~~~~~~~~~~~~~~~~
244
245 The vRouter transfers IPv4 packets between vBridges. The vRouter
246 supports routing, ARP learning, and ARP aging functions. The following
247 outlines the functions.
248
249 -  Routing function When an IP address is registered with a virtual
250    interface of the vRouter, the default routing information for that
251    interface is registered. It is also possible to statically register
252    routing information for a virtual interface.
253
254 -  ARP learning function The vRouter associates a destination IP
255    address, MAC address and a virtual interface, based on an ARP request
256    to its host or a reply packet for an ARP request, and maintains this
257    information in an ARP table prepared for each routing domain. The
258    registered ARP entry is retained until the aging timer, described
259    later, times out. The vRouter transmits an ARP request on an
260    individual aging timer basis and deletes the associated entry from
261    the ARP table if no reply is returned. For static ARP learning, you
262    can register ARP entry information manually.
263
264 -  DHCP relay agent function The vRouter also provides the DHCP relay
265    agent function.
266
267 Flow Filter Functions
268 ~~~~~~~~~~~~~~~~~~~~~
269
270 Flow Filter function is similar to ACL. It is possible to allow or
271 prohibit communication with only certain kind of packets that meet a
272 particular condition. Also, it can perform a processing called
273 Redirection - WayPoint routing, which is different from the existing
274 ACL. Flow Filter can be applied to any interface of a vNode within VTN,
275 and it is possible to the control the packets that pass interface. The
276 match conditions that could be specified in Flow Filter are as follows.
277 It is also possible to specify a combination of multiple conditions.
278
279 -  Source MAC address
280
281 -  Destination MAC address
282
283 -  MAC ether type
284
285 -  VLAN Priority
286
287 -  Source IP address
288
289 -  Destination IP address
290
291 -  DSCP
292
293 -  IP Protocol
294
295 -  TCP/UDP source port
296
297 -  TCP/UDP destination port
298
299 -  ICMP type
300
301 -  ICMP code
302
303 The types of Action that can be applied on packets that match the Flow
304 Filter conditions are given in the following table. It is possible to
305 make only those packets, which match a particular condition, to pass
306 through a particular server by specifying Redirection in Action. E.g.,
307 path of flow can be changed for each packet sent from a particular
308 terminal, depending upon the destination IP address. VLAN priority
309 control and DSCP marking are also supported.
310
311 +--------------------------------------+--------------------------------------+
312 | Action                               | Function                             |
313 +--------------------------------------+--------------------------------------+
314 | Pass                                 | Pass particular packets matching the |
315 |                                      | specified conditions.                |
316 +--------------------------------------+--------------------------------------+
317 | Drop                                 | Discards particular packets matching |
318 |                                      | the specified conditions.            |
319 +--------------------------------------+--------------------------------------+
320 | Redirection                          | Redirects the packet to a desired    |
321 |                                      | virtual interface. Both Transparent  |
322 |                                      | Redirection (not changing MAC        |
323 |                                      | address) and Router Redirection      |
324 |                                      | (changing MAC address) are           |
325 |                                      | supported.                           |
326 +--------------------------------------+--------------------------------------+
327
328 The following figure shows an example of how the flow filter function
329 works.
330
331 If there is any matching condition specified by flow filter when a
332 packet being transferred within a virtual network goes through a virtual
333 interface, the function evaluates the matching condition to see whether
334 the packet matches it. If the packet matches the condition, the function
335 applies the matching action specified by flow filter. In the example
336 shown in the figure, the function evaluates the matching condition at
337 BR1 and discards the packet if it matches the condition.
338
339 .. figure:: ./images/vtn/VTN_Flow_Filter.jpg
340    :alt: VTN FlowFilter
341
342    VTN FlowFilter
343
344 Multiple SDN Controller Coordination
345 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346
347 With the network abstractions, VTN enables to configure virtual network
348 across multiple SDN controllers. This provides highly scalable network
349 system.
350
351 VTN can be created on each SDN controller. If users would like to manage
352 those multiple VTNs with one policy, those VTNs can be integrated to a
353 single VTN.
354
355 As a use case, this feature is deployed to multi data center
356 environment. Even if those data centers are geographically separated and
357 controlled with different controllers, a single policy virtual network
358 can be realized with VTN.
359
360 Also, one can easily add a new SDN Controller to an existing VTN or
361 delete a particular SDN Controller from VTN.
362
363 In addition to this, one can define a VTN which covers both OpenFlow
364 network and Overlay network at the same time.
365
366 Flow Filter, which is set on the VTN, will be automatically applied on
367 the newly added SDN Controller.
368
369 Coordination between OpenFlow Network and L2/L3 Network
370 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
371
372 It is possible to configure VTN on an environment where there is mix of
373 L2/L3 switches as well. L2/L3 switch will be shown on VTN as vBypass.
374 Flow Filter or policing cannot be configured for a vBypass. However, it
375 is possible to treat it as a virtual node inside VTN.
376
377 Virtual Tenant Network (VTN) API
378 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
379
380 VTN provides Web APIs. They are implemented by REST architecture and
381 provide the access to resources within VTN that are identified by URI.
382 User can perform the operations like GET/PUT/POST/DELETE against the
383 virtual network resources (e.g. vBridge or vRouter) by sending a message
384 to VTN through HTTPS communication in XML or JSON format.
385
386 .. figure:: ./images/vtn/VTN_API.jpg
387    :alt: VTN API
388
389    VTN API
390
391 Function Outline
392 ^^^^^^^^^^^^^^^^
393
394 VTN provides following operations for various network resources.
395
396 +----------------+----------------+----------------+----------------+----------------+
397 | Resources      | GET            | POST           | PUT            | DELETE         |
398 +----------------+----------------+----------------+----------------+----------------+
399 | VTN            | Yes            | Yes            | Yes            | Yes            |
400 +----------------+----------------+----------------+----------------+----------------+
401 | vBridge        | Yes            | Yes            | Yes            | Yes            |
402 +----------------+----------------+----------------+----------------+----------------+
403 | vRouter        | Yes            | Yes            | Yes            | Yes            |
404 +----------------+----------------+----------------+----------------+----------------+
405 | vTep           | Yes            | Yes            | Yes            | Yes            |
406 +----------------+----------------+----------------+----------------+----------------+
407 | vTunnel        | Yes            | Yes            | Yes            | Yes            |
408 +----------------+----------------+----------------+----------------+----------------+
409 | vBypass        | Yes            | Yes            | Yes            | Yes            |
410 +----------------+----------------+----------------+----------------+----------------+
411 | vLink          | Yes            | Yes            | Yes            | Yes            |
412 +----------------+----------------+----------------+----------------+----------------+
413 | Interface      | Yes            | Yes            | Yes            | Yes            |
414 +----------------+----------------+----------------+----------------+----------------+
415 | Port map       | Yes            | No             | Yes            | Yes            |
416 +----------------+----------------+----------------+----------------+----------------+
417 | Vlan map       | Yes            | Yes            | Yes            | Yes            |
418 +----------------+----------------+----------------+----------------+----------------+
419 | Flowfilter     | Yes            | Yes            | Yes            | Yes            |
420 | (ACL/redirect) |                |                |                |                |
421 +----------------+----------------+----------------+----------------+----------------+
422 | Controller     | Yes            | Yes            | Yes            | Yes            |
423 | information    |                |                |                |                |
424 +----------------+----------------+----------------+----------------+----------------+
425 | Physical       | Yes            | No             | No             | No             |
426 | topology       |                |                |                |                |
427 | information    |                |                |                |                |
428 +----------------+----------------+----------------+----------------+----------------+
429 | Alarm          | Yes            | No             | No             | No             |
430 | information    |                |                |                |                |
431 +----------------+----------------+----------------+----------------+----------------+
432
433 Example usage
434 ^^^^^^^^^^^^^
435
436 The following is an example of the usage to construct a virtual network.
437
438 -  Create VTN
439
440 ::
441
442        curl --user admin:adminpass -X POST -H 'content-type: application/json'  \
443       -d '{"vtn":{"vtn_name":"VTN1"}}' http://172.1.0.1:8083/vtn-webapi/vtns.json
444
445 -  Create Controller Information
446
447 ::
448
449        curl --user admin:adminpass -X POST -H 'content-type: application/json'  \
450       -d '{"controller": {"controller_id":"CONTROLLER1","ipaddr":"172.1.0.1","type":"odc","username":"admin", \
451       "password":"admin","version":"1.0"}}' http://172.1.0.1:8083/vtn-webapi/controllers.json
452
453 -  Create vBridge under VTN
454
455 ::
456
457       curl --user admin:adminpass -X POST -H 'content-type: application/json' \
458       -d '{"vbridge":{"vbr_name":"VBR1","controller_id": "CONTROLLER1","domain_id": "(DEFAULT)"}}' \
459       http://172.1.0.1:8083/vtn-webapi/vtns/VTN1/vbridges.json
460
461 -  Create the interface under vBridge
462
463 ::
464
465       curl --user admin:adminpass -X POST -H 'content-type: application/json' \
466       -d '{"interface":{"if_name":"IF1"}}' http://172.1.0.1:8083/vtn-webapi/vtns/VTN1/vbridges/VBR1/interfaces.json
467
468 VTN OpenStack Configuration
469 ---------------------------
470
471 This guide describes how to set up OpenStack for integration with
472 OpenDaylight Controller.
473
474 While OpenDaylight Controller provides several ways to integrate with
475 OpenStack, this guide focus on the way which uses VTN features available
476 on OpenDaylight. In the integration, VTN Manager work as network service
477 provider for OpenStack.
478
479 VTN Manager features, enable OpenStack to work in pure OpenFlow
480 environment in which all switches in data plane are OpenFlow switch.
481
482 Requirements
483 ~~~~~~~~~~~~
484
485 -  OpenDaylight Controller. (VTN features must be installed)
486
487 -  OpenStack Control Node.
488
489 -  OpenStack Compute Node.
490
491 -  OpenFlow Switch like mininet(Not Mandatory).
492
493 The VTN features support multiple OpenStack nodes. You can deploy
494 multiple OpenStack Compute Nodes. In management plane, OpenDaylight
495 Controller, OpenStack nodes and OpenFlow switches should communicate
496 with each other. In data plane, Open vSwitches running in OpenStack
497 nodes should communicate with each other through a physical or logical
498 OpenFlow switches. The core OpenFlow switches are not mandatory.
499 Therefore, you can directly connect to the Open vSwitch’s.
500
501 .. figure:: ./images/vtn/OpenStack_Demo_Picture.png
502    :alt: Openstack Overview
503
504    Openstack Overview
505
506 Sample Configuration
507 ~~~~~~~~~~~~~~~~~~~~
508
509 Below steps depicts the configuration of single OpenStack Control node
510 and OpenStack Compute node setup. Our test setup is as follows
511
512 .. figure:: ./images/vtn/vtn_devstack_setup.png
513    :alt: LAB Setup
514
515    LAB Setup
516
517 **Server Preparation**
518
519 -  Install Ubuntu 14.04 LTS in two servers (OpenStack Control node and
520    Compute node respectively)
521
522 -  While installing, Ubuntu mandates creation of a User, we created the
523    user "stack"(We will use the same user for running devstack)
524
525 -  Proceed with the below mentioned User Settings and Network Settings
526    in both the Control and Compute nodes.
527
528 **User Settings for devstack** - Login to both servers - Disable Ubuntu
529 Firewall
530
531 ::
532
533     sudo ufw disable
534
535 -  Install the below packages (optional, provides ifconfig and route
536    coammnds, handy for debugging!!)
537
538    ::
539
540        sudo apt-get install net-tools
541
542 -  Edit sudo vim /etc/sudoers and add an entry as follows
543
544    ::
545
546        stack ALL=(ALL) NOPASSWD: ALL
547
548 **Network Settings** - Checked the output of ifconfig -a, two interfaces
549 were listed eth0 and eth1 as indicated in the image above. - We had
550 connected eth0 interface to the Network where OpenDaylight is reachable.
551 - eth1 interface in both servers were connected to a different network
552 to act as data plane for the VM’s created using the OpenStack. -
553 Manually edited the file : sudo vim /etc/network/interfaces and made
554 entries as follows
555
556 ::
557
558      stack@ubuntu-devstack:~/devstack$ cat /etc/network/interfaces
559      # This file describes the network interfaces available on your system
560      # and how to activate them. For more information, see interfaces(5).
561      # The loop-back network interface
562      auto lo
563      iface lo inet loopback
564      # The primary network interface
565      auto eth0
566      iface eth0 inet static
567           address <IP_ADDRESS_TO_REACH_ODL>
568           netmask <NET_MASK>
569           broadcast <BROADCAST_IP_ADDRESS>
570           gateway <GATEWAY_IP_ADDRESS>
571     auto eth1
572     iface eth1 inet static
573          address <IP_ADDRESS_UNIQ>
574          netmask <NETMASK>
575
576 .. note::
577
578     Please ensure that the eth0 interface is the default route and it is
579     able to reach the ODL\_IP\_ADDRESS NOTE: The entries for eth1 are
580     not mandatory, If not set, we may have to manually do "ifup eth1"
581     after the stacking is complete to activate the interface
582
583 **Finalize the user and network settings** - Please reboot both nodes
584 after the user and network settings to have the network settings applied
585 to the network - Login again and check the output of ifconfig to ensure
586 that both interfaces are listed
587
588 OpenDaylight Settings and Execution
589 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
590
591 VTN Configuration for OpenStack Integration:
592 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
593
594 -  VTN uses the configuration parameters from "90-vtn-neutron.xml" file
595    for the OpenStack integration.
596
597 -  These values will be set for the OpenvSwitch, in all the
598    participating OpenStack nodes.
599
600 -  A configuration file "90-vtn-neutron.xml" will be generated
601    automatically by following the below steps,
602
603 -  Download the latest Beryllium karaf distribution from the below link,
604
605    ::
606
607        http://www.opendaylight.org/software/downloads
608
609 -  cd "distribution-karaf-0.4.0-Beryllium" and run karaf by using the
610    following command "./bin/karaf".
611
612 -  Install the below feature to generate "90-vtn-neutron.xml"
613
614 ::
615
616      feature:install odl-vtn-manager-neutron
617
618 -  Logout from the karaf console and Check "90-vtn-neutron.xml" file
619    from the following path
620    "distribution-karaf-0.4.0-Beryllium/etc/opendaylight/karaf/".
621
622 -  The contents of "90-vtn-neutron.xml" should be as follows:
623
624 bridgename=br-int portname=eth1 protocols=OpenFlow13 failmode=secure
625
626 -  The values of the configuration parameters must be changed based on
627    the user environment.
628
629 -  Especially, "portname" should be carefully configured, because if the
630    value is wrong, OpenDaylight fails to forward packets.
631
632 -  Other parameters works fine as is for general use cases.
633
634    -  bridgename
635
636       -  The name of the bridge in Open vSwitch, that will be created by
637          OpenDaylight Controller.
638
639       -  It must be "br-int".
640
641    -  portname
642
643       -  The name of the port that will be created in the vbridge in
644          Open vSwitch.
645
646       -  This must be the same name of the interface of OpenStack Nodes
647          which is used for interconnecting OpenStack Nodes in data
648          plane.(in our case:eth1)
649
650       -  By default, if 90-vtn-neutron.xml is not created, VTN uses
651          ens33 as portname.
652
653    -  protocols
654
655       -  OpenFlow protocol through which OpenFlow Switch and Controller
656          communicate.
657
658       -  The values can be OpenFlow13 or OpenFlow10.
659
660    -  failmode
661
662       -  The value can be "standalone" or "secure".
663
664       -  Please use "secure" for general use cases.
665
666 Start ODL Controller
667 ^^^^^^^^^^^^^^^^^^^^
668
669 -  Please refer to the Installation Pages to run ODL with VTN Feature
670    enabled.
671
672 -  After running ODL Controller, please ensure ODL Controller listens to
673    the ports:6633,6653, 6640 and 8080
674
675 -  Please allow the ports in firewall for the devstack to be able to
676    communicate with ODL Controller.
677
678 .. note::
679
680     -  6633/6653 - OpenFlow Ports
681
682     -  6640 - OVS Manager Port
683
684     -  8080 - Port for REST API
685
686 Devstack Setup
687 ~~~~~~~~~~~~~~
688
689 Get Devstack (All nodes)
690 ^^^^^^^^^^^^^^^^^^^^^^^^
691
692 -  Install git application using
693
694    -  sudo apt-get install git
695
696 -  Get devstack
697
698    -  git clone https://git.openstack.org/openstack-dev/devstack;
699
700 -  Switch to stable/Juno Version branch
701
702    -  cd devstack
703
704       ::
705
706           git checkout stable/juno
707
708 .. note::
709
710     If you want to use stable/kilo Version branch, Please execute the
711     below command in devstack folder
712
713 ::
714
715     git checkout stable/kilo
716
717 .. note::
718
719     If you want to use stable/liberty Version branch, Please execute the
720     below command in devstack folder
721
722 ::
723
724     git checkout stable/liberty
725
726 Stack Control Node
727 ^^^^^^^^^^^^^^^^^^
728
729 -  local.conf:
730
731 -  cd devstack in the controller node
732
733 -  Copy the contents of local.conf for juno (devstack control node) from
734    https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:devstack
735    and save it as "local.conf" in the "devstack".
736
737 -  Copy the contents of local.conf for kilo and liberty (devstack
738    control node) from
739    https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:devstack_post_juno_versions
740    and save it as "local.conf" in the "devstack".
741
742 -  Please modify the IP Address values as required.
743
744 -  Stack the node
745
746    ::
747
748        ./stack.sh
749
750 Verify Control Node stacking
751 ''''''''''''''''''''''''''''
752
753 -  stack.sh prints out Horizon is now available at
754    `http://<CONTROL\_NODE\_IP\_ADDRESS>:8080/ <http://<CONTROL_NODE_IP_ADDRESS>:8080/>`__
755
756 -  Execute the command *sudo ovs-vsctl show* in the control node
757    terminal and verify if the bridge *br-int* is created.
758
759 -  Typical output of the ovs-vsctl show is indicated below:
760
761 ::
762
763     e232bbd5-096b-48a3-a28d-ce4a492d4b4f
764        Manager "tcp:192.168.64.73:6640"
765            is_connected: true
766        Bridge br-int
767            Controller "tcp:192.168.64.73:6633"
768                is_connected: true
769            fail_mode: secure
770            Port "eth1"
771               Interface "eth1"
772        ovs_version: "2.0.2"
773
774 Stack Compute Node
775 ^^^^^^^^^^^^^^^^^^
776
777 -  local.conf:
778
779 -  cd devstack in the controller node
780
781 -  Copy the contents of local.conf for juno (devstack compute node) from
782    https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:devstack
783    and save it as "local.conf" in the "devstack".
784
785 -  Copy the contents of local.conf file for kilo and liberty (devstack
786    compute node) from
787    https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:devstack_post_juno_versions
788    and save it as "local.conf" in the "devstack".
789
790 -  Please modify the IP Address values as required.
791
792 -  Stack the node
793
794    ::
795
796        ./stack.sh
797
798 Verify Compute Node Stacking
799 ''''''''''''''''''''''''''''
800
801 -  stack.sh prints out This is your host ip:
802    <COMPUTE\_NODE\_IP\_ADDRESS>
803
804 -  Execute the command *sudo ovs-vsctl show* in the control node
805    terminal and verify if the bridge *br-int* is created.
806
807 -  The output of the ovs-vsctl show will be similar to the one seen in
808    control node.
809
810 Additional Verifications
811 ^^^^^^^^^^^^^^^^^^^^^^^^
812
813 -  Please visit the OpenDaylight DLUX GUI after stacking all the nodes,
814    `http://<ODL\_IP\_ADDRESS>:8181/index.html <http://<ODL_IP_ADDRESS>:8181/index.html>`__.
815    The switches, topology and the ports that are currently read can be
816    validated.
817
818 ::
819
820     http://<controller-ip>:8181/index.html
821
822     **Tip**
823
824     If the interconnected between the Open vSwitch is not seen, Please
825     bring up the interface for the dataplane manually using the below
826     comamnd
827
828 ::
829
830     ifup <interface_name>
831
832 -  Please Accept Promiscuous mode in the networks involving the
833    interconnect.
834
835 Create VM from Devstack Horizon GUI
836 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
837
838 -  Login to
839    `http://<CONTROL\_NODE\_IP>:8080/ <http://<CONTROL_NODE_IP>:8080/>`__
840    to check the horizon GUI.
841
842 .. figure:: ./images/vtn/OpenStackGui.png
843    :alt: Horizon GUI
844
845    Horizon GUI
846
847 Enter the value for User Name as admin and enter the value for Password
848 as labstack.
849
850 -  We should first ensure both the hypervisors(control node and compute
851    node) are mapped under hypervisors by clicking on Hpervisors tab.
852
853 .. figure:: ./images/vtn/Hypervisors.png
854    :alt: Hypervisors
855
856    Hypervisors
857
858 -  Create a new Network from Horizon GUI.
859
860 -  Click on Networks Tab.
861
862 -  click on the Create Network button.
863
864 .. figure:: ./images/vtn/Create_Network.png
865    :alt: Create Network
866
867    Create Network
868
869 -  A popup screen will appear.
870
871 -  Enter network name and click Next button.
872
873 .. figure:: ./images/vtn/Creare_Network_Step_1.png
874    :alt: Step 1
875
876    Step 1
877
878 -  Create a sub network by giving Network Address and click Next button
879    .
880
881 .. figure:: ./images/vtn/Create_Network_Step_2.png
882    :alt: Step 2
883
884    Step 2
885
886 -  Specify the additional details for subnetwork (please refer the image
887    for your reference).
888
889 .. figure:: ./images/vtn/Create_Network_Step_3.png
890    :alt: Step 3
891
892    Step 3
893
894 -  Click Create button
895
896 -  Create VM Instance
897
898 -  Navigate to Instances tab in the GUI.
899
900 .. figure:: ./images/vtn/Instance_Creation.png
901    :alt: Instance Creation
902
903    Instance Creation
904
905 -  Click on Launch Instances button.
906
907 .. figure:: ./images/vtn/Launch_Instance.png
908    :alt: Launch Instance
909
910    Launch Instance
911
912 -  Click on Details tab to enter the VM details.For this demo we are
913    creating Ten VM’s(instances).
914
915 -  In the Networking tab, we must select the network,for this we need to
916    drag and drop the Available networks to Selected Networks (i.e.,)
917    Drag vtn1 we created from Available networks to Selected Networks and
918    click Launch to create the instances.
919
920 .. figure:: ./images/vtn/Launch_Instance_network.png
921    :alt: Launch Network
922
923    Launch Network
924
925 -  Ten VM’s will be created.
926
927 .. figure:: ./images/vtn/Load_All_Instances.png
928    :alt: Load All Instances
929
930    Load All Instances
931
932 -  Click on any VM displayed in the Instances tab and click the Console
933    tab.
934
935 .. figure:: ./images/vtn/Instance_Console.png
936    :alt: Instance Console
937
938    Instance Console
939
940 -  Login to the VM console and verify with a ping command.
941
942 .. figure:: ./images/vtn/Instance_ping.png
943    :alt: Ping
944
945    Ping
946
947 Verification of Control and Compute Node after VM creation
948 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
949
950 -  Every time a new VM is created, more interfaces are added to the
951    br-int bridge in Open vSwitch.
952
953 -  Use *sudo ovs-vsctl show* to list the number of interfaces added.
954
955 -  Please visit the DLUX GUI to list the new nodes in every switch.
956
957 Getting started with DLUX
958 ^^^^^^^^^^^^^^^^^^^^^^^^^
959
960 Ensure that you have created a topology and enabled MD-SAL feature in
961 the Karaf distribution before you use DLUX for network management.
962
963 Logging In
964 ^^^^^^^^^^
965
966 To log in to DLUX, after installing the application: \* Open a browser
967 and enter the login URL. If you have installed DLUX as a stand-alone,
968 then the login URL is http://localhost:9000/DLUX/index.html. However if
969 you have deployed DLUX with Karaf, then the login URL is
970 `http://\\<your <http://\<your>`__ IP\\>:8181/dlux/index.html. \* Login
971 to the application with user ID and password credentials as admin.
972 NOTE:admin is the only user type available for DLUX in this release.
973
974 Working with DLUX
975 ^^^^^^^^^^^^^^^^^
976
977 To get a complete DLUX feature list, install restconf, odl l2 switch,
978 and switch while you start the DLUX distribution.
979
980 .. figure:: ./images/vtn/Dlux_login.png
981    :alt: DLUX\_GUI
982
983    DLUX\_GUI
984
985 .. note::
986
987     DLUX enables only those modules, whose APIs are responding. If you
988     enable just the MD-SAL in beginning and then start dlux, only MD-SAL
989     related tabs will be visible. While using the GUI if you enable
990     AD-SAL karaf features, those tabs will appear automatically.
991
992 Viewing Network Statistics
993 ^^^^^^^^^^^^^^^^^^^^^^^^^^
994
995 The Nodes module on the left pane enables you to view the network
996 statistics and port information for the switches in the network. \* To
997 use the Nodes module: \*\* Select Nodeson the left pane.
998
999 ::
1000
1001     The right pane displays atable that lists all the nodes, node connectors and the statistics.
1002
1003 -  Enter a node ID in the Search Nodes tab to search by node connectors.
1004
1005 -  Click on the Node Connector number to view details such as port ID,
1006    port name, number of ports per switch, MAC Address, and so on.
1007
1008 -  Click Flows in the Statistics column to view Flow Table Statistics
1009    for the particular node like table ID, packet match, active flows and
1010    so on.
1011
1012 -  Click Node Connectors to view Node Connector Statistics for the
1013    particular node ID.
1014
1015 Viewing Network Topology
1016 ^^^^^^^^^^^^^^^^^^^^^^^^
1017
1018 To view network topology: \* Select Topology on the left pane. You will
1019 view the graphical representation on the right pane.
1020
1021 ::
1022
1023     In the diagram
1024     blue boxes represent the switches,black represents the hosts available, and lines represents how switches are connected.
1025
1026 .. note::
1027
1028     DLUX UI does not provide ability to add topology information. The
1029     Topology should be created using an open flow plugin. Controller
1030     stores this information in the database and displays on the DLUX
1031     page, when the you connect to the controller using openflow.
1032
1033 .. figure:: ./images/vtn/Dlux_topology.png
1034    :alt: Topology
1035
1036    Topology
1037
1038 OpenStack PackStack Installation Steps
1039 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1040
1041 -  Please go through the below wiki page for OpenStack PackStack
1042    installation steps.
1043
1044    -  https://wiki.opendaylight.org/view/Release/Lithium/VTN/User_Guide/Openstack_Packstack_Support
1045
1046 References
1047 ~~~~~~~~~~
1048
1049 -  http://devstack.org/guides/multinode-lab.html
1050
1051 -  https://wiki.opendaylight.org/view/File:Vtn_demo_hackfest_2014_march.pdf
1052
1053 VTN Manager Usage Examples
1054 --------------------------
1055
1056 How to provision virtual L2 Network
1057 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1058
1059 Overview
1060 ^^^^^^^^
1061
1062 This page explains how to provision virtual L2 network using VTN
1063 Manager. This page targets Beryllium release, so the procedure described
1064 here does not work in other releases.
1065
1066 .. figure:: ./images/vtn/How_to_provision_virtual_L2_network.png
1067    :alt: Virtual L2 network for host1 and host3
1068
1069    Virtual L2 network for host1 and host3
1070
1071 Requirements
1072 ^^^^^^^^^^^^
1073
1074 Mininet
1075 '''''''
1076
1077 -  To provision OpenFlow switches, this page uses Mininet. Mininet
1078    details and set-up can be referred at the following page:
1079    https://wiki.opendaylight.org/view/OpenDaylight_Controller:Installation#Using_Mininet
1080
1081 -  Start Mininet and create three switches(s1, s2, and s3) and four
1082    hosts(h1, h2, h3, and h4) in it.
1083
1084 ::
1085
1086      mininet@mininet-vm:~$ sudo mn --controller=remote,ip=192.168.0.100 --topo tree,2
1087
1088 .. note::
1089
1090     Replace "192.168.0.100" with the IP address of OpenDaylight
1091     controller based on your environment.
1092
1093 -  you can check the topology that you have created by executing "net"
1094    command in the Mininet console.
1095
1096 ::
1097
1098      mininet> net
1099      h1 h1-eth0:s2-eth1
1100      h2 h2-eth0:s2-eth2
1101      h3 h3-eth0:s3-eth1
1102      h4 h4-eth0:s3-eth2
1103      s1 lo:  s1-eth1:s2-eth3 s1-eth2:s3-eth3
1104      s2 lo:  s2-eth1:h1-eth0 s2-eth2:h2-eth0 s2-eth3:s1-eth1
1105      s3 lo:  s3-eth1:h3-eth0 s3-eth2:h4-eth0 s3-eth3:s1-eth2
1106
1107 -  In this guide, you will provision the virtual L2 network to establish
1108    communication between h1 and h3.
1109
1110 Configuration
1111 ^^^^^^^^^^^^^
1112
1113 To provision the virtual L2 network for the two hosts (h1 and h3),
1114 execute REST API provided by VTN Manager as follows. It uses curl
1115 command to call the REST API.
1116
1117 -  Create a virtual tenant named vtn1 by executing `the update-vtn
1118    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#update-vtn>`__.
1119
1120 ::
1121
1122     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:update-vtn -d '{"input":{"tenant-name":"vtn1"}}'
1123
1124 -  Create a virtual bridge named vbr1 in the tenant vtn1 by executing
1125    `the update-vbridge
1126    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge>`__.
1127
1128 ::
1129
1130     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"}}'
1131
1132 -  Create two interfaces into the virtual bridge by executing `the
1133    update-vinterface
1134    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
1135
1136 ::
1137
1138     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"}}'
1139
1140 ::
1141
1142     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"}}'
1143
1144 -  Configure two mappings on the created interfaces by executing `the
1145    set-port-map
1146    RPC <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>`__.
1147
1148    -  The interface if1 of the virtual bridge will be mapped to the port
1149       "s2-eth1" of the switch "openflow:2" of the Mininet.
1150
1151       -  The h1 is connected to the port "s2-eth1".
1152
1153    -  The interface if2 of the virtual bridge will be mapped to the port
1154       "s3-eth1" of the switch "openflow:3" of the Mininet.
1155
1156       -  The h3 is connected to the port "s3-eth1".
1157
1158 ::
1159
1160     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"}}'
1161
1162 ::
1163
1164     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"}}'
1165
1166 Verification
1167 ^^^^^^^^^^^^
1168
1169 -  Please execute ping from h1 to h3 to verify if the virtual L2 network
1170    for h1 and h3 is provisioned successfully.
1171
1172 ::
1173
1174      mininet> h1 ping h3
1175      PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
1176      64 bytes from 10.0.0.3: icmp_seq=1 ttl=64 time=243 ms
1177      64 bytes from 10.0.0.3: icmp_seq=2 ttl=64 time=0.341 ms
1178      64 bytes from 10.0.0.3: icmp_seq=3 ttl=64 time=0.078 ms
1179      64 bytes from 10.0.0.3: icmp_seq=4 ttl=64 time=0.079 ms
1180
1181 -  You can also verify the configuration by executing the following REST
1182    API. It shows all configuration in VTN Manager.
1183
1184 ::
1185
1186     curl --user "admin":"admin" -H "Content-type: application/json" -X GET http://localhost:8181/restconf/operational/vtn:vtns/
1187
1188 -  The result of the command should be like this.
1189
1190 ::
1191
1192     {
1193       "vtns": {
1194         "vtn": [
1195         {
1196           "name": "vtn1",
1197             "vtenant-config": {
1198               "idle-timeout": 300,
1199               "hard-timeout": 0
1200             },
1201             "vbridge": [
1202             {
1203               "name": "vbr1",
1204               "bridge-status": {
1205                 "state": "UP",
1206                 "path-faults": 0
1207               },
1208               "vbridge-config": {
1209                 "age-interval": 600
1210               },
1211               "vinterface": [
1212               {
1213                 "name": "if2",
1214                 "vinterface-status": {
1215                   "entity-state": "UP",
1216                   "state": "UP",
1217                   "mapped-port": "openflow:3:3"
1218                 },
1219                 "vinterface-config": {
1220                   "enabled": true
1221                 },
1222                 "port-map-config": {
1223                   "vlan-id": 0,
1224                   "port-name": "s3-eth1",
1225                   "node": "openflow:3"
1226                 }
1227               },
1228               {
1229                 "name": "if1",
1230                 "vinterface-status": {
1231                   "entity-state": "UP",
1232                   "state": "UP",
1233                   "mapped-port": "openflow:2:1"
1234                 },
1235                 "vinterface-config": {
1236                   "enabled": true
1237                 },
1238                 "port-map-config": {
1239                   "vlan-id": 0,
1240                   "port-name": "s2-eth1",
1241                   "node": "openflow:2"
1242                 }
1243               }
1244               ]
1245             }
1246           ]
1247         }
1248         ]
1249       }
1250     }
1251
1252 Cleaning Up
1253 ^^^^^^^^^^^
1254
1255 -  You can delete the virtual tenant vtn1 by executing `the remove-vtn
1256    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#remove-vtn>`__.
1257
1258 ::
1259
1260     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"vtn1"}}'
1261
1262 How To Test Vlan-Map In Mininet Environment
1263 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1264
1265 Overview
1266 ^^^^^^^^
1267
1268 This page explains how to test Vlan-map in a multi host scenario using
1269 mininet. This page targets Beryllium release, so the procedure described
1270 here does not work in other releases.
1271
1272 .. figure:: ./images/vtn/vlanmap_using_mininet.png
1273    :alt: Example that demonstrates vlanmap testing in Mininet
1274    Environment
1275
1276    Example that demonstrates vlanmap testing in Mininet Environment
1277
1278 Requirements
1279 ^^^^^^^^^^^^
1280
1281 Save the mininet script given below as vlan\_vtn\_test.py and run the
1282 mininet script in the mininet environment where Mininet is installed.
1283
1284 Mininet Script
1285 ^^^^^^^^^^^^^^
1286
1287 https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:Mininet#Network_with_hosts_in_different_vlan
1288
1289 -  Run the mininet script
1290
1291 ::
1292
1293     sudo mn --controller=remote,ip=192.168.64.13 --custom vlan_vtn_test.py --topo mytopo
1294
1295 .. note::
1296
1297     Replace "192.168.64.13" with the IP address of OpenDaylight
1298     controller based on your environment.
1299
1300 -  You can check the topology that you have created by executing "net"
1301    command in the Mininet console.
1302
1303 ::
1304
1305      mininet> net
1306      h1 h1-eth0.200:s1-eth1
1307      h2 h2-eth0.300:s2-eth2
1308      h3 h3-eth0.200:s2-eth3
1309      h4 h4-eth0.300:s2-eth4
1310      h5 h5-eth0.200:s3-eth2
1311      h6 h6-eth0.300:s3-eth3
1312      s1 lo:  s1-eth1:h1-eth0.200 s1-eth2:s2-eth1 s1-eth3:s3-eth1
1313      s2 lo:  s2-eth1:s1-eth2 s2-eth2:h2-eth0.300 s2-eth3:h3-eth0.200 s2-eth4:h4-eth0.300
1314      s3 lo:  s3-eth1:s1-eth3 s3-eth2:h5-eth0.200 s3-eth3:h6-eth0.300
1315      c0
1316
1317 Configuration
1318 ^^^^^^^^^^^^^
1319
1320 To test vlan-map, execute REST API provided by VTN Manager as follows.
1321
1322 -  Create a virtual tenant named vtn1 by executing `the update-vtn
1323    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#update-vtn>`__.
1324
1325 ::
1326
1327     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:update-vtn -d '{"input":{"tenant-name":"vtn1"}}'
1328
1329 -  Create a virtual bridge named vbr1 in the tenant vtn1 by executing
1330    `the update-vbridge
1331    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge>`__.
1332
1333 ::
1334
1335     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"}}'
1336
1337 -  Configure a vlan map with vlanid 200 for vBridge vbr1 by executing
1338    `the add-vlan-map
1339    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vlan-map.html#add-vlan-map>`__.
1340
1341 ::
1342
1343     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vlan-map:add-vlan-map -d '{"input":{"vlan-id":200,"tenant-name":"vtn1","bridge-name":"vbr1"}}'
1344
1345 -  Create a virtual bridge named vbr2 in the tenant vtn1 by executing
1346    `the update-vbridge
1347    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge>`__.
1348
1349 ::
1350
1351     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":"vbr2"}}'
1352
1353 -  Configure a vlan map with vlanid 300 for vBridge vbr2 by executing
1354    `the add-vlan-map
1355    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vlan-map.html#add-vlan-map>`__.
1356
1357 ::
1358
1359     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vlan-map:add-vlan-map -d '{"input":{"vlan-id":300,"tenant-name":"vtn1","bridge-name":"vbr2"}}'
1360
1361 Verification
1362 ^^^^^^^^^^^^
1363
1364 -  Please execute pingall in mininet environment to view the host
1365    reachability.
1366
1367 ::
1368
1369      mininet> pingall
1370      Ping: testing ping reachability
1371      h1 -> X h3 X h5 X
1372      h2 -> X X h4 X h6
1373      h3 -> h1 X X h5 X
1374      h4 -> X h2 X X h6
1375      h5 -> h1 X h3 X X
1376      h6 -> X h2 X h4 X
1377
1378 -  You can also verify the configuration by executing the following REST
1379    API. It shows all configurations in VTN Manager.
1380
1381 ::
1382
1383     curl --user "admin":"admin" -H "Content-type: application/json" -X GET http://localhost:8181/restconf/operational/vtn:vtns
1384
1385 -  The result of the command should be like this.
1386
1387 ::
1388
1389     {
1390       "vtns": {
1391         "vtn": [
1392         {
1393           "name": "vtn1",
1394             "vtenant-config": {
1395               "hard-timeout": 0,
1396               "idle-timeout": 300,
1397               "description": "creating vtn"
1398             },
1399             "vbridge": [
1400             {
1401               "name": "vbr2",
1402               "vbridge-config": {
1403                 "age-interval": 600,
1404                 "description": "creating vbr2"
1405               },
1406               "bridge-status": {
1407                 "state": "UP",
1408                 "path-faults": 0
1409               },
1410               "vlan-map": [
1411               {
1412                 "map-id": "ANY.300",
1413                 "vlan-map-config": {
1414                   "vlan-id": 300
1415                 },
1416                 "vlan-map-status": {
1417                   "active": true
1418                 }
1419               }
1420               ]
1421             },
1422             {
1423               "name": "vbr1",
1424               "vbridge-config": {
1425                 "age-interval": 600,
1426                 "description": "creating vbr1"
1427               },
1428               "bridge-status": {
1429                 "state": "UP",
1430                 "path-faults": 0
1431               },
1432               "vlan-map": [
1433               {
1434                 "map-id": "ANY.200",
1435                 "vlan-map-config": {
1436                   "vlan-id": 200
1437                 },
1438                 "vlan-map-status": {
1439                   "active": true
1440                 }
1441               }
1442               ]
1443             }
1444           ]
1445         }
1446         ]
1447       }
1448     }
1449
1450 Cleaning Up
1451 ^^^^^^^^^^^
1452
1453 -  You can delete the virtual tenant vtn1 by executing `the remove-vtn
1454    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#remove-vtn>`__.
1455
1456 ::
1457
1458     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"vtn1"}}'
1459
1460 How To Configure Service Function Chaining using VTN Manager
1461 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1462
1463 Overview
1464 ^^^^^^^^
1465
1466 This page explains how to configure VTN Manager for Service Chaining.
1467 This page targets Beryllium release, so the procedure described here
1468 does not work in other releases.
1469
1470 .. figure:: ./images/vtn/Service_Chaining_With_One_Service.png
1471    :alt: Service Chaining With One Service
1472
1473    Service Chaining With One Service
1474
1475 Requirements
1476 ^^^^^^^^^^^^
1477
1478 -  Please refer to the `Installation
1479    Pages <https://wiki.opendaylight.org/view/VTN:Beryllium:Installation_Guide>`__
1480    to run ODL with VTN Feature enabled.
1481
1482 -  Please ensure Bridge-Utils package is installed in mininet
1483    environment before running the mininet script.
1484
1485 -  To install Bridge-Utils package run sudo apt-get install bridge-utils
1486    (assuming Ubuntu is used to run mininet, If not then this is not
1487    required).
1488
1489 -  Save the mininet script given below as topo\_handson.py and run the
1490    mininet script in the mininet environment where Mininet is installed.
1491
1492 Mininet Script
1493 ^^^^^^^^^^^^^^
1494
1495 -  `Script for emulating network with multiple
1496    hosts <https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:Mininet>`__.
1497
1498 -  Before executing the mininet script, please confirm Controller is up
1499    and running.
1500
1501 -  Run the mininet script.
1502
1503 -  Replace <path> and <Controller IP> based on your environment
1504
1505 ::
1506
1507     sudo mn --controller=remote,ip=<Controller IP> --custom <path>\topo_handson.py --topo mytopo2
1508
1509 ::
1510
1511      mininet> net
1512      h11 h11-eth0:s1-eth1
1513      h12 h12-eth0:s1-eth2
1514      h21 h21-eth0:s2-eth1
1515      h22 h22-eth0:s2-eth2
1516      h23 h23-eth0:s2-eth3
1517      srvc1 srvc1-eth0:s3-eth3 srvc1-eth1:s4-eth3
1518      srvc2 srvc2-eth0:s3-eth4 srvc2-eth1:s4-eth4
1519      s1 lo:  s1-eth1:h11-eth0 s1-eth2:h12-eth0 s1-eth3:s2-eth4 s1-eth4:s3-eth2
1520      s2 lo:  s2-eth1:h21-eth0 s2-eth2:h22-eth0 s2-eth3:h23-eth0 s2-eth4:s1-eth3 s2-eth5:s4-eth1
1521      s3 lo:  s3-eth1:s4-eth2 s3-eth2:s1-eth4 s3-eth3:srvc1-eth0 s3-eth4:srvc2-eth0
1522      s4 lo:  s4-eth1:s2-eth5 s4-eth2:s3-eth1 s4-eth3:srvc1-eth1 s4-eth4:srvc2-eth1
1523
1524 Configurations
1525 ^^^^^^^^^^^^^^
1526
1527 Mininet
1528 '''''''
1529
1530 -  Please follow the below steps to configure the network in mininet as
1531    in the below image:
1532
1533 .. figure:: ./images/vtn/Mininet_Configuration.png
1534    :alt: Mininet Configuration
1535
1536    Mininet Configuration
1537
1538 Configure service nodes
1539 '''''''''''''''''''''''
1540
1541 -  Please execute the following commands in the mininet console where
1542    mininet script is executed.
1543
1544 ::
1545
1546      mininet> srvc1 ip addr del 10.0.0.6/8 dev srvc1-eth0
1547      mininet> srvc1 brctl addbr br0
1548      mininet> srvc1 brctl addif br0 srvc1-eth0
1549      mininet> srvc1 brctl addif br0 srvc1-eth1
1550      mininet> srvc1 ifconfig br0 up
1551      mininet> srvc1 tc qdisc add dev srvc1-eth1 root netem delay 200ms
1552      mininet> srvc2 ip addr del 10.0.0.7/8 dev srvc2-eth0
1553      mininet> srvc2 brctl addbr br0
1554      mininet> srvc2 brctl addif br0 srvc2-eth0
1555      mininet> srvc2 brctl addif br0 srvc2-eth1
1556      mininet> srvc2 ifconfig br0 up
1557      mininet> srvc2 tc qdisc add dev srvc2-eth1 root netem delay 300ms
1558
1559 Controller
1560 ^^^^^^^^^^
1561
1562 Multi-Tenancy
1563 '''''''''''''
1564
1565 -  Please execute the below commands to configure the network topology
1566    in the controller as in the below image:
1567
1568 .. figure:: ./images/vtn/Tenant2.png
1569    :alt: Tenant2
1570
1571    Tenant2
1572
1573 Please execute the below commands in controller
1574 '''''''''''''''''''''''''''''''''''''''''''''''
1575
1576 .. note::
1577
1578     The below commands are for the difference in behavior of Manager in
1579     Beryllium topology. The Link below has the details for this bug:
1580     https://bugs.opendaylight.org/show_bug.cgi?id=3818.
1581
1582 ::
1583
1584     curl --user admin:admin -H 'content-type: application/json' -H 'ipaddr:127.0.0.1' -X PUT http://localhost:8181/restconf/config/vtn-static-topology:vtn-static-topology/static-edge-ports -d '{"static-edge-ports": {"static-edge-port": [ {"port": "openflow:3:3"}, {"port": "openflow:3:4"}, {"port": "openflow:4:3"}, {"port": "openflow:4:4"}]}}'
1585
1586 -  Create a virtual tenant named vtn1 by executing `the update-vtn
1587    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#update-vtn>`__.
1588
1589 ::
1590
1591     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:update-vtn -d '{"input":{"tenant-name":"vtn1","update-mode":"CREATE","operation":"SET","description":"creating vtn","idle-timeout":300,"hard-timeout":0}}'
1592
1593 -  Create a virtual bridge named vbr1 in the tenant vtn1 by executing
1594    `the update-vbridge
1595    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge>`__.
1596
1597 ::
1598
1599     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vbridge:update-vbridge -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"creating vbr","tenant-name":"vtn1","bridge-name":"vbr1"}}'
1600
1601 -  Create interface if1 into the virtual bridge vbr1 by executing `the
1602    update-vinterface
1603    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
1604
1605 ::
1606
1607     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vbrif1 interface","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if1"}}'
1608
1609 -  Configure port mapping on the interface by executing `the
1610    set-port-map
1611    RPC <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>`__.
1612
1613    -  The interface if1 of the virtual bridge will be mapped to the port
1614       "s1-eth2" of the switch "openflow:1" of the Mininet.
1615
1616       -  The h12 is connected to the port "s1-eth2".
1617
1618 ::
1619
1620     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"vlan-id":0,"tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if1","node":"openflow:1","port-name":"s1-eth2"}}'
1621
1622 -  Create interface if2 into the virtual bridge vbr1 by executing `the
1623    update-vinterface
1624    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
1625
1626 ::
1627
1628     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vbrif2 interface","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if2"}}'
1629
1630 -  Configure port mapping on the interface by executing `the
1631    set-port-map
1632    RPC <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>`__.
1633
1634    -  The interface if2 of the virtual bridge will be mapped to the port
1635       "s2-eth2" of the switch "openflow:2" of the Mininet.
1636
1637       -  The h22 is connected to the port "s2-eth2".
1638
1639 ::
1640
1641     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"vlan-id":0,"tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if2","node":"openflow:2","port-name":"s2-eth2"}}'
1642
1643 -  Create interface if3 into the virtual bridge vbr1 by executing `the
1644    update-vinterface
1645    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
1646
1647 ::
1648
1649     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vbrif3 interface","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if3"}}'
1650
1651 -  Configure port mapping on the interfaces by executing `the
1652    set-port-map
1653    RPC <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>`__.
1654
1655    -  The interface if3 of the virtual bridge will be mapped to the port
1656       "s2-eth3" of the switch "openflow:2" of the Mininet.
1657
1658       -  The h23 is connected to the port "s2-eth3".
1659
1660 ::
1661
1662     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-port-map:set-port-map -d '{"input":{"vlan-id":0,"tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if3","node":"openflow:2","port-name":"s2-eth3"}}'
1663
1664 Traffic filtering
1665 ^^^^^^^^^^^^^^^^^
1666
1667 -  Create flowcondition named cond\_1 by executing `the
1668    set-flow-condition
1669    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#set-flow-condition>`__.
1670
1671    -  For option source and destination-network, get inet address of
1672       host h12(src) and h22(dst) from mininet.
1673
1674 ::
1675
1676     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"operation":"SET","present":"false","name":"cond_1","vtn-flow-match":[{"index":1,"vtn-ether-match":{},"vtn-inet-match":{"source-network":"10.0.0.2/32","destination-network":"10.0.0.4/32"}}]}}'
1677
1678 -  Flow filter demonstration with DROP action-type. Create Flowfilter in
1679    VBR Interface if1 by executing `the set-flow-filter
1680    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter>`__.
1681
1682 ::
1683
1684     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if1","vtn-flow-filter":[{"condition":"cond_1","index":10,"vtn-drop-filter":{}}]}}'
1685
1686 Service Chaining
1687 ^^^^^^^^^^^^^^^^
1688
1689 With One Service
1690 ''''''''''''''''
1691
1692 -  Please execute the below commands to configure the network topology
1693    which sends some specific traffic via a single service(External
1694    device) in the controller as in the below image:
1695
1696 .. figure:: ./images/vtn/Service_Chaining_With_One_Service_LLD.png
1697    :alt: Service Chaining With One Service LLD
1698
1699    Service Chaining With One Service LLD
1700
1701 -  Create a virtual terminal named vt\_srvc1\_1 in the tenant vtn1 by
1702    executing `the update-vterminal
1703    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vterminal.html#update-vterminal>`__.
1704
1705 ::
1706
1707     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vterminal:update-vterminal -d '{"input":{"update-mode":"CREATE","operation":"SET","tenant-name":"vtn1","terminal-name":"vt_srvc1_1","description":"Creating vterminal"}}'
1708
1709 -  Create interface IF into the virtual terminal vt\_srvc1\_1 by
1710    executing `the update-vinterface
1711    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
1712
1713 ::
1714
1715     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vterminal IF","enabled":"true","tenant-name":"vtn1","terminal-name":"vt_srvc1_1","interface-name":"IF"}}'
1716
1717 -  Configure port mapping on the interfaces by executing `the
1718    set-port-map
1719    RPC <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>`__.
1720
1721    -  The interface IF of the virtual terminal will be mapped to the
1722       port "s3-eth3" of the switch "openflow:3" of the Mininet.
1723
1724       -  The h12 is connected to the port "s3-eth3".
1725
1726 ::
1727
1728     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","terminal-name":"vt_srvc1_1","interface-name":"IF","node":"openflow:3","port-name":"s3-eth3"}}'
1729
1730 -  Create a virtual terminal named vt\_srvc1\_2 in the tenant vtn1 by
1731    executing `the update-vterminal
1732    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vterminal.html#update-vterminal>`__.
1733
1734 ::
1735
1736     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vterminal:update-vterminal -d '{"input":{"update-mode":"CREATE","operation":"SET","tenant-name":"vtn1","terminal-name":"vt_srvc1_2","description":"Creating vterminal"}}'
1737
1738 -  Create interface IF into the virtual terminal vt\_srvc1\_2 by
1739    executing `the update-vinterface
1740    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
1741
1742 ::
1743
1744     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vterminal IF","enabled":"true","tenant-name":"vtn1","terminal-name":"vt_srvc1_2","interface-name":"IF"}}'
1745
1746 -  Configure port mapping on the interfaces by executing `the
1747    set-port-map
1748    RPC <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>`__.
1749
1750    -  The interface IF of the virtual terminal will be mapped to the
1751       port "s4-eth3" of the switch "openflow:4" of the Mininet.
1752
1753       -  The h22 is connected to the port "s4-eth3".
1754
1755 ::
1756
1757     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","terminal-name":"vt_srvc1_2","interface-name":"IF","node":"openflow:4","port-name":"s4-eth3"}}'
1758
1759 -  Create flowcondition named cond\_1 by executing `the
1760    set-flow-condition
1761    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#set-flow-condition>`__.
1762
1763    -  For option source and destination-network, get inet address of
1764       host h12(src) and h22(dst) from mininet.
1765
1766 ::
1767
1768     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"operation":"SET","present":"false","name":"cond_1","vtn-flow-match":[{"index":1,"vtn-ether-match":{},"vtn-inet-match":{"source-network":"10.0.0.2/32","destination-network":"10.0.0.4/32"}}]}}'
1769
1770 -  Create flowcondition named cond\_any by executing `the
1771    set-flow-condition
1772    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#set-flow-condition>`__.
1773
1774 ::
1775
1776     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"operation":"SET","present":"false","name":"cond_any","vtn-flow-match":[{"index":1}]}}'
1777
1778 -  Flow filter demonstration with redirect action-type. Create
1779    Flowfilter in virtual terminal vt\_srvc1\_2 interface IF by executing
1780    `the set-flow-filter
1781    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter>`__.
1782
1783    -  Flowfilter redirects vt\_srvc1\_2 to bridge1-IF2
1784
1785 ::
1786
1787     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","terminal-name":"vt_srvc1_2","interface-name":"IF","vtn-flow-filter":[{"condition":"cond_any","index":10,"vtn-redirect-filter":{"redirect-destination":{"bridge-name":"vbr1","interface-name":"if2"},"output":"true"}}]}}'
1788
1789 -  Flow filter demonstration with redirect action-type. Create
1790    Flowfilter in vbridge vbr1 interface if1 by executing `the
1791    set-flow-filter
1792    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter>`__.
1793
1794    -  Flow filter redirects Bridge1-IF1 to vt\_srvc1\_1
1795
1796 ::
1797
1798     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","bridge-name":"vbr1","interface-name":"if1","vtn-flow-filter":[{"condition":"cond_1","index":10,"vtn-redirect-filter":{"redirect-destination":{"terminal-name":"vt_srvc1_1","interface-name":"IF"},"output":"true"}}]}}'
1799
1800 Verification
1801 ^^^^^^^^^^^^
1802
1803 .. figure:: ./images/vtn/Service_Chaining_With_One_Service_Verification.png
1804    :alt: Service Chaining With One Service
1805
1806    Service Chaining With One Service
1807
1808 -  Ping host12 to host22 to view the host rechability, a delay of 200ms
1809    will be taken to reach host22 as below.
1810
1811 ::
1812
1813      mininet> h12 ping h22
1814      PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
1815      64 bytes from 10.0.0.4: icmp_seq=35 ttl=64 time=209 ms
1816      64 bytes from 10.0.0.4: icmp_seq=36 ttl=64 time=201 ms
1817      64 bytes from 10.0.0.4: icmp_seq=37 ttl=64 time=200 ms
1818      64 bytes from 10.0.0.4: icmp_seq=38 ttl=64 time=200 ms
1819
1820 With two services
1821 '''''''''''''''''
1822
1823 -  Please execute the below commands to configure the network topology
1824    which sends some specific traffic via two services(External device)
1825    in the controller as in the below image.
1826
1827 .. figure:: ./images/vtn/Service_Chaining_With_Two_Services_LLD.png
1828    :alt: Service Chaining With Two Services LLD
1829
1830    Service Chaining With Two Services LLD
1831
1832 -  Create a virtual terminal named vt\_srvc2\_1 in the tenant vtn1 by
1833    executing `the update-vterminal
1834    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vterminal.html#update-vterminal>`__.
1835
1836 ::
1837
1838     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vterminal:update-vterminal -d '{"input":{"update-mode":"CREATE","operation":"SET","tenant-name":"vtn1","terminal-name":"vt_srvc2_1","description":"Creating vterminal"}}'
1839
1840 -  Create interface IF into the virtual terminal vt\_srvc2\_1 by
1841    executing `the update-vinterface
1842    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
1843
1844 ::
1845
1846     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vterminal IF","enabled":"true","tenant-name":"vtn1","terminal-name":"vt_srvc2_1","interface-name":"IF"}}'
1847
1848 -  Configure port mapping on the interfaces by executing `the
1849    set-port-map
1850    RPC <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>`__.
1851
1852    -  The interface IF of the virtual terminal will be mapped to the
1853       port "s3-eth4" of the switch "openflow:3" of the Mininet.
1854
1855       -  The host h12 is connected to the port "s3-eth4".
1856
1857 ::
1858
1859     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","terminal-name":"vt_srvc2_1","interface-name":"IF","node":"openflow:3","port-name":"s3-eth4"}}'
1860
1861 -  Create a virtual terminal named vt\_srvc2\_2 in the tenant vtn1 by
1862    executing `the update-vterminal
1863    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vterminal.html#update-vterminal>`__.
1864
1865 ::
1866
1867     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vterminal:update-vterminal -d '{"input":{"update-mode":"CREATE","operation":"SET","tenant-name":"vtn1","terminal-name":"vt_srvc2_2","description":"Creating vterminal"}}'
1868
1869 -  Create interfaces IF into the virtual terminal vt\_srvc2\_2 by
1870    executing `the update-vinterface
1871    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
1872
1873 ::
1874
1875     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vinterface:update-vinterface -d '{"input":{"update-mode":"CREATE","operation":"SET","description":"Creating vterminal IF","enabled":"true","tenant-name":"vtn1","terminal-name":"vt_srvc2_2","interface-name":"IF"}}'
1876
1877 -  Configure port mapping on the interfaces by executing `the
1878    set-port-map
1879    RPC <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>`__.
1880
1881    -  The interface IF of the virtual terminal will be mapped to the
1882       port "s4-eth4" of the switch "openflow:4" of the mininet.
1883
1884       -  The host h22 is connected to the port "s4-eth4".
1885
1886 ::
1887
1888     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","terminal-name":"vt_srvc2_2","interface-name":"IF","node":"openflow:4","port-name":"s4-eth4"}}'
1889
1890 -  Flow filter demonstration with redirect action-type. Create
1891    Flowfilter in virtual terminal vt\_srvc2\_2 interface IF by executing
1892    `the set-flow-filter
1893    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter>`__.
1894
1895    -  Flow filter redirects vt\_srvc2\_2 to Bridge1-IF2.
1896
1897 ::
1898
1899     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","terminal-name":"vt_srvc2_2","interface-name":"IF","vtn-flow-filter":[{"condition":"cond_any","index":10,"vtn-redirect-filter":{"redirect-destination":{"bridge-name":"vbr1","interface-name":"if2"},"output":"true"}}]}}'
1900
1901 -  Flow filter demonstration with redirect action-type. Create
1902    Flowfilter in virtual terminal vt\_srvc2\_2 interface IF by executing
1903    `the set-flow-filter
1904    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter>`__.
1905
1906    -  Flow filter redirects vt\_srvc1\_2 to vt\_srvc2\_1.
1907
1908 ::
1909
1910     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input":{"output":"false","tenant-name":"vtn1","terminal-name":"vt_srvc1_2","interface-name":"IF","vtn-flow-filter":[{"condition":"cond_any","index":10,"vtn-redirect-filter":{"redirect-destination":{"terminal-name":"vt_srvc2_1","interface-name":"IF"},"output":"true"}}]}}'
1911
1912 Verification
1913 ^^^^^^^^^^^^
1914
1915 .. figure:: ./images/vtn/Service_Chaining_With_Two_Services.png
1916    :alt: Service Chaining With Two Service
1917
1918    Service Chaining With Two Service
1919
1920 -  Ping host12 to host22 to view the host rechability, a delay of 500ms
1921    will be taken to reach host22 as below.
1922
1923 ::
1924
1925      mininet> h12 ping h22
1926      PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
1927      64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=512 ms
1928      64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=501 ms
1929      64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=500 ms
1930      64 bytes from 10.0.0.4: icmp_seq=4 ttl=64 time=500 ms
1931
1932 -  You can verify the configuration by executing the following REST API.
1933    It shows all configuration in VTN Manager.
1934
1935 ::
1936
1937     curl --user "admin":"admin" -H "Content-type: application/json" -X GET http://localhost:8181/restconf/operational/vtn:vtns
1938
1939 ::
1940
1941     {
1942       "vtn": [
1943       {
1944         "name": "vtn1",
1945           "vtenant-config": {
1946             "hard-timeout": 0,
1947             "idle-timeout": 300,
1948             "description": "creating vtn"
1949           },
1950           "vbridge": [
1951           {
1952             "name": "vbr1",
1953             "vbridge-config": {
1954               "age-interval": 600,
1955               "description": "creating vbr"
1956             },
1957             "bridge-status": {
1958               "state": "UP",
1959               "path-faults": 0
1960             },
1961             "vinterface": [
1962             {
1963               "name": "if1",
1964               "vinterface-status": {
1965                 "mapped-port": "openflow:1:2",
1966                 "state": "UP",
1967                 "entity-state": "UP"
1968               },
1969               "port-map-config": {
1970                 "vlan-id": 0,
1971                 "node": "openflow:1",
1972                 "port-name": "s1-eth2"
1973               },
1974               "vinterface-config": {
1975                 "description": "Creating vbrif1 interface",
1976                 "enabled": true
1977               },
1978               "vinterface-input-filter": {
1979                 "vtn-flow-filter": [
1980                 {
1981                   "index": 10,
1982                   "condition": "cond_1",
1983                   "vtn-redirect-filter": {
1984                     "output": true,
1985                     "redirect-destination": {
1986                       "terminal-name": "vt_srvc1_1",
1987                       "interface-name": "IF"
1988                     }
1989                   }
1990                 }
1991                 ]
1992               }
1993             },
1994             {
1995               "name": "if2",
1996               "vinterface-status": {
1997                 "mapped-port": "openflow:2:2",
1998                 "state": "UP",
1999                 "entity-state": "UP"
2000               },
2001               "port-map-config": {
2002                 "vlan-id": 0,
2003                 "node": "openflow:2",
2004                 "port-name": "s2-eth2"
2005               },
2006               "vinterface-config": {
2007                 "description": "Creating vbrif2 interface",
2008                 "enabled": true
2009               }
2010             },
2011             {
2012               "name": "if3",
2013               "vinterface-status": {
2014                 "mapped-port": "openflow:2:3",
2015                 "state": "UP",
2016                 "entity-state": "UP"
2017               },
2018               "port-map-config": {
2019                 "vlan-id": 0,
2020                 "node": "openflow:2",
2021                 "port-name": "s2-eth3"
2022               },
2023               "vinterface-config": {
2024                 "description": "Creating vbrif3 interface",
2025                 "enabled": true
2026               }
2027             }
2028             ]
2029           }
2030         ],
2031           "vterminal": [
2032           {
2033             "name": "vt_srvc2_2",
2034             "bridge-status": {
2035               "state": "UP",
2036               "path-faults": 0
2037             },
2038             "vinterface": [
2039             {
2040               "name": "IF",
2041               "vinterface-status": {
2042                 "mapped-port": "openflow:4:4",
2043                 "state": "UP",
2044                 "entity-state": "UP"
2045               },
2046               "port-map-config": {
2047                 "vlan-id": 0,
2048                 "node": "openflow:4",
2049                 "port-name": "s4-eth4"
2050               },
2051               "vinterface-config": {
2052                 "description": "Creating vterminal IF",
2053                 "enabled": true
2054               },
2055               "vinterface-input-filter": {
2056                 "vtn-flow-filter": [
2057                 {
2058                   "index": 10,
2059                   "condition": "cond_any",
2060                   "vtn-redirect-filter": {
2061                     "output": true,
2062                     "redirect-destination": {
2063                       "bridge-name": "vbr1",
2064                       "interface-name": "if2"
2065                     }
2066                   }
2067                 }
2068                 ]
2069               }
2070             }
2071             ],
2072               "vterminal-config": {
2073                 "description": "Creating vterminal"
2074               }
2075           },
2076           {
2077             "name": "vt_srvc1_1",
2078             "bridge-status": {
2079               "state": "UP",
2080               "path-faults": 0
2081             },
2082             "vinterface": [
2083             {
2084               "name": "IF",
2085               "vinterface-status": {
2086                 "mapped-port": "openflow:3:3",
2087                 "state": "UP",
2088                 "entity-state": "UP"
2089               },
2090               "port-map-config": {
2091                 "vlan-id": 0,
2092                 "node": "openflow:3",
2093                 "port-name": "s3-eth3"
2094               },
2095               "vinterface-config": {
2096                 "description": "Creating vterminal IF",
2097                 "enabled": true
2098               }
2099             }
2100             ],
2101               "vterminal-config": {
2102                 "description": "Creating vterminal"
2103               }
2104           },
2105           {
2106             "name": "vt_srvc1_2",
2107             "bridge-status": {
2108               "state": "UP",
2109               "path-faults": 0
2110             },
2111             "vinterface": [
2112             {
2113               "name": "IF",
2114               "vinterface-status": {
2115                 "mapped-port": "openflow:4:3",
2116                 "state": "UP",
2117                 "entity-state": "UP"
2118               },
2119               "port-map-config": {
2120                 "vlan-id": 0,
2121                 "node": "openflow:4",
2122                 "port-name": "s4-eth3"
2123               },
2124               "vinterface-config": {
2125                 "description": "Creating vterminal IF",
2126                 "enabled": true
2127               },
2128               "vinterface-input-filter": {
2129                 "vtn-flow-filter": [
2130                 {
2131                   "index": 10,
2132                   "condition": "cond_any",
2133                   "vtn-redirect-filter": {
2134                     "output": true,
2135                     "redirect-destination": {
2136                       "terminal-name": "vt_srvc2_1",
2137                       "interface-name": "IF"
2138                     }
2139                   }
2140                 }
2141                 ]
2142               }
2143             }
2144             ],
2145               "vterminal-config": {
2146                 "description": "Creating vterminal"
2147               }
2148           },
2149           {
2150             "name": "vt_srvc2_1",
2151             "bridge-status": {
2152               "state": "UP",
2153               "path-faults": 0
2154             },
2155             "vinterface": [
2156             {
2157               "name": "IF",
2158               "vinterface-status": {
2159                 "mapped-port": "openflow:3:4",
2160                 "state": "UP",
2161                 "entity-state": "UP"
2162               },
2163               "port-map-config": {
2164                 "vlan-id": 0,
2165                 "node": "openflow:3",
2166                 "port-name": "s3-eth4"
2167               },
2168               "vinterface-config": {
2169                 "description": "Creating vterminal IF",
2170                 "enabled": true
2171               }
2172             }
2173             ],
2174               "vterminal-config": {
2175                 "description": "Creating vterminal"
2176               }
2177           }
2178         ]
2179       }
2180       ]
2181     }
2182
2183 Cleaning Up
2184 ^^^^^^^^^^^
2185
2186 -  To clean up both VTN and flowconditions.
2187
2188 -  You can delete the virtual tenant vtn1 by executing `the remove-vtn
2189    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#remove-vtn>`__.
2190
2191 ::
2192
2193     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"vtn1"}}'
2194
2195 -  You can delete the flowcondition cond\_1 and cond\_any by executing
2196    `the remove-flow-condition
2197    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#remove-flow-condition>`__.
2198
2199 ::
2200
2201     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:remove-flow-condition -d '{"input":{"name":"cond_1"}}'
2202
2203 ::
2204
2205     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:remove-flow-condition -d '{"input":{"name":"cond_any"}}'
2206
2207 How To View Dataflows
2208 ~~~~~~~~~~~~~~~~~~~~~
2209
2210 Overview
2211 ^^^^^^^^
2212
2213 This page explains how to view Dataflows using VTN Manager. This page
2214 targets Beryllium release, so the procedure described here does not work
2215 in other releases.
2216
2217 Dataflow feature enables retrieval and display of data flows in the
2218 openflow network. The data flows can be retrieved based on an openflow
2219 switch or a switch port or a L2 source host.
2220
2221 The flow information provided by this feature are
2222
2223 -  Location of virtual node which maps the incoming packet and outgoing
2224    packets.
2225
2226 -  Location of physical switch port where incoming and outgoing packets
2227    is sent and received.
2228
2229 -  A sequence of physical route info which represents the packet route
2230    in the physical network.
2231
2232 Configuration
2233 ^^^^^^^^^^^^^
2234
2235 -  To view Dataflow information, configure with VLAN Mapping
2236    https://wiki.opendaylight.org/view/VTN:Mananger:How_to_test_Vlan-map_using_mininet.
2237
2238 Verification
2239 ^^^^^^^^^^^^
2240
2241 After creating vlan mapping configuration from the above page, execute
2242 as below in mininet to get switch details.
2243
2244 ::
2245
2246      mininet> net
2247      h1 h1-eth0.200:s1-eth1
2248      h2 h2-eth0.300:s2-eth2
2249      h3 h3-eth0.200:s2-eth3
2250      h4 h4-eth0.300:s2-eth4
2251      h5 h5-eth0.200:s3-eth2
2252      h6 h6-eth0.300:s3-eth3
2253      s1 lo:  s1-eth1:h1-eth0.200 s1-eth2:s2-eth1 s1-eth3:s3-eth1
2254      s2 lo:  s2-eth1:s1-eth2 s2-eth2:h2-eth0.300 s2-eth3:h3-eth0.200 s2-eth4:h4-eth0.300
2255      s3 lo:  s3-eth1:s1-eth3 s3-eth2:h5-eth0.200 s3-eth3:h6-eth0.300
2256      c0
2257      mininet>
2258
2259 Please execute ping from h1 to h3 to check hosts reachability.
2260
2261 ::
2262
2263      mininet> h1 ping h3
2264      PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
2265      64 bytes from 10.0.0.3: icmp_seq=1 ttl=64 time=11.4 ms
2266      64 bytes from 10.0.0.3: icmp_seq=2 ttl=64 time=0.654 ms
2267      64 bytes from 10.0.0.3: icmp_seq=3 ttl=64 time=0.093 ms
2268
2269 Parallely execute below Restconf command to get data flow information of
2270 node "openflow:1" and its port "s1-eth1".
2271
2272 -  Get the Dataflows information by executing `the get-data-flow
2273    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow.html#get-data-flow>`__.
2274
2275 ::
2276
2277     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow:get-data-flow -d '{"input":{"tenant-name":"vtn1","mode":"DETAIL","node":"openflow:1","data-flow-port":{"port-id":"1","port-name":"s1-eth1"}}}'
2278
2279 ::
2280
2281     {
2282       "output": {
2283         "data-flow-info": [
2284         {
2285           "averaged-data-flow-stats": {
2286             "packet-count": 1.1998800119988002,
2287               "start-time": 1455241209151,
2288               "end-time": 1455241219152,
2289               "byte-count": 117.58824117588242
2290           },
2291             "physical-route": [
2292             {
2293               "physical-ingress-port": {
2294                 "port-name": "s2-eth3",
2295                 "port-id": "3"
2296               },
2297               "physical-egress-port": {
2298                 "port-name": "s2-eth1",
2299                 "port-id": "1"
2300               },
2301               "node": "openflow:2",
2302               "order": 0
2303             },
2304             {
2305               "physical-ingress-port": {
2306                 "port-name": "s1-eth2",
2307                 "port-id": "2"
2308               },
2309               "physical-egress-port": {
2310                 "port-name": "s1-eth1",
2311                 "port-id": "1"
2312               },
2313               "node": "openflow:1",
2314               "order": 1
2315             }
2316           ],
2317             "data-egress-node": {
2318               "bridge-name": "vbr1",
2319               "tenant-name": "vtn1"
2320             },
2321             "hard-timeout": 0,
2322             "idle-timeout": 300,
2323             "data-flow-stats": {
2324               "duration": {
2325                 "nanosecond": 640000000,
2326                 "second": 362
2327               },
2328               "packet-count": 134,
2329               "byte-count": 12932
2330             },
2331             "data-egress-port": {
2332               "node": "openflow:1",
2333               "port-name": "s1-eth1",
2334               "port-id": "1"
2335             },
2336             "data-ingress-node": {
2337               "bridge-name": "vbr1",
2338               "tenant-name": "vtn1"
2339             },
2340             "data-ingress-port": {
2341               "node": "openflow:2",
2342               "port-name": "s2-eth3",
2343               "port-id": "3"
2344             },
2345             "creation-time": 1455240855753,
2346             "data-flow-match": {
2347               "vtn-ether-match": {
2348                 "vlan-id": 200,
2349                 "source-address": "6a:ff:e2:81:86:bb",
2350                 "destination-address": "26:9f:82:70:ec:66"
2351               }
2352             },
2353             "virtual-route": [
2354             {
2355               "reason": "VLANMAPPED",
2356               "virtual-node-path": {
2357                 "bridge-name": "vbr1",
2358                 "tenant-name": "vtn1"
2359               },
2360               "order": 0
2361             },
2362             {
2363               "reason": "FORWARDED",
2364               "virtual-node-path": {
2365                 "bridge-name": "vbr1",
2366                 "tenant-name": "vtn1"
2367               },
2368               "order": 1
2369             }
2370           ],
2371             "flow-id": 16
2372         },
2373         {
2374           "averaged-data-flow-stats": {
2375             "packet-count": 1.1998800119988002,
2376             "start-time": 1455241209151,
2377             "end-time": 1455241219152,
2378             "byte-count": 117.58824117588242
2379           },
2380           "physical-route": [
2381           {
2382             "physical-ingress-port": {
2383               "port-name": "s1-eth1",
2384               "port-id": "1"
2385             },
2386             "physical-egress-port": {
2387               "port-name": "s1-eth2",
2388               "port-id": "2"
2389             },
2390             "node": "openflow:1",
2391             "order": 0
2392           },
2393           {
2394             "physical-ingress-port": {
2395               "port-name": "s2-eth1",
2396               "port-id": "1"
2397             },
2398             "physical-egress-port": {
2399               "port-name": "s2-eth3",
2400               "port-id": "3"
2401             },
2402             "node": "openflow:2",
2403             "order": 1
2404           }
2405           ],
2406             "data-egress-node": {
2407               "bridge-name": "vbr1",
2408               "tenant-name": "vtn1"
2409             },
2410             "hard-timeout": 0,
2411             "idle-timeout": 300,
2412             "data-flow-stats": {
2413               "duration": {
2414                 "nanosecond": 587000000,
2415                 "second": 362
2416               },
2417               "packet-count": 134,
2418               "byte-count": 12932
2419             },
2420             "data-egress-port": {
2421               "node": "openflow:2",
2422               "port-name": "s2-eth3",
2423               "port-id": "3"
2424             },
2425             "data-ingress-node": {
2426               "bridge-name": "vbr1",
2427               "tenant-name": "vtn1"
2428             },
2429             "data-ingress-port": {
2430               "node": "openflow:1",
2431               "port-name": "s1-eth1",
2432               "port-id": "1"
2433             },
2434             "creation-time": 1455240855747,
2435             "data-flow-match": {
2436               "vtn-ether-match": {
2437                 "vlan-id": 200,
2438                 "source-address": "26:9f:82:70:ec:66",
2439                 "destination-address": "6a:ff:e2:81:86:bb"
2440               }
2441             },
2442             "virtual-route": [
2443             {
2444               "reason": "VLANMAPPED",
2445               "virtual-node-path": {
2446                 "bridge-name": "vbr1",
2447                 "tenant-name": "vtn1"
2448               },
2449               "order": 0
2450             },
2451             {
2452               "reason": "FORWARDED",
2453               "virtual-node-path": {
2454                 "bridge-name": "vbr1",
2455                 "tenant-name": "vtn1"
2456               },
2457               "order": 1
2458             }
2459           ],
2460             "flow-id": 15
2461         }
2462         ]
2463       }
2464     }
2465
2466 How To Create Mac Map In VTN
2467 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2468
2469 Overview
2470 ^^^^^^^^
2471
2472 -  This page demonstrates Mac Mapping. This demonstration aims at
2473    enabling communication between two hosts and denying communication of
2474    particular host by associating a Vbridge to the hosts and configuring
2475    Mac Mapping (mac address) to the Vbridge.
2476
2477 -  This page targets Beryllium release, so the procedure described here
2478    does not work in other releases.
2479
2480 .. figure:: ./images/vtn/Single_Controller_Mapping.png
2481    :alt: Single Controller Mapping
2482
2483    Single Controller Mapping
2484
2485 Requirement
2486 ^^^^^^^^^^^
2487
2488 Configure mininet and create a topology
2489 '''''''''''''''''''''''''''''''''''''''
2490
2491 -  `Script for emulating network with multiple
2492    hosts <https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:Mininet#Network_with_Multiple_Hosts_for_Service_Function_Chain>`__.
2493
2494 -  Before executing the mininet script, please confirm Controller is up
2495    and running.
2496
2497 -  Run the mininet script.
2498
2499 -  Replace <path> and <Controller IP> based on your environment.
2500
2501 ::
2502
2503     sudo mn --controller=remote,ip=<Controller IP> --custom <path>\topo_handson.py --topo mytopo2
2504
2505 ::
2506
2507     mininet> net
2508     h11 h11-eth0:s1-eth1
2509     h12 h12-eth0:s1-eth2
2510     h21 h21-eth0:s2-eth1
2511     h22 h22-eth0:s2-eth2
2512     h23 h23-eth0:s2-eth3
2513     srvc1 srvc1-eth0:s3-eth3 srvc1-eth1:s4-eth3
2514     srvc2 srvc2-eth0:s3-eth4 srvc2-eth1:s4-eth4
2515     s1 lo:  s1-eth1:h11-eth0 s1-eth2:h12-eth0 s1-eth3:s2-eth4 s1-eth4:s3-eth2
2516     s2 lo:  s2-eth1:h21-eth0 s2-eth2:h22-eth0 s2-eth3:h23-eth0 s2-eth4:s1-eth3 s2-eth5:s4-eth1
2517     s3 lo:  s3-eth1:s4-eth2 s3-eth2:s1-eth4 s3-eth3:srvc1-eth0 s3-eth4:srvc2-eth0
2518     s4 lo:  s4-eth1:s2-eth5 s4-eth2:s3-eth1 s4-eth3:srvc1-eth1 s4-eth4:srvc2-eth1
2519
2520 Configuration
2521 ^^^^^^^^^^^^^
2522
2523 To create Mac Map in VTN, execute REST API provided by VTN Manager as
2524 follows. It uses curl command to call REST API.
2525
2526 -  Create a virtual tenant named Tenant1 by executing `the update-vtn
2527    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#update-vtn>`__.
2528
2529 ::
2530
2531     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:update-vtn -d '{"input":{"tenant-name":"Tenant1"}}'
2532
2533 -  Create a virtual bridge named vBridge1 in the tenant Tenant1 by
2534    executing `the update-vbridge
2535    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge>`__.
2536
2537 ::
2538
2539     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-vbridge:update-vbridge -d '{"input":{"tenant-name":"Tenant1","bridge-name":"vBridge1"}}'
2540
2541 -  Configuring Mac Mappings on the vBridge1 by giving the mac address of
2542    host h12 and host h22 as follows to allow the communication by
2543    executing `the set-mac-map
2544    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-mac-map.html#set-mac-map>`__.
2545
2546 ::
2547
2548     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-mac-map:set-mac-map -d '{"input":{"operation":"SET","allowed-hosts":["de:05:40:c4:96:76@0","62:c5:33:bc:d7:4e@0"],"tenant-name":"Tenant1","bridge-name":"vBridge1"}}'
2549
2550 .. note::
2551
2552     Mac Address of host h12 and host h22 can be obtained with the
2553     following command in mininet.
2554
2555 ::
2556
2557      mininet> h12 ifconfig
2558      h12-eth0  Link encap:Ethernet  HWaddr 62:c5:33:bc:d7:4e
2559      inet addr:10.0.0.2  Bcast:10.255.255.255  Mask:255.0.0.0
2560      inet6 addr: fe80::60c5:33ff:febc:d74e/64 Scope:Link
2561
2562 ::
2563
2564      mininet> h22 ifconfig
2565      h22-eth0  Link encap:Ethernet  HWaddr de:05:40:c4:96:76
2566      inet addr:10.0.0.4  Bcast:10.255.255.255  Mask:255.0.0.0
2567      inet6 addr: fe80::dc05:40ff:fec4:9676/64 Scope:Link
2568
2569 -  MAC Mapping will not be activated just by configuring it, a two end
2570    communication needs to be established to activate Mac Mapping.
2571
2572 -  Ping host h22 from host h12 in mininet, the ping will not happen
2573    between the hosts as only one way activation is enabled.
2574
2575 ::
2576
2577      mininet> h12 ping h22
2578      PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
2579      From 10.0.0.2 icmp_seq=1 Destination Host Unreachable
2580      From 10.0.0.2 icmp_seq=2 Destination Host Unreachable
2581
2582 -  Ping host h12 from host h22 in mininet, now the ping communication
2583    will take place as the two end communication is enabled.
2584
2585 ::
2586
2587      mininet> h22 ping h12
2588      PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
2589      64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=91.8 ms
2590      64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.510 ms
2591
2592 -  After two end communication enabled, now host h12 can ping host h22
2593
2594 ::
2595
2596      mininet> h12 ping h22
2597      PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
2598      64 bytes from 10.0.0.4: icmp_req=1 ttl=64 time=0.780 ms
2599      64 bytes from 10.0.0.4: icmp_req=2 ttl=64 time=0.079 ms
2600
2601 Verification
2602 ^^^^^^^^^^^^
2603
2604 -  To view the configured Mac Map of allowed host execute the following
2605    command.
2606
2607 ::
2608
2609     curl --user "admin":"admin" -H "Content-type: application/json" -X GET http://localhost:8181/restconf/operational/vtn:vtns/vtn/Tenant1/vbridge/vBridge1/mac-map
2610
2611 ::
2612
2613     {
2614       "mac-map": {
2615         "mac-map-status": {
2616           "mapped-host": [
2617           {
2618             "mac-address": "c6:44:22:ba:3e:72",
2619               "vlan-id": 0,
2620               "port-id": "openflow:1:2"
2621           },
2622           {
2623             "mac-address": "f6:e0:43:b6:3a:b7",
2624             "vlan-id": 0,
2625             "port-id": "openflow:2:2"
2626           }
2627           ]
2628         },
2629           "mac-map-config": {
2630             "allowed-hosts": {
2631               "vlan-host-desc-list": [
2632               {
2633                 "host": "c6:44:22:ba:3e:72@0"
2634               },
2635               {
2636                 "host": "f6:e0:43:b6:3a:b7@0"
2637               }
2638               ]
2639             }
2640           }
2641       }
2642     }
2643
2644 .. note::
2645
2646     When Deny is configured a broadcast message is sent to all the hosts
2647     connected to the vBridge, so a two end communication need not be
2648     establihed like allow, the hosts can communicate directly without
2649     any two way communication enabled.
2650
2651 1. To Deny host h23 communication from hosts connected on vBridge1, the
2652    following configuration can be applied.
2653
2654 ::
2655
2656     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-mac-map:set-mac-map -d '{"input":{"operation": "SET", "denied-hosts": ["0a:d3:ea:3d:8f:a5@0"],"tenant-name": "Tenant1","bridge-name": "vBridge1"}}'
2657
2658 Cleaning Up
2659 ^^^^^^^^^^^
2660
2661 -  You can delete the virtual tenant Tenant1 by executing `the
2662    remove-vtn
2663    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#remove-vtn>`__.
2664
2665 ::
2666
2667     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"Tenant1"}}'
2668
2669 How To Configure Flowfilters
2670 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2671
2672 Overview
2673 ^^^^^^^^
2674
2675 -  This page explains how to provision flowfilter using VTN Manager.
2676    This page targets Beryllium release, so the procedure described here
2677    does not work in other releases.
2678
2679 -  The flow-filter function discards, permits, or redirects packets of
2680    the traffic within a VTN, according to specified flow conditions. The
2681    table below lists the actions to be applied when a packet matches the
2682    condition:
2683
2684 +-----------------------+----------------------------------------------------+
2685 | Action                | Function                                           |
2686 +=======================+====================================================+
2687 | Pass                  | | Permits the packet to pass along the determined  |
2688 |                       |   path.                                            |
2689 |                       | | As options, packet transfer priority (set        |
2690 |                       |   priority) and DSCP change (set ip-dscp) is       |
2691 |                       |   specified.                                       |
2692 +-----------------------+----------------------------------------------------+
2693 | Drop                  | Discards the packet.                               |
2694 +-----------------------+----------------------------------------------------+
2695 | Redirect              | | Redirects the packet to a desired virtual        |
2696 |                       |   interface.                                       |
2697 |                       | | As an option, it is possible to change the MAC   |
2698 |                       |   address when the packet is transferred.          |
2699 +-----------------------+----------------------------------------------------+
2700
2701 .. figure:: ./images/vtn/flow_filter_example.png
2702    :alt: Flow Filter Example
2703
2704    Flow Filter Example
2705
2706 -  Following steps explain flow-filter function:
2707
2708    -  when a packet is transferred to an interface within a virtual
2709       network, the flow-filter function evaluates whether the
2710       transferred packet matches the condition specifed in the
2711       flow-list.
2712
2713    -  If the packet matches the condition, the flow-filter applies the
2714       flow-list matching action specified in the flow-filter.
2715
2716 Requirements
2717 ^^^^^^^^^^^^
2718
2719 To apply the packet filter, configure the following:
2720
2721 -  Create a flow condition.
2722
2723 -  Specify where to apply the flow-filter, for example VTN, vBridge, or
2724    interface of vBridge.
2725
2726 To provision OpenFlow switches, this page uses Mininet. Mininet details
2727 and set-up can be referred at the below page:
2728 https://wiki.opendaylight.org/view/OpenDaylight_Controller:Installation#Using_Mininet
2729
2730 Start Mininet, and create three switches (s1, s2, and s3) and four hosts
2731 (h1, h2, h3 and h4) in it.
2732
2733 ::
2734
2735     sudo mn --controller=remote,ip=192.168.0.100 --topo tree,2
2736
2737 .. note::
2738
2739     Replace "192.168.0.100" with the IP address of OpenDaylight
2740     controller based on your environment.
2741
2742 You can check the topology that you have created by executing "net"
2743 command in the Mininet console.
2744
2745 ::
2746
2747      mininet> net
2748      h1 h1-eth0:s2-eth1
2749      h2 h2-eth0:s2-eth2
2750      h3 h3-eth0:s3-eth1
2751      h4 h4-eth0:s3-eth2
2752      s1 lo:  s1-eth1:s2-eth3 s1-eth2:s3-eth3
2753      s2 lo:  s2-eth1:h1-eth0 s2-eth2:h2-eth0 s2-eth3:s1-eth1
2754      s3 lo:  s3-eth1:h3-eth0 s3-eth2:h4-eth0 s3-eth3:s1-eth2
2755
2756 In this guide, you will provision flowfilters to establish communication
2757 between h1 and h3.
2758
2759 Configuration
2760 ^^^^^^^^^^^^^
2761
2762 To provision the virtual L2 network for the two hosts (h1 and h3),
2763 execute REST API provided by VTN Manager as follows. It uses curl
2764 command to call the REST API.
2765
2766 -  Create a virtual tenant named vtn1 by executing `the update-vtn
2767    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#update-vtn>`__.
2768
2769 ::
2770
2771     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:update-vtn -d '{"input":{"tenant-name":"vtn1"}}'
2772
2773 -  Create a virtual bridge named vbr1 in the tenant vtn1 by executing
2774    `the update-vbridge
2775    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge>`__.
2776
2777 ::
2778
2779     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"}}'
2780
2781 -  Create two interfaces into the virtual bridge by executing `the
2782    update-vinterface
2783    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
2784
2785 ::
2786
2787     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"}}'
2788
2789 ::
2790
2791     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"}}'
2792
2793 -  Configure two mappings on the interfaces by executing `the
2794    set-port-map
2795    RPC <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>`__.
2796
2797    -  The interface if1 of the virtual bridge will be mapped to the port
2798       "s2-eth1" of the switch "openflow:2" of the Mininet.
2799
2800       -  The h1 is connected to the port "s2-eth1".
2801
2802    -  The interface if2 of the virtual bridge will be mapped to the port
2803       "s3-eth1" of the switch "openflow:3" of the Mininet.
2804
2805       -  The h3 is connected to the port "s3-eth1".
2806
2807 ::
2808
2809     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"}}'
2810
2811 ::
2812
2813     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"}}'
2814
2815 -  Create flowcondition named cond\_1 by executing `the
2816    set-flow-condition
2817    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#set-flow-condition>`__.
2818
2819    -  For option source and destination-network, get inet address of
2820       host h1 and h3 from mininet.
2821
2822 ::
2823
2824     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"name":"cond_1", "vtn-flow-match":[{"vtn-ether-match":{},"vtn-inet-match":{"source-network":"10.0.0.1/32","protocol":1,"destination-network":"10.0.0.3/32"},"index":"1"}]}}'
2825
2826 -  Flowfilter can be applied either in VTN, VBR or VBR Interfaces. Here
2827    in this page we provision flowfilter with VBR Interface and
2828    demonstrate with action type drop and then pass.
2829
2830 -  Flow filter demonstration with DROP action-type. Create Flowfilter in
2831    VBR Interface if1 by executing `the set-flow-filter
2832    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter>`__.
2833
2834 ::
2835
2836     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input": {"tenant-name": "vtn1", "bridge-name": "vbr1","interface-name":"if1","vtn-flow-filter":[{"condition":"cond_1","vtn-drop-filter":{},"vtn-flow-action":[{"order": "1","vtn-set-inet-src-action":{"ipv4-address":"10.0.0.1/32"}},{"order": "2","vtn-set-inet-dst-action":{"ipv4-address":"10.0.0.3/32"}}],"index": "1"}]}}'
2837
2838 Verification of the drop filter
2839 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2840
2841 -  Please execute ping from h1 to h3. As we have applied the action type
2842    "drop" , ping should fail with no packet flows between hosts h1 and
2843    h3 as below,
2844
2845 ::
2846
2847      mininet> h1 ping h3
2848
2849 Configuration for pass filter
2850 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2851
2852 -  Update the flow filter to pass the packets by executing `the
2853    set-flow-filter
2854    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-filter.html#set-flow-filter>`__.
2855
2856 ::
2857
2858     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-filter:set-flow-filter -d '{"input": {"tenant-name": "vtn1", "bridge-name": "vbr1","interface-name":"if1","vtn-flow-filter":[{"condition":"cond_1","vtn-pass-filter":{},"vtn-flow-action":[{"order": "1","vtn-set-inet-src-action":{"ipv4-address":"10.0.0.1/32"}},{"order": "2","vtn-set-inet-dst-action":{"ipv4-address":"10.0.0.3/32"}}],"index": "1"}]}}'
2859
2860 Verification For Packets Success
2861 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2862
2863 -  As we have applied action type PASS now ping should happen between
2864    hosts h1 and h3.
2865
2866 ::
2867
2868      mininet> h1 ping h3
2869      PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
2870      64 bytes from 10.0.0.3: icmp_req=1 ttl=64 time=0.984 ms
2871      64 bytes from 10.0.0.3: icmp_req=2 ttl=64 time=0.110 ms
2872      64 bytes from 10.0.0.3: icmp_req=3 ttl=64 time=0.098 ms
2873
2874 -  You can also verify the configurations by executing the following
2875    REST API. It shows all configuration in VTN Manager.
2876
2877 ::
2878
2879     curl --user "admin":"admin" -H "Content-type: application/json" -X GET http://localhost:8181/restconf/operational/vtn:vtns/vtn/vtn1
2880
2881 ::
2882
2883     {
2884       "vtn": [
2885       {
2886         "name": "vtn1",
2887           "vtenant-config": {
2888             "hard-timeout": 0,
2889             "idle-timeout": 300,
2890             "description": "creating vtn"
2891           },
2892           "vbridge": [
2893           {
2894             "name": "vbr1",
2895             "vbridge-config": {
2896               "age-interval": 600,
2897               "description": "creating vBridge1"
2898             },
2899             "bridge-status": {
2900               "state": "UP",
2901               "path-faults": 0
2902             },
2903             "vinterface": [
2904             {
2905               "name": "if1",
2906               "vinterface-status": {
2907                 "mapped-port": "openflow:2:1",
2908                 "state": "UP",
2909                 "entity-state": "UP"
2910               },
2911               "port-map-config": {
2912                 "vlan-id": 0,
2913                 "node": "openflow:2",
2914                 "port-name": "s2-eth1"
2915               },
2916               "vinterface-config": {
2917                 "description": "Creating if1 interface",
2918                 "enabled": true
2919               },
2920               "vinterface-input-filter": {
2921                 "vtn-flow-filter": [
2922                 {
2923                   "index": 1,
2924                   "condition": "cond_1",
2925                   "vtn-flow-action": [
2926                   {
2927                     "order": 1,
2928                     "vtn-set-inet-src-action": {
2929                       "ipv4-address": "10.0.0.1/32"
2930                     }
2931                   },
2932                   {
2933                     "order": 2,
2934                     "vtn-set-inet-dst-action": {
2935                       "ipv4-address": "10.0.0.3/32"
2936                     }
2937                   }
2938                   ],
2939                     "vtn-pass-filter": {}
2940                 },
2941                 {
2942                   "index": 10,
2943                   "condition": "cond_1",
2944                   "vtn-drop-filter": {}
2945                 }
2946                 ]
2947               }
2948             },
2949             {
2950               "name": "if2",
2951               "vinterface-status": {
2952                 "mapped-port": "openflow:3:1",
2953                 "state": "UP",
2954                 "entity-state": "UP"
2955               },
2956               "port-map-config": {
2957                 "vlan-id": 0,
2958                 "node": "openflow:3",
2959                 "port-name": "s3-eth1"
2960               },
2961               "vinterface-config": {
2962                 "description": "Creating if2 interface",
2963                 "enabled": true
2964               }
2965             }
2966             ]
2967           }
2968         ]
2969       }
2970       ]
2971     }
2972
2973 Cleaning Up
2974 ^^^^^^^^^^^
2975
2976 -  To clean up both VTN and flowcondition.
2977
2978 -  You can delete the virtual tenant vtn1 by executing `the remove-vtn
2979    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#remove-vtn>`__.
2980
2981 ::
2982
2983     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"vtn1"}}'
2984
2985 -  You can delete the flowcondition cond\_1 by executing `the
2986    remove-flow-condition
2987    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#remove-flow-condition>`__.
2988
2989 ::
2990
2991     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:remove-flow-condition -d '{"input":{"name":"cond_1"}}'
2992
2993 How to use VTN to change the path of the packet flow
2994 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2995
2996 Overview
2997 ^^^^^^^^
2998
2999 -  This page explains how to create specific VTN Pathmap using VTN
3000    Manager. This page targets Beryllium release, so the procedure
3001    described here does not work in other releases.
3002
3003 .. figure:: ./images/vtn/Pathmap.png
3004    :alt: Pathmap
3005
3006    Pathmap
3007
3008 Requirement
3009 ^^^^^^^^^^^
3010
3011 -  Save the mininet script given below as pathmap\_test.py and run the
3012    mininet script in the mininet environment where Mininet is installed.
3013
3014 -  Create topology using the below mininet script:
3015
3016 ::
3017
3018      from mininet.topo import Topo
3019      class MyTopo( Topo ):
3020         "Simple topology example."
3021         def __init__( self ):
3022             "Create custom topo."
3023             # Initialize topology
3024             Topo.__init__( self )
3025             # Add hosts and switches
3026             leftHost = self.addHost( 'h1' )
3027             rightHost = self.addHost( 'h2' )
3028             leftSwitch = self.addSwitch( 's1' )
3029             middleSwitch = self.addSwitch( 's2' )
3030             middleSwitch2 = self.addSwitch( 's4' )
3031             rightSwitch = self.addSwitch( 's3' )
3032             # Add links
3033             self.addLink( leftHost, leftSwitch )
3034             self.addLink( leftSwitch, middleSwitch )
3035             self.addLink( leftSwitch, middleSwitch2 )
3036             self.addLink( middleSwitch, rightSwitch )
3037             self.addLink( middleSwitch2, rightSwitch )
3038             self.addLink( rightSwitch, rightHost )
3039      topos = { 'mytopo': ( lambda: MyTopo() ) }
3040
3041 -  After creating new file with the above script start the mininet as
3042    below,
3043
3044 ::
3045
3046     sudo mn --controller=remote,ip=10.106.138.124 --custom pathmap_test.py --topo mytopo
3047
3048 .. note::
3049
3050     Replace "10.106.138.124" with the IP address of OpenDaylight
3051     controller based on your environment.
3052
3053 ::
3054
3055      mininet> net
3056      h1 h1-eth0:s1-eth1
3057      h2 h2-eth0:s3-eth3
3058      s1 lo:  s1-eth1:h1-eth0 s1-eth2:s2-eth1 s1-eth3:s4-eth1
3059      s2 lo:  s2-eth1:s1-eth2 s2-eth2:s3-eth1
3060      s3 lo:  s3-eth1:s2-eth2 s3-eth2:s4-eth2 s3-eth3:h2-eth0
3061      s4 lo:  s4-eth1:s1-eth3 s4-eth2:s3-eth2
3062      c0
3063
3064 -  Generate traffic by pinging between host h1 and host h2 before
3065    creating the portmaps respectively.
3066
3067 ::
3068
3069      mininet> h1 ping h2
3070      PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
3071      From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
3072      From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
3073      From 10.0.0.1 icmp_seq=3 Destination Host Unreachable
3074      From 10.0.0.1 icmp_seq=4 Destination Host Unreachable
3075
3076 Configuration
3077 ^^^^^^^^^^^^^
3078
3079 -  To change the path of the packet flow, execute REST API provided by
3080    VTN Manager as follows. It uses curl command to call the REST API.
3081
3082 -  Create a virtual tenant named vtn1 by executing `the update-vtn
3083    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#update-vtn>`__.
3084
3085 ::
3086
3087     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:update-vtn -d '{"input":{"tenant-name":"vtn1"}}'
3088
3089 -  Create a virtual bridge named vbr1 in the tenant vtn1 by executing
3090    `the update-vbridge
3091    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vbridge.html#update-vbridge>`__.
3092
3093 ::
3094
3095     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"}}'
3096
3097 -  Create two interfaces into the virtual bridge by executing `the
3098    update-vinterface
3099    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-vinterface.html#update-vinterface>`__.
3100
3101 ::
3102
3103     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"}}'
3104
3105 ::
3106
3107     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"}}'
3108
3109 -  Configure two mappings on the interfaces by executing `the
3110    set-port-map
3111    RPC <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>`__.
3112
3113    -  The interface if1 of the virtual bridge will be mapped to the port
3114       "s2-eth1" of the switch "openflow:1" of the Mininet.
3115
3116       -  The h1 is connected to the port "s1-eth1".
3117
3118    -  The interface if2 of the virtual bridge will be mapped to the port
3119       "s3-eth1" of the switch "openflow:3" of the Mininet.
3120
3121       -  The h3 is connected to the port "s3-eth3".
3122
3123 ::
3124
3125     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:1", "port-name":"s1-eth1"}}'
3126
3127 ::
3128
3129     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-eth3"}}'
3130
3131 -  Genarate traffic by pinging between host h1 and host h2 after
3132    creating the portmaps respectively.
3133
3134 ::
3135
3136      mininet> h1 ping h2
3137      PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
3138      64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.861 ms
3139      64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.101 ms
3140      64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.101 ms
3141
3142 -  Get the Dataflows information by executing `the get-data-flow
3143    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow.html#get-data-flow>`__.
3144
3145 ::
3146
3147     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow:get-data-flow -d '{"input":{"tenant-name":"vtn1","mode":"DETAIL","node":"openflow:1","data-flow-port":{"port-id":1,"port-name":"s1-eth1"}}}'
3148
3149 -  Create flowcondition named cond\_1 by executing `the
3150    set-flow-condition
3151    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#set-flow-condition>`__.
3152
3153    -  For option source and destination-network, get inet address of
3154       host h1 or host h2 from mininet
3155
3156 ::
3157
3158     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"operation":"SET","present":"false","name":"cond_1", "vtn-flow-match":[{"vtn-ether-match":{},"vtn-inet-match":{"source-network":"10.0.0.1/32","protocol":1,"destination-network":"10.0.0.2/32"},"index":"1"}]}}'
3159
3160 -  Create pathmap with flowcondition cond\_1 by executing `the
3161    set-path-map
3162    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-path-map.html#set-path-map>`__.
3163
3164 ::
3165
3166     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-path-map:set-path-map -d '{"input":{"tenant-name":"vtn1","path-map-list":[{"condition":"cond_1","policy":"1","index": "1","idle-timeout":"300","hard-timeout":"0"}]}}'
3167
3168 -  Create pathpolicy by executing `the set-path-policy
3169    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-path-policy.html#set-path-policy>`__.
3170
3171 ::
3172
3173     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-path-policy:set-path-policy -d '{"input":{"operation":"SET","id": "1","default-cost": "10000","vtn-path-cost": [{"port-desc":"openflow:1,3,s1-eth3","cost":"1000"},{"port-desc":"openflow:4,2,s4-eth2","cost":"1000"},{"port-desc":"openflow:3,3,s3-eth3","cost":"100000"}]}}'
3174
3175 Verification
3176 ^^^^^^^^^^^^
3177
3178 -  Before applying Path policy get node information by executing get
3179    dataflow command.
3180
3181 ::
3182
3183     "data-flow-info": [
3184     {
3185       "physical-route": [
3186       {
3187         "physical-ingress-port": {
3188           "port-name": "s3-eth3",
3189             "port-id": "3"
3190         },
3191           "physical-egress-port": {
3192             "port-name": "s3-eth1",
3193             "port-id": "1"
3194           },
3195           "node": "openflow:3",
3196           "order": 0
3197       },
3198       {
3199         "physical-ingress-port": {
3200           "port-name": "s2-eth2",
3201           "port-id": "2"
3202         },
3203         "physical-egress-port": {
3204           "port-name": "s2-eth1",
3205           "port-id": "1"
3206         },
3207         "node": "openflow:2",
3208         "order": 1
3209       },
3210       {
3211         "physical-ingress-port": {
3212           "port-name": "s1-eth2",
3213           "port-id": "2"
3214         },
3215         "physical-egress-port": {
3216           "port-name": "s1-eth1",
3217           "port-id": "1"
3218         },
3219         "node": "openflow:1",
3220         "order": 2
3221       }
3222       ],
3223         "data-egress-node": {
3224           "interface-name": "if1",
3225           "bridge-name": "vbr1",
3226           "tenant-name": "vtn1"
3227         },
3228         "data-egress-port": {
3229           "node": "openflow:1",
3230           "port-name": "s1-eth1",
3231           "port-id": "1"
3232         },
3233         "data-ingress-node": {
3234           "interface-name": "if2",
3235           "bridge-name": "vbr1",
3236           "tenant-name": "vtn1"
3237         },
3238         "data-ingress-port": {
3239           "node": "openflow:3",
3240           "port-name": "s3-eth3",
3241           "port-id": "3"
3242         },
3243         "flow-id": 32
3244       },
3245     }
3246
3247 -  After applying Path policy get node information by executing get
3248    dataflow command.
3249
3250 ::
3251
3252     "data-flow-info": [
3253     {
3254       "physical-route": [
3255       {
3256         "physical-ingress-port": {
3257           "port-name": "s1-eth1",
3258             "port-id": "1"
3259         },
3260           "physical-egress-port": {
3261             "port-name": "s1-eth3",
3262             "port-id": "3"
3263           },
3264           "node": "openflow:1",
3265           "order": 0
3266       },
3267       {
3268         "physical-ingress-port": {
3269           "port-name": "s4-eth1",
3270           "port-id": "1"
3271         },
3272         "physical-egress-port": {
3273           "port-name": "s4-eth2",
3274           "port-id": "2"
3275         },
3276         "node": "openflow:4",
3277         "order": 1
3278       },
3279       {
3280         "physical-ingress-port": {
3281           "port-name": "s3-eth2",
3282           "port-id": "2"
3283         },
3284         "physical-egress-port": {
3285           "port-name": "s3-eth3",
3286           "port-id": "3"
3287         },
3288         "node": "openflow:3",
3289         "order": 2
3290       }
3291       ],
3292         "data-egress-node": {
3293           "interface-name": "if2",
3294           "bridge-name": "vbr1",
3295           "tenant-name": "vtn1"
3296         },
3297         "data-egress-port": {
3298           "node": "openflow:3",
3299           "port-name": "s3-eth3",
3300           "port-id": "3"
3301         },
3302         "data-ingress-node": {
3303           "interface-name": "if1",
3304           "bridge-name": "vbr1",
3305           "tenant-name": "vtn1"
3306         },
3307         "data-ingress-port": {
3308           "node": "openflow:1",
3309           "port-name": "s1-eth1",
3310           "port-id": "1"
3311         },
3312     }
3313
3314 Cleaning Up
3315 ^^^^^^^^^^^
3316
3317 -  To clean up both VTN and flowcondition.
3318
3319 -  You can delete the virtual tenant vtn1 by executing `the remove-vtn
3320    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn.html#remove-vtn>`__.
3321
3322 ::
3323
3324     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn:remove-vtn -d '{"input":{"tenant-name":"vtn1"}}'
3325
3326 -  You can delete the flowcondition cond\_1 by executing `the
3327    remove-flow-condition
3328    RPC <https://jenkins.opendaylight.org/releng/view/vtn/job/vtn-merge-beryllium/lastSuccessfulBuild/artifact/manager/model/target/site/models/vtn-flow-condition.html#remove-flow-condition>`__.
3329
3330 ::
3331
3332     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:remove-flow-condition -d '{"input":{"name":"cond_1"}}'
3333
3334 VTN Coordinator Usage Examples
3335 ------------------------------
3336
3337 How to configure L2 Network with Single Controller
3338 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3339
3340 Overview
3341 ^^^^^^^^
3342
3343 This example provides the procedure to demonstrate configuration of VTN
3344 Coordinator with L2 network using VTN Virtualization(single controller).
3345 Here is the Example for vBridge Interface Mapping with Single Controller
3346 using mininet. mininet details and set-up can be referred at below URL:
3347 https://wiki.opendaylight.org/view/OpenDaylight_Controller:Installation#Using_Mininet
3348
3349 .. figure:: ./images/vtn/vtn-single-controller-topology-example.png
3350    :alt: EXAMPLE DEMONSTRATING SINGLE CONTROLLER
3351
3352    EXAMPLE DEMONSTRATING SINGLE CONTROLLER
3353
3354 Requirements
3355 ^^^^^^^^^^^^
3356
3357 -  Configure mininet and create a topology:
3358
3359 ::
3360
3361     mininet@mininet-vm:~$ sudo mn --controller=remote,ip=<controller-ip> --topo tree,2
3362
3363 -  mininet> net
3364
3365 ::
3366
3367      s1 lo:  s1-eth1:h1-eth0 s1-eth2:s2-eth1
3368      s2 lo:  s2-eth1:s1-eth2 s2-eth2:h2-eth0
3369      h1 h1-eth0:s1-eth1
3370      h2 h2-eth0:s2-eth2
3371
3372 Configuration
3373 ^^^^^^^^^^^^^
3374
3375 -  Create a Controller named controllerone and mention its ip-address in
3376    the below create-controller command.
3377
3378 ::
3379
3380     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
3381
3382 -  Create a VTN named vtn1 by executing the create-vtn command
3383
3384 ::
3385
3386     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
3387
3388 -  Create a vBridge named vBridge1 in the vtn1 by executing the
3389    create-vbr command.
3390
3391 ::
3392
3393      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
3394
3395 -  Create two Interfaces named if1 and if2 into the vBridge1
3396
3397 ::
3398
3399     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
3400
3401 ::
3402
3403     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
3404
3405 -  Get the list of logical ports configured
3406
3407 ::
3408
3409     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
3410
3411 -  Configure two mappings on each of the interfaces by executing the
3412    below command.
3413
3414 The interface if1 of the virtual bridge will be mapped to the port
3415 "s2-eth1" of the switch "openflow:2" of the Mininet. The h1 is connected
3416 to the port "s2-eth1".
3417
3418 The interface if2 of the virtual bridge will be mapped to the port
3419 "s3-eth1" of the switch "openflow:3" of the Mininet. The h3 is connected
3420 to the port "s3-eth1".
3421
3422 ::
3423
3424     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
3425     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
3426
3427 Verification
3428 ^^^^^^^^^^^^
3429
3430 Please verify whether the Host1 and Host3 are pinging.
3431
3432 -  Send packets from Host1 to Host3
3433
3434 ::
3435
3436      mininet> h1 ping h3
3437      PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
3438      64 bytes from 10.0.0.3: icmp_req=1 ttl=64 time=0.780 ms
3439      64 bytes from 10.0.0.3: icmp_req=2 ttl=64 time=0.079 ms
3440
3441 How to configure L2 Network with Multiple Controllers
3442 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3443
3444 -  This example provides the procedure to demonstrate configuration of
3445    VTN Coordinator with L2 network using VTN Virtualization Here is the
3446    Example for vBridge Interface Mapping with Multi-controller using
3447    mininet.
3448
3449 .. figure:: ./images/vtn/MutiController_Example_diagram.png
3450    :alt: EXAMPLE DEMONSTRATING MULTIPLE CONTROLLERS
3451
3452    EXAMPLE DEMONSTRATING MULTIPLE CONTROLLERS
3453
3454 Requirements
3455 ^^^^^^^^^^^^
3456
3457 -  Configure multiple controllers using the mininet script given below:
3458    https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_%28VTN%29:Scripts:Mininet#Network_with_multiple_switches_and_OpenFlow_controllers
3459
3460 Configuration
3461 ^^^^^^^^^^^^^
3462
3463 -  Create a VTN named vtn3 by executing the create-vtn command
3464
3465 ::
3466
3467     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"vtn" : {"vtn_name":"vtn3"}}' http://127.0.0.1:8083/vtn-webapi/vtns.json
3468
3469 -  Create two Controllers named odc1 and odc2 with its ip-address in the
3470    below create-controller command.
3471
3472 ::
3473
3474     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"controller": {"controller_id": "odc1", "ipaddr":"10.100.9.52", "type": "odc", "version": "1.0", "auditstatus":"enable"}}' http://127.0.0.1:8083/vtn-webapi/controllers.json
3475
3476 ::
3477
3478     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"controller": {"controller_id": "odc2", "ipaddr":"10.100.9.61", "type": "odc", "version": "1.0", "auditstatus":"enable"}}' http://127.0.0.1:8083/vtn-webapi/controllers.json
3479
3480 -  Create two vBridges in the VTN like, vBridge1 in Controller1 and
3481    vBridge2 in Controller2
3482
3483 ::
3484
3485      curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"vbridge" : {"vbr_name":"vbr1","controller_id":"odc1","domain_id":"(DEFAULT)" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vbridges.json
3486
3487 ::
3488
3489     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"vbridge" : {"vbr_name":"vbr2","controller_id":"odc2","domain_id":"(DEFAULT)" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vbridges.json
3490
3491 -  Create two Interfaces if1, if2 for the two vBridges vbr1 and vbr2.
3492
3493 ::
3494
3495     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"interface": {"if_name": "if1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vbridges/vbr1/interfaces.json
3496
3497 ::
3498
3499     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"interface": {"if_name": "if2"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vbridges/vbr1/interfaces.json
3500
3501 ::
3502
3503     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"interface": {"if_name": "if1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vbridges/vbr2/interfaces.json
3504
3505 ::
3506
3507     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"interface": {"if_name": "if2"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vbridges/vbr2/interfaces.json
3508
3509 -  Get the list of logical ports configured
3510
3511 ::
3512
3513     curl --user admin:adminpass -H 'content-type: application/json' -X GET http://127.0.0.1:8083/vtn-webapi/controllers/odc1/domains/\(DEFAULT\)/logical_ports/detail.json
3514
3515 -  Create boundary and vLink for the two controllers
3516
3517 ::
3518
3519     curl --user admin:adminpass -H 'content-type: application/json'   -X POST -d '{"boundary": {"boundary_id": "b1", "link": {"controller1_id": "odc1", "domain1_id": "(DEFAULT)", "logical_port1_id": "PP-OF:00:00:00:00:00:00:00:01-s1-eth3", "controller2_id": "odc2", "domain2_id": "(DEFAULT)", "logical_port2_id": "PP-OF:00:00:00:00:00:00:00:04-s4-eth3"}}}' http://127.0.0.1:8083/vtn-webapi/boundaries.json
3520
3521 ::
3522
3523     curl --user admin:adminpass -H 'content-type: application/json'  -X POST -d '{"vlink": {"vlk_name": "vlink1" , "vnode1_name": "vbr1", "if1_name":"if2", "vnode2_name": "vbr2", "if2_name": "if2", "boundary_map": {"boundary_id":"b1","vlan_id": "50"}}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vlinks.json
3524
3525 -  Configure two mappings on each of the interfaces by executing the
3526    below command.
3527
3528 The interface if1 of the vbr1 will be mapped to the port "s2-eth2" of
3529 the switch "openflow:2" of the Mininet. The h2 is connected to the port
3530 "s2-eth2".
3531
3532 The interface if2 of the vbr2 will be mapped to the port "s5-eth2" of
3533 the switch "openflow:5" of the Mininet. The h6 is connected to the port
3534 "s5-eth2".
3535
3536 ::
3537
3538     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-eth2"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vbridges/vbr1/interfaces/if1/portmap.json
3539
3540 ::
3541
3542     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:05-s5-eth2"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn3/vbridges/vbr2/interfaces/if1/portmap.json
3543
3544 Verification
3545 ^^^^^^^^^^^^
3546
3547 Please verify whether Host h2 and Host h6 are pinging.
3548
3549 -  Send packets from h2 to h6
3550
3551 ::
3552
3553     mininet> h2 ping h6
3554
3555 ::
3556
3557      PING 10.0.0.6 (10.0.0.3) 56(84) bytes of data.
3558      64 bytes from 10.0.0.6: icmp_req=1 ttl=64 time=0.780 ms
3559      64 bytes from 10.0.0.6: icmp_req=2 ttl=64 time=0.079 ms
3560
3561 How To Test Vlan-Map In Mininet Environment
3562 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3563
3564 Overview
3565 ^^^^^^^^
3566
3567 This example explains how to test vlan-map in a multi host scenario.
3568
3569 .. figure:: ./images/vtn/vlanmap_using_mininet.png
3570    :alt: Example that demonstrates vlanmap testing in Mininet
3571    Environment
3572
3573    Example that demonstrates vlanmap testing in Mininet Environment
3574
3575 Requirements
3576 ^^^^^^^^^^^^
3577
3578 -  Save the mininet script given below as vlan\_vtn\_test.py and run the
3579    mininet script in the mininet environment where Mininet is installed.
3580
3581 Mininet Script
3582 ^^^^^^^^^^^^^^
3583
3584 https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Scripts:Mininet#Network_with_hosts_in_different_vlan
3585
3586 -  Run the mininet script
3587
3588 ::
3589
3590     sudo mn --controller=remote,ip=192.168.64.13 --custom vlan_vtn_test.py --topo mytopo
3591
3592 Configuration
3593 ^^^^^^^^^^^^^
3594
3595 Please follow the below steps to test a vlan map using mininet:
3596
3597 -  Create a Controller named controllerone and mention its ip-address in
3598    the below create-controller command.
3599
3600 ::
3601
3602     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
3603
3604 -  Create a VTN named vtn1 by executing the create-vtn command
3605
3606 ::
3607
3608     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
3609
3610 -  Create a vBridge named vBridge1 in the vtn1 by executing the
3611    create-vbr command.
3612
3613 ::
3614
3615     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
3616
3617 -  Create a vlan map with vlanid 200 for vBridge vBridge1
3618
3619 ::
3620
3621     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
3622
3623 -  Create a vBridge named vBridge2 in the vtn1 by executing the
3624    create-vbr command.
3625
3626 ::
3627
3628     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
3629
3630 -  Create a vlan map with vlanid 300 for vBridge vBridge2
3631
3632 ::
3633
3634     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
3635
3636 Verification
3637 ^^^^^^^^^^^^
3638
3639 Ping all in mininet environment to view the host reachability.
3640
3641 ::
3642
3643     mininet> pingall
3644     Ping: testing ping reachability
3645     h1 -> X h3 X h5 X
3646     h2 -> X X h4 X h6
3647     h3 -> h1 X X h5 X
3648     h4 -> X h2 X X h6
3649     h5 -> h1 X h3 X X
3650     h6 -> X h2 X h4 X
3651
3652 How To View Specific VTN Station Information.
3653 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3654
3655 This example demonstrates on how to view a specific VTN Station
3656 information.
3657
3658 .. figure:: ./images/vtn/vtn_stations.png
3659    :alt: EXAMPLE DEMONSTRATING VTN STATIONS
3660
3661    EXAMPLE DEMONSTRATING VTN STATIONS
3662
3663 Requirement
3664 ^^^^^^^^^^^
3665
3666 -  Configure mininet and create a topology:
3667
3668 ::
3669
3670      $ sudo mn --custom /home/mininet/mininet/custom/topo-2sw-2host.py --controller=remote,ip=10.100.9.61 --topo mytopo
3671     mininet> net
3672
3673      s1 lo:  s1-eth1:h1-eth0 s1-eth2:s2-eth1
3674      s2 lo:  s2-eth1:s1-eth2 s2-eth2:h2-eth0
3675      h1 h1-eth0:s1-eth1
3676      h2 h2-eth0:s2-eth2
3677
3678 -  Generate traffic by pinging between hosts h1 and h2 after configuring
3679    the portmaps respectively
3680
3681 ::
3682
3683      mininet> h1 ping h2
3684      PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
3685      64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=16.7 ms
3686      64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=13.2 ms
3687
3688 Configuration
3689 ^^^^^^^^^^^^^
3690
3691 -  Create a Controller named controllerone and mention its ip-address in
3692    the below create-controller command
3693
3694 ::
3695
3696     curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"controller": {"controller_id": "controllerone", "ipaddr":"10.100.9.61", "type": "odc", "version": "1.0", "auditstatus":"enable"}}' http://127.0.0.1:8083/vtn-webapi/controllers.json
3697
3698 -  Create a VTN named vtn1 by executing the create-vtn command
3699
3700 ::
3701
3702     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
3703
3704 -  Create a vBridge named vBridge1 in the vtn1 by executing the
3705    create-vbr command.
3706
3707 ::
3708
3709     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
3710
3711 -  Create two Interfaces named if1 and if2 into the vBridge1
3712
3713 ::
3714
3715     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
3716     curl -v --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
3717
3718 -  Configure two mappings on each of the interfaces by executing the
3719    below command.
3720
3721 The interface if1 of the virtual bridge will be mapped to the port
3722 "s1-eth1" of the switch "openflow:1" of the Mininet. The h1 is connected
3723 to the port "s1-eth1".
3724
3725 The interface if2 of the virtual bridge will be mapped to the port
3726 "s1-eth2" of the switch "openflow:1" of the Mininet. The h2 is connected
3727 to the port "s1-eth2".
3728
3729 ::
3730
3731     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:01-s1-eth1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces/if1/portmap.json
3732     curl -v --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-eth2"}}' http://17.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces/if2/portmap.json
3733
3734 -  Get the VTN stations information
3735
3736 ::
3737
3738     curl -X GET -H 'content-type: application/json' -H 'username: admin' -H 'password: adminpass' "http://127.0.0.1:8083/vtn-webapi/vtnstations?controller_id=controllerone&vtn_name=vtn1"
3739
3740 Verification
3741 ^^^^^^^^^^^^
3742
3743 ::
3744
3745     curl -X GET -H 'content-type: application/json' -H 'username: admin' -H 'password: adminpass' "http://127.0.0.1:8083/vtn-webapi/vtnstations?controller_id=controllerone&vtn_name=vtn1"
3746     {
3747        "vtnstations": [
3748            {
3749                "domain_id": "(DEFAULT)",
3750                "interface": {},
3751                "ipaddrs": [
3752                    "10.0.0.2"
3753                ],
3754                "macaddr": "b2c3.06b8.2dac",
3755                "no_vlan_id": "true",
3756                "port_name": "s2-eth2",
3757                "station_id": "178195618445172",
3758                "switch_id": "00:00:00:00:00:00:00:02",
3759                "vnode_name": "vBridge1",
3760                "vnode_type": "vbridge",
3761                "vtn_name": "vtn1"
3762            },
3763            {
3764                "domain_id": "(DEFAULT)",
3765                "interface": {},
3766                "ipaddrs": [
3767                    "10.0.0.1"
3768                ],
3769                "macaddr": "ce82.1b08.90cf",
3770                "no_vlan_id": "true",
3771                "port_name": "s1-eth1",
3772                "station_id": "206130278144207",
3773                "switch_id": "00:00:00:00:00:00:00:01",
3774                "vnode_name": "vBridge1",
3775                "vnode_type": "vbridge",
3776                "vtn_name": "vtn1"
3777            }
3778        ]
3779     }
3780
3781 How To View Dataflows in VTN
3782 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3783
3784 This example demonstrates on how to view a specific VTN Dataflow
3785 information.
3786
3787 Configuration
3788 ^^^^^^^^^^^^^
3789
3790 The same Configuration as Vlan Mapping
3791 Example(\ https://wiki.opendaylight.org/view/VTN:Coordinator:Beryllium:HowTos:How_To_test_vlanmap_using_mininet)
3792
3793 Verification
3794 ^^^^^^^^^^^^
3795
3796 Get the VTN Dataflows information
3797
3798 ::
3799
3800     curl -X GET -H 'content-type: application/json' --user 'admin:adminpass' "http://127.0.0.1:8083/vtn-webapi/dataflows?controller_id=controllerone&srcmacaddr=924c.e4a3.a743&vlan_id=300&switch_id=openflow:2&port_name=s2-eth1"
3801
3802 ::
3803
3804     {
3805        "dataflows": [
3806            {
3807                "controller_dataflows": [
3808                    {
3809                        "controller_id": "controllerone",
3810                        "controller_type": "odc",
3811                        "egress_domain_id": "(DEFAULT)",
3812                        "egress_port_name": "s3-eth3",
3813                        "egress_station_id": "3",
3814                        "egress_switch_id": "00:00:00:00:00:00:00:03",
3815                        "flow_id": "29",
3816                        "ingress_domain_id": "(DEFAULT)",
3817                        "ingress_port_name": "s2-eth2",
3818                        "ingress_station_id": "2",
3819                        "ingress_switch_id": "00:00:00:00:00:00:00:02",
3820                        "match": {
3821                            "macdstaddr": [
3822                                "4298.0959.0e0b"
3823                            ],
3824                            "macsrcaddr": [
3825                                "924c.e4a3.a743"
3826                            ],
3827                            "vlan_id": [
3828                                "300"
3829                            ]
3830                        },
3831                        "pathinfos": [
3832                            {
3833                                "in_port_name": "s2-eth2",
3834                                "out_port_name": "s2-eth1",
3835                                "switch_id": "00:00:00:00:00:00:00:02"
3836                            },
3837                            {
3838                                "in_port_name": "s1-eth2",
3839                                "out_port_name": "s1-eth3",
3840                                "switch_id": "00:00:00:00:00:00:00:01"
3841                            },
3842                            {
3843                                "in_port_name": "s3-eth1",
3844                                "out_port_name": "s3-eth3",
3845                                "switch_id": "00:00:00:00:00:00:00:03"
3846                            }
3847                        ]
3848                    }
3849                ],
3850                "reason": "success"
3851            }
3852        ]
3853     }
3854
3855 How To Configure Flow Filters Using VTN
3856 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3857
3858 Overview
3859 ^^^^^^^^
3860
3861 The flow-filter function discards, permits, or redirects packets of the
3862 traffic within a VTN, according to specified flow conditions The table
3863 below lists the actions to be applied when a packet matches the
3864 condition:
3865
3866 +--------------------------------------+--------------------------------------+
3867 | Action                               | Function                             |
3868 +--------------------------------------+--------------------------------------+
3869 | Pass                                 | Permits the packet to pass. As       |
3870 |                                      | options, packet transfer priority    |
3871 |                                      | (set priority) and DSCP change (se t |
3872 |                                      | ip-dscp) is specified.               |
3873 +--------------------------------------+--------------------------------------+
3874 | Drop                                 | Discards the packet.                 |
3875 +--------------------------------------+--------------------------------------+
3876 | Redirect                             | Redirects the packet to a desired    |
3877 |                                      | virtual interface. As an option, it  |
3878 |                                      | is possible to change the MAC        |
3879 |                                      | address when the packet is           |
3880 |                                      | transferred.                         |
3881 +--------------------------------------+--------------------------------------+
3882
3883 .. figure:: ./images/vtn/flow_filter_example.png
3884    :alt: Flow Filter
3885
3886    Flow Filter
3887
3888 Following steps explain flow-filter function:
3889
3890 -  When a packet is transferred to an interface within a virtual
3891    network, the flow-filter function evaluates whether the transferred
3892    packet matches the condition specified in the flow-list.
3893
3894 -  If the packet matches the condition, the flow-filter applies the
3895    flow-list matching action specified in the flow-filter.
3896
3897 Requirements
3898 ^^^^^^^^^^^^
3899
3900 To apply the packet filter, configure the following:
3901
3902 -  Create a flow-list and flow-listentry.
3903
3904 -  Specify where to apply the flow-filter, for example VTN, vBridge, or
3905    interface of vBridge.
3906
3907 Configure mininet and create a topology:
3908
3909 ::
3910
3911     $  mininet@mininet-vm:~$ sudo mn --controller=remote,ip=<controller-ip> --topo tree
3912
3913 Please generate the following topology
3914
3915 ::
3916
3917     $  mininet@mininet-vm:~$ sudo mn --controller=remote,ip=<controller-ip> --topo tree,2
3918     mininet> net
3919     c0
3920     s1 lo:  s1-eth1:s2-eth3 s1-eth2:s3-eth3
3921     s2 lo:  s2-eth1:h1-eth0 s2-eth2:h2-eth0 s2-eth3:s1-eth1
3922     s3 lo:  s3-eth1:h3-eth0 s3-eth2:h4-eth0 s3-eth3:s1-eth2
3923     h1 h1-eth0:s2-eth1
3924     h2 h2-eth0:s2-eth2
3925     h3 h3-eth0:s3-eth1
3926     h4 h4-eth0:s3-eth2
3927
3928 Configuration
3929 ^^^^^^^^^^^^^
3930
3931 -  Create a Controller named controller1 and mention its ip-address in
3932    the below create-controller command.
3933
3934 ::
3935
3936     curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"controller": {"controller_id": "controller1", "ipaddr":"10.100.9.61", "type": "odc", "version": "1.0", "auditstatus":"enable"}}' http://127.0.0.1:8083/vtn-webapi/controllers
3937
3938 -  Create a VTN named vtn\_one by executing the create-vtn command
3939
3940 ::
3941
3942     curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"vtn" : {"vtn_name":"vtn_one","description":"test VTN" }}' http://127.0.0.1:8083/vtn-webapi/vtns.json
3943
3944 -  Create a vBridge named vbr\_two in the vtn1 by executing the
3945    create-vbr command.
3946
3947 ::
3948
3949     curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"vbridge" : {"vbr_name":"vbr_one^C"controller_id":"controller1","domain_id":"(DEFAULT)" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn_one/vbridges.json
3950     curl -v --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"vbridge" :
3951     {"vbr_name":"vbr_two","controller_id":"controller1","domain_id":"(DEFAULT)" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn_one/vbridges.json
3952
3953 -  Create two Interfaces named if1 and if2 into the vbr\_two
3954
3955 ::
3956
3957     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/vtn_one/vbridges/vbr_two/interfaces.json
3958     curl -v --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/vtn_one/vbridges/vbr_two/interfaces.json
3959
3960 -  Get the list of logical ports configured
3961
3962 ::
3963
3964     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
3965
3966 -  Configure two mappings on each of the interfaces by executing the
3967    below command.
3968
3969 The interface if1 of the virtual bridge will be mapped to the port
3970 "s2-eth1" of the switch "openflow:2" of the Mininet. The h1 is connected
3971 to the port "s2-eth1".
3972
3973 The interface if2 of the virtual bridge will be mapped to the port
3974 "s3-eth1" of the switch "openflow:3" of the Mininet. The h3 is connected
3975 to the port "s3-eth1".
3976
3977 ::
3978
3979     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/vtn_one/vbridges/vbr_two/interfaces/if1/portmap.json
3980     curl -v --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/vtn_one/vbridges/vbr_two/interfaces/if2/portmap.json
3981
3982 -  Create Flowlist
3983
3984 ::
3985
3986     curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"flowlist": {"fl_name": "flowlist1", "ip_version":"IP"}}' http://127.0.0.1:8083/vtn-webapi/flowlists.json
3987
3988 -  Create Flowlistentry
3989
3990 ::
3991
3992     curl --user admin:adminpass -H 'content-type: application/json' -X POST -d '{"flowlistentry": {"seqnum": "233","macethertype": "0x8000","ipdstaddr": "10.0.0.3","ipdstaddrprefix": "2","ipsrcaddr": "10.0.0.2","ipsrcaddrprefix": "2","ipproto": "17","ipdscp": "55","icmptypenum":"232","icmpcodenum": "232"}}' http://127.0.0.1:8083/vtn-webapi/flowlists/flowlist1/flowlistentries.json
3993
3994 -  Create vBridge Interface Flowfilter
3995
3996 ::
3997
3998     curl --user admin:adminpass -X POST -H 'content-type: application/json' -d '{"flowfilter" : {"ff_type": "in"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_two/interfaces/if1/flowfilters.json
3999
4000 Flow filter demonstration with DROP action-type
4001 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4002
4003 ::
4004
4005     curl --user admin:adminpass -X POST -H 'content-type: application/json' -d '{"flowfilterentry": {"seqnum": "233", "fl_name": "flowlist1", "action_type":"drop", "priority":"3", "dscp":"55" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_two/interfaces/if1/flowfilters/in/flowfilterentries.json
4006
4007 Verification
4008 ^^^^^^^^^^^^
4009
4010 As we have applied the action type "drop" , ping should fail.
4011
4012 ::
4013
4014     mininet> h1 ping h3
4015     PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
4016     From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
4017     From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
4018
4019 Flow filter demonstration with PASS action-type
4020 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4021
4022 ::
4023
4024     curl --user admin:adminpass -X PUT -H 'content-type: application/json' -d '{"flowfilterentry": {"seqnum": "233", "fl_name": "flowlist1", "action_type":"pass", "priority":"3", "dscp":"55" }}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn_one/vbridges/vbr_two/interfaces/if1/flowfilters/in/flowfilterentries/233.json
4025
4026 Verification
4027 ^^^^^^^^^^^^
4028
4029 ::
4030
4031     mininet> h1 ping h3
4032     PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
4033     64 bytes from 10.0.0.3: icmp_req=1 ttl=64 time=0.984 ms
4034     64 bytes from 10.0.0.3: icmp_req=2 ttl=64 time=0.110 ms
4035     64 bytes from 10.0.0.3: icmp_req=3 ttl=64 time=0.098 ms
4036
4037 How To Use VTN To Make Packets Take Different Paths
4038 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4039
4040 This example demonstrates on how to create a specific VTN Path Map
4041 information.
4042
4043 .. figure:: ./images/vtn/Pathmap.png
4044    :alt: PathMap
4045
4046    PathMap
4047
4048 Requirement
4049 ^^^^^^^^^^^
4050
4051 -  Save the mininet script given below as pathmap\_test.py and run the
4052    mininet script in the mininet environment where Mininet is installed.
4053
4054 -  Create topology using the below mininet script:
4055
4056 ::
4057
4058      from mininet.topo import Topo
4059      class MyTopo( Topo ):
4060         "Simple topology example."
4061         def __init__( self ):
4062             "Create custom topo."
4063             # Initialize topology
4064             Topo.__init__( self )
4065             # Add hosts and switches
4066             leftHost = self.addHost( 'h1' )
4067             rightHost = self.addHost( 'h2' )
4068             leftSwitch = self.addSwitch( 's1' )
4069             middleSwitch = self.addSwitch( 's2' )
4070             middleSwitch2 = self.addSwitch( 's4' )
4071             rightSwitch = self.addSwitch( 's3' )
4072             # Add links
4073             self.addLink( leftHost, leftSwitch )
4074             self.addLink( leftSwitch, middleSwitch )
4075             self.addLink( leftSwitch, middleSwitch2 )
4076             self.addLink( middleSwitch, rightSwitch )
4077             self.addLink( middleSwitch2, rightSwitch )
4078             self.addLink( rightSwitch, rightHost )
4079      topos = { 'mytopo': ( lambda: MyTopo() ) }
4080
4081 ::
4082
4083      mininet> net
4084      c0
4085      s1 lo:  s1-eth1:h1-eth0 s1-eth2:s2-eth1 s1-eth3:s4-eth1
4086      s2 lo:  s2-eth1:s1-eth2 s2-eth2:s3-eth1
4087      s3 lo:  s3-eth1:s2-eth2 s3-eth2:s4-eth2 s3-eth3:h2-eth0
4088      s4 lo:  s4-eth1:s1-eth3 s4-eth2:s3-eth2
4089      h1 h1-eth0:s1-eth1
4090      h2 h2-eth0:s3-eth3
4091
4092 -  Generate traffic by pinging between hosts h1 and h2 before creating
4093    the portmaps respectively
4094
4095 ::
4096
4097       mininet> h1 ping h2
4098       PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
4099       From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
4100       From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
4101       From 10.0.0.1 icmp_seq=3 Destination Host Unreachable
4102       From 10.0.0.1 icmp_seq=4 Destination Host Unreachable
4103
4104 Configuration
4105 ^^^^^^^^^^^^^
4106
4107 -  Create a Controller named controller1 and mention its ip-address in
4108    the below create-controller command.
4109
4110 ::
4111
4112     curl --user admin:adminpass -H 'content-type: application/json'  -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
4113
4114 -  Create a VTN named vtn1 by executing the create-vtn command
4115
4116 ::
4117
4118     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
4119
4120 -  Create a vBridge named vBridge1 in the vtn1 by executing the
4121    create-vbr command.
4122
4123 ::
4124
4125     curl --user admin:adminpass -H 'content-type: application/json'  -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
4126
4127 -  Create two Interfaces named if1 and if2 into the vBridge1
4128
4129 ::
4130
4131     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
4132     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
4133
4134 -  Configure two mappings on each of the interfaces by executing the
4135    below command.
4136
4137 The interface if1 of the virtual bridge will be mapped to the port
4138 "s1-eth1" of the switch "openflow:1" of the Mininet. The h1 is connected
4139 to the port "s1-eth1".
4140
4141 The interface if2 of the virtual bridge will be mapped to the port
4142 "s3-eth3" of the switch "openflow:3" of the Mininet. The h2 is connected
4143 to the port "s3-eth3".
4144
4145 ::
4146
4147     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:01-s1-eth1"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces/if1/portmap.json
4148     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-eth3"}}' http://127.0.0.1:8083/vtn-webapi/vtns/vtn1/vbridges/vBridge1/interfaces/if2/portmap.json
4149
4150 -  Generate traffic by pinging between hosts h1 and h2 after creating
4151    the portmaps respectively
4152
4153 ::
4154
4155       mininet> h1 ping h2
4156       PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
4157       64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=36.4 ms
4158       64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.880 ms
4159       64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=0.073 ms
4160       64 bytes from 10.0.0.2: icmp_req=4 ttl=64 time=0.081 ms
4161
4162 -  Get the VTN Dataflows information
4163
4164 ::
4165
4166     curl -X GET -H 'content-type: application/json' --user 'admin:adminpass' "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"
4167
4168 -  Create a Flowcondition in the VTN
4169
4170 **(The flowconditions, pathmap and pathpolicy commands have to be
4171 executed in the controller).**
4172
4173 ::
4174
4175     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-flow-condition:set-flow-condition -d '{"input":{"operation":"SET","present":"false","name":"cond_1", "vtn-flow-match":[{"vtn-ether-match":{},"vtn-inet-match":{"source-network":"10.0.0.1/32","protocol":1,"destination-network":"10.0.0.2/32"},"index":"1"}]}}'
4176
4177 -  Create a Pathmap in the VTN
4178
4179 ::
4180
4181     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-path-map:set-path-map -d '{"input":{"tenant-name":"vtn1","path-map-list":[{"condition":"cond_1","policy":"1","index": "1","idle-timeout":"300","hard-timeout":"0"}]}}'
4182
4183 -  Get the Path policy information
4184
4185 ::
4186
4187     curl --user "admin":"admin" -H "Content-type: application/json" -X POST http://localhost:8181/restconf/operations/vtn-path-policy:set-path-policy -d '{"input":{"operation":"SET","id": "1","default-cost": "10000","vtn-path-cost": [{"port-desc":"openflow:1,3,s1-eth3","cost":"1000"},{"port-desc":"openflow:4,2,s4-eth2","cost":"100000"},{"port-desc":"openflow:3,3,s3-eth3","cost":"10000"}]}}'
4188
4189 Verification
4190 ^^^^^^^^^^^^
4191
4192 -  Before applying Path policy information in the VTN
4193
4194 ::
4195
4196     {
4197             "pathinfos": [
4198                 {
4199                   "in_port_name": "s1-eth1",
4200                   "out_port_name": "s1-eth3",
4201                   "switch_id": "openflow:1"
4202                 },
4203                 {
4204                   "in_port_name": "s4-eth1",
4205                   "out_port_name": "s4-eth2",
4206                   "switch_id": "openflow:4"
4207                 },
4208                 {
4209                    "in_port_name": "s3-eth2",
4210                    "out_port_name": "s3-eth3",
4211                    "switch_id": "openflow:3"
4212                 }
4213                          ]
4214     }
4215
4216 -  After applying Path policy information in the VTN
4217
4218 ::
4219
4220     {
4221         "pathinfos": [
4222                 {
4223                   "in_port_name": "s1-eth1",
4224                   "out_port_name": "s1-eth2",
4225                   "switch_id": "openflow:1"
4226                 },
4227                 {
4228                   "in_port_name": "s2-eth1",
4229                   "out_port_name": "s2-eth2",
4230                   "switch_id": "openflow:2"
4231                 },
4232                 {
4233                    "in_port_name": "s3-eth1",
4234                    "out_port_name": "s3-eth3",
4235                    "switch_id": "openflow:3"
4236                 }
4237                          ]
4238     }
4239
4240 VTN Coordinator(Troubleshooting HowTo)
4241 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4242
4243 Overview
4244 ^^^^^^^^
4245
4246 This page demonstrates Installation troubleshooting steps of VTN
4247 Coordinator. OpenDaylight VTN provides multi-tenant virtual network
4248 functions on OpenDaylight controllers. OpenDaylight VTN consists of two
4249 parts:
4250
4251 -  VTN Coordinator.
4252
4253 -  VTN Manager.
4254
4255 VTN Coordinator orchestrates multiple VTN Managers running in
4256 OpenDaylight Controllers, and provides VTN Applications with VTN API.
4257 VTN Manager is OSGi bundles running in OpenDaylight Controller. Current
4258 VTN Manager supports only OpenFlow switches. It handles PACKET\_IN
4259 messages, sends PACKET\_OUT messages, manages host information, and
4260 installs flow entries into OpenFlow switches to provide VTN Coordinator
4261 with virtual network functions. The requirements for installing these
4262 two are different.Therefore, we recommend that you install VTN Manager
4263 and VTN Coordinator in different machines.
4264
4265 List of installation Troubleshooting How to’s
4266 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4267
4268 -  https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Installation:VTN_Coordinator
4269
4270 **After executing db\_setup, you have encountered the error "Failed to
4271 setup database"?**
4272
4273 The error could be due to the below reasons
4274
4275 -  Access Restriction
4276
4277 The user who owns /usr/local/vtn/ directory and installs VTN
4278 Coordinator, can only start db\_setup. Example :
4279
4280 ::
4281
4282       The directory should appear as below (assuming the user as "vtn"):
4283       # ls -l /usr/local/
4284         drwxr-xr-x. 12 vtn  vtn  4096 Mar 14 21:53 vtn
4285       If the user doesnot own /usr/local/vtn/ then, please run the below command (assuming the username as vtn),
4286                   chown -R vtn:vtn /usr/local/vtn
4287
4288 -  Postgres not Present
4289
4290 ::
4291
4292     1. In case of Fedora/CentOS/RHEL, please check if /usr/pgsql/<version> directory is present and also ensure the commands initdb, createdb,pg_ctl,psql are working. If, not please re-install postgres packages
4293     2. In case of Ubuntu, check if /usr/lib/postgres/<version> directory is present and check for the commands as in the previous step.
4294
4295 -  Not enough space to create tables
4296
4297 ::
4298
4299     Please check df -k and ensure enough free space is available.
4300
4301 -  If the above steps do not solve the problem, please refer to the log
4302    file for the exact problem
4303
4304 ::
4305
4306     /usr/local/vtn/var/dbm/unc_setup_db.log for the exact error.
4307
4308 -  list of VTN Coordinator processes
4309
4310 -  Run the below command ensure the Coordinator daemons are running.
4311
4312 ::
4313
4314            Command:     /usr/local/vtn/bin/unc_dmctl status
4315            Name              Type           IPC Channel       PID
4316         -----------       -----------      --------------     ------
4317             drvodcd         DRIVER           drvodcd           15972
4318             lgcnwd         LOGICAL           lgcnwd            16010
4319             phynwd         PHYSICAL          phynwd            15996
4320
4321 -  Issue the curl command to fetch version and ensure the process is
4322    able to respond.
4323
4324 **How to debug a startup failure?.**
4325
4326 The following activities take place in order during startup
4327
4328 -  Database server is started after setting virtual memory to required
4329    value,Any database startup errors will be reflected in any of the
4330    below logs.
4331
4332 ::
4333
4334              /usr/local/vtn/var/dbm/unc_db_script.log.
4335              /usr/local/vtn/var/db/pg_log/postgresql-*.log (the pattern will have the date)
4336
4337 -  uncd daemon is kicked off, The daemon in turn kicks off the rest of
4338    the daemons.
4339
4340 ::
4341
4342       Any  uncd startup failures will be reflected in /usr/local/vtn/var/uncd/uncd_start.err.
4343
4344 After setting up the apache tomcat server, what are the aspects that should be checked.
4345 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
4346
4347 **Please check if catalina is running..**
4348
4349 ::
4350
4351         The command ps -ef | grep catalina | grep -v grep should list a catalina process
4352
4353 **If you encounter an erroneous situation where the REST API is always
4354 failing..**
4355
4356 ::
4357
4358       Please ensure the firewall settings for port:8181(Beryllium release) or port:8083(Post Beryllium release) and enable the same.
4359
4360 **How to debug a REST API returning a failure message?.**
4361
4362 Please check the /usr/share/java/apache-tomcat-7.0.39/logs/core/core.log
4363 for failure details.
4364
4365 **REST API for VTN configuration fails, how to debug?.**
4366
4367 The default log level for all daemons is "INFO", to debug the situation
4368 TRACE or DEBUG logs may be needed. To increase the log level for
4369 individual daemons, please use the commands suggested below
4370
4371 ::
4372
4373       /usr/local/vtn/bin/lgcnw_control loglevel trace -- upll daemon log
4374        /usr/local/vtn/bin/phynw_control loglevel trace -- uppl daemon log
4375        /usr/local/vtn/bin/unc_control loglevel trace -- uncd daemon log
4376        /usr/local/vtn/bin/drvodc_control loglevel trace -- Driver daemon log
4377
4378 After setting the log levels, the operation can be repeated and the log
4379 files can be referred for debugging.
4380
4381 **Problems while Installing PostgreSQL due to openssl.**
4382
4383 Errors may occur when trying to install postgreSQL rpms. Recently
4384 PostgreSQL has upgraded all their binaries to use the latest openssl
4385 versions with fix for http://en.wikipedia.org/wiki/Heartbleed Please
4386 upgrade the openssl package to the latest version and re-install. For
4387 RHEL 6.1/6.4 : If you have subscription, Please use the same and update
4388 the rpms. The details are available in the following link
4389 https://access.redhat.com/site/solutions/781793 ACCESS-REDHAT
4390
4391 ::
4392
4393       rpm -Uvh http://mirrors.kernel.org/centos/6/os/x86_64/Packages/openssl-1.0.1e-15.el6.x86_64.rpm
4394       rpm -ivh http://mirrors.kernel.org/centos/6/os/x86_64/Packages/openssl-devel-1.0.1e-15.el6.x86_64.rpm
4395
4396 For other linux platforms, Please do yum update, the public respositroes
4397 will have the latest openssl, please install the same.
4398
4399 Support for Microsoft SCVMM 2012 R2 with ODL VTN
4400 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4401
4402 Introduction
4403 ^^^^^^^^^^^^
4404
4405 System Center Virtual Machine Manager (SCVMM) is Microsoft’s virtual
4406 machine support center for window’s based emulations. SCVMM is a
4407 management solution for the virtualized data center. You can use it to
4408 configure and manage your virtualization host, networking, and storage
4409 resources in order to create and deploy virtual machines and services to
4410 private clouds that you have created.
4411
4412 The VSEM Provider is a plug-in to bridge between SCVMM and OpenDaylight.
4413
4414 Microsoft Hyper-V is a server virtualization developed by Microsoft,
4415 which provides virtualization services through hypervisor-based
4416 emulations.
4417
4418 .. figure:: ./images/vtn/setup_diagram_SCVMM.png
4419    :alt: Set-Up Diagram
4420
4421    Set-Up Diagram
4422
4423 **The topology used in this set-up is:**
4424
4425 -  A SCVMM with VSEM Provider installed and a running VTN Coordinator
4426    and OpenDaylight with VTN Feature installed.
4427
4428 -  PF1000 virtual switch extension has been installed in the two Hyper-V
4429    servers as it implements the OpenFlow capability in Hyper-V.
4430
4431 -  Three OpenFlow switches simulated using mininet and connected to
4432    Hyper-V.
4433
4434 -  Four VM’s hosted using SCVMM.
4435
4436 **It is implemented as two major components:**
4437
4438 -  SCVMM
4439
4440 -  OpenDaylight (VTN Feature)
4441
4442 -  VTN Coordinator
4443
4444 VTN Coordinator
4445 ^^^^^^^^^^^^^^^
4446
4447 OpenDaylight VTN as Network Service provider for SCVMM where VSEM
4448 provider is added in the Network Service which will handle all requests
4449 from SCVMM and communicate with the VTN Coordinator. It is used to
4450 manage the network virtualization provided by OpenDaylight.
4451
4452 Installing HTTPS in VTN Coordinator
4453 '''''''''''''''''''''''''''''''''''
4454
4455 -  System Center Virtual Machine Manager (SCVMM) supports only https
4456    protocol.
4457
4458 **Apache Portable Runtime (APR) Installation Steps**
4459
4460 -  Enter the command "yum install **apr**" in VTN Coordinator installed
4461    machine.
4462
4463 -  In /usr/bin, create a soft link as "ln –s /usr/bin/apr-1-config
4464    /usr/bin/apr-config".
4465
4466 -  Extract tomcat under "/usr/share/java" by using the below command
4467    "tar -xvf apache-tomcat-8.0.27.tar.gz –C /usr/share/java".
4468
4469 .. note::
4470
4471     Please go through the bleow link to download
4472     apache-tomcat-8.0.27.tar.gz file,
4473     https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.27/bin/
4474
4475 -  Please go to the directory "cd
4476    /usr/share/java/apache-tomcat-8.0.27/bin and unzip tomcat-native.gz
4477    using this command "tar -xvf tomcat-native.gz".
4478
4479 -  Go to the directory "cd
4480    /usr/share/java/apache-tomcat-8.0.27/bin/tomcat-native-1.1.33-src/jni/native".
4481
4482 -  Enter the command "./configure --with-os-type=bin
4483    --with-apr=/usr/bin/apr-config".
4484
4485 -  Enter the command "make" and "make install".
4486
4487 -  Apr libraries are successfully installed in "/usr/local/apr/lib".
4488
4489 **Enable HTTP/HTTPS in VTN Coordinator**
4490
4491 Enter the command "firewall-cmd --zone=public --add-port=8083/tcp
4492 --permanent" and "firewall-cmd --reload" to enable firewall settings in
4493 server.
4494
4495 **Create a CA’s private key and a self-signed certificate in server**
4496
4497 -  Execute the following command "openssl req -x509 -days 365
4498    -extensions v3\_ca -newkey rsa:2048 –out /etc/pki/CA/cacert.pem
4499    –keyout /etc/pki/CA/private/cakey.pem" in a single line.
4500
4501 +-----------------------+----------------------------------------------------+
4502 | Argument              | Description                                        |
4503 +=======================+====================================================+
4504 | Country Name          | | Specify the country code.                        |
4505 |                       | | For example, JP                                  |
4506 +-----------------------+----------------------------------------------------+
4507 | State or Province     | | Specify the state or province.                   |
4508 | Name                  | | For example, Tokyo                               |
4509 +-----------------------+----------------------------------------------------+
4510 | Locality Name         | | Locality Name                                    |
4511 |                       | | For example, Chuo-Ku                             |
4512 +-----------------------+----------------------------------------------------+
4513 | Organization Name     | Specify the company.                               |
4514 +-----------------------+----------------------------------------------------+
4515 | Organizational Unit   | Specify the department, division, or the like.     |
4516 | Name                  |                                                    |
4517 +-----------------------+----------------------------------------------------+
4518 | Common Name           | Specify the host name.                             |
4519 +-----------------------+----------------------------------------------------+
4520 | Email Address         | Specify the e-mail address.                        |
4521 +-----------------------+----------------------------------------------------+
4522
4523 -  Execute the following commands: "touch /etc/pki/CA/index.txt" and
4524    "echo 00 > /etc/pki/CA/serial" in server after setting your CA’s
4525    private key.
4526
4527 **Create a private key and a CSR for web server**
4528
4529 -  Execute the following command "openssl req -new -newkey rsa:2048 -out
4530    csr.pem –keyout /usr/local/vtn/tomcat/conf/key.pem" in a single line.
4531
4532 -  Enter the PEM pass phrase: Same password you have given in CA’s
4533    private key PEM pass phrase.
4534
4535 +-----------------------+----------------------------------------------------+
4536 | Argument              | Description                                        |
4537 +=======================+====================================================+
4538 | Country Name          | | Specify the country code.                        |
4539 |                       | | For example, JP                                  |
4540 +-----------------------+----------------------------------------------------+
4541 | State or Province     | | Specify the state or province.                   |
4542 | Name                  | | For example, Tokyo                               |
4543 +-----------------------+----------------------------------------------------+
4544 | Locality Name         | | Locality Name                                    |
4545 |                       | | For example, Chuo-Ku                             |
4546 +-----------------------+----------------------------------------------------+
4547 | Organization Name     | Specify the company.                               |
4548 +-----------------------+----------------------------------------------------+
4549 | Organizational Unit   | Specify the department, division, or the like.     |
4550 | Name                  |                                                    |
4551 +-----------------------+----------------------------------------------------+
4552 | Common Name           | Specify the host name.                             |
4553 +-----------------------+----------------------------------------------------+
4554 | Email Address         | Specify the e-mail address.                        |
4555 +-----------------------+----------------------------------------------------+
4556 | A challenge password  | Specify the challenge password.                    |
4557 +-----------------------+----------------------------------------------------+
4558 | An optional company   | Specify an optional company name.                  |
4559 | name                  |                                                    |
4560 +-----------------------+----------------------------------------------------+
4561
4562 **Create a certificate for web server**
4563
4564 -  Execute the following command "openssl ca –in csr.pem –out
4565    /usr/local/vtn/tomcat/conf/cert.pem –days 365 –batch" in a single
4566    line.
4567
4568 -  Enter pass phrase for /etc/pki/CA/private/cakey.pem: Same password
4569    you have given in CA’s private key PEM pass phrase.
4570
4571 -  Open the tomcat file using "vim /usr/local/vtn/tomcat/bin/tomcat".
4572
4573 -  Include the line " TOMCAT\_PROPS="$TOMCAT\_PROPS
4574    -Djava.library.path=\\"/usr/local/apr/lib\\"" " in 131th line and
4575    save the file.
4576
4577 **Edit server.xml file and restart the server**
4578
4579 -  Open the server.xml file using "vim
4580    /usr/local/vtn/tomcat/conf/server.xml" and add the below lines.
4581
4582    ::
4583
4584        <Connector port="${vtn.port}" protocol="HTTP/1.1" SSLEnabled="true"
4585        maxThreads="150" scheme="https" secure="true"
4586        SSLCertificateFile="/usr/local/vtn/tomcat/conf/cert.pem"
4587        SSLCertificateKeyFile="/usr/local/vtn/tomcat/conf/key.pem"
4588        SSLPassword=same password you have given in CA's private key PEM pass phrase
4589        connectionTimeout="20000" />
4590
4591 -  Save the file and restart the server.
4592
4593 -  To stop vtn use the following command.
4594
4595    ::
4596
4597        /usr/local/vtn/bin/vtn_stop
4598
4599 -  To start vtn use the following command.
4600
4601    ::
4602
4603        /usr/local/vtn/bin/vtn_start
4604
4605 -  Copy the created CA certificate from cacert.pem to cacert.crt by
4606    using the following command,
4607
4608    ::
4609
4610        openssl x509 –in /etc/pki/CA/cacert.pem –out cacert.crt
4611
4612    **Checking the HTTP and HTTPS connection from client**
4613
4614 -  You can check the HTTP connection by using the following command:
4615
4616    ::
4617
4618        curl -X GET -H 'contenttype:application/json' -H 'username:admin' -H 'password:adminpass' http://<server IP address>:8083/vtn-webapi/api_version.json
4619
4620 -  You can check the HTTPS connection by using the following command:
4621
4622    ::
4623
4624        curl -X GET -H 'contenttype:application/json' -H 'username:admin' -H 'password:adminpass' https://<server IP address>:8083/vtn-webapi/api_version.json --cacert /etc/pki/CA/cacert.pem
4625
4626 -  The response should be like this for both HTTP and HTTPS:
4627
4628    ::
4629
4630        {"api_version":{"version":"V1.4"}}
4631
4632 Prerequisites to create Network Service in SCVMM machine, Please follow the below steps
4633 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4634
4635 1.  Please go through the below link to download VSEM Provider zip file,
4636     https://nexus.opendaylight.org/content/groups/public/org/opendaylight/vtn/application/vtnmanager-vsemprovider/2.0.0-Beryllium/vtnmanager-vsemprovider-2.0.0-Beryllium-bin.zip
4637
4638 2.  Unzip the vtnmanager-vsemprovider-2.0.0-Beryllium-bin.zip file
4639     anywhere in your SCVMM machine.
4640
4641 3.  Stop SCVMM service from **"service manager→tools→servers→select
4642     system center virtual machine manager"** and click stop.
4643
4644 4.  Go to **"C:/Program Files"** in your SCVMM machine. Inside
4645     **"C:/Program Files"**, create a folder named as **"ODLProvider"**.
4646
4647 5.  Inside **"C:/Program Files/ODLProvider"**, create a folder named as
4648     "Module" in your SCVMM machine.
4649
4650 6.  Inside "C:/Program Files/ODLProvider/Module", Create two folders
4651     named as **"Odl.VSEMProvider"** and **"VSEMOdlUI"** in your SCVMM
4652     machine.
4653
4654 7.  Copy the **"VSEMOdl.dll"** file from
4655     **"ODL\_SCVMM\_PROVIDER/ODL\_VSEM\_PROVIDER"** to **"C:/Program
4656     Files/ODLProvider/Module/Odl.VSEMProvider"** in your SCVMM machine.
4657
4658 8.  Copy the **"VSEMOdlProvider.psd1"** file from
4659     **"application/vsemprovider/VSEMOdlProvider/VSEMOdlProvider.psd1"**
4660     to **"C:/Program Files/ODLProvider/Module/Odl.VSEMProvider"** in
4661     your SCVMM machine.
4662
4663 9.  Copy the **"VSEMOdlUI.dll"** file from
4664     **"ODL\_SCVMM\_PROVIDER/ODL\_VSEM\_PROVIDER\_UI"** to **"C:/Program
4665     Files/ODLProvider/Module/VSEMOdlUI"** in your SCVMM machine.
4666
4667 10. Copy the **"VSEMOdlUI.psd1"** file from
4668     **"application/vsemprovider/VSEMOdlUI"** to **"C:/Program
4669     Files/ODLProvider/Module/VSEMOdlUI"** in your SCVMM machine.
4670
4671 11. Copy the **"reg\_entry.reg"** file from
4672     **"ODL\_SCVMM\_PROVIDER/Register\_settings"** to your SCVMM desktop
4673     and double click the **"reg\_entry.reg"** file to install registry
4674     entry in your SCVMM machine.
4675
4676 12. Download **"PF1000.msi"** from this link,
4677     https://www.pf-info.com/License/en/index.php?url=index/index_non_buyer
4678     and place into **"C:/Program Files/Switch Extension Drivers"** in
4679     your SCVMM machine.
4680
4681 13. Start SCVMM service from **"service manager→tools→servers→select
4682     system center virtual machine manager"** and click start.
4683
4684 System Center Virtual Machine Manager (SCVMM)
4685 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4686
4687 It supports two major features:
4688
4689 -  Failover Clustering
4690
4691 -  Live Migration
4692
4693 Failover Clustering
4694 '''''''''''''''''''
4695
4696 A single Hyper-V can host a number of virtual machines. If the host were
4697 to fail then all of the virtual machines that are running on it will
4698 also fail, thereby resulting in a major outage. Failover clustering
4699 treats individual virtual machines as clustered resources. If a host
4700 were to fail then clustered virtual machines are able to fail over to a
4701 different Hyper-V server where they can continue to run.
4702
4703 Live Migration
4704 ''''''''''''''
4705
4706 Live Migration is used to migrate the running virtual machines from one
4707 Hyper-V server to another Hyper-V server without any interruptions.
4708 Please go through the below video for more details,
4709
4710 -  https://youtu.be/34YMOTzbNJM
4711
4712 SCVMM User Guide
4713 ^^^^^^^^^^^^^^^^
4714
4715 -  Please go through the below link for SCVMM user guide:
4716    https://wiki.opendaylight.org/images/c/ca/ODL_SCVMM_USER_GUIDE_final.pdf
4717
4718 -  Please go through the below links for more details
4719
4720    -  OpenDaylight SCVMM VTN Integration: https://youtu.be/iRt4dxtiz94
4721
4722    -  OpenDaylight Congestion Control with SCVMM VTN:
4723       https://youtu.be/34YMOTzbNJM
4724