Nathan Skrzypczak | a2c9509 | 2021-10-08 14:05:58 +0200 | [diff] [blame] | 1 | .. _srv6_plugin_doc: |
| 2 | |
| 3 | Sample SRv6 LocalSID documentation |
| 4 | ================================== |
| 5 | |
| 6 | Introduction |
| 7 | ------------ |
| 8 | |
| 9 | This plugin is an example of how an user can create a new SRv6 LocalSID |
| 10 | behavior by using VPP plugins with the appropriate API calls to the |
| 11 | existing SR code. |
| 12 | |
| 13 | This **example** plugin registers a new localsid behavior, with cli |
| 14 | keyword ‘new_srv6_localsid’ which only takes one parameter, a fib-table. |
| 15 | Upon receival of a packet, this plugin will enforce the next IP6 lookup |
| 16 | in the specific fib-table specified by the user. (Indeed it will do the |
| 17 | lookup in the fib_table n+1 (since for the shake of the example we |
| 18 | increment the fib-table.) |
| 19 | |
| 20 | Notice that the plugin only ‘defines’ a new SRv6 LocalSID behavior, but |
| 21 | the existing SR code in VNET is the one actually instantiating new |
| 22 | LocalSIDs. Notice that there are callback functions such that when you |
| 23 | create or remove a LocalSID you can actually setup specific parameters |
| 24 | through the functions in this plugin. |
| 25 | |
| 26 | Variables 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.e. sr 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 | |
| 39 | Functions 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 | |
| 57 | Graph node |
| 58 | ---------- |
| 59 | |
| 60 | The current graph node uses the function ‘end_srh_processing’ to do the |
| 61 | Segment Routing Endpoint behavior. Notice that it does not allow the |
| 62 | cleanup of a Segment Routing header (as per the SRv6 behavior specs). |
| 63 | This function is identical to the one found in |
| 64 | /src/vnet/srv6/sr_localsid.c In case that by some other reason you want |
| 65 | to do decapsulation, or SRH clean_up you can use the functions |
| 66 | ‘end_decaps_srh_processing’ or ‘end_psp_srh_processing’ respectively. |