forked from Mirror/frr
lib: Add ZAPI command ZEBRA_SRV6_SID_NOTIFY
Add a new ZAPI command `ZEBRA_SRV6_SID_NOTIFY` used by zebra to send asynchronous SRv6 SIDs notifications to zclients. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
This commit is contained in:
parent
84dd482cb9
commit
b90cb00974
|
@ -464,7 +464,8 @@ static const struct zebra_desc_table command_types[] = {
|
|||
DESC_ENTRY(ZEBRA_TC_CLASS_DELETE),
|
||||
DESC_ENTRY(ZEBRA_TC_FILTER_ADD),
|
||||
DESC_ENTRY(ZEBRA_TC_FILTER_DELETE),
|
||||
DESC_ENTRY(ZEBRA_OPAQUE_NOTIFY)
|
||||
DESC_ENTRY(ZEBRA_OPAQUE_NOTIFY),
|
||||
DESC_ENTRY(ZEBRA_SRV6_SID_NOTIFY)
|
||||
};
|
||||
#undef DESC_ENTRY
|
||||
|
||||
|
|
|
@ -2133,6 +2133,30 @@ stream_failure:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool zapi_srv6_sid_notify_decode(struct stream *s, struct srv6_sid_ctx *ctx,
|
||||
struct in6_addr *sid_value, uint32_t *func,
|
||||
uint32_t *wide_func,
|
||||
enum zapi_srv6_sid_notify *note)
|
||||
{
|
||||
uint32_t f, wf;
|
||||
|
||||
STREAM_GET(note, s, sizeof(*note));
|
||||
STREAM_GET(ctx, s, sizeof(struct srv6_sid_ctx));
|
||||
STREAM_GET(sid_value, s, sizeof(struct in6_addr));
|
||||
STREAM_GETL(s, f);
|
||||
STREAM_GETL(s, wf);
|
||||
|
||||
if (func)
|
||||
*func = f;
|
||||
if (wide_func)
|
||||
*wide_func = wf;
|
||||
|
||||
return true;
|
||||
|
||||
stream_failure:
|
||||
return false;
|
||||
}
|
||||
|
||||
struct nexthop *nexthop_from_zapi_nexthop(const struct zapi_nexthop *znh)
|
||||
{
|
||||
struct nexthop *n = nexthop_new();
|
||||
|
|
|
@ -238,6 +238,7 @@ typedef enum {
|
|||
ZEBRA_TC_FILTER_ADD,
|
||||
ZEBRA_TC_FILTER_DELETE,
|
||||
ZEBRA_OPAQUE_NOTIFY,
|
||||
ZEBRA_SRV6_SID_NOTIFY,
|
||||
} zebra_message_types_t;
|
||||
/* Zebra message types. Please update the corresponding
|
||||
* command_types array with any changes!
|
||||
|
@ -764,6 +765,13 @@ enum zapi_iptable_notify_owner {
|
|||
ZAPI_IPTABLE_FAIL_REMOVE,
|
||||
};
|
||||
|
||||
enum zapi_srv6_sid_notify {
|
||||
ZAPI_SRV6_SID_FAIL_ALLOC = 0,
|
||||
ZAPI_SRV6_SID_ALLOCATED,
|
||||
ZAPI_SRV6_SID_RELEASED,
|
||||
ZAPI_SRV6_SID_FAIL_RELEASE,
|
||||
};
|
||||
|
||||
enum zclient_send_status {
|
||||
ZCLIENT_SEND_FAILURE = -1,
|
||||
ZCLIENT_SEND_SUCCESS = 0,
|
||||
|
@ -816,6 +824,28 @@ zapi_rule_notify_owner2str(enum zapi_rule_notify_owner note)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline const char *zapi_srv6_sid_notify2str(enum zapi_srv6_sid_notify note)
|
||||
{
|
||||
const char *ret = "UNKNOWN";
|
||||
|
||||
switch (note) {
|
||||
case ZAPI_SRV6_SID_FAIL_ALLOC:
|
||||
ret = "ZAPI_SRV6_SID_FAIL_ALLOC";
|
||||
break;
|
||||
case ZAPI_SRV6_SID_ALLOCATED:
|
||||
ret = "ZAPI_SRV6_SID_ALLOCATED";
|
||||
break;
|
||||
case ZAPI_SRV6_SID_FAIL_RELEASE:
|
||||
ret = "ZAPI_SRV6_SID_FAIL_RELEASE";
|
||||
break;
|
||||
case ZAPI_SRV6_SID_RELEASED:
|
||||
ret = "ZAPI_SRV6_SID_RELEASED";
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Zebra MAC types */
|
||||
#define ZEBRA_MACIP_TYPE_STICKY 0x01 /* Sticky MAC*/
|
||||
#define ZEBRA_MACIP_TYPE_GW 0x02 /* gateway (SVI) mac*/
|
||||
|
@ -1144,6 +1174,10 @@ bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
|
|||
bool zapi_ipset_notify_decode(struct stream *s,
|
||||
uint32_t *unique,
|
||||
enum zapi_ipset_notify_owner *note);
|
||||
bool zapi_srv6_sid_notify_decode(struct stream *s, struct srv6_sid_ctx *ctx,
|
||||
struct in6_addr *sid_value, uint32_t *func,
|
||||
uint32_t *wide_func,
|
||||
enum zapi_srv6_sid_notify *note);
|
||||
|
||||
/* Nexthop-group message apis */
|
||||
extern enum zclient_send_status
|
||||
|
|
Loading…
Reference in a new issue