42 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 49 #define foreach_vpe_api_msg \ 50 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \ 51 _(SR_POLICY_ADD, sr_policy_add) \ 52 _(SR_POLICY_MOD, sr_policy_mod) \ 53 _(SR_POLICY_DEL, sr_policy_del) \ 54 _(SR_STEERING_ADD_DEL, sr_steering_add_del) \ 55 _(SR_SET_ENCAP_SOURCE, sr_set_encap_source) \ 56 _(SR_SET_ENCAP_HOP_LIMIT, sr_set_encap_hop_limit) \ 57 _(SR_LOCALSIDS_DUMP, sr_localsids_dump) \ 58 _(SR_POLICIES_DUMP, sr_policies_dump) \ 59 _(SR_STEERING_POL_DUMP, sr_steering_pol_dump) 64 vl_api_sr_localsid_add_del_reply_t *rmp;
67 ip6_address_t localsid;
96 vl_api_sr_policy_add_reply_t *rmp;
97 ip6_address_t *segments = 0, *seg;
98 ip6_address_t bsid_addr;
101 for (i = 0; i < mp->
sids.num_sids; i++)
117 ntohl (mp->
sids.weight),
128 vl_api_sr_policy_mod_reply_t *rmp;
129 ip6_address_t *segments = 0, *seg;
130 ip6_address_t bsid_addr;
133 for (i = 0; i < mp->
sids.num_sids; i++)
153 ntohl (mp->
sids.weight));
162 vl_api_sr_policy_del_reply_t *rmp;
164 ip6_address_t bsid_addr;
178 vl_api_sr_set_encap_source_reply_t *rmp;
180 ip6_address_t encaps_source;
191 vl_api_sr_set_encap_hop_limit_reply_t *rmp;
195 rv = VNET_API_ERROR_INVALID_VALUE;
205 vl_api_sr_steering_add_del_reply_t *rmp;
207 ip6_address_t bsid_addr;
208 ip46_address_t prefix_addr;
241 rmp->_vl_msg_id = ntohs (VL_API_SR_LOCALSIDS_DETAILS);
277 send_sr_localsid_details(t, reg, mp->context);
288 u32 *sl_index, slidx = 0;
290 ip6_address_t *segment;
291 vl_api_srv6_sid_list_t *api_sid_list;
295 sizeof (vl_api_srv6_sid_list_t));
299 sizeof (vl_api_srv6_sid_list_t)));
301 rmp->_vl_msg_id = ntohs (VL_API_SR_POLICIES_DETAILS);
316 api_sid_list->weight = htonl (segment_list->
weight);
342 send_sr_policies_details(t, reg, mp->context);
355 rmp->_vl_msg_id = ntohs (VL_API_SR_STEERING_POL_DETAILS);
389 send_sr_steering_pol_details(t, reg, mp->context);
401 #define vl_msg_name_crc_list 403 #undef vl_msg_name_crc_list 408 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 409 foreach_vl_msg_name_crc_sr;
419 vl_msg_api_set_handlers(VL_API_##N, #n, \ 420 vl_api_##n##_t_handler, \ 422 vl_api_##n##_t_endian, \ 423 vl_api_##n##_t_print, \ 424 sizeof(vl_api_##n##_t), 1);
struct sr_steering_key_t::@515::@517 l3
u8 type
Type (default is 0)
u32 vlan_index
VLAN tag (not an index)
void sr_set_source(ip6_address_t *address)
vl_api_ip6_address_t addr
vl_api_sr_steer_t traffic_type
vl_api_ip6_address_t bsid
int sr_steering_policy(int is_del, ip6_address_t *bsid, u32 sr_policy_index, u32 table_id, ip46_address_t *prefix, u32 mask_width, u32 sw_if_index, u8 traffic_type)
Steer traffic L2 and L3 traffic through a given SR policy.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void send_sr_policies_details(ip6_sr_policy_t *t, vl_api_registration_t *reg, u32 context)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
vl_api_interface_index_t sw_if_index
void ip6_address_decode(const vl_api_ip6_address_t in, ip6_address_t *out)
ip6_address_t * segments
SIDs (key)
static void vl_api_sr_policy_add_t_handler(vl_api_sr_policy_add_t *mp)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
vl_api_address_t xconnect_nh_addr
u16 behavior
Behavior associated to this localsid.
vl_api_sr_behavior_t behavior
void * vl_msg_api_alloc(int nbytes)
ip6_sr_steering_policy_t * steer_policies
IPv6 SR Set SRv6 encapsulation hop-limit.
vl_api_srv6_sid_list_t sids
vl_api_interface_index_t sw_if_index[default=0xffffffff]
static void vl_api_sr_steering_add_del_t_handler(vl_api_sr_steering_add_del_t *mp)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vl_api_srv6_sid_list_t sids
static void vl_api_sr_policy_mod_t_handler(vl_api_sr_policy_mod_t *mp)
vl_api_sr_policy_op_t operation
SR Segment List (SID list)
vl_api_sr_behavior_t behavior
ip46_type_t ip_address_decode(const vl_api_address_t *in, ip46_address_t *out)
Decode/Encode for struct/union types.
static void send_sr_localsid_details(ip6_sr_localsid_t *t, vl_api_registration_t *reg, u32 context)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vl_api_sr_localsids_dump_t_handler(vl_api_sr_localsids_dump_t *mp)
bool is_del[default=false]
static void setup_message_id_table(api_main_t *am)
u32 xconnect_iface_or_vrf_table
vl_api_interface_index_t sw_if_index
static void send_sr_steering_pol_details(ip6_sr_steering_policy_t *t, vl_api_registration_t *reg, u32 context)
int sr_cli_localsid(char is_del, ip6_address_t *localsid_addr, u16 localsid_prefix_len, char end_psp, u8 behavior, u32 sw_if_index, u32 vlan_index, u32 fib_table, ip46_address_t *nh_addr, int usid_len, void *ls_plugin_mem)
SR localsid add/del.
char end_psp
Combined with End.PSP?
sr_steering_key_t classify
Traffic classification.
static void vl_api_sr_steering_pol_dump_t_handler(vl_api_sr_policies_dump_t *mp)
u8 is_encap
Mode (0 is SRH insert, 1 Encaps)
u32 sr_policy
SR Policy index.
u32 weight
SID list weight (wECMP / UCMP)
API main structure, used by both vpp and binary API clients.
An API client registration, only in vpp/vlib.
ip6_sr_localsid_t * localsids
#define BAD_SW_IF_INDEX_LABEL
VLIB_API_INIT_FUNCTION(sr_api_hookup)
vl_api_srv6_sid_list_t sid_lists[num_sid_lists]
vl_api_ip6_address_t bsid
vl_api_sr_steer_t traffic_type
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
vl_api_ip6_address_t bsid_addr
int sr_policy_del(ip6_address_t *bsid, u32 index)
Delete a SR policy.
u32 * segments_lists
SID lists indexes (vector)
static void vl_api_sr_set_encap_hop_limit_t_handler(vl_api_sr_set_encap_hop_limit_t *mp)
IPv6 SR Set SRv6 encapsulation source.
static void vl_api_sr_policies_dump_t_handler(vl_api_sr_policies_dump_t *mp)
IPv6 SR steering add/del.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
vl_api_ip6_address_t localsid
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
int sr_policy_add(ip6_address_t *bsid, ip6_address_t *segments, u32 weight, u8 behavior, u32 fib_table, u8 is_encap, u16 plugin, void *plugin_mem)
Create a new SR policy.
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
#define foreach_vpe_api_msg
u32 fib_table
FIB table where localsid is registered.
struct sr_steering_key_t::@515::@518 l2
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip6_sr_policy_t * sr_policies
static void vl_api_sr_policy_del_t_handler(vl_api_sr_policy_del_t *mp)
vl_api_ip6_address_t bsid_addr
vl_api_ip6_address_t bsid_addr
vl_api_ip6_address_t encaps_source
static clib_error_t * sr_api_hookup(vlib_main_t *vm)
bool is_del[default=false]
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
void sr_set_hop_limit(u8 hop_limit)
static api_main_t * vlibapi_get_main(void)
Segment Routing data structures definitions.
Segment Routing main datastructure.
IPv6 SR policy modification.
#define vec_foreach(var, vec)
Vector iterator.
u8 traffic_type
Traffic type (IPv4, IPv6, L2)
ip46_address_t next_hop
Next_hop for xconnect usage only.
static void vl_api_sr_localsid_add_del_t_handler(vl_api_sr_localsid_add_del_t *mp)
Dump the list of SR policies.
u32 sw_if_index
xconnect only
vl_api_ip6_address_t bsid_addr
IPv6 SR LocalSID add/del request.
ip6_address_t localsid
LocalSID IPv6 address.
static void vl_api_sr_set_encap_source_t_handler(vl_api_sr_set_encap_source_t *mp)
int sr_policy_mod(ip6_address_t *bsid, u32 index, u32 fib_table, u8 operation, ip6_address_t *segments, u32 sl_index, u32 weight)
Modify an existing SR policy.
ip6_address_t bsid
BindingSID (key)
#define VALIDATE_SW_IF_INDEX(mp)
Dump the list of SR LocalSIDs.