FD.io VPP  v17.10-9-gd594711
Vector Packet Processing
sr_mpls_policy.c File Reference

SR MPLS policy creation and application. More...

+ Include dependency graph for sr_mpls_policy.c:

Go to the source code of this file.

Functions

static mpls_sr_sl_tcreate_sl (mpls_sr_policy_t *sr_policy, mpls_label_t *sl, u32 weight)
 Creates a Segment List and adds it to an SR policy. More...
 
int sr_mpls_policy_add (mpls_label_t bsid, mpls_label_t *segments, u8 behavior, u32 weight)
 Create a new SR policy. More...
 
int sr_mpls_policy_del (mpls_label_t bsid, u32 index)
 Delete a SR policy. More...
 
int sr_mpls_policy_mod (mpls_label_t bsid, u32 index, u8 operation, mpls_label_t *segments, u32 sl_index, u32 weight)
 Modify an existing SR policy. More...
 
static clib_error_tsr_mpls_policy_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI for 'sr mpls policies' command family. More...
 
static clib_error_tshow_sr_mpls_policies_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI to display onscreen all the SR MPLS policies. More...
 
clib_error_tsr_mpls_policy_rewrite_init (vlib_main_t *vm)
 SR MPLS Policy initialization. More...
 

Variables

mpls_sr_main_t sr_mpls_main
 
static vlib_cli_command_t sr_mpls_policy_command
 (constructor) VLIB_CLI_COMMAND (sr_mpls_policy_command) More...
 
static vlib_cli_command_t show_sr_mpls_policies_command
 (constructor) VLIB_CLI_COMMAND (show_sr_mpls_policies_command) More...
 

Detailed Description

SR MPLS policy creation and application.

Create an SR policy. An SR policy can be either of 'default' type or 'spray' type An SR policy has attached a list of SID lists. In case the SR policy is a default one it will load balance among them. An SR policy has associated a BindingSID. In case any packet arrives with MPLS_label == BindingSID then the SR policy associated to such bindingSID will be applied to such packet.

Definition in file sr_mpls_policy.c.

Function Documentation

static mpls_sr_sl_t* create_sl ( mpls_sr_policy_t sr_policy,
mpls_label_t sl,
u32  weight 
)
inlinestatic

Creates a Segment List and adds it to an SR policy.

Creates a Segment List and adds it to the SR policy. Notice that the SL are not necessarily unique. Hence there might be two Segment List within the same SR Policy with exactly the same segments and same weight.

Parameters
sr_policyis the SR policy where the SL will be added
slis a vector of IPv6 addresses composing the Segment List
weightis the weight of the SegmentList (for load-balancing purposes)
is_encaprepresents the mode (SRH insertion vs Encapsulation)
Returns
pointer to the just created segment list

Definition at line 62 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* show_sr_mpls_policies_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI to display onscreen all the SR MPLS policies.

Definition at line 491 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

int sr_mpls_policy_add ( mpls_label_t  bsid,
mpls_label_t segments,
u8  behavior,
u32  weight 
)

Create a new SR policy.

Parameters
bsidis the bindingSID of the SR Policy
segmentsis a vector of MPLS labels composing the segment list
behavioris the behavior of the SR policy. (default//spray)
fib_tableis the VRF where to install the FIB entry for the BSID
weightis the weight of this specific SID list
Returns
0 if correct, else error

Definition at line 137 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* sr_mpls_policy_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI for 'sr mpls policies' command family.

Definition at line 367 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

int sr_mpls_policy_del ( mpls_label_t  bsid,
u32  index 
)

Delete a SR policy.

Parameters
bsidis the bindingSID of the SR Policy
indexis the index of the SR policy
Returns
0 if correct, else error

Definition at line 176 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int sr_mpls_policy_mod ( mpls_label_t  bsid,
u32  index,
u8  operation,
mpls_label_t segments,
u32  sl_index,
u32  weight 
)

Modify an existing SR policy.

The possible modifications are adding a new Segment List, modifying an existing Segment List (modify the weight only) and delete a given Segment List from the SR Policy.

Parameters
bsidis the bindingSID of the SR Policy
indexis the index of the SR policy
fib_tableis the VRF where to install the FIB entry for the BSID
operationis the operation to perform (among the top ones)
segmentsis a vector of IPv6 address composing the segment list
sl_indexis the index of the Segment List to modify/delete
weightis the weight of the sid list. optional.
Returns
0 if correct, else error

Definition at line 262 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* sr_mpls_policy_rewrite_init ( vlib_main_t vm)

SR MPLS Policy initialization.

Definition at line 551 of file sr_mpls_policy.c.

Variable Documentation

vlib_cli_command_t show_sr_mpls_policies_command
static
Initial value:
= {
.path = "show sr mpls policies",
.short_help = "show sr mpls policies",
}
static clib_error_t * show_sr_mpls_policies_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI to display onscreen all the SR MPLS policies.

(constructor) VLIB_CLI_COMMAND (show_sr_mpls_policies_command)

Definition at line 539 of file sr_mpls_policy.c.

mpls_sr_main_t sr_mpls_main

Definition at line 44 of file sr_mpls_policy.c.

vlib_cli_command_t sr_mpls_policy_command
static
Initial value:
= {
.path = "sr mpls policy",
.short_help = "sr mpls policy [add||del||mod] bsid 2999 "
"next 10 next 20 next 30 (weight 1) (spray)",
.long_help = "TBD.\n",
}
static clib_error_t * sr_mpls_policy_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI for 'sr mpls policies' command family.

(constructor) VLIB_CLI_COMMAND (sr_mpls_policy_command)

Definition at line 478 of file sr_mpls_policy.c.