summaryrefslogtreecommitdiffstats
path: root/ldpd
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-07-25 02:45:33 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-07-31 13:56:44 +0200
commit1224e5c4340723dc3b9073953bc67933b5fab552 (patch)
treed18230d559369366479a821c7e81879a66f3e32e /ldpd
parentldpd: restore correct defaults on "no discovery ... interval" (diff)
downloadfrr-1224e5c4340723dc3b9073953bc67933b5fab552.tar.xz
frr-1224e5c4340723dc3b9073953bc67933b5fab552.zip
ldpd: convert CLI code to use DEFPY
Yay :) Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd')
-rw-r--r--ldpd/Makefile.am4
-rw-r--r--ldpd/ldp_debug.c18
-rw-r--r--ldpd/ldp_vty.h78
-rw-r--r--ldpd/ldp_vty_cmds.c668
-rw-r--r--ldpd/ldp_vty_conf.c210
-rw-r--r--ldpd/ldp_vty_exec.c34
6 files changed, 276 insertions, 736 deletions
diff --git a/ldpd/Makefile.am b/ldpd/Makefile.am
index 6074b53a3..de9b07ed4 100644
--- a/ldpd/Makefile.am
+++ b/ldpd/Makefile.am
@@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in.
+include ../common.am
+
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
@@ -16,6 +18,8 @@ libldp_a_SOURCES = \
socket.c util.c ldp_vty_cmds.c ldp_vty_conf.c ldp_vty_exec.c \
ldp_debug.c ldp_zebra.c
+ldp_vty_cmds.o: ldp_vty_cmds_clippy.c
+
noinst_HEADERS = \
control.h lde.h ldpd.h ldpe.h ldp.h log.h ldp_debug.h ldp_vty.h
diff --git a/ldpd/ldp_debug.c b/ldpd/ldp_debug.c
index c9c7160ae..d80ec8dfb 100644
--- a/ldpd/ldp_debug.c
+++ b/ldpd/ldp_debug.c
@@ -38,31 +38,31 @@ struct cmd_node ldp_debug_node =
};
int
-ldp_vty_debug(struct vty *vty, int disable, const char *type_str,
- const char *dir_str, int all)
+ldp_vty_debug(struct vty *vty, const char *negate, const char *type_str,
+ const char *dir_str, const char *all)
{
if (strcmp(type_str, "discovery") == 0) {
if (dir_str == NULL)
return (CMD_WARNING_CONFIG_FAILED);
if (dir_str[0] == 'r') {
- if (disable)
+ if (negate)
DEBUG_OFF(hello, HELLO_RECV);
else
DEBUG_ON(hello, HELLO_RECV);
} else {
- if (disable)
+ if (negate)
DEBUG_OFF(hello, HELLO_SEND);
else
DEBUG_ON(hello, HELLO_SEND);
}
} else if (strcmp(type_str, "errors") == 0) {
- if (disable)
+ if (negate)
DEBUG_OFF(errors, ERRORS);
else
DEBUG_ON(errors, ERRORS);
} else if (strcmp(type_str, "event") == 0) {
- if (disable)
+ if (negate)
DEBUG_OFF(event, EVENT);
else
DEBUG_ON(event, EVENT);
@@ -71,7 +71,7 @@ ldp_vty_debug(struct vty *vty, int disable, const char *type_str,
return (CMD_WARNING_CONFIG_FAILED);
if (dir_str[0] == 'r') {
- if (disable) {
+ if (negate) {
DEBUG_OFF(msg, MSG_RECV);
DEBUG_OFF(msg, MSG_RECV_ALL);
} else {
@@ -80,7 +80,7 @@ ldp_vty_debug(struct vty *vty, int disable, const char *type_str,
DEBUG_ON(msg, MSG_RECV_ALL);
}
} else {
- if (disable) {
+ if (negate) {
DEBUG_OFF(msg, MSG_SEND);
DEBUG_OFF(msg, MSG_SEND_ALL);
} else {
@@ -90,7 +90,7 @@ ldp_vty_debug(struct vty *vty, int disable, const char *type_str,
}
}
} else if (strcmp(type_str, "zebra") == 0) {
- if (disable)
+ if (negate)
DEBUG_OFF(zebra, ZEBRA);
else
DEBUG_ON(zebra, ZEBRA);
diff --git a/ldpd/ldp_vty.h b/ldpd/ldp_vty.h
index 93713166f..3d2072f1e 100644
--- a/ldpd/ldp_vty.h
+++ b/ldpd/ldp_vty.h
@@ -36,46 +36,46 @@ int ldp_get_address(const char *, int *, union ldpd_addr *);
int ldp_config_write(struct vty *);
int ldp_l2vpn_config_write(struct vty *);
int ldp_debug_config_write(struct vty *);
-int ldp_vty_mpls_ldp (struct vty *, int);
-int ldp_vty_address_family (struct vty *, int, const char *);
-int ldp_vty_disc_holdtime(struct vty *, int, const char *, const char *);
-int ldp_vty_disc_interval(struct vty *, int, const char *, const char *);
-int ldp_vty_targeted_hello_accept(struct vty *, int, const char *);
-int ldp_vty_nbr_session_holdtime(struct vty *, int, const char *, const char *);
-int ldp_vty_af_session_holdtime(struct vty *, int, const char *);
-int ldp_vty_interface(struct vty *, int, const char *);
-int ldp_vty_trans_addr(struct vty *, int, const char *);
-int ldp_vty_neighbor_targeted(struct vty *, int, const char *);
-int ldp_vty_label_advertise(struct vty *, int, const char *, const char *);
-int ldp_vty_label_allocate(struct vty *, int, int, const char *);
-int ldp_vty_label_expnull(struct vty *, int, const char *);
-int ldp_vty_label_accept(struct vty *, int, const char *, const char *);
-int ldp_vty_ttl_security(struct vty *, int);
-int ldp_vty_router_id(struct vty *, int, const char *);
-int ldp_vty_ds_cisco_interop(struct vty *, int);
-int ldp_vty_trans_pref_ipv4(struct vty *, int);
-int ldp_vty_neighbor_password(struct vty *, int, const char *, const char *);
-int ldp_vty_neighbor_ttl_security(struct vty *, int, const char *, const char *);
-int ldp_vty_l2vpn(struct vty *, int, const char *);
-int ldp_vty_l2vpn_bridge(struct vty *, int, const char *);
-int ldp_vty_l2vpn_mtu(struct vty *, int, const char *);
-int ldp_vty_l2vpn_pwtype(struct vty *, int, const char *);
-int ldp_vty_l2vpn_interface(struct vty *, int, const char *);
-int ldp_vty_l2vpn_pseudowire(struct vty *, int, const char *);
-int ldp_vty_l2vpn_pw_cword(struct vty *, int, const char *);
-int ldp_vty_l2vpn_pw_nbr_addr(struct vty *, int, const char *);
-int ldp_vty_l2vpn_pw_nbr_id(struct vty *, int, const char *);
-int ldp_vty_l2vpn_pw_pwid(struct vty *, int, const char *);
-int ldp_vty_l2vpn_pw_pwstatus(struct vty *, int);
+int ldp_vty_mpls_ldp (struct vty *, const char *);
+int ldp_vty_address_family (struct vty *, const char *, const char *);
+int ldp_vty_disc_holdtime(struct vty *, const char *, const char *, long);
+int ldp_vty_disc_interval(struct vty *, const char *, const char *, long);
+int ldp_vty_targeted_hello_accept(struct vty *, const char *, const char *);
+int ldp_vty_nbr_session_holdtime(struct vty *, const char *, struct in_addr, long);
+int ldp_vty_af_session_holdtime(struct vty *, const char *, long);
+int ldp_vty_interface(struct vty *, const char *, const char *);
+int ldp_vty_trans_addr(struct vty *, const char *, const char *);
+int ldp_vty_neighbor_targeted(struct vty *, const char *, const char *);
+int ldp_vty_label_advertise(struct vty *, const char *, const char *, const char *);
+int ldp_vty_label_allocate(struct vty *, const char *, const char *, const char *);
+int ldp_vty_label_expnull(struct vty *, const char *, const char *);
+int ldp_vty_label_accept(struct vty *, const char *, const char *, const char *);
+int ldp_vty_ttl_security(struct vty *, const char *);
+int ldp_vty_router_id(struct vty *, const char *, struct in_addr);
+int ldp_vty_ds_cisco_interop(struct vty *, const char *);
+int ldp_vty_trans_pref_ipv4(struct vty *, const char *);
+int ldp_vty_neighbor_password(struct vty *, const char *, struct in_addr, const char *);
+int ldp_vty_neighbor_ttl_security(struct vty *, const char *, struct in_addr, const char *);
+int ldp_vty_l2vpn(struct vty *, const char *, const char *);
+int ldp_vty_l2vpn_bridge(struct vty *, const char *, const char *);
+int ldp_vty_l2vpn_mtu(struct vty *, const char *, long);
+int ldp_vty_l2vpn_pwtype(struct vty *, const char *, const char *);
+int ldp_vty_l2vpn_interface(struct vty *, const char *, const char *);
+int ldp_vty_l2vpn_pseudowire(struct vty *, const char *, const char *);
+int ldp_vty_l2vpn_pw_cword(struct vty *, const char *, const char *);
+int ldp_vty_l2vpn_pw_nbr_addr(struct vty *, const char *, const char *);
+int ldp_vty_l2vpn_pw_nbr_id(struct vty *, const char *, struct in_addr);
+int ldp_vty_l2vpn_pw_pwid(struct vty *, const char *, long);
+int ldp_vty_l2vpn_pw_pwstatus(struct vty *, const char *);
int ldp_vty_clear_nbr(struct vty *, const char *);
-int ldp_vty_debug(struct vty *, int, const char *, const char *, int);
-int ldp_vty_show_binding(struct vty *, const char *, int, int);
-int ldp_vty_show_discovery(struct vty *, const char *, int, int);
-int ldp_vty_show_interface(struct vty *, const char *, int);
-int ldp_vty_show_capabilities(struct vty *, int);
-int ldp_vty_show_neighbor(struct vty *, int, int, int);
-int ldp_vty_show_atom_binding(struct vty *, int);
-int ldp_vty_show_atom_vc(struct vty *, int);
+int ldp_vty_debug(struct vty *, const char *, const char *, const char *, const char *);
+int ldp_vty_show_binding(struct vty *, const char *, const char *, const char *);
+int ldp_vty_show_discovery(struct vty *, const char *, const char *, const char *);
+int ldp_vty_show_interface(struct vty *, const char *, const char *);
+int ldp_vty_show_capabilities(struct vty *, const char *);
+int ldp_vty_show_neighbor(struct vty *, int, const char *, const char *);
+int ldp_vty_show_atom_binding(struct vty *, const char *);
+int ldp_vty_show_atom_vc(struct vty *, const char *);
int ldp_vty_show_debugging(struct vty *);
void ldp_vty_init(void);
diff --git a/ldpd/ldp_vty_cmds.c b/ldpd/ldp_vty_cmds.c
index 052a93e2a..56a14581c 100644
--- a/ldpd/ldp_vty_cmds.c
+++ b/ldpd/ldp_vty_cmds.c
@@ -22,6 +22,7 @@
#include "command.h"
#include "vty.h"
#include "ldpd/ldp_vty.h"
+#include "ldpd/ldp_vty_cmds_clippy.c"
DEFUN_NOSH(ldp_mpls_ldp,
ldp_mpls_ldp_cmd,
@@ -29,17 +30,17 @@ DEFUN_NOSH(ldp_mpls_ldp,
"Global MPLS configuration subcommands\n"
"Label Distribution Protocol\n")
{
- return (ldp_vty_mpls_ldp(vty, 0));
+ return (ldp_vty_mpls_ldp(vty, NULL));
}
-DEFUN (no_ldp_mpls_ldp,
+DEFPY (no_ldp_mpls_ldp,
no_ldp_mpls_ldp_cmd,
"no mpls ldp",
"Negate a command or set its defaults\n"
"Global MPLS configuration subcommands\n"
"Label Distribution Protocol\n")
{
- return (ldp_vty_mpls_ldp(vty, 1));
+ return (ldp_vty_mpls_ldp(vty, "no"));
}
DEFUN_NOSH(ldp_l2vpn,
@@ -59,21 +60,16 @@ DEFUN_NOSH(ldp_l2vpn,
return (ldp_vty_l2vpn(vty, 0, name));
}
-DEFUN (no_ldp_l2vpn,
+DEFPY (no_ldp_l2vpn,
no_ldp_l2vpn_cmd,
- "no l2vpn WORD type vpls",
+ "no l2vpn WORD$name type vpls",
+ "Negate a command or set its defaults\n"
"Configure l2vpn commands\n"
"L2VPN name\n"
"L2VPN type\n"
"Virtual Private LAN Service\n")
{
- int idx = 0;
- const char *name;
-
- argv_find(argv, argc, "WORD", &idx);
- name = argv[idx]->arg;
-
- return (ldp_vty_l2vpn(vty, 1, name));
+ return (ldp_vty_l2vpn(vty, "no", name));
}
DEFUN_NOSH(ldp_address_family,
@@ -92,21 +88,15 @@ DEFUN_NOSH(ldp_address_family,
return (ldp_vty_address_family(vty, 0, af));
}
-DEFUN (no_ldp_address_family,
+DEFPY (no_ldp_address_family,
no_ldp_address_family_cmd,
- "no address-family <ipv4|ipv6>",
+ "no address-family <ipv4|ipv6>$af",
"Negate a command or set its defaults\n"
"Configure Address Family and its parameters\n"
"IPv4\n"
"IPv6\n")
{
- int idx = 0;
- const char *af;
-
- argv_find(argv, argc, "address-family", &idx);
- af = argv[idx + 1]->text;
-
- return (ldp_vty_address_family(vty, 1, af));
+ return (ldp_vty_address_family(vty, "no", af));
}
DEFUN_NOSH(ldp_exit_address_family,
@@ -119,9 +109,9 @@ DEFUN_NOSH(ldp_exit_address_family,
return CMD_SUCCESS;
}
-DEFUN (ldp_discovery_holdtime,
+DEFPY (ldp_discovery_holdtime,
ldp_discovery_holdtime_cmd,
- "[no] discovery <hello|targeted-hello> holdtime (1-65535)",
+ "[no] discovery <hello|targeted-hello>$hello_type holdtime (1-65535)$holdtime",
"Negate a command or set its defaults\n"
"Configure discovery parameters\n"
"LDP Link Hellos\n"
@@ -129,24 +119,12 @@ DEFUN (ldp_discovery_holdtime,
"Hello holdtime\n"
"Time (seconds) - 65535 implies infinite\n")
{
- int idx = 0;
- int negate = 0;
- const char *hello_type;
- const char *holdtime;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "discovery", &idx);
- hello_type = argv[idx + 1]->text;
- argv_find(argv, argc, "(1-65535)", &idx);
- holdtime = argv[idx]->arg;
-
- return (ldp_vty_disc_holdtime(vty, negate, hello_type, holdtime));
+ return (ldp_vty_disc_holdtime(vty, no, hello_type, holdtime));
}
-DEFUN (ldp_discovery_interval,
+DEFPY (ldp_discovery_interval,
ldp_discovery_interval_cmd,
- "[no] discovery <hello|targeted-hello> interval (1-65535)",
+ "[no] discovery <hello|targeted-hello>$hello_type interval (1-65535)$interval",
"Negate a command or set its defaults\n"
"Configure discovery parameters\n"
"LDP Link Hellos\n"
@@ -154,22 +132,10 @@ DEFUN (ldp_discovery_interval,
"Hello interval\n"
"Time (seconds)\n")
{
- int idx = 0;
- int negate = 0;
- const char *hello_type;
- const char *interval;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "discovery", &idx);
- hello_type = argv[idx + 1]->text;
- argv_find(argv, argc, "(1-65535)", &idx);
- interval = argv[idx]->arg;
-
- return (ldp_vty_disc_interval(vty, negate, hello_type, interval));
+ return (ldp_vty_disc_interval(vty, no, hello_type, interval));
}
-DEFUN (ldp_dual_stack_transport_connection_prefer_ipv4,
+DEFPY (ldp_dual_stack_transport_connection_prefer_ipv4,
ldp_dual_stack_transport_connection_prefer_ipv4_cmd,
"[no] dual-stack transport-connection prefer ipv4",
"Negate a command or set its defaults\n"
@@ -178,58 +144,34 @@ DEFUN (ldp_dual_stack_transport_connection_prefer_ipv4,
"Configure prefered address family for TCP transport connection with neighbor\n"
"IPv4\n")
{
- int idx = 0;
- int negate = 0;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
-
- return (ldp_vty_trans_pref_ipv4(vty, negate));
+ return (ldp_vty_trans_pref_ipv4(vty, no));
}
-DEFUN (ldp_dual_stack_cisco_interop,
+DEFPY (ldp_dual_stack_cisco_interop,
ldp_dual_stack_cisco_interop_cmd,
"[no] dual-stack cisco-interop",
"Negate a command or set its defaults\n"
"Configure dual stack parameters\n"
"Use Cisco non-compliant format to send and interpret the Dual-Stack capability TLV\n")
{
- int idx = 0;
- int negate = 0;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
-
- return (ldp_vty_ds_cisco_interop(vty, negate));
+ return (ldp_vty_ds_cisco_interop(vty, no));
}
-DEFUN (ldp_neighbor_password,
+DEFPY (ldp_neighbor_password,
ldp_neighbor_password_cmd,
- "[no] neighbor A.B.C.D password WORD",
+ "[no] neighbor A.B.C.D$neighbor password WORD$password",
"Negate a command or set its defaults\n"
"Configure neighbor parameters\n"
"LDP Id of neighbor\n"
"Configure password for MD5 authentication\n"
"The password\n")
{
- int idx = 0;
- int negate = 0;
- const char *neighbor;
- const char *password;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "A.B.C.D", &idx);
- neighbor = argv[idx]->arg;
- argv_find(argv, argc, "WORD", &idx);
- password = argv[idx]->arg;
-
- return (ldp_vty_neighbor_password(vty, negate, neighbor, password));
+ return (ldp_vty_neighbor_password(vty, no, neighbor, password));
}
-DEFUN (ldp_neighbor_session_holdtime,
+DEFPY (ldp_neighbor_session_holdtime,
ldp_neighbor_session_holdtime_cmd,
- "[no] neighbor A.B.C.D session holdtime (15-65535)",
+ "[no] neighbor A.B.C.D$neighbor session holdtime (15-65535)$holdtime",
"Negate a command or set its defaults\n"
"Configure neighbor parameters\n"
"LDP Id of neighbor\n"
@@ -237,24 +179,12 @@ DEFUN (ldp_neighbor_session_holdtime,
"Configure session holdtime\n"
"Time (seconds)\n")
{
- int idx = 0;
- int negate = 0;
- const char *neighbor;
- const char *holdtime;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "A.B.C.D", &idx);
- neighbor = argv[idx]->arg;
- argv_find(argv, argc, "(15-65535)", &idx);
- holdtime = argv[idx]->arg;
-
- return (ldp_vty_nbr_session_holdtime(vty, negate, neighbor, holdtime));
+ return (ldp_vty_nbr_session_holdtime(vty, no, neighbor, holdtime));
}
-DEFUN (ldp_neighbor_ttl_security,
+DEFPY (ldp_neighbor_ttl_security,
ldp_neighbor_ttl_security_cmd,
- "[no] neighbor A.B.C.D ttl-security <disable|hops (1-254)>",
+ "[no] neighbor A.B.C.D$neighbor ttl-security <disable|hops (1-254)$hops>",
"Negate a command or set its defaults\n"
"Configure neighbor parameters\n"
"LDP Id of neighbor\n"
@@ -263,43 +193,22 @@ DEFUN (ldp_neighbor_ttl_security,
"IP hops\n"
"maximum number of hops\n")
{
- int idx = 0;
- int negate = 0;
- const char *neighbor;
- const char *hops = NULL;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "A.B.C.D", &idx);
- neighbor = argv[idx]->arg;
- if (argv_find(argv, argc, "(1-254)", &idx))
- hops = argv[idx]->arg;
-
- return (ldp_vty_neighbor_ttl_security(vty, negate, neighbor, hops));
+ return (ldp_vty_neighbor_ttl_security(vty, no, neighbor, hops_str));
}
-DEFUN (ldp_router_id,
+DEFPY (ldp_router_id,
ldp_router_id_cmd,
- "[no] router-id A.B.C.D",
+ "[no] router-id A.B.C.D$address",
"Negate a command or set its defaults\n"
"Configure router Id\n"
"LSR Id (in form of an IPv4 address)\n")
{
- int idx = 0;
- int negate = 0;
- const char *address;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "A.B.C.D", &idx);
- address = argv[idx]->arg;
-
- return (ldp_vty_router_id(vty, negate, address));
+ return (ldp_vty_router_id(vty, no, address));
}
-DEFUN (ldp_discovery_targeted_hello_accept,
+DEFPY (ldp_discovery_targeted_hello_accept,
ldp_discovery_targeted_hello_accept_cmd,
- "[no] discovery targeted-hello accept [from <(1-199)|(1300-2699)|WORD>]",
+ "[no] discovery targeted-hello accept [from <(1-199)|(1300-2699)|WORD>$from_acl]",
"Negate a command or set its defaults\n"
"Configure discovery parameters\n"
"LDP Targeted Hellos\n"
@@ -309,61 +218,34 @@ DEFUN (ldp_discovery_targeted_hello_accept,
"IP access-list number (expanded range)\n"
"IP access-list name\n")
{
- int idx = 0;
- int negate = 0;
- const char *from_acl = NULL;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- if (argv_find(argv, argc, "from", &idx))
- from_acl = argv[idx + 1]->arg;
-
- return (ldp_vty_targeted_hello_accept(vty, negate, from_acl));
+ return (ldp_vty_targeted_hello_accept(vty, no, from_acl));
}
-DEFUN (ldp_discovery_transport_address_ipv4,
+DEFPY (ldp_discovery_transport_address_ipv4,
ldp_discovery_transport_address_ipv4_cmd,
- "[no] discovery transport-address A.B.C.D",
+ "[no] discovery transport-address A.B.C.D$address",
"Negate a command or set its defaults\n"
"Configure discovery parameters\n"
"Specify transport address for TCP connection\n"
"IP address to be used as transport address\n")
{
- int idx = 0;
- int negate = 0;
- const char *address;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "A.B.C.D", &idx);
- address = argv[idx]->arg;
-
- return (ldp_vty_trans_addr(vty, negate, address));
+ return (ldp_vty_trans_addr(vty, no, address_str));
}
-DEFUN (ldp_discovery_transport_address_ipv6,
+DEFPY (ldp_discovery_transport_address_ipv6,
ldp_discovery_transport_address_ipv6_cmd,
- "[no] discovery transport-address X:X::X:X",
+ "[no] discovery transport-address X:X::X:X$address",
"Negate a command or set its defaults\n"
"Configure discovery parameters\n"
"Specify transport address for TCP connection\n"
"IPv6 address to be used as transport address\n")
{
- int idx = 0;
- int negate = 0;
- const char *address;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "X:X::X:X", &idx);
- address = argv[idx]->arg;
-
- return (ldp_vty_trans_addr(vty, negate, address));
+ return (ldp_vty_trans_addr(vty, no, address_str));
}
-DEFUN (ldp_label_local_advertise,
+DEFPY (ldp_label_local_advertise,
ldp_label_local_advertise_cmd,
- "[no] label local advertise [{to <(1-199)|(1300-2699)|WORD>|for <(1-199)|(1300-2699)|WORD>}]",
+ "[no] label local advertise [{to <(1-199)|(1300-2699)|WORD>$to_acl|for <(1-199)|(1300-2699)|WORD>$for_acl}]",
"Negate a command or set its defaults\n"
"Configure label control and policies\n"
"Configure local label control and policies\n"
@@ -377,27 +259,12 @@ DEFUN (ldp_label_local_advertise,
"IP access-list number (expanded range)\n"
"IP access-list name\n")
{
- int idx = 0;
- int negate = 0;
- const char *to_acl = NULL;
- const char *for_acl = NULL;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
-
- /* arguments within curly braces may be provided in any order */
- if (argv_find(argv, argc, "to", &idx))
- to_acl = argv[idx + 1]->arg;
- idx = 0;
- if (argv_find(argv, argc, "for", &idx))
- for_acl = argv[idx + 1]->arg;
-
- return (ldp_vty_label_advertise(vty, negate, to_acl, for_acl));
+ return (ldp_vty_label_advertise(vty, no, to_acl, for_acl));
}
-DEFUN (ldp_label_local_advertise_explicit_null,
+DEFPY (ldp_label_local_advertise_explicit_null,
ldp_label_local_advertise_explicit_null_cmd,
- "[no] label local advertise explicit-null [for <(1-199)|(1300-2699)|WORD>]",
+ "[no] label local advertise explicit-null [for <(1-199)|(1300-2699)|WORD>$for_acl]",
"Negate a command or set its defaults\n"
"Configure label control and policies\n"
"Configure local label control and policies\n"
@@ -408,21 +275,12 @@ DEFUN (ldp_label_local_advertise_explicit_null,
"IP access-list number (expanded range)\n"
"IP access-list name\n")
{
- int idx = 0;
- int negate = 0;
- const char *for_acl = NULL;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- if (argv_find(argv, argc, "for", &idx))
- for_acl = argv[idx + 1]->arg;
-
- return (ldp_vty_label_expnull(vty, negate, for_acl));
+ return (ldp_vty_label_expnull(vty, no, for_acl));
}
-DEFUN (ldp_label_local_allocate,
+DEFPY (ldp_label_local_allocate,
ldp_label_local_allocate_cmd,
- "[no] label local allocate <host-routes|for <(1-199)|(1300-2699)|WORD>>",
+ "[no] label local allocate <host-routes$host_routes|for <(1-199)|(1300-2699)|WORD>$for_acl>",
"Negate a command or set its defaults\n"
"Configure label control and policies\n"
"Configure local label control and policies\n"
@@ -433,27 +291,12 @@ DEFUN (ldp_label_local_allocate,
"IP access-list number (expanded range)\n"
"IP access-list name\n")
{
- int idx = 0;
- int negate = 0;
- int host_routes = 0;
- const char *for_acl = NULL;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
-
- /* arguments within curly braces may be provided in any order */
- if (argv_find(argv, argc, "host-routes", &idx))
- host_routes = 1;
- idx = 0;
- if (argv_find(argv, argc, "for", &idx))
- for_acl = argv[idx + 1]->arg;
-
- return (ldp_vty_label_allocate(vty, negate, host_routes, for_acl));
+ return (ldp_vty_label_allocate(vty, no, host_routes, for_acl));
}
-DEFUN (ldp_label_remote_accept,
+DEFPY (ldp_label_remote_accept,
ldp_label_remote_accept_cmd,
- "[no] label remote accept {from <(1-199)|(1300-2699)|WORD>|for <(1-199)|(1300-2699)|WORD>}",
+ "[no] label remote accept {from <(1-199)|(1300-2699)|WORD>$from_acl|for <(1-199)|(1300-2699)|WORD>$for_acl}",
"Negate a command or set its defaults\n"
"Configure label control and policies\n"
"Configure remote/peer label control and policies\n"
@@ -467,58 +310,28 @@ DEFUN (ldp_label_remote_accept,
"IP access-list number (expanded range)\n"
"IP access-list name\n")
{
- int idx = 0;
- int negate = 0;
- const char *from_acl = NULL;
- const char *for_acl = NULL;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
-
- /* arguments within curly braces may be provided in any order */
- if (argv_find(argv, argc, "from", &idx))
- from_acl = argv[idx + 1]->arg;
- idx = 0;
- if (argv_find(argv, argc, "for", &idx))
- for_acl = argv[idx + 1]->arg;
-
- return (ldp_vty_label_accept(vty, negate, from_acl, for_acl));
+ return (ldp_vty_label_accept(vty, no, from_acl, for_acl));
}
-DEFUN (ldp_ttl_security_disable,
+DEFPY (ldp_ttl_security_disable,
ldp_ttl_security_disable_cmd,
"[no] ttl-security disable",
"Negate a command or set its defaults\n"
"LDP ttl security check\n"
"Disable ttl security\n")
{
- int idx = 0;
- int negate = 0;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
-
- return (ldp_vty_ttl_security(vty, negate));
+ return (ldp_vty_ttl_security(vty, no));
}
-DEFUN (ldp_session_holdtime,
+DEFPY (ldp_session_holdtime,
ldp_session_holdtime_cmd,
- "[no] session holdtime (15-65535)",
+ "[no] session holdtime (15-65535)$holdtime",
"Negate a command or set its defaults\n"
"Configure session parameters\n"
"Configure session holdtime\n"
"Time (seconds)\n")
{
- int idx = 0;
- int negate = 0;
- const char *holdtime;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "(15-65535)", &idx);
- holdtime = argv[idx]->arg;
-
- return (ldp_vty_af_session_holdtime(vty, negate, holdtime));
+ return (ldp_vty_af_session_holdtime(vty, no, holdtime));
}
DEFUN_NOSH(ldp_interface,
@@ -536,117 +349,67 @@ DEFUN_NOSH(ldp_interface,
return (ldp_vty_interface(vty, 0, ifname));
}
-DEFUN (no_ldp_interface,
+DEFPY (no_ldp_interface,
no_ldp_interface_cmd,
- "no interface IFNAME",
+ "no interface IFNAME$ifname",
+ "Negate a command or set its defaults\n"
"Enable LDP on an interface and enter interface submode\n"
"Interface's name\n")
{
- int idx = 0;
- const char *ifname;
-
- argv_find(argv, argc, "IFNAME", &idx);
- ifname = argv[idx]->arg;
-
- return (ldp_vty_interface(vty, 1, ifname));
+ return (ldp_vty_interface(vty, "no", ifname));
}
-DEFUN (ldp_neighbor_ipv4_targeted,
+DEFPY (ldp_neighbor_ipv4_targeted,
ldp_neighbor_ipv4_targeted_cmd,
- "[no] neighbor A.B.C.D targeted",
+ "[no] neighbor A.B.C.D$address targeted",
"Negate a command or set its defaults\n"
"Configure neighbor parameters\n"
"IP address of neighbor\n"
"Establish targeted session\n")
{
- int idx = 0;
- int negate = 0;
- const char *address;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "A.B.C.D", &idx);
- address = argv[idx]->arg;
-
- return (ldp_vty_neighbor_targeted(vty, negate, address));
+ return (ldp_vty_neighbor_targeted(vty, no, address_str));
}
-DEFUN (ldp_neighbor_ipv6_targeted,
+DEFPY (ldp_neighbor_ipv6_targeted,
ldp_neighbor_ipv6_targeted_cmd,
- "[no] neighbor X:X::X:X targeted",
+ "[no] neighbor X:X::X:X$address targeted",
"Negate a command or set its defaults\n"
"Configure neighbor parameters\n"
"IPv6 address of neighbor\n"
"Establish targeted session\n")
{
- int idx = 0;
- int negate = 0;
- const char *address;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "X:X::X:X", &idx);
- address = argv[idx]->arg;
-
- return (ldp_vty_neighbor_targeted(vty, negate, address));
+ return (ldp_vty_neighbor_targeted(vty, no, address_str));
}
-DEFUN (ldp_bridge,
+DEFPY (ldp_bridge,
ldp_bridge_cmd,
- "[no] bridge IFNAME",
+ "[no] bridge IFNAME$ifname",
"Negate a command or set its defaults\n"
"Bridge interface\n"
"Interface's name\n")
{
- int idx = 0;
- int negate = 0;
- const char *ifname;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "IFNAME", &idx);
- ifname = argv[idx]->arg;
-
- return (ldp_vty_l2vpn_bridge(vty, negate, ifname));
+ return (ldp_vty_l2vpn_bridge(vty, no, ifname));
}
-DEFUN (ldp_mtu,
+DEFPY (ldp_mtu,
ldp_mtu_cmd,
- "[no] mtu (1500-9180)",
+ "[no] mtu (1500-9180)$mtu",
"Negate a command or set its defaults\n"
"Set Maximum Transmission Unit\n"
"Maximum Transmission Unit value\n")
{
- int idx = 0;
- int negate = 0;
- const char *mtu;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "(1500-9180)", &idx);
- mtu = argv[idx]->arg;
-
- return (ldp_vty_l2vpn_mtu(vty, negate, mtu));
+ return (ldp_vty_l2vpn_mtu(vty, no, mtu));
}
-DEFUN (ldp_member_interface,
+DEFPY (ldp_member_interface,
ldp_member_interface_cmd,
- "[no] member interface IFNAME",
+ "[no] member interface IFNAME$ifname",
"Negate a command or set its defaults\n"
"L2VPN member configuration\n"
"Local interface\n"
"Interface's name\n")
{
- int idx = 0;
- int negate = 0;
- const char *ifname;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "IFNAME", &idx);
- ifname = argv[idx]->arg;
-
- return (ldp_vty_l2vpn_interface(vty, negate, ifname));
+ return (ldp_vty_l2vpn_interface(vty, no, ifname));
}
DEFUN_NOSH(ldp_member_pseudowire,
@@ -665,143 +428,86 @@ DEFUN_NOSH(ldp_member_pseudowire,
return (ldp_vty_l2vpn_pseudowire(vty, 0, ifname));
}
-DEFUN (no_ldp_member_pseudowire,
+DEFPY (no_ldp_member_pseudowire,
no_ldp_member_pseudowire_cmd,
- "no member pseudowire IFNAME",
+ "no member pseudowire IFNAME$ifname",
"Negate a command or set its defaults\n"
"L2VPN member configuration\n"
"Pseudowire interface\n"
"Interface's name\n")
{
- int idx = 0;
- const char *ifname;
-
- argv_find(argv, argc, "IFNAME", &idx);
- ifname = argv[idx]->arg;
-
- return (ldp_vty_l2vpn_pseudowire(vty, 1, ifname));
+ return (ldp_vty_l2vpn_pseudowire(vty, "no", ifname));
}
-DEFUN (ldp_vc_type,
+DEFPY (ldp_vc_type,
ldp_vc_type_cmd,
- "[no] vc type <ethernet|ethernet-tagged>",
+ "[no] vc type <ethernet|ethernet-tagged>$vc_type",
"Negate a command or set its defaults\n"
"Virtual Circuit options\n"
"Virtual Circuit type to use\n"
"Ethernet (type 5)\n"
"Ethernet-tagged (type 4)\n")
{
- int idx = 0;
- int negate = 0;
- const char *vc_type;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "type", &idx);
- vc_type = argv[idx + 1]->text;
-
- return (ldp_vty_l2vpn_pwtype(vty, negate, vc_type));
+ return (ldp_vty_l2vpn_pwtype(vty, no, vc_type));
}
-DEFUN (ldp_control_word,
+DEFPY (ldp_control_word,
ldp_control_word_cmd,
- "[no] control-word <exclude|include>",
+ "[no] control-word <exclude|include>$preference",
"Negate a command or set its defaults\n"
"Control-word options\n"
"Exclude control-word in pseudowire packets\n"
"Include control-word in pseudowire packets\n")
{
- int idx = 0;
- int negate = 0;
- const char *preference;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "control-word", &idx);
- preference = argv[idx + 1]->text;
-
- return (ldp_vty_l2vpn_pw_cword(vty, negate, preference));
+ return (ldp_vty_l2vpn_pw_cword(vty, no, preference));
}
-DEFUN (ldp_neighbor_address,
+DEFPY (ldp_neighbor_address,
ldp_neighbor_address_cmd,
- "[no] neighbor address <A.B.C.D|X:X::X:X>",
+ "[no] neighbor address <A.B.C.D|X:X::X:X>$pw_address",
"Negate a command or set its defaults\n"
"Remote endpoint configuration\n"
"Specify the IPv4 or IPv6 address of the remote endpoint\n"
"IPv4 address\n"
"IPv6 address\n")
{
- int idx = 0;
- int negate = 0;
- const char *address;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "address", &idx);
- address = argv[idx + 1]->arg;
-
- return (ldp_vty_l2vpn_pw_nbr_addr(vty, negate, address));
+ return (ldp_vty_l2vpn_pw_nbr_addr(vty, no, pw_address_str));
}
-DEFUN (ldp_neighbor_lsr_id,
+DEFPY (ldp_neighbor_lsr_id,
ldp_neighbor_lsr_id_cmd,
- "[no] neighbor lsr-id A.B.C.D",
+ "[no] neighbor lsr-id A.B.C.D$address",
"Negate a command or set its defaults\n"
"Remote endpoint configuration\n"
"Specify the LSR-ID of the remote endpoint\n"
"IPv4 address\n")
{
- int idx = 0;
- int negate = 0;
- const char *address;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "A.B.C.D", &idx);
- address = argv[idx]->arg;
-
- return (ldp_vty_l2vpn_pw_nbr_id(vty, negate, address));
+ return (ldp_vty_l2vpn_pw_nbr_id(vty, no, address));
}
-DEFUN (ldp_pw_id,
+DEFPY (ldp_pw_id,
ldp_pw_id_cmd,
- "[no] pw-id (1-4294967295)",
+ "[no] pw-id (1-4294967295)$pwid",
"Negate a command or set its defaults\n"
"Set the Virtual Circuit ID\n"
"Virtual Circuit ID value\n")
{
- int idx = 0;
- int negate = 0;
- const char *pwid;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "(1-4294967295)", &idx);
- pwid = argv[idx]->arg;
-
- return (ldp_vty_l2vpn_pw_pwid(vty, negate, pwid));
+ return (ldp_vty_l2vpn_pw_pwid(vty, no, pwid));
}
-DEFUN (ldp_pw_status_disable,
+DEFPY (ldp_pw_status_disable,
ldp_pw_status_disable_cmd,
"[no] pw-status disable",
"Negate a command or set its defaults\n"
"Configure PW status\n"
"Disable PW status\n")
{
- int idx = 0;
- int negate = 0;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
-
- return (ldp_vty_l2vpn_pw_pwstatus(vty, negate));
+ return (ldp_vty_l2vpn_pw_pwstatus(vty, no));
}
-DEFUN (ldp_clear_mpls_ldp_neighbor,
+DEFPY (ldp_clear_mpls_ldp_neighbor,
ldp_clear_mpls_ldp_neighbor_cmd,
- "clear mpls ldp neighbor [<A.B.C.D|X:X::X:X>]",
+ "clear mpls ldp neighbor [<A.B.C.D|X:X::X:X>]$address",
"Reset functions\n"
"Reset MPLS statistical information\n"
"Clear LDP state\n"
@@ -809,19 +515,12 @@ DEFUN (ldp_clear_mpls_ldp_neighbor,
"IPv4 address\n"
"IPv6 address\n")
{
- int idx = 0;
- const char *address = NULL;
-
- if (argv_find(argv, argc, "A.B.C.D", &idx) ||
- argv_find(argv, argc, "X:X::X:X", &idx))
- address = argv[idx]->arg;
-
- return (ldp_vty_clear_nbr(vty, address));
+ return (ldp_vty_clear_nbr(vty, address_str));
}
-DEFUN (ldp_debug_mpls_ldp_discovery_hello,
+DEFPY (ldp_debug_mpls_ldp_discovery_hello,
ldp_debug_mpls_ldp_discovery_hello_cmd,
- "[no] debug mpls ldp discovery hello <recv|sent>",
+ "[no] debug mpls ldp discovery hello <recv|sent>$dir",
"Negate a command or set its defaults\n"
"Debugging functions\n"
"MPLS information\n"
@@ -831,21 +530,12 @@ DEFUN (ldp_debug_mpls_ldp_discovery_hello,
"Received messages\n"
"Sent messages\n")
{
- int idx = 0;
- int negate = 0;
- const char *dir;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "hello", &idx);
- dir = argv[idx + 1]->text;
-
- return (ldp_vty_debug(vty, negate, "discovery", dir, 0));
+ return (ldp_vty_debug(vty, no, "discovery", dir, NULL));
}
-DEFUN (ldp_debug_mpls_ldp_type,
+DEFPY (ldp_debug_mpls_ldp_type,
ldp_debug_mpls_ldp_type_cmd,
- "[no] debug mpls ldp <errors|event|zebra>",
+ "[no] debug mpls ldp <errors|event|zebra>$type",
"Negate a command or set its defaults\n"
"Debugging functions\n"
"MPLS information\n"
@@ -854,21 +544,12 @@ DEFUN (ldp_debug_mpls_ldp_type,
"LDP event information\n"
"LDP zebra information\n")
{
- int idx = 0;
- int negate = 0;
- const char *type;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- argv_find(argv, argc, "ldp", &idx);
- type = argv[idx + 1]->text;
-
- return (ldp_vty_debug(vty, negate, type, NULL, 0));
+ return (ldp_vty_debug(vty, no, type, NULL, NULL));
}
-DEFUN (ldp_debug_mpls_ldp_messages_recv,
+DEFPY (ldp_debug_mpls_ldp_messages_recv,
ldp_debug_mpls_ldp_messages_recv_cmd,
- "[no] debug mpls ldp messages recv [all]",
+ "[no] debug mpls ldp messages recv [all]$all",
"Negate a command or set its defaults\n"
"Debugging functions\n"
"MPLS information\n"
@@ -877,21 +558,12 @@ DEFUN (ldp_debug_mpls_ldp_messages_recv,
"Received messages, excluding periodic Keep Alives\n"
"Received messages, including periodic Keep Alives\n")
{
- int idx = 0;
- int negate = 0;
- int all = 0;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- if (argv_find(argv, argc, "all", &idx))
- all = 1;
-
- return (ldp_vty_debug(vty, negate, "messages", "recv", all));
+ return (ldp_vty_debug(vty, no, "messages", "recv", all));
}
-DEFUN (ldp_debug_mpls_ldp_messages_sent,
+DEFPY (ldp_debug_mpls_ldp_messages_sent,
ldp_debug_mpls_ldp_messages_sent_cmd,
- "[no] debug mpls ldp messages sent [all]",
+ "[no] debug mpls ldp messages sent [all]$all",
"Negate a command or set its defaults\n"
"Debugging functions\n"
"MPLS information\n"
@@ -900,21 +572,12 @@ DEFUN (ldp_debug_mpls_ldp_messages_sent,
"Sent messages, excluding periodic Keep Alives\n"
"Sent messages, including periodic Keep Alives\n")
{
- int idx = 0;
- int negate = 0;
- int all = 0;
-
- if (argv_find(argv, argc, "no", &idx))
- negate = 1;
- if (argv_find(argv, argc, "all", &idx))
- all = 1;
-
- return (ldp_vty_debug(vty, negate, "messages", "sent", all));
+ return (ldp_vty_debug(vty, no, "messages", "sent", all));
}
-DEFUN (ldp_show_mpls_ldp_binding,
+DEFPY (ldp_show_mpls_ldp_binding,
ldp_show_mpls_ldp_binding_cmd,
- "show mpls ldp [<ipv4|ipv6>] binding [detail] [json]",
+ "show mpls ldp [<ipv4|ipv6>]$af binding [detail]$detail [json]$json",
"Show running system information\n"
"MPLS information\n"
"Label Distribution Protocol\n"
@@ -924,25 +587,12 @@ DEFUN (ldp_show_mpls_ldp_binding,
"Show detailed information\n"
"JavaScript Object Notation\n")
{
- int idx = 0;
- const char *af = NULL;
- int detail = 0;
- int json = 0;
-
- if (argv_find(argv, argc, "ipv4", &idx) ||
- argv_find(argv, argc, "ipv6", &idx))
- af = argv[idx]->text;
- if (argv_find(argv, argc, "detail", &idx))
- detail = 1;
- if (argv_find(argv, argc, "json", &idx))
- json = 1;
-
return (ldp_vty_show_binding(vty, af, detail, json));
}
-DEFUN (ldp_show_mpls_ldp_discovery,
+DEFPY (ldp_show_mpls_ldp_discovery,
ldp_show_mpls_ldp_discovery_cmd,
- "show mpls ldp [<ipv4|ipv6>] discovery [detail] [json]",
+ "show mpls ldp [<ipv4|ipv6>]$af discovery [detail]$detail [json]$json",
"Show running system information\n"
"MPLS information\n"
"Label Distribution Protocol\n"
@@ -952,25 +602,12 @@ DEFUN (ldp_show_mpls_ldp_discovery,
"Show detailed information\n"
"JavaScript Object Notation\n")
{
- int idx = 0;
- const char *af = NULL;
- int detail = 0;
- int json = 0;
-
- if (argv_find(argv, argc, "ipv4", &idx) ||
- argv_find(argv, argc, "ipv6", &idx))
- af = argv[idx]->text;
- if (argv_find(argv, argc, "detail", &idx))
- detail = 1;
- if (argv_find(argv, argc, "json", &idx))
- json = 1;
-
return (ldp_vty_show_discovery(vty, af, detail, json));
}
-DEFUN (ldp_show_mpls_ldp_interface,
+DEFPY (ldp_show_mpls_ldp_interface,
ldp_show_mpls_ldp_interface_cmd,
- "show mpls ldp [<ipv4|ipv6>] interface [json]",
+ "show mpls ldp [<ipv4|ipv6>]$af interface [json]$json",
"Show running system information\n"
"MPLS information\n"
"Label Distribution Protocol\n"
@@ -979,40 +616,24 @@ DEFUN (ldp_show_mpls_ldp_interface,
"interface information\n"
"JavaScript Object Notation\n")
{
- int idx = 0;
- const char *af = NULL;
- int json = 0;
-
- if (argv_find(argv, argc, "ipv4", &idx) ||
- argv_find(argv, argc, "ipv6", &idx))
- af = argv[idx]->text;
- if (argv_find(argv, argc, "json", &idx))
- json = 1;
-
return (ldp_vty_show_interface(vty, af, json));
}
-DEFUN (ldp_show_mpls_ldp_capabilities,
+DEFPY (ldp_show_mpls_ldp_capabilities,
ldp_show_mpls_ldp_capabilities_cmd,
- "show mpls ldp capabilities [json]",
+ "show mpls ldp capabilities [json]$json",
"Show running system information\n"
"MPLS information\n"
"Label Distribution Protocol\n"
"Display LDP Capabilities information\n"
"JavaScript Object Notation\n")
{
- int idx = 0;
- int json = 0;
-
- if (argv_find(argv, argc, "json", &idx))
- json = 1;
-
return (ldp_vty_show_capabilities(vty, json));
}
-DEFUN (ldp_show_mpls_ldp_neighbor,
+DEFPY (ldp_show_mpls_ldp_neighbor,
ldp_show_mpls_ldp_neighbor_cmd,
- "show mpls ldp neighbor [detail] [json]",
+ "show mpls ldp neighbor [detail]$detail [json]$json",
"Show running system information\n"
"MPLS information\n"
"Label Distribution Protocol\n"
@@ -1020,21 +641,12 @@ DEFUN (ldp_show_mpls_ldp_neighbor,
"Show detailed information\n"
"JavaScript Object Notation\n")
{
- int idx = 0;
- int detail = 0;
- int json = 0;
-
- if (argv_find(argv, argc, "detail", &idx))
- detail = 1;
- if (argv_find(argv, argc, "json", &idx))
- json = 1;
-
return (ldp_vty_show_neighbor(vty, 0, detail, json));
}
-DEFUN (ldp_show_mpls_ldp_neighbor_capabilities,
+DEFPY (ldp_show_mpls_ldp_neighbor_capabilities,
ldp_show_mpls_ldp_neighbor_capabilities_cmd,
- "show mpls ldp neighbor capabilities [json]",
+ "show mpls ldp neighbor capabilities [json]$json",
"Show running system information\n"
"MPLS information\n"
"Label Distribution Protocol\n"
@@ -1042,52 +654,34 @@ DEFUN (ldp_show_mpls_ldp_neighbor_capabilities,
"Display neighbor capability information\n"
"JavaScript Object Notation\n")
{
- int idx = 0;
- int json = 0;
-
- if (argv_find(argv, argc, "json", &idx))
- json = 1;
-
- return (ldp_vty_show_neighbor(vty, 1, 0, json));
+ return (ldp_vty_show_neighbor(vty, 1, NULL, json));
}
-DEFUN (ldp_show_l2vpn_atom_binding,
+DEFPY (ldp_show_l2vpn_atom_binding,
ldp_show_l2vpn_atom_binding_cmd,
- "show l2vpn atom binding [json]",
+ "show l2vpn atom binding [json]$json",
"Show running system information\n"
"Show information about Layer2 VPN\n"
"Show Any Transport over MPLS information\n"
"Show AToM label binding information\n"
"JavaScript Object Notation\n")
{
- int idx = 0;
- int json = 0;
-
- if (argv_find(argv, argc, "json", &idx))
- json = 1;
-
return (ldp_vty_show_atom_binding(vty, json));
}
-DEFUN (ldp_show_l2vpn_atom_vc,
+DEFPY (ldp_show_l2vpn_atom_vc,
ldp_show_l2vpn_atom_vc_cmd,
- "show l2vpn atom vc [json]",
+ "show l2vpn atom vc [json]$json",
"Show running system information\n"
"Show information about Layer2 VPN\n"
"Show Any Transport over MPLS information\n"
"Show AToM virtual circuit information\n"
"JavaScript Object Notation\n")
{
- int idx = 0;
- int json = 0;
-
- if (argv_find(argv, argc, "json", &idx))
- json = 1;
-
return (ldp_vty_show_atom_vc(vty, json));
}
-DEFUN (ldp_show_debugging_mpls_ldp,
+DEFPY (ldp_show_debugging_mpls_ldp,
ldp_show_debugging_mpls_ldp_cmd,
"show debugging mpls ldp",
"Show running system information\n"
diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c
index 2dbc5757d..e938582d0 100644
--- a/ldpd/ldp_vty_conf.c
+++ b/ldpd/ldp_vty_conf.c
@@ -407,9 +407,9 @@ ldp_iface_is_configured(struct ldpd_conf *xconf, const char *ifname)
}
int
-ldp_vty_mpls_ldp(struct vty *vty, int disable)
+ldp_vty_mpls_ldp(struct vty *vty, const char *negate)
{
- if (disable)
+ if (negate)
vty_conf->flags &= ~F_LDPD_ENABLED;
else {
vty->node = LDP_NODE;
@@ -422,7 +422,7 @@ ldp_vty_mpls_ldp(struct vty *vty, int disable)
}
int
-ldp_vty_address_family(struct vty *vty, int disable, const char *af_str)
+ldp_vty_address_family(struct vty *vty, const char *negate, const char *af_str)
{
struct ldpd_af_conf *af_conf;
int af;
@@ -436,7 +436,7 @@ ldp_vty_address_family(struct vty *vty, int disable, const char *af_str)
} else
return (CMD_WARNING_CONFIG_FAILED);
- if (disable) {
+ if (negate) {
af_conf->flags &= ~F_LDPD_AF_ENABLED;
ldp_config_apply(vty, vty_conf);
return (CMD_SUCCESS);
@@ -460,23 +460,15 @@ ldp_vty_address_family(struct vty *vty, int disable, const char *af_str)
}
int
-ldp_vty_disc_holdtime(struct vty *vty, int disable, const char *hello_type_str,
- const char *seconds_str)
+ldp_vty_disc_holdtime(struct vty *vty, const char *negate,
+ const char *hello_type_str, long secs)
{
struct ldpd_af_conf *af_conf;
struct iface *iface;
struct iface_af *ia;
int af;
- char *ep;
- long int secs;
enum hello_type hello_type;
- secs = strtol(seconds_str, &ep, 10);
- if (*ep != '\0' || secs < MIN_HOLDTIME || secs > MAX_HOLDTIME) {
- vty_out (vty, "%% Invalid holdtime\n");
- return (CMD_WARNING_CONFIG_FAILED);
- }
-
if (hello_type_str[0] == 'h')
hello_type = HELLO_LINK;
else
@@ -484,7 +476,7 @@ ldp_vty_disc_holdtime(struct vty *vty, int disable, const char *hello_type_str,
switch (vty->node) {
case LDP_NODE:
- if (disable) {
+ if (negate) {
switch (hello_type) {
case HELLO_LINK:
vty_conf->lhello_holdtime = LINK_DFLT_HOLDTIME;
@@ -511,7 +503,7 @@ ldp_vty_disc_holdtime(struct vty *vty, int disable, const char *hello_type_str,
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable) {
+ if (negate) {
switch (hello_type) {
case HELLO_LINK:
af_conf->lhello_holdtime = 0;
@@ -539,7 +531,7 @@ ldp_vty_disc_holdtime(struct vty *vty, int disable, const char *hello_type_str,
VTY_CHECK_CONTEXT(iface);
ia = iface_af_get(iface, af);
- if (disable)
+ if (negate)
ia->hello_holdtime = 0;
else
ia->hello_holdtime = secs;
@@ -554,24 +546,15 @@ ldp_vty_disc_holdtime(struct vty *vty, int disable, const char *hello_type_str,
}
int
-ldp_vty_disc_interval(struct vty *vty, int disable, const char *hello_type_str,
- const char *seconds_str)
+ldp_vty_disc_interval(struct vty *vty, const char *negate,
+ const char *hello_type_str, long secs)
{
struct ldpd_af_conf *af_conf;
struct iface *iface;
struct iface_af *ia;
int af;
- char *ep;
- long int secs;
enum hello_type hello_type;
- secs = strtol(seconds_str, &ep, 10);
- if (*ep != '\0' || secs < MIN_HELLO_INTERVAL ||
- secs > MAX_HELLO_INTERVAL) {
- vty_out (vty, "%% Invalid interval\n");
- return (CMD_WARNING_CONFIG_FAILED);
- }
-
if (hello_type_str[0] == 'h')
hello_type = HELLO_LINK;
else
@@ -579,7 +562,7 @@ ldp_vty_disc_interval(struct vty *vty, int disable, const char *hello_type_str,
switch (vty->node) {
case LDP_NODE:
- if (disable) {
+ if (negate) {
switch (hello_type) {
case HELLO_LINK:
vty_conf->lhello_interval =
@@ -607,7 +590,7 @@ ldp_vty_disc_interval(struct vty *vty, int disable, const char *hello_type_str,
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable) {
+ if (negate) {
switch (hello_type) {
case HELLO_LINK:
af_conf->lhello_interval = 0;
@@ -635,7 +618,7 @@ ldp_vty_disc_interval(struct vty *vty, int disable, const char *hello_type_str,
VTY_CHECK_CONTEXT(iface);
ia = iface_af_get(iface, af);
- if (disable)
+ if (negate)
ia->hello_interval = 0;
else
ia->hello_interval = secs;
@@ -650,7 +633,7 @@ ldp_vty_disc_interval(struct vty *vty, int disable, const char *hello_type_str,
}
int
-ldp_vty_targeted_hello_accept(struct vty *vty, int disable,
+ldp_vty_targeted_hello_accept(struct vty *vty, const char *negate,
const char *acl_from_str)
{
struct ldpd_af_conf *af_conf;
@@ -659,7 +642,7 @@ ldp_vty_targeted_hello_accept(struct vty *vty, int disable,
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable) {
+ if (negate) {
af_conf->flags &= ~F_LDPD_AF_THELLO_ACCEPT;
af_conf->acl_thello_accept_from[0] = '\0';
} else {
@@ -677,29 +660,19 @@ ldp_vty_targeted_hello_accept(struct vty *vty, int disable,
}
int
-ldp_vty_nbr_session_holdtime(struct vty *vty, int disable,
- const char *lsr_id_str, const char *seconds_str)
+ldp_vty_nbr_session_holdtime(struct vty *vty, const char *negate,
+ struct in_addr lsr_id, long secs)
{
- char *ep;
- long int secs;
- struct in_addr lsr_id;
struct nbr_params *nbrp;
- if (inet_pton(AF_INET, lsr_id_str, &lsr_id) != 1 ||
- bad_addr_v4(lsr_id)) {
+ if (bad_addr_v4(lsr_id)) {
vty_out (vty, "%% Malformed address\n");
return (CMD_WARNING_CONFIG_FAILED);
}
- secs = strtol(seconds_str, &ep, 10);
- if (*ep != '\0' || secs < MIN_KEEPALIVE || secs > MAX_KEEPALIVE) {
- vty_out (vty, "%% Invalid holdtime\n");
- return (CMD_SUCCESS);
- }
-
nbrp = nbr_params_find(vty_conf, lsr_id);
- if (disable) {
+ if (negate) {
if (nbrp == NULL)
return (CMD_SUCCESS);
@@ -723,24 +696,15 @@ ldp_vty_nbr_session_holdtime(struct vty *vty, int disable,
}
int
-ldp_vty_af_session_holdtime(struct vty *vty, int disable,
- const char *seconds_str)
+ldp_vty_af_session_holdtime(struct vty *vty, const char *negate, long secs)
{
struct ldpd_af_conf *af_conf;
int af;
- char *ep;
- long int secs;
-
- secs = strtol(seconds_str, &ep, 10);
- if (*ep != '\0' || secs < MIN_KEEPALIVE || secs > MAX_KEEPALIVE) {
- vty_out (vty, "%% Invalid holdtime\n");
- return (CMD_SUCCESS);
- }
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable)
+ if (negate)
af_conf->keepalive = DEFAULT_KEEPALIVE;
else
af_conf->keepalive = secs;
@@ -751,7 +715,7 @@ ldp_vty_af_session_holdtime(struct vty *vty, int disable,
}
int
-ldp_vty_interface(struct vty *vty, int disable, const char *ifname)
+ldp_vty_interface(struct vty *vty, const char *negate, const char *ifname)
{
int af;
struct iface *iface;
@@ -760,7 +724,7 @@ ldp_vty_interface(struct vty *vty, int disable, const char *ifname)
af = ldp_vty_get_af(vty);
iface = if_lookup_name(vty_conf, ifname);
- if (disable) {
+ if (negate) {
if (iface == NULL)
return (CMD_SUCCESS);
@@ -813,7 +777,7 @@ ldp_vty_interface(struct vty *vty, int disable, const char *ifname)
}
int
-ldp_vty_trans_addr(struct vty *vty, int disable, const char *addr_str)
+ldp_vty_trans_addr(struct vty *vty, const char *negate, const char *addr_str)
{
struct ldpd_af_conf *af_conf;
int af;
@@ -821,7 +785,7 @@ ldp_vty_trans_addr(struct vty *vty, int disable, const char *addr_str)
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable)
+ if (negate)
memset(&af_conf->trans_addr, 0, sizeof(af_conf->trans_addr));
else {
if (inet_pton(af, addr_str, &af_conf->trans_addr) != 1 ||
@@ -837,7 +801,7 @@ ldp_vty_trans_addr(struct vty *vty, int disable, const char *addr_str)
}
int
-ldp_vty_neighbor_targeted(struct vty *vty, int disable, const char *addr_str)
+ldp_vty_neighbor_targeted(struct vty *vty, const char *negate, const char *addr_str)
{
int af;
union ldpd_addr addr;
@@ -857,7 +821,7 @@ ldp_vty_neighbor_targeted(struct vty *vty, int disable, const char *addr_str)
tnbr = tnbr_find(vty_conf, af, &addr);
- if (disable) {
+ if (negate) {
if (tnbr == NULL)
return (CMD_SUCCESS);
@@ -884,7 +848,7 @@ ldp_vty_neighbor_targeted(struct vty *vty, int disable, const char *addr_str)
}
int
-ldp_vty_label_advertise(struct vty *vty, int disable, const char *acl_to_str,
+ldp_vty_label_advertise(struct vty *vty, const char *negate, const char *acl_to_str,
const char *acl_for_str)
{
struct ldpd_af_conf *af_conf;
@@ -893,7 +857,7 @@ ldp_vty_label_advertise(struct vty *vty, int disable, const char *acl_to_str,
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable) {
+ if (negate) {
af_conf->acl_label_advertise_to[0] = '\0';
af_conf->acl_label_advertise_for[0] = '\0';
} else {
@@ -915,7 +879,7 @@ ldp_vty_label_advertise(struct vty *vty, int disable, const char *acl_to_str,
}
int
-ldp_vty_label_allocate(struct vty *vty, int disable, int host_routes,
+ldp_vty_label_allocate(struct vty *vty, const char *negate, const char *host_routes,
const char *acl_for_str)
{
struct ldpd_af_conf *af_conf;
@@ -926,7 +890,7 @@ ldp_vty_label_allocate(struct vty *vty, int disable, int host_routes,
af_conf->flags &= ~F_LDPD_AF_ALLOCHOSTONLY;
af_conf->acl_label_allocate_for[0] = '\0';
- if (!disable) {
+ if (!negate) {
if (host_routes)
af_conf->flags |= F_LDPD_AF_ALLOCHOSTONLY;
else
@@ -940,7 +904,7 @@ ldp_vty_label_allocate(struct vty *vty, int disable, int host_routes,
}
int
-ldp_vty_label_expnull(struct vty *vty, int disable, const char *acl_for_str)
+ldp_vty_label_expnull(struct vty *vty, const char *negate, const char *acl_for_str)
{
struct ldpd_af_conf *af_conf;
int af;
@@ -948,7 +912,7 @@ ldp_vty_label_expnull(struct vty *vty, int disable, const char *acl_for_str)
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable) {
+ if (negate) {
af_conf->flags &= ~F_LDPD_AF_EXPNULL;
af_conf->acl_label_expnull_for[0] = '\0';
} else {
@@ -966,7 +930,7 @@ ldp_vty_label_expnull(struct vty *vty, int disable, const char *acl_for_str)
}
int
-ldp_vty_label_accept(struct vty *vty, int disable, const char *acl_from_str,
+ldp_vty_label_accept(struct vty *vty, const char *negate, const char *acl_from_str,
const char *acl_for_str)
{
struct ldpd_af_conf *af_conf;
@@ -975,7 +939,7 @@ ldp_vty_label_accept(struct vty *vty, int disable, const char *acl_from_str,
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable) {
+ if (negate) {
af_conf->acl_label_accept_from[0] = '\0';
af_conf->acl_label_accept_for[0] = '\0';
} else {
@@ -997,7 +961,7 @@ ldp_vty_label_accept(struct vty *vty, int disable, const char *acl_from_str,
}
int
-ldp_vty_ttl_security(struct vty *vty, int disable)
+ldp_vty_ttl_security(struct vty *vty, const char *negate)
{
struct ldpd_af_conf *af_conf;
int af;
@@ -1005,7 +969,7 @@ ldp_vty_ttl_security(struct vty *vty, int disable)
af = ldp_vty_get_af(vty);
af_conf = ldp_af_conf_get(vty_conf, af);
- if (disable)
+ if (negate)
af_conf->flags &= ~F_LDPD_AF_NO_GTSM;
else
af_conf->flags |= F_LDPD_AF_NO_GTSM;
@@ -1016,16 +980,16 @@ ldp_vty_ttl_security(struct vty *vty, int disable)
}
int
-ldp_vty_router_id(struct vty *vty, int disable, const char *addr_str)
+ldp_vty_router_id(struct vty *vty, const char *negate, struct in_addr address)
{
- if (disable)
+ if (negate)
vty_conf->rtr_id.s_addr = INADDR_ANY;
else {
- if (inet_pton(AF_INET, addr_str, &vty_conf->rtr_id) != 1 ||
- bad_addr_v4(vty_conf->rtr_id)) {
+ if (bad_addr_v4(address)) {
vty_out (vty, "%% Malformed address\n");
return (CMD_SUCCESS);
}
+ vty_conf->rtr_id = address;
}
ldp_config_apply(vty, vty_conf);
@@ -1034,9 +998,9 @@ ldp_vty_router_id(struct vty *vty, int disable, const char *addr_str)
}
int
-ldp_vty_ds_cisco_interop(struct vty *vty, int disable)
+ldp_vty_ds_cisco_interop(struct vty *vty, const char * negate)
{
- if (disable)
+ if (negate)
vty_conf->flags &= ~F_LDPD_DS_CISCO_INTEROP;
else
vty_conf->flags |= F_LDPD_DS_CISCO_INTEROP;
@@ -1047,9 +1011,9 @@ ldp_vty_ds_cisco_interop(struct vty *vty, int disable)
}
int
-ldp_vty_trans_pref_ipv4(struct vty *vty, int disable)
+ldp_vty_trans_pref_ipv4(struct vty *vty, const char *negate)
{
- if (disable)
+ if (negate)
vty_conf->trans_pref = DUAL_STACK_LDPOV6;
else
vty_conf->trans_pref = DUAL_STACK_LDPOV4;
@@ -1060,22 +1024,20 @@ ldp_vty_trans_pref_ipv4(struct vty *vty, int disable)
}
int
-ldp_vty_neighbor_password(struct vty *vty, int disable, const char *lsr_id_str,
+ldp_vty_neighbor_password(struct vty *vty, const char *negate, struct in_addr lsr_id,
const char *password_str)
{
- struct in_addr lsr_id;
size_t password_len;
struct nbr_params *nbrp;
- if (inet_pton(AF_INET, lsr_id_str, &lsr_id) != 1 ||
- bad_addr_v4(lsr_id)) {
+ if (bad_addr_v4(lsr_id)) {
vty_out (vty, "%% Malformed address\n");
return (CMD_WARNING_CONFIG_FAILED);
}
nbrp = nbr_params_find(vty_conf, lsr_id);
- if (disable) {
+ if (negate) {
if (nbrp == NULL)
return (CMD_SUCCESS);
@@ -1105,16 +1067,14 @@ ldp_vty_neighbor_password(struct vty *vty, int disable, const char *lsr_id_str,
}
int
-ldp_vty_neighbor_ttl_security(struct vty *vty, int disable,
- const char *lsr_id_str, const char *hops_str)
+ldp_vty_neighbor_ttl_security(struct vty *vty, const char *negate,
+ struct in_addr lsr_id, const char *hops_str)
{
- struct in_addr lsr_id;
struct nbr_params *nbrp;
long int hops = 0;
char *ep;
- if (inet_pton(AF_INET, lsr_id_str, &lsr_id) != 1 ||
- bad_addr_v4(lsr_id)) {
+ if (bad_addr_v4(lsr_id)) {
vty_out (vty, "%% Malformed address\n");
return (CMD_WARNING_CONFIG_FAILED);
}
@@ -1129,7 +1089,7 @@ ldp_vty_neighbor_ttl_security(struct vty *vty, int disable,
nbrp = nbr_params_find(vty_conf, lsr_id);
- if (disable) {
+ if (negate) {
if (nbrp == NULL)
return (CMD_SUCCESS);
@@ -1159,7 +1119,7 @@ ldp_vty_neighbor_ttl_security(struct vty *vty, int disable,
}
int
-ldp_vty_l2vpn(struct vty *vty, int disable, const char *name_str)
+ldp_vty_l2vpn(struct vty *vty, const char *negate, const char *name_str)
{
struct l2vpn *l2vpn;
struct l2vpn_if *lif;
@@ -1167,7 +1127,7 @@ ldp_vty_l2vpn(struct vty *vty, int disable, const char *name_str)
l2vpn = l2vpn_find(vty_conf, name_str);
- if (disable) {
+ if (negate) {
if (l2vpn == NULL)
return (CMD_SUCCESS);
@@ -1204,11 +1164,11 @@ ldp_vty_l2vpn(struct vty *vty, int disable, const char *name_str)
}
int
-ldp_vty_l2vpn_bridge(struct vty *vty, int disable, const char *ifname)
+ldp_vty_l2vpn_bridge(struct vty *vty, const char *negate, const char *ifname)
{
VTY_DECLVAR_CONTEXT(l2vpn, l2vpn);
- if (disable)
+ if (negate)
memset(l2vpn->br_ifname, 0, sizeof(l2vpn->br_ifname));
else
strlcpy(l2vpn->br_ifname, ifname, sizeof(l2vpn->br_ifname));
@@ -1219,19 +1179,11 @@ ldp_vty_l2vpn_bridge(struct vty *vty, int disable, const char *ifname)
}
int
-ldp_vty_l2vpn_mtu(struct vty *vty, int disable, const char *mtu_str)
+ldp_vty_l2vpn_mtu(struct vty *vty, const char *negate, long mtu)
{
VTY_DECLVAR_CONTEXT(l2vpn, l2vpn);
- char *ep;
- int mtu;
-
- mtu = strtol(mtu_str, &ep, 10);
- if (*ep != '\0' || mtu < MIN_L2VPN_MTU || mtu > MAX_L2VPN_MTU) {
- vty_out (vty, "%% Invalid MTU\n");
- return (CMD_WARNING_CONFIG_FAILED);
- }
- if (disable)
+ if (negate)
l2vpn->mtu = DEFAULT_L2VPN_MTU;
else
l2vpn->mtu = mtu;
@@ -1242,7 +1194,7 @@ ldp_vty_l2vpn_mtu(struct vty *vty, int disable, const char *mtu_str)
}
int
-ldp_vty_l2vpn_pwtype(struct vty *vty, int disable, const char *type_str)
+ldp_vty_l2vpn_pwtype(struct vty *vty, const char *negate, const char *type_str)
{
VTY_DECLVAR_CONTEXT(l2vpn, l2vpn);
int pw_type;
@@ -1252,7 +1204,7 @@ ldp_vty_l2vpn_pwtype(struct vty *vty, int disable, const char *type_str)
else
pw_type = PW_TYPE_ETHERNET_TAGGED;
- if (disable)
+ if (negate)
l2vpn->pw_type = DEFAULT_PW_TYPE;
else
l2vpn->pw_type = pw_type;
@@ -1263,14 +1215,14 @@ ldp_vty_l2vpn_pwtype(struct vty *vty, int disable, const char *type_str)
}
int
-ldp_vty_l2vpn_interface(struct vty *vty, int disable, const char *ifname)
+ldp_vty_l2vpn_interface(struct vty *vty, const char *negate, const char *ifname)
{
VTY_DECLVAR_CONTEXT(l2vpn, l2vpn);
struct l2vpn_if *lif;
lif = l2vpn_if_find(l2vpn, ifname);
- if (disable) {
+ if (negate) {
if (lif == NULL)
return (CMD_SUCCESS);
@@ -1301,14 +1253,14 @@ ldp_vty_l2vpn_interface(struct vty *vty, int disable, const char *ifname)
}
int
-ldp_vty_l2vpn_pseudowire(struct vty *vty, int disable, const char *ifname)
+ldp_vty_l2vpn_pseudowire(struct vty *vty, const char *negate, const char *ifname)
{
VTY_DECLVAR_CONTEXT(l2vpn, l2vpn);
struct l2vpn_pw *pw;
pw = l2vpn_pw_find(l2vpn, ifname);
- if (disable) {
+ if (negate) {
if (pw == NULL)
return (CMD_SUCCESS);
@@ -1347,11 +1299,11 @@ ldp_vty_l2vpn_pseudowire(struct vty *vty, int disable, const char *ifname)
}
int
-ldp_vty_l2vpn_pw_cword(struct vty *vty, int disable, const char *preference_str)
+ldp_vty_l2vpn_pw_cword(struct vty *vty, const char *negate, const char *preference_str)
{
VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw, pw);
- if (disable)
+ if (negate)
pw->flags |= F_PW_CWORD_CONF;
else {
if (preference_str[0] == 'e')
@@ -1366,7 +1318,7 @@ ldp_vty_l2vpn_pw_cword(struct vty *vty, int disable, const char *preference_str)
}
int
-ldp_vty_l2vpn_pw_nbr_addr(struct vty *vty, int disable, const char *addr_str)
+ldp_vty_l2vpn_pw_nbr_addr(struct vty *vty, const char *negate, const char *addr_str)
{
VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw, pw);
int af;
@@ -1378,7 +1330,7 @@ ldp_vty_l2vpn_pw_nbr_addr(struct vty *vty, int disable, const char *addr_str)
return (CMD_WARNING_CONFIG_FAILED);
}
- if (disable) {
+ if (negate) {
pw->af = AF_UNSPEC;
memset(&pw->addr, 0, sizeof(pw->addr));
pw->flags &= ~F_PW_STATIC_NBR_ADDR;
@@ -1394,18 +1346,16 @@ ldp_vty_l2vpn_pw_nbr_addr(struct vty *vty, int disable, const char *addr_str)
}
int
-ldp_vty_l2vpn_pw_nbr_id(struct vty *vty, int disable, const char *lsr_id_str)
+ldp_vty_l2vpn_pw_nbr_id(struct vty *vty, const char *negate, struct in_addr lsr_id)
{
VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw, pw);
- struct in_addr lsr_id;
- if (inet_pton(AF_INET, lsr_id_str, &lsr_id) != 1 ||
- bad_addr_v4(lsr_id)) {
+ if (bad_addr_v4(lsr_id)) {
vty_out (vty, "%% Malformed address\n");
return (CMD_WARNING_CONFIG_FAILED);
}
- if (disable)
+ if (negate)
pw->lsr_id.s_addr = INADDR_ANY;
else
pw->lsr_id = lsr_id;
@@ -1416,19 +1366,11 @@ ldp_vty_l2vpn_pw_nbr_id(struct vty *vty, int disable, const char *lsr_id_str)
}
int
-ldp_vty_l2vpn_pw_pwid(struct vty *vty, int disable, const char *pwid_str)
+ldp_vty_l2vpn_pw_pwid(struct vty *vty, const char *negate, long pwid)
{
VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw, pw);
- char *ep;
- uint32_t pwid;
-
- pwid = strtol(pwid_str, &ep, 10);
- if (*ep != '\0' || pwid < MIN_PWID_ID || pwid > MAX_PWID_ID) {
- vty_out (vty, "%% Invalid pw-id\n");
- return (CMD_WARNING_CONFIG_FAILED);
- }
- if (disable)
+ if (negate)
pw->pwid = 0;
else
pw->pwid = pwid;
@@ -1439,11 +1381,11 @@ ldp_vty_l2vpn_pw_pwid(struct vty *vty, int disable, const char *pwid_str)
}
int
-ldp_vty_l2vpn_pw_pwstatus(struct vty *vty, int disable)
+ldp_vty_l2vpn_pw_pwstatus(struct vty *vty, const char *negate)
{
VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw, pw);
- if (disable)
+ if (negate)
pw->flags |= F_PW_STATUSTLV_CONF;
else
pw->flags &= ~F_PW_STATUSTLV_CONF;
diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c
index bec1375bd..ad5e79c72 100644
--- a/ldpd/ldp_vty_exec.c
+++ b/ldpd/ldp_vty_exec.c
@@ -1565,7 +1565,7 @@ ldp_vty_get_af(const char *str, int *af)
}
int
-ldp_vty_show_binding(struct vty *vty, const char *af_str, int detail, int json)
+ldp_vty_show_binding(struct vty *vty, const char *af_str, const char *detail, const char *json)
{
struct imsgbuf ibuf;
struct show_params params;
@@ -1579,8 +1579,8 @@ ldp_vty_show_binding(struct vty *vty, const char *af_str, int detail, int json)
memset(&params, 0, sizeof(params));
params.family = af;
- params.detail = detail;
- params.json = json;
+ params.detail = (detail) ? 1 : 0;
+ params.json = (json) ? 1 : 0;
if (!params.detail && !params.json)
vty_out (vty, "%-4s %-20s %-15s %-11s %-13s %6s\n", "AF",
@@ -1592,8 +1592,8 @@ ldp_vty_show_binding(struct vty *vty, const char *af_str, int detail, int json)
}
int
-ldp_vty_show_discovery(struct vty *vty, const char *af_str, int detail,
- int json)
+ldp_vty_show_discovery(struct vty *vty, const char *af_str, const char *detail,
+ const char *json)
{
struct imsgbuf ibuf;
struct show_params params;
@@ -1607,8 +1607,8 @@ ldp_vty_show_discovery(struct vty *vty, const char *af_str, int detail,
memset(&params, 0, sizeof(params));
params.family = af;
- params.detail = detail;
- params.json = json;
+ params.detail = (detail) ? 1 : 0;
+ params.json = (json) ? 1 : 0;
if (!params.detail && !params.json)
vty_out (vty, "%-4s %-15s %-8s %-15s %9s\n",
@@ -1623,7 +1623,7 @@ ldp_vty_show_discovery(struct vty *vty, const char *af_str, int detail,
}
int
-ldp_vty_show_interface(struct vty *vty, const char *af_str, int json)
+ldp_vty_show_interface(struct vty *vty, const char *af_str, const char *json)
{
struct imsgbuf ibuf;
struct show_params params;
@@ -1638,7 +1638,7 @@ ldp_vty_show_interface(struct vty *vty, const char *af_str, int json)
memset(&params, 0, sizeof(params));
params.family = af;
- params.json = json;
+ params.json = (json) ? 1 : 0;
/* header */
if (!params.json) {
@@ -1652,7 +1652,7 @@ ldp_vty_show_interface(struct vty *vty, const char *af_str, int json)
}
int
-ldp_vty_show_capabilities(struct vty *vty, int json)
+ldp_vty_show_capabilities(struct vty *vty, const char *json)
{
if (json) {
json_object *json;
@@ -1703,7 +1703,7 @@ ldp_vty_show_capabilities(struct vty *vty, int json)
}
int
-ldp_vty_show_neighbor(struct vty *vty, int capabilities, int detail, int json)
+ldp_vty_show_neighbor(struct vty *vty, int capabilities, const char *detail, const char *json)
{
struct imsgbuf ibuf;
struct show_params params;
@@ -1713,8 +1713,8 @@ ldp_vty_show_neighbor(struct vty *vty, int capabilities, int detail, int json)
memset(&params, 0, sizeof(params));
params.capabilities = capabilities;
- params.detail = detail;
- params.json = json;
+ params.detail = (detail) ? 1 : 0;
+ params.json = (json) ? 1 : 0;
if (params.capabilities)
params.detail = 1;
@@ -1728,7 +1728,7 @@ ldp_vty_show_neighbor(struct vty *vty, int capabilities, int detail, int json)
}
int
-ldp_vty_show_atom_binding(struct vty *vty, int json)
+ldp_vty_show_atom_binding(struct vty *vty, const char *json)
{
struct imsgbuf ibuf;
struct show_params params;
@@ -1737,14 +1737,14 @@ ldp_vty_show_atom_binding(struct vty *vty, int json)
return (CMD_WARNING);
memset(&params, 0, sizeof(params));
- params.json = json;
+ params.json = (json) ? 1 : 0;
imsg_compose(&ibuf, IMSG_CTL_SHOW_L2VPN_BINDING, 0, 0, -1, NULL, 0);
return (ldp_vty_dispatch(vty, &ibuf, SHOW_L2VPN_BINDING, &params));
}
int
-ldp_vty_show_atom_vc(struct vty *vty, int json)
+ldp_vty_show_atom_vc(struct vty *vty, const char *json)
{
struct imsgbuf ibuf;
struct show_params params;
@@ -1753,7 +1753,7 @@ ldp_vty_show_atom_vc(struct vty *vty, int json)
return (CMD_WARNING);
memset(&params, 0, sizeof(params));
- params.json = json;
+ params.json = (json) ? 1 : 0;
if (!params.json) {
/* header */