mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 12:36:20 +00:00
Merge pull request #17941 from opensourcerouting/fix-dst-src
static: fix botched staticd YANG conversion for dst-src
This commit is contained in:
commit
bd82864d03
@ -309,13 +309,3 @@ static ssize_t printfrr_rn(struct fbuf *buf, struct printfrr_eargs *ea,
|
|||||||
cbuf, sizeof(cbuf));
|
cbuf, sizeof(cbuf));
|
||||||
return bputs(buf, cbuf);
|
return bputs(buf, cbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct route_table *srcdest_srcnode_table(struct route_node *rn)
|
|
||||||
{
|
|
||||||
if (rnode_is_dstnode(rn)) {
|
|
||||||
struct srcdest_rnode *srn = srcdest_rnode_from_rnode(rn);
|
|
||||||
|
|
||||||
return srn->src_table;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
@ -87,8 +87,6 @@ static inline void *srcdest_rnode_table_info(struct route_node *rn)
|
|||||||
return route_table_get_info(srcdest_rnode_table(rn));
|
return route_table_get_info(srcdest_rnode_table(rn));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern struct route_table *srcdest_srcnode_table(struct route_node *rn);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2123,6 +2123,15 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
|||||||
uint32_t *tableid,
|
uint32_t *tableid,
|
||||||
enum zapi_route_notify_owner *note,
|
enum zapi_route_notify_owner *note,
|
||||||
afi_t *afi, safi_t *safi)
|
afi_t *afi, safi_t *safi)
|
||||||
|
{
|
||||||
|
struct prefix dummy;
|
||||||
|
|
||||||
|
return zapi_route_notify_decode_srcdest(s, p, &dummy, tableid, note, afi, safi);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool zapi_route_notify_decode_srcdest(struct stream *s, struct prefix *p, struct prefix *src_p,
|
||||||
|
uint32_t *tableid, enum zapi_route_notify_owner *note,
|
||||||
|
afi_t *afi, safi_t *safi)
|
||||||
{
|
{
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
afi_t afi_val;
|
afi_t afi_val;
|
||||||
@ -2133,6 +2142,9 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
|||||||
STREAM_GETC(s, p->family);
|
STREAM_GETC(s, p->family);
|
||||||
STREAM_GETC(s, p->prefixlen);
|
STREAM_GETC(s, p->prefixlen);
|
||||||
STREAM_GET(&p->u.prefix, s, prefix_blen(p));
|
STREAM_GET(&p->u.prefix, s, prefix_blen(p));
|
||||||
|
src_p->family = p->family;
|
||||||
|
STREAM_GETC(s, src_p->prefixlen);
|
||||||
|
STREAM_GET(&src_p->u.prefix, s, prefix_blen(src_p));
|
||||||
STREAM_GETL(s, t);
|
STREAM_GETL(s, t);
|
||||||
STREAM_GETC(s, afi_val);
|
STREAM_GETC(s, afi_val);
|
||||||
STREAM_GETC(s, safi_val);
|
STREAM_GETC(s, safi_val);
|
||||||
|
@ -1168,6 +1168,9 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
|||||||
uint32_t *tableid,
|
uint32_t *tableid,
|
||||||
enum zapi_route_notify_owner *note,
|
enum zapi_route_notify_owner *note,
|
||||||
afi_t *afi, safi_t *safi);
|
afi_t *afi, safi_t *safi);
|
||||||
|
bool zapi_route_notify_decode_srcdest(struct stream *s, struct prefix *p, struct prefix *src_p,
|
||||||
|
uint32_t *tableid, enum zapi_route_notify_owner *note,
|
||||||
|
afi_t *afi, safi_t *safi);
|
||||||
bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
|
bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
|
||||||
uint32_t *priority, uint32_t *unique, char *ifname,
|
uint32_t *priority, uint32_t *unique, char *ifname,
|
||||||
enum zapi_rule_notify_owner *note);
|
enum zapi_rule_notify_owner *note);
|
||||||
|
@ -134,96 +134,6 @@ const struct frr_yang_module_info frr_staticd_info = {
|
|||||||
.destroy = route_next_hop_bfd_profile_destroy,
|
.destroy = route_next_hop_bfd_profile_destroy,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list",
|
|
||||||
.cbs = {
|
|
||||||
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_create,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list",
|
|
||||||
.cbs = {
|
|
||||||
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_create,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/tag",
|
|
||||||
.cbs = {
|
|
||||||
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_tag_modify,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop",
|
|
||||||
.cbs = {
|
|
||||||
.apply_finish = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_apply_finish,
|
|
||||||
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_create,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_destroy,
|
|
||||||
.pre_validate = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_pre_validate,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/bh-type",
|
|
||||||
.cbs = {
|
|
||||||
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_modify,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/onlink",
|
|
||||||
.cbs = {
|
|
||||||
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_onlink_modify,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/srte-color",
|
|
||||||
.cbs = {
|
|
||||||
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_modify,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/srv6-segs-stack/entry",
|
|
||||||
.cbs = {
|
|
||||||
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_create,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/srv6-segs-stack/entry/seg",
|
|
||||||
.cbs = {
|
|
||||||
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_seg_modify,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_seg_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/mpls-label-stack/entry",
|
|
||||||
.cbs = {
|
|
||||||
.create = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_create,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/mpls-label-stack/entry/label",
|
|
||||||
.cbs = {
|
|
||||||
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_modify,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/mpls-label-stack/entry/ttl",
|
|
||||||
.cbs = {
|
|
||||||
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_modify,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/mpls-label-stack/entry/traffic-class",
|
|
||||||
.cbs = {
|
|
||||||
.modify = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_modify,
|
|
||||||
.destroy = routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_destroy,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/segment-routing/srv6/static-sids/sid",
|
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/segment-routing/srv6/static-sids/sid",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
|
@ -72,52 +72,6 @@ int route_next_hop_bfd_source_destroy(struct nb_cb_destroy_args *args);
|
|||||||
int route_next_hop_bfd_profile_modify(struct nb_cb_modify_args *args);
|
int route_next_hop_bfd_profile_modify(struct nb_cb_modify_args *args);
|
||||||
int route_next_hop_bfd_profile_destroy(struct nb_cb_destroy_args *args);
|
int route_next_hop_bfd_profile_destroy(struct nb_cb_destroy_args *args);
|
||||||
int route_next_hop_bfd_multi_hop_modify(struct nb_cb_modify_args *args);
|
int route_next_hop_bfd_multi_hop_modify(struct nb_cb_modify_args *args);
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_create(
|
|
||||||
struct nb_cb_create_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_create(
|
|
||||||
struct nb_cb_create_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_tag_modify(
|
|
||||||
struct nb_cb_modify_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_create(
|
|
||||||
struct nb_cb_create_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_modify(
|
|
||||||
struct nb_cb_modify_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_onlink_modify(
|
|
||||||
struct nb_cb_modify_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_modify(
|
|
||||||
struct nb_cb_modify_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_create(
|
|
||||||
struct nb_cb_create_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_seg_modify(
|
|
||||||
struct nb_cb_modify_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_seg_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_create(
|
|
||||||
struct nb_cb_create_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_modify(
|
|
||||||
struct nb_cb_modify_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_modify(
|
|
||||||
struct nb_cb_modify_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_modify(
|
|
||||||
struct nb_cb_modify_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_destroy(
|
|
||||||
struct nb_cb_destroy_args *args);
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_create(
|
int routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_create(
|
||||||
struct nb_cb_create_args *args);
|
struct nb_cb_create_args *args);
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_destroy(
|
int routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_destroy(
|
||||||
@ -151,8 +105,6 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_segment_routi
|
|||||||
|
|
||||||
void routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_apply_finish(
|
void routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_apply_finish(
|
||||||
struct nb_cb_apply_finish_args *args);
|
struct nb_cb_apply_finish_args *args);
|
||||||
void routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_apply_finish(
|
|
||||||
struct nb_cb_apply_finish_args *args);
|
|
||||||
void routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_apply_finish(
|
void routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_srv6_local_sids_sid_apply_finish(
|
||||||
struct nb_cb_apply_finish_args *args);
|
struct nb_cb_apply_finish_args *args);
|
||||||
|
|
||||||
@ -169,16 +121,16 @@ int routing_control_plane_protocols_name_validate(
|
|||||||
|
|
||||||
/* xpath macros */
|
/* xpath macros */
|
||||||
/* route-list */
|
/* route-list */
|
||||||
#define FRR_STATIC_ROUTE_INFO_KEY_XPATH \
|
#define FRR_STATIC_ROUTE_INFO_KEY_XPATH \
|
||||||
"/frr-routing:routing/control-plane-protocols/" \
|
"/frr-routing:routing/control-plane-protocols/" \
|
||||||
"control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \
|
"control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \
|
||||||
"frr-staticd:staticd/route-list[prefix='%s'][afi-safi='%s']/" \
|
"frr-staticd:staticd/route-list[prefix='%s'][src-prefix='%s'][afi-safi='%s']/" \
|
||||||
"path-list[table-id='%u'][distance='%u']"
|
"path-list[table-id='%u'][distance='%u']"
|
||||||
|
|
||||||
#define FRR_STATIC_ROUTE_INFO_KEY_NO_DISTANCE_XPATH \
|
#define FRR_STATIC_ROUTE_INFO_KEY_NO_DISTANCE_XPATH \
|
||||||
"/frr-routing:routing/control-plane-protocols/" \
|
"/frr-routing:routing/control-plane-protocols/" \
|
||||||
"control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \
|
"control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \
|
||||||
"frr-staticd:staticd/route-list[prefix='%s'][afi-safi='%s']/" \
|
"frr-staticd:staticd/route-list[prefix='%s'][src-prefix='%s'][afi-safi='%s']/" \
|
||||||
"path-list[table-id='%u']"
|
"path-list[table-id='%u']"
|
||||||
|
|
||||||
|
|
||||||
@ -203,19 +155,6 @@ int routing_control_plane_protocols_name_validate(
|
|||||||
|
|
||||||
#define FRR_STATIC_ROUTE_NH_SRV6_KEY_SEG_XPATH "/entry[id='%u']/seg"
|
#define FRR_STATIC_ROUTE_NH_SRV6_KEY_SEG_XPATH "/entry[id='%u']/seg"
|
||||||
|
|
||||||
/* route-list/srclist */
|
|
||||||
#define FRR_S_ROUTE_SRC_INFO_KEY_XPATH \
|
|
||||||
"/frr-routing:routing/control-plane-protocols/" \
|
|
||||||
"control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \
|
|
||||||
"frr-staticd:staticd/route-list[prefix='%s'][afi-safi='%s']/" \
|
|
||||||
"src-list[src-prefix='%s']/path-list[table-id='%u'][distance='%u']"
|
|
||||||
|
|
||||||
#define FRR_S_ROUTE_SRC_INFO_KEY_NO_DISTANCE_XPATH \
|
|
||||||
"/frr-routing:routing/control-plane-protocols/" \
|
|
||||||
"control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \
|
|
||||||
"frr-staticd:staticd/route-list[prefix='%s'][afi-safi='%s']/" \
|
|
||||||
"src-list[src-prefix='%s']/path-list[table-id='%u']"
|
|
||||||
|
|
||||||
/* route-list/frr-nexthops */
|
/* route-list/frr-nexthops */
|
||||||
#define FRR_DEL_S_ROUTE_NH_KEY_XPATH \
|
#define FRR_DEL_S_ROUTE_NH_KEY_XPATH \
|
||||||
FRR_STATIC_ROUTE_INFO_KEY_XPATH \
|
FRR_STATIC_ROUTE_INFO_KEY_XPATH \
|
||||||
@ -226,16 +165,6 @@ int routing_control_plane_protocols_name_validate(
|
|||||||
FRR_STATIC_ROUTE_INFO_KEY_NO_DISTANCE_XPATH \
|
FRR_STATIC_ROUTE_INFO_KEY_NO_DISTANCE_XPATH \
|
||||||
FRR_STATIC_ROUTE_NH_KEY_XPATH
|
FRR_STATIC_ROUTE_NH_KEY_XPATH
|
||||||
|
|
||||||
/* route-list/src/src-list/frr-nexthops*/
|
|
||||||
#define FRR_DEL_S_ROUTE_SRC_NH_KEY_XPATH \
|
|
||||||
FRR_S_ROUTE_SRC_INFO_KEY_XPATH \
|
|
||||||
FRR_STATIC_ROUTE_NH_KEY_XPATH
|
|
||||||
|
|
||||||
/* route-list/src/src-list/frr-nexthops*/
|
|
||||||
#define FRR_DEL_S_ROUTE_SRC_NH_KEY_NO_DISTANCE_XPATH \
|
|
||||||
FRR_S_ROUTE_SRC_INFO_KEY_NO_DISTANCE_XPATH \
|
|
||||||
FRR_STATIC_ROUTE_NH_KEY_XPATH
|
|
||||||
|
|
||||||
/* srv6 */
|
/* srv6 */
|
||||||
#define FRR_STATIC_SRV6_INFO_KEY_XPATH \
|
#define FRR_STATIC_SRV6_INFO_KEY_XPATH \
|
||||||
"/frr-routing:routing/control-plane-protocols/" \
|
"/frr-routing:routing/control-plane-protocols/" \
|
||||||
|
@ -502,16 +502,6 @@ void routing_control_plane_protocols_control_plane_protocol_staticd_route_list_p
|
|||||||
static_install_nexthop(nh);
|
static_install_nexthop(nh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_apply_finish(
|
|
||||||
struct nb_cb_apply_finish_args *args)
|
|
||||||
{
|
|
||||||
struct static_nexthop *nh;
|
|
||||||
|
|
||||||
nh = nb_running_get_entry(args->dnode, NULL, true);
|
|
||||||
|
|
||||||
static_install_nexthop(nh);
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_pre_validate(
|
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_path_list_frr_nexthops_nexthop_pre_validate(
|
||||||
struct nb_cb_pre_validate_args *args)
|
struct nb_cb_pre_validate_args *args)
|
||||||
{
|
{
|
||||||
@ -576,7 +566,7 @@ int routing_control_plane_protocols_staticd_destroy(
|
|||||||
if (!stable)
|
if (!stable)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (rn = route_top(stable); rn; rn = route_next(rn))
|
for (rn = route_top(stable); rn; rn = srcdest_route_next(rn))
|
||||||
static_del_route(rn);
|
static_del_route(rn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,7 +585,7 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
|
|||||||
struct static_vrf *svrf;
|
struct static_vrf *svrf;
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
const struct lyd_node *vrf_dnode;
|
const struct lyd_node *vrf_dnode;
|
||||||
struct prefix prefix;
|
struct prefix prefix, src_prefix, *src_p;
|
||||||
const char *afi_safi;
|
const char *afi_safi;
|
||||||
afi_t prefix_afi;
|
afi_t prefix_afi;
|
||||||
afi_t afi;
|
afi_t afi;
|
||||||
@ -604,6 +594,8 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
|
|||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
|
yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
|
||||||
|
yang_dnode_get_prefix(&src_prefix, args->dnode, "src-prefix");
|
||||||
|
src_p = src_prefix.prefixlen ? &src_prefix : NULL;
|
||||||
afi_safi = yang_dnode_get_string(args->dnode, "afi-safi");
|
afi_safi = yang_dnode_get_string(args->dnode, "afi-safi");
|
||||||
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
|
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
|
||||||
prefix_afi = family2afi(prefix.family);
|
prefix_afi = family2afi(prefix.family);
|
||||||
@ -614,6 +606,14 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
|
|||||||
yang_dnode_get_string(args->dnode, "prefix"));
|
yang_dnode_get_string(args->dnode, "prefix"));
|
||||||
return NB_ERR_VALIDATION;
|
return NB_ERR_VALIDATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src_p && afi != AFI_IP6) {
|
||||||
|
flog_warn(EC_LIB_NB_CB_CONFIG_VALIDATE,
|
||||||
|
"invalid use of IPv6 dst-src prefix %s on %s",
|
||||||
|
yang_dnode_get_string(args->dnode, "src-prefix"),
|
||||||
|
yang_dnode_get_string(args->dnode, "prefix"));
|
||||||
|
return NB_ERR_VALIDATION;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
@ -624,10 +624,12 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
|
|||||||
svrf = nb_running_get_entry(vrf_dnode, NULL, true);
|
svrf = nb_running_get_entry(vrf_dnode, NULL, true);
|
||||||
|
|
||||||
yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
|
yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
|
||||||
|
yang_dnode_get_prefix(&src_prefix, args->dnode, "src-prefix");
|
||||||
|
src_p = src_prefix.prefixlen ? &src_prefix : NULL;
|
||||||
afi_safi = yang_dnode_get_string(args->dnode, "afi-safi");
|
afi_safi = yang_dnode_get_string(args->dnode, "afi-safi");
|
||||||
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
|
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
|
||||||
|
|
||||||
rn = static_add_route(afi, safi, &prefix, NULL, svrf);
|
rn = static_add_route(afi, safi, &prefix, (struct prefix_ipv6 *)src_p, svrf);
|
||||||
if (!svrf->vrf || svrf->vrf->vrf_id == VRF_UNKNOWN)
|
if (!svrf->vrf || svrf->vrf->vrf_id == VRF_UNKNOWN)
|
||||||
snprintf(
|
snprintf(
|
||||||
args->errmsg, args->errmsg_len,
|
args->errmsg, args->errmsg_len,
|
||||||
@ -1046,331 +1048,6 @@ int route_next_hop_bfd_profile_destroy(struct nb_cb_destroy_args *args)
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_create(
|
|
||||||
struct nb_cb_create_args *args)
|
|
||||||
{
|
|
||||||
struct static_vrf *s_vrf;
|
|
||||||
struct route_node *rn;
|
|
||||||
struct route_node *src_rn;
|
|
||||||
struct prefix_ipv6 src_prefix = {};
|
|
||||||
struct stable_info *info;
|
|
||||||
afi_t afi;
|
|
||||||
safi_t safi = SAFI_UNICAST;
|
|
||||||
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
break;
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
rn = nb_running_get_entry(args->dnode, NULL, true);
|
|
||||||
info = route_table_get_info(rn->table);
|
|
||||||
s_vrf = info->svrf;
|
|
||||||
yang_dnode_get_ipv6p(&src_prefix, args->dnode, "src-prefix");
|
|
||||||
afi = family2afi(src_prefix.family);
|
|
||||||
src_rn =
|
|
||||||
static_add_route(afi, safi, &rn->p, &src_prefix, s_vrf);
|
|
||||||
nb_running_set_entry(args->dnode, src_rn);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
struct route_node *src_rn;
|
|
||||||
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
break;
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
src_rn = nb_running_unset_entry(args->dnode);
|
|
||||||
static_del_route(src_rn);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_create(
|
|
||||||
struct nb_cb_create_args *args)
|
|
||||||
{
|
|
||||||
return static_path_list_create(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
return static_path_list_destroy(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/tag
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_tag_modify(
|
|
||||||
struct nb_cb_modify_args *args)
|
|
||||||
{
|
|
||||||
return static_path_list_tag_modify(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_create(
|
|
||||||
struct nb_cb_create_args *args)
|
|
||||||
{
|
|
||||||
return static_nexthop_create(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
return static_nexthop_destroy(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/bh-type
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_bh_type_modify(
|
|
||||||
struct nb_cb_modify_args *args)
|
|
||||||
{
|
|
||||||
return static_nexthop_bh_type_modify(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/onlink
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_onlink_modify(
|
|
||||||
struct nb_cb_modify_args *args)
|
|
||||||
{
|
|
||||||
return static_nexthop_onlink_modify(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/srte-color
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_modify(
|
|
||||||
struct nb_cb_modify_args *args)
|
|
||||||
{
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
break;
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
if (static_nexthop_color_modify(args) != NB_OK)
|
|
||||||
return NB_ERR;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_color_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
break;
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
if (static_nexthop_color_destroy(args) != NB_OK)
|
|
||||||
return NB_ERR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/srv6-segs-stack/entry
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_create(
|
|
||||||
struct nb_cb_create_args *args)
|
|
||||||
{
|
|
||||||
return nexthop_srv6_segs_stack_entry_create(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
return nexthop_srv6_segs_stack_entry_destroy(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/srv6-segs-stack/entry/seg
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_seg_modify(
|
|
||||||
struct nb_cb_modify_args *args)
|
|
||||||
{
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
break;
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
if (static_nexthop_srv6_segs_modify(args) != NB_OK)
|
|
||||||
return NB_ERR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_srv6_segs_stack_entry_seg_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* No operation is required in this call back.
|
|
||||||
* nexthop_mpls_seg_stack_entry_destroy() will take care
|
|
||||||
* to reset the seg vaue.
|
|
||||||
*/
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/mpls-label-stack/entry
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_create(
|
|
||||||
struct nb_cb_create_args *args)
|
|
||||||
{
|
|
||||||
return nexthop_mpls_label_stack_entry_create(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
return nexthop_mpls_label_stack_entry_destroy(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/mpls-label-stack/entry/label
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_modify(
|
|
||||||
struct nb_cb_modify_args *args)
|
|
||||||
{
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
break;
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
if (static_nexthop_mpls_label_modify(args) != NB_OK)
|
|
||||||
return NB_ERR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_label_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* No operation is required in this call back.
|
|
||||||
* nexthop_mpls_label_stack_entry_destroy() will take care
|
|
||||||
* to reset the label vaue.
|
|
||||||
*/
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/mpls-label-stack/entry/ttl
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_modify(
|
|
||||||
struct nb_cb_modify_args *args)
|
|
||||||
{
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XPath:
|
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop/mpls-label-stack/entry/traffic-class
|
|
||||||
*/
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_modify(
|
|
||||||
struct nb_cb_modify_args *args)
|
|
||||||
{
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_list_path_list_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_destroy(
|
|
||||||
struct nb_cb_destroy_args *args)
|
|
||||||
{
|
|
||||||
switch (args->event) {
|
|
||||||
case NB_EV_VALIDATE:
|
|
||||||
case NB_EV_PREPARE:
|
|
||||||
case NB_EV_ABORT:
|
|
||||||
case NB_EV_APPLY:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NB_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath:
|
* XPath:
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/segment-routing
|
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/segment-routing
|
||||||
|
@ -49,8 +49,8 @@ static void static_nht_update_path(struct static_path *pn, struct prefix *nhp,
|
|||||||
static_zebra_route_add(pn, true);
|
static_zebra_route_add(pn, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void static_nht_update_safi(struct prefix *sp, struct prefix *nhp,
|
static void static_nht_update_safi(const struct prefix *sp, const struct prefix *ssrc_p,
|
||||||
uint32_t nh_num, afi_t afi, safi_t safi,
|
struct prefix *nhp, uint32_t nh_num, afi_t afi, safi_t safi,
|
||||||
struct static_vrf *svrf, vrf_id_t nh_vrf_id)
|
struct static_vrf *svrf, vrf_id_t nh_vrf_id)
|
||||||
{
|
{
|
||||||
struct route_table *stable;
|
struct route_table *stable;
|
||||||
@ -63,7 +63,7 @@ static void static_nht_update_safi(struct prefix *sp, struct prefix *nhp,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (sp) {
|
if (sp) {
|
||||||
rn = srcdest_rnode_lookup(stable, sp, NULL);
|
rn = srcdest_rnode_lookup(stable, sp, (const struct prefix_ipv6 *)ssrc_p);
|
||||||
if (rn && rn->info) {
|
if (rn && rn->info) {
|
||||||
si = static_route_info_from_rnode(rn);
|
si = static_route_info_from_rnode(rn);
|
||||||
frr_each(static_path_list, &si->path_list, pn) {
|
frr_each(static_path_list, &si->path_list, pn) {
|
||||||
@ -75,7 +75,7 @@ static void static_nht_update_safi(struct prefix *sp, struct prefix *nhp,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (rn = route_top(stable); rn; rn = route_next(rn)) {
|
for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) {
|
||||||
si = static_route_info_from_rnode(rn);
|
si = static_route_info_from_rnode(rn);
|
||||||
if (!si)
|
if (!si)
|
||||||
continue;
|
continue;
|
||||||
@ -85,14 +85,13 @@ static void static_nht_update_safi(struct prefix *sp, struct prefix *nhp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void static_nht_update(struct prefix *sp, struct prefix *nhp, uint32_t nh_num,
|
void static_nht_update(const struct prefix *sp, const struct prefix *ssrc_p, struct prefix *nhp,
|
||||||
afi_t afi, safi_t safi, vrf_id_t nh_vrf_id)
|
uint32_t nh_num, afi_t afi, safi_t safi, vrf_id_t nh_vrf_id)
|
||||||
{
|
{
|
||||||
struct static_vrf *svrf;
|
struct static_vrf *svrf;
|
||||||
|
|
||||||
RB_FOREACH (svrf, svrf_name_head, &svrfs)
|
RB_FOREACH (svrf, svrf_name_head, &svrfs)
|
||||||
static_nht_update_safi(sp, nhp, nh_num, afi, safi, svrf,
|
static_nht_update_safi(sp, ssrc_p, nhp, nh_num, afi, safi, svrf, nh_vrf_id);
|
||||||
nh_vrf_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void static_nht_reset_start_safi(struct prefix *nhp, afi_t afi,
|
static void static_nht_reset_start_safi(struct prefix *nhp, afi_t afi,
|
||||||
@ -109,7 +108,7 @@ static void static_nht_reset_start_safi(struct prefix *nhp, afi_t afi,
|
|||||||
if (!stable)
|
if (!stable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (rn = route_top(stable); rn; rn = route_next(rn)) {
|
for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) {
|
||||||
si = static_route_info_from_rnode(rn);
|
si = static_route_info_from_rnode(rn);
|
||||||
if (!si)
|
if (!si)
|
||||||
continue;
|
continue;
|
||||||
@ -150,8 +149,8 @@ void static_nht_reset_start(struct prefix *nhp, afi_t afi, safi_t safi,
|
|||||||
static_nht_reset_start_safi(nhp, afi, safi, svrf, nh_vrf_id);
|
static_nht_reset_start_safi(nhp, afi, safi, svrf, nh_vrf_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void static_nht_mark_state_safi(struct prefix *sp, afi_t afi,
|
static void static_nht_mark_state_safi(const struct prefix *sp, const struct prefix *ssrc_p,
|
||||||
safi_t safi, struct vrf *vrf,
|
afi_t afi, safi_t safi, struct vrf *vrf,
|
||||||
enum static_install_states state)
|
enum static_install_states state)
|
||||||
{
|
{
|
||||||
struct static_vrf *svrf;
|
struct static_vrf *svrf;
|
||||||
@ -169,7 +168,7 @@ static void static_nht_mark_state_safi(struct prefix *sp, afi_t afi,
|
|||||||
if (!stable)
|
if (!stable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rn = srcdest_rnode_lookup(stable, sp, NULL);
|
rn = srcdest_rnode_lookup(stable, sp, (const struct prefix_ipv6 *)ssrc_p);
|
||||||
if (!rn)
|
if (!rn)
|
||||||
return;
|
return;
|
||||||
si = rn->info;
|
si = rn->info;
|
||||||
@ -184,8 +183,8 @@ static void static_nht_mark_state_safi(struct prefix *sp, afi_t afi,
|
|||||||
route_unlock_node(rn);
|
route_unlock_node(rn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static_nht_mark_state(struct prefix *sp, safi_t safi, vrf_id_t vrf_id,
|
void static_nht_mark_state(const struct prefix *sp, const struct prefix *ssrc_p, safi_t safi,
|
||||||
enum static_install_states state)
|
vrf_id_t vrf_id, enum static_install_states state)
|
||||||
{
|
{
|
||||||
struct vrf *vrf;
|
struct vrf *vrf;
|
||||||
|
|
||||||
@ -198,5 +197,5 @@ void static_nht_mark_state(struct prefix *sp, safi_t safi, vrf_id_t vrf_id,
|
|||||||
if (!vrf || !vrf->info)
|
if (!vrf || !vrf->info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static_nht_mark_state_safi(sp, afi, safi, vrf, state);
|
static_nht_mark_state_safi(sp, ssrc_p, afi, safi, vrf, state);
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,14 @@ extern "C" {
|
|||||||
* us call this function to find the nexthop we are tracking so it
|
* us call this function to find the nexthop we are tracking so it
|
||||||
* can be installed or removed.
|
* can be installed or removed.
|
||||||
*
|
*
|
||||||
* sp -> The route we are looking at. If NULL then look at all
|
* sp + ssrc_p -> The route we are looking at. If NULL then look at all routes.
|
||||||
* routes.
|
|
||||||
* nhp -> The nexthop that is being tracked.
|
* nhp -> The nexthop that is being tracked.
|
||||||
* nh_num -> number of valid nexthops.
|
* nh_num -> number of valid nexthops.
|
||||||
* afi -> The afi we are working in.
|
* afi -> The afi we are working in.
|
||||||
* vrf_id -> The vrf the nexthop is in.
|
* vrf_id -> The vrf the nexthop is in.
|
||||||
*/
|
*/
|
||||||
extern void static_nht_update(struct prefix *sp, struct prefix *nhp,
|
extern void static_nht_update(const struct prefix *sp, const struct prefix *ssrc_p,
|
||||||
uint32_t nh_num, afi_t afi, safi_t safi,
|
struct prefix *nhp, uint32_t nh_num, afi_t afi, safi_t safi,
|
||||||
vrf_id_t vrf_id);
|
vrf_id_t vrf_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -35,11 +34,10 @@ extern void static_nht_reset_start(struct prefix *nhp, afi_t afi, safi_t safi,
|
|||||||
vrf_id_t nh_vrf_id);
|
vrf_id_t nh_vrf_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For the given prefix, sp, mark it as in a particular state
|
* For the given prefix, sp + ssrc_p, mark it as in a particular state
|
||||||
*/
|
*/
|
||||||
extern void static_nht_mark_state(struct prefix *sp, safi_t safi,
|
extern void static_nht_mark_state(const struct prefix *sp, const struct prefix *ssrc_p, safi_t safi,
|
||||||
vrf_id_t vrf_id,
|
vrf_id_t vrf_id, enum static_install_states state);
|
||||||
enum static_install_states state);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For the given nexthop, returns the string
|
* For the given nexthop, returns the string
|
||||||
|
@ -33,10 +33,6 @@ void zebra_stable_node_cleanup(struct route_table *table,
|
|||||||
struct static_nexthop *nh;
|
struct static_nexthop *nh;
|
||||||
struct static_path *pn;
|
struct static_path *pn;
|
||||||
struct static_route_info *si;
|
struct static_route_info *si;
|
||||||
struct route_table *src_table;
|
|
||||||
struct route_node *src_node;
|
|
||||||
struct static_path *src_pn;
|
|
||||||
struct static_route_info *src_si;
|
|
||||||
|
|
||||||
si = node->info;
|
si = node->info;
|
||||||
|
|
||||||
@ -50,36 +46,6 @@ void zebra_stable_node_cleanup(struct route_table *table,
|
|||||||
static_path_list_del(&si->path_list, pn);
|
static_path_list_del(&si->path_list, pn);
|
||||||
XFREE(MTYPE_STATIC_PATH, pn);
|
XFREE(MTYPE_STATIC_PATH, pn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up for dst table */
|
|
||||||
src_table = srcdest_srcnode_table(node);
|
|
||||||
if (src_table) {
|
|
||||||
/* This means the route_node is part of the top
|
|
||||||
* hierarchy and refers to a destination prefix.
|
|
||||||
*/
|
|
||||||
for (src_node = route_top(src_table); src_node;
|
|
||||||
src_node = route_next(src_node)) {
|
|
||||||
src_si = src_node->info;
|
|
||||||
|
|
||||||
frr_each_safe(static_path_list,
|
|
||||||
&src_si->path_list, src_pn) {
|
|
||||||
frr_each_safe(static_nexthop_list,
|
|
||||||
&src_pn->nexthop_list,
|
|
||||||
nh) {
|
|
||||||
static_nexthop_list_del(
|
|
||||||
&src_pn->nexthop_list,
|
|
||||||
nh);
|
|
||||||
XFREE(MTYPE_STATIC_NEXTHOP, nh);
|
|
||||||
}
|
|
||||||
static_path_list_del(&src_si->path_list,
|
|
||||||
src_pn);
|
|
||||||
XFREE(MTYPE_STATIC_PATH, src_pn);
|
|
||||||
}
|
|
||||||
|
|
||||||
XFREE(MTYPE_STATIC_ROUTE, src_node->info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XFREE(MTYPE_STATIC_ROUTE, node->info);
|
XFREE(MTYPE_STATIC_ROUTE, node->info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,28 +90,10 @@ struct route_node *static_add_route(afi_t afi, safi_t safi, struct prefix *p,
|
|||||||
return rn;
|
return rn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* To delete the srcnodes */
|
|
||||||
static void static_del_src_route(struct route_node *rn)
|
|
||||||
{
|
|
||||||
struct static_path *pn;
|
|
||||||
struct static_route_info *si;
|
|
||||||
|
|
||||||
si = rn->info;
|
|
||||||
|
|
||||||
frr_each_safe(static_path_list, &si->path_list, pn) {
|
|
||||||
static_del_path(pn);
|
|
||||||
}
|
|
||||||
|
|
||||||
XFREE(MTYPE_STATIC_ROUTE, rn->info);
|
|
||||||
route_unlock_node(rn);
|
|
||||||
}
|
|
||||||
|
|
||||||
void static_del_route(struct route_node *rn)
|
void static_del_route(struct route_node *rn)
|
||||||
{
|
{
|
||||||
struct static_path *pn;
|
struct static_path *pn;
|
||||||
struct static_route_info *si;
|
struct static_route_info *si;
|
||||||
struct route_table *src_table;
|
|
||||||
struct route_node *src_node;
|
|
||||||
|
|
||||||
si = rn->info;
|
si = rn->info;
|
||||||
|
|
||||||
@ -153,17 +101,6 @@ void static_del_route(struct route_node *rn)
|
|||||||
static_del_path(pn);
|
static_del_path(pn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up for dst table */
|
|
||||||
src_table = srcdest_srcnode_table(rn);
|
|
||||||
if (src_table) {
|
|
||||||
/* This means the route_node is part of the top hierarchy
|
|
||||||
* and refers to a destination prefix.
|
|
||||||
*/
|
|
||||||
for (src_node = route_top(src_table); src_node;
|
|
||||||
src_node = route_next(src_node)) {
|
|
||||||
static_del_src_route(src_node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
XFREE(MTYPE_STATIC_ROUTE, rn->info);
|
XFREE(MTYPE_STATIC_ROUTE, rn->info);
|
||||||
route_unlock_node(rn);
|
route_unlock_node(rn);
|
||||||
}
|
}
|
||||||
@ -477,7 +414,7 @@ static void static_fixup_vrf(struct vrf *vrf, struct route_table *stable,
|
|||||||
struct static_path *pn;
|
struct static_path *pn;
|
||||||
struct static_route_info *si;
|
struct static_route_info *si;
|
||||||
|
|
||||||
for (rn = route_top(stable); rn; rn = route_next(rn)) {
|
for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) {
|
||||||
si = static_route_info_from_rnode(rn);
|
si = static_route_info_from_rnode(rn);
|
||||||
if (!si)
|
if (!si)
|
||||||
continue;
|
continue;
|
||||||
@ -517,7 +454,7 @@ static void static_enable_vrf(struct route_table *stable, afi_t afi, safi_t safi
|
|||||||
struct static_path *pn;
|
struct static_path *pn;
|
||||||
struct static_route_info *si;
|
struct static_route_info *si;
|
||||||
|
|
||||||
for (rn = route_top(stable); rn; rn = route_next(rn)) {
|
for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) {
|
||||||
si = static_route_info_from_rnode(rn);
|
si = static_route_info_from_rnode(rn);
|
||||||
if (!si)
|
if (!si)
|
||||||
continue;
|
continue;
|
||||||
@ -575,7 +512,7 @@ static void static_cleanup_vrf(struct vrf *vrf, struct route_table *stable,
|
|||||||
struct static_path *pn;
|
struct static_path *pn;
|
||||||
struct static_route_info *si;
|
struct static_route_info *si;
|
||||||
|
|
||||||
for (rn = route_top(stable); rn; rn = route_next(rn)) {
|
for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) {
|
||||||
si = static_route_info_from_rnode(rn);
|
si = static_route_info_from_rnode(rn);
|
||||||
if (!si)
|
if (!si)
|
||||||
continue;
|
continue;
|
||||||
@ -608,7 +545,7 @@ static void static_disable_vrf(struct route_table *stable,
|
|||||||
struct static_path *pn;
|
struct static_path *pn;
|
||||||
struct static_route_info *si;
|
struct static_route_info *si;
|
||||||
|
|
||||||
for (rn = route_top(stable); rn; rn = route_next(rn)) {
|
for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) {
|
||||||
si = static_route_info_from_rnode(rn);
|
si = static_route_info_from_rnode(rn);
|
||||||
if (!si)
|
if (!si)
|
||||||
continue;
|
continue;
|
||||||
|
@ -51,10 +51,8 @@ struct static_vrf *static_vrf_alloc(const char *name)
|
|||||||
|
|
||||||
for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
|
for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
|
||||||
for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) {
|
for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) {
|
||||||
if (afi == AFI_IP6)
|
table = srcdest_table_init();
|
||||||
table = srcdest_table_init();
|
table->cleanup = zebra_stable_node_cleanup;
|
||||||
else
|
|
||||||
table = route_table_init();
|
|
||||||
|
|
||||||
info = XCALLOC(MTYPE_STATIC_RTABLE_INFO,
|
info = XCALLOC(MTYPE_STATIC_RTABLE_INFO,
|
||||||
sizeof(struct stable_info));
|
sizeof(struct stable_info));
|
||||||
@ -63,7 +61,6 @@ struct static_vrf *static_vrf_alloc(const char *name)
|
|||||||
info->safi = safi;
|
info->safi = safi;
|
||||||
route_table_set_info(table, info);
|
route_table_set_info(table, info);
|
||||||
|
|
||||||
table->cleanup = zebra_stable_node_cleanup;
|
|
||||||
svrf->stable[afi][safi] = table;
|
svrf->stable[afi][safi] = table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
|
|||||||
char xpath_seg[XPATH_MAXLEN];
|
char xpath_seg[XPATH_MAXLEN];
|
||||||
char ab_xpath[XPATH_MAXLEN];
|
char ab_xpath[XPATH_MAXLEN];
|
||||||
char buf_prefix[PREFIX_STRLEN];
|
char buf_prefix[PREFIX_STRLEN];
|
||||||
char buf_src_prefix[PREFIX_STRLEN] = {};
|
char buf_src_prefix[PREFIX_STRLEN] = "::/0";
|
||||||
char buf_nh_type[PREFIX_STRLEN] = {};
|
char buf_nh_type[PREFIX_STRLEN] = {};
|
||||||
char buf_tag[PREFIX_STRLEN];
|
char buf_tag[PREFIX_STRLEN];
|
||||||
uint8_t label_stack_id = 0;
|
uint8_t label_stack_id = 0;
|
||||||
@ -116,6 +116,7 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(!!str2prefix(args->prefix, &p));
|
assert(!!str2prefix(args->prefix, &p));
|
||||||
|
src = (struct prefix){ .family = p.family, .prefixlen = 0 };
|
||||||
|
|
||||||
switch (args->afi) {
|
switch (args->afi) {
|
||||||
case AFI_IP:
|
case AFI_IP:
|
||||||
@ -146,7 +147,7 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
|
|||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->source)
|
if (src.prefixlen)
|
||||||
prefix2str(&src, buf_src_prefix, sizeof(buf_src_prefix));
|
prefix2str(&src, buf_src_prefix, sizeof(buf_src_prefix));
|
||||||
if (args->gateway)
|
if (args->gateway)
|
||||||
buf_gate_str = args->gateway;
|
buf_gate_str = args->gateway;
|
||||||
@ -183,25 +184,10 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
|
|||||||
|
|
||||||
static_get_nh_type(type, buf_nh_type, sizeof(buf_nh_type));
|
static_get_nh_type(type, buf_nh_type, sizeof(buf_nh_type));
|
||||||
if (!args->delete) {
|
if (!args->delete) {
|
||||||
if (args->source)
|
snprintf(ab_xpath, sizeof(ab_xpath), FRR_DEL_S_ROUTE_NH_KEY_NO_DISTANCE_XPATH,
|
||||||
snprintf(ab_xpath, sizeof(ab_xpath),
|
"frr-staticd:staticd", "staticd", args->vrf, buf_prefix, buf_src_prefix,
|
||||||
FRR_DEL_S_ROUTE_SRC_NH_KEY_NO_DISTANCE_XPATH,
|
yang_afi_safi_value2identity(args->afi, args->safi), table_id, buf_nh_type,
|
||||||
"frr-staticd:staticd", "staticd", args->vrf,
|
args->nexthop_vrf, buf_gate_str, args->interface_name);
|
||||||
buf_prefix,
|
|
||||||
yang_afi_safi_value2identity(args->afi,
|
|
||||||
args->safi),
|
|
||||||
buf_src_prefix, table_id, buf_nh_type,
|
|
||||||
args->nexthop_vrf, buf_gate_str,
|
|
||||||
args->interface_name);
|
|
||||||
else
|
|
||||||
snprintf(ab_xpath, sizeof(ab_xpath),
|
|
||||||
FRR_DEL_S_ROUTE_NH_KEY_NO_DISTANCE_XPATH,
|
|
||||||
"frr-staticd:staticd", "staticd", args->vrf,
|
|
||||||
buf_prefix,
|
|
||||||
yang_afi_safi_value2identity(args->afi,
|
|
||||||
args->safi),
|
|
||||||
table_id, buf_nh_type, args->nexthop_vrf,
|
|
||||||
buf_gate_str, args->interface_name);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there's already the same nexthop but with a different
|
* If there's already the same nexthop but with a different
|
||||||
@ -218,22 +204,9 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* route + path procesing */
|
/* route + path procesing */
|
||||||
if (args->source)
|
snprintf(xpath_prefix, sizeof(xpath_prefix), FRR_STATIC_ROUTE_INFO_KEY_XPATH,
|
||||||
snprintf(xpath_prefix, sizeof(xpath_prefix),
|
"frr-staticd:staticd", "staticd", args->vrf, buf_prefix, buf_src_prefix,
|
||||||
FRR_S_ROUTE_SRC_INFO_KEY_XPATH,
|
yang_afi_safi_value2identity(args->afi, args->safi), table_id, distance);
|
||||||
"frr-staticd:staticd", "staticd", args->vrf,
|
|
||||||
buf_prefix,
|
|
||||||
yang_afi_safi_value2identity(args->afi,
|
|
||||||
args->safi),
|
|
||||||
buf_src_prefix, table_id, distance);
|
|
||||||
else
|
|
||||||
snprintf(xpath_prefix, sizeof(xpath_prefix),
|
|
||||||
FRR_STATIC_ROUTE_INFO_KEY_XPATH,
|
|
||||||
"frr-staticd:staticd", "staticd", args->vrf,
|
|
||||||
buf_prefix,
|
|
||||||
yang_afi_safi_value2identity(args->afi,
|
|
||||||
args->safi),
|
|
||||||
table_id, distance);
|
|
||||||
|
|
||||||
nb_cli_enqueue_change(vty, xpath_prefix, NB_OP_CREATE, NULL);
|
nb_cli_enqueue_change(vty, xpath_prefix, NB_OP_CREATE, NULL);
|
||||||
|
|
||||||
@ -412,51 +385,18 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
|
|||||||
if (orig_seg)
|
if (orig_seg)
|
||||||
XFREE(MTYPE_TMP, orig_seg);
|
XFREE(MTYPE_TMP, orig_seg);
|
||||||
} else {
|
} else {
|
||||||
if (args->source) {
|
if (args->distance)
|
||||||
if (args->distance)
|
snprintf(ab_xpath, sizeof(ab_xpath), FRR_DEL_S_ROUTE_NH_KEY_XPATH,
|
||||||
snprintf(ab_xpath, sizeof(ab_xpath),
|
"frr-staticd:staticd", "staticd", args->vrf, buf_prefix,
|
||||||
FRR_DEL_S_ROUTE_SRC_NH_KEY_XPATH,
|
buf_src_prefix, yang_afi_safi_value2identity(args->afi, args->safi),
|
||||||
"frr-staticd:staticd", "staticd",
|
table_id, distance, buf_nh_type, args->nexthop_vrf, buf_gate_str,
|
||||||
args->vrf, buf_prefix,
|
args->interface_name);
|
||||||
yang_afi_safi_value2identity(
|
else
|
||||||
args->afi, args->safi),
|
snprintf(ab_xpath, sizeof(ab_xpath),
|
||||||
buf_src_prefix, table_id, distance,
|
FRR_DEL_S_ROUTE_NH_KEY_NO_DISTANCE_XPATH, "frr-staticd:staticd",
|
||||||
buf_nh_type, args->nexthop_vrf,
|
"staticd", args->vrf, buf_prefix, buf_src_prefix,
|
||||||
buf_gate_str, args->interface_name);
|
yang_afi_safi_value2identity(args->afi, args->safi), table_id,
|
||||||
else
|
buf_nh_type, args->nexthop_vrf, buf_gate_str, args->interface_name);
|
||||||
snprintf(
|
|
||||||
ab_xpath, sizeof(ab_xpath),
|
|
||||||
FRR_DEL_S_ROUTE_SRC_NH_KEY_NO_DISTANCE_XPATH,
|
|
||||||
"frr-staticd:staticd", "staticd",
|
|
||||||
args->vrf, buf_prefix,
|
|
||||||
yang_afi_safi_value2identity(
|
|
||||||
args->afi, args->safi),
|
|
||||||
buf_src_prefix, table_id, buf_nh_type,
|
|
||||||
args->nexthop_vrf, buf_gate_str,
|
|
||||||
args->interface_name);
|
|
||||||
} else {
|
|
||||||
if (args->distance)
|
|
||||||
snprintf(ab_xpath, sizeof(ab_xpath),
|
|
||||||
FRR_DEL_S_ROUTE_NH_KEY_XPATH,
|
|
||||||
"frr-staticd:staticd", "staticd",
|
|
||||||
args->vrf, buf_prefix,
|
|
||||||
yang_afi_safi_value2identity(
|
|
||||||
args->afi, args->safi),
|
|
||||||
table_id, distance, buf_nh_type,
|
|
||||||
args->nexthop_vrf, buf_gate_str,
|
|
||||||
args->interface_name);
|
|
||||||
else
|
|
||||||
snprintf(
|
|
||||||
ab_xpath, sizeof(ab_xpath),
|
|
||||||
FRR_DEL_S_ROUTE_NH_KEY_NO_DISTANCE_XPATH,
|
|
||||||
"frr-staticd:staticd", "staticd",
|
|
||||||
args->vrf, buf_prefix,
|
|
||||||
yang_afi_safi_value2identity(
|
|
||||||
args->afi, args->safi),
|
|
||||||
table_id, buf_nh_type,
|
|
||||||
args->nexthop_vrf, buf_gate_str,
|
|
||||||
args->interface_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
dnode = yang_dnode_get(vty->candidate_config->dnode, ab_xpath);
|
dnode = yang_dnode_get(vty->candidate_config->dnode, ab_xpath);
|
||||||
if (!dnode) {
|
if (!dnode) {
|
||||||
@ -1439,9 +1379,8 @@ static int srv6_seg_iter_cb(const struct lyd_node *dnode, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
|
static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
|
||||||
const struct lyd_node *src,
|
const struct lyd_node *path, const struct lyd_node *nexthop,
|
||||||
const struct lyd_node *path,
|
bool show_defaults)
|
||||||
const struct lyd_node *nexthop, bool show_defaults)
|
|
||||||
{
|
{
|
||||||
const char *vrf;
|
const char *vrf;
|
||||||
const char *afi_safi;
|
const char *afi_safi;
|
||||||
@ -1455,6 +1394,7 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
|
|||||||
struct srv6_seg_iter seg_iter;
|
struct srv6_seg_iter seg_iter;
|
||||||
const char *nexthop_vrf;
|
const char *nexthop_vrf;
|
||||||
uint32_t table_id;
|
uint32_t table_id;
|
||||||
|
struct prefix src_prefix;
|
||||||
bool onlink;
|
bool onlink;
|
||||||
|
|
||||||
vrf = yang_dnode_get_string(route, "../../vrf");
|
vrf = yang_dnode_get_string(route, "../../vrf");
|
||||||
@ -1476,9 +1416,9 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
|
|||||||
|
|
||||||
vty_out(vty, " %s", yang_dnode_get_string(route, "prefix"));
|
vty_out(vty, " %s", yang_dnode_get_string(route, "prefix"));
|
||||||
|
|
||||||
if (src)
|
yang_dnode_get_prefix(&src_prefix, route, "src-prefix");
|
||||||
vty_out(vty, " from %s",
|
if (src_prefix.prefixlen)
|
||||||
yang_dnode_get_string(src, "src-prefix"));
|
vty_out(vty, " from %pFX", &src_prefix);
|
||||||
|
|
||||||
nh_type = yang_dnode_get_enum(nexthop, "nh-type");
|
nh_type = yang_dnode_get_enum(nexthop, "nh-type");
|
||||||
switch (nh_type) {
|
switch (nh_type) {
|
||||||
@ -1582,18 +1522,7 @@ static void static_nexthop_cli_show(struct vty *vty,
|
|||||||
const struct lyd_node *route =
|
const struct lyd_node *route =
|
||||||
yang_dnode_get_parent(path, "route-list");
|
yang_dnode_get_parent(path, "route-list");
|
||||||
|
|
||||||
nexthop_cli_show(vty, route, NULL, path, dnode, show_defaults);
|
nexthop_cli_show(vty, route, path, dnode, show_defaults);
|
||||||
}
|
|
||||||
|
|
||||||
static void static_src_nexthop_cli_show(struct vty *vty,
|
|
||||||
const struct lyd_node *dnode,
|
|
||||||
bool show_defaults)
|
|
||||||
{
|
|
||||||
const struct lyd_node *path = yang_dnode_get_parent(dnode, "path-list");
|
|
||||||
const struct lyd_node *src = yang_dnode_get_parent(path, "src-list");
|
|
||||||
const struct lyd_node *route = yang_dnode_get_parent(src, "route-list");
|
|
||||||
|
|
||||||
nexthop_cli_show(vty, route, src, path, dnode, show_defaults);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
|
static int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
|
||||||
@ -1658,6 +1587,8 @@ static int static_route_list_cli_cmp(const struct lyd_node *dnode1,
|
|||||||
afi_t afi1, afi2;
|
afi_t afi1, afi2;
|
||||||
safi_t safi1, safi2;
|
safi_t safi1, safi2;
|
||||||
struct prefix prefix1, prefix2;
|
struct prefix prefix1, prefix2;
|
||||||
|
struct prefix src_prefix1, src_prefix2;
|
||||||
|
int rv;
|
||||||
|
|
||||||
afi_safi1 = yang_dnode_get_string(dnode1, "afi-safi");
|
afi_safi1 = yang_dnode_get_string(dnode1, "afi-safi");
|
||||||
yang_afi_safi_identity2value(afi_safi1, &afi1, &safi1);
|
yang_afi_safi_identity2value(afi_safi1, &afi1, &safi1);
|
||||||
@ -1673,19 +1604,13 @@ static int static_route_list_cli_cmp(const struct lyd_node *dnode1,
|
|||||||
|
|
||||||
yang_dnode_get_prefix(&prefix1, dnode1, "prefix");
|
yang_dnode_get_prefix(&prefix1, dnode1, "prefix");
|
||||||
yang_dnode_get_prefix(&prefix2, dnode2, "prefix");
|
yang_dnode_get_prefix(&prefix2, dnode2, "prefix");
|
||||||
|
rv = prefix_cmp(&prefix1, &prefix2);
|
||||||
|
if (rv)
|
||||||
|
return rv;
|
||||||
|
|
||||||
return prefix_cmp(&prefix1, &prefix2);
|
yang_dnode_get_prefix(&src_prefix1, dnode1, "src-prefix");
|
||||||
}
|
yang_dnode_get_prefix(&src_prefix2, dnode2, "src-prefix");
|
||||||
|
return prefix_cmp(&src_prefix1, &src_prefix2);
|
||||||
static int static_src_list_cli_cmp(const struct lyd_node *dnode1,
|
|
||||||
const struct lyd_node *dnode2)
|
|
||||||
{
|
|
||||||
struct prefix prefix1, prefix2;
|
|
||||||
|
|
||||||
yang_dnode_get_prefix(&prefix1, dnode1, "src-prefix");
|
|
||||||
yang_dnode_get_prefix(&prefix2, dnode2, "src-prefix");
|
|
||||||
|
|
||||||
return prefix_cmp(&prefix1, &prefix2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int static_path_list_cli_cmp(const struct lyd_node *dnode1,
|
static int static_path_list_cli_cmp(const struct lyd_node *dnode1,
|
||||||
@ -1830,25 +1755,6 @@ const struct frr_yang_module_info frr_staticd_cli_info = {
|
|||||||
.cli_cmp = static_nexthop_cli_cmp,
|
.cli_cmp = static_nexthop_cli_cmp,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list",
|
|
||||||
.cbs = {
|
|
||||||
.cli_cmp = static_src_list_cli_cmp,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list",
|
|
||||||
.cbs = {
|
|
||||||
.cli_cmp = static_path_list_cli_cmp,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/src-list/path-list/frr-nexthops/nexthop",
|
|
||||||
.cbs = {
|
|
||||||
.cli_show = static_src_nexthop_cli_show,
|
|
||||||
.cli_cmp = static_nexthop_cli_cmp,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/segment-routing",
|
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/segment-routing",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
|
@ -132,35 +132,37 @@ static int static_ifp_down(struct interface *ifp)
|
|||||||
|
|
||||||
static int route_notify_owner(ZAPI_CALLBACK_ARGS)
|
static int route_notify_owner(ZAPI_CALLBACK_ARGS)
|
||||||
{
|
{
|
||||||
struct prefix p;
|
struct prefix p, src_p, *src_pp;
|
||||||
enum zapi_route_notify_owner note;
|
enum zapi_route_notify_owner note;
|
||||||
uint32_t table_id;
|
uint32_t table_id;
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
|
|
||||||
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e, NULL,
|
if (!zapi_route_notify_decode_srcdest(zclient->ibuf, &p, &src_p, &table_id, ¬e, NULL,
|
||||||
&safi))
|
&safi))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
src_pp = src_p.prefixlen ? &src_p : NULL;
|
||||||
|
|
||||||
switch (note) {
|
switch (note) {
|
||||||
case ZAPI_ROUTE_FAIL_INSTALL:
|
case ZAPI_ROUTE_FAIL_INSTALL:
|
||||||
static_nht_mark_state(&p, safi, vrf_id, STATIC_NOT_INSTALLED);
|
static_nht_mark_state(&p, src_pp, safi, vrf_id, STATIC_NOT_INSTALLED);
|
||||||
zlog_warn("%s: Route %pFX failed to install for table: %u",
|
zlog_warn("%s: Route %pFX failed to install for table: %u",
|
||||||
__func__, &p, table_id);
|
__func__, &p, table_id);
|
||||||
break;
|
break;
|
||||||
case ZAPI_ROUTE_BETTER_ADMIN_WON:
|
case ZAPI_ROUTE_BETTER_ADMIN_WON:
|
||||||
static_nht_mark_state(&p, safi, vrf_id, STATIC_NOT_INSTALLED);
|
static_nht_mark_state(&p, src_pp, safi, vrf_id, STATIC_NOT_INSTALLED);
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s: Route %pFX over-ridden by better route for table: %u",
|
"%s: Route %pFX over-ridden by better route for table: %u",
|
||||||
__func__, &p, table_id);
|
__func__, &p, table_id);
|
||||||
break;
|
break;
|
||||||
case ZAPI_ROUTE_INSTALLED:
|
case ZAPI_ROUTE_INSTALLED:
|
||||||
static_nht_mark_state(&p, safi, vrf_id, STATIC_INSTALLED);
|
static_nht_mark_state(&p, src_pp, safi, vrf_id, STATIC_INSTALLED);
|
||||||
break;
|
break;
|
||||||
case ZAPI_ROUTE_REMOVED:
|
case ZAPI_ROUTE_REMOVED:
|
||||||
static_nht_mark_state(&p, safi, vrf_id, STATIC_NOT_INSTALLED);
|
static_nht_mark_state(&p, src_pp, safi, vrf_id, STATIC_NOT_INSTALLED);
|
||||||
break;
|
break;
|
||||||
case ZAPI_ROUTE_REMOVE_FAIL:
|
case ZAPI_ROUTE_REMOVE_FAIL:
|
||||||
static_nht_mark_state(&p, safi, vrf_id, STATIC_INSTALLED);
|
static_nht_mark_state(&p, src_pp, safi, vrf_id, STATIC_INSTALLED);
|
||||||
zlog_warn("%s: Route %pFX failure to remove for table: %u",
|
zlog_warn("%s: Route %pFX failure to remove for table: %u",
|
||||||
__func__, &p, table_id);
|
__func__, &p, table_id);
|
||||||
break;
|
break;
|
||||||
@ -226,8 +228,8 @@ static void static_zebra_nexthop_update(struct vrf *vrf, struct prefix *matched,
|
|||||||
nhtd->nh_num = nhr->nexthop_num;
|
nhtd->nh_num = nhr->nexthop_num;
|
||||||
|
|
||||||
static_nht_reset_start(matched, afi, nhr->safi, nhtd->nh_vrf_id);
|
static_nht_reset_start(matched, afi, nhr->safi, nhtd->nh_vrf_id);
|
||||||
static_nht_update(NULL, matched, nhr->nexthop_num, afi,
|
static_nht_update(NULL, NULL, matched, nhr->nexthop_num, afi, nhr->safi,
|
||||||
nhr->safi, nhtd->nh_vrf_id);
|
nhtd->nh_vrf_id);
|
||||||
} else
|
} else
|
||||||
zlog_err("No nhtd?");
|
zlog_err("No nhtd?");
|
||||||
}
|
}
|
||||||
@ -312,10 +314,13 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg)
|
|||||||
{
|
{
|
||||||
struct static_path *pn = nh->pn;
|
struct static_path *pn = nh->pn;
|
||||||
struct route_node *rn = pn->rn;
|
struct route_node *rn = pn->rn;
|
||||||
|
const struct prefix *p, *src_p;
|
||||||
struct static_route_info *si = static_route_info_from_rnode(rn);
|
struct static_route_info *si = static_route_info_from_rnode(rn);
|
||||||
struct static_nht_data *nhtd, lookup = {};
|
struct static_nht_data *nhtd, lookup = {};
|
||||||
uint32_t cmd;
|
uint32_t cmd;
|
||||||
|
|
||||||
|
srcdest_rnode_prefixes(rn, &p, &src_p);
|
||||||
|
|
||||||
if (!static_zebra_nht_get_prefix(nh, &lookup.nh))
|
if (!static_zebra_nht_get_prefix(nh, &lookup.nh))
|
||||||
return;
|
return;
|
||||||
lookup.nh_vrf_id = nh->nh_vrf_id;
|
lookup.nh_vrf_id = nh->nh_vrf_id;
|
||||||
@ -351,8 +356,8 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg)
|
|||||||
if (nh->state == STATIC_NOT_INSTALLED ||
|
if (nh->state == STATIC_NOT_INSTALLED ||
|
||||||
nh->state == STATIC_SENT_TO_ZEBRA)
|
nh->state == STATIC_SENT_TO_ZEBRA)
|
||||||
nh->state = STATIC_START;
|
nh->state = STATIC_START;
|
||||||
static_nht_update(&rn->p, &nhtd->nh, nhtd->nh_num, afi,
|
static_nht_update(p, src_p, &nhtd->nh, nhtd->nh_num, afi, si->safi,
|
||||||
si->safi, nh->nh_vrf_id);
|
nh->nh_vrf_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ def test_mgmt_commit_check(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.2/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/bh-type unspec",
|
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.2/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/bh-type unspec",
|
||||||
"mgmt commit check",
|
"mgmt commit check",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ def test_mgmt_commit_check(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.2/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/bh-type unspec",
|
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.2/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/bh-type unspec",
|
||||||
"mgmt commit check",
|
"mgmt commit check",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ def test_mgmt_commit_apply(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.20/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/vrf default",
|
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.20/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/vrf default",
|
||||||
"mgmt commit apply",
|
"mgmt commit apply",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ def test_mgmt_commit_apply(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.20/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/vrf default",
|
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.20/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/vrf default",
|
||||||
"mgmt commit apply",
|
"mgmt commit apply",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ def test_mgmt_commit_abort(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.3/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/vrf default",
|
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.1.3/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/vrf default",
|
||||||
"mgmt commit abort",
|
"mgmt commit abort",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -350,7 +350,7 @@ def test_mgmt_delete_config(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.168.1.3/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/vrf default",
|
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.168.1.3/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/vrf default",
|
||||||
"mgmt commit apply",
|
"mgmt commit apply",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ def test_mgmt_delete_config(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt delete-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.168.1.3/32'][afi-safi='frr-routing:ipv4-unicast']",
|
"mgmt delete-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.168.1.3/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']",
|
||||||
"mgmt commit apply",
|
"mgmt commit apply",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -657,7 +657,7 @@ def test_mgmt_chaos_stop_start_frr(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.11.200/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/bh-type unspec",
|
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.11.200/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/bh-type unspec",
|
||||||
"mgmt commit apply",
|
"mgmt commit apply",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -689,7 +689,7 @@ def test_mgmt_chaos_stop_start_frr(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt delete-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.11.200/32'][afi-safi='frr-routing:ipv4-unicast']",
|
"mgmt delete-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.11.200/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']",
|
||||||
"mgmt commit apply",
|
"mgmt commit apply",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -733,7 +733,7 @@ def test_mgmt_chaos_kill_daemon(request):
|
|||||||
raw_config = {
|
raw_config = {
|
||||||
"r1": {
|
"r1": {
|
||||||
"raw_config": [
|
"raw_config": [
|
||||||
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.11.200/32'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/bh-type unspec",
|
"mgmt set-config /frr-routing:routing/control-plane-protocols/control-plane-protocol[type='frr-staticd:staticd'][name='staticd'][vrf='default']/frr-staticd:staticd/route-list[prefix='192.1.11.200/32'][src-prefix='::/0'][afi-safi='frr-routing:ipv4-unicast']/path-list[table-id='0'][distance='1']/frr-nexthops/nexthop[nh-type='blackhole'][vrf='default'][gateway=''][interface='(null)']/bh-type unspec",
|
||||||
"mgmt commit apply",
|
"mgmt commit apply",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,15 @@ def get_ip_networks(super_prefix, count):
|
|||||||
return tuple(network.subnets(count_log2))[0:count]
|
return tuple(network.subnets(count_log2))[0:count]
|
||||||
|
|
||||||
|
|
||||||
|
def get_src_networks(src_prefix, count, default=""):
|
||||||
|
if src_prefix is not None:
|
||||||
|
for net in get_ip_networks(src_prefix, count):
|
||||||
|
yield " from {}".format(net)
|
||||||
|
else:
|
||||||
|
for i in range(0, count):
|
||||||
|
yield default
|
||||||
|
|
||||||
|
|
||||||
def enable_debug(router):
|
def enable_debug(router):
|
||||||
router.vtysh_cmd("debug northbound callbacks configuration")
|
router.vtysh_cmd("debug northbound callbacks configuration")
|
||||||
|
|
||||||
@ -70,7 +79,7 @@ def disable_debug(router):
|
|||||||
|
|
||||||
|
|
||||||
@retry(retry_timeout=30, initial_wait=0.1)
|
@retry(retry_timeout=30, initial_wait=0.1)
|
||||||
def check_kernel(r1, super_prefix, count, add, is_blackhole, vrf, matchvia):
|
def check_kernel(r1, super_prefix, src_prefix, count, add, is_blackhole, vrf, matchvia):
|
||||||
network = ipaddress.ip_network(super_prefix)
|
network = ipaddress.ip_network(super_prefix)
|
||||||
vrfstr = f" vrf {vrf}" if vrf else ""
|
vrfstr = f" vrf {vrf}" if vrf else ""
|
||||||
if network.version == 6:
|
if network.version == 6:
|
||||||
@ -79,26 +88,30 @@ def check_kernel(r1, super_prefix, count, add, is_blackhole, vrf, matchvia):
|
|||||||
kernel = r1.run(f"ip -4 route show{vrfstr}")
|
kernel = r1.run(f"ip -4 route show{vrfstr}")
|
||||||
|
|
||||||
logger.debug("checking kernel routing table%s:\n%s", vrfstr, kernel)
|
logger.debug("checking kernel routing table%s:\n%s", vrfstr, kernel)
|
||||||
for _, net in enumerate(get_ip_networks(super_prefix, count)):
|
for net, srcnet in zip(
|
||||||
|
get_ip_networks(super_prefix, count), get_src_networks(src_prefix, count)
|
||||||
|
):
|
||||||
|
netfull = str(net) + srcnet
|
||||||
if not add:
|
if not add:
|
||||||
assert str(net) not in kernel
|
assert netfull + " nhid" not in kernel
|
||||||
|
assert netfull + " via" not in kernel
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if is_blackhole:
|
if is_blackhole:
|
||||||
route = f"blackhole {str(net)} proto (static|196) metric 20"
|
route = f"blackhole {netfull}(?: dev lo)? proto (static|196) metric 20"
|
||||||
else:
|
else:
|
||||||
route = (
|
route = (
|
||||||
f"{str(net)}(?: nhid [0-9]+)? {matchvia} "
|
f"{netfull}(?: nhid [0-9]+)? {matchvia} proto (static|196) metric 20"
|
||||||
"proto (static|196) metric 20"
|
|
||||||
)
|
)
|
||||||
assert re.search(route, kernel), f"Failed to find \n'{route}'\n in \n'{kernel}'"
|
assert re.search(route, kernel), f"Failed to find \n'{route}'\n in \n'{kernel}'"
|
||||||
|
|
||||||
|
|
||||||
def do_config(
|
def do_config_inner(
|
||||||
r1,
|
r1,
|
||||||
count,
|
count,
|
||||||
add=True,
|
add=True,
|
||||||
do_ipv6=False,
|
do_ipv6=False,
|
||||||
|
do_sadr=False,
|
||||||
via=None,
|
via=None,
|
||||||
vrf=None,
|
vrf=None,
|
||||||
use_cli=False,
|
use_cli=False,
|
||||||
@ -109,11 +122,18 @@ def do_config(
|
|||||||
#
|
#
|
||||||
# Set the route details
|
# Set the route details
|
||||||
#
|
#
|
||||||
|
src_prefs = [None, None]
|
||||||
if vrf:
|
if do_ipv6 and do_sadr:
|
||||||
super_prefix = "2002::/48" if do_ipv6 else "20.0.0.0/8"
|
# intentionally using overlapping prefix
|
||||||
|
super_prefs = ["2001::/48", "2002::/48"]
|
||||||
|
src_prefs = ["2001:db8:1111::/48", "2001:db8:2222::/48"]
|
||||||
|
elif do_ipv6:
|
||||||
|
super_prefs = ["2001::/48", "2002::/48"]
|
||||||
else:
|
else:
|
||||||
super_prefix = "2001::/48" if do_ipv6 else "10.0.0.0/8"
|
super_prefs = ["10.0.0.0/8", "20.0.0.0/8"]
|
||||||
|
|
||||||
|
super_prefix = super_prefs[1 if vrf else 0]
|
||||||
|
src_prefix = src_prefs[1 if vrf else 0]
|
||||||
|
|
||||||
matchvia = ""
|
matchvia = ""
|
||||||
if via == "blackhole":
|
if via == "blackhole":
|
||||||
@ -144,11 +164,13 @@ def do_config(
|
|||||||
if vrf:
|
if vrf:
|
||||||
f.write("vrf {}\n".format(vrf))
|
f.write("vrf {}\n".format(vrf))
|
||||||
|
|
||||||
for _, net in enumerate(get_ip_networks(super_prefix, count)):
|
for net, srcnet in zip(
|
||||||
|
get_ip_networks(super_prefix, count), get_src_networks(src_prefix, count)
|
||||||
|
):
|
||||||
if add:
|
if add:
|
||||||
f.write("ip route {} {}\n".format(net, via))
|
f.write("ip route {}{} {}\n".format(net, srcnet, via))
|
||||||
else:
|
else:
|
||||||
f.write("no ip route {} {}\n".format(net, via))
|
f.write("no ip route {}{} {}\n".format(net, srcnet, via))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Load config file.
|
# Load config file.
|
||||||
@ -165,7 +187,9 @@ def do_config(
|
|||||||
#
|
#
|
||||||
# Verify the results are in the kernel
|
# Verify the results are in the kernel
|
||||||
#
|
#
|
||||||
check_kernel(r1, super_prefix, count, add, via == "blackhole", vrf, matchvia)
|
check_kernel(
|
||||||
|
r1, super_prefix, src_prefix, count, add, via == "blackhole", vrf, matchvia
|
||||||
|
)
|
||||||
|
|
||||||
optyped = "added" if add else "removed"
|
optyped = "added" if add else "removed"
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@ -175,6 +199,12 @@ def do_config(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def do_config(*args, **kwargs):
|
||||||
|
do_config_inner(*args, do_ipv6=False, do_sadr=False, **kwargs)
|
||||||
|
do_config_inner(*args, do_ipv6=True, do_sadr=False, **kwargs)
|
||||||
|
do_config_inner(*args, do_ipv6=True, do_sadr=True, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def guts(tgen, vrf, use_cli):
|
def guts(tgen, vrf, use_cli):
|
||||||
if tgen.routers_have_failure():
|
if tgen.routers_have_failure():
|
||||||
pytest.skip(tgen.errors)
|
pytest.skip(tgen.errors)
|
||||||
@ -183,20 +213,20 @@ def guts(tgen, vrf, use_cli):
|
|||||||
|
|
||||||
count = 10
|
count = 10
|
||||||
step(f"add {count} via gateway", reset=True)
|
step(f"add {count} via gateway", reset=True)
|
||||||
do_config(r1, count, True, False, vrf=vrf, use_cli=use_cli)
|
do_config(r1, count, True, vrf=vrf, use_cli=use_cli)
|
||||||
step(f"remove {count} via gateway")
|
step(f"remove {count} via gateway")
|
||||||
do_config(r1, count, False, False, vrf=vrf, use_cli=use_cli)
|
do_config(r1, count, False, vrf=vrf, use_cli=use_cli)
|
||||||
|
|
||||||
via = f"lo-{vrf}" if vrf else "lo"
|
via = f"lo-{vrf}" if vrf else "lo"
|
||||||
step("add via loopback")
|
step("add via loopback")
|
||||||
do_config(r1, 1, True, False, via=via, vrf=vrf, use_cli=use_cli)
|
do_config(r1, 1, True, via=via, vrf=vrf, use_cli=use_cli)
|
||||||
step("remove via loopback")
|
step("remove via loopback")
|
||||||
do_config(r1, 1, False, False, via=via, vrf=vrf, use_cli=use_cli)
|
do_config(r1, 1, False, via=via, vrf=vrf, use_cli=use_cli)
|
||||||
|
|
||||||
step("add via blackhole")
|
step("add via blackhole")
|
||||||
do_config(r1, 1, True, False, via="blackhole", vrf=vrf, use_cli=use_cli)
|
do_config(r1, 1, True, via="blackhole", vrf=vrf, use_cli=use_cli)
|
||||||
step("remove via blackhole")
|
step("remove via blackhole")
|
||||||
do_config(r1, 1, False, False, via="blackhole", vrf=vrf, use_cli=use_cli)
|
do_config(r1, 1, False, via="blackhole", vrf=vrf, use_cli=use_cli)
|
||||||
|
|
||||||
|
|
||||||
def test_static_cli(tgen):
|
def test_static_cli(tgen):
|
||||||
|
@ -165,7 +165,7 @@ module frr-staticd {
|
|||||||
"Support for a 'staticd' pseudo-protocol instance
|
"Support for a 'staticd' pseudo-protocol instance
|
||||||
consists of a list of routes.";
|
consists of a list of routes.";
|
||||||
list route-list {
|
list route-list {
|
||||||
key "prefix afi-safi";
|
key "prefix src-prefix afi-safi";
|
||||||
description
|
description
|
||||||
"List of staticd IP routes.";
|
"List of staticd IP routes.";
|
||||||
leaf prefix {
|
leaf prefix {
|
||||||
@ -173,6 +173,11 @@ module frr-staticd {
|
|||||||
description
|
description
|
||||||
"IP prefix.";
|
"IP prefix.";
|
||||||
}
|
}
|
||||||
|
leaf src-prefix {
|
||||||
|
type inet:ipv6-prefix;
|
||||||
|
description
|
||||||
|
"IPv6 source prefix for dst-src routes";
|
||||||
|
}
|
||||||
leaf afi-safi {
|
leaf afi-safi {
|
||||||
type identityref {
|
type identityref {
|
||||||
base frr-rt:afi-safi-type;
|
base frr-rt:afi-safi-type;
|
||||||
@ -180,6 +185,12 @@ module frr-staticd {
|
|||||||
description
|
description
|
||||||
"AFI-SAFI type.";
|
"AFI-SAFI type.";
|
||||||
}
|
}
|
||||||
|
/* note dst-src routes are semantically invalid in MRIB */
|
||||||
|
must "afi-safi = 'frr-rt:ipv6-unicast'
|
||||||
|
or afi-safi = 'frr-rt:ipv6-labeled-unicast'
|
||||||
|
or afi-safi = 'frr-rt:l3vpn-ipv6-unicast'
|
||||||
|
or src-prefix = '::/0'
|
||||||
|
";
|
||||||
|
|
||||||
uses staticd-prefix-attributes {
|
uses staticd-prefix-attributes {
|
||||||
augment "path-list/frr-nexthops/nexthop" {
|
augment "path-list/frr-nexthops/nexthop" {
|
||||||
@ -194,17 +205,6 @@ module frr-staticd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list src-list {
|
|
||||||
key "src-prefix";
|
|
||||||
leaf src-prefix {
|
|
||||||
type inet:ipv6-prefix;
|
|
||||||
description
|
|
||||||
"IPv6 source prefix";
|
|
||||||
}
|
|
||||||
|
|
||||||
uses staticd-prefix-attributes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
container segment-routing {
|
container segment-routing {
|
||||||
|
@ -2588,10 +2588,10 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, struct zebra_dplane_ctx *ctx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!fpm && kernel_nexthops_supported()
|
if ((!fpm && kernel_nexthops_supported() &&
|
||||||
&& (!proto_nexthops_only()
|
(!proto_nexthops_only() || is_proto_nhg(dplane_ctx_get_nhe_id(ctx), 0)) &&
|
||||||
|| is_proto_nhg(dplane_ctx_get_nhe_id(ctx), 0)))
|
(!src_p || !src_p->prefixlen)) ||
|
||||||
|| (fpm && force_nhg)) {
|
(fpm && force_nhg)) {
|
||||||
/* Kernel supports nexthop objects */
|
/* Kernel supports nexthop objects */
|
||||||
if (IS_ZEBRA_DEBUG_KERNEL)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
zlog_debug("%s: %pFX nhg_id is %u", __func__, p,
|
zlog_debug("%s: %pFX nhg_id is %u", __func__, p,
|
||||||
|
@ -740,6 +740,10 @@ static int route_notify_internal(const struct route_node *rn, int type,
|
|||||||
struct zserv *client;
|
struct zserv *client;
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
uint8_t blen;
|
uint8_t blen;
|
||||||
|
const struct prefix *p, *src_p;
|
||||||
|
struct prefix src_dummy = {};
|
||||||
|
|
||||||
|
srcdest_rnode_prefixes(rn, &p, &src_p);
|
||||||
|
|
||||||
client = zserv_find_client(type, instance);
|
client = zserv_find_client(type, instance);
|
||||||
if (!client || !client->notify_owner) {
|
if (!client || !client->notify_owner) {
|
||||||
@ -771,9 +775,17 @@ static int route_notify_internal(const struct route_node *rn, int type,
|
|||||||
|
|
||||||
stream_putc(s, rn->p.family);
|
stream_putc(s, rn->p.family);
|
||||||
|
|
||||||
blen = prefix_blen(&rn->p);
|
blen = prefix_blen(p);
|
||||||
stream_putc(s, rn->p.prefixlen);
|
stream_putc(s, p->prefixlen);
|
||||||
stream_put(s, &rn->p.u.prefix, blen);
|
stream_put(s, &p->u.prefix, blen);
|
||||||
|
|
||||||
|
if (!src_p) {
|
||||||
|
src_dummy.family = p->family;
|
||||||
|
src_p = &src_dummy;
|
||||||
|
}
|
||||||
|
blen = prefix_blen(src_p);
|
||||||
|
stream_putc(s, src_p->prefixlen);
|
||||||
|
stream_put(s, &src_p->u.prefix, blen);
|
||||||
|
|
||||||
stream_putl(s, table_id);
|
stream_putl(s, table_id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user