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