FD.io VPP  v19.08.3-2-gbabecb413
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)
 Delete a SR policy. More...
 
int sr_mpls_policy_mod (mpls_label_t bsid, 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...
 
int sr_mpls_policy_assign_endpoint_color (mpls_label_t bsid, ip46_address_t *endpoint, u8 endpoint_type, u32 color)
 Update the Endpoint,Color tuple of an SR policy. More...
 
static clib_error_tcli_sr_mpls_policy_ec_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI to modify the Endpoint,Color of an SR policy. 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...
 
static vlib_cli_command_t cli_sr_mpls_policy_ec_command
 (constructor) VLIB_CLI_COMMAND (cli_sr_mpls_policy_ec_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. Also, a BSID can be associated with a (Next-Hop, Color)

Definition in file sr_mpls_policy.c.

Function Documentation

◆ cli_sr_mpls_policy_ec_command_fn()

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

CLI to modify the Endpoint,Color of an SR policy.

Definition at line 834 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

◆ create_sl()

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 60 of file sr_mpls_policy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_sr_mpls_policies_command_fn()

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 586 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

◆ sr_mpls_policy_add()

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 152 of file sr_mpls_policy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sr_mpls_policy_assign_endpoint_color()

int sr_mpls_policy_assign_endpoint_color ( mpls_label_t  bsid,
ip46_address_t *  endpoint,
u8  endpoint_type,
u32  color 
)

Update the Endpoint,Color tuple of an SR policy.

Parameters
bsidis the bindingSID of the SR Policy
endpointrepresents the IP46 of the endpoint
colorrepresents the color (u32)

To reset to NULL use ~0 as parameters.

Returns
0 if correct, else error

Definition at line 671 of file sr_mpls_policy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sr_mpls_policy_command_fn()

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 463 of file sr_mpls_policy.c.

+ Here is the call graph for this function:

◆ sr_mpls_policy_del()

int sr_mpls_policy_del ( mpls_label_t  bsid)

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 207 of file sr_mpls_policy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sr_mpls_policy_mod()

int sr_mpls_policy_mod ( mpls_label_t  bsid,
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
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 ok, >0 index of SL, <0 error

Definition at line 299 of file sr_mpls_policy.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sr_mpls_policy_rewrite_init()

clib_error_t* sr_mpls_policy_rewrite_init ( vlib_main_t vm)

SR MPLS Policy initialization.

Definition at line 905 of file sr_mpls_policy.c.

Variable Documentation

◆ cli_sr_mpls_policy_ec_command

vlib_cli_command_t cli_sr_mpls_policy_ec_command
static
Initial value:
=
{
.path = "sr mpls policy te",
.short_help = "sr mpls policy te bsid xxxxx endpoint x.x.x.x color 12341234",
}
static clib_error_t * cli_sr_mpls_policy_ec_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI to modify the Endpoint,Color of an SR policy.

(constructor) VLIB_CLI_COMMAND (cli_sr_mpls_policy_ec_command)

Definition at line 892 of file sr_mpls_policy.c.

◆ show_sr_mpls_policies_command

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 651 of file sr_mpls_policy.c.

◆ sr_mpls_main

mpls_sr_main_t sr_mpls_main

Definition at line 42 of file sr_mpls_policy.c.

◆ sr_mpls_policy_command

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 &#39;sr mpls policies&#39; command family.

(constructor) VLIB_CLI_COMMAND (sr_mpls_policy_command)

Definition at line 572 of file sr_mpls_policy.c.