86255805f51274352ff5a5901798200b60be3042
[lispflowmapping.git] / docs / user-guide.rst
1 .. _lispflowmapping-user-guide:
2
3 LISP Flow Mapping User Guide
4 ============================
5
6 Overview
7 --------
8
9 Locator/ID Separation Protocol
10 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11
12 `Locator/ID Separation Protocol
13 (LISP) <http://tools.ietf.org/html/rfc6830>`__ is a technology that
14 provides a flexible map-and-encap framework that can be used for overlay
15 network applications such as data center network virtualization and
16 Network Function Virtualization (NFV).
17
18 LISP provides the following name spaces:
19
20 -  `Endpoint Identifiers
21    (EIDs) <http://tools.ietf.org/html/rfc6830#page-6>`__
22
23 -  `Routing Locators
24    (RLOCs) <http://tools.ietf.org/html/rfc6830#section-3>`__
25
26 In a virtualization environment EIDs can be viewed as virtual address
27 space and RLOCs can be viewed as physical network address space.
28
29 The LISP framework decouples network control plane from the forwarding
30 plane by providing:
31
32 -  A data plane that specifies how the virtualized network addresses are
33    encapsulated in addresses from the underlying physical network.
34
35 -  A control plane that stores the mapping of the virtual-to-physical
36    address spaces, the associated forwarding policies and serves this
37    information to the data plane on demand.
38
39 Network programmability is achieved by programming forwarding policies
40 such as transparent mobility, service chaining, and traffic engineering
41 in the mapping system; where the data plane elements can fetch these
42 policies on demand as new flows arrive. This chapter describes the LISP
43 Flow Mapping project in OpenDaylight and how it can be used to enable
44 advanced SDN and NFV use cases.
45
46 LISP data plane Tunnel Routers are available at
47 `OpenOverlayRouter.org <http://www.openoverlayrouter.org/>`__ in the open source community on
48 the following platforms:
49
50 -  Linux
51
52 -  Android
53
54 -  OpenWRT
55
56 For more details and support for LISP data plane software please visit
57 `the OOR web site <http://www.openoverlayrouter.org/>`__.
58
59 LISP Flow Mapping Service
60 ~~~~~~~~~~~~~~~~~~~~~~~~~
61
62 The LISP Flow Mapping service provides LISP Mapping System services.
63 This includes LISP Map-Server and LISP Map-Resolver services to store
64 and serve mapping data to data plane nodes as well as to OpenDaylight
65 applications. Mapping data can include mapping of virtual addresses to
66 physical network address where the virtual nodes are reachable or hosted
67 at. Mapping data can also include a variety of routing policies
68 including traffic engineering and load balancing. To leverage this
69 service, OpenDaylight applications and services can use the northbound
70 REST API to define the mappings and policies in the LISP Mapping
71 Service. Data plane devices capable of LISP control protocol can
72 leverage this service through a southbound LISP plugin. LISP-enabled
73 devices must be configured to use this OpenDaylight service as their Map
74 Server and/or Map Resolver.
75
76 The southbound LISP plugin supports the LISP control protocol
77 (Map-Register, Map-Request, Map-Reply messages), and can also be used to
78 register mappings in the OpenDaylight mapping service.
79
80 LISP Flow Mapping Architecture
81 ------------------------------
82
83 The following figure shows the various LISP Flow Mapping modules.
84
85 .. figure:: ./images/ODL_lfm_Be_component.jpg
86    :alt: LISP Mapping Service Internal Architecture
87
88    LISP Mapping Service Internal Architecture
89
90 A brief description of each module is as follows:
91
92 -  **DAO (Data Access Object):** This layer separates the LISP logic
93    from the database, so that we can separate the map server and map
94    resolver from the specific implementation of the mapping database.
95    Currently we have an implementation of this layer with an in-memory
96    HashMap, but it can be switched to any other key/value store and you
97    only need to implement the ILispDAO interface.
98
99 -  **Map Server:** This module processes the adding or registration of
100    authentication tokens (keys) and mappings. For a detailed
101    specification of LISP Map Server, see
102    `LISP <http://tools.ietf.org/search/rfc6830>`__.
103
104 -  **Map Resolver:** This module receives and processes the mapping
105    lookup queries and provides the mappings to requester. For a detailed
106    specification of LISP Map Server, see
107    `LISP <http://tools.ietf.org/search/rfc6830>`__.
108
109 -  **RPC/RESTCONF:** This is the auto-generated RESTCONF-based
110    northbound API. This module enables defining key-EID associations as
111    well as adding mapping information through the Map Server. Key-EID
112    associations and mappings can also be queried via this API.
113
114 -  **Neutron:** This module implements the OpenDaylight Neutron Service
115    APIs. It provides integration between the LISP service and the
116    OpenDaylight Neutron service, and thus OpenStack.
117
118 -  **Java API:** The API module exposes the Map Server and Map Resolver
119    capabilities via a Java API.
120
121 -  **LISP Proto:** This module includes LISP protocol dependent data
122    types and associated processing.
123
124 -  **In Memory DB:** This module includes the in memory database
125    implementation of the mapping service.
126
127 -  **LISP Southbound Plugin:** This plugin enables data plane devices
128    that support LISP control plane protocol (see
129    `LISP <http://tools.ietf.org/search/rfc6830>`__) to register and
130    query mappings to the LISP Flow Mapping via the LISP control plane
131    protocol.
132
133 .. _lfm_config:
134
135 Configuring LISP Flow Mapping
136 -----------------------------
137
138 In order to use the LISP mapping service for registering EID to RLOC
139 mappings from northbound or southbound, keys have to be defined for the
140 EID prefixes first. Once a key is defined for an EID prefix, it can be
141 used to add mappings for that EID prefix multiple times. If the service
142 is going to be used to process Map-Register messages from the southbound
143 LISP plugin, the same key must be used by the data plane device to
144 create the authentication data in the Map-Register messages for the
145 associated EID prefix.
146
147 The ``etc/custom.properties`` file in the Karaf distribution allows
148 configuration of several OpenDaylight parameters. The LISP service has
149 the following properties that can be adjusted:
150
151 **lisp.smr** (default: *true*)
152     Enables/disables the `Solicit-Map-Request
153     (SMR) <http://tools.ietf.org/html/rfc6830#section-6.6.2>`__
154     functionality. SMR is a method to notify changes in an EID-to-RLOC
155     mapping to "subscribers". The LISP service considers all
156     Map-Request’s source RLOC as a subscriber to the requested EID
157     prefix, and will send an SMR control message to that RLOC if the
158     mapping changes.
159
160 **lisp.elpPolicy** (default: *default*)
161     Configures how to build a Map-Reply southbound message from a
162     mapping containing an Explicit Locator Path (ELP) RLOC. It is used
163     for compatibility with dataplane devices that don’t understand the
164     ELP LCAF format. The *default* setting doesn’t alter the mapping,
165     returning all RLOCs unmodified. The *both* setting adds a new RLOC
166     to the mapping, with a lower priority than the ELP, that is the next
167     hop in the service chain. To determine the next hop, it searches the
168     source RLOC of the Map-Request in the ELP, and chooses the next hop,
169     if it exists, otherwise it chooses the first hop. The *replace*
170     setting adds a new RLOC using the same algorithm as the *both*
171     setting, but using the origin priority of the ELP RLOC, which is
172     removed from the mapping.
173
174 **lisp.lookupPolicy** (default: *northboundFirst*)
175     Configures the mapping lookup algorithm. When set to
176     *northboundFirst* mappings programmed through the northbound API
177     will take precedence. If no northbound programmed mappings exist,
178     then the mapping service will return mappings registered through the
179     southbound plugin, if any exists. When set to
180     *northboundAndSouthbound* the mapping programmed by the northbound
181     is returned, updated by the up/down status of these mappings as
182     reported by the southbound (if existing).
183
184 **lisp.mappingMerge** (default: *false*)
185     Configures the merge policy on the southbound registrations through
186     the LISP SB Plugin. When set to *false*, only the latest mapping
187     registered through the SB plugin is valid in the southbound mapping
188     database, independent of which device it came from. When set to
189     *true*, mappings for the same EID registered by different devices
190     are merged together and a union of the locators is maintained as the
191     valid mapping for that EID.
192
193 Textual Conventions for LISP Address Formats
194 --------------------------------------------
195
196 In addition to the more common IPv4, IPv6 and MAC address data types,
197 the LISP control plane supports arbitrary `Address Family
198 Identifiers <http://www.iana.org/assignments/address-family-numbers>`__
199 assigned by IANA, and in addition to those the `LISP Canoncal Address
200 Format (LCAF) <https://tools.ietf.org/html/draft-ietf-lisp-lcaf>`__.
201
202 The LISP Flow Mapping project in OpenDaylight implements support for
203 many of these different address formats, the full list being summarized
204 in the following table. While some of the address formats have well
205 defined and widely used textual representation, many don’t. It became
206 necessary to define a convention to use for text rendering of all
207 implemented address types in logs, URLs, input fields, etc. The below
208 table lists the supported formats, along with their AFI number and LCAF
209 type, including the prefix used for disambiguation of potential overlap,
210 and examples output.
211
212 +------------------+----------+----------+----------+----------------------------------+
213 | Name             | AFI      | LCAF     | Prefix   | Text Rendering                   |
214 +==================+==========+==========+==========+==================================+
215 | **No Address**   | 0        | -        | no:      | No Address Present               |
216 +------------------+----------+----------+----------+----------------------------------+
217 | **IPv4 Prefix**  | 1        | -        | ipv4:    | 192.0.2.0/24                     |
218 +------------------+----------+----------+----------+----------------------------------+
219 | **IPv6 Prefix**  | 2        | -        | ipv6:    | 2001:db8::/32                    |
220 +------------------+----------+----------+----------+----------------------------------+
221 | **MAC Address**  | 16389    | -        | mac:     | 00:00:5E:00:53:00                |
222 +------------------+----------+----------+----------+----------------------------------+
223 | **Distinguished  | 17       | -        | dn:      | stringAsIs                       |
224 | Name**           |          |          |          |                                  |
225 +------------------+----------+----------+----------+----------------------------------+
226 | **AS Number**    | 18       | -        | as:      | AS64500                          |
227 +------------------+----------+----------+----------+----------------------------------+
228 | **AFI List**     | 16387    | 1        | list:    | {192.0.2.1,192.0.2.2,2001:db8::1 |
229 |                  |          |          |          | }                                |
230 +------------------+----------+----------+----------+----------------------------------+
231 | **Instance ID**  | 16387    | 2        | -        | [223] 192.0.2.0/24               |
232 +------------------+----------+----------+----------+----------------------------------+
233 | **Application    | 16387    | 4        | appdata: | 192.0.2.1!128!17!80-81!6667-7000 |
234 | Data**           |          |          |          |                                  |
235 +------------------+----------+----------+----------+----------------------------------+
236 | **Explicit       | 16387    | 10       | elp:     | {192.0.2.1→192.0.2.2\|lps→192.0. |
237 | Locator Path**   |          |          |          | 2.3}                             |
238 +------------------+----------+----------+----------+----------------------------------+
239 | **Source/Destina | 16387    | 12       | srcdst:  | 192.0.2.1/32\|192.0.2.2/32       |
240 | tion             |          |          |          |                                  |
241 | Key**            |          |          |          |                                  |
242 +------------------+----------+----------+----------+----------------------------------+
243 | **Key/Value      | 16387    | 15       | kv:      | 192.0.2.1⇒192.0.2.2              |
244 | Address Pair**   |          |          |          |                                  |
245 +------------------+----------+----------+----------+----------------------------------+
246 | **Service Path** | 16387    | N/A      | sp:      | 42(3)                            |
247 +------------------+----------+----------+----------+----------------------------------+
248
249 Table: LISP Address Formats
250
251 Please note that the forward slash character ``/`` typically separating
252 IPv4 and IPv6 addresses from the mask length is transformed into ``%2f``
253 when used in a URL.
254
255 Karaf commands
256 --------------
257
258 In this section we will discuss two types of Karaf commands: built-in,
259 and LISP specific. Some built-in commands are quite useful, and are
260 needed for the tutorial, so they will be discussed here. A reference of
261 all LISP specific commands, added by the LISP Flow Mapping project is
262 also included. They are useful mostly for debugging.
263
264 Useful built-in commands
265 ~~~~~~~~~~~~~~~~~~~~~~~~
266
267 ``help``
268     Lists all available command, with a short description of each.
269
270 ``help <command_name>``
271     Show detailed help about a specific command.
272
273 ``feature:list [-i]``
274     Show all locally available features in the Karaf container. The
275     ``-i`` option lists only features that are currently installed. It
276     is possible to use ``| grep`` to filter the output (for all
277     commands, not just this one).
278
279 ``feature:install <feature_name>``
280     Install feature ``feature_name``.
281
282 ``log:set <level> <class>``
283     Set the log level for ``class`` to ``level``. The default log level
284     for all classes is INFO. For debugging, or learning about LISP
285     internals it is useful to run
286     ``log:set TRACE org.opendaylight.lispflowmapping`` right after Karaf
287     starts up.
288
289 ``log:display``
290     Outputs the log file to the console, and returns control to the
291     user.
292
293 ``log:tail``
294     Continuously shows log output, requires ``Ctrl+C`` to return to the
295     console.
296
297 LISP specific commands
298 ~~~~~~~~~~~~~~~~~~~~~~
299
300 The available lisp commands can always be obtained by
301 ``help mappingservice``. Currently they are:
302
303 ``mappingservice:addkey``
304     Add the default password ``password`` for the IPv4 EID prefix
305     0.0.0.0/0 (all addresses). This is useful when experimenting with
306     southbound devices, and using the REST interface would be combersome
307     for whatever reason.
308
309 ``mappingservice:mappings``
310     Show the list of all mappings stored in the internal non-persistent
311     data store (the DAO), listing the full data structure. The output is
312     not human friendly, but can be used for debugging.
313
314 LISP Flow Mapping Karaf Features
315 --------------------------------
316
317 LISP Flow Mapping has the following Karaf features that can be installed
318 from the Karaf console:
319
320 ``odl-lispflowmapping-msmr``
321     This includes the core features required to use the LISP Flow
322     Mapping Service such as mapping service and the LISP southbound
323     plugin.
324
325 ``odl-lispflowmapping-ui``
326     This includes the GUI module for the LISP Mapping Service.
327
328 ``odl-lispflowmapping-neutron``
329     This is the experimental Neutron provider module for LISP mapping
330     service.
331
332 Tutorials
333 ---------
334
335 This section provides a tutorial demonstrating various features in this
336 service. We have included tutorials using two forwarding platforms:
337
338 1.  Using `Open Overlay Router (OOR) <https://github.com/OpenOverlayRouter/oor#overview>`__
339
340 2.  Using `FD.io <https://wiki.fd.io/view/ONE>`__
341
342 Both have different approaches to create the overlay but ultimately do the
343 same job. Details of both approaches have been explained below.
344
345 Creating a LISP overlay with OOR
346 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
347
348 This section provides instructions to set up a LISP network of three
349 nodes (one "client" node and two "server" nodes) using OOR as data
350 plane LISP nodes and the LISP Flow Mapping project from OpenDaylight as
351 the LISP programmable mapping system for the LISP network.
352
353 Overview
354 ^^^^^^^^
355
356 The steps shown below will demonstrate setting up a LISP network between
357 a client and two servers, then performing a failover between the two
358 "server" nodes.
359
360 Prerequisites
361 ^^^^^^^^^^^^^
362
363 -  `The OpenDaylight Karaf Distribution
364    <https://www.opendaylight.org/downloads>`_
365
366 .. _instructions:
367
368 -  **The Postman Chrome App**: the most convenient way to follow along
369    this tutorial is to use the `Postman
370    App <https://www.getpostman.com/apps>`__
371    to edit and send the requests. The project git repository hosts a
372    collection of the requests that are used in this tutorial in the
373    ``resources/tutorial/OOR/Beryllium_Tutorial.json.postman_collection``
374    file. You can import this file to Postman by clicking *Import* at the
375    top, choosing *Download from link* and then entering the following
376    URL:
377    `<https://git.opendaylight.org/gerrit/gitweb?p=lispflowmapping.git;a=blob_plain;f=resources/tutorial/OOR/Beryllium_Tutorial.json.postman_collection;hb=refs/heads/stable/fluorine>`__.
378    Alternatively, you can save the file on your machine, or if you have
379    the repository checked out, you can import from there. You will need
380    to create a new Postman Environment and define some variables within:
381    ``controllerHost`` set to the hostname or IP address of the machine
382    running the OpenDaylight instance, and ``restconfPort`` to 8181, if you didn’t
383    modify the default controller settings.
384
385 -  **OOR version 1.0 or later** The README.md lists the dependencies needed
386    to build it from source.
387
388 -  **A virtualization platform**
389
390 Target Environment
391 ^^^^^^^^^^^^^^^^^^
392
393 The three LISP data plane nodes and the LISP mapping system are assumed
394 to be running in Linux virtual machines, which have the ``eth0``
395 interface in NAT mode to allow outside internet access and ``eth1``
396 connected to a host-only network, with the following IP addresses
397 (please adjust configuration files, JSON examples, etc. accordingly if
398 you’re using another addressing scheme):
399
400 +--------------------------+--------------------------+--------------------------+
401 | Node                     | Node Type                | IP Address               |
402 +==========================+==========================+==========================+
403 | **controller**           | OpenDaylight             | 192.168.16.11            |
404 +--------------------------+--------------------------+--------------------------+
405 | **client**               | OOR                      | 192.168.16.30            |
406 +--------------------------+--------------------------+--------------------------+
407 | **server1**              | OOR                      | 192.168.16.31            |
408 +--------------------------+--------------------------+--------------------------+
409 | **server2**              | OOR                      | 192.168.16.32            |
410 +--------------------------+--------------------------+--------------------------+
411 | **service-node**         | OOR                      | 192.168.16.33            |
412 +--------------------------+--------------------------+--------------------------+
413
414 Table: Nodes in the tutorial
415
416 The figure below gives a sketch of network topology that will be used in the tutorial.
417
418 .. figure:: ./images/tutorial_architecture_diagram.png
419    :alt: Network architecture of the tutorial
420
421 In LISP terminology **client**, **server1** and **server2** are mobile nodes (MN in OOR),
422 **controller** is a MS/MR and **service-node** is a RTR.
423
424 Instructions
425 ^^^^^^^^^^^^
426
427 The below steps use the command line tool cURL to talk to the LISP Flow
428 Mapping RPC REST API. This is so that you can see the actual request
429 URLs and body content on the page.
430
431 1.  Install and run the OpenDaylight distribution on the controller VM.
432     Please follow the general OpenDaylight Installation Guide
433     for this step. Once the OpenDaylight controller is running install
434     the *odl-lispflowmapping-msmr* feature from the Karaf CLI:
435
436     ::
437
438         feature:install odl-lispflowmapping-msmr
439
440     It takes quite a while to load and initialize all features and their
441     dependencies. It’s worth running the command ``log:tail`` in the
442     Karaf console to see when the log output is winding down, and
443     continue with the tutorial after that.
444
445 2.  Install OOR on the **client**, **server1**, **server2**, and
446     **service-node** VMs following the installation instructions `from
447     the OOR README
448     file <https://github.com/OpenOverlayRouter/oor#software-prerequisites>`__.
449
450 3.  Configure the OOR installations from the previous step. Take a look
451     at the ``oor.conf.example`` to get a general idea of the structure
452     of the conf file. First, check if the file ``/etc/oor.conf`` exists.
453     If the file doesn't exist, create the file ``/etc/oor.conf``. Set the
454     EID in ``/etc/oor.conf`` file from the IP address space selected
455     for your virtual/LISP network. In this tutorial the EID of the
456     **client** is set to 1.1.1.1/32, and that of **server1** and
457     **server2** to 2.2.2.2/32.
458
459 4.  Set the RLOC interface to ``eth1`` in each ``oor.conf`` file. LISP
460     will determine the RLOC (IP address of the corresponding VM) based
461     on this interface.
462
463 5.  Set the Map-Resolver address to the IP address of the
464     **controller**, and on the **client** the Map-Server too. On
465     **server1** and **server2** remove the Map-Server configuration, so
466     that it doesn’t interfere with the mappings on the controller, since
467     we’re going to program them manually.
468
469 6.  Modify the "key" parameter in each ``oor.conf`` file to a
470     key/password of your choice (*password* in this tutorial).
471
472     .. note::
473
474         The ``resources/tutorial/OOR`` directory in the project git repository
475         has the files used in the tutorial `checked in
476         <https://git.opendaylight.org/gerrit/gitweb?p=lispflowmapping.git;a=tree;f=resources/tutorial/OOR;hb=refs/heads/stable/fluorine>`_,
477         so you can just copy the files to ``/etc/oor.conf`` on the respective
478         VMs. You will also find the JSON files referenced below in the same
479         directory.
480
481 7.  Define a key and EID prefix association in OpenDaylight using the
482     RPC REST API for the **client** EID (1.1.1.1/32) to allow
483     registration from the southbound. Since the mappings for the server
484     EID will be configured from the REST API, no such association is
485     necessary. Run the below command on the **controller** (or any
486     machine that can reach **controller**, by replacing *localhost* with
487     the IP address of **controller**).
488
489     ::
490
491         curl -u "admin":"admin" -H "Content-type: application/json" -X PUT \
492             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/authentication-key/ipv4:1.1.1.1%2f32/ \
493             --data @add-key.json
494
495     where the content of the *add-key.json* file is the following:
496
497     .. code:: json
498
499         {
500             "authentication-key": {
501                 "eid-uri": "ipv4:1.1.1.1/32",
502                 "eid": {
503                     "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
504                     "ipv4-prefix": "1.1.1.1/32"
505                 },
506                 "mapping-authkey": {
507                     "key-string": "password",
508                     "key-type": 1
509                 }
510             }
511         }
512
513 8.  Verify that the key is added properly by requesting the following
514     URL:
515
516     ::
517
518         curl -u "admin":"admin" -H "Content-type: application/json" -X GET \
519             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/authentication-key/ipv4:1.1.1.1%2f32/
520
521     The output the above invocation should look like this:
522
523     .. code:: json
524
525         {
526             "authentication-key":[
527                 {
528                     "eid-uri":"ipv4:1.1.1.1/32",
529                     "eid":{
530                         "ipv4-prefix":"1.1.1.1/32",
531                         "address-type":"ietf-lisp-address-types:ipv4-prefix-afi"
532                     },
533                     "mapping-authkey":{
534                         "key-string":"password"
535                         ,"key-type":1
536                     }
537                 }
538             ]
539         }
540
541 9.  Run the ``oor`` OOR daemon on all VMs:
542
543     ::
544
545         oor -f /etc/oor.conf
546
547     For more information on accessing OOR logs, take a look at
548     `OOR README <https://github.com/OpenOverlayRouter/oor#readme>`__
549 10. The **client** OOR node should now register its EID-to-RLOC
550     mapping in OpenDaylight. To verify you can lookup the corresponding
551     EIDs via the REST API
552
553     ::
554
555         curl -u "admin":"admin" -H "Content-type: application/json" -X GET \
556             http://localhost:8181/restconf/operational/odl-mappingservice:mapping-database/virtual-network-identifier/0/mapping/ipv4:1.1.1.1%2f32/southbound/
557
558     An alternative way for retrieving mappings from OpenDaylight using the
559     southbound interface is using the
560     `lig <https://github.com/davidmeyer/lig>`__ open source tool.
561
562 11. Register the EID-to-RLOC mapping of the server EID 2.2.2.2/32 to the
563     controller, pointing to **server1** and **server2** with a higher
564     priority for **server1**
565
566     ::
567
568         curl -u "admin":"admin" -H "Content-type: application/json" -X PUT \
569             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/mapping/ipv4:2.2.2.2%2f32/northbound/ \
570             --data @mapping.json
571
572     where the *mapping.json* file looks like this:
573
574     .. code:: json
575
576         {
577             "mapping": {
578                 "eid-uri": "ipv4:2.2.2.2/32",
579                 "origin": "northbound",
580                 "mapping-record": {
581                     "recordTtl": 1440,
582                     "action": "NoAction",
583                     "authoritative": true,
584                     "eid": {
585                         "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
586                         "ipv4-prefix": "2.2.2.2/32"
587                     },
588                     "LocatorRecord": [
589                         {
590                             "locator-id": "server1",
591                             "priority": 1,
592                             "weight": 1,
593                             "multicastPriority": 255,
594                             "multicastWeight": 0,
595                             "localLocator": true,
596                             "rlocProbed": false,
597                             "routed": true,
598                             "rloc": {
599                                 "address-type": "ietf-lisp-address-types:ipv4-afi",
600                                 "ipv4": "192.168.16.31"
601                             }
602                         },
603                         {
604                             "locator-id": "server2",
605                             "priority": 2,
606                             "weight": 1,
607                             "multicastPriority": 255,
608                             "multicastWeight": 0,
609                             "localLocator": true,
610                             "rlocProbed": false,
611                             "routed": true,
612                             "rloc": {
613                                 "address-type": "ietf-lisp-address-types:ipv4-afi",
614                                 "ipv4": "192.168.16.32"
615                             }
616                         }
617                     ]
618                 }
619             }
620         }
621
622     Here the priority of the second RLOC (192.168.16.32 - **server2**)
623     is 2, a higher numeric value than the priority of 192.168.16.31,
624     which is 1. This policy is saying that **server1** is preferred to
625     **server2** for reaching EID 2.2.2.2/32. Note that lower priority
626     value has higher preference in LISP.
627
628 12. Verify the correct registration of the 2.2.2.2/32 EID:
629
630     ::
631
632         curl -u "admin":"admin" -H "Content-type: application/json" -X GET \
633             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/mapping/ipv4:2.2.2.2%2f32/northbound/
634
635 13. Now the LISP network is up. To verify, log into the **client** VM
636     and ping the server EID:
637
638     ::
639
640         ping 2.2.2.2
641
642 14. Let’s test fail-over now. Suppose you had a service on **server1**
643     which became unavailable, but **server1** itself is still reachable.
644     LISP will not automatically fail over, even if the mapping for
645     2.2.2.2/32 has two locators, since both locators are still reachable
646     and uses the one with the higher priority (lowest priority value).
647     To force a failover, we need to set the priority of **server2** to a
648     lower value. Using the file mapping.json above, swap the priority
649     values between the two locators (lines 14 and 28 in *mapping.json*)
650     and repeat the request from step 11. You can also repeat step 12 to
651     see if the mapping is correctly registered. If you leave the ping
652     on, and monitor the traffic using wireshark, you can see that the
653     ping traffic to 2.2.2.2 will be diverted from the **server1** RLOC
654     to the **server2** RLOC.
655
656     With the default OpenDaylight configuration the failover should be
657     near instantaneous (we observed 3 lost pings in the worst case),
658     because of the LISP `Solicit-Map-Request (SMR)
659     mechanism <http://tools.ietf.org/html/rfc6830#section-6.6.2>`__ that
660     can ask a LISP data plane element to update its mapping for a
661     certain EID (enabled by default). It is controlled by the
662     ``lisp.smr`` variable in ``etc/custom.porperties``. When enabled,
663     any mapping change from the RPC interface will trigger an SMR packet
664     to all data plane elements that have requested the mapping in the
665     last 24 hours (this value was chosen because it’s the default TTL of
666     Cisco IOS xTR mapping registrations). If disabled, ITRs keep their
667     mappings until the TTL specified in the Map-Reply expires.
668
669 15. To add a service chain into the path from the client to the server,
670     we can use an Explicit Locator Path, specifying the **service-node**
671     as the first hop and **server1** (or **server2**) as the second hop.
672     The following will achieve that:
673
674     ::
675
676         curl -u "admin":"admin" -H "Content-type: application/json" -X PUT \
677             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/mapping/ipv4:2.2.2.2%2f32/northbound/ \
678             --data @elp.json
679
680     where the *elp.json* file is as follows:
681
682     .. code:: json
683
684         {
685             "mapping": {
686                 "eid-uri": "ipv4:2.2.2.2/32",
687                 "origin": "northbound",
688                 "mapping-record": {
689                     "recordTtl": 1440,
690                     "action": "NoAction",
691                     "authoritative": true,
692                     "eid": {
693                         "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
694                         "ipv4-prefix": "2.2.2.2/32"
695                     },
696                     "LocatorRecord": [
697                         {
698                             "locator-id": "ELP",
699                             "priority": 1,
700                             "weight": 1,
701                             "multicastPriority": 255,
702                             "multicastWeight": 0,
703                             "localLocator": true,
704                             "rlocProbed": false,
705                             "routed": true,
706                             "rloc": {
707                                 "address-type": "ietf-lisp-address-types:explicit-locator-path-lcaf",
708                                 "explicit-locator-path": {
709                                     "hop": [
710                                         {
711                                             "hop-id": "service-node",
712                                             "address": "192.168.16.33",
713                                             "lrs-bits": "strict"
714                                         },
715                                         {
716                                             "hop-id": "server1",
717                                             "address": "192.168.16.31",
718                                             "lrs-bits": "strict"
719                                         }
720                                     ]
721                                 }
722                             }
723                         }
724                     ]
725                 }
726             }
727         }
728
729     After the mapping for 2.2.2.2/32 is updated with the above, the ICMP
730     traffic from **client** to **server1** will flow through the
731     **service-node**. You can confirm this in the OOR logs, or by
732     sniffing the traffic on either the **service-node** or **server1**.
733     Note that service chains are unidirectional, so unless another ELP
734     mapping is added for the return traffic, packets will go from
735     **server1** to **client** directly.
736
737 16. Suppose the **service-node** is actually a firewall, and traffic is
738     diverted there to support access control lists (ACLs). In this
739     tutorial that can be emulated by using ``iptables`` firewall rules
740     in the **service-node** VM. To deny traffic on the service chain
741     defined above, the following rule can be added:
742
743     ::
744
745         iptables -A OUTPUT --dst 192.168.16.31 -j DROP
746
747     The ping from the **client** should now have stopped.
748
749     In this case the ACL is done on the destination RLOC. There is an
750     effort underway in the OOR community to allow filtering on EIDs,
751     which is the more logical place to apply ACLs.
752
753 17. To delete the rule and restore connectivity on the service chain,
754     delete the ACL by issuing the following command:
755
756     ::
757
758         iptables -D OUTPUT --dst 192.168.16.31 -j DROP
759
760     which should restore connectivity.
761
762
763 Creating a simple LISP overlay with FD.io
764 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
765
766 In this section, we use the Overlay Network Engine (ONE) project in FD.io
767 to facilitate fully scripted setup and testing of a LISP/VXLAN-GPE network.
768 Overlay Network Engine (ONE) is a `FD.io <https://fd.io/>`__ project that enables programmable
769 dynamic software defined overlays. Details about this project can be
770 found in `ONE wiki <https://wiki.fd.io/view/ONE>`__.
771
772 The steps shown below will demonstrate setting up a LISP network between
773 a client and a server using VPP. We demonstrate how to use VPP lite to
774 build a IP4 LISP overlay on an Ubuntu host using namespaces and af_packet
775 interfaces. All configuration files used in the tutorials can be found
776 `here <https://gerrit.fd.io/r/gitweb?p=one.git;a=tree;f=tutorial>`__.
777
778 Prerequisites
779 ^^^^^^^^^^^^^
780
781 -  `The OpenDaylight Karaf Distribution
782    <https://www.opendaylight.org/downloads>`_
783
784 -  **The Postman Chrome App**: Please follow the instructions_ and import
785    postman collection from the following URL: `<https://git.opendaylight.org/gerrit/gitweb?p=lispflowmapping.git;a=blob;f=resources/tutorial/FD_io/lfm_vpp.postman_collection.json;hb=refs/heads/stable/fluorine>`__.
786
787 -  **Vagrant** (optional): Download it from `Vagrant website <https://www.vagrantup.com/downloads.html>`__
788    and follow the setup instructions.
789
790 Target Environment
791 ^^^^^^^^^^^^^^^^^^
792
793 Unlike the case with OOR, we use network namespace functionality of Linux
794 to create the overlay in this case. The following table contains ip addresses
795 of nodes in the overlay topology used in the tutorial. Our objective will be to
796 create this topology and be able to ping from client to server through an
797 intermediary hop, **service node**, which is a ``rtr node`` providing the
798 service of re-encapsulation. So, all the packets from client to server
799 will be through this **service node**.
800
801 +--------------------------+--------------------------+--------------------------+
802 | Node                     | Node Type                | IP Address               |
803 +==========================+==========================+==========================+
804 | **controller**           | OpenDaylight             | 6.0.3.100                |
805 +--------------------------+--------------------------+--------------------------+
806 | **client**               | VPP                      | 6.0.2.2                  |
807 +--------------------------+--------------------------+--------------------------+
808 | **server**               | VPP                      | 6.0.4.4                  |
809 +--------------------------+--------------------------+--------------------------+
810 | **service node**         | VPP                      | 6.0.3.3                  |
811 +--------------------------+--------------------------+--------------------------+
812
813 Table: Nodes in the tutorial
814
815 The figure below gives a sketch of network topology that will be used in the tutorial.
816
817 .. figure:: ./images/one_ODL_architecture.png
818    :alt: Network architecture of the tutorial for FD.io
819
820 Instructions
821 ^^^^^^^^^^^^
822
823 Follow the instructions below sequentially.
824
825 1.  Pull the VPP code anonymously using:
826     ::
827
828         git clone https://gerrit.fd.io/r/vpp
829
830 2.  Then, use the vagrant file from repository to build virtual machine
831     with proper environment.
832     ::
833
834         cd vpp/build-root/vagrant/
835         vagrant up
836         vagrant ssh
837
838 3.  In case there is any error from ``vagrant up``, try ``vargant ssh``. if
839     it works, no worries. If it still doesn't work, you can try any Ubuntu virtual
840     machine. Or sometimes there is an issue with the Vagrant properly copying
841     the VPP repo code from the host VM after the first installation. In that
842     case ``/vpp`` doesn't exist. In both cases, follow the instructions
843     from below.
844
845     1. Clone the code in ``/`` directory. So, the codes will be in ``/vpp``.
846
847     2. Run the following commands:
848         ::
849
850             cd /vpp/build-root
851             make distclean
852             ./bootstrap.sh
853             make V=0 PLATFORM=vpp TAG=vpp install-deb
854             sudo dpkg -i /vpp/build-root/*.deb
855
856     Alternative and more detailed build instructions can be found in
857     `VPP's wiki <https://wiki.fd.io/view/VPP/Build,_install,_and_test_images>`__
858 4.  By now, you should have a Ubuntu VM with VPP repository in ``/vpp``
859     with ``sudo`` access. Now, we need VPP Lite build. The following commands
860     builds VPP Lite.
861     ::
862
863         cd /vpp
864         export PLATFORM=vpp_lite
865         make build
866
867     Successful build create the binary in ``/vpp/build-root/install-vpp_lite_debug-native/vpp/bin``
868
869 5.  Install bridge-utils and ethtool if needed by using following commands:
870     ::
871
872        sudo apt-get install bridge-utils ethtool
873
874 6.  Now, install and run OpenDaylight on the VM. Please follow the general
875     OpenDaylight Installation Guide for this step from :ref:`install_odl`.
876     Before running OpenDaylight, we need to change the configuration for RTR
877     to work. Update ``etc/custom.properties`` with the ``lisp.elpPolicy`` to
878     be replace.
879     ::
880
881         lisp.elpPolicy = replace
882
883     Then, run OpenDaylight. For details regarding configuring LISP
884     Flow Mapping, please take a look at :ref:`lfm_config`.
885     Once the OpenDaylight controller is running install the *odl-lispflowmapping-msmr*
886     feature from the Karaf CLI:
887
888     ::
889
890         feature:install odl-lispflowmapping-msmr
891
892     It may take quite a while to load and initialize all features and their
893     dependencies. It’s worth running the command ``log:tail`` in the
894     Karaf console to see when the log output is winding down, and
895     continue with the tutorial after that.
896
897 7.  For setting up VPP, get the files from ``resources/tutorial/FD_io``
898     folder of the lispflowmapping repo. The files can also be found `here
899     <https://git.opendaylight.org/gerrit/gitweb?p=lispflowmapping.git;a=tree;f=resources/tutorial/FD_io;hb=refs/heads/stable/fluorine>`__.
900     Copy the ``vpp1.config``, ``vpp2.config`` and ``rtr.config`` files in
901     ``/etc/vpp/lite/``.
902
903 8.  In this example, VPP doesn't make any southbound map registers to OpenDaylight.
904     So, we add the mappings directly from northbound. For that, we need
905     to add the mappings to OpenDaylight via RESTCONF API.
906
907     Register EID-to-RLOC mapping of the Client EID 6.0.2.0/24.
908     ::
909
910         curl -u "admin":"admin" -H "Content-type: application/json" -X PUT \
911             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/mapping/ipv4:6.0.2.0%2f24/northbound/ \
912             --data @epl1.json
913
914     Content of epl1.json:
915
916     .. code:: json
917
918         {
919             "mapping": {
920                 "eid-uri": "ipv4:6.0.2.0/24",
921                 "origin": "northbound",
922                 "mapping-record": {
923                     "recordTtl": 1440,
924                     "action": "NoAction",
925                     "authoritative": true,
926                     "eid": {
927                             "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
928                             "ipv4-prefix": "6.0.2.0/24"
929                     },
930                     "LocatorRecord": [
931                         {
932                             "locator-id": "ELP",
933                             "priority": 1,
934                             "weight": 1,
935                             "multicastPriority": 255,
936                             "multicastWeight": 0,
937                             "localLocator": true,
938                             "rlocProbed": false,
939                             "routed": false,
940                             "rloc": {
941                                 "address-type": "ietf-lisp-address-types:explicit-locator-path-lcaf",
942                                 "explicit-locator-path": {
943                                     "hop": [
944                                         {
945                                             "hop-id": "Hop 1",
946                                             "address": "6.0.3.3",
947                                             "lrs-bits": "lookup rloc-probe strict"
948                                         },
949                                         {
950                                             "hop-id": "Hop 2",
951                                             "address": "6.0.3.1",
952                                             "lrs-bits": "lookup strict"
953                                         }
954                                     ]
955                                 }
956                             }
957                         }
958                     ]
959                 }
960             }
961         }
962
963
964     Similarly add EID-to-RLOC mapping of the Server EID 6.0.4.0/24.
965     ::
966
967         curl -u "admin":"admin" -H "Content-type: application/json" -X PUT \
968             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/mapping/ipv4:6.0.4.0%2f24/northbound/ \
969             --data @epl2.json
970
971     Content of elp2.json:
972
973     .. code:: json
974
975         {
976             "mapping": {
977                 "eid-uri": "ipv4:6.0.4.0/24",
978                 "origin": "northbound",
979                 "mapping-record": {
980                     "recordTtl": 1440,
981                     "action": "NoAction",
982                     "authoritative": true,
983                     "eid": {
984                             "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
985                             "ipv4-prefix": "6.0.4.0/24"
986                     },
987                     "LocatorRecord": [
988                         {
989                             "locator-id": "ELP",
990                             "priority": 1,
991                             "weight": 1,
992                             "multicastPriority": 255,
993                             "multicastWeight": 0,
994                             "localLocator": true,
995                             "rlocProbed": false,
996                             "routed": false,
997                             "rloc": {
998                                 "address-type": "ietf-lisp-address-types:explicit-locator-path-lcaf",
999                                 "explicit-locator-path": {
1000                                     "hop": [
1001                                         {
1002                                             "hop-id": "Hop 1",
1003                                             "address": "6.0.3.3",
1004                                             "lrs-bits": "lookup rloc-probe strict"
1005                                         },
1006                                         {
1007                                             "hop-id": "Hop 2",
1008                                             "address": "6.0.3.2",
1009                                             "lrs-bits": "lookup strict"
1010                                         }
1011                                     ]
1012                                 }
1013                             }
1014                         }
1015                     ]
1016                 }
1017             }
1018         }
1019
1020     The JSON files regarding these can be found in `here
1021     <https://git.opendaylight.org/gerrit/gitweb?p=lispflowmapping.git;a=tree;f=resources/tutorial/FD_io;hb=refs/heads/stable/fluorine>`__.
1022     Even though there is no southbound registration for mapping to OpenDaylight, using
1023     northbound policy we can specify mappings, when Client requests for
1024     the Server eid, Client gets a reply from OpenDaylight.
1025
1026 9.  Assuming all files have been created and OpenDaylight has been configured as
1027     explained above, execute the host script you've created or the ``topology_setup.sh``
1028     script from `here <https://git.opendaylight.org/gerrit/gitweb?p=lispflowmapping.git;a=tree;f=resources/tutorial/FD_io;hb=refs/heads/stable/fluorine>`__.
1029
1030 10. If all goes well, you can now test connectivity between the namespaces with:
1031     ::
1032
1033         sudo ip netns exec vpp-ns1 ping 6.0.4.4
1034
1035 11. Traffic and control plane message exchanges can be checked with a wireshark
1036     listening on the odl interface.
1037 12. .. important:: Delete the topology by running the ``topology_setup.sh`` with ``clean`` argument.
1038         ::
1039
1040             sudo ./topology_setup.sh clean
1041
1042 Creating a LISP overlay with Cisco IOS-XE
1043 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1044
1045 This section describes how to create a simple LISP overlay using the Cisco
1046 IOS-XE network operating system as the data plane software running on the
1047 `Cisco CSR 1000v Series Cloud Services Router
1048 <http://www.cisco.com/c/en/us/support/routers/cloud-services-router-1000v/model.html>`_.
1049
1050 Prerequisites
1051 ^^^^^^^^^^^^^
1052
1053 -  `The OpenDaylight Karaf Distribution**
1054    <https://www.opendaylight.org/downloads>`_
1055
1056 -  `CSR1Kv image with Cisco IOS-XE version 03.13.00.S or later
1057    <http://www.cisco.com/c/en/us/support/routers/cloud-services-router-1000v/model.html#~tab-downloads>`_;
1058    the instructions have been tested on version 03.15.00.S.
1059
1060 -  **A virtualization platform** supported by CSR1Kv images (VMware ESXi,
1061    Citrix XenServer, KVM, and Microsoft Hyper-V).
1062
1063 Target Environment
1064 ^^^^^^^^^^^^^^^^^^
1065
1066 The CSR1Kv images are configured with one management interface
1067 (``GigabitEthernet1``), and another interface (``GigabitEthernet2``) connected
1068 to a host-only network on the virtualization platform, while the LISP mapping
1069 system is assumed to be running in a Linux virtual machine, which has the
1070 ``eth0`` interface in NAT mode to allow outside internet access and ``eth1``
1071 connected to the host-only network, with the following IP addresses (please
1072 adjust configuration files, JSON examples, etc.  accordingly if you’re using
1073 another addressing scheme):
1074
1075 +--------------------------+--------------------------+--------------------------+
1076 | Node                     | Node Type                | IP Address               |
1077 +==========================+==========================+==========================+
1078 | **controller**           | OpenDaylight             | 192.168.16.11            |
1079 +--------------------------+--------------------------+--------------------------+
1080 | **client**               | CSR1Kv                   | 192.168.16.30            |
1081 +--------------------------+--------------------------+--------------------------+
1082 | **server**               | CSR1Kv                   | 192.168.16.31            |
1083 +--------------------------+--------------------------+--------------------------+
1084
1085 Table: Nodes in the tutorial
1086
1087 The scenario and EID allocation is the same as the OOR scenario, except that
1088 there is no **server2** and **service-node** (for now).
1089
1090 Before this tutorial can be followed, basic connectivity between the Linux VM
1091 and the CSRs should work on the host-only network.
1092
1093 Instructions
1094 ^^^^^^^^^^^^
1095
1096 The below steps use the command line tool cURL to talk to the LISP Flow
1097 Mapping RPC REST API. This is so that you can see the actual request
1098 URLs and body content on the page. The easy way is to just use Postman.
1099
1100 1.  Install and run the OpenDaylight distribution on the controller VM.
1101     Please follow the general OpenDaylight Installation Guide from
1102     :ref:`install_odl` for this step. Once the OpenDaylight controller is
1103     running install the *odl-lispflowmapping-msmr* feature from the Karaf CLI:
1104
1105     ::
1106
1107         feature:install odl-lispflowmapping-msmr
1108
1109     It takes quite a while to load and initialize all features and their
1110     dependencies. It’s worth running the command ``log:tail`` in the
1111     Karaf console to see when the log output is winding down, and
1112     continue with the tutorial after that.
1113
1114 2.  Create the **client** and **server** VMs following the installation
1115     instructions from the `CSR1Kv Configuration Guide
1116     <http://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/configuration/b_CSR1000v_Configuration_Guide.html>`_.
1117
1118 3.  Define a key and EID prefix association in OpenDaylight using the RPC REST
1119     API for the **client** and **server** EIDs (1.1.1.1/32 and 2.2.2.2/32
1120     respectively) to allow registration from the southbound.  Run the below
1121     command on the **controller** (or any machine that can reach
1122     **controller**, by replacing *localhost* with the IP address of
1123     **controller**).
1124
1125     ::
1126
1127         curl -u "admin":"admin" -H "Content-type: application/json" -X PUT \
1128             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/authentication-key/ipv4:1.1.1.1%2f32/ \
1129             --data @add-key.json
1130
1131     where the content of the *add-key.json* file is the following:
1132
1133     .. code:: json
1134
1135         {
1136             "authentication-key": {
1137                 "eid-uri": "ipv4:1.1.1.1/32",
1138                 "eid": {
1139                     "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
1140                     "ipv4-prefix": "1.1.1.1/32"
1141                 },
1142                 "mapping-authkey": {
1143                     "key-string": "password",
1144                     "key-type": 1
1145                 }
1146             }
1147         }
1148
1149     The same should be done for 2.2.2.2/32 too.
1150
1151 4.  Verify that the key is added properly by requesting the following
1152     URL:
1153
1154     ::
1155
1156         curl -u "admin":"admin" -H "Content-type: application/json" -X GET \
1157             http://localhost:8181/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/authentication-key/ipv4:1.1.1.1%2f32/
1158
1159     The output the above invocation should look like this:
1160
1161     .. code:: json
1162
1163         {
1164             "authentication-key":[
1165                 {
1166                     "eid-uri":"ipv4:1.1.1.1/32",
1167                     "eid":{
1168                         "ipv4-prefix":"1.1.1.1/32",
1169                         "address-type":"ietf-lisp-address-types:ipv4-prefix-afi"
1170                     },
1171                     "mapping-authkey":{
1172                         "key-string":"password"
1173                         ,"key-type":1
1174                     }
1175                 }
1176             ]
1177         }
1178
1179 5.  Configure the CSR installations from the previous step. The EID needs to
1180     be configured on a loopback interface (except when the CSR is used as a
1181     router not a simple client like in this tutorial and the EID is assigned
1182     to a real interface).
1183
1184     ::
1185
1186         interface Loopback0
1187          ip address 1.1.1.1 255.255.255.255
1188
1189 6.  The LISP specific configuration goes to a ``router lisp`` section in the
1190     configuration. A ``locator-set`` defines the list of locators with their
1191     priorities and weights, either statically, or better yet, as an interface
1192     name:
1193
1194     ::
1195
1196         locator-set rloc-network
1197          IPv4-interface GigabitEthernet2 priority 1 weight 1
1198          exit
1199
1200 7.  To make sure a Map-Request is using the above defined ``rloc-network``
1201     locator set, the following configuration is used:
1202
1203     ::
1204
1205         map-request itr-rlocs rloc-network
1206
1207 8.  Each Instance ID needs its own configuration. For the default Instance ID
1208     of 0, the following configuration is needed for a besic setup:
1209
1210     ::
1211
1212         eid-table default instance-id 0
1213          database-mapping 1.1.1.1/32 locator-set rloc-network
1214          map-cache 0.0.0.0/0 map-request
1215          no ipv4 map-cache-persistent
1216          ipv4 itr map-resolver 192.168.16.11
1217          ipv4 itr
1218          ipv4 etr map-server 192.168.16.11 key password
1219          ipv4 etr
1220          exit
1221
1222     ``database-mapping`` defines the EID prefix the router will register in
1223     the mapping system and which locator set it will use (``rloc-network`` in
1224     this case, which was defined in step 6).
1225
1226     The next line creates a static map-cache entry for the whole IPv4 EID
1227     space, causing a Map-Request to be triggered for every destination (that
1228     is not directly connected on some interface).
1229
1230     LISP routers save their map cache to a fie which is used to restore
1231     previous state on reboot. To avoid confusion due to state restored from a
1232     previous run, ``no ipv4 map-cache-persistent`` can be used to disable this
1233     behavior for non-production testing environments.
1234
1235     A ``map-resolver`` is then defined, where Map-Requests will be directed to
1236     for mapping lookups, and then a ``map-server`` association with a shared
1237     secret key.
1238
1239 9.  Here's the full configuration that needs to be pasted into the
1240     configuration of the **client** to follow this tutorial:
1241
1242     ::
1243
1244         interface Loopback0
1245          ip address 1.1.1.1 255.255.255.255
1246         !
1247         router lisp
1248          locator-set rloc-network
1249           IPv4-interface GigabitEthernet2 priority 1 weight 1
1250           exit
1251          !
1252          map-request itr-rlocs rloc-network
1253          eid-table default instance-id 0
1254           database-mapping 1.1.1.1/32 locator-set rloc-network
1255           map-cache 0.0.0.0/0 map-request
1256           no ipv4 map-cache-persistent
1257           ipv4 itr map-resolver 192.168.16.11
1258           ipv4 itr
1259           ipv4 etr map-server 192.168.16.11 key password
1260           ipv4 etr
1261           exit
1262          !
1263          exit
1264
1265     Configuring the **server** is done by replacing ``1.1.1.1`` with
1266     ``2.2.2.2`` in the above configuration snippet.
1267
1268 10. The CSR nodes should now register their EID-to-RLOC mappings to
1269     OpenDaylight. To verify, the corresponding EIDs can be looked up via the
1270     REST API:
1271
1272     ::
1273
1274         curl -u "admin":"admin" -H "Content-type: application/json" -X GET \
1275             http://localhost:8181/restconf/operational/odl-mappingservice:mapping-database/virtual-network-identifier/0/mapping/ipv4:1.1.1.1%2f32/southbound/
1276
1277     An alternative way for retrieving mappings from OpenDaylight using the
1278     southbound interface is using the
1279     `lig <https://github.com/davidmeyer/lig>`_ open source tool.
1280
1281     Yet another different way is to use the OpenDaylight mappingservice CLI,
1282     and type the following at the Karaf prompt:
1283
1284     ::
1285
1286         mappingservice:mappings
1287
1288     This needs the *odl-lispflowmapping-mappingservice-shell* feature to be
1289     loaded. The output is intended for debugging purposes and shows the full
1290     Java objects stored in the map-cache.
1291
1292
1293 11. Now the LISP network is up. It can be verified by pinging the **server**
1294     EID from the **client** CSR EID:
1295
1296     ::
1297
1298         ping 2.2.2.2 source 1.1.1.1
1299
1300 LISP Flow Mapping Support
1301 -------------------------
1302
1303 For support the lispflowmapping project can be reached by emailing the
1304 developer mailing list: lispflowmapping-dev@lists.opendaylight.org or on
1305 the #opendaylight-lispflowmapping IRC channel on irc.freenode.net.
1306
1307 Additional information is also available on the `Lisp Flow Mapping
1308 wiki <https://wiki.opendaylight.org/view/OpenDaylight_Lisp_Flow_Mapping:Main>`__
1309
1310 Clustering in LISP Flow Mapping
1311 -------------------------------
1312
1313 Documentation regarding setting up a 3-node OpenDaylight cluster is
1314 described at following `odl wiki
1315 page <https://wiki.opendaylight.org/view/Running_and_testing_an_OpenDaylight_Cluster#Three-node_cluster>`__.
1316
1317 To turn on clustering in LISP Flow Mapping it is necessary:
1318
1319 -  run script **deploy.py** script. This script is in
1320    `integration-test <https://git.opendaylight.org/gerrit/integration/test>`__
1321    project placed at *tools/clustering/cluster-deployer/deploy.py*. A
1322    whole deploy.py command can looks like:
1323
1324 .. raw:: html
1325
1326    <div class="informalexample">
1327
1328 | {path\_to\_integration\_test\_project}/tools/clustering/cluster-deployer/**deploy.py**
1329 | --**distribution** {path\_to\_distribution\_in\_zip\_format}
1330 | --**rootdir** {dir\_at\_remote\_host\_where\_copy\_odl\_distribution}
1331 | --**hosts** {ip1},{ip2},{ip3}
1332 | --**clean**
1333 | --**template** lispflowmapping
1334 | --**rf** 3
1335 | --**user** {user\_name\_of\_remote\_hosts}
1336 | --**password** {password\_to\_remote\_hosts}
1337
1338 .. raw:: html
1339
1340    </div>
1341
1342 | Running this script will cause that specified **distribution** to be
1343   deployed to remote **hosts** specified through their IP adresses with
1344   using credentials (**user** and **password**). The distribution will
1345   be copied to specified **rootdir**. As part of the deployment, a
1346   **template** which contains a set of controller files which are
1347   different from standard ones. In this case it is specified in
1348 | *{path\_to\_integration\_test\_project}/tools/clustering/cluster-deployer/lispflowmapping*
1349   directory.
1350 | Lispflowmapping templates are part of integration-test project. There
1351   are 5 template files:
1352
1353 -  akka.conf.template
1354
1355 -  jolokia.xml.template
1356
1357 -  module-shards.conf.template
1358
1359 -  modules.conf.template
1360
1361 -  org.apache.karaf.features.cfg.template
1362
1363 After copying the distribution, it is unzipped and started on all of
1364 specified **hosts** in cluster aware manner.
1365
1366 Remarks
1367 ~~~~~~~
1368
1369 It is necessary to have:
1370
1371 -  **unzip** program installed on all of the host
1372
1373 -  set all remote hosts /etc/sudoers files to not **requiretty** (should
1374    only matter on debian hosts)