38 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 45 #define foreach_vpe_api_msg \ 46 _(SR_MPLS_POLICY_DEL, sr_mpls_policy_del) \ 47 _(SR_MPLS_STEERING_ADD_DEL, sr_mpls_steering_add_del) \ 48 _(SR_MPLS_POLICY_ASSIGN_ENDPOINT_COLOR, sr_mpls_policy_assign_endpoint_color) 54 vl_api_sr_mpls_policy_add_reply_t *rmp;
63 this_address = ntohl (mp->
segments[i]);
64 clib_memcpy (seg, &this_address,
sizeof (this_address));
77 vl_api_sr_mpls_policy_mod_reply_t *rmp;
86 this_address = ntohl (mp->
segments[i]);
87 clib_memcpy (seg, &this_address,
sizeof (this_address));
101 vl_api_sr_mpls_policy_del_reply_t *rmp;
111 vl_api_sr_mpls_steering_add_del_reply_t *rmp;
112 ip46_address_t prefix;
113 memset (&prefix, 0,
sizeof (ip46_address_t));
115 memcpy (&prefix.ip4, mp->
prefix_addr, sizeof (prefix.ip4));
117 memcpy (&prefix, mp->
prefix_addr, sizeof (prefix.ip6));
137 REPLY_MACRO (VL_API_SR_MPLS_STEERING_ADD_DEL_REPLY);
143 vl_api_sr_mpls_policy_assign_endpoint_color_reply_t *rmp;
146 ip46_address_t endpoint;
147 memset (&endpoint, 0,
sizeof (ip46_address_t));
149 memcpy (&endpoint.ip4, mp->
endpoint, sizeof (endpoint.ip4));
151 memcpy (&endpoint, mp->
endpoint, sizeof (endpoint.ip6));
157 REPLY_MACRO (VL_API_SR_MPLS_POLICY_ASSIGN_ENDPOINT_COLOR_REPLY);
165 #define vl_msg_name_crc_list 167 #undef vl_msg_name_crc_list 172 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 173 foreach_vl_msg_name_crc_sr_mpls;
183 vl_msg_api_set_handlers(VL_API_##N, #n, \ 184 vl_api_##n##_t_handler, \ 186 vl_api_##n##_t_endian, \ 187 vl_api_##n##_t_print, \ 188 sizeof(vl_api_##n##_t), 1); 197 "sr_mpls_policy_add",
200 vl_api_sr_mpls_policy_add_t_endian,
201 vl_api_sr_mpls_policy_add_t_print, 256, 1);
208 "sr_mpls_policy_mod",
211 vl_api_sr_mpls_policy_mod_t_endian,
212 vl_api_sr_mpls_policy_mod_t_print, 256, 1);
MPLS SR steering add/del.
void vl_noop_handler(void *mp)
u32 mpls_label_t
A label value only, i.e.
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
MPLS SR steering add/del.
MPLS SR policy modification.
static void vl_api_sr_mpls_policy_mod_t_handler(vl_api_sr_mpls_policy_mod_t *mp)
static void vl_api_sr_mpls_steering_add_del_t_handler(vl_api_sr_mpls_steering_add_del_t *mp)
static clib_error_t * sr_mpls_api_hookup(vlib_main_t *vm)
int sr_mpls_policy_add(mpls_label_t bsid, mpls_label_t *segments, u8 behavior, u32 weight)
Create a new SR policy.
static void setup_message_id_table(api_main_t *am)
void vl_msg_api_set_handlers(int msg_id, char *msg_name, void *handler, void *cleanup, void *endian, void *print, int msg_size, int traced)
int sr_mpls_steering_policy_del(ip46_address_t *prefix, u32 mask_width, u8 traffic_type, u32 table_id, u32 color)
Delete steering rule for an SR-MPLS policy.
API main structure, used by both vpp and binary API clients.
#define clib_memcpy(a, b, c)
static void vl_api_sr_mpls_policy_del_t_handler(vl_api_sr_mpls_policy_del_t *mp)
int sr_mpls_policy_del(mpls_label_t bsid)
Delete a SR policy.
#define foreach_vpe_api_msg
static void vl_api_sr_mpls_policy_assign_endpoint_color_t_handler(vl_api_sr_mpls_policy_assign_endpoint_color_t *mp)
VLIB_API_INIT_FUNCTION(sr_mpls_api_hookup)
static void vl_api_sr_mpls_policy_add_t_handler(vl_api_sr_mpls_policy_add_t *mp)
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.
Segment Routing MPLS data structures definitions.
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.
int sr_mpls_steering_policy_add(mpls_label_t bsid, u32 table_id, ip46_address_t *prefix, u32 mask_width, u8 traffic_type, ip46_address_t *next_hop, u8 nh_type, u32 color, char co_bits, mpls_label_t vpn_label)
Steer traffic L3 traffic through a given SR-MPLS policy.