mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 00:56:19 +00:00
staticd: Added afi-safi as a key in route-list
To address the ip mroute command there is a need to add safi as a key. So adding the afi-safi-type identityref as a key. Signed-off-by: VishalDhingra <vdhingra@vmware.com>
This commit is contained in:
parent
755100ac89
commit
314825ff91
@ -125,7 +125,7 @@ int routing_control_plane_protocols_name_validate(
|
||||
#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']" \
|
||||
"frr-staticd:staticd/route-list[prefix='%s'][afi-safi='%s']/" \
|
||||
"path-list[distance='%u']"
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ int routing_control_plane_protocols_name_validate(
|
||||
#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']" \
|
||||
"frr-staticd:staticd/route-list[prefix='%s'][afi-safi='%s']/" \
|
||||
"src-list[src-prefix='%s']/path-list[distance='%u']"
|
||||
|
||||
/* route-list/frr-nexthops */
|
||||
|
@ -421,11 +421,25 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
|
||||
struct route_node *rn;
|
||||
const struct lyd_node *vrf_dnode;
|
||||
struct prefix prefix;
|
||||
const char *afi_safi;
|
||||
afi_t prefix_afi;
|
||||
afi_t afi;
|
||||
safi_t safi = SAFI_UNICAST;
|
||||
safi_t safi;
|
||||
|
||||
switch (args->event) {
|
||||
case NB_EV_VALIDATE:
|
||||
yang_dnode_get_prefix(&prefix, args->dnode, "./prefix");
|
||||
afi_safi = yang_dnode_get_string(args->dnode, "./afi-safi");
|
||||
yang_afi_safi_identity2value(afi_safi, &afi, &safi);
|
||||
prefix_afi = family2afi(prefix.family);
|
||||
if (afi != prefix_afi) {
|
||||
flog_warn(
|
||||
EC_LIB_NB_CB_CONFIG_VALIDATE,
|
||||
"route node %s creation failed",
|
||||
yang_dnode_get_string(args->dnode, "./prefix"));
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
break;
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
break;
|
||||
@ -436,15 +450,8 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
|
||||
s_vrf = vrf->info;
|
||||
|
||||
yang_dnode_get_prefix(&prefix, args->dnode, "./prefix");
|
||||
afi = family2afi(prefix.family);
|
||||
|
||||
if (afi == AFI_IP) {
|
||||
if (IN_MULTICAST(ntohl(prefix.u.prefix4.s_addr)))
|
||||
safi = SAFI_MULTICAST;
|
||||
} else {
|
||||
if (IN6_IS_ADDR_MULTICAST(&prefix.u.prefix6))
|
||||
safi = SAFI_MULTICAST;
|
||||
}
|
||||
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, s_vrf);
|
||||
if (!rn) {
|
||||
|
@ -174,12 +174,14 @@ static int static_route_leak(struct vty *vty, const char *svrf,
|
||||
FRR_S_ROUTE_SRC_INFO_KEY_XPATH,
|
||||
"frr-staticd:staticd", "staticd", svrf,
|
||||
buf_prefix,
|
||||
yang_afi_safi_value2identity(afi, safi),
|
||||
buf_src_prefix, distance);
|
||||
else
|
||||
snprintf(xpath_prefix, sizeof(xpath_prefix),
|
||||
FRR_STATIC_ROUTE_INFO_KEY_XPATH,
|
||||
"frr-staticd:staticd", "staticd", svrf,
|
||||
buf_prefix,
|
||||
yang_afi_safi_value2identity(afi, safi),
|
||||
distance);
|
||||
|
||||
nb_cli_enqueue_change(vty, xpath_prefix, NB_OP_CREATE, NULL);
|
||||
@ -288,6 +290,7 @@ static int static_route_leak(struct vty *vty, const char *svrf,
|
||||
FRR_DEL_S_ROUTE_SRC_NH_KEY_XPATH,
|
||||
"frr-staticd:staticd", "staticd", svrf,
|
||||
buf_prefix,
|
||||
yang_afi_safi_value2identity(afi, safi),
|
||||
buf_src_prefix, distance, buf_nh_type, nh_svrf,
|
||||
buf_gate_str, ifname);
|
||||
else
|
||||
@ -295,6 +298,7 @@ static int static_route_leak(struct vty *vty, const char *svrf,
|
||||
FRR_DEL_S_ROUTE_NH_KEY_XPATH,
|
||||
"frr-staticd:staticd", "staticd", svrf,
|
||||
buf_prefix,
|
||||
yang_afi_safi_value2identity(afi, safi),
|
||||
distance, buf_nh_type, nh_svrf, buf_gate_str,
|
||||
ifname);
|
||||
|
||||
|
@ -99,7 +99,7 @@ module frr-staticd {
|
||||
"Support for a 'staticd' pseudo-protocol instance
|
||||
consists of a list of routes.";
|
||||
list route-list {
|
||||
key "prefix";
|
||||
key "prefix afi-safi";
|
||||
description
|
||||
"List of staticd IP routes.";
|
||||
leaf prefix {
|
||||
@ -107,6 +107,13 @@ module frr-staticd {
|
||||
description
|
||||
"IP prefix.";
|
||||
}
|
||||
leaf afi-safi {
|
||||
type identityref {
|
||||
base frr-rt:afi-safi-type;
|
||||
}
|
||||
description
|
||||
"AFI-SAFI type.";
|
||||
}
|
||||
|
||||
uses staticd-prefix-attributes;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user