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