Allow multiple MPLS output labels to be passed on the CLI
Change-Id: Ib5af105e32b6b0df86923e189ab6bf6ee59de5b9 Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:

committed by
Florin Coras

parent
a3a3a9dedd
commit
f73d0e2ea6
@ -408,15 +408,22 @@ vnet_ip_route_cmd (vlib_main_t * vm,
|
||||
rpaths[vec_len (rpaths) - 1].frp_flags |=
|
||||
FIB_ROUTE_PATH_RESOLVE_VIA_ATTACHED;
|
||||
}
|
||||
else if (unformat (line_input, "out-label %U",
|
||||
unformat_mpls_unicast_label, &out_label))
|
||||
else if (unformat (line_input, "out-labels"))
|
||||
{
|
||||
if (vec_len (rpaths) == 0)
|
||||
{
|
||||
error = clib_error_return (0, "Paths then labels");
|
||||
goto done;
|
||||
}
|
||||
vec_add1 (rpaths[vec_len (rpaths) - 1].frp_label_stack, out_label);
|
||||
else
|
||||
{
|
||||
while (unformat (line_input, "%U",
|
||||
unformat_mpls_unicast_label, &out_label))
|
||||
{
|
||||
vec_add1 (rpaths[vec_len (rpaths) - 1].frp_label_stack,
|
||||
out_label);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (unformat (line_input, "via-label %U",
|
||||
unformat_mpls_unicast_label, &rpath.frp_local_label))
|
||||
|
@ -66,8 +66,18 @@ uword unformat_mpls_unicast_label (unformat_input_t * input, va_list * args)
|
||||
*label = MPLS_IETF_ROUTER_ALERT_LABEL;
|
||||
else if (unformat (input, MPLS_IETF_IMPLICIT_NULL_STRING))
|
||||
*label = MPLS_IETF_IMPLICIT_NULL_LABEL;
|
||||
else if (unformat (input, MPLS_IETF_IPV4_EXPLICIT_NULL_BRIEF_STRING))
|
||||
*label = MPLS_IETF_IPV4_EXPLICIT_NULL_LABEL;
|
||||
else if (unformat (input, MPLS_IETF_IPV6_EXPLICIT_NULL_BRIEF_STRING))
|
||||
*label = MPLS_IETF_IPV6_EXPLICIT_NULL_LABEL;
|
||||
else if (unformat (input, MPLS_IETF_ROUTER_ALERT_BRIEF_STRING))
|
||||
*label = MPLS_IETF_ROUTER_ALERT_LABEL;
|
||||
else if (unformat (input, MPLS_IETF_IMPLICIT_NULL_BRIEF_STRING))
|
||||
*label = MPLS_IETF_IMPLICIT_NULL_LABEL;
|
||||
else if (unformat (input, "%d", label))
|
||||
;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
@ -388,16 +398,23 @@ vnet_mpls_local_label (vlib_main_t * vm,
|
||||
rpath.frp_flags = FIB_ROUTE_PATH_INTF_RX;
|
||||
vec_add1(rpaths, rpath);
|
||||
}
|
||||
else if (unformat (line_input, "out-label %U",
|
||||
unformat_mpls_unicast_label,
|
||||
&out_label))
|
||||
else if (unformat (line_input, "out-labels"))
|
||||
{
|
||||
if (vec_len(rpaths) == 0)
|
||||
{
|
||||
error = clib_error_return(0 , "Paths then labels");
|
||||
if (vec_len (rpaths) == 0)
|
||||
{
|
||||
error = clib_error_return (0, "Paths then labels");
|
||||
goto done;
|
||||
}
|
||||
vec_add1(rpaths[vec_len(rpaths)-1].frp_label_stack, out_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (unformat (line_input, "%U",
|
||||
unformat_mpls_unicast_label,
|
||||
&out_label))
|
||||
{
|
||||
vec_add1 (rpaths[vec_len (rpaths) - 1].frp_label_stack,
|
||||
out_label);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -800,11 +800,24 @@ vnet_create_mpls_tunnel_command_fn (vlib_main_t * vm,
|
||||
is_del = 0;
|
||||
else if (unformat (line_input, "add"))
|
||||
is_del = 0;
|
||||
else if (unformat (line_input, "out-label %U",
|
||||
unformat_mpls_unicast_label, &out_label))
|
||||
{
|
||||
vec_add1(rpath.frp_label_stack, out_label);
|
||||
}
|
||||
else if (unformat (line_input, "out-labels"))
|
||||
{
|
||||
if (vec_len (rpaths) == 0)
|
||||
{
|
||||
error = clib_error_return (0, "Paths then labels");
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (unformat (line_input, "%U",
|
||||
unformat_mpls_unicast_label,
|
||||
&out_label))
|
||||
{
|
||||
vec_add1 (rpaths[vec_len (rpaths) - 1].frp_label_stack,
|
||||
out_label);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (unformat (line_input, "via %U %U",
|
||||
unformat_ip4_address,
|
||||
&rpath.frp_addr.ip4,
|
||||
|
Reference in New Issue
Block a user