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));
78 vl_api_sr_mpls_policy_mod_reply_t *rmp;
87 this_address = ntohl (mp->
segments[i]);
88 clib_memcpy (seg, &this_address,
sizeof (this_address));
103 vl_api_sr_mpls_policy_del_reply_t *rmp;
113 vl_api_sr_mpls_steering_add_del_reply_t *rmp;
117 memcpy (&prefix.ip4, mp->
prefix_addr, sizeof (prefix.ip4));
119 memcpy (&prefix, mp->
prefix_addr, sizeof (prefix.ip6));
139 REPLY_MACRO (VL_API_SR_MPLS_STEERING_ADD_DEL_REPLY);
145 vl_api_sr_mpls_policy_assign_endpoint_color_reply_t *rmp;
148 ip46_address_t endpoint;
149 clib_memset (&endpoint, 0,
sizeof (ip46_address_t));
151 memcpy (&endpoint.ip4, mp->
endpoint, sizeof (endpoint.ip4));
153 memcpy (&endpoint, mp->
endpoint, sizeof (endpoint.ip6));
159 REPLY_MACRO (VL_API_SR_MPLS_POLICY_ASSIGN_ENDPOINT_COLOR_REPLY);
167 #define vl_msg_name_crc_list 169 #undef vl_msg_name_crc_list 174 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 175 foreach_vl_msg_name_crc_sr_mpls;
185 vl_msg_api_set_handlers(VL_API_##N, #n, \ 186 vl_api_##n##_t_handler, \ 188 vl_api_##n##_t_endian, \ 189 vl_api_##n##_t_print, \ 190 sizeof(vl_api_##n##_t), 1); 199 "sr_mpls_policy_add",
202 vl_api_sr_mpls_policy_add_t_endian,
210 "sr_mpls_policy_mod",
213 vl_api_sr_mpls_policy_mod_t_endian,
214 vl_api_sr_mpls_policy_mod_t_print, 256, 1);
MPLS SR steering add/del.
static void * vl_api_sr_mpls_policy_add_t_print(vl_api_sr_mpls_policy_add_t *mp, void *handle)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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.
#define clib_memcpy(d, s, n)
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 vec_free(V)
Free vector's memory (no header).
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.