blob: a076cd2a6c7bc21259b3006beba967c061e0bb4f [file] [log] [blame]
Nathan Skrzypczaka2c95092021-10-08 14:05:58 +02001.. _srv6_plugin_doc:
2
3Sample SRv6 LocalSID documentation
4==================================
5
6Introduction
7------------
8
9This plugin is an example of how an user can create a new SRv6 LocalSID
10behavior by using VPP plugins with the appropriate API calls to the
11existing SR code.
12
13This **example** plugin registers a new localsid behavior, with cli
14keyword new_srv6_localsid which only takes one parameter, a fib-table.
15Upon receival of a packet, this plugin will enforce the next IP6 lookup
16in the specific fib-table specified by the user. (Indeed it will do the
17lookup in the fib_table n+1 (since for the shake of the example we
18increment the fib-table.)
19
20Notice that the plugin only defines a new SRv6 LocalSID behavior, but
21the existing SR code in VNET is the one actually instantiating new
22LocalSIDs. Notice that there are callback functions such that when you
23create or remove a LocalSID you can actually setup specific parameters
24through the functions in this plugin.
25
26Variables to watch for
27----------------------
28
29- srv6_localsid_name: This variable is the name (used as a unique key)
30 identifying this SR LocalSID plugin.
31- keyword_str: This is the CLI keyword to be used for the plugin. In
32 this example new_srv6_localsid’. (i.esr localsid address cafe::1
33 behavior new_srv6_localsid )
34- def_str: This is a definition of this SR behavior. This is printed
35 when you do show sr localsid behaviors’.
36- params_str: This is a definition of the parameters of this localsid.
37 This is printed when you do show sr localsid behaviors’.
38
39Functions to watch for
40----------------------
41
42- srv6_localsid_creation_fn: This function will be called every time a
43 new SR LocalSID is instantiated with the behavior defined in this
44 plugin.
45- srv6_localsid_removal_fn: This function will be called every time a
46 new SR LocalSID is removed with the behavior defined in this plugin.
47 This function tends to be used for freeing up all the memory created
48 in the previous function.
49- format_srv6_localsid_sample: This function prints nicely the
50 parameters of every SR LocalSID using this behavior.
51- unformat_srv6_localsid_sample: This function parses the CLI command
52 when initializing a new SR LocalSID using this behavior. It parses
53 all the parameters and ensures that the parameters are correct.
54- format_srv6_localsid_sample_dpo: This function formats the show ip6
55 fib message for the SR LocalSIDs created with this plugin behavior.
56
57Graph node
58----------
59
60The current graph node uses the function end_srh_processing to do the
61Segment Routing Endpoint behavior. Notice that it does not allow the
62cleanup of a Segment Routing header (as per the SRv6 behavior specs).
63This function is identical to the one found in
64/src/vnet/srv6/sr_localsid.c In case that by some other reason you want
65to do decapsulation, or SRH clean_up you can use the functions
66end_decaps_srh_processing or end_psp_srh_processing respectively.