yang_dnode_get_string(args->dnode,
"./gateway"));
nh = static_add_nexthop(rn, pn, info->safi, info->svrf, nh_type,
- &ipaddr, ifname, nh_vrf);
+ &ipaddr, ifname, nh_vrf, 0);
if (!nh) {
char buf[SRCDEST2STR_BUFFER];
return NB_OK;
}
+static int static_nexthop_color_modify(struct nb_cb_modify_args *args)
+{
+ struct static_nexthop *nh;
+
+ nh = nb_running_get_entry(args->dnode, NULL, true);
+ nh->color = yang_dnode_get_uint32(args->dnode, NULL);
+
+ return NB_OK;
+}
+
+static int static_nexthop_color_destroy(struct nb_cb_destroy_args *args)
+{
+ struct static_nexthop *nh;
+
+ nh = nb_running_unset_entry(args->dnode);
+ nh->color = 0;
+
+ return NB_OK;
+}
+
static int static_nexthop_bh_type_modify(struct nb_cb_modify_args *args)
{
struct static_nexthop *nh;
}
return NB_OK;
}
+
+/*
+ * XPath:
+ * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-staticd:staticd/route-list/path-list/frr-nexthops/nexthop/srte-color
+ */
+int routing_control_plane_protocols_control_plane_protocol_staticd_route_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_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/path-list/frr-nexthops/nexthop/mpls-label-stack/entry
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/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/mpls-label-stack/entry
const char *gate_str, const char *ifname,
const char *flag_str, const char *tag_str,
const char *distance_str, const char *label_str,
- const char *table_str, bool onlink)
+ const char *table_str, bool onlink,
+ const char *color_str)
{
int ret;
struct prefix p, src;
nb_cli_enqueue_change(vty, ab_xpath,
NB_OP_MODIFY, "false");
}
+ if (type == STATIC_IPV4_GATEWAY
+ || type == STATIC_IPV6_GATEWAY
+ || type == STATIC_IPV4_GATEWAY_IFNAME
+ || type == STATIC_IPV6_GATEWAY_IFNAME) {
+ strlcpy(ab_xpath, xpath_nexthop, sizeof(ab_xpath));
+ strlcat(ab_xpath, FRR_STATIC_ROUTE_NH_COLOR_XPATH,
+ sizeof(ab_xpath));
+ nb_cli_enqueue_change(vty, ab_xpath, NB_OP_MODIFY,
+ color_str);
+ }
if (label_str) {
/* copy of label string (start) */
char *ostr;
return static_route_leak(vty, vrf_name, vrf_name, afi, safi, negate,
dest_str, mask_str, src_str, gate_str, ifname,
flag_str, tag_str, distance_str, label_str,
- table_str, false);
+ table_str, false, NULL);
}
/* Write static route configuration. */
if (nh->onlink)
vty_out(vty, " onlink");
+ /*
+ * SR-TE color
+ */
+ if (nh->color != 0)
+ vty_out(vty, " color %u", nh->color);
+
vty_out(vty, "\n");
write = 1;
return static_route_leak(vty, vrfname, vrfname, AFI_IP, SAFI_UNICAST,
no, prefix, mask_str, NULL, NULL, NULL, flag,
tag_str, distance_str, label, table_str,
- false);
+ false, NULL);
}
DEFPY_YANG(ip_route_address_interface,
|table (1-4294967295) \
|nexthop-vrf NAME \
|onlink$onlink \
+ |color (1-4294967295) \
}]",
NO_STR IP_STR
"Establish static routes\n"
"Table to configure\n"
"The table number to configure\n"
VRF_CMD_HELP_STR
- "Treat the nexthop as directly attached to the interface\n")
+ "Treat the nexthop as directly attached to the interface\n"
+ "SR-TE color\n"
+ "The SR-TE color to configure\n")
{
const char *nh_vrf;
const char *flag = NULL;
return static_route_leak(vty, vrf, nh_vrf, AFI_IP, SAFI_UNICAST, no,
prefix, mask_str, NULL, gate_str, ifname, flag,
tag_str, distance_str, label, table_str,
- !!onlink);
+ !!onlink, color_str);
}
DEFPY_YANG(ip_route_address_interface_vrf,
|table (1-4294967295) \
|nexthop-vrf NAME \
|onlink$onlink \
- }]",
+ |color (1-4294967295) \
+ }]",
NO_STR IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"Table to configure\n"
"The table number to configure\n"
VRF_CMD_HELP_STR
- "Treat the nexthop as directly attached to the interface\n")
+ "Treat the nexthop as directly attached to the interface\n"
+ "SR-TE color\n"
+ "The SR-TE color to configure\n")
{
const char *nh_vrf;
const char *flag = NULL;
return static_route_leak(vty, vrfname, nh_vrf, AFI_IP, SAFI_UNICAST, no,
prefix, mask_str, NULL, gate_str, ifname, flag,
tag_str, distance_str, label, table_str,
- !!onlink);
+ !!onlink, color_str);
}
DEFPY_YANG(ip_route,
|label WORD \
|table (1-4294967295) \
|nexthop-vrf NAME \
+ |color (1-4294967295) \
}]",
NO_STR IP_STR
"Establish static routes\n"
MPLS_LABEL_HELPSTR
"Table to configure\n"
"The table number to configure\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "SR-TE color\n"
+ "The SR-TE color to configure\n")
{
const char *nh_vrf;
const char *flag = NULL;
return static_route_leak(vty, vrf, nh_vrf, AFI_IP, SAFI_UNICAST, no,
prefix, mask_str, NULL, gate_str, ifname, flag,
tag_str, distance_str, label, table_str,
- false);
+ false, color_str);
}
DEFPY_YANG(ip_route_vrf,
|label WORD \
|table (1-4294967295) \
|nexthop-vrf NAME \
+ |color (1-4294967295) \
}]",
NO_STR IP_STR
"Establish static routes\n"
MPLS_LABEL_HELPSTR
"Table to configure\n"
"The table number to configure\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "SR-TE color\n"
+ "The SR-TE color to configure\n")
{
const char *nh_vrf;
const char *flag = NULL;
return static_route_leak(vty, vrfname, nh_vrf, AFI_IP, SAFI_UNICAST, no,
prefix, mask_str, NULL, gate_str, ifname, flag,
tag_str, distance_str, label, table_str,
- false);
+ false, color_str);
}
DEFPY_YANG(ipv6_route_blackhole,
return static_route_leak(vty, vrfname, vrfname, AFI_IP6, SAFI_UNICAST,
no, prefix_str, NULL, from_str, NULL, NULL,
flag, tag_str, distance_str, label, table_str,
- false);
+ false, NULL);
}
DEFPY_YANG(ipv6_route_address_interface,
|table (1-4294967295) \
|nexthop-vrf NAME \
|onlink$onlink \
+ |color (1-4294967295) \
}]",
NO_STR
IPV6_STR
"Table to configure\n"
"The table number to configure\n"
VRF_CMD_HELP_STR
- "Treat the nexthop as directly attached to the interface\n")
+ "Treat the nexthop as directly attached to the interface\n"
+ "SR-TE color\n"
+ "The SR-TE color to configure\n")
{
const char *nh_vrf;
const char *flag = NULL;
return static_route_leak(vty, vrf, nh_vrf, AFI_IP6, SAFI_UNICAST, no,
prefix_str, NULL, from_str, gate_str, ifname,
flag, tag_str, distance_str, label, table_str,
- !!onlink);
+ !!onlink, color_str);
}
DEFPY_YANG(ipv6_route_address_interface_vrf,
|table (1-4294967295) \
|nexthop-vrf NAME \
|onlink$onlink \
+ |color (1-4294967295) \
}]",
NO_STR
IPV6_STR
"Table to configure\n"
"The table number to configure\n"
VRF_CMD_HELP_STR
- "Treat the nexthop as directly attached to the interface\n")
+ "Treat the nexthop as directly attached to the interface\n"
+ "SR-TE color\n"
+ "The SR-TE color to configure\n")
{
const char *nh_vrf;
const char *flag = NULL;
return static_route_leak(vty, vrfname, nh_vrf, AFI_IP6, SAFI_UNICAST,
no, prefix_str, NULL, from_str, gate_str,
ifname, flag, tag_str, distance_str, label,
- table_str, !!onlink);
+ table_str, !!onlink, color_str);
}
DEFPY_YANG(ipv6_route,
|label WORD \
|table (1-4294967295) \
|nexthop-vrf NAME \
+ |color (1-4294967295) \
}]",
NO_STR
IPV6_STR
MPLS_LABEL_HELPSTR
"Table to configure\n"
"The table number to configure\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "SR-TE color\n"
+ "The SR-TE color to configure\n")
{
const char *nh_vrf;
const char *flag = NULL;
return static_route_leak(vty, vrf, nh_vrf, AFI_IP6, SAFI_UNICAST, no,
prefix_str, NULL, from_str, gate_str, ifname,
flag, tag_str, distance_str, label, table_str,
- false);
+ false, color_str);
}
DEFPY_YANG(ipv6_route_vrf,
|label WORD \
|table (1-4294967295) \
|nexthop-vrf NAME \
+ |color (1-4294967295) \
}]",
NO_STR
IPV6_STR
MPLS_LABEL_HELPSTR
"Table to configure\n"
"The table number to configure\n"
- VRF_CMD_HELP_STR)
+ VRF_CMD_HELP_STR
+ "SR-TE color\n"
+ "The SR-TE color to configure\n")
{
const char *nh_vrf;
const char *flag = NULL;
return static_route_leak(vty, vrfname, nh_vrf, AFI_IP6, SAFI_UNICAST,
no, prefix_str, NULL, from_str, gate_str,
ifname, flag, tag_str, distance_str, label,
- table_str, false);
+ table_str, false, color_str);
}
DEFPY_YANG(debug_staticd,
debug_staticd_cmd,