Migrate ALTO user docs to rst
[docs.git] / manuals / developer-guide / src / main / asciidoc / sfc / odl-sfc-classifier-dev.adoc
1 === SFC Classifier Control and Date plane Developer guide
2
3 ==== Overview
4 Description of classifier can be found in: https://datatracker.ietf.org/doc/draft-ietf-sfc-architecture/
5
6 Classifier manages everything from starting the packet listener to creation (and removal) of appropriate ip(6)tables rules and marking received packets accordingly. Its functionality is *available only on Linux* as it leverdges *NetfilterQueue*, which provides access to packets matched by an *iptables* rule. Classifier requires *root privileges* to be able to operate.
7
8 So far it is capable of processing ACL for MAC addresses, ports, IPv4 and IPv6. Supported protocols are TCP and UDP.
9
10 ==== Classifier Architecture
11 Python code located in the project repository sfc-py/common/classifier.py.
12
13 NOTE: classifier assumes that Rendered Service Path (RSP) *already exists* in ODL when an ACL referencing it is obtained
14
15 .How it works:
16 . sfc_agent receives an ACL and passes it for processing to the classifier
17 . the RSP (its SFF locator) referenced by ACL is requested from ODL
18 . if the RSP exists in the ODL then ACL based iptables rules for it are applied
19
20 After this process is over, every packet successfully matched to an iptables rule (i.e. successfully classified) will be NSH encapsulated and forwarded to a related SFF, which knows how to traverse the RSP.
21
22 Rules are created using appropriate iptables command. If the Access Control Entry (ACE) rule is MAC address related both iptables and ip6tabeles rules re issued. If ACE rule is IPv4 address related, only iptables rules are issued, same for IPv6.
23
24 NOTE: iptables *raw* table contains all created rules
25
26 Information regarding already registered RSP(s) are stored in an internal data-store, which is represented as a dictionary:
27
28         {rsp_id: {'name': <rsp_name>,
29                       'chains': {'chain_name': (<ipv>,),
30                                  ...
31                                  },
32                       'sff': {'ip': <ip>,
33                               'port': <port>,
34                               'starting-index': <starting-index>,
35                               'transport-type': <transport-type>
36                               },
37                       },
38         ...
39         }
40
41 .Where
42     * `name`: name of the RSP
43     * `chains`: dictionary of iptables chains related to the RSP with information about IP version for which the chain exists
44     * `SFF`: SFF forwarding parameters
45         - `ip`: SFF IP address
46         - `port`: SFF port
47         - `starting-index`: index given to packet at first RSP hop
48         - `transport-type`: encapsulation protocol
49
50 ==== Key APIs and Interfaces
51 This features exposes API to configure classifier (corresponds to service-function-classifier.yang)
52
53 ==== API Reference Documentation
54 See: sfc-model/src/main/yang/service-function-classifier.yang