Spec update against reviews #70100, #70246, #70319
[genius.git] / docs / specs / of-tunnels.rst
1
2 .. contents:: Table of Contents
3       :depth: 3
4
5 ==========
6 OF Tunnels
7 ==========
8
9 https://git.opendaylight.org/gerrit/#/q/topic:of-tunnels
10
11 OF Tunnels feature adds support for flow based tunnels to allow
12 scalable overlay tunnels.
13
14 Problem description
15 ===================
16
17 Today when tunnel interfaces are created, InterFaceManager [IFM] creates one
18 OVS port for each tunnel interface i.e. source-destination pair. For N devices
19 in a TransportZone this translates to N*(N-1) tunnel ports created across all
20 devices and N-1 ports in each device. This has obvious scale limitations.
21
22 Use Cases
23 ---------
24 This feature will support following use cases:
25
26 * Use case 1: Allow user to specify if they want to use flow based tunnels at
27   the time of configuration.
28 * Use case 2: Create single OVS Tunnel Interface if flow based tunnels are
29   configured and this is the first tunnel on this device/tep.
30 * Use case 3: Flow based and non flow based tunnels should be able to exist
31   in a given transport zone.
32 * Use case 4: On tep delete, if this is the last tunnel interface on this
33   tep/device and it is flow based tunnel, delete the OVS Tunnel Interface.
34
35 Following use cases will not be supported:
36
37 * Configuration of flow based and non-flow based tunnels of same type on the same device.
38   OVS requires one of the following: ``remote_ip``, ``local_ip``, ``type`` and ``key`` to
39   be unique. Currently we don't support multiple local_ip and key is always set to flow.
40   So ``remote_ip`` and ``type`` are the only unique identifiers. ``remote_ip=flow``
41   is a super set of ``remote_ip=<fixed-ip>`` and we can't have two interfaces with
42   all other fields same except this.
43 * Changing tunnel from one flow based to non-flow based at runtime. Such a
44   change will require deletion and addition of tep. This is inline with
45   existing model where tunnel-type cannot be changed at runtime.
46 * Configuration of Source IP for tunnel through flow. It will still be fixed. Though we're
47   adding option in IFM YANG for this, implementation for it won't be done till we get
48   use case(s) for it.
49
50 Proposed change
51 ===============
52 ``OVS 2.0.0`` onwards allows configuration of flow based tunnels through
53 interface ``option:remote_ip=flow``. Currently this field is set to
54 IP address of the destination endpoint.
55
56 ``remote_ip=flow`` means tunnel destination IP will be set by an OpenFlow
57 action. This allows us to add different actions for different destinations
58 using the single OVS/OF port.
59
60 This change will add optional parameters to ITM and IFM YANG files to allow
61 OF Tunnels. Based on this option, ITM will configure IFM which in turn will
62 create tunnel ports in OVSDB.
63
64 Using OVSDB Plugin
65 ------------------
66 OVSDB Plugin provides following field in Interface to configure options:
67
68 .. code-block:: none
69    :caption: ovsdb.yang
70
71     list options {
72         description "Port/Interface related optional input values";
73         key "option";
74         leaf option {
75             description "Option name";
76             type string;
77         }
78         leaf value {
79             description "Option value";
80             type string;
81         }
82
83 For flow based tunnels we will set option name ``remote_ip`` to
84 value ``flow``.
85
86 MDSALUtil changes
87 -----------------
88 Following new actions will be added to ``mdsalutil/ActionType.java``
89
90 * set_tunnel_src_ip
91 * set_tunnel_dest_ip
92
93 Following new matches will be added to ``mdsalutil/NxMatchFieldType.java``
94
95 * tun_src_ip
96 * tun_dest_ip
97
98 Pipeline changes
99 ----------------
100 This change adds a new match in **Table0**. Today we match in ``in_port``
101 to determine which tunnel interface this pkt came in on. Since currently
102 each tunnel maps to a source-destination pair it tells us about source device.
103 For interfaces configured to use flow based tunnels this will add an
104 additional match for ``tun_src_ip``. So, ``in_port+tunnel_src_ip`` will
105 give us which tunnel interface this pkt belongs to.
106
107 When services call ``getEgressActions(), they will get one additional action,
108 ``set_tunnel_dest_ip`` before the ``output:ofport`` action.
109
110 YANG changes
111 ------------
112 Changes will be needed in ``itm.yang`` and ``odl-interface.yang`` to allow
113 configuring a tunnel as flow based or not.
114
115 ITM YANG changes
116 ^^^^^^^^^^^^^^^^
117 A new parameter ``option-of-tunnel`` will be added to ``list-vteps``
118
119 .. code-block:: none
120    :caption: itm.yang
121    :emphasize-lines: 12-15
122
123     list vteps {
124         key "dpn-id portname";
125         leaf dpn-id {
126             type uint64;
127         }
128         leaf portname {
129             type string;
130         }
131         leaf ip-address {
132             type inet:ip-address;
133         }
134         leaf option-of-tunnel {
135             type boolean;
136             default false;
137         }
138     }
139
140 Same parameter will also be added to ``tunnel-end-points`` in ``itm-state.yang``.
141 This will help eliminate need to retrieve information from TransportZones when configuring
142 tunnel interfaces.
143
144 .. code-block:: none
145    :caption: itm-state.yang
146    :emphasize-lines: 11-14
147
148     list tunnel-end-points {
149         ordered-by user;
150         key "portname VLAN-ID ip-address tunnel-type";
151         /* Multiple tunnels on the same physical port but on different VLAN can be supported */
152
153         leaf portname {
154             type string;
155         }
156         ...
157         ...
158         leaf option-of-tunnel {
159             type boolean;
160             default false;
161         }
162     }
163
164
165 This will allow to set OF Tunnels on per VTEP basis. So in a transport-zone
166 we can have some VTEPs (devices) that use OF Tunnels and others that don't.
167 Default of false means it will not impact existing behavior and will need to
168 be explicitly configured. Going forward we can choose to set default true.
169
170 IFM YANG changes
171 ^^^^^^^^^^^^^^^^
172 We'll add a new ``tunnel-optional-params`` and add them to ``iftunnel``
173
174 .. code-block:: none
175    :caption: odl-interface.yang
176    :emphasize-lines: 1-23
177
178     grouping tunnel-optional-params {
179         leaf tunnel-source-ip-flow {
180             type boolean;
181             default false;
182         }
183
184         leaf tunnel-remote-ip-flow {
185             type boolean;
186             default false;
187         }
188
189         list tunnel-options {
190             key "tunnel-option";
191             leaf tunnel-option {
192                 description "Tunnel Option name";
193                 type string;
194             }
195             leaf value {
196                 description "Option value";
197                 type string;
198             }
199         }
200     }
201
202 The ``list tunnel-options`` is a list of key-value pairs of strings, similar to
203 options in OVSDB Plugin. These are not needed for OF Tunnels but is being added
204 to allow user to configure any other Interface options that OVS supports. Aim is to
205 enable developers and users try out newer options supported by OVS without needing to
206 add explicit support for it. Note that there is no counterpart for this option in
207 ``itm.yang``. Any options that we want to explicitly support will be added as a separate
208 option. This will allow us to do better validations for options that are needed for
209 our specific use cases.
210
211
212 .. code-block:: none
213    :emphasize-lines: 6
214
215     augment "/if:interfaces/if:interface" {
216         ext:augment-identifier "if-tunnel";
217         when "if:type = 'ianaift:tunnel'";
218         ...
219         ...
220         uses tunnel-optional-params;
221         uses monitor-params;
222     }
223
224 Workflow
225 --------
226
227 Adding tep
228 ^^^^^^^^^^
229
230 #. User: While adding tep user gives ``option-of-tunnel:true`` for tep being
231    added.
232 #. ITM: When creating tunnel interfaces for this tep, if
233    ``option-of-tunnel:true``, set ``tunnel-remote-ip:true`` for the tunnel
234    interface.
235 #. IFM: If ``option-of-tunnel:true`` and this is first tunne on this device,
236    set ``option:remote_ip=flow`` when creating tunnel interface in OVSDB. Else,
237    set ``option:remote_ip=<destination-ip>``.
238
239 Deleting tep
240 ^^^^^^^^^^^^
241
242 #. If ``tunnel-remote-ip:true`` and this is *last* tunnel on this device,
243    delete tunnel port in OVSDB. Else, do nothing.
244 #. If ``tunnel-remote-ip:false``, follow existing logic.
245
246 Configuration impact
247 ---------------------
248 This change doesn't add or modify any configuration parameters.
249
250 Clustering considerations
251 -------------------------
252 Any clustering requirements are already addressed in ITM and IFM, no new
253 requirements added as part of this feature.
254
255 Other Infra considerations
256 --------------------------
257 N.A.
258
259 Security considerations
260 -----------------------
261 N.A.
262
263 Scale and Performance Impact
264 ----------------------------
265 This solution will help improve scale numbers by reducing no. of interfaces
266 created on devices as well as no. of interfaces and ports present in
267 ``inventory`` and ``network-topology``.
268
269 Targeted Release(s)
270 -------------------
271 Carbon.
272 Boron-SR3.
273
274 Known Limitations
275 -----------------
276 BFD monitoring will not work when OF Tunnels are used. Today BFD monitoring in
277 OVS relies on destination_ip configured in remote_ip when creating tunnel port
278 to determine target IP for BFD packets. If we use ``flow`` it won't know where
279 to send BFD packets. Unless OVS allows adding destination IP for BFD monitoring
280 on such tunnels, monitoring cannot be enabled.
281
282 Alternatives
283 ------------
284 LLDP/ARP based monitoring was considered for OF tunnels to overcome lack of BFD
285 monitoring but was rejected because LLDP/ARP based monitoring doesn't scale
286 well. Since driving requirement for this feature is scale setups, it didn't
287 make sense to use an unscalable solution for monitoring.
288
289 XML/CFG file based global knob to enable OF tunnels for all tunnel interfaces
290 was rejected due to inflexible nature of such a solution. Current solution
291 allows a more fine grained and device based configuration at runtime. Also,
292 wanted to avoid adding yet another global configuration knob.
293
294 Usage
295 =====
296
297 Features to Install
298 -------------------
299 This feature doesn't add any new karaf feature.
300
301 REST API
302 --------
303
304 Adding TEPs to transport zone
305 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
306
307 For most users TEP Addition is the only configuration they need to do to create
308 tunnels using genius. The REST API to add TEPs with OF Tunnels is same as earlier
309 with one small addition.
310
311 **URL:** restconf/config/itm:transport-zones/
312
313 **Sample JSON data**
314
315 .. code-block:: json
316    :emphasize-lines: 14
317
318    {
319     "transport-zone": [
320         {
321             "zone-name": "TZA",
322             "subnets": [
323                 {
324                     "prefix": "192.168.56.0/24",
325                     "vlan-id": 0,
326                     "vteps": [
327                         {
328                             "dpn-id": "1",
329                             "portname": "eth2",
330                             "ip-address": "192.168.56.101",
331                             "option-of-tunnel":"true"
332                         }
333                     ],
334                     "gateway-ip": "0.0.0.0"
335                 }
336             ],
337             "tunnel-type": "odl-interface:tunnel-type-vxlan"
338         }
339     ]
340    }
341
342
343 Creating tunnel-interface directly in IFM
344 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
345
346 This use case is mainly for those who want to write applications using Genius and/or
347 want to create individual tunnel interfaces. Note that this is a simpler easy way to
348 create tunnels without needing to delve into how OVSDB Plugin creates tunnels.
349
350 Refer `Genius User Guide <http://docs.opendaylight.org/en/latest/user-guide/genius-user-guide.html#creating-overlay-tunnel-interfaces>`__
351 for more details on this.
352
353 **URL:** restconf/config/ietf-interfaces:interfaces
354
355 **Sample JSON data**
356
357 .. code-block:: json
358    :emphasize-lines: 10
359
360    {
361     "interfaces": {
362     "interface": [
363         {
364             "name": "vxlan_tunnel",
365             "type": "iana-if-type:tunnel",
366             "odl-interface:tunnel-interface-type": "odl-interface:tunnel-type-vxlan",
367             "odl-interface:datapath-node-identifier": "1",
368             "odl-interface:tunnel-source": "192.168.56.101",
369             "odl-interface:tunnel-destination": "192.168.56.102",
370             "odl-interface:tunnel-remote-ip-flow": "true",
371             "odl-interface:monitor-enabled": false,
372             "odl-interface:monitor-interval": 10000,
373             "enabled": true
374         }
375      ]
376     }
377    }
378
379
380 CLI
381 ---
382
383 A new boolean option, ``remoteIpFlow`` will be added to ``tep:add`` command.
384
385 .. code-block:: none
386   :emphasize-lines: 7,24-25
387
388   DESCRIPTION
389     tep:add
390     adding a tunnel end point
391
392   SYNTAX
393     tep:add [dpnId] [portNo] [vlanId] [ipAddress] [subnetMask] [gatewayIp] [transportZone]
394     [remoteIpFlow]
395
396   ARGUMENTS
397     dpnId
398             DPN-ID
399     portNo
400             port-name
401     vlanId
402             vlan-id
403     ipAddress
404             ip-address
405     subnetMask
406             subnet-Mask
407     gatewayIp
408             gateway-ip
409     transportZone
410             transport_zone
411     remoteIpFlow
412             Use flow for remote ip
413
414
415 Implementation
416 ==============
417
418 Assignee(s)
419 -----------
420 Primary assignee:
421   <Vishal Thapar>
422
423 Other contributors:
424   <Vacancies available>
425
426
427 Work Items
428 ----------
429 #. YANG changes
430 #. Add relevant match and actions to MDSALUtil
431 #. Add ``set_tunnel_dest_ip`` action to actions returned in
432    ``getEgressActions()`` for OF Tunnels.
433 #. Add match on ``tun_src_ip`` in **Table0** for OF Tunnels.
434 #. Add CLI.
435 #. Add UTs.
436 #. Add ITs.
437 #. Add CSIT.
438 #. Add Documentation
439
440 Dependencies
441 ============
442 This doesn't add any new dependencies. This requires minimum of ``OVS 2.0.0``
443 which is already lower than required by some of other features.
444
445 This change is backwards compatible, so no impact on dependent projects.
446 Projects can choose to start using this when they want. However, there is a
447 known limitation with monitoring, refer Limitations section for details.
448
449 Following projects currently depend on Genius:
450
451 * Netvirt
452 * SFC
453
454 Testing
455 =======
456
457 Unit Tests
458 ----------
459 Appropriate UTs will be added for the new code coming in once framework is in place.
460
461 Integration Tests
462 -----------------
463 Integration tests will be added once IT framework for ITM and IFM is ready.
464
465 CSIT
466 ----
467 CSIT already has test cases for tunnels which test with non OF Tunnels. Similar test
468 cases will be added for OF Tunnels. Alternatively, some of the existing test cases
469 that use multiple teps can be tweaked to use OF Tunnels for one of them.
470
471 Following test cases will need to be added/expanded in Genius CSIT:
472
473 #. Create a TZ with more than one TEPs set to use OF Tunnels and test datapath.
474 #. Create a TZ with mix of OF and non OF Tunnels and test datapath.
475 #. Delete a TEP using OF Tunnels and add it again with non OF tunnels and test
476    the datapath.
477 #. Delete a TEP using non OF Tunnels and add it again with OF Tunnels and test
478    datapath.
479
480 Documentation Impact
481 ====================
482 This will require changes to User Guide and Developer Guide.
483
484 User Guide will need to add information on how to add TEPs with flow based
485 tunnels.
486
487 Developer Guide will need to capture how to use changes in IFM to create
488 individual tunnel interfaces.
489
490 References
491 ==========
492
493 * https://wiki.opendaylight.org/view/Genius:Carbon_Release_Plan