diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2016-11-28 17:56:29 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2016-11-28 17:56:29 +0100 |
commit | 82992fed8c6426f431fa92933dcf4cfe4de926d6 (patch) | |
tree | c7c3afb35248073d61d8863e635580f2969296e5 /isisd | |
parent | lib: merge-prep lib/command.c (partial revert) (diff) | |
parent | lib: pre-remove str.[ch] for merge, move strmatch() (diff) | |
download | frr-82992fed8c6426f431fa92933dcf4cfe4de926d6.tar.xz frr-82992fed8c6426f431fa92933dcf4cfe4de926d6.zip |
Merge branch 'vtysh-grammar'
Conflicts:
isisd/isisd.c
lib/Makefile.am
lib/thread.c
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/isis_redist.c | 115 | ||||
-rw-r--r-- | isisd/isis_routemap.c | 311 | ||||
-rw-r--r-- | isisd/isis_te.c | 10 | ||||
-rw-r--r-- | isisd/isis_vty.c | 777 | ||||
-rw-r--r-- | isisd/isisd.c | 45 |
5 files changed, 390 insertions, 868 deletions
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 21daaa779..045c7daa3 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -540,8 +540,7 @@ isis_redist_area_finish(struct isis_area *area) DEFUN (isis_redistribute, isis_redistribute_cmd, - "redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD - " (level-1|level-2) {metric <0-16777215>|route-map WORD}", + "redistribute <ipv4|ipv6> <kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table> <level-1|level-2> [<metric (0-16777215)|route-map WORD>]", REDIST_STR "Redistribute IPv4 routes\n" "Redistribute IPv6 routes\n" @@ -553,18 +552,19 @@ DEFUN (isis_redistribute, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_afi = 1; + int idx_protocol = 2; + int idx_level = 3; + int idx_metric_rmap = 4; VTY_DECLVAR_CONTEXT (isis_area, area); int family; int afi; int type; int level; unsigned long metric; - const char *routemap; + const char *routemap = NULL; - if (argc < 5) - return CMD_WARNING; - - family = str2family(argv[0]); + family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; @@ -572,13 +572,13 @@ DEFUN (isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[1]); + type = proto_redistnum(afi, argv[idx_protocol]->arg); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[2])) + if (!strcmp("level-1", argv[idx_level]->arg)) level = 1; - else if (!strcmp("level-2", argv[2])) + else if (!strcmp("level-2", argv[idx_level]->arg)) level = 2; else return CMD_WARNING; @@ -589,28 +589,28 @@ DEFUN (isis_redistribute, return CMD_WARNING; } - if (argv[3]) + if (strmatch(argv[idx_metric_rmap]->text, "metric")) { char *endp; - metric = strtoul(argv[3], &endp, 10); - if (argv[3][0] == '\0' || *endp != '\0') + metric = strtoul(argv[idx_metric_rmap + 1]->arg, &endp, 10); + routemap = NULL; + + if (argv[idx_metric_rmap]->arg[0] == '\0' || *endp != '\0') return CMD_WARNING; } else { + routemap = argv[idx_metric_rmap + 1]->arg; metric = 0xffffffff; } - routemap = argv[4]; - isis_redist_set(area, level, family, type, metric, routemap, 0); return 0; } DEFUN (no_isis_redistribute, no_isis_redistribute_cmd, - "no redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD - " (level-1|level-2)", + "no redistribute <ipv4|ipv6> <kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table> <level-1|level-2>", NO_STR REDIST_STR "Redistribute IPv4 routes\n" @@ -619,16 +619,16 @@ DEFUN (no_isis_redistribute, "Redistribute into level-1\n" "Redistribute into level-2\n") { + int idx_afi = 2; + int idx_protocol = 3; + int idx_level = 4; VTY_DECLVAR_CONTEXT (isis_area, area); int type; int level; int family; int afi; - if (argc < 3) - return CMD_WARNING; - - family = str2family(argv[0]); + family = str2family(argv[idx_afi]->arg); if (family < 0) return CMD_WARNING; @@ -636,16 +636,11 @@ DEFUN (no_isis_redistribute, if (!afi) return CMD_WARNING; - type = proto_redistnum(afi, argv[1]); + type = proto_redistnum(afi, argv[idx_protocol]->text); if (type < 0 || type == ZEBRA_ROUTE_ISIS) return CMD_WARNING; - if (!strcmp("level-1", argv[2])) - level = 1; - else if (!strcmp("level-2", argv[2])) - level = 2; - else - return CMD_WARNING; + level = strmatch ("level-1", argv[idx_level]->text) ? 1 : 2; isis_redist_unset(area, level, family, type); return 0; @@ -653,8 +648,7 @@ DEFUN (no_isis_redistribute, DEFUN (isis_default_originate, isis_default_originate_cmd, - "default-information originate (ipv4|ipv6) (level-1|level-2) " - "{always|metric <0-16777215>|route-map WORD}", + "default-information originate <ipv4|ipv6> <level-1|level-2> [<always|metric (0-16777215)|route-map WORD>]", "Control distribution of default information\n" "Distribute a default route\n" "Distribute default route for IPv4\n" @@ -667,26 +661,21 @@ DEFUN (isis_default_originate, "Route map reference\n" "Pointer to route-map entries\n") { + int idx_afi = 2; + int idx_level = 3; + int idx_metric_rmap = 4; VTY_DECLVAR_CONTEXT (isis_area, area); int family; - int originate_type; + int originate_type = DEFAULT_ORIGINATE; int level; - unsigned long metric; - const char *routemap; - - if (argc < 5) - return CMD_WARNING; + unsigned long metric = 0xffffffff; + const char *routemap = NULL; - family = str2family(argv[0]); + family = str2family(argv[idx_afi]->text); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[1])) - level = 1; - else if (!strcmp("level-2", argv[1])) - level = 2; - else - return CMD_WARNING; + level = strmatch ("level-1", argv[idx_level]->text) ? 1 : 2; if ((area->is_type & level) != level) { @@ -694,10 +683,15 @@ DEFUN (isis_default_originate, return CMD_WARNING; } - if (argv[2] && *argv[2] != '\0') - originate_type = DEFAULT_ORIGINATE_ALWAYS; - else - originate_type = DEFAULT_ORIGINATE; + if (argc > 4) + { + if (strmatch (argv[idx_metric_rmap]->text, "always")) + originate_type = DEFAULT_ORIGINATE_ALWAYS; + else if (strmatch(argv[idx_metric_rmap]->text, "metric")) + metric = strtoul(argv[idx_metric_rmap + 1]->arg, NULL, 10); + else + routemap = argv[idx_metric_rmap + 1]->arg; + } if (family == AF_INET6 && originate_type != DEFAULT_ORIGINATE_ALWAYS) { @@ -705,27 +699,13 @@ DEFUN (isis_default_originate, vty_out(vty, "so use with care or use default-originate always.%s", VTY_NEWLINE); } - if (argv[3]) - { - char *endp; - metric = strtoul(argv[3], &endp, 10); - if (argv[3][0] == '\0' || *endp != '\0') - return CMD_WARNING; - } - else - { - metric = 0xffffffff; - } - - routemap = argv[4]; - isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap, originate_type); return 0; } DEFUN (no_isis_default_originate, no_isis_default_originate_cmd, - "no default-information originate (ipv4|ipv6) (level-1|level-2)", + "no default-information originate <ipv4|ipv6> <level-1|level-2>", NO_STR "Control distribution of default information\n" "Distribute a default route\n" @@ -734,20 +714,19 @@ DEFUN (no_isis_default_originate, "Distribute default route into level-1\n" "Distribute default route into level-2\n") { + int idx_afi = 3; + int idx_level = 4; VTY_DECLVAR_CONTEXT (isis_area, area); int family; int level; - if (argc < 2) - return CMD_WARNING; - - family = str2family(argv[0]); + family = str2family(argv[idx_afi]->text); if (family < 0) return CMD_WARNING; - if (!strcmp("level-1", argv[1])) + if (strmatch ("level-1", argv[idx_level]->text)) level = 1; - else if (!strcmp("level-2", argv[1])) + else if (strmatch ("level-2", argv[idx_level]->text)) level = 2; else return CMD_WARNING; diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index 070965b2d..61f3315f0 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -250,314 +250,29 @@ static struct route_map_rule_cmd route_set_metric_cmd = route_set_metric_free }; -/* ------------------------------------------------------------*/ - -static int -isis_route_match_add(struct vty *vty, - const char *command, const char *arg) -{ - VTY_DECLVAR_CONTEXT (route_map_index, index); - int ret; - - ret = route_map_add_match (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -static int -isis_route_match_delete(struct vty *vty, - const char *command, const char *arg) -{ - VTY_DECLVAR_CONTEXT (route_map_index, index); - int ret; - - ret = route_map_delete_match (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - return CMD_SUCCESS; -} - -static int -isis_route_set_add(struct vty *vty, - const char *command, const char *arg) -{ - VTY_DECLVAR_CONTEXT (route_map_index, index); - int ret; - - ret = route_map_add_set(index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - return CMD_SUCCESS; -} - -static int -isis_route_set_delete (struct vty *vty, - const char *command, const char *arg) -{ - VTY_DECLVAR_CONTEXT (route_map_index, index); - int ret; - - ret = route_map_delete_set (index, command, arg); - if (ret) - { - switch (ret) - { - case RMAP_RULE_MISSING: - vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); - return CMD_WARNING; - case RMAP_COMPILE_ERROR: - vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); - return CMD_WARNING; - } - } - - return CMD_SUCCESS; -} - -/* ------------------------------------------------------------*/ - -DEFUN (match_ip_address, - match_ip_address_cmd, - "match ip address (<1-199>|<1300-2699>|WORD)", - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - return isis_route_match_add(vty, "ip address", argv[0]); -} - -DEFUN (no_match_ip_address, - no_match_ip_address_val_cmd, - "no match ip address (<1-199>|<1300-2699>|WORD)", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "IP access-list number\n" - "IP access-list number (expanded range)\n" - "IP Access-list name\n") -{ - if (argc == 0) - return isis_route_match_delete(vty, "ip address", NULL); - return isis_route_match_delete(vty, "ip address", argv[0]); -} - -ALIAS (no_match_ip_address, - no_match_ip_address_cmd, - "no match ip address", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n") - -/* ------------------------------------------------------------*/ - -DEFUN (match_ip_address_prefix_list, - match_ip_address_prefix_list_cmd, - "match ip address prefix-list WORD", - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - return isis_route_match_add(vty, "ip address prefix-list", argv[0]); -} - -DEFUN (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_cmd, - "no match ip address prefix-list", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n") -{ - if (argc == 0) - return isis_route_match_delete (vty, "ip address prefix-list", NULL); - return isis_route_match_delete (vty, "ip address prefix-list", argv[0]); -} - -ALIAS (no_match_ip_address_prefix_list, - no_match_ip_address_prefix_list_val_cmd, - "no match ip address prefix-list WORD", - NO_STR - MATCH_STR - IP_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") - -/* ------------------------------------------------------------*/ - -DEFUN (match_ipv6_address, - match_ipv6_address_cmd, - "match ipv6 address WORD", - MATCH_STR - IPV6_STR - "Match IPv6 address of route\n" - "IPv6 access-list name\n") -{ - return isis_route_match_add(vty, "ipv6 address", argv[0]); -} - -DEFUN (no_match_ipv6_address, - no_match_ipv6_address_val_cmd, - "no match ipv6 address WORD", - NO_STR - MATCH_STR - IPV6_STR - "Match IPv6 address of route\n" - "IPv6 access-list name\n") -{ - if (argc == 0) - return isis_route_match_delete(vty, "ipv6 address", NULL); - return isis_route_match_delete(vty, "ipv6 address", argv[0]); -} - -ALIAS (no_match_ipv6_address, - no_match_ipv6_address_cmd, - "no match ipv6 address", - NO_STR - MATCH_STR - IPV6_STR - "Match IPv6 address of route\n") - -/* ------------------------------------------------------------*/ - -DEFUN (match_ipv6_address_prefix_list, - match_ipv6_address_prefix_list_cmd, - "match ipv6 address prefix-list WORD", - MATCH_STR - IPV6_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") -{ - return isis_route_match_add(vty, "ipv6 address prefix-list", argv[0]); -} - -DEFUN (no_match_ipv6_address_prefix_list, - no_match_ipv6_address_prefix_list_cmd, - "no match ipv6 address prefix-list", - NO_STR - MATCH_STR - IPV6_STR - "Match address of route\n" - "Match entries of prefix-lists\n") +void +isis_route_map_init(void) { - if (argc == 0) - return isis_route_match_delete (vty, "ipv6 address prefix-list", NULL); - return isis_route_match_delete (vty, "ipv6 address prefix-list", argv[0]); -} + route_map_init(); -ALIAS (no_match_ipv6_address_prefix_list, - no_match_ipv6_address_prefix_list_val_cmd, - "no match ipv6 address prefix-list WORD", - NO_STR - MATCH_STR - IPV6_STR - "Match address of route\n" - "Match entries of prefix-lists\n" - "IP prefix-list name\n") + route_map_match_ip_address_hook (generic_match_add); + route_map_no_match_ip_address_hook (generic_match_delete); -/* ------------------------------------------------------------*/ + route_map_match_ip_address_prefix_list_hook (generic_match_add); + route_map_no_match_ip_address_prefix_list_hook (generic_match_delete); -/* set metric already exists e.g. in the ospf routemap. vtysh doesn't cope well with different - * commands at the same node, therefore add set metric with the same 32-bit range as ospf and - * verify that the input is a valid isis metric */ -DEFUN (set_metric, - set_metric_cmd, - "set metric <0-4294967295>", - SET_STR - "Metric vale for destination routing protocol\n" - "Metric value\n") -{ - return isis_route_set_add(vty, "metric", argv[0]); -} + route_map_match_ipv6_address_hook (generic_match_add); + route_map_no_match_ipv6_address_hook (generic_match_delete); -DEFUN (no_set_metric, - no_set_metric_val_cmd, - "no set metric <0-4294967295>", - NO_STR - SET_STR - "Metric value for destination routing protocol\n" - "Metric value\n") -{ - if (argc == 0) - return isis_route_set_delete(vty, "metric", NULL); - return isis_route_set_delete(vty, "metric", argv[0]); -} + route_map_match_ipv6_address_prefix_list_hook (generic_match_add); + route_map_no_match_ipv6_address_prefix_list_hook (generic_match_delete); -ALIAS (no_set_metric, - no_set_metric_cmd, - "no set metric", - NO_STR - SET_STR - "Metric vale for destination routing protocol\n"); - -void -isis_route_map_init(void) -{ - route_map_init(); + route_map_set_metric_hook (generic_set_add); + route_map_no_set_metric_hook (generic_set_delete); route_map_install_match(&route_match_ip_address_cmd); - install_element(RMAP_NODE, &match_ip_address_cmd); - install_element(RMAP_NODE, &no_match_ip_address_val_cmd); - install_element(RMAP_NODE, &no_match_ip_address_cmd); - route_map_install_match(&route_match_ip_address_prefix_list_cmd); - install_element(RMAP_NODE, &match_ip_address_prefix_list_cmd); - install_element(RMAP_NODE, &no_match_ip_address_prefix_list_val_cmd); - install_element(RMAP_NODE, &no_match_ip_address_prefix_list_cmd); - route_map_install_match(&route_match_ipv6_address_cmd); - install_element(RMAP_NODE, &match_ipv6_address_cmd); - install_element(RMAP_NODE, &no_match_ipv6_address_val_cmd); - install_element(RMAP_NODE, &no_match_ipv6_address_cmd); - route_map_install_match(&route_match_ipv6_address_prefix_list_cmd); - install_element(RMAP_NODE, &match_ipv6_address_prefix_list_cmd); - install_element(RMAP_NODE, &no_match_ipv6_address_prefix_list_val_cmd); - install_element(RMAP_NODE, &no_match_ipv6_address_prefix_list_cmd); - route_map_install_set(&route_set_metric_cmd); - install_element(RMAP_NODE, &set_metric_cmd); - install_element(RMAP_NODE, &no_set_metric_val_cmd); - install_element(RMAP_NODE, &no_set_metric_cmd); } diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 34300669b..d3605f448 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -1163,11 +1163,12 @@ DEFUN (isis_mpls_te_router_addr, "Stable IP address of the advertising router\n" "MPLS-TE router address in IPv4 address format\n") { + int idx_ipv4 = 2; struct in_addr value; struct listnode *node; struct isis_area *area; - if (! inet_aton (argv[0], &value)) + if (! inet_aton (argv[idx_ipv4]->arg, &value)) { vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); return CMD_WARNING; @@ -1190,7 +1191,7 @@ DEFUN (isis_mpls_te_router_addr, DEFUN (isis_mpls_te_inter_as, isis_mpls_te_inter_as_cmd, - "mpls-te inter-as (level-1|level-1-2|level-2-only)", + "mpls-te inter-as <level-1|level-1-2|level-2-only>", MPLS_TE_STR "Configure MPLS-TE Inter-AS support\n" "AREA native mode self originate INTER-AS LSP with L1 only flooding scope)\n" @@ -1317,11 +1318,12 @@ DEFUN (show_isis_mpls_te_interface, "Interface information\n" "Interface name\n") { + int idx_interface = 4; struct interface *ifp; struct listnode *node; /* Show All Interfaces. */ - if (argc == 0) + if (argc == 4) { for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) show_mpls_te_sub (vty, ifp); @@ -1329,7 +1331,7 @@ DEFUN (show_isis_mpls_te_interface, /* Interface name is specified. */ else { - if ((ifp = if_lookup_by_name (argv[0])) == NULL) + if ((ifp = if_lookup_by_name (argv[idx_interface]->arg)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else show_mpls_te_sub (vty, ifp); diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 12ef682c1..df13696b2 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -54,17 +54,19 @@ isis_circuit_lookup (struct vty *vty) DEFUN (ip_router_isis, ip_router_isis_cmd, - "(ip|ipv6) router isis WORD", + "ip router isis WORD", "Interface Internet Protocol config commands\n" "IP router interface commands\n" "IS-IS Routing for IP\n" "Routing process tag\n") { + int idx_afi = 0; + int idx_word = 3; VTY_DECLVAR_CONTEXT (interface, ifp); struct isis_circuit *circuit; struct isis_area *area; - const char *af = argv[0]; - const char *area_tag = argv[1]; + const char *af = argv[idx_afi]->arg; + const char *area_tag = argv[idx_word]->arg; /* Prevent more than one area per circuit */ circuit = circuit_scan_by_ifp (ifp); @@ -102,26 +104,39 @@ DEFUN (ip_router_isis, return CMD_SUCCESS; } +DEFUN (ip6_router_isis, + ip6_router_isis_cmd, + "ipv6 router isis WORD", + "Interface Internet Protocol config commands\n" + "IP router interface commands\n" + "IS-IS Routing for IP\n" + "Routing process tag\n") +{ + return ip_router_isis (self, vty, argc, argv); +} + DEFUN (no_ip_router_isis, no_ip_router_isis_cmd, - "no (ip|ipv6) router isis WORD", + "no <ip|ipv6> router isis WORD", NO_STR "Interface Internet Protocol config commands\n" "IP router interface commands\n" "IS-IS Routing for IP\n" "Routing process tag\n") { + int idx_afi = 1; + int idx_word = 4; VTY_DECLVAR_CONTEXT (interface, ifp); struct isis_area *area; struct isis_circuit *circuit; - const char *af = argv[0]; - const char *area_tag = argv[1]; + const char *af = argv[idx_afi]->arg; + const char *area_tag = argv[idx_word]->arg; area = isis_area_lookup (area_tag); if (!area) { vty_out (vty, "Can't find ISIS instance %s%s", - argv[0], VTY_NEWLINE); + argv[idx_afi]->arg, VTY_NEWLINE); return CMD_ERR_NO_MATCH; } @@ -181,19 +196,20 @@ DEFUN (no_isis_passive, DEFUN (isis_circuit_type, isis_circuit_type_cmd, - "isis circuit-type (level-1|level-1-2|level-2-only)", + "isis circuit-type <level-1|level-1-2|level-2-only>", "IS-IS commands\n" "Configure circuit type for interface\n" "Level-1 only adjacencies are formed\n" "Level-1-2 adjacencies are formed\n" "Level-2 only adjacencies are formed\n") { + int idx_level = 2; int is_type; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - is_type = string2circuit_t (argv[0]); + is_type = string2circuit_t (argv[idx_level]->arg); if (!is_type) { vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); @@ -215,7 +231,7 @@ DEFUN (isis_circuit_type, DEFUN (no_isis_circuit_type, no_isis_circuit_type_cmd, - "no isis circuit-type (level-1|level-1-2|level-2-only)", + "no isis circuit-type <level-1|level-1-2|level-2-only>", NO_STR "IS-IS commands\n" "Configure circuit type for interface\n" @@ -287,22 +303,24 @@ DEFUN (no_isis_network, DEFUN (isis_passwd, isis_passwd_cmd, - "isis password (md5|clear) WORD", + "isis password <md5|clear> WORD", "IS-IS commands\n" "Configure the authentication password for a circuit\n" "HMAC-MD5 authentication\n" "Cleartext password\n" "Circuit password\n") { + int idx_encryption = 2; + int idx_word = 3; struct isis_circuit *circuit = isis_circuit_lookup (vty); int rv; if (!circuit) return CMD_ERR_NO_MATCH; - if (argv[0][0] == 'm') - rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]); + if (argv[idx_encryption]->arg[0] == 'm') + rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[idx_word]->arg); else - rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]); + rv = isis_circuit_passwd_cleartext_set(circuit, argv[idx_word]->arg); if (rv) { vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); @@ -314,10 +332,13 @@ DEFUN (isis_passwd, DEFUN (no_isis_passwd, no_isis_passwd_cmd, - "no isis password", + "no isis password [<md5|clear> WORD]", NO_STR "IS-IS commands\n" - "Configure the authentication password for a circuit\n") + "Configure the authentication password for a circuit\n" + "HMAC-MD5 authentication\n" + "Cleartext password\n" + "Circuit password\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -328,29 +349,21 @@ DEFUN (no_isis_passwd, return CMD_SUCCESS; } -ALIAS (no_isis_passwd, - no_isis_passwd_arg_cmd, - "no isis password (md5|clear) WORD", - NO_STR - "IS-IS commands\n" - "Configure the authentication password for a circuit\n" - "HMAC-MD5 authentication\n" - "Cleartext password\n" - "Circuit password\n") DEFUN (isis_priority, isis_priority_cmd, - "isis priority <0-127>", + "isis priority (0-127)", "IS-IS commands\n" "Set priority for Designated Router election\n" "Priority value\n") { + int idx_number = 2; int prio; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[idx_number]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -366,10 +379,11 @@ DEFUN (isis_priority, DEFUN (no_isis_priority, no_isis_priority_cmd, - "no isis priority", + "no isis priority [(0-127)]", NO_STR "IS-IS commands\n" - "Set priority for Designated Router election\n") + "Set priority for Designated Router election\n" + "Priority value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -381,28 +395,22 @@ DEFUN (no_isis_priority, return CMD_SUCCESS; } -ALIAS (no_isis_priority, - no_isis_priority_arg_cmd, - "no isis priority <0-127>", - NO_STR - "IS-IS commands\n" - "Set priority for Designated Router election\n" - "Priority value\n") DEFUN (isis_priority_l1, isis_priority_l1_cmd, - "isis priority <0-127> level-1", + "isis priority (0-127) level-1", "IS-IS commands\n" "Set priority for Designated Router election\n" "Priority value\n" "Specify priority for level-1 routing\n") { + int idx_number = 2; int prio; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[idx_number]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -417,10 +425,11 @@ DEFUN (isis_priority_l1, DEFUN (no_isis_priority_l1, no_isis_priority_l1_cmd, - "no isis priority level-1", + "no isis priority [(0-127)] level-1", NO_STR "IS-IS commands\n" "Set priority for Designated Router election\n" + "Priority value\n" "Specify priority for level-1 routing\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -432,29 +441,22 @@ DEFUN (no_isis_priority_l1, return CMD_SUCCESS; } -ALIAS (no_isis_priority_l1, - no_isis_priority_l1_arg_cmd, - "no isis priority <0-127> level-1", - NO_STR - "IS-IS commands\n" - "Set priority for Designated Router election\n" - "Priority value\n" - "Specify priority for level-1 routing\n") DEFUN (isis_priority_l2, isis_priority_l2_cmd, - "isis priority <0-127> level-2", + "isis priority (0-127) level-2", "IS-IS commands\n" "Set priority for Designated Router election\n" "Priority value\n" "Specify priority for level-2 routing\n") { + int idx_number = 2; int prio; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - prio = atoi (argv[0]); + prio = atoi (argv[idx_number]->arg); if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) { vty_out (vty, "Invalid priority %d - should be <0-127>%s", @@ -469,10 +471,11 @@ DEFUN (isis_priority_l2, DEFUN (no_isis_priority_l2, no_isis_priority_l2_cmd, - "no isis priority level-2", + "no isis priority [(0-127)] level-2", NO_STR "IS-IS commands\n" "Set priority for Designated Router election\n" + "Priority value\n" "Specify priority for level-2 routing\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -484,29 +487,22 @@ DEFUN (no_isis_priority_l2, return CMD_SUCCESS; } -ALIAS (no_isis_priority_l2, - no_isis_priority_l2_arg_cmd, - "no isis priority <0-127> level-2", - NO_STR - "IS-IS commands\n" - "Set priority for Designated Router election\n" - "Priority value\n" - "Specify priority for level-2 routing\n") /* Metric command */ DEFUN (isis_metric, isis_metric_cmd, - "isis metric <0-16777215>", + "isis metric (0-16777215)", "IS-IS commands\n" "Set default metric for circuit\n" "Default metric value\n") { + int idx_number = 2; int met; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[idx_number]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -533,12 +529,14 @@ DEFUN (isis_metric, return CMD_SUCCESS; } + DEFUN (no_isis_metric, no_isis_metric_cmd, - "no isis metric", + "no isis metric [(0-16777215)]", NO_STR "IS-IS commands\n" - "Set default metric for circuit\n") + "Set default metric for circuit\n" + "Default metric value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -549,28 +547,22 @@ DEFUN (no_isis_metric, return CMD_SUCCESS; } -ALIAS (no_isis_metric, - no_isis_metric_arg_cmd, - "no isis metric <0-16777215>", - NO_STR - "IS-IS commands\n" - "Set default metric for circuit\n" - "Default metric value\n") DEFUN (isis_metric_l1, isis_metric_l1_cmd, - "isis metric <0-16777215> level-1", + "isis metric (0-16777215) level-1", "IS-IS commands\n" "Set default metric for circuit\n" "Default metric value\n" "Specify metric for level-1 routing\n") { + int idx_number = 2; int met; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[idx_number]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -596,12 +588,14 @@ DEFUN (isis_metric_l1, return CMD_SUCCESS; } + DEFUN (no_isis_metric_l1, no_isis_metric_l1_cmd, - "no isis metric level-1", + "no isis metric [(0-16777215)] level-1", NO_STR "IS-IS commands\n" "Set default metric for circuit\n" + "Default metric value\n" "Specify metric for level-1 routing\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -612,29 +606,22 @@ DEFUN (no_isis_metric_l1, return CMD_SUCCESS; } -ALIAS (no_isis_metric_l1, - no_isis_metric_l1_arg_cmd, - "no isis metric <0-16777215> level-1", - NO_STR - "IS-IS commands\n" - "Set default metric for circuit\n" - "Default metric value\n" - "Specify metric for level-1 routing\n") DEFUN (isis_metric_l2, isis_metric_l2_cmd, - "isis metric <0-16777215> level-2", + "isis metric (0-16777215) level-2", "IS-IS commands\n" "Set default metric for circuit\n" "Default metric value\n" "Specify metric for level-2 routing\n") { + int idx_number = 2; int met; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - met = atoi (argv[0]); + met = atoi (argv[idx_number]->arg); /* RFC3787 section 5.1 */ if (circuit->area && circuit->area->oldmetric == 1 && @@ -660,12 +647,14 @@ DEFUN (isis_metric_l2, return CMD_SUCCESS; } + DEFUN (no_isis_metric_l2, no_isis_metric_l2_cmd, - "no isis metric level-2", + "no isis metric [(0-16777215)] level-2", NO_STR "IS-IS commands\n" "Set default metric for circuit\n" + "Default metric value\n" "Specify metric for level-2 routing\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -676,30 +665,23 @@ DEFUN (no_isis_metric_l2, return CMD_SUCCESS; } -ALIAS (no_isis_metric_l2, - no_isis_metric_l2_arg_cmd, - "no isis metric <0-16777215> level-2", - NO_STR - "IS-IS commands\n" - "Set default metric for circuit\n" - "Default metric value\n" - "Specify metric for level-2 routing\n") /* end of metrics */ DEFUN (isis_hello_interval, isis_hello_interval_cmd, - "isis hello-interval <1-600>", + "isis hello-interval (1-600)", "IS-IS commands\n" "Set Hello interval\n" "Hello interval value\n" "Holdtime 1 seconds, interval depends on multiplier\n") { + int idx_number = 2; int interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", @@ -713,12 +695,14 @@ DEFUN (isis_hello_interval, return CMD_SUCCESS; } + DEFUN (no_isis_hello_interval, no_isis_hello_interval_cmd, - "no isis hello-interval", + "no isis hello-interval [(1-600)]", NO_STR "IS-IS commands\n" - "Set Hello interval\n") + "Set Hello interval\n" + "Holdtime 1 second, interval depends on multiplier\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -730,30 +714,23 @@ DEFUN (no_isis_hello_interval, return CMD_SUCCESS; } -ALIAS (no_isis_hello_interval, - no_isis_hello_interval_arg_cmd, - "no isis hello-interval <1-600>", - NO_STR - "IS-IS commands\n" - "Set Hello interval\n" - "Hello interval value\n" - "Holdtime 1 second, interval depends on multiplier\n") DEFUN (isis_hello_interval_l1, isis_hello_interval_l1_cmd, - "isis hello-interval <1-600> level-1", + "isis hello-interval (1-600) level-1", "IS-IS commands\n" "Set Hello interval\n" "Hello interval value\n" "Holdtime 1 second, interval depends on multiplier\n" "Specify hello-interval for level-1 IIHs\n") { + int idx_number = 2; long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -766,12 +743,14 @@ DEFUN (isis_hello_interval_l1, return CMD_SUCCESS; } + DEFUN (no_isis_hello_interval_l1, no_isis_hello_interval_l1_cmd, - "no isis hello-interval level-1", + "no isis hello-interval [(1-600)] level-1", NO_STR "IS-IS commands\n" "Set Hello interval\n" + "Holdtime 1 second, interval depends on multiplier\n" "Specify hello-interval for level-1 IIHs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -783,31 +762,23 @@ DEFUN (no_isis_hello_interval_l1, return CMD_SUCCESS; } -ALIAS (no_isis_hello_interval_l1, - no_isis_hello_interval_l1_arg_cmd, - "no isis hello-interval <1-600> level-1", - NO_STR - "IS-IS commands\n" - "Set Hello interval\n" - "Hello interval value\n" - "Holdtime 1 second, interval depends on multiplier\n" - "Specify hello-interval for level-1 IIHs\n") DEFUN (isis_hello_interval_l2, isis_hello_interval_l2_cmd, - "isis hello-interval <1-600> level-2", + "isis hello-interval (1-600) level-2", "IS-IS commands\n" "Set Hello interval\n" "Hello interval value\n" "Holdtime 1 second, interval depends on multiplier\n" "Specify hello-interval for level-2 IIHs\n") { + int idx_number = 2; long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) { vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", @@ -820,12 +791,14 @@ DEFUN (isis_hello_interval_l2, return CMD_SUCCESS; } + DEFUN (no_isis_hello_interval_l2, no_isis_hello_interval_l2_cmd, - "no isis hello-interval level-2", + "no isis hello-interval [(1-600)] level-2", NO_STR "IS-IS commands\n" "Set Hello interval\n" + "Holdtime 1 second, interval depends on multiplier\n" "Specify hello-interval for level-2 IIHs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -837,29 +810,21 @@ DEFUN (no_isis_hello_interval_l2, return CMD_SUCCESS; } -ALIAS (no_isis_hello_interval_l2, - no_isis_hello_interval_l2_arg_cmd, - "no isis hello-interval <1-600> level-2", - NO_STR - "IS-IS commands\n" - "Set Hello interval\n" - "Hello interval value\n" - "Holdtime 1 second, interval depends on multiplier\n" - "Specify hello-interval for level-2 IIHs\n") DEFUN (isis_hello_multiplier, isis_hello_multiplier_cmd, - "isis hello-multiplier <2-100>", + "isis hello-multiplier (2-100)", "IS-IS commands\n" "Set multiplier for Hello holding time\n" "Hello multiplier value\n") { + int idx_number = 2; int mult; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[idx_number]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -873,12 +838,14 @@ DEFUN (isis_hello_multiplier, return CMD_SUCCESS; } + DEFUN (no_isis_hello_multiplier, no_isis_hello_multiplier_cmd, - "no isis hello-multiplier", + "no isis hello-multiplier [(2-100)]", NO_STR "IS-IS commands\n" - "Set multiplier for Hello holding time\n") + "Set multiplier for Hello holding time\n" + "Hello multiplier value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -890,28 +857,22 @@ DEFUN (no_isis_hello_multiplier, return CMD_SUCCESS; } -ALIAS (no_isis_hello_multiplier, - no_isis_hello_multiplier_arg_cmd, - "no isis hello-multiplier <2-100>", - NO_STR - "IS-IS commands\n" - "Set multiplier for Hello holding time\n" - "Hello multiplier value\n") DEFUN (isis_hello_multiplier_l1, isis_hello_multiplier_l1_cmd, - "isis hello-multiplier <2-100> level-1", + "isis hello-multiplier (2-100) level-1", "IS-IS commands\n" "Set multiplier for Hello holding time\n" "Hello multiplier value\n" "Specify hello multiplier for level-1 IIHs\n") { + int idx_number = 2; int mult; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[idx_number]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -924,12 +885,14 @@ DEFUN (isis_hello_multiplier_l1, return CMD_SUCCESS; } + DEFUN (no_isis_hello_multiplier_l1, no_isis_hello_multiplier_l1_cmd, - "no isis hello-multiplier level-1", + "no isis hello-multiplier [(2-100)] level-1", NO_STR "IS-IS commands\n" "Set multiplier for Hello holding time\n" + "Hello multiplier value\n" "Specify hello multiplier for level-1 IIHs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -941,29 +904,22 @@ DEFUN (no_isis_hello_multiplier_l1, return CMD_SUCCESS; } -ALIAS (no_isis_hello_multiplier_l1, - no_isis_hello_multiplier_l1_arg_cmd, - "no isis hello-multiplier <2-100> level-1", - NO_STR - "IS-IS commands\n" - "Set multiplier for Hello holding time\n" - "Hello multiplier value\n" - "Specify hello multiplier for level-1 IIHs\n") DEFUN (isis_hello_multiplier_l2, isis_hello_multiplier_l2_cmd, - "isis hello-multiplier <2-100> level-2", + "isis hello-multiplier (2-100) level-2", "IS-IS commands\n" "Set multiplier for Hello holding time\n" "Hello multiplier value\n" "Specify hello multiplier for level-2 IIHs\n") { + int idx_number = 2; int mult; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - mult = atoi (argv[0]); + mult = atoi (argv[idx_number]->arg); if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) { vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", @@ -976,12 +932,14 @@ DEFUN (isis_hello_multiplier_l2, return CMD_SUCCESS; } + DEFUN (no_isis_hello_multiplier_l2, no_isis_hello_multiplier_l2_cmd, - "no isis hello-multiplier level-2", + "no isis hello-multiplier [(2-100)] level-2", NO_STR "IS-IS commands\n" "Set multiplier for Hello holding time\n" + "Hello multiplier value\n" "Specify hello multiplier for level-2 IIHs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -993,14 +951,6 @@ DEFUN (no_isis_hello_multiplier_l2, return CMD_SUCCESS; } -ALIAS (no_isis_hello_multiplier_l2, - no_isis_hello_multiplier_l2_arg_cmd, - "no isis hello-multiplier <2-100> level-2", - NO_STR - "IS-IS commands\n" - "Set multiplier for Hello holding time\n" - "Hello multiplier value\n" - "Specify hello multiplier for level-2 IIHs\n") DEFUN (isis_hello_padding, isis_hello_padding_cmd, @@ -1039,17 +989,18 @@ DEFUN (no_isis_hello_padding, DEFUN (csnp_interval, csnp_interval_cmd, - "isis csnp-interval <1-600>", + "isis csnp-interval (1-600)", "IS-IS commands\n" "Set CSNP interval in seconds\n" "CSNP interval value\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[idx_number]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1063,12 +1014,14 @@ DEFUN (csnp_interval, return CMD_SUCCESS; } + DEFUN (no_csnp_interval, no_csnp_interval_cmd, - "no isis csnp-interval", + "no isis csnp-interval [(1-600)]", NO_STR "IS-IS commands\n" - "Set CSNP interval in seconds\n") + "Set CSNP interval in seconds\n" + "CSNP interval value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -1080,28 +1033,22 @@ DEFUN (no_csnp_interval, return CMD_SUCCESS; } -ALIAS (no_csnp_interval, - no_csnp_interval_arg_cmd, - "no isis csnp-interval <1-600>", - NO_STR - "IS-IS commands\n" - "Set CSNP interval in seconds\n" - "CSNP interval value\n") DEFUN (csnp_interval_l1, csnp_interval_l1_cmd, - "isis csnp-interval <1-600> level-1", + "isis csnp-interval (1-600) level-1", "IS-IS commands\n" "Set CSNP interval in seconds\n" "CSNP interval value\n" "Specify interval for level-1 CSNPs\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[idx_number]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1114,12 +1061,14 @@ DEFUN (csnp_interval_l1, return CMD_SUCCESS; } + DEFUN (no_csnp_interval_l1, no_csnp_interval_l1_cmd, - "no isis csnp-interval level-1", + "no isis csnp-interval [(1-600)] level-1", NO_STR "IS-IS commands\n" "Set CSNP interval in seconds\n" + "CSNP interval value\n" "Specify interval for level-1 CSNPs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1131,29 +1080,22 @@ DEFUN (no_csnp_interval_l1, return CMD_SUCCESS; } -ALIAS (no_csnp_interval_l1, - no_csnp_interval_l1_arg_cmd, - "no isis csnp-interval <1-600> level-1", - NO_STR - "IS-IS commands\n" - "Set CSNP interval in seconds\n" - "CSNP interval value\n" - "Specify interval for level-1 CSNPs\n") DEFUN (csnp_interval_l2, csnp_interval_l2_cmd, - "isis csnp-interval <1-600> level-2", + "isis csnp-interval (1-600) level-2", "IS-IS commands\n" "Set CSNP interval in seconds\n" "CSNP interval value\n" "Specify interval for level-2 CSNPs\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[idx_number]->arg); if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) { vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", @@ -1166,12 +1108,14 @@ DEFUN (csnp_interval_l2, return CMD_SUCCESS; } + DEFUN (no_csnp_interval_l2, no_csnp_interval_l2_cmd, - "no isis csnp-interval level-2", + "no isis csnp-interval [(1-600)] level-2", NO_STR "IS-IS commands\n" "Set CSNP interval in seconds\n" + "CSNP interval value\n" "Specify interval for level-2 CSNPs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1183,28 +1127,21 @@ DEFUN (no_csnp_interval_l2, return CMD_SUCCESS; } -ALIAS (no_csnp_interval_l2, - no_csnp_interval_l2_arg_cmd, - "no isis csnp-interval <1-600> level-2", - NO_STR - "IS-IS commands\n" - "Set CSNP interval in seconds\n" - "CSNP interval value\n" - "Specify interval for level-2 CSNPs\n") DEFUN (psnp_interval, psnp_interval_cmd, - "isis psnp-interval <1-120>", + "isis psnp-interval (1-120)", "IS-IS commands\n" "Set PSNP interval in seconds\n" "PSNP interval value\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[idx_number]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1218,12 +1155,14 @@ DEFUN (psnp_interval, return CMD_SUCCESS; } + DEFUN (no_psnp_interval, no_psnp_interval_cmd, - "no isis psnp-interval", + "no isis psnp-interval [(1-120)]", NO_STR "IS-IS commands\n" - "Set PSNP interval in seconds\n") + "Set PSNP interval in seconds\n" + "PSNP interval value\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) @@ -1235,28 +1174,22 @@ DEFUN (no_psnp_interval, return CMD_SUCCESS; } -ALIAS (no_psnp_interval, - no_psnp_interval_arg_cmd, - "no isis psnp-interval <1-120>", - NO_STR - "IS-IS commands\n" - "Set PSNP interval in seconds\n" - "PSNP interval value\n") DEFUN (psnp_interval_l1, psnp_interval_l1_cmd, - "isis psnp-interval <1-120> level-1", + "isis psnp-interval (1-120) level-1", "IS-IS commands\n" "Set PSNP interval in seconds\n" "PSNP interval value\n" "Specify interval for level-1 PSNPs\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[idx_number]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1269,12 +1202,14 @@ DEFUN (psnp_interval_l1, return CMD_SUCCESS; } + DEFUN (no_psnp_interval_l1, no_psnp_interval_l1_cmd, - "no isis psnp-interval level-1", + "no isis psnp-interval [(1-120)] level-1", NO_STR "IS-IS commands\n" "Set PSNP interval in seconds\n" + "PSNP interval value\n" "Specify interval for level-1 PSNPs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1286,29 +1221,22 @@ DEFUN (no_psnp_interval_l1, return CMD_SUCCESS; } -ALIAS (no_psnp_interval_l1, - no_psnp_interval_l1_arg_cmd, - "no isis psnp-interval <1-120> level-1", - NO_STR - "IS-IS commands\n" - "Set PSNP interval in seconds\n" - "PSNP interval value\n" - "Specify interval for level-1 PSNPs\n") DEFUN (psnp_interval_l2, psnp_interval_l2_cmd, - "isis psnp-interval <1-120> level-2", + "isis psnp-interval (1-120) level-2", "IS-IS commands\n" "Set PSNP interval in seconds\n" "PSNP interval value\n" "Specify interval for level-2 PSNPs\n") { + int idx_number = 2; unsigned long interval; struct isis_circuit *circuit = isis_circuit_lookup (vty); if (!circuit) return CMD_ERR_NO_MATCH; - interval = atol (argv[0]); + interval = atol (argv[idx_number]->arg); if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) { vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", @@ -1321,12 +1249,14 @@ DEFUN (psnp_interval_l2, return CMD_SUCCESS; } + DEFUN (no_psnp_interval_l2, no_psnp_interval_l2_cmd, - "no isis psnp-interval level-2", + "no isis psnp-interval [(1-120)] level-2", NO_STR "IS-IS commands\n" "Set PSNP interval in seconds\n" + "PSNP interval value\n" "Specify interval for level-2 PSNPs\n") { struct isis_circuit *circuit = isis_circuit_lookup (vty); @@ -1338,14 +1268,6 @@ DEFUN (no_psnp_interval_l2, return CMD_SUCCESS; } -ALIAS (no_psnp_interval_l2, - no_psnp_interval_l2_arg_cmd, - "no isis psnp-interval <1-120> level-2", - NO_STR - "IS-IS commands\n" - "Set PSNP interval in seconds\n" - "PSNP interval value\n" - "Specify interval for level-2 PSNPs\n") static int validate_metric_style_narrow (struct vty *vty, struct isis_area *area) @@ -1387,16 +1309,17 @@ validate_metric_style_narrow (struct vty *vty, struct isis_area *area) DEFUN (metric_style, metric_style_cmd, - "metric-style (narrow|transition|wide)", + "metric-style <narrow|transition|wide>", "Use old-style (ISO 10589) or new-style packet formats\n" "Use old style of TLVs with narrow metric\n" "Send and accept both styles of TLVs during transition\n" "Use new style of TLVs to carry wider metric\n") { + int idx_metric_style = 1; VTY_DECLVAR_CONTEXT (isis_area, area); int ret; - if (strncmp (argv[0], "w", 1) == 0) + if (strncmp (argv[idx_metric_style]->arg, "w", 1) == 0) { isis_area_metricstyle_set(area, false, true); return CMD_SUCCESS; @@ -1406,9 +1329,9 @@ DEFUN (metric_style, if (ret != CMD_SUCCESS) return ret; - if (strncmp (argv[0], "t", 1) == 0) + if (strncmp (argv[idx_metric_style]->arg, "t", 1) == 0) isis_area_metricstyle_set(area, true, true); - else if (strncmp (argv[0], "n", 1) == 0) + else if (strncmp (argv[idx_metric_style]->arg, "n", 1) == 0) isis_area_metricstyle_set(area, true, false); return CMD_SUCCESS; @@ -1471,6 +1394,7 @@ DEFUN (set_attached_bit, DEFUN (no_set_attached_bit, no_set_attached_bit_cmd, "no set-attached-bit", + NO_STR "Reset attached bit\n") { VTY_DECLVAR_CONTEXT (isis_area, area); @@ -1529,45 +1453,43 @@ static int area_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu) DEFUN (area_lsp_mtu, area_lsp_mtu_cmd, - "lsp-mtu <128-4352>", + "lsp-mtu (128-4352)", "Configure the maximum size of generated LSPs\n" "Maximum size of generated LSPs\n") { + int idx_number = 1; unsigned int lsp_mtu; - VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352); + VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[idx_number]->arg, 128, 4352); return area_lsp_mtu_set(vty, lsp_mtu); } + DEFUN (no_area_lsp_mtu, no_area_lsp_mtu_cmd, - "no lsp-mtu", + "no lsp-mtu [(128-4352)]", NO_STR - "Configure the maximum size of generated LSPs\n") + "Configure the maximum size of generated LSPs\n" + "Maximum size of generated LSPs\n") { return area_lsp_mtu_set(vty, DEFAULT_LSP_MTU); } -ALIAS (no_area_lsp_mtu, - no_area_lsp_mtu_arg_cmd, - "no lsp-mtu <128-4352>", - NO_STR - "Configure the maximum size of generated LSPs\n" - "Maximum size of generated LSPs\n"); DEFUN (is_type, is_type_cmd, - "is-type (level-1|level-1-2|level-2-only)", + "is-type <level-1|level-1-2|level-2-only>", "IS Level for this routing process (OSI only)\n" "Act as a station router only\n" "Act as both a station router and an area router\n" "Act as an area router only\n") { + int idx_level = 1; VTY_DECLVAR_CONTEXT (isis_area, area); int type; - type = string2circuit_t (argv[0]); + type = string2circuit_t (argv[idx_level]->arg); if (!type) { vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); @@ -1581,7 +1503,7 @@ DEFUN (is_type, DEFUN (no_is_type, no_is_type_cmd, - "no is-type (level-1|level-1-2|level-2-only)", + "no is-type <level-1|level-1-2|level-2-only>", NO_STR "IS Level for this routing process (OSI only)\n" "Act as a station router only\n" @@ -1638,24 +1560,26 @@ set_lsp_gen_interval (struct vty *vty, struct isis_area *area, DEFUN (lsp_gen_interval, lsp_gen_interval_cmd, - "lsp-gen-interval <1-120>", + "lsp-gen-interval (1-120)", "Minimum interval between regenerating same LSP\n" "Minimum interval in seconds\n") { + int idx_number = 1; VTY_DECLVAR_CONTEXT (isis_area, area); uint16_t interval; int level; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); level = IS_LEVEL_1 | IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } DEFUN (no_lsp_gen_interval, no_lsp_gen_interval_cmd, - "no lsp-gen-interval", + "no lsp-gen-interval [(1-120)]", NO_STR - "Minimum interval between regenerating same LSP\n") + "Minimum interval between regenerating same LSP\n" + "Minimum interval in seconds\n") { VTY_DECLVAR_CONTEXT (isis_area, area); uint16_t interval; @@ -1666,32 +1590,27 @@ DEFUN (no_lsp_gen_interval, return set_lsp_gen_interval (vty, area, interval, level); } -ALIAS (no_lsp_gen_interval, - no_lsp_gen_interval_arg_cmd, - "no lsp-gen-interval <1-120>", - NO_STR - "Minimum interval between regenerating same LSP\n" - "Minimum interval in seconds\n") DEFUN (lsp_gen_interval_l1, lsp_gen_interval_l1_cmd, - "lsp-gen-interval level-1 <1-120>", + "lsp-gen-interval level-1 (1-120)", "Minimum interval between regenerating same LSP\n" "Set interval for level 1 only\n" "Minimum interval in seconds\n") { + int idx_number = 2; VTY_DECLVAR_CONTEXT (isis_area, area); uint16_t interval; int level; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); level = IS_LEVEL_1; return set_lsp_gen_interval (vty, area, interval, level); } DEFUN (no_lsp_gen_interval_l1, no_lsp_gen_interval_l1_cmd, - "no lsp-gen-interval level-1", + "no lsp-gen-interval level-1 [(1-120)]", NO_STR "Minimum interval between regenerating same LSP\n" "Set interval for level 1 only\n") @@ -1705,36 +1624,31 @@ DEFUN (no_lsp_gen_interval_l1, return set_lsp_gen_interval (vty, area, interval, level); } -ALIAS (no_lsp_gen_interval_l1, - no_lsp_gen_interval_l1_arg_cmd, - "no lsp-gen-interval level-1 <1-120>", - NO_STR - "Minimum interval between regenerating same LSP\n" - "Set interval for level 1 only\n" - "Minimum interval in seconds\n") DEFUN (lsp_gen_interval_l2, lsp_gen_interval_l2_cmd, - "lsp-gen-interval level-2 <1-120>", + "lsp-gen-interval level-2 (1-120)", "Minimum interval between regenerating same LSP\n" "Set interval for level 2 only\n" "Minimum interval in seconds\n") { VTY_DECLVAR_CONTEXT (isis_area, area); + int idx_number = 2; uint16_t interval; int level; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); level = IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } DEFUN (no_lsp_gen_interval_l2, no_lsp_gen_interval_l2_cmd, - "no lsp-gen-interval level-2", + "no lsp-gen-interval level-2 [(1-120)]", NO_STR "Minimum interval between regenerating same LSP\n" - "Set interval for level 2 only\n") + "Set interval for level 2 only\n" + "Minimum interval in seconds\n") { VTY_DECLVAR_CONTEXT (isis_area, area); uint16_t interval; @@ -1745,35 +1659,33 @@ DEFUN (no_lsp_gen_interval_l2, return set_lsp_gen_interval (vty, area, interval, level); } -ALIAS (no_lsp_gen_interval_l2, - no_lsp_gen_interval_l2_arg_cmd, - "no lsp-gen-interval level-2 <1-120>", - NO_STR - "Minimum interval between regenerating same LSP\n" - "Set interval for level 2 only\n" - "Minimum interval in seconds\n") DEFUN (spf_interval, spf_interval_cmd, - "spf-interval <1-120>", + "spf-interval (1-120)", "Minimum interval between SPF calculations\n" "Minimum interval between consecutive SPFs in seconds\n") { + int idx_number = 1; VTY_DECLVAR_CONTEXT (isis_area, area); u_int16_t interval; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); area->min_spf_interval[0] = interval; area->min_spf_interval[1] = interval; return CMD_SUCCESS; } + DEFUN (no_spf_interval, no_spf_interval_cmd, - "no spf-interval", + "no spf-interval [[<level-1|level-2>] (1-120)]", NO_STR - "Minimum interval between SPF calculations\n") + "Minimum interval between SPF calculations\n" + "Set interval for level 1 only\n" + "Set interval for level 2 only\n" + "Minimum interval between consecutive SPFs in seconds\n") { VTY_DECLVAR_CONTEXT (isis_area, area); @@ -1783,24 +1695,19 @@ DEFUN (no_spf_interval, return CMD_SUCCESS; } -ALIAS (no_spf_interval, - no_spf_interval_arg_cmd, - "no spf-interval <1-120>", - NO_STR - "Minimum interval between SPF calculations\n" - "Minimum interval between consecutive SPFs in seconds\n") DEFUN (spf_interval_l1, spf_interval_l1_cmd, - "spf-interval level-1 <1-120>", + "spf-interval level-1 (1-120)", "Minimum interval between SPF calculations\n" "Set interval for level 1 only\n" "Minimum interval between consecutive SPFs in seconds\n") { + int idx_number = 2; VTY_DECLVAR_CONTEXT (isis_area, area); u_int16_t interval; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); area->min_spf_interval[0] = interval; return CMD_SUCCESS; @@ -1820,25 +1727,19 @@ DEFUN (no_spf_interval_l1, return CMD_SUCCESS; } -ALIAS (no_spf_interval, - no_spf_interval_l1_arg_cmd, - "no spf-interval level-1 <1-120>", - NO_STR - "Minimum interval between SPF calculations\n" - "Set interval for level 1 only\n" - "Minimum interval between consecutive SPFs in seconds\n") DEFUN (spf_interval_l2, spf_interval_l2_cmd, - "spf-interval level-2 <1-120>", + "spf-interval level-2 (1-120)", "Minimum interval between SPF calculations\n" "Set interval for level 2 only\n" "Minimum interval between consecutive SPFs in seconds\n") { + int idx_number = 2; VTY_DECLVAR_CONTEXT (isis_area, area); u_int16_t interval; - interval = atoi (argv[0]); + interval = atoi (argv[idx_number]->arg); area->min_spf_interval[1] = interval; return CMD_SUCCESS; @@ -1858,13 +1759,6 @@ DEFUN (no_spf_interval_l2, return CMD_SUCCESS; } -ALIAS (no_spf_interval, - no_spf_interval_l2_arg_cmd, - "no spf-interval level-2 <1-120>", - NO_STR - "Minimum interval between SPF calculations\n" - "Set interval for level 2 only\n" - "Minimum interval between consecutive SPFs in seconds\n") static int area_max_lsp_lifetime_set(struct vty *vty, int level, @@ -1914,79 +1808,44 @@ area_max_lsp_lifetime_set(struct vty *vty, int level, DEFUN (max_lsp_lifetime, max_lsp_lifetime_cmd, - "max-lsp-lifetime <350-65535>", - "Maximum LSP lifetime\n" + "max-lsp-lifetime [<level-1|level-2>] (350-65535)", + "Maximum LSP lifetime for Level 1 only\n" + "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0])); -} + int idx = 0; + unsigned int level = IS_LEVEL_1_AND_2; -DEFUN (no_max_lsp_lifetime, - no_max_lsp_lifetime_cmd, - "no max-lsp-lifetime", - NO_STR - "LSP lifetime in seconds\n") -{ - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, - DEFAULT_LSP_LIFETIME); -} + if (argv_find (argv, argc, "level-1", &idx)) + level = IS_LEVEL_1; + else if (argv_find (argv, argc, "level-2", &idx)) + level = IS_LEVEL_2; -ALIAS (no_max_lsp_lifetime, - no_max_lsp_lifetime_arg_cmd, - "no max-lsp-lifetime <350-65535>", - NO_STR - "Maximum LSP lifetime\n" - "LSP lifetime in seconds\n") + argv_find (argv, argc, "(350-65535)", &idx); + int lifetime = atoi(argv[idx]->arg); -DEFUN (max_lsp_lifetime_l1, - max_lsp_lifetime_l1_cmd, - "max-lsp-lifetime level-1 <350-65535>", - "Maximum LSP lifetime for Level 1 only\n" - "LSP lifetime for Level 1 only in seconds\n") -{ - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[0])); + return area_max_lsp_lifetime_set(vty, level, lifetime); } -DEFUN (no_max_lsp_lifetime_l1, - no_max_lsp_lifetime_l1_cmd, - "no max-lsp-lifetime level-1", - NO_STR - "LSP lifetime for Level 1 only in seconds\n") -{ - return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, DEFAULT_LSP_LIFETIME); -} -ALIAS (no_max_lsp_lifetime_l1, - no_max_lsp_lifetime_l1_arg_cmd, - "no max-lsp-lifetime level-1 <350-65535>", +DEFUN (no_max_lsp_lifetime, + no_max_lsp_lifetime_cmd, + "no max-lsp-lifetime [<level-1|level-2>] [(350-65535)]", NO_STR "Maximum LSP lifetime for Level 1 only\n" - "LSP lifetime for Level 1 only in seconds\n") - -DEFUN (max_lsp_lifetime_l2, - max_lsp_lifetime_l2_cmd, - "max-lsp-lifetime level-2 <350-65535>", "Maximum LSP lifetime for Level 2 only\n" - "LSP lifetime for Level 2 only in seconds\n") + "LSP lifetime in seconds\n") { - return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[0])); -} + int idx = 0; + unsigned int level = IS_LEVEL_1_AND_2; -DEFUN (no_max_lsp_lifetime_l2, - no_max_lsp_lifetime_l2_cmd, - "no max-lsp-lifetime level-2", - NO_STR - "LSP lifetime for Level 2 only in seconds\n") -{ - return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, DEFAULT_LSP_LIFETIME); -} + if (argv_find (argv, argc, "level-1", &idx)) + level = IS_LEVEL_1; + else if (argv_find (argv, argc, "level-2", &idx)) + level = IS_LEVEL_2; -ALIAS (no_max_lsp_lifetime_l2, - no_max_lsp_lifetime_l2_arg_cmd, - "no max-lsp-lifetime level-2 <350-65535>", - NO_STR - "Maximum LSP lifetime for Level 2 only\n" - "LSP lifetime for Level 2 only in seconds\n") + return area_max_lsp_lifetime_set(vty, level, DEFAULT_LSP_LIFETIME); +} static int area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval) @@ -2028,81 +1887,44 @@ area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval) DEFUN (lsp_refresh_interval, lsp_refresh_interval_cmd, - "lsp-refresh-interval <1-65235>", + "lsp-refresh-interval [<level-1|level-2>] (1-65235)", "LSP refresh interval\n" + "LSP refresh interval for Level 1 only\n" + "LSP refresh interval for Level 2 only\n" "LSP refresh interval in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0])); + int idx = 0; + unsigned int level = IS_LEVEL_1_AND_2; + unsigned int interval = 0; + + if (argv_find (argv, argc, "level-1", &idx)) + level = IS_LEVEL_1; + else if (argv_find (argv, argc, "level-2", &idx)) + level = IS_LEVEL_2; + + interval = atoi(argv[argc-1]->arg); + return area_lsp_refresh_interval_set(vty, level, interval); } DEFUN (no_lsp_refresh_interval, no_lsp_refresh_interval_cmd, - "no lsp-refresh-interval", - NO_STR - "LSP refresh interval in seconds\n") -{ - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, - DEFAULT_MAX_LSP_GEN_INTERVAL); -} - -ALIAS (no_lsp_refresh_interval, - no_lsp_refresh_interval_arg_cmd, - "no lsp-refresh-interval <1-65235>", + "no lsp-refresh-interval [<level-1|level-2>] [(1-65235)]", NO_STR "LSP refresh interval\n" - "LSP refresh interval in seconds\n") - -DEFUN (lsp_refresh_interval_l1, - lsp_refresh_interval_l1_cmd, - "lsp-refresh-interval level-1 <1-65235>", - "LSP refresh interval for Level 1 only\n" - "LSP refresh interval for Level 1 only in seconds\n") -{ - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[0])); -} - -DEFUN (no_lsp_refresh_interval_l1, - no_lsp_refresh_interval_l1_cmd, - "no lsp-refresh-interval level-1", - NO_STR - "LSP refresh interval for Level 1 only in seconds\n") -{ - return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, - DEFAULT_MAX_LSP_GEN_INTERVAL); -} - -ALIAS (no_lsp_refresh_interval_l1, - no_lsp_refresh_interval_l1_arg_cmd, - "no lsp-refresh-interval level-1 <1-65235>", - NO_STR "LSP refresh interval for Level 1 only\n" - "LSP refresh interval for Level 1 only in seconds\n") - -DEFUN (lsp_refresh_interval_l2, - lsp_refresh_interval_l2_cmd, - "lsp-refresh-interval level-2 <1-65235>", "LSP refresh interval for Level 2 only\n" - "LSP refresh interval for Level 2 only in seconds\n") + "LSP refresh interval in seconds\n") { - return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[0])); -} + int idx = 0; + unsigned int level = IS_LEVEL_1_AND_2; -DEFUN (no_lsp_refresh_interval_l2, - no_lsp_refresh_interval_l2_cmd, - "no lsp-refresh-interval level-2", - NO_STR - "LSP refresh interval for Level 2 only in seconds\n") -{ - return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, - DEFAULT_MAX_LSP_GEN_INTERVAL); -} + if (argv_find (argv, argc, "level-1", &idx)) + level = IS_LEVEL_1; + else if (argv_find (argv, argc, "level-2", &idx)) + level = IS_LEVEL_2; -ALIAS (no_lsp_refresh_interval_l2, - no_lsp_refresh_interval_l2_arg_cmd, - "no lsp-refresh-interval level-2 <1-65235>", - NO_STR - "LSP refresh interval for Level 2 only\n" - "LSP refresh interval for Level 2 only in seconds\n") + return area_lsp_refresh_interval_set(vty, level, DEFAULT_MAX_LSP_GEN_INTERVAL); +} static int area_passwd_set(struct vty *vty, int level, @@ -2122,32 +1944,38 @@ area_passwd_set(struct vty *vty, int level, return CMD_SUCCESS; } + DEFUN (area_passwd_md5, area_passwd_md5_cmd, - "(area-password|domain-password) md5 WORD", + "area-password md5 WORD [authenticate snp <send-only|validate>]", "Configure the authentication password for an area\n" - "Set the authentication password for a routing domain\n" "Authentication type\n" - "Level-wide password\n") + "Level-wide password\n" + "Authentication\n" + "SNP PDUs\n" + "Send but do not check PDUs on receiving\n" + "Send and check PDUs on receiving\n") { + int idx_password = 0; + int idx_word = 2; + int idx_type = 5; u_char snp_auth = 0; - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = strmatch(argv[idx_password]->text, "domain-password") ? IS_LEVEL_2 : IS_LEVEL_1; - if (argc > 2) + if (argc > 3) { snp_auth = SNP_AUTH_SEND; - if (strncmp(argv[2], "v", 1) == 0) + if (strmatch(argv[idx_type]->text, "validate")) snp_auth |= SNP_AUTH_RECV; } return area_passwd_set(vty, level, isis_area_passwd_hmac_md5_set, - argv[1], snp_auth); + argv[idx_word]->arg, snp_auth); } -ALIAS (area_passwd_md5, - area_passwd_md5_snpauth_cmd, - "(area-password|domain-password) md5 WORD authenticate snp (send-only|validate)", - "Configure the authentication password for an area\n" +DEFUN (domain_passwd_md5, + domain_passwd_md5_cmd, + "domain-password md5 WORD [authenticate snp <send-only|validate>]", "Set the authentication password for a routing domain\n" "Authentication type\n" "Level-wide password\n" @@ -2155,33 +1983,41 @@ ALIAS (area_passwd_md5, "SNP PDUs\n" "Send but do not check PDUs on receiving\n" "Send and check PDUs on receiving\n") +{ + return area_passwd_md5 (self, vty, argc, argv); +} DEFUN (area_passwd_clear, area_passwd_clear_cmd, - "(area-password|domain-password) clear WORD", + "area-password clear WORD [authenticate snp <send-only|validate>]", "Configure the authentication password for an area\n" - "Set the authentication password for a routing domain\n" "Authentication type\n" - "Area password\n") + "Area password\n" + "Authentication\n" + "SNP PDUs\n" + "Send but do not check PDUs on receiving\n" + "Send and check PDUs on receiving\n") { + int idx_password = 0; + int idx_word = 2; + int idx_type = 5; u_char snp_auth = 0; - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; + int level = strmatch(argv[idx_password]->text, "domain-password") ? IS_LEVEL_2 : IS_LEVEL_1; - if (argc > 2) + if (argc > 3) { snp_auth = SNP_AUTH_SEND; - if (strncmp(argv[2], "v", 1) == 0) + if (strmatch (argv[idx_type]->text, "validate")) snp_auth |= SNP_AUTH_RECV; } return area_passwd_set(vty, level, isis_area_passwd_cleartext_set, - argv[1], snp_auth); + argv[idx_word]->arg, snp_auth); } -ALIAS (area_passwd_clear, - area_passwd_clear_snpauth_cmd, - "(area-password|domain-password) clear WORD authenticate snp (send-only|validate)", - "Configure the authentication password for an area\n" +DEFUN (domain_passwd_clear, + domain_passwd_clear_cmd, + "domain-password clear WORD [authenticate snp <send-only|validate>]", "Set the authentication password for a routing domain\n" "Authentication type\n" "Area password\n" @@ -2189,16 +2025,20 @@ ALIAS (area_passwd_clear, "SNP PDUs\n" "Send but do not check PDUs on receiving\n" "Send and check PDUs on receiving\n") +{ + return area_passwd_clear (self, vty, argc, argv); +} DEFUN (no_area_passwd, no_area_passwd_cmd, - "no (area-password|domain-password)", + "no <area-password|domain-password>", NO_STR "Configure the authentication password for an area\n" "Set the authentication password for a routing domain\n") { + int idx_password = 1; + int level = strmatch (argv[idx_password]->text, "domain-password") ? IS_LEVEL_2 : IS_LEVEL_1; VTY_DECLVAR_CONTEXT (isis_area, area); - int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; return isis_area_passwd_unset (area, level); } @@ -2207,6 +2047,7 @@ void isis_vty_init (void) { install_element (INTERFACE_NODE, &ip_router_isis_cmd); + install_element (INTERFACE_NODE, &ip6_router_isis_cmd); install_element (INTERFACE_NODE, &no_ip_router_isis_cmd); install_element (INTERFACE_NODE, &isis_passive_cmd); @@ -2220,70 +2061,51 @@ isis_vty_init (void) install_element (INTERFACE_NODE, &isis_passwd_cmd); install_element (INTERFACE_NODE, &no_isis_passwd_cmd); - install_element (INTERFACE_NODE, &no_isis_passwd_arg_cmd); install_element (INTERFACE_NODE, &isis_priority_cmd); install_element (INTERFACE_NODE, &no_isis_priority_cmd); - install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd); install_element (INTERFACE_NODE, &isis_priority_l1_cmd); install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd); - install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd); install_element (INTERFACE_NODE, &isis_priority_l2_cmd); install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd); - install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd); install_element (INTERFACE_NODE, &isis_metric_cmd); install_element (INTERFACE_NODE, &no_isis_metric_cmd); - install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd); install_element (INTERFACE_NODE, &isis_metric_l1_cmd); install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd); - install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd); install_element (INTERFACE_NODE, &isis_metric_l2_cmd); install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd); - install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_interval_cmd); install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd); install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd); install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd); install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd); install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd); install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd); - install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd); install_element (INTERFACE_NODE, &isis_hello_padding_cmd); install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd); install_element (INTERFACE_NODE, &csnp_interval_cmd); install_element (INTERFACE_NODE, &no_csnp_interval_cmd); - install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd); install_element (INTERFACE_NODE, &csnp_interval_l1_cmd); install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd); - install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd); install_element (INTERFACE_NODE, &csnp_interval_l2_cmd); install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd); - install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd); install_element (INTERFACE_NODE, &psnp_interval_cmd); install_element (INTERFACE_NODE, &no_psnp_interval_cmd); - install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd); install_element (INTERFACE_NODE, &psnp_interval_l1_cmd); install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd); - install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd); install_element (INTERFACE_NODE, &psnp_interval_l2_cmd); install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd); - install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd); install_element (ISIS_NODE, &metric_style_cmd); install_element (ISIS_NODE, &no_metric_style_cmd); @@ -2299,54 +2121,33 @@ isis_vty_init (void) install_element (ISIS_NODE, &area_lsp_mtu_cmd); install_element (ISIS_NODE, &no_area_lsp_mtu_cmd); - install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd); install_element (ISIS_NODE, &is_type_cmd); install_element (ISIS_NODE, &no_is_type_cmd); install_element (ISIS_NODE, &lsp_gen_interval_cmd); install_element (ISIS_NODE, &no_lsp_gen_interval_cmd); - install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd); install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd); install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd); - install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd); install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd); install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd); - install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd); install_element (ISIS_NODE, &spf_interval_cmd); install_element (ISIS_NODE, &no_spf_interval_cmd); - install_element (ISIS_NODE, &no_spf_interval_arg_cmd); install_element (ISIS_NODE, &spf_interval_l1_cmd); install_element (ISIS_NODE, &no_spf_interval_l1_cmd); - install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd); install_element (ISIS_NODE, &spf_interval_l2_cmd); install_element (ISIS_NODE, &no_spf_interval_l2_cmd); - install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd); install_element (ISIS_NODE, &max_lsp_lifetime_cmd); install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd); - install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd); - install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd); - install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd); install_element (ISIS_NODE, &lsp_refresh_interval_cmd); install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd); - install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd); - install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd); - install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd); install_element (ISIS_NODE, &area_passwd_md5_cmd); - install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd); install_element (ISIS_NODE, &area_passwd_clear_cmd); - install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd); + install_element (ISIS_NODE, &domain_passwd_md5_cmd); + install_element (ISIS_NODE, &domain_passwd_clear_cmd); install_element (ISIS_NODE, &no_area_passwd_cmd); } diff --git a/isisd/isisd.c b/isisd/isisd.c index c22be5fa8..cce0c1e39 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -529,7 +529,8 @@ DEFUN (show_isis_interface_arg, "ISIS interface\n" "ISIS interface name\n") { - return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + int idx_word = 3; + return show_isis_interface_common (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); } /* @@ -703,7 +704,8 @@ DEFUN (show_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + int idx_word = 3; + return show_isis_neighbor_common (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); } DEFUN (clear_isis_neighbor, @@ -724,7 +726,8 @@ DEFUN (clear_isis_neighbor_arg, "ISIS neighbor adjacencies\n" "System id\n") { - return clear_isis_neighbor_common (vty, argv[0]); + int idx_word = 3; + return clear_isis_neighbor_common (vty, argv[idx_word]->arg); } /* @@ -895,6 +898,7 @@ DEFUN (debug_isis_adj, DEFUN (no_debug_isis_adj, no_debug_isis_adj_cmd, "no debug isis adj-packets", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Adjacency related packets\n") @@ -921,6 +925,7 @@ DEFUN (debug_isis_csum, DEFUN (no_debug_isis_csum, no_debug_isis_csum_cmd, "no debug isis checksum-errors", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS LSP checksum errors\n") @@ -947,6 +952,7 @@ DEFUN (debug_isis_lupd, DEFUN (no_debug_isis_lupd, no_debug_isis_lupd_cmd, "no debug isis local-updates", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS local update packets\n") @@ -973,6 +979,7 @@ DEFUN (debug_isis_err, DEFUN (no_debug_isis_err, no_debug_isis_err_cmd, "no debug isis protocol-errors", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS LSP protocol errors\n") @@ -999,6 +1006,7 @@ DEFUN (debug_isis_snp, DEFUN (no_debug_isis_snp, no_debug_isis_snp_cmd, "no debug isis snp-packets", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS CSNP/PSNP packets\n") @@ -1025,6 +1033,7 @@ DEFUN (debug_isis_upd, DEFUN (no_debug_isis_upd, no_debug_isis_upd_cmd, "no debug isis update-packets", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Update related packets\n") @@ -1051,6 +1060,7 @@ DEFUN (debug_isis_spfevents, DEFUN (no_debug_isis_spfevents, no_debug_isis_spfevents_cmd, "no debug isis spf-events", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Shortest Path First Events\n") @@ -1077,6 +1087,7 @@ DEFUN (debug_isis_spfstats, DEFUN (no_debug_isis_spfstats, no_debug_isis_spfstats_cmd, "no debug isis spf-statistics", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS SPF Timing and Statistic Data\n") @@ -1103,6 +1114,7 @@ DEFUN (debug_isis_spftrigg, DEFUN (no_debug_isis_spftrigg, no_debug_isis_spftrigg_cmd, "no debug isis spf-triggers", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS SPF triggering events\n") @@ -1129,6 +1141,7 @@ DEFUN (debug_isis_rtevents, DEFUN (no_debug_isis_rtevents, no_debug_isis_rtevents_cmd, "no debug isis route-events", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Route related events\n") @@ -1155,6 +1168,7 @@ DEFUN (debug_isis_events, DEFUN (no_debug_isis_events, no_debug_isis_events_cmd, "no debug isis events", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS Events\n") @@ -1181,6 +1195,7 @@ DEFUN (debug_isis_packet_dump, DEFUN (no_debug_isis_packet_dump, no_debug_isis_packet_dump_cmd, "no debug isis packet-dump", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS packet dump\n") @@ -1207,6 +1222,7 @@ DEFUN (debug_isis_lsp_gen, DEFUN (no_debug_isis_lsp_gen, no_debug_isis_lsp_gen_cmd, "no debug isis lsp-gen", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS generation of own LSPs\n") @@ -1233,6 +1249,7 @@ DEFUN (debug_isis_lsp_sched, DEFUN (no_debug_isis_lsp_sched, no_debug_isis_lsp_sched_cmd, "no debug isis lsp-sched", + NO_STR UNDEBUG_STR "IS-IS information\n" "IS-IS scheduling of LSP generation\n") @@ -1526,7 +1543,8 @@ DEFUN (show_database_lsp_brief, "IS-IS link state database\n" "LSP ID\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF); + int idx_word = 3; + return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_BRIEF); } DEFUN (show_database_lsp_detail, @@ -1538,7 +1556,8 @@ DEFUN (show_database_lsp_detail, "LSP ID\n" "Detailed information\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + int idx_word = 3; + return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); } DEFUN (show_database_detail, @@ -1560,7 +1579,8 @@ DEFUN (show_database_detail_lsp, "Detailed information\n" "LSP ID\n") { - return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); + int idx_word = 4; + return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); } /* @@ -1573,7 +1593,8 @@ DEFUN (router_isis, "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_get (vty, argv[0]); + int idx_word = 2; + return isis_area_get (vty, argv[idx_word]->arg); } /* @@ -1584,7 +1605,8 @@ DEFUN (no_router_isis, "no router isis WORD", "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") { - return isis_area_destroy (vty, argv[0]); + int idx_word = 3; + return isis_area_destroy (vty, argv[idx_word]->arg); } /* @@ -1596,7 +1618,8 @@ DEFUN (net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_net_title (vty, argv[0]); + int idx_word = 1; + return area_net_title (vty, argv[idx_word]->arg); } /* @@ -1609,7 +1632,8 @@ DEFUN (no_net, "A Network Entity Title for this process (OSI only)\n" "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") { - return area_clear_net_title (vty, argv[0]); + int idx_word = 2; + return area_clear_net_title (vty, argv[idx_word]->arg); } void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) @@ -1873,6 +1897,7 @@ DEFUN (log_adj_changes, DEFUN (no_log_adj_changes, no_log_adj_changes_cmd, "no log-adjacency-changes", + NO_STR "Stop logging changes in adjacency state\n") { VTY_DECLVAR_CONTEXT (isis_area, area); |