The staticd YANG conversion completely f*cked up dst-src routes.
Stupidly enough, the correct thing is much simpler as seen by the amount
of deletes in this commit.
This does, unfortunately, involve a rather annoying YANG edge case with
what should reasonably be an optional leaf as part of a list key, which
is not possible. It uses `::/0` as unconditional filler instead, since
that is semantically correct.
The `test_yang_mgmt` topotest needed to be adjusted after this to add
`src-prefix='::/0'`.
Fixes: 88fa5104a04a ("staticd : Configuration northbound implementation")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
cbuf, sizeof(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;
-}
return route_table_get_info(srcdest_rnode_table(rn));
}
-extern struct route_table *srcdest_srcnode_table(struct route_node *rn);
-
#ifdef __cplusplus
}
#endif
.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",
.cbs = {
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_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(
struct nb_cb_create_args *args);
int routing_control_plane_protocols_control_plane_protocol_staticd_segment_routing_destroy(
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);
-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(
struct nb_cb_apply_finish_args *args);
/* xpath macros */
/* route-list */
-#define FRR_STATIC_ROUTE_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']/" \
+#define FRR_STATIC_ROUTE_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'][src-prefix='%s'][afi-safi='%s']/" \
"path-list[table-id='%u'][distance='%u']"
-#define FRR_STATIC_ROUTE_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']/" \
+#define FRR_STATIC_ROUTE_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'][src-prefix='%s'][afi-safi='%s']/" \
"path-list[table-id='%u']"
#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 */
#define FRR_DEL_S_ROUTE_NH_KEY_XPATH \
FRR_STATIC_ROUTE_INFO_KEY_XPATH \
FRR_STATIC_ROUTE_INFO_KEY_NO_DISTANCE_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 */
#define FRR_STATIC_SRV6_INFO_KEY_XPATH \
"/frr-routing:routing/control-plane-protocols/" \
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(
struct nb_cb_pre_validate_args *args)
{
if (!stable)
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);
}
struct static_vrf *svrf;
struct route_node *rn;
const struct lyd_node *vrf_dnode;
- struct prefix prefix;
+ struct prefix prefix, src_prefix, *src_p;
const char *afi_safi;
afi_t prefix_afi;
afi_t afi;
switch (args->event) {
case NB_EV_VALIDATE:
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");
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
prefix_afi = family2afi(prefix.family);
yang_dnode_get_string(args->dnode, "prefix"));
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;
case NB_EV_PREPARE:
case NB_EV_ABORT:
svrf = nb_running_get_entry(vrf_dnode, NULL, true);
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");
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)
snprintf(
args->errmsg, args->errmsg_len,
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:
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/segment-routing
struct static_nexthop *nh;
struct static_path *pn;
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;
static_path_list_del(&si->path_list, 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);
}
}
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)
{
struct static_path *pn;
struct static_route_info *si;
- struct route_table *src_table;
- struct route_node *src_node;
si = rn->info;
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);
route_unlock_node(rn);
}
struct static_path *pn;
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);
if (!si)
continue;
struct static_path *pn;
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);
if (!si)
continue;
struct static_path *pn;
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);
if (!si)
continue;
struct static_path *pn;
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);
if (!si)
continue;
for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) {
- if (afi == AFI_IP6)
- table = srcdest_table_init();
- else
- table = route_table_init();
+ table = srcdest_table_init();
+ table->cleanup = zebra_stable_node_cleanup;
info = XCALLOC(MTYPE_STATIC_RTABLE_INFO,
sizeof(struct stable_info));
info->safi = safi;
route_table_set_info(table, info);
- table->cleanup = zebra_stable_node_cleanup;
svrf->stable[afi][safi] = table;
}
}
char xpath_seg[XPATH_MAXLEN];
char ab_xpath[XPATH_MAXLEN];
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_tag[PREFIX_STRLEN];
uint8_t label_stack_id = 0;
}
assert(!!str2prefix(args->prefix, &p));
+ src = (struct prefix){ .family = p.family, .prefixlen = 0 };
switch (args->afi) {
case AFI_IP:
return CMD_WARNING_CONFIG_FAILED;
}
- if (args->source)
+ if (src.prefixlen)
prefix2str(&src, buf_src_prefix, sizeof(buf_src_prefix));
if (args->gateway)
buf_gate_str = args->gateway;
static_get_nh_type(type, buf_nh_type, sizeof(buf_nh_type));
if (!args->delete) {
- if (args->source)
- 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
- 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);
+ snprintf(ab_xpath, sizeof(ab_xpath), FRR_DEL_S_ROUTE_NH_KEY_NO_DISTANCE_XPATH,
+ "frr-staticd:staticd", "staticd", args->vrf, buf_prefix, buf_src_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
}
/* route + path procesing */
- if (args->source)
- snprintf(xpath_prefix, sizeof(xpath_prefix),
- FRR_S_ROUTE_SRC_INFO_KEY_XPATH,
- "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);
+ snprintf(xpath_prefix, sizeof(xpath_prefix), FRR_STATIC_ROUTE_INFO_KEY_XPATH,
+ "frr-staticd:staticd", "staticd", args->vrf, buf_prefix, buf_src_prefix,
+ yang_afi_safi_value2identity(args->afi, args->safi), table_id, distance);
nb_cli_enqueue_change(vty, xpath_prefix, NB_OP_CREATE, NULL);
if (orig_seg)
XFREE(MTYPE_TMP, orig_seg);
} else {
- if (args->source) {
- if (args->distance)
- snprintf(ab_xpath, sizeof(ab_xpath),
- FRR_DEL_S_ROUTE_SRC_NH_KEY_XPATH,
- "frr-staticd:staticd", "staticd",
- args->vrf, buf_prefix,
- yang_afi_safi_value2identity(
- args->afi, args->safi),
- buf_src_prefix, 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_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);
- }
+ if (args->distance)
+ snprintf(ab_xpath, sizeof(ab_xpath), FRR_DEL_S_ROUTE_NH_KEY_XPATH,
+ "frr-staticd:staticd", "staticd", args->vrf, buf_prefix,
+ buf_src_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, buf_src_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);
if (!dnode) {
}
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, bool show_defaults)
+ const struct lyd_node *path, const struct lyd_node *nexthop,
+ bool show_defaults)
{
const char *vrf;
const char *afi_safi;
struct srv6_seg_iter seg_iter;
const char *nexthop_vrf;
uint32_t table_id;
+ struct prefix src_prefix;
bool onlink;
vrf = yang_dnode_get_string(route, "../../vrf");
vty_out(vty, " %s", yang_dnode_get_string(route, "prefix"));
- if (src)
- vty_out(vty, " from %s",
- yang_dnode_get_string(src, "src-prefix"));
+ yang_dnode_get_prefix(&src_prefix, route, "src-prefix");
+ if (src_prefix.prefixlen)
+ vty_out(vty, " from %pFX", &src_prefix);
nh_type = yang_dnode_get_enum(nexthop, "nh-type");
switch (nh_type) {
const struct lyd_node *route =
yang_dnode_get_parent(path, "route-list");
- nexthop_cli_show(vty, route, NULL, 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);
+ nexthop_cli_show(vty, route, path, dnode, show_defaults);
}
static int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
afi_t afi1, afi2;
safi_t safi1, safi2;
struct prefix prefix1, prefix2;
+ struct prefix src_prefix1, src_prefix2;
+ int rv;
afi_safi1 = yang_dnode_get_string(dnode1, "afi-safi");
yang_afi_safi_identity2value(afi_safi1, &afi1, &safi1);
yang_dnode_get_prefix(&prefix1, dnode1, "prefix");
yang_dnode_get_prefix(&prefix2, dnode2, "prefix");
+ rv = prefix_cmp(&prefix1, &prefix2);
+ if (rv)
+ return rv;
- return prefix_cmp(&prefix1, &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);
+ 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_path_list_cli_cmp(const struct lyd_node *dnode1,
.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",
.cbs = {
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
raw_config = {
"r1": {
"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",
]
}
"Support for a 'staticd' pseudo-protocol instance
consists of a list of routes.";
list route-list {
- key "prefix afi-safi";
+ key "prefix src-prefix afi-safi";
description
"List of staticd IP routes.";
leaf prefix {
description
"IP prefix.";
}
+ leaf src-prefix {
+ type inet:ipv6-prefix;
+ description
+ "IPv6 source prefix for dst-src routes";
+ }
leaf afi-safi {
type identityref {
base frr-rt:afi-safi-type;
description
"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 {
augment "path-list/frr-nexthops/nexthop" {
}
}
}
-
- list src-list {
- key "src-prefix";
- leaf src-prefix {
- type inet:ipv6-prefix;
- description
- "IPv6 source prefix";
- }
-
- uses staticd-prefix-attributes;
- }
}
container segment-routing {