Merge "Add information on referencing locations in reST"
[docs.git] / docs / user-guide / service-function-chaining.rst
1 Service Function Chaining
2 =========================
3
4 OpenDaylight Service Function Chaining (SFC) Overview
5 -----------------------------------------------------
6
7 OpenDaylight Service Function Chaining (SFC) provides the ability to
8 define an ordered list of a network services (e.g. firewalls, load
9 balancers). These service are then "stitched" together in the network to
10 create a service chain. This project provides the infrastructure
11 (chaining logic, APIs) needed for ODL to provision a service chain in
12 the network and an end-user application for defining such chains.
13
14 -  ACE - Access Control Entry
15
16 -  ACL - Access Control List
17
18 -  SCF - Service Classifier Function
19
20 -  SF - Service Function
21
22 -  SFC - Service Function Chain
23
24 -  SFF - Service Function Forwarder
25
26 -  SFG - Service Function Group
27
28 -  SFP - Service Function Path
29
30 -  RSP - Rendered Service Path
31
32 -  NSH - Network Service Header
33
34 SFC User Interface
35 ------------------
36
37 Overview
38 ~~~~~~~~
39
40 SFC User Interface (SFC-UI) is based on Dlux project. It provides an
41 easy way to create, read, update and delete configuration stored in
42 datastore. Moreover, it shows the status of all SFC features (e.g
43 installed, uninstalled) and Karaf log messages as well.
44
45 SFC-UI Architecture
46 ~~~~~~~~~~~~~~~~~~~
47
48 SFC-UI operates purely by using RESTCONF.
49
50 .. figure:: ./images/sfc/sfc-ui-architecture.png
51    :alt: SFC-UI integration into ODL
52
53    SFC-UI integration into ODL
54
55 Configuring SFC-UI
56 ~~~~~~~~~~~~~~~~~~
57
58 1. Run ODL distribution (run karaf)
59
60 2. In Karaf console execute: ``feature:install odl-sfc-ui``
61
62 3. Visit SFC-UI on: ``http://<odl_ip_address>:8181/sfc/index.html``
63
64 SFC Southbound REST Plug-in
65 --------------------------
66
67 Overview
68 ~~~~~~~~
69
70 The Southbound REST Plug-in is used to send configuration from datastore
71 down to network devices supporting a REST API (i.e. they have a
72 configured REST URI). It supports POST/PUT/DELETE operations, which are
73 triggered accordingly by changes in the SFC data stores.
74
75 -  Access Control List (ACL)
76
77 -  Service Classifier Function (SCF)
78
79 -  Service Function (SF)
80
81 -  Service Function Group (SFG)
82
83 -  Service Function Schedule Type (SFST)
84
85 -  Service Function Forwarder (SFF)
86
87 -  Rendered Service Path (RSP)
88
89 Southbound REST Plug-in Architecture
90 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91
92 From the user perspective, the REST plug-in is another SFC Southbound
93 plug-in used to communicate with network devices.
94
95 .. figure:: ./images/sfc/sb-rest-architecture-user.png
96    :alt: Southbound REST Plug-in integration into ODL
97
98    Southbound REST Plug-in integration into ODL
99
100 Configuring Southbound REST Plugin
101 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102
103 1. Run ODL distribution (run karaf)
104
105 2. In Karaf console execute: ``feature:install odl-sfc-sb-rest``
106
107 3. Configure REST URIs for SF/SFF through SFC User Interface or RESTCONF
108    (required configuration steps can be found in the tutorial stated
109    bellow)
110
111 Tutorial
112 ~~~~~~~~
113
114 Comprehensive tutorial on how to use the Southbound REST Plug-in and how
115 to control network devices with it can be found on:
116 https://wiki.opendaylight.org/view/Service_Function_Chaining:Main#SFC_101
117
118 SFC-OVS integration
119 -------------------
120
121 Overview
122 ~~~~~~~~
123
124 SFC-OVS provides integration of SFC with Open vSwitch (OVS) devices.
125 Integration is realized through mapping of SFC objects (like SF, SFF,
126 Classifier, etc.) to OVS objects (like Bridge,
127 TerminationPoint=Port/Interface). The mapping takes care of automatic
128 instantiation (setup) of corresponding object whenever its counterpart
129 is created. For example, when a new SFF is created, the SFC-OVS plug-in
130 will create a new OVS bridge and when a new OVS Bridge is created, the
131 SFC-OVS plug-in will create a new SFF.
132
133 The feature is intended for SFC users willing to use Open vSwitch as
134 underlying network infrastructure for deploying RSPs (Rendered Service
135 Paths).
136
137 SFC-OVS Architecture
138 ~~~~~~~~~~~~~~~~~~~~
139
140 SFC-OVS uses the OVSDB MD-SAL Southbound API for getting/writing
141 information from/to OVS devices. From the user perspective SFC-OVS acts
142 as a layer between SFC datastore and OVSDB.
143
144 .. figure:: ./images/sfc/sfc-ovs-architecture-user.png
145    :alt: SFC-OVS integration into ODL
146
147    SFC-OVS integration into ODL
148
149 Configuring SFC-OVS
150 ~~~~~~~~~~~~~~~~~~~
151
152 1. Run ODL distribution (run karaf)
153
154 2. In Karaf console execute: ``feature:install odl-sfc-ovs``
155
156 3. Configure Open vSwitch to use ODL as a manager, using following
157    command: ``ovs-vsctl set-manager tcp:<odl_ip_address>:6640``
158
159 Tutorials
160 ~~~~~~~~~
161
162 Verifying mapping from OVS to SFF
163 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
164
165 Overview
166 ''''''''
167
168 This tutorial shows the usual work flow when OVS configuration is
169 transformed to corresponding SFC objects (in this case SFF).
170
171 Prerequisites
172 ''''''''''''''
173
174 -  Open vSwitch installed (ovs-vsctl command available in shell)
175
176 -  SFC-OVS feature configured as stated above
177
178 Instructions
179 ''''''''''''
180
181 1. ``ovs-vsctl set-manager tcp:<odl_ip_address>:6640``
182
183 2. ``ovs-vsctl add-br br1``
184
185 3. ``ovs-vsctl add-port br1 testPort``
186
187 Verification
188 ''''''''''''
189
190 a. visit SFC User Interface:
191    ``http://<odl_ip_address>:8181/sfc/index.html#/sfc/serviceforwarder``
192
193 b. use pure RESTCONF and send GET request to URL:
194    ``http://<odl_ip_address>:8181/restconf/config/service-function-forwarder:service-function-forwarders``
195
196 There should be SFF, which name will be ending with *br1* and the SFF
197 should containt two DataPlane locators: *br1* and *testPort*.
198
199 Verifying mapping from SFF to OVS
200 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
201
202 Overview
203 ''''''''
204
205 This tutorial shows the usual workflow during creation of OVS Bridge
206 with use of SFC APIs.
207
208 Prerequisites
209 ''''''''''''''
210
211 -  Open vSwitch installed (ovs-vsctl command available in shell)
212
213 -  SFC-OVS feature configured as stated above
214
215 Instructions
216 ''''''''''''
217
218 1. In shell execute: ``ovs-vsctl set-manager tcp:<odl_ip_address>:6640``
219
220 2. Send POST request to URL:
221    ``http://<odl_ip_address>:8181/restconf/operations/service-function-forwarder-ovs:create-ovs-bridge``
222    Use Basic auth with credentials: "admin", "admin" and set
223    ``Content-Type: application/json``. The content of POST request
224    should be following:
225
226 ::
227
228     {
229         "input":
230         {
231             "name": "br-test",
232             "ovs-node": {
233                 "ip": "<Open_vSwitch_ip_address>"
234             }
235         }
236     }
237
238 Open\_vSwitch\_ip\_address is IP address of machine, where Open vSwitch
239 is installed.
240
241 Verification
242 ''''''''''''
243
244 In shell execute: ``ovs-vsctl show``. There should be Bridge with name
245 *br-test* and one port/interface called *br-test*.
246
247 Also, corresponding SFF for this OVS Bridge should be configured, which
248 can be verified through SFC User Interface or RESTCONF as stated in
249 previous tutorial.
250
251 SFC Classifier User Guide
252 -------------------------
253
254 Overview
255 ~~~~~~~~
256
257 Description of classifier can be found in:
258 https://datatracker.ietf.org/doc/draft-ietf-sfc-architecture/
259
260 There are two types of classifier:
261
262 1. OpenFlow Classifier
263
264 2. Iptables Classifier
265
266 OpenFlow Classifier
267 ~~~~~~~~~~~~~~~~~~~
268
269 OpenFlow Classifier implements the classification criteria based on
270 OpenFlow rules deployed into an OpenFlow switch. An Open vSwitch will
271 take the role of a classifier and performs various encapsulations such
272 NSH, VLAN, MPLS, etc. In the existing implementation, classifier can
273 support NSH encapsulation. Matching information is based on ACL for MAC
274 addresses, ports, protocol, IPv4 and IPv6. Supported protocols are TCP,
275 UDP and SCTP. Actions information in the OF rules, shall be forwarding
276 of the encapsulated packets with specific information related to the
277 RSP.
278
279 Classifier Architecture
280 ^^^^^^^^^^^^^^^^^^^^^^^
281
282 The OVSDB Southbound interface is used to create an instance of a bridge
283 in a specific location (via IP address). This bridge contains the
284 OpenFlow rules that perform the classification of the packets and react
285 accordingly. The OpenFlow Southbound interface is used to translate the
286 ACL information into OF rules within the Open vSwitch.
287
288 .. note::
289
290     in order to create the instance of the bridge that takes the role of
291     a classifier, an "empty" SFF must be created.
292
293 Configuring Classifier
294 ^^^^^^^^^^^^^^^^^^^^^^
295
296 1. An empty SFF must be created in order to host the ACL that contains
297    the classification information.
298
299 2. SFF data plane locator must be configured
300
301 3. Classifier interface must be manually added to SFF bridge.
302
303 Administering or Managing Classifier
304 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
305
306 Classification information is based on MAC addresses, protocol, ports
307 and IP. ACL gathers this information and is assigned to an RSP which
308 turns to be a specific path for a Service Chain.
309
310 Iptables Classifier
311 ~~~~~~~~~~~~~~~~~~~
312
313 Classifier manages everything from starting the packet listener to
314 creation (and removal) of appropriate ip(6)tables rules and marking
315 received packets accordingly. Its functionality is **available only on
316 Linux** as it leverdges **NetfilterQueue**, which provides access to
317 packets matched by an **iptables** rule. Classifier requires **root
318 privileges** to be able to operate.
319
320 So far it is capable of processing ACL for MAC addresses, ports, IPv4
321 and IPv6. Supported protocols are TCP and UDP.
322
323 Classifier Architecture
324 ^^^^^^^^^^^^^^^^^^^^^^^
325
326 Python code located in the project repository
327 sfc-py/common/classifier.py.
328
329 .. note::
330
331     classifier assumes that Rendered Service Path (RSP) **already
332     exists** in ODL when an ACL referencing it is obtained
333
334 1. sfc\_agent receives an ACL and passes it for processing to the
335    classifier
336
337 2. the RSP (its SFF locator) referenced by ACL is requested from ODL
338
339 3. if the RSP exists in the ODL then ACL based iptables rules for it are
340    applied
341
342 After this process is over, every packet successfully matched to an
343 iptables rule (i.e. successfully classified) will be NSH encapsulated
344 and forwarded to a related SFF, which knows how to traverse the RSP.
345
346 Rules are created using appropriate iptables command. If the Access
347 Control Entry (ACE) rule is MAC address related both iptables and
348 IPv6 tables rules re issued. If ACE rule is IPv4 address related, only
349 iptables rules are issued, same for IPv6.
350
351 .. note::
352
353     iptables **raw** table contains all created rules
354
355 Configuring Classifier
356 ^^^^^^^^^^^^^^^^^^^^^^
357
358 | Classfier does’t need any configuration.
359 | Its only requirement is that the **second (2) Netfilter Queue** is not
360   used by any other process and is **avalilable for the classifier**.
361
362 Administering or Managing Classifier
363 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
364
365 Classifier runs alongside sfc\_agent, therefore the command for starting
366 it locally is:
367
368 ::
369
370     sudo python3.4 sfc-py/sfc_agent.py --rest --odl-ip-port localhost:8181 --auto-sff-name --nfq-class
371
372 SFC OpenFlow Renderer User Guide
373 --------------------------------
374
375 Overview
376 ~~~~~~~~
377
378 The Service Function Chaining (SFC) OpenFlow Renderer (SFC OF Renderer)
379 implements Service Chaining on OpenFlow switches. It listens for the
380 creation of a Rendered Service Path (RSP), and once received it programs
381 Service Function Forwarders (SFF) that are hosted on OpenFlow capable
382 switches to steer packets through the service chain.
383
384 Common acronyms used in the following sections:
385
386 -  SF - Service Function
387
388 -  SFF - Service Function Forwarder
389
390 -  SFC - Service Function Chain
391
392 -  SFP - Service Function Path
393
394 -  RSP - Rendered Service Path
395
396 SFC OpenFlow Renderer Architecture
397 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
398
399 The SFC OF Renderer is invoked after a RSP is created using an MD-SAL
400 listener called ``SfcOfRspDataListener``. Upon SFC OF Renderer
401 initialization, the ``SfcOfRspDataListener`` registers itself to listen
402 for RSP changes. When invoked, the ``SfcOfRspDataListener`` processes
403 the RSP and calls the ``SfcOfFlowProgrammerImpl`` to create the
404 necessary flows in the Service Function Forwarders configured in the
405 RSP. Refer to the following diagram for more details.
406
407 .. figure:: ./images/sfc/sfcofrenderer_architecture.png
408    :alt: SFC OpenFlow Renderer High Level Architecture
409
410    SFC OpenFlow Renderer High Level Architecture
411
412 .. _sfc-user-guide-sfc-of-pipeline:
413
414 SFC OpenFlow Switch Flow pipeline
415 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
416
417 The SFC OpenFlow Renderer uses the following tables for its Flow
418 pipeline:
419
420 -  Table 0, Classifier
421
422 -  Table 1, Transport Ingress
423
424 -  Table 2, Path Mapper
425
426 -  Table 3, Path Mapper ACL
427
428 -  Table 4, Next Hop
429
430 -  Table 10, Transport Egress
431
432 The OpenFlow Table Pipeline is intended to be generic to work for all of
433 the different encapsulations supported by SFC.
434
435 All of the tables are explained in detail in the following section.
436
437 The SFFs (SFF1 and SFF2), SFs (SF1), and topology used for the flow
438 tables in the following sections are as described in the following
439 diagram.
440
441 .. figure:: ./images/sfc/sfcofrenderer_nwtopo.png
442    :alt: SFC OpenFlow Renderer Typical Network Topology
443
444    SFC OpenFlow Renderer Typical Network Topology
445
446 Classifier Table detailed
447 ^^^^^^^^^^^^^^^^^^^^^^^^^
448
449 It is possible for the SFF to also act as a classifier. This table maps
450 subscriber traffic to RSPs, and is explained in detail in the classifier
451 documentation.
452
453 If the SFF is not a classifier, then this table will just have a simple
454 Goto Table 1 flow.
455
456 Transport Ingress Table detailed
457 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
458
459 The Transport Ingress table has an entry per expected tunnel transport
460 type to be received in a particular SFF, as established in the SFC
461 configuration.
462
463 Here are two example on SFF1: one where the RSP ingress tunnel is MPLS
464 assuming VLAN is used for the SFF-SF, and the other where the RSP
465 ingress tunnel is NSH GRE (UDP port 4789):
466
467 +----------+-------------------------------------+--------------+
468 | Priority | Match                               | Action       |
469 +==========+=====================================+==============+
470 | 256      | EtherType==0x8847 (MPLS unicast)    | Goto Table 2 |
471 +----------+-------------------------------------+--------------+
472 | 256      | EtherType==0x8100 (VLAN)            | Goto Table 2 |
473 +----------+-------------------------------------+--------------+
474 | 256      | EtherType==0x0800,udp,tp\_dst==4789 | Goto Table 2 |
475 |          | (IP v4)                             |              |
476 +----------+-------------------------------------+--------------+
477 | 5        | Match Any                           | Drop         |
478 +----------+-------------------------------------+--------------+
479
480 Table: Table Transport Ingress
481
482 Path Mapper Table detailed
483 ^^^^^^^^^^^^^^^^^^^^^^^^^^
484
485 The Path Mapper table has an entry per expected tunnel transport info to
486 be received in a particular SFF, as established in the SFC
487 configuration. The tunnel transport info is used to determine the RSP
488 Path ID, and is stored in the OpenFlow Metadata. This table is not used
489 for NSH, since the RSP Path ID is stored in the NSH header.
490
491 For SF nodes that do not support NSH tunneling, the IP header DSCP field
492 is used to store the RSP Path Id. The RSP Path Id is written to the DSCP
493 field in the Transport Egress table for those packets sent to an SF.
494
495 Here is an example on SFF1, assuming the following details:
496
497 -  VLAN ID 1000 is used for the SFF-SF
498
499 -  The RSP Path 1 tunnel uses MPLS label 100 for ingress and 101 for
500    egress
501
502 -  The RSP Path 2 (symmetric downlink path) uses MPLS label 101 for
503    ingress and 100 for egress
504
505 +----------+-------------------+-----------------------+
506 | Priority | Match             | Action                |
507 +==========+===================+=======================+
508 | 256      | MPLS Label==100   | RSP Path=1, Pop MPLS, |
509 |          |                   | Goto Table 4          |
510 +----------+-------------------+-----------------------+
511 | 256      | MPLS Label==101   | RSP Path=2, Pop MPLS, |
512 |          |                   | Goto Table 4          |
513 +----------+-------------------+-----------------------+
514 | 256      | VLAN ID==1000, IP | RSP Path=1, Pop VLAN, |
515 |          | DSCP==1           | Goto Table 4          |
516 +----------+-------------------+-----------------------+
517 | 256      | VLAN ID==1000, IP | RSP Path=2, Pop VLAN, |
518 |          | DSCP==2           | Goto Table 4          |
519 +----------+-------------------+-----------------------+
520 | 5        | Match Any         | Goto Table 3          |
521 +----------+-------------------+-----------------------+
522
523 Table: Table Path Mapper
524
525 Path Mapper ACL Table detailed
526 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
527
528 This table is only populated when PacketIn packets are received from the
529 switch for TcpProxy type SFs. These flows are created with an inactivity
530 timer of 60 seconds and will be automatically deleted upon expiration.
531
532 Next Hop Table detailed
533 ^^^^^^^^^^^^^^^^^^^^^^^
534
535 The Next Hop table uses the RSP Path Id and appropriate packet fields to
536 determine where to send the packet next. For NSH, only the NSP (Network
537 Services Path, RSP ID) and NSI (Network Services Index, next hop) fields
538 from the NSH header are needed to determine the VXLAN tunnel destination
539 IP. For VLAN or MPLS, then the source MAC address is used to determine
540 the destination MAC address.
541
542 Here are two examples on SFF1, assuming SFF1 is connected to SFF2. RSP
543 Paths 1 and 2 are symmetric VLAN paths. RSP Paths 3 and 4 are symmetric
544 NSH paths. RSP Path 1 ingress packets come from external to SFC, for
545 which we don’t have the source MAC address (MacSrc).
546
547 +----------+--------------------------------+--------------------------------+
548 | Priority | Match                          | Action                         |
549 +==========+================================+================================+
550 | 256      | RSP Path==1, MacSrc==SF1       | MacDst=SFF2, Goto Table 10     |
551 +----------+--------------------------------+--------------------------------+
552 | 256      | RSP Path==2, MacSrc==SF1       | Goto Table 10                  |
553 +----------+--------------------------------+--------------------------------+
554 | 256      | RSP Path==2, MacSrc==SFF2      | MacDst=SF1, Goto Table 10      |
555 +----------+--------------------------------+--------------------------------+
556 | 246      | RSP Path==1                    | MacDst=SF1, Goto Table 10      |
557 +----------+--------------------------------+--------------------------------+
558 | 256      | nsp=3,nsi=255 (SFF Ingress RSP | load:0xa000002→NXM\_NX\_TUN\_I |
559 |          | 3)                             | PV4\_DST[],                    |
560 |          |                                | Goto Table 10                  |
561 +----------+--------------------------------+--------------------------------+
562 | 256      | nsp=3,nsi=254 (SFF Ingress     | load:0xa00000a→NXM\_NX\_TUN\_I |
563 |          | from SF, RSP 3)                | PV4\_DST[],                    |
564 |          |                                | Goto Table 10                  |
565 +----------+--------------------------------+--------------------------------+
566 | 256      | nsp=4,nsi=254 (SFF1 Ingress    | load:0xa00000a→NXM\_NX\_TUN\_I |
567 |          | from SFF2)                     | PV4\_DST[],                    |
568 |          |                                | Goto Table 10                  |
569 +----------+--------------------------------+--------------------------------+
570 | 5        | Match Any                      | Drop                           |
571 +----------+--------------------------------+--------------------------------+
572
573 Table: Table Next Hop
574
575 Transport Egress Table detailed
576 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
577
578 The Transport Egress table prepares egress tunnel information and sends
579 the packets out.
580
581 Here are two examples on SFF1. RSP Paths 1 and 2 are symmetric MPLS
582 paths that use VLAN for the SFF-SF. RSP Paths 3 and 4 are symmetric NSH
583 paths. Since it is assumed that switches used for NSH will only have one
584 VXLAN port, the NSH packets are just sent back where they came from.
585
586 +----------+--------------------------------+--------------------------------+
587 | Priority | Match                          | Action                         |
588 +==========+================================+================================+
589 | 256      | RSP Path==1, MacDst==SF1       | Push VLAN ID 1000, Port=SF1    |
590 +----------+--------------------------------+--------------------------------+
591 | 256      | RSP Path==1, MacDst==SFF2      | Push MPLS Label 101, Port=SFF2 |
592 +----------+--------------------------------+--------------------------------+
593 | 256      | RSP Path==2, MacDst==SF1       | Push VLAN ID 1000, Port=SF1    |
594 +----------+--------------------------------+--------------------------------+
595 | 246      | RSP Path==2                    | Push MPLS Label 100,           |
596 |          |                                | Port=Ingress                   |
597 +----------+--------------------------------+--------------------------------+
598 | 256      | nsp=3,nsi=255 (SFF Ingress RSP | IN\_PORT                       |
599 |          | 3)                             |                                |
600 +----------+--------------------------------+--------------------------------+
601 | 256      | nsp=3,nsi=254 (SFF Ingress     | IN\_PORT                       |
602 |          | from SF, RSP 3)                |                                |
603 +----------+--------------------------------+--------------------------------+
604 | 256      | nsp=4,nsi=254 (SFF1 Ingress    | IN\_PORT                       |
605 |          | from SFF2)                     |                                |
606 +----------+--------------------------------+--------------------------------+
607 | 5        | Match Any                      | Drop                           |
608 +----------+--------------------------------+--------------------------------+
609
610 Table: Table Transport Egress
611
612 Administering SFC OF Renderer
613 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
614
615 To use the SFC OpenFlow Renderer Karaf, at least the following Karaf
616 features must be installed.
617
618 -  odl-openflowplugin-nxm-extensions
619
620 -  odl-openflowplugin-flow-services
621
622 -  odl-sfc-provider
623
624 -  odl-sfc-model
625
626 -  odl-sfc-openflow-renderer
627
628 -  odl-sfc-ui (optional)
629
630 The following command can be used to view all of the currently installed
631 Karaf features:
632
633 ::
634
635     opendaylight-user@root>feature:list -i
636
637 Or, pipe the command to a grep to see a subset of the currently
638 installed Karaf features:
639
640 ::
641
642     opendaylight-user@root>feature:list -i | grep sfc
643
644 To install a particular feature, use the Karaf ``feature:install``
645 command.
646
647 SFC OF Renderer Tutorial
648 ~~~~~~~~~~~~~~~~~~~~~~~~
649
650 Overview
651 ^^^^^^^^
652
653 In this tutorial, 2 different encapsulations will be shown: MPLS and
654 NSH. The following Network Topology diagram is a logical view of the
655 SFFs and SFs involved in creating the Service Chains.
656
657 .. figure:: ./images/sfc/sfcofrenderer_nwtopo.png
658    :alt: SFC OpenFlow Renderer Typical Network Topology
659
660    SFC OpenFlow Renderer Typical Network Topology
661
662 Prerequisites
663 ^^^^^^^^^^^^^
664
665 To use this example, SFF OpenFlow switches must be created and connected
666 as illustrated above. Additionally, the SFs must be created and
667 connected.
668
669 Note that RSP symmetry depends on Service Function Path symmetric field, if present.
670 If not, the RSP will be symmetric if any of the SFs involved in the chain
671 has the bidirectional field set to true.
672
673 Target Environment
674 ^^^^^^^^^^^^^^^^^^
675
676 The target environment is not important, but this use-case was created
677 and tested on Linux.
678
679 Instructions
680 ^^^^^^^^^^^^
681
682 The steps to use this tutorial are as follows. The referenced
683 configuration in the steps is listed in the following sections.
684
685 There are numerous ways to send the configuration. In the following
686 configuration chapters, the appropriate ``curl`` command is shown for
687 each configuration to be sent, including the URL.
688
689 Steps to configure the SFC OF Renderer tutorial:
690
691 1. Send the ``SF`` RESTCONF configuration
692
693 2. Send the ``SFF`` RESTCONF configuration
694
695 3. Send the ``SFC`` RESTCONF configuration
696
697 4. Send the ``SFP`` RESTCONF configuration
698
699 5. Create the ``RSP`` with a RESTCONF RPC command
700
701 Once the configuration has been successfully created, query the Rendered
702 Service Paths with either the SFC UI or via RESTCONF. Notice that the
703 RSP is symmetrical, so the following 2 RSPs will be created:
704
705 -  sfc-path1
706
707 -  sfc-path1-Reverse
708
709 At this point the Service Chains have been created, and the OpenFlow
710 Switches are programmed to steer traffic through the Service Chain.
711 Traffic can now be injected from a client into the Service Chain. To
712 debug problems, the OpenFlow tables can be dumped with the following
713 commands, assuming SFF1 is called ``s1`` and SFF2 is called ``s2``.
714
715 ::
716
717     sudo ovs-ofctl -O OpenFlow13  dump-flows s1
718
719 ::
720
721     sudo ovs-ofctl -O OpenFlow13  dump-flows s2
722
723 In all the following configuration sections, replace the ``${JSON}``
724 string with the appropriate JSON configuration. Also, change the
725 ``localhost`` destination in the URL accordingly.
726
727 SFC OF Renderer NSH Tutorial
728 ''''''''''''''''''''''''''''
729
730 The following configuration sections show how to create the different
731 elements using NSH encapsulation.
732
733 | **NSH Service Function configuration**
734
735 The Service Function configuration can be sent with the following
736 command:
737
738 ::
739
740     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function:service-functions/
741
742 **SF configuration JSON.**
743
744 ::
745
746     {
747      "service-functions": {
748        "service-function": [
749          {
750            "name": "sf1",
751            "type": "http-header-enrichment",
752            "ip-mgmt-address": "10.0.0.2",
753            "sf-data-plane-locator": [
754              {
755                "name": "sf1dpl",
756                "ip": "10.0.0.10",
757                "port": 4789,
758                "transport": "service-locator:vxlan-gpe",
759                "service-function-forwarder": "sff1"
760              }
761            ]
762          },
763          {
764            "name": "sf2",
765            "type": "firewall",
766            "ip-mgmt-address": "10.0.0.3",
767            "sf-data-plane-locator": [
768              {
769                "name": "sf2dpl",
770                 "ip": "10.0.0.20",
771                 "port": 4789,
772                 "transport": "service-locator:vxlan-gpe",
773                "service-function-forwarder": "sff2"
774              }
775            ]
776          }
777        ]
778      }
779     }
780
781 | **NSH Service Function Forwarder configuration**
782
783 The Service Function Forwarder configuration can be sent with the
784 following command:
785
786 ::
787
788     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-forwarder:service-function-forwarders/
789
790 **SFF configuration JSON.**
791
792 ::
793
794     {
795      "service-function-forwarders": {
796        "service-function-forwarder": [
797          {
798            "name": "sff1",
799            "service-node": "openflow:2",
800            "sff-data-plane-locator": [
801              {
802                "name": "sff1dpl",
803                "data-plane-locator":
804                {
805                    "ip": "10.0.0.1",
806                    "port": 4789,
807                    "transport": "service-locator:vxlan-gpe"
808                }
809              }
810            ],
811            "service-function-dictionary": [
812              {
813                "name": "sf1",
814                "sff-sf-data-plane-locator":
815                {
816                    "sf-dpl-name": "sf1dpl",
817                    "sff-dpl-name": "sff1dpl"
818                }
819              }
820            ]
821          },
822          {
823            "name": "sff2",
824            "service-node": "openflow:3",
825            "sff-data-plane-locator": [
826              {
827                "name": "sff2dpl",
828                "data-plane-locator":
829                {
830                    "ip": "10.0.0.2",
831                    "port": 4789,
832                    "transport": "service-locator:vxlan-gpe"
833                }
834              }
835            ],
836            "service-function-dictionary": [
837              {
838                "name": "sf2",
839                "sff-sf-data-plane-locator":
840                {
841                    "sf-dpl-name": "sf2dpl",
842                    "sff-dpl-name": "sff2dpl"
843                }
844              }
845            ]
846          }
847        ]
848      }
849     }
850
851 | **NSH Service Function Chain configuration**
852
853 The Service Function Chain configuration can be sent with the following
854 command:
855
856 ::
857
858     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-chain:service-function-chains/
859
860 **SFC configuration JSON.**
861
862 ::
863
864     {
865      "service-function-chains": {
866        "service-function-chain": [
867          {
868            "name": "sfc-chain1",
869            "sfc-service-function": [
870              {
871                "name": "hdr-enrich-abstract1",
872                "type": "http-header-enrichment"
873              },
874              {
875                "name": "firewall-abstract1",
876                "type": "firewall"
877              }
878            ]
879          }
880        ]
881      }
882     }
883
884 | **NSH Service Function Path configuration**
885
886 The Service Function Path configuration can be sent with the following
887 command:
888
889 ::
890
891     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-path:service-function-paths/
892
893 **SFP configuration JSON.**
894
895 ::
896
897     {
898       "service-function-paths": {
899         "service-function-path": [
900           {
901             "name": "sfc-path1",
902             "service-chain-name": "sfc-chain1",
903             "transport-type": "service-locator:vxlan-gpe",
904             "symmetric": true
905           }
906         ]
907       }
908     }
909
910 | **NSH Rendered Service Path creation**
911
912 ::
913
914     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X POST --user admin:admin http://localhost:8181/restconf/operations/rendered-service-path:create-rendered-path/
915
916 **RSP creation JSON.**
917
918 ::
919
920     {
921      "input": {
922          "name": "sfc-path1",
923          "parent-service-function-path": "sfc-path1"
924      }
925     }
926
927 | **NSH Rendered Service Path removal**
928
929 The following command can be used to remove a Rendered Service Path
930 called ``sfc-path1``:
931
932 ::
933
934     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '{"input": {"name": "sfc-path1" } }' -X POST --user admin:admin http://localhost:8181/restconf/operations/rendered-service-path:delete-rendered-path/
935
936 | **NSH Rendered Service Path Query**
937
938 The following command can be used to query all of the created Rendered
939 Service Paths:
940
941 ::
942
943     curl -H "Content-Type: application/json" -H "Cache-Control: no-cache" -X GET --user admin:admin http://localhost:8181/restconf/operational/rendered-service-path:rendered-service-paths/
944
945 SFC OF Renderer MPLS Tutorial
946 '''''''''''''''''''''''''''''
947
948 The following configuration sections show how to create the different
949 elements using MPLS encapsulation.
950
951 | **MPLS Service Function configuration**
952
953 The Service Function configuration can be sent with the following
954 command:
955
956 ::
957
958     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function:service-functions/
959
960 **SF configuration JSON.**
961
962 ::
963
964     {
965      "service-functions": {
966        "service-function": [
967          {
968            "name": "sf1",
969            "type": "http-header-enrichment",
970            "ip-mgmt-address": "10.0.0.2",
971            "sf-data-plane-locator": [
972              {
973                "name": "sf1-sff1",
974                "mac": "00:00:08:01:02:01",
975                "vlan-id": 1000,
976                "transport": "service-locator:mac",
977                "service-function-forwarder": "sff1"
978              }
979            ]
980          },
981          {
982            "name": "sf2",
983            "type": "firewall",
984            "ip-mgmt-address": "10.0.0.3",
985            "sf-data-plane-locator": [
986              {
987                "name": "sf2-sff2",
988                "mac": "00:00:08:01:03:01",
989                "vlan-id": 2000,
990                "transport": "service-locator:mac",
991                "service-function-forwarder": "sff2"
992              }
993            ]
994          }
995        ]
996      }
997     }
998
999 | **MPLS Service Function Forwarder configuration**
1000
1001 The Service Function Forwarder configuration can be sent with the
1002 following command:
1003
1004 ::
1005
1006     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-forwarder:service-function-forwarders/
1007
1008 **SFF configuration JSON.**
1009
1010 ::
1011
1012     {
1013      "service-function-forwarders": {
1014        "service-function-forwarder": [
1015          {
1016            "name": "sff1",
1017            "service-node": "openflow:2",
1018            "sff-data-plane-locator": [
1019              {
1020                "name": "ulSff1Ingress",
1021                "data-plane-locator":
1022                {
1023                    "mpls-label": 100,
1024                    "transport": "service-locator:mpls"
1025                },
1026                "service-function-forwarder-ofs:ofs-port":
1027                {
1028                    "mac": "11:11:11:11:11:11",
1029                    "port-id" : "1"
1030                }
1031              },
1032              {
1033                "name": "ulSff1ToSff2",
1034                "data-plane-locator":
1035                {
1036                    "mpls-label": 101,
1037                    "transport": "service-locator:mpls"
1038                },
1039                "service-function-forwarder-ofs:ofs-port":
1040                {
1041                    "mac": "33:33:33:33:33:33",
1042                    "port-id" : "2"
1043                }
1044              },
1045              {
1046                "name": "toSf1",
1047                "data-plane-locator":
1048                {
1049                    "mac": "22:22:22:22:22:22",
1050                    "vlan-id": 1000,
1051                    "transport": "service-locator:mac",
1052                },
1053                "service-function-forwarder-ofs:ofs-port":
1054                {
1055                    "mac": "33:33:33:33:33:33",
1056                    "port-id" : "3"
1057                }
1058              }
1059            ],
1060            "service-function-dictionary": [
1061              {
1062                "name": "sf1",
1063                "sff-sf-data-plane-locator":
1064                {
1065                    "sf-dpl-name": "sf1-sff1",
1066                    "sff-dpl-name": "toSf1"
1067                }
1068              }
1069            ]
1070          },
1071          {
1072            "name": "sff2",
1073            "service-node": "openflow:3",
1074            "sff-data-plane-locator": [
1075              {
1076                "name": "ulSff2Ingress",
1077                "data-plane-locator":
1078                {
1079                    "mpls-label": 101,
1080                    "transport": "service-locator:mpls"
1081                },
1082                "service-function-forwarder-ofs:ofs-port":
1083                {
1084                    "mac": "44:44:44:44:44:44",
1085                    "port-id" : "1"
1086                }
1087              },
1088              {
1089                "name": "ulSff2Egress",
1090                "data-plane-locator":
1091                {
1092                    "mpls-label": 102,
1093                    "transport": "service-locator:mpls"
1094                },
1095                "service-function-forwarder-ofs:ofs-port":
1096                {
1097                    "mac": "66:66:66:66:66:66",
1098                    "port-id" : "2"
1099                }
1100              },
1101              {
1102                "name": "toSf2",
1103                "data-plane-locator":
1104                {
1105                    "mac": "55:55:55:55:55:55",
1106                    "vlan-id": 2000,
1107                    "transport": "service-locator:mac"
1108                },
1109                "service-function-forwarder-ofs:ofs-port":
1110                {
1111                    "port-id" : "3"
1112                }
1113              }
1114            ],
1115            "service-function-dictionary": [
1116              {
1117                "name": "sf2",
1118                "sff-sf-data-plane-locator":
1119                {
1120                    "sf-dpl-name": "sf2-sff2",
1121                    "sff-dpl-name": "toSf2"
1122
1123                },
1124                "service-function-forwarder-ofs:ofs-port":
1125                {
1126                    "port-id" : "3"
1127                }
1128              }
1129            ]
1130          }
1131        ]
1132      }
1133     }
1134
1135 | **MPLS Service Function Chain configuration**
1136
1137 The Service Function Chain configuration can be sent with the following
1138 command:
1139
1140 ::
1141
1142     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-chain:service-function-chains/
1143
1144 **SFC configuration JSON.**
1145
1146 ::
1147
1148     {
1149      "service-function-chains": {
1150        "service-function-chain": [
1151          {
1152            "name": "sfc-chain1",
1153            "sfc-service-function": [
1154              {
1155                "name": "hdr-enrich-abstract1",
1156                "type": "http-header-enrichment"
1157              },
1158              {
1159                "name": "firewall-abstract1",
1160                "type": "firewall"
1161              }
1162            ]
1163          }
1164        ]
1165      }
1166     }
1167
1168 | **MPLS Service Function Path configuration**
1169
1170 The Service Function Path configuration can be sent with the following
1171 command:
1172
1173 ::
1174
1175     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-path:service-function-paths/
1176
1177 **SFP configuration JSON.**
1178
1179 ::
1180
1181     {
1182       "service-function-paths": {
1183         "service-function-path": [
1184           {
1185             "name": "sfc-path1",
1186             "service-chain-name": "sfc-chain1",
1187             "transport-type": "service-locator:mpls",
1188             "symmetric": true
1189           }
1190         ]
1191       }
1192     }
1193
1194 | **MPLS Rendered Service Path creation**
1195
1196 ::
1197
1198     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X POST --user admin:admin http://localhost:8181/restconf/operations/rendered-service-path:create-rendered-path/
1199
1200 **RSP creation JSON.**
1201
1202 ::
1203
1204     {
1205      "input": {
1206          "name": "sfc-path1",
1207          "parent-service-function-path": "sfc-path1"
1208      }
1209     }
1210
1211 | **MPLS Rendered Service Path removal**
1212
1213 The following command can be used to remove a Rendered Service Path
1214 called ``sfc-path1``:
1215
1216 ::
1217
1218     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '{"input": {"name": "sfc-path1" } }' -X POST --user admin:admin http://localhost:8181/restconf/operations/rendered-service-path:delete-rendered-path/
1219
1220 | **MPLS Rendered Service Path Query**
1221
1222 The following command can be used to query all of the created Rendered
1223 Service Paths:
1224
1225 ::
1226
1227     curl -H "Content-Type: application/json" -H "Cache-Control: no-cache" -X GET --user admin:admin http://localhost:8181/restconf/operational/rendered-service-path:rendered-service-paths/
1228
1229 SFC IOS XE Renderer User Guide
1230 ------------------------------
1231
1232 Overview
1233 ~~~~~~~~
1234
1235 The early Service Function Chaining (SFC) renderer for IOS-XE devices
1236 (SFC IOS-XE renderer) implements Service Chaining functionality on
1237 IOS-XE capable switches. It listens for the creation of a Rendered
1238 Service Path (RSP) and sets up Service Function Forwarders (SFF) that
1239 are hosted on IOS-XE switches to steer traffic through the service
1240 chain.
1241
1242 Common acronyms used in the following sections:
1243
1244 -  SF - Service Function
1245
1246 -  SFF - Service Function Forwarder
1247
1248 -  SFC - Service Function Chain
1249
1250 -  SP - Service Path
1251
1252 -  SFP - Service Function Path
1253
1254 -  RSP - Rendered Service Path
1255
1256 -  LSF - Local Service Forwarder
1257
1258 -  RSF - Remote Service Forwarder
1259
1260 SFC IOS-XE Renderer Architecture
1261 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1262
1263 When the SFC IOS-XE renderer is initialized, all required listeners are
1264 registered to handle incoming data. It involves CSR/IOS-XE
1265 ``NodeListener`` which stores data about all configurable devices
1266 including their mountpoints (used here as databrokers),
1267 ``ServiceFunctionListener``, ``ServiceForwarderListener`` (see mapping)
1268 and ``RenderedPathListener`` used to listen for RSP changes. When the
1269 SFC IOS-XE renderer is invoked, ``RenderedPathListener`` calls the
1270 ``IosXeRspProcessor`` which processes the RSP change and creates all
1271 necessary Service Paths and Remote Service Forwarders (if necessary) on
1272 IOS-XE devices.
1273
1274 Service Path details
1275 ~~~~~~~~~~~~~~~~~~~~
1276
1277 Each Service Path is defined by index (represented by NSP) and contains
1278 service path entries. Each entry has appropriate service index (NSI) and
1279 definition of next hop. Next hop can be Service Function, different
1280 Service Function Forwarder or definition of end of chain - terminate.
1281 After terminating, the packet is sent to destination. If a SFF is
1282 defined as a next hop, it has to be present on device in the form of
1283 Remote Service Forwarder. RSFs are also created during RSP processing.
1284
1285 Example of Service Path:
1286
1287 ::
1288
1289     service-chain service-path 200
1290        service-index 255 service-function firewall-1
1291        service-index 254 service-function dpi-1
1292        service-index 253 terminate
1293
1294 Mapping to IOS-XE SFC entities
1295 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1296
1297 Renderer contains mappers for SFs and SFFs. IOS-XE capable device is
1298 using its own definition of Service Functions and Service Function
1299 Forwarders according to appropriate .yang file.
1300 ``ServiceFunctionListener`` serves as a listener for SF changes. If SF
1301 appears in datastore, listener extracts its management ip address and
1302 looks into cached IOS-XE nodes. If some of available nodes match,
1303 Service function is mapped in ``IosXeServiceFunctionMapper`` to be
1304 understandable by IOS-XE device and it’s written into device’s config.
1305 ``ServiceForwarderListener`` is used in a similar way. All SFFs with
1306 suitable management ip address it mapped in
1307 ``IosXeServiceForwarderMapper``. Remapped SFFs are configured as a Local
1308 Service Forwarders. It is not possible to directly create Remote Service
1309 Forwarder using IOS-XE renderer. RSF is created only during RSP
1310 processing.
1311
1312 Administering SFC IOS-XE renderer
1313 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1314
1315 To use the SFC IOS-XE Renderer Karaf, at least the following Karaf
1316 features must be installed:
1317
1318 -  odl-aaa-shiro
1319
1320 -  odl-sfc-model
1321
1322 -  odl-sfc-provider
1323
1324 -  odl-restconf
1325
1326 -  odl-netconf-topology
1327
1328 -  odl-sfc-ios-xe-renderer
1329
1330 SFC IOS-XE renderer Tutorial
1331 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1332
1333 Overview
1334 ^^^^^^^^
1335
1336 This tutorial is a simple example how to create Service Path on IOS-XE
1337 capable device using IOS-XE renderer
1338
1339 Preconditions
1340 ^^^^^^^^^^^^^
1341
1342 To connect to IOS-XE device, it is necessary to use several modified
1343 yang models and override device’s ones. All .yang files are in the
1344 ``Yang/netconf`` folder in the ``sfc-ios-xe-renderer module`` in the SFC
1345 project. These files have to be copied to the ``cache/schema``
1346 directory, before Karaf is started. After that, custom capabilities have
1347 to be sent to network-topology:
1348
1349 ::
1350
1351     PUT ./config/network-topology:network-topology/topology/topology-netconf/node/<device-name>
1352
1353     <node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
1354       <node-id>device-name</node-id>
1355       <host xmlns="urn:opendaylight:netconf-node-topology">device-ip</host>
1356       <port xmlns="urn:opendaylight:netconf-node-topology">2022</port>
1357       <username xmlns="urn:opendaylight:netconf-node-topology">login</username>
1358       <password xmlns="urn:opendaylight:netconf-node-topology">password</password>
1359       <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
1360       <keepalive-delay xmlns="urn:opendaylight:netconf-node-topology">0</keepalive-delay>
1361       <yang-module-capabilities xmlns="urn:opendaylight:netconf-node-topology">
1362          <override>true</override>
1363          <capability xmlns="urn:opendaylight:netconf-node-topology">
1364             urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&amp;revision=2013-07-15
1365          </capability>
1366          <capability xmlns="urn:opendaylight:netconf-node-topology">
1367             urn:ietf:params:xml:ns:yang:ietf-yang-types?module=ietf-yang-types&amp;revision=2013-07-15
1368          </capability>
1369          <capability xmlns="urn:opendaylight:netconf-node-topology">
1370             urn:ios?module=ned&amp;revision=2016-03-08
1371          </capability>
1372          <capability xmlns="urn:opendaylight:netconf-node-topology">
1373             http://tail-f.com/yang/common?module=tailf-common&amp;revision=2015-05-22
1374          </capability>
1375          <capability xmlns="urn:opendaylight:netconf-node-topology">
1376             http://tail-f.com/yang/common?module=tailf-meta-extensions&amp;revision=2013-11-07
1377          </capability>
1378          <capability xmlns="urn:opendaylight:netconf-node-topology">
1379             http://tail-f.com/yang/common?module=tailf-cli-extensions&amp;revision=2015-03-19
1380          </capability>
1381       </yang-module-capabilities>
1382     </node>
1383
1384 .. note::
1385
1386     The device name in the URL and in the XML must match.
1387
1388 Instructions
1389 ^^^^^^^^^^^^
1390
1391 When the IOS-XE renderer is installed, all NETCONF nodes in
1392 topology-netconf are processed and all capable nodes with accessible
1393 mountpoints are cached. The first step is to create LSF on node.
1394
1395 ``Service Function Forwarder configuration``
1396
1397 ::
1398
1399     PUT ./config/service-function-forwarder:service-function-forwarders
1400
1401     {
1402         "service-function-forwarders": {
1403             "service-function-forwarder": [
1404                 {
1405                     "name": "CSR1Kv-2",
1406                     "ip-mgmt-address": "172.25.73.23",
1407                     "sff-data-plane-locator": [
1408                         {
1409                             "name": "CSR1Kv-2-dpl",
1410                             "data-plane-locator": {
1411                                 "transport": "service-locator:vxlan-gpe",
1412                                 "port": 6633,
1413                                 "ip": "10.99.150.10"
1414                             }
1415                         }
1416                     ]
1417                 }
1418             ]
1419         }
1420     }
1421
1422 If the IOS-XE node with appropriate management IP exists, this
1423 configuration is mapped and LSF is created on the device. The same
1424 approach is used for Service Functions.
1425
1426 ::
1427
1428     PUT ./config/service-function:service-functions
1429
1430     {
1431         "service-functions": {
1432             "service-function": [
1433                 {
1434                     "name": "Firewall",
1435                     "ip-mgmt-address": "172.25.73.23",
1436                     "type": "firewall",
1437                     "sf-data-plane-locator": [
1438                         {
1439                             "name": "firewall-dpl",
1440                             "port": 6633,
1441                             "ip": "12.1.1.2",
1442                             "transport": "service-locator:gre",
1443                             "service-function-forwarder": "CSR1Kv-2"
1444                         }
1445                     ]
1446                 },
1447                 {
1448                     "name": "Dpi",
1449                     "ip-mgmt-address": "172.25.73.23",
1450                     "type":"dpi",
1451                     "sf-data-plane-locator": [
1452                         {
1453                             "name": "dpi-dpl",
1454                             "port": 6633,
1455                             "ip": "12.1.1.1",
1456                             "transport": "service-locator:gre",
1457                             "service-function-forwarder": "CSR1Kv-2"
1458                         }
1459                     ]
1460                 },
1461                 {
1462                     "name": "Qos",
1463                     "ip-mgmt-address": "172.25.73.23",
1464                     "type":"qos",
1465                     "sf-data-plane-locator": [
1466                         {
1467                             "name": "qos-dpl",
1468                             "port": 6633,
1469                             "ip": "12.1.1.4",
1470                             "transport": "service-locator:gre",
1471                             "service-function-forwarder": "CSR1Kv-2"
1472                         }
1473                     ]
1474                 }
1475             ]
1476         }
1477     }
1478
1479 All these SFs are configured on the same device as the LSF. The next
1480 step is to prepare Service Function Chain.
1481
1482 ::
1483
1484     PUT ./config/service-function-chain:service-function-chains/
1485
1486     {
1487         "service-function-chains": {
1488             "service-function-chain": [
1489                 {
1490                     "name": "CSR3XSF",
1491                     "sfc-service-function": [
1492                         {
1493                             "name": "Firewall",
1494                             "type": "firewall"
1495                         },
1496                         {
1497                             "name": "Dpi",
1498                             "type": "dpi"
1499                         },
1500                         {
1501                             "name": "Qos",
1502                             "type": "qos"
1503                         }
1504                     ]
1505                 }
1506             ]
1507         }
1508     }
1509
1510 Service Function Path:
1511
1512 ::
1513
1514     PUT ./config/service-function-path:service-function-paths/
1515
1516     {
1517         "service-function-paths": {
1518             "service-function-path": [
1519                 {
1520                     "name": "CSR3XSF-Path",
1521                     "service-chain-name": "CSR3XSF",
1522                     "starting-index": 255,
1523                     "symmetric": "true"
1524                 }
1525             ]
1526         }
1527     }
1528
1529 Without a classifier, there is possibility to POST RSP directly.
1530
1531 ::
1532
1533     POST ./operations/rendered-service-path:create-rendered-path
1534
1535     {
1536       "input": {
1537           "name": "CSR3XSF-Path-RSP",
1538           "parent-service-function-path": "CSR3XSF-Path"
1539       }
1540     }
1541
1542 The resulting configuration:
1543
1544 ::
1545
1546     !
1547     service-chain service-function-forwarder local
1548       ip address 10.99.150.10
1549     !
1550     service-chain service-function firewall
1551     ip address 12.1.1.2
1552       encapsulation gre enhanced divert
1553     !
1554     service-chain service-function dpi
1555     ip address 12.1.1.1
1556       encapsulation gre enhanced divert
1557     !
1558     service-chain service-function qos
1559     ip address 12.1.1.4
1560       encapsulation gre enhanced divert
1561     !
1562     service-chain service-path 1
1563       service-index 255 service-function firewall
1564       service-index 254 service-function dpi
1565       service-index 253 service-function qos
1566       service-index 252 terminate
1567     !
1568     service-chain service-path 2
1569       service-index 255 service-function qos
1570       service-index 254 service-function dpi
1571       service-index 253 service-function firewall
1572       service-index 252 terminate
1573     !
1574
1575 Service Path 1 is direct, Service Path 2 is reversed. Path numbers may
1576 vary.
1577
1578 Service Function Scheduling Algorithms
1579 --------------------------------------
1580
1581 Overview
1582 ~~~~~~~~
1583
1584 When creating the Rendered Service Path, the origin SFC controller chose
1585 the first available service function from a list of service function
1586 names. This may result in many issues such as overloaded service
1587 functions and a longer service path as SFC has no means to understand
1588 the status of service functions and network topology. The service
1589 function selection framework supports at least four algorithms (Random,
1590 Round Robin, Load Balancing and Shortest Path) to select the most
1591 appropriate service function when instantiating the Rendered Service
1592 Path. In addition, it is an extensible framework that allows 3rd party
1593 selection algorithm to be plugged in.
1594
1595 Architecture
1596 ~~~~~~~~~~~~
1597
1598 The following figure illustrates the service function selection
1599 framework and algorithms.
1600
1601 .. figure:: ./images/sfc/sf-selection-arch.png
1602    :alt: SF Selection Architecture
1603
1604    SF Selection Architecture
1605
1606 A user has three different ways to select one service function selection
1607 algorithm:
1608
1609 1. Integrated RESTCONF Calls. OpenStack and/or other administration
1610    system could provide plugins to call the APIs to select one
1611    scheduling algorithm.
1612
1613 2. Command line tools. Command line tools such as curl or browser
1614    plugins such as POSTMAN (for Google Chrome) and RESTClient (for
1615    Mozilla Firefox) could select schedule algorithm by making RESTCONF
1616    calls.
1617
1618 3. SFC-UI. Now the SFC-UI provides an option for choosing a selection
1619    algorithm when creating a Rendered Service Path.
1620
1621 The RESTCONF northbound SFC API provides GUI/RESTCONF interactions for
1622 choosing the service function selection algorithm. MD-SAL data store
1623 provides all supported service function selection algorithms, and
1624 provides APIs to enable one of the provided service function selection
1625 algorithms. Once a service function selection algorithm is enabled, the
1626 service function selection algorithm will work when creating a Rendered
1627 Service Path.
1628
1629 Select SFs with Scheduler
1630 ~~~~~~~~~~~~~~~~~~~~~~~~~
1631
1632 Administrator could use both the following ways to select one of the
1633 selection algorithm when creating a Rendered Service Path.
1634
1635 -  Command line tools. Command line tools includes Linux commands curl
1636    or even browser plugins such as POSTMAN(for Google Chrome) or
1637    RESTClient(for Mozilla Firefox). In this case, the following JSON
1638    content is needed at the moment:
1639    Service\_function\_schudule\_type.json
1640
1641    ::
1642
1643        {
1644          "service-function-scheduler-types": {
1645            "service-function-scheduler-type": [
1646              {
1647                "name": "random",
1648                "type": "service-function-scheduler-type:random",
1649                "enabled": false
1650              },
1651              {
1652                "name": "roundrobin",
1653                "type": "service-function-scheduler-type:round-robin",
1654                "enabled": true
1655              },
1656              {
1657                "name": "loadbalance",
1658                "type": "service-function-scheduler-type:load-balance",
1659                "enabled": false
1660              },
1661              {
1662                "name": "shortestpath",
1663                "type": "service-function-scheduler-type:shortest-path",
1664                "enabled": false
1665              }
1666            ]
1667          }
1668        }
1669
1670    If using the Linux curl command, it could be:
1671
1672    ::
1673
1674        curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '$${Service_function_schudule_type.json}'
1675        -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-scheduler-type:service-function-scheduler-types/
1676
1677    Here is also a snapshot for using the RESTClient plugin:
1678
1679 .. figure:: ./images/sfc/RESTClient-snapshot.png
1680    :alt: Mozilla Firefox RESTClient
1681
1682    Mozilla Firefox RESTClient
1683
1684 -  SFC-UI.SFC-UI provides a drop down menu for service function
1685    selection algorithm. Here is a snapshot for the user interaction from
1686    SFC-UI when creating a Rendered Service Path.
1687
1688 .. figure:: ./images/sfc/karaf-webui-select-a-type.png
1689    :alt: Karaf Web UI
1690
1691    Karaf Web UI
1692
1693 .. note::
1694
1695     Some service function selection algorithms in the drop list are not
1696     implemented yet. Only the first three algorithms are committed at
1697     the moment.
1698
1699 Random
1700 ^^^^^^
1701
1702 Select Service Function from the name list randomly.
1703
1704 Overview
1705 ''''''''
1706
1707 The Random algorithm is used to select one Service Function from the
1708 name list which it gets from the Service Function Type randomly.
1709
1710 Prerequisites
1711 '''''''''''''
1712
1713 -  Service Function information are stored in datastore.
1714
1715 -  Either no algorithm or the Random algorithm is selected.
1716
1717 Target Environment
1718 ''''''''''''''''''
1719
1720 The Random algorithm will work either no algorithm type is selected or
1721 the Random algorithm is selected.
1722
1723 Instructions
1724 ''''''''''''
1725
1726 Once the plugins are installed into Karaf successfully, a user can use
1727 his favorite method to select the Random scheduling algorithm type.
1728 There are no special instructions for using the Random algorithm.
1729
1730 Round Robin
1731 ^^^^^^^^^^^
1732
1733 Select Service Function from the name list in Round Robin manner.
1734
1735 Overview
1736 ''''''''
1737
1738 The Round Robin algorithm is used to select one Service Function from
1739 the name list which it gets from the Service Function Type in a Round
1740 Robin manner, this will balance workloads to all Service Functions.
1741 However, this method cannot help all Service Functions load the same
1742 workload because it’s flow-based Round Robin.
1743
1744 Prerequisites
1745 '''''''''''''
1746
1747 -  Service Function information are stored in datastore.
1748
1749 -  Round Robin algorithm is selected
1750
1751 Target Environment
1752 ''''''''''''''''''
1753
1754 The Round Robin algorithm will work one the Round Robin algorithm is
1755 selected.
1756
1757 Instructions
1758 ''''''''''''
1759
1760 Once the plugins are installed into Karaf successfully, a user can use
1761 his favorite method to select the Round Robin scheduling algorithm type.
1762 There are no special instructions for using the Round Robin algorithm.
1763
1764 Load Balance Algorithm
1765 ^^^^^^^^^^^^^^^^^^^^^^
1766
1767 Select appropriate Service Function by actual CPU utilization.
1768
1769 Overview
1770 ''''''''
1771
1772 The Load Balance Algorithm is used to select appropriate Service
1773 Function by actual CPU utilization of service functions. The CPU
1774 utilization of service function obtained from monitoring information
1775 reported via NETCONF.
1776
1777 Prerequisites
1778 '''''''''''''
1779
1780 -  CPU-utilization for Service Function.
1781
1782 -  NETCONF server.
1783
1784 -  NETCONF client.
1785
1786 -  Each VM has a NETCONF server and it could work with NETCONF client
1787    well.
1788
1789 Instructions
1790 ''''''''''''
1791
1792 Set up VMs as Service Functions. enable NETCONF server in VMs. Ensure
1793 that you specify them separately. For example:
1794
1795 a. Set up 4 VMs include 2 SFs' type are Firewall, Others are Napt44.
1796    Name them as firewall-1, firewall-2, napt44-1, napt44-2 as Service
1797    Function. The four VMs can run either the same server or different
1798    servers.
1799
1800 b. Install NETCONF server on every VM and enable it. More information on
1801    NETCONF can be found on the OpenDaylight wiki here:
1802    https://wiki.opendaylight.org/view/OpenDaylight_Controller:Config:Examples:Netconf:Manual_netopeer_installation
1803
1804 c. Get Monitoring data from NETCONF server. These monitoring data should
1805    be get from the NETCONF server which is running in VMs. The following
1806    static XML data is an example:
1807
1808 static XML data like this:
1809
1810 ::
1811
1812     <?xml version="1.0" encoding="UTF-8"?>
1813     <service-function-description-monitor-report>
1814       <SF-description>
1815         <number-of-dataports>2</number-of-dataports>
1816         <capabilities>
1817           <supported-packet-rate>5</supported-packet-rate>
1818           <supported-bandwidth>10</supported-bandwidth>
1819           <supported-ACL-number>2000</supported-ACL-number>
1820           <RIB-size>200</RIB-size>
1821           <FIB-size>100</FIB-size>
1822           <ports-bandwidth>
1823             <port-bandwidth>
1824               <port-id>1</port-id>
1825               <ipaddress>10.0.0.1</ipaddress>
1826               <macaddress>00:1e:67:a2:5f:f4</macaddress>
1827               <supported-bandwidth>20</supported-bandwidth>
1828             </port-bandwidth>
1829             <port-bandwidth>
1830               <port-id>2</port-id>
1831               <ipaddress>10.0.0.2</ipaddress>
1832               <macaddress>01:1e:67:a2:5f:f6</macaddress>
1833               <supported-bandwidth>10</supported-bandwidth>
1834             </port-bandwidth>
1835           </ports-bandwidth>
1836         </capabilities>
1837       </SF-description>
1838       <SF-monitoring-info>
1839         <liveness>true</liveness>
1840         <resource-utilization>
1841             <packet-rate-utilization>10</packet-rate-utilization>
1842             <bandwidth-utilization>15</bandwidth-utilization>
1843             <CPU-utilization>12</CPU-utilization>
1844             <memory-utilization>17</memory-utilization>
1845             <available-memory>8</available-memory>
1846             <RIB-utilization>20</RIB-utilization>
1847             <FIB-utilization>25</FIB-utilization>
1848             <power-utilization>30</power-utilization>
1849             <SF-ports-bandwidth-utilization>
1850               <port-bandwidth-utilization>
1851                 <port-id>1</port-id>
1852                 <bandwidth-utilization>20</bandwidth-utilization>
1853               </port-bandwidth-utilization>
1854               <port-bandwidth-utilization>
1855                 <port-id>2</port-id>
1856                 <bandwidth-utilization>30</bandwidth-utilization>
1857               </port-bandwidth-utilization>
1858             </SF-ports-bandwidth-utilization>
1859         </resource-utilization>
1860       </SF-monitoring-info>
1861     </service-function-description-monitor-report>
1862
1863 a. Unzip SFC release tarball.
1864
1865 b. Run SFC: ${sfc}/bin/karaf. More information on Service Function
1866    Chaining can be found on the OpenDaylight SFC’s wiki page:
1867    https://wiki.opendaylight.org/view/Service_Function_Chaining:Main
1868
1869 a. Deploy the SFC2 (firewall-abstract2⇒napt44-abstract2) and click
1870    button to Create Rendered Service Path in SFC UI
1871    (http://localhost:8181/sfc/index.html).
1872
1873 b. Verify the Rendered Service Path to ensure the CPU utilization of the
1874    selected hop is the minimum one among all the service functions with
1875    same type. The correct RSP is firewall-1⇒napt44-2
1876
1877 Shortest Path Algorithm
1878 ^^^^^^^^^^^^^^^^^^^^^^^
1879
1880 Select appropriate Service Function by Dijkstra’s algorithm. Dijkstra’s
1881 algorithm is an algorithm for finding the shortest paths between nodes
1882 in a graph.
1883
1884 Overview
1885 ''''''''
1886
1887 The Shortest Path Algorithm is used to select appropriate Service
1888 Function by actual topology.
1889
1890 Prerequisites
1891 '''''''''''''
1892
1893 -  Deployed topology (include SFFs, SFs and their links).
1894
1895 -  Dijkstra’s algorithm. More information on Dijkstra’s algorithm can be
1896    found on the wiki here:
1897    http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
1898
1899 Instructions
1900 ''''''''''''
1901
1902 a. Unzip SFC release tarball.
1903
1904 b. Run SFC: ${sfc}/bin/karaf.
1905
1906 c. Depoly SFFs and SFs. import the service-function-forwarders.json and
1907    service-functions.json in UI
1908    (http://localhost:8181/sfc/index.html#/sfc/config)
1909
1910 service-function-forwarders.json:
1911
1912 ::
1913
1914     {
1915       "service-function-forwarders": {
1916         "service-function-forwarder": [
1917           {
1918             "name": "SFF-br1",
1919             "service-node": "OVSDB-test01",
1920             "rest-uri": "http://localhost:5001",
1921             "sff-data-plane-locator": [
1922               {
1923                 "name": "eth0",
1924                 "service-function-forwarder-ovs:ovs-bridge": {
1925                   "uuid": "4c3778e4-840d-47f4-b45e-0988e514d26c",
1926                   "bridge-name": "br-tun"
1927                 },
1928                 "data-plane-locator": {
1929                   "port": 5000,
1930                   "ip": "192.168.1.1",
1931                   "transport": "service-locator:vxlan-gpe"
1932                 }
1933               }
1934             ],
1935             "service-function-dictionary": [
1936               {
1937                 "sff-sf-data-plane-locator": {
1938                    "sf-dpl-name": "sf1dpl",
1939                    "sff-dpl-name": "sff1dpl"
1940                 },
1941                 "name": "napt44-1",
1942                 "type": "napt44"
1943               },
1944               {
1945                 "sff-sf-data-plane-locator": {
1946                    "sf-dpl-name": "sf2dpl",
1947                    "sff-dpl-name": "sff2dpl"
1948                 },
1949                 "name": "firewall-1",
1950                 "type": "firewall"
1951               }
1952             ],
1953             "connected-sff-dictionary": [
1954               {
1955                 "name": "SFF-br3"
1956               }
1957             ]
1958           },
1959           {
1960             "name": "SFF-br2",
1961             "service-node": "OVSDB-test01",
1962             "rest-uri": "http://localhost:5002",
1963             "sff-data-plane-locator": [
1964               {
1965                 "name": "eth0",
1966                 "service-function-forwarder-ovs:ovs-bridge": {
1967                   "uuid": "fd4d849f-5140-48cd-bc60-6ad1f5fc0a1",
1968                   "bridge-name": "br-tun"
1969                 },
1970                 "data-plane-locator": {
1971                   "port": 5000,
1972                   "ip": "192.168.1.2",
1973                   "transport": "service-locator:vxlan-gpe"
1974                 }
1975               }
1976             ],
1977             "service-function-dictionary": [
1978               {
1979                 "sff-sf-data-plane-locator": {
1980                    "sf-dpl-name": "sf1dpl",
1981                    "sff-dpl-name": "sff1dpl"
1982                 },
1983                 "name": "napt44-2",
1984                 "type": "napt44"
1985               },
1986               {
1987                 "sff-sf-data-plane-locator": {
1988                    "sf-dpl-name": "sf2dpl",
1989                    "sff-dpl-name": "sff2dpl"
1990                 },
1991                 "name": "firewall-2",
1992                 "type": "firewall"
1993               }
1994             ],
1995             "connected-sff-dictionary": [
1996               {
1997                 "name": "SFF-br3"
1998               }
1999             ]
2000           },
2001           {
2002             "name": "SFF-br3",
2003             "service-node": "OVSDB-test01",
2004             "rest-uri": "http://localhost:5005",
2005             "sff-data-plane-locator": [
2006               {
2007                 "name": "eth0",
2008                 "service-function-forwarder-ovs:ovs-bridge": {
2009                   "uuid": "fd4d849f-5140-48cd-bc60-6ad1f5fc0a4",
2010                   "bridge-name": "br-tun"
2011                 },
2012                 "data-plane-locator": {
2013                   "port": 5000,
2014                   "ip": "192.168.1.2",
2015                   "transport": "service-locator:vxlan-gpe"
2016                 }
2017               }
2018             ],
2019             "service-function-dictionary": [
2020               {
2021                 "sff-sf-data-plane-locator": {
2022                    "sf-dpl-name": "sf1dpl",
2023                    "sff-dpl-name": "sff1dpl"
2024                 },
2025                 "name": "test-server",
2026                 "type": "dpi"
2027               },
2028               {
2029                 "sff-sf-data-plane-locator": {
2030                    "sf-dpl-name": "sf2dpl",
2031                    "sff-dpl-name": "sff2dpl"
2032                 },
2033                 "name": "test-client",
2034                 "type": "dpi"
2035               }
2036             ],
2037             "connected-sff-dictionary": [
2038               {
2039                 "name": "SFF-br1"
2040               },
2041               {
2042                 "name": "SFF-br2"
2043               }
2044             ]
2045           }
2046         ]
2047       }
2048     }
2049
2050 service-functions.json:
2051
2052 ::
2053
2054     {
2055       "service-functions": {
2056         "service-function": [
2057           {
2058             "rest-uri": "http://localhost:10001",
2059             "ip-mgmt-address": "10.3.1.103",
2060             "sf-data-plane-locator": [
2061               {
2062                 "name": "preferred",
2063                 "port": 10001,
2064                 "ip": "10.3.1.103",
2065                 "service-function-forwarder": "SFF-br1"
2066               }
2067             ],
2068             "name": "napt44-1",
2069             "type": "napt44"
2070           },
2071           {
2072             "rest-uri": "http://localhost:10002",
2073             "ip-mgmt-address": "10.3.1.103",
2074             "sf-data-plane-locator": [
2075               {
2076                 "name": "master",
2077                 "port": 10002,
2078                 "ip": "10.3.1.103",
2079                 "service-function-forwarder": "SFF-br2"
2080               }
2081             ],
2082             "name": "napt44-2",
2083             "type": "napt44"
2084           },
2085           {
2086             "rest-uri": "http://localhost:10003",
2087             "ip-mgmt-address": "10.3.1.103",
2088             "sf-data-plane-locator": [
2089               {
2090                 "name": "1",
2091                 "port": 10003,
2092                 "ip": "10.3.1.102",
2093                 "service-function-forwarder": "SFF-br1"
2094               }
2095             ],
2096             "name": "firewall-1",
2097             "type": "firewall"
2098           },
2099           {
2100             "rest-uri": "http://localhost:10004",
2101             "ip-mgmt-address": "10.3.1.103",
2102             "sf-data-plane-locator": [
2103               {
2104                 "name": "2",
2105                 "port": 10004,
2106                 "ip": "10.3.1.101",
2107                 "service-function-forwarder": "SFF-br2"
2108               }
2109             ],
2110             "name": "firewall-2",
2111             "type": "firewall"
2112           },
2113           {
2114             "rest-uri": "http://localhost:10005",
2115             "ip-mgmt-address": "10.3.1.103",
2116             "sf-data-plane-locator": [
2117               {
2118                 "name": "3",
2119                 "port": 10005,
2120                 "ip": "10.3.1.104",
2121                 "service-function-forwarder": "SFF-br3"
2122               }
2123             ],
2124             "name": "test-server",
2125             "type": "dpi"
2126           },
2127           {
2128             "rest-uri": "http://localhost:10006",
2129             "ip-mgmt-address": "10.3.1.103",
2130             "sf-data-plane-locator": [
2131               {
2132                 "name": "4",
2133                 "port": 10006,
2134                 "ip": "10.3.1.102",
2135                 "service-function-forwarder": "SFF-br3"
2136               }
2137             ],
2138             "name": "test-client",
2139             "type": "dpi"
2140           }
2141         ]
2142       }
2143     }
2144
2145 The deployed topology like this:
2146
2147 ::
2148
2149                   +----+           +----+          +----+
2150                   |sff1|+----------|sff3|---------+|sff2|
2151                   +----+           +----+          +----+
2152                     |                                  |
2153              +--------------+                   +--------------+
2154              |              |                   |              |
2155         +----------+   +--------+          +----------+   +--------+
2156         |firewall-1|   |napt44-1|          |firewall-2|   |napt44-2|
2157         +----------+   +--------+          +----------+   +--------+
2158
2159 -  Deploy the SFC2(firewall-abstract2⇒napt44-abstract2), select
2160    "Shortest Path" as schedule type and click button to Create Rendered
2161    Service Path in SFC UI (http://localhost:8181/sfc/index.html).
2162
2163 .. figure:: ./images/sfc/sf-schedule-type.png
2164    :alt: select schedule type
2165
2166    select schedule type
2167
2168 -  Verify the Rendered Service Path to ensure the selected hops are
2169    linked in one SFF. The correct RSP is firewall-1⇒napt44-1 or
2170    firewall-2⇒napt44-2. The first SF type is Firewall in Service
2171    Function Chain. So the algorithm will select first Hop randomly among
2172    all the SFs type is Firewall. Assume the first selected SF is
2173    firewall-2. All the path from firewall-1 to SF which type is Napt44
2174    are list:
2175
2176    -  Path1: firewall-2 â†’ sff2 â†’ napt44-2
2177
2178    -  Path2: firewall-2 â†’ sff2 â†’ sff3 â†’ sff1 â†’ napt44-1 The shortest
2179       path is Path1, so the selected next hop is napt44-2.
2180
2181 .. figure:: ./images/sfc/sf-rendered-service-path.png
2182    :alt: rendered service path
2183
2184    rendered service path
2185
2186 Service Function Load Balancing User Guide
2187 ------------------------------------------
2188
2189 Overview
2190 ~~~~~~~~
2191
2192 SFC Load-Balancing feature implements load balancing of Service
2193 Functions, rather than a one-to-one mapping between
2194 Service-Function-Forwarder and Service-Function.
2195
2196 Load Balancing Architecture
2197 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2198
2199 Service Function Groups (SFG) can replace Service Functions (SF) in the
2200 Rendered Path model. A Service Path can only be defined using SFGs or
2201 SFs, but not a combination of both.
2202
2203 Relevant objects in the YANG model are as follows:
2204
2205 1. Service-Function-Group-Algorithm:
2206
2207    ::
2208
2209        Service-Function-Group-Algorithms {
2210            Service-Function-Group-Algorithm {
2211                String name
2212                String type
2213            }
2214        }
2215
2216    ::
2217
2218        Available types: ALL, SELECT, INDIRECT, FAST_FAILURE
2219
2220 2. Service-Function-Group:
2221
2222    ::
2223
2224        Service-Function-Groups {
2225            Service-Function-Group {
2226                String name
2227                String serviceFunctionGroupAlgorithmName
2228                String type
2229                String groupId
2230                Service-Function-Group-Element {
2231                    String service-function-name
2232                    int index
2233                }
2234            }
2235        }
2236
2237 3. ServiceFunctionHop: holds a reference to a name of SFG (or SF)
2238
2239 Tutorials
2240 ~~~~~~~~~
2241
2242 This tutorial will explain how to create a simple SFC configuration,
2243 with SFG instead of SF. In this example, the SFG will include two
2244 existing SF.
2245
2246 Setup SFC
2247 ^^^^^^^^^
2248
2249 For general SFC setup and scenarios, please see the SFC wiki page:
2250 https://wiki.opendaylight.org/view/Service_Function_Chaining:Main#SFC_101
2251
2252 Create an algorithm
2253 ^^^^^^^^^^^^^^^^^^^
2254
2255 POST -
2256 http://127.0.0.1:8181/restconf/config/service-function-group-algorithm:service-function-group-algorithms
2257
2258 ::
2259
2260     {
2261         "service-function-group-algorithm": [
2262           {
2263             "name": "alg1"
2264             "type": "ALL"
2265           }
2266        ]
2267     }
2268
2269 (Header "content-type": application/json)
2270
2271 Verify: get all algorithms
2272 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2273
2274 GET -
2275 http://127.0.0.1:8181/restconf/config/service-function-group-algorithm:service-function-group-algorithms
2276
2277 In order to delete all algorithms: DELETE -
2278 http://127.0.0.1:8181/restconf/config/service-function-group-algorithm:service-function-group-algorithms
2279
2280 Create a group
2281 ^^^^^^^^^^^^^^
2282
2283 POST -
2284 http://127.0.0.1:8181/restconf/config/service-function-group:service-function-groups
2285
2286 ::
2287
2288     {
2289         "service-function-group": [
2290         {
2291             "rest-uri": "http://localhost:10002",
2292             "ip-mgmt-address": "10.3.1.103",
2293             "algorithm": "alg1",
2294             "name": "SFG1",
2295             "type": "napt44",
2296             "sfc-service-function": [
2297                 {
2298                     "name":"napt44-104"
2299                 },
2300                 {
2301                     "name":"napt44-103-1"
2302                 }
2303             ]
2304           }
2305         ]
2306     }
2307
2308 Verify: get all SFG’s
2309 ^^^^^^^^^^^^^^^^^^^^^
2310
2311 GET -
2312 http://127.0.0.1:8181/restconf/config/service-function-group:service-function-groups
2313
2314 SFC Proof of Transit User Guide
2315 -------------------------------
2316
2317 Overview
2318 ~~~~~~~~
2319
2320 Early Service Function Chaining (SFC) Proof of Transit (SFC Proof of
2321 Transit) implements Service Chaining Proof of Transit functionality on
2322 capable switches. After the creation of an Rendered Service Path (RSP),
2323 a user can configure to enable SFC proof of transit on the selected RSP
2324 to effect the proof of transit.
2325
2326 Common acronyms used in the following sections:
2327
2328 -  SF - Service Function
2329
2330 -  SFF - Service Function Forwarder
2331
2332 -  SFC - Service Function Chain
2333
2334 -  SFP - Service Function Path
2335
2336 -  RSP - Rendered Service Path
2337
2338 -  SFCPOT - Service Function Chain Proof of Transit
2339
2340 SFC Proof of Transit Architecture
2341 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2342
2343 When SFC Proof of Transit is initialized, all required listeners are
2344 registered to handle incoming data. It involves ``SfcPotNodeListener``
2345 which stores data about all node devices including their mountpoints
2346 (used here as databrokers), ``SfcPotRSPDataListener``,
2347 ``RenderedPathListener``. ``RenderedPathListener`` is used to listen for
2348 RSP changes. ``SfcPotRSPDataListener`` implements RPC services to enable
2349 or disable SFC Proof of Transit on a particular RSP. When the SFC Proof
2350 of Transit is invoked, RSP listeners and service implementations are
2351 setup to receive SFCPOT configurations. When a user configures via a
2352 POST RPC call to enable SFCPOT on a particular RSP, the configuration
2353 drives the creation of necessary augmentations to the RSP to effect the
2354 SFCPOT configurations.
2355
2356 SFC Proof of Transit details
2357 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2358
2359 Several deployments use traffic engineering, policy routing, segment
2360 routing or service function chaining (SFC) to steer packets through a
2361 specific set of nodes. In certain cases regulatory obligations or a
2362 compliance policy require to prove that all packets that are supposed to
2363 follow a specific path are indeed being forwarded across the exact set
2364 of nodes specified. I.e. if a packet flow is supposed to go through a
2365 series of service functions or network nodes, it has to be proven that
2366 all packets of the flow actually went through the service chain or
2367 collection of nodes specified by the policy. In case the packets of a
2368 flow weren’t appropriately processed, a proof of transit egress device
2369 would be required to identify the policy violation and take
2370 corresponding actions (e.g. drop or redirect the packet, send an alert
2371 etc.) corresponding to the policy.
2372
2373 The SFCPOT approach is based on meta-data which is added to every
2374 packet. The meta data is updated at every hop and is used to verify
2375 whether a packet traversed all required nodes. A particular path is
2376 either described by a set of secret keys, or a set of shares of a single
2377 secret. Nodes on the path retrieve their individual keys or shares of a
2378 key (using for e.g. Shamir’s Shared Sharing Secret scheme) from a
2379 central controller. The complete key set is only known to the verifier-
2380 which is typically the ultimate node on a path that requires proof of
2381 transit. Each node in the path uses its secret or share of the secret to
2382 update the meta-data of the packets as the packets pass through the
2383 node. When the verifier receives a packet, it can use its key(s) along
2384 with the meta-data to validate whether the packet traversed the service
2385 chain correctly.
2386
2387 SFC Proof of Transit entities
2388 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2389
2390 In order to implement SFC Proof of Transit for a service function chain,
2391 an RSP is a pre-requisite to identify the SFC to enable SFC PoT on. SFC
2392 Proof of Transit for a particular RSP is enabled by an RPC request to
2393 the controller along with necessary parameters to control some of the
2394 aspects of the SFC Proof of Transit process.
2395
2396 The RPC handler identifies the RSP and generates SFC Proof of Transit
2397 parameters like secret share, secret etc., and adds the generated SFCPOT
2398 configuration parameters to SFC main as well as the various SFC hops.
2399 The last node in the SFC is configured as a verifier node to allow
2400 SFCPOT Proof of Transit process to be completed.
2401
2402 The SFCPOT configuration generators and related handling are done by
2403 ``SfcPotAPI``, ``SfcPotConfigGenerator``, ``SfcPotListener``,
2404 ``SfcPotPolyAPI``, ``SfcPotPolyClassAPI`` and ``SfcPotPolyClass``.
2405
2406 Administering SFC Proof of Transit
2407 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2408
2409 To use the SFC Proof of Transit Karaf, at least the following Karaf
2410 features must be installed:
2411
2412 -  odl-sfc-model
2413
2414 -  odl-sfc-provider
2415
2416 -  odl-sfc-netconf
2417
2418 -  odl-restconf
2419
2420 -  odl-netconf-topology
2421
2422 -  odl-netconf-connector-all
2423
2424 -  odl-sfc-pot
2425
2426 SFC Proof of Transit Tutorial
2427 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2428
2429 Overview
2430 ^^^^^^^^
2431
2432 This tutorial is a simple example how to configure Service Function
2433 Chain Proof of Transit using SFC POT feature.
2434
2435 Preconditions
2436 ^^^^^^^^^^^^^
2437
2438 To enable a device to handle SFC Proof of Transit, it is expected that
2439 the netconf server device advertise capability as under ioam-scv.yang
2440 present under src/main/yang folder of sfc-pot feature. It is also
2441 expected that netconf notifications be enabled and its support
2442 capability advertised as capabilities.
2443
2444 It is also expected that the devices are netconf mounted and available
2445 in the topology-netconf store.
2446
2447 Instructions
2448 ^^^^^^^^^^^^
2449
2450 When SFC Proof of Transit is installed, all netconf nodes in
2451 topology-netconf are processed and all capable nodes with accessible
2452 mountpoints are cached.
2453
2454 First step is to create the required RSP as usually done.
2455
2456 Once RSP name is available it is used to send a POST RPC to the
2457 controller similar to below:
2458
2459 ::
2460
2461     POST ./restconf/operations/sfc-ioam-nb-pot:enable-sfc-ioam-pot-rendered-path
2462
2463     {
2464       "input": {
2465         "sfc-ioam-pot-rsp-name": "rsp1"
2466       }
2467     }
2468
2469 The following can be used to disable the SFC Proof of Transit on an RSP
2470 which removes the augmentations and stores back the RSP without the
2471 SFCPOT enabled features and also sending down a delete configuration to
2472 the SFCPOT configuration sub-tree in the nodes.
2473
2474 ::
2475
2476     POST ./restconf/operations/sfc-ioam-nb-pot:disable-sfc-ioam-pot-rendered-path
2477
2478     {
2479       "input": {
2480         "sfc-ioam-pot-rsp-name": "rsp1"
2481       }
2482     }
2483
2484 Logical Service Function Forwarder
2485 ----------------------------------
2486
2487 Overview
2488 ~~~~~~~~
2489
2490 .. _sfc-user-guide-logical-sff-motivation:
2491
2492 Rationale
2493 ^^^^^^^^^
2494 When the current SFC is deployed in a cloud environment, it is assumed that each
2495 switch connected to a Service Function is configured as a Service Function Forwarder and
2496 each Service Function is connected to its Service Function Forwarder depending on the
2497 Compute Node where the Virtual Machine is located.
2498
2499 .. figure:: ./images/sfc/sfc-in-cloud.png
2500    :alt: Deploying SFC in Cloud Environments
2501
2502 As shown in the picture above, this solution allows the basic cloud use cases to be fulfilled,
2503 as for example, the ones required in OPNFV Brahmaputra, however, some advanced use cases
2504 like the transparent migration of VMs can not be implemented. The Logical Service Function Forwarder
2505 enables the following advanced use cases:
2506
2507 1. Service Function mobility without service disruption
2508 2. Service Functions load balancing and failover
2509
2510 As shown in the picture below, the Logical Service Function Forwarder concept extends the current
2511 SFC northbound API to provide an abstraction of the underlying Data Center infrastructure.
2512 The Data Center underlaying network can be abstracted by a single SFF. This single SFF uses
2513 the logical port UUID as data plane locator to connect SFs globally and in a location-transparent manner.
2514 SFC makes use of `Genius <./genius-user-guide.html>`__ project to track the
2515 location of the SF's logical ports.
2516
2517 .. figure:: ./images/sfc/single-logical-sff-concept.png
2518    :alt: Single Logical SFF concept
2519
2520 The SFC internally distributes the necessary flow state over the relevant switches based on the
2521 internal Data Center topology and the deployment of SFs.
2522
2523 Changes in data model
2524 ~~~~~~~~~~~~~~~~~~~~~
2525 The Logical Service Function Forwarder concept extends the current SFC northbound API to provide
2526 an abstraction of the underlying Data Center infrastructure.
2527
2528 The Logical SFF simplifies the configuration of the current SFC data model by reducing the number
2529 of parameters to be be configured in every SFF, since the controller will discover those parameters
2530 by interacting with the services offered by the `Genius <./genius-user-guide.html>`__ project.
2531
2532 The following picture shows the Logical SFF data model. The model gets simplified as most of the
2533 configuration parameters of the current SFC data model are discovered in runtime. The complete
2534 YANG model can be found here `logical SFF model
2535 <https://github.com/opendaylight/sfc/blob/master/sfc-model/src/main/yang/service-function-forwarder-logical.yang>`__.
2536
2537 .. figure:: ./images/sfc/logical-sff-datamodel.png
2538    :alt: Logical SFF data model
2539
2540 How to configure the Logical SFF
2541 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2542 The following are examples to configure the Logical SFF:
2543 ::
2544
2545     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/restconf/config/service-function:service-functions/
2546
2547 **Service Functions JSON.**
2548
2549 ::
2550
2551     {
2552     "service-functions": {
2553         "service-function": [
2554             {
2555                 "name": "firewall-1",
2556                 "type": "firewall",
2557                 "sf-data-plane-locator": [
2558                     {
2559                         "name": "firewall-dpl",
2560                         "interface-name": "eccb57ae-5a2e-467f-823e-45d7bb2a6a9a",
2561                         "transport": "service-locator:eth-nsh",
2562                         "service-function-forwarder": "sfflogical1"
2563
2564                     }
2565                 ]
2566             },
2567             {
2568                 "name": "dpi-1",
2569                 "type": "dpi",
2570                 "sf-data-plane-locator": [
2571                     {
2572                         "name": "dpi-dpl",
2573                         "interface-name": "df15ac52-e8ef-4e9a-8340-ae0738aba0c0",
2574                         "transport": "service-locator:eth-nsh",
2575                         "service-function-forwarder": "sfflogical1"
2576                     }
2577                 ]
2578             }
2579         ]
2580     }
2581     }
2582
2583 ::
2584
2585     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-forwarder:service-function-forwarders/
2586
2587 **Service Function Forwarders JSON.**
2588
2589 ::
2590
2591     {
2592     "service-function-forwarders": {
2593         "service-function-forwarder": [
2594            {
2595                 "name": "sfflogical1"
2596             }
2597         ]
2598     }
2599     }
2600
2601 ::
2602
2603     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-chain:service-function-chains/
2604
2605 **Service Function Chains JSON.**
2606
2607 ::
2608
2609     {
2610     "service-function-chains": {
2611         "service-function-chain": [
2612             {
2613                 "name": "SFC1",
2614                 "sfc-service-function": [
2615                     {
2616                         "name": "dpi-abstract1",
2617                         "type": "dpi"
2618                     },
2619                     {
2620                         "name": "firewall-abstract1",
2621                         "type": "firewall"
2622                     }
2623                 ]
2624             },
2625             {
2626                 "name": "SFC2",
2627                 "sfc-service-function": [
2628                     {
2629                         "name": "dpi-abstract1",
2630                         "type": "dpi"
2631                     }
2632                 ]
2633             }
2634         ]
2635     }
2636     }
2637
2638 ::
2639
2640     curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8182/restconf/config/service-function-chain:service-function-paths/
2641
2642 **Service Function Paths JSON.**
2643
2644 ::
2645
2646     {
2647     "service-function-paths": {
2648         "service-function-path": [
2649             {
2650                 "name": "SFP1",
2651                 "service-chain-name": "SFC1",
2652                 "starting-index": 255,
2653                 "symmetric": "true",
2654                 "context-metadata": "NSH1",
2655                 "transport-type": "service-locator:vxlan-gpe"
2656
2657             }
2658         ]
2659     }
2660     }
2661
2662 As a result of above configuration, OpenDaylight renders the needed flows in all involved SFFs. Those flows implement:
2663
2664 - Two Rendered Service Paths:
2665
2666   - dpi-1 (SF1), firewall-1 (SF2)
2667   - firewall-1 (SF2), dpi-1 (SF1)
2668
2669 - The communication between SFFs and SFs based on eth-nsh
2670
2671 - The communication between SFFs based on vxlan-gpe
2672
2673 The following picture shows a topology and traffic flow (in green) which corresponds to the above configuration.
2674
2675 .. figure:: ./images/sfc/single-logical-sff-example.png
2676    :alt: Logical SFF Example
2677    :width: 800px
2678    :height: 600px
2679
2680    Logical SFF Example
2681
2682
2683
2684 The Logical SFF functionality allows OpenDaylight to find out the SFFs holding the SFs involved in a path. In this example
2685 the SFFs affected are Node3 and Node4 thus the controller renders the flows containing NSH parameters just in those SFFs.
2686
2687 Here you have the new flows rendered in Node3 and Node4 which implement the NSH protocol. Every Rendered Service Path is represented
2688 by an NSP value. We provisioned a symmetric RSP so we get two NSPs: 8388613 and 5. Node3 holds the first SF of NSP 8388613 and 
2689 the last SF of NSP 5. Node 4 holds the first SF of NSP 5 and the last SF of NSP 8388613. Both Node3 and Node4 will pop the NSH header 
2690 when the received packet has gone through the last SF of its path.
2691
2692
2693 **Rendered flows Node 3**
2694
2695 ::
2696
2697  cookie=0x14, duration=59.264s, table=83, n_packets=0, n_bytes=0, priority=250,nsp=5 actions=goto_table:86
2698  cookie=0x14, duration=59.194s, table=83, n_packets=0, n_bytes=0, priority=250,nsp=8388613 actions=goto_table:86
2699  cookie=0x14, duration=59.257s, table=86, n_packets=0, n_bytes=0, priority=550,nsi=254,nsp=5 actions=load:0x8e0a37cc9094->NXM_NX_ENCAP_ETH_SRC[],load:0x6ee006b4c51e->NXM_NX_ENCAP_ETH_DST[],goto_table:87
2700  cookie=0x14, duration=59.189s, table=86, n_packets=0, n_bytes=0, priority=550,nsi=255,nsp=8388613 actions=load:0x8e0a37cc9094->NXM_NX_ENCAP_ETH_SRC[],load:0x6ee006b4c51e->NXM_NX_ENCAP_ETH_DST[],goto_table:87
2701  cookie=0xba5eba1100000203, duration=59.213s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=253,nsp=5 actions=pop_nsh,set_field:6e:e0:06:b4:c5:1e->eth_src,resubmit(,17)
2702  cookie=0xba5eba1100000201, duration=59.213s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=254,nsp=5 actions=load:0x800->NXM_NX_REG6[],resubmit(,220)
2703  cookie=0xba5eba1100000201, duration=59.188s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=255,nsp=8388613 actions=load:0x800->NXM_NX_REG6[],resubmit(,220)
2704  cookie=0xba5eba1100000201, duration=59.182s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=254,nsp=8388613 actions=set_field:0->tun_id,output:6
2705
2706 **Rendered Flows Node 4**
2707
2708 ::
2709
2710  cookie=0x14, duration=69.040s, table=83, n_packets=0, n_bytes=0, priority=250,nsp=5 actions=goto_table:86
2711  cookie=0x14, duration=69.008s, table=83, n_packets=0, n_bytes=0, priority=250,nsp=8388613 actions=goto_table:86
2712  cookie=0x14, duration=69.040s, table=86, n_packets=0, n_bytes=0, priority=550,nsi=255,nsp=5 actions=load:0xbea93873f4fa->NXM_NX_ENCAP_ETH_SRC[],load:0x214845ea85d->NXM_NX_ENCAP_ETH_DST[],goto_table:87
2713  cookie=0x14, duration=69.005s, table=86, n_packets=0, n_bytes=0, priority=550,nsi=254,nsp=8388613 actions=load:0xbea93873f4fa->NXM_NX_ENCAP_ETH_SRC[],load:0x214845ea85d->NXM_NX_ENCAP_ETH_DST[],goto_table:87
2714  cookie=0xba5eba1100000201, duration=69.029s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=255,nsp=5 actions=load:0x1100->NXM_NX_REG6[],resubmit(,220)
2715  cookie=0xba5eba1100000201, duration=69.029s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=254,nsp=5 actions=set_field:0->tun_id,output:1
2716  cookie=0xba5eba1100000201, duration=68.999s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=254,nsp=8388613 actions=load:0x1100->NXM_NX_REG6[],resubmit(,220)
2717  cookie=0xba5eba1100000203, duration=68.996s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=253,nsp=8388613 actions=pop_nsh,set_field:02:14:84:5e:a8:5d->eth_src,resubmit(,17)
2718
2719
2720 An interesting scenario to show the Logical SFF strength is the migration of a SF from a compute node to another. 
2721 The OpenDaylight will learn the new topology by itself, then it will re-render the new flows to the new SFFs affected. 
2722
2723 .. figure:: ./images/sfc/single-logical-sff-example-migration.png
2724    :alt: Logical SFF - SF Migration Example
2725    :width: 800px
2726    :height: 600px
2727
2728    Logical SFF - SF Migration Example
2729
2730
2731 In our example, SF2 is moved from Node4 to Node2 then OpenDaylight removes NSH specific flows from Node4 and puts them in Node2.
2732 Check below flows showing this effect. Now Node3 keeps holding the first SF of NSP 8388613 and the last SF of NSP 5;
2733 but Node2 becomes the new holder of the first SF of NSP 5 and the last SF of NSP 8388613.
2734
2735
2736 **Rendered Flows Node 3 After Migration**
2737
2738 ::
2739
2740  cookie=0x14, duration=64.044s, table=83, n_packets=0, n_bytes=0, priority=250,nsp=5 actions=goto_table:86
2741  cookie=0x14, duration=63.947s, table=83, n_packets=0, n_bytes=0, priority=250,nsp=8388613 actions=goto_table:86
2742  cookie=0x14, duration=64.044s, table=86, n_packets=0, n_bytes=0, priority=550,nsi=254,nsp=5 actions=load:0x8e0a37cc9094->NXM_NX_ENCAP_ETH_SRC[],load:0x6ee006b4c51e->NXM_NX_ENCAP_ETH_DST[],goto_table:87
2743  cookie=0x14, duration=63.947s, table=86, n_packets=0, n_bytes=0, priority=550,nsi=255,nsp=8388613 actions=load:0x8e0a37cc9094->NXM_NX_ENCAP_ETH_SRC[],load:0x6ee006b4c51e->NXM_NX_ENCAP_ETH_DST[],goto_table:87
2744  cookie=0xba5eba1100000201, duration=64.034s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=254,nsp=5 actions=load:0x800->NXM_NX_REG6[],resubmit(,220)
2745  cookie=0xba5eba1100000203, duration=64.034s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=253,nsp=5 actions=pop_nsh,set_field:6e:e0:06:b4:c5:1e->eth_src,resubmit(,17)
2746  cookie=0xba5eba1100000201, duration=63.947s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=255,nsp=8388613 actions=load:0x800->NXM_NX_REG6[],resubmit(,220)
2747  cookie=0xba5eba1100000201, duration=63.942s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=254,nsp=8388613 actions=set_field:0->tun_id,output:2
2748
2749 **Rendered Flows Node 2 After Migration**
2750
2751 ::
2752
2753  cookie=0x14, duration=56.856s, table=83, n_packets=0, n_bytes=0, priority=250,nsp=5 actions=goto_table:86
2754  cookie=0x14, duration=56.755s, table=83, n_packets=0, n_bytes=0, priority=250,nsp=8388613 actions=goto_table:86
2755  cookie=0x14, duration=56.847s, table=86, n_packets=0, n_bytes=0, priority=550,nsi=255,nsp=5 actions=load:0xbea93873f4fa->NXM_NX_ENCAP_ETH_SRC[],load:0x214845ea85d->NXM_NX_ENCAP_ETH_DST[],goto_table:87
2756  cookie=0x14, duration=56.755s, table=86, n_packets=0, n_bytes=0, priority=550,nsi=254,nsp=8388613 actions=load:0xbea93873f4fa->NXM_NX_ENCAP_ETH_SRC[],load:0x214845ea85d->NXM_NX_ENCAP_ETH_DST[],goto_table:87
2757  cookie=0xba5eba1100000201, duration=56.823s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=255,nsp=5 actions=load:0x1100->NXM_NX_REG6[],resubmit(,220)
2758  cookie=0xba5eba1100000201, duration=56.823s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=254,nsp=5 actions=set_field:0->tun_id,output:4
2759  cookie=0xba5eba1100000201, duration=56.755s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=254,nsp=8388613 actions=load:0x1100->NXM_NX_REG6[],resubmit(,220)
2760  cookie=0xba5eba1100000203, duration=56.750s, table=87, n_packets=0, n_bytes=0, priority=650,nsi=253,nsp=8388613 actions=pop_nsh,set_field:02:14:84:5e:a8:5d->eth_src,resubmit(,17)
2761
2762 **Rendered Flows Node 4 After Migration**
2763
2764 ::
2765
2766  -- No flows for NSH processing --
2767
2768 .. _sfc-user-guide-classifier-impacts:
2769
2770 Classifier impacts
2771 ~~~~~~~~~~~~~~~~~~
2772
2773 As previously mentioned, in the :ref:`Logical SFF rationale
2774 <sfc-user-guide-logical-sff-motivation>`, the Logical SFF feature relies on
2775 Genius to get the dataplane IDs of the OpenFlow switches, in order to properly
2776 steer the traffic through the chain.
2777
2778 Since one of the classifier's objectives is to steer the packets *into* the
2779 SFC domain, the classifier has to be aware of where the first Service
2780 Function is located - if it migrates somewhere else, the classifier table
2781 has to be updated accordingly, thus enabling the seemless migration of Service
2782 Functions.
2783
2784 For this feature, mobility of the client VM is out of scope, and should be
2785 managed by its high-availability module, or VNF manager.
2786
2787 Keep in mind that classification *always* occur in the compute-node where
2788 the client VM (i.e. traffic origin) is running.
2789
2790 How to attach the classifier to a Logical SFF
2791 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2792
2793 In order to leverage this functionality, the classifier has to be configured
2794 using a Logical SFF as an attachment-point, specifying within it the neutron
2795 port to classify.
2796
2797 The following examples show how to configure an ACL, and a classifier having
2798 a Logical SFF as an attachment-point:
2799
2800 **Configure an ACL**
2801
2802 The following ACL enables traffic intended for port 80 within the subnetwork
2803 192.168.2.0/24, for RSP1 and RSP1-Reverse.
2804
2805 ::
2806
2807         {
2808           "access-lists": {
2809             "acl": [
2810               {
2811                 "acl-name": "ACL1",
2812                 "acl-type": "ietf-access-control-list:ipv4-acl",
2813                 "access-list-entries": {
2814                   "ace": [
2815                     {
2816                       "rule-name": "ACE1",
2817                       "actions": {
2818                         "service-function-acl:rendered-service-path": "RSP1"
2819                       },
2820                       "matches": {
2821                         "destination-ipv4-network": "192.168.2.0/24",
2822                         "source-ipv4-network": "192.168.2.0/24",
2823                         "protocol": "6",
2824                         "source-port-range": {
2825                             "lower-port": 0
2826                         },
2827                         "destination-port-range": {
2828                             "lower-port": 80
2829                         }
2830                       }
2831                     }
2832                   ]
2833                 }
2834               },
2835               {
2836                 "acl-name": "ACL2",
2837                 "acl-type": "ietf-access-control-list:ipv4-acl",
2838                 "access-list-entries": {
2839                   "ace": [
2840                     {
2841                       "rule-name": "ACE2",
2842                       "actions": {
2843                         "service-function-acl:rendered-service-path": "RSP1-Reverse"
2844                       },
2845                       "matches": {
2846                         "destination-ipv4-network": "192.168.2.0/24",
2847                         "source-ipv4-network": "192.168.2.0/24",
2848                         "protocol": "6",
2849                         "source-port-range": {
2850                             "lower-port": 80
2851                         },
2852                         "destination-port-range": {
2853                             "lower-port": 0
2854                         }
2855                       }
2856                     }
2857                   ]
2858                 }
2859               }
2860             ]
2861           }
2862         }
2863
2864 ::
2865
2866   curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/ietf-access-control-list:access-lists/
2867
2868 **Configure a classifier JSON**
2869
2870 The following JSON provisions a classifier, having a Logical SFF as an
2871 attachment point. The value of the field 'interface' is where you
2872 indicate the neutron ports of the VMs you want to classify.
2873
2874 ::
2875
2876         {
2877           "service-function-classifiers": {
2878             "service-function-classifier": [
2879               {
2880                 "name": "Classifier1",
2881                 "scl-service-function-forwarder": [
2882                   {
2883                     "name": "sfflogical1",
2884                     "interface": "09a78ba3-78ba-40f5-a3ea-1ce708367f2b"
2885                   }
2886                 ],
2887                 "acl": {
2888                     "name": "ACL1",
2889                     "type": "ietf-access-control-list:ipv4-acl"
2890                  }
2891               }
2892             ]
2893           }
2894         }
2895
2896 ::
2897
2898   curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data '${JSON}' -X PUT --user admin:admin http://localhost:8181/restconf/config/service-function-classifier:service-function-classifiers/
2899
2900 .. _sfc-user-guide-pipeline-impacts:
2901
2902 SFC pipeline impacts
2903 ~~~~~~~~~~~~~~~~~~~~
2904
2905 After binding SFC service with a particular interface by means of Genius, as explained in the :ref:`Genius User Guide <genius-user-guide-binding-services>`,
2906 the entry point in the SFC pipeline will be table 82 (SFC_TRANSPORT_CLASSIFIER_TABLE), and from that point, packet
2907 processing will be similar to the :ref:`SFC OpenFlow pipeline <sfc-user-guide-sfc-of-pipeline>`, just with another set
2908 of specific tables for the SFC service.
2909
2910 This picture shows the SFC pipeline after service integration with Genius:
2911
2912 .. figure:: ./images/sfc/LSFF_pipeline.png
2913    :alt: SFC Logical SFF OpenFlow pipeline
2914
2915    SFC Logical SFF OpenFlow pipeline
2916
2917