isisd: add 'int idx_foo' argv index variables

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Daniel Walton 2016-09-23 19:50:58 +00:00
parent c500ae4060
commit ba4c5c8307
6 changed files with 188 additions and 91 deletions

View File

@ -551,6 +551,10 @@ DEFUN (isis_redistribute,
"Route map reference\n" "Route map reference\n"
"Pointer to route-map entries\n") "Pointer to route-map entries\n")
{ {
int idx_afi = 1;
int idx_protocol = 2;
int idx_level = 3;
int idx_metric_rmap = 4;
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
int family; int family;
int afi; int afi;
@ -562,7 +566,7 @@ DEFUN (isis_redistribute,
if (argc < 5) if (argc < 5)
return CMD_WARNING; return CMD_WARNING;
family = str2family(argv[1]->arg); family = str2family(argv[idx_afi]->arg);
if (family < 0) if (family < 0)
return CMD_WARNING; return CMD_WARNING;
@ -570,13 +574,13 @@ DEFUN (isis_redistribute,
if (!afi) if (!afi)
return CMD_WARNING; return CMD_WARNING;
type = proto_redistnum(afi, argv[2]->arg); type = proto_redistnum(afi, argv[idx_protocol]->arg);
if (type < 0 || type == ZEBRA_ROUTE_ISIS) if (type < 0 || type == ZEBRA_ROUTE_ISIS)
return CMD_WARNING; return CMD_WARNING;
if (!strcmp("level-1", argv[3]->arg)) if (!strcmp("level-1", argv[idx_level]->arg))
level = 1; level = 1;
else if (!strcmp("level-2", argv[3]->arg)) else if (!strcmp("level-2", argv[idx_level]->arg))
level = 2; level = 2;
else else
return CMD_WARNING; return CMD_WARNING;
@ -587,11 +591,11 @@ DEFUN (isis_redistribute,
return CMD_WARNING; return CMD_WARNING;
} }
if (argv[4]->arg) if (argv[idx_metric_rmap]->arg)
{ {
char *endp; char *endp;
metric = strtoul(argv[4]->arg, &endp, 10); metric = strtoul(argv[idx_metric_rmap]->arg, &endp, 10);
if (argv[4]->arg[0] == '\0' || *endp != '\0') if (argv[idx_metric_rmap]->arg[0] == '\0' || *endp != '\0')
return CMD_WARNING; return CMD_WARNING;
} }
else else
@ -616,6 +620,9 @@ DEFUN (no_isis_redistribute,
"Redistribute into level-1\n" "Redistribute into level-1\n"
"Redistribute into level-2\n") "Redistribute into level-2\n")
{ {
int idx_afi = 2;
int idx_protocol = 3;
int idx_level = 4;
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
int type; int type;
int level; int level;
@ -625,7 +632,7 @@ DEFUN (no_isis_redistribute,
if (argc < 3) if (argc < 3)
return CMD_WARNING; return CMD_WARNING;
family = str2family(argv[2]->arg); family = str2family(argv[idx_afi]->arg);
if (family < 0) if (family < 0)
return CMD_WARNING; return CMD_WARNING;
@ -633,13 +640,13 @@ DEFUN (no_isis_redistribute,
if (!afi) if (!afi)
return CMD_WARNING; return CMD_WARNING;
type = proto_redistnum(afi, argv[3]->arg); type = proto_redistnum(afi, argv[idx_protocol]->arg);
if (type < 0 || type == ZEBRA_ROUTE_ISIS) if (type < 0 || type == ZEBRA_ROUTE_ISIS)
return CMD_WARNING; return CMD_WARNING;
if (!strcmp("level-1", argv[4]->arg)) if (!strcmp("level-1", argv[idx_level]->arg))
level = 1; level = 1;
else if (!strcmp("level-2", argv[4]->arg)) else if (!strcmp("level-2", argv[idx_level]->arg))
level = 2; level = 2;
else else
return CMD_WARNING; return CMD_WARNING;
@ -663,6 +670,9 @@ DEFUN (isis_default_originate,
"Route map reference\n" "Route map reference\n"
"Pointer to route-map entries\n") "Pointer to route-map entries\n")
{ {
int idx_afi = 2;
int idx_level = 3;
int idx_metric_rmap = 4;
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
int family; int family;
int originate_type; int originate_type;
@ -673,13 +683,13 @@ DEFUN (isis_default_originate,
if (argc < 5) if (argc < 5)
return CMD_WARNING; return CMD_WARNING;
family = str2family(argv[2]->arg); family = str2family(argv[idx_afi]->arg);
if (family < 0) if (family < 0)
return CMD_WARNING; return CMD_WARNING;
if (!strcmp("level-1", argv[3]->arg)) if (!strcmp("level-1", argv[idx_level]->arg))
level = 1; level = 1;
else if (!strcmp("level-2", argv[3]->arg)) else if (!strcmp("level-2", argv[idx_level]->arg))
level = 2; level = 2;
else else
return CMD_WARNING; return CMD_WARNING;
@ -690,7 +700,7 @@ DEFUN (isis_default_originate,
return CMD_WARNING; return CMD_WARNING;
} }
if (argv[4]->arg && *argv[4]->arg != '\0') if (argv[idx_metric_rmap]->arg && *argv[idx_metric_rmap]->arg != '\0')
originate_type = DEFAULT_ORIGINATE_ALWAYS; originate_type = DEFAULT_ORIGINATE_ALWAYS;
else else
originate_type = DEFAULT_ORIGINATE; originate_type = DEFAULT_ORIGINATE;
@ -730,6 +740,8 @@ DEFUN (no_isis_default_originate,
"Distribute default route into level-1\n" "Distribute default route into level-1\n"
"Distribute default route into level-2\n") "Distribute default route into level-2\n")
{ {
int idx_afi = 3;
int idx_level = 4;
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
int family; int family;
@ -738,13 +750,13 @@ DEFUN (no_isis_default_originate,
if (argc < 2) if (argc < 2)
return CMD_WARNING; return CMD_WARNING;
family = str2family(argv[3]->arg); family = str2family(argv[idx_afi]->arg);
if (family < 0) if (family < 0)
return CMD_WARNING; return CMD_WARNING;
if (!strcmp("level-1", argv[4]->arg)) if (!strcmp("level-1", argv[idx_level]->arg))
level = 1; level = 1;
else if (!strcmp("level-2", argv[4]->arg)) else if (!strcmp("level-2", argv[idx_level]->arg))
level = 2; level = 2;
else else
return CMD_WARNING; return CMD_WARNING;

View File

@ -354,7 +354,8 @@ DEFUN (match_ip_address,
"IP access-list number (expanded range)\n" "IP access-list number (expanded range)\n"
"IP Access-list name\n") "IP Access-list name\n")
{ {
return isis_route_match_add(vty, vty->index, "ip address", argv[3]->arg); int idx_acl = 3;
return isis_route_match_add(vty, vty->index, "ip address", argv[idx_acl]->arg);
} }
/* /*
@ -377,9 +378,10 @@ DEFUN (no_match_ip_address,
"IP access-list number (expanded range)\n" "IP access-list number (expanded range)\n"
"IP Access-list name\n") "IP Access-list name\n")
{ {
int idx_acl = 4;
if (argc == 0) if (argc == 0)
return isis_route_match_delete(vty, vty->index, "ip address", NULL); return isis_route_match_delete(vty, vty->index, "ip address", NULL);
return isis_route_match_delete(vty, vty->index, "ip address", argv[4]->arg); return isis_route_match_delete(vty, vty->index, "ip address", argv[idx_acl]->arg);
} }
@ -394,7 +396,8 @@ DEFUN (match_ip_address_prefix_list,
"Match entries of prefix-lists\n" "Match entries of prefix-lists\n"
"IP prefix-list name\n") "IP prefix-list name\n")
{ {
return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[4]->arg); int idx_word = 4;
return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[idx_word]->arg);
} }
/* /*
@ -433,7 +436,8 @@ DEFUN (match_ipv6_address,
"Match IPv6 address of route\n" "Match IPv6 address of route\n"
"IPv6 access-list name\n") "IPv6 access-list name\n")
{ {
return isis_route_match_add(vty, vty->index, "ipv6 address", argv[3]->arg); int idx_word = 3;
return isis_route_match_add(vty, vty->index, "ipv6 address", argv[idx_word]->arg);
} }
/* /*
@ -454,9 +458,10 @@ DEFUN (no_match_ipv6_address,
"Match IPv6 address of route\n" "Match IPv6 address of route\n"
"IPv6 access-list name\n") "IPv6 access-list name\n")
{ {
int idx_word = 4;
if (argc == 0) if (argc == 0)
return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL);
return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[4]->arg); return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[idx_word]->arg);
} }
@ -471,7 +476,8 @@ DEFUN (match_ipv6_address_prefix_list,
"Match entries of prefix-lists\n" "Match entries of prefix-lists\n"
"IP prefix-list name\n") "IP prefix-list name\n")
{ {
return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[4]->arg); int idx_word = 4;
return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[idx_word]->arg);
} }
/* /*
@ -512,7 +518,8 @@ DEFUN (set_metric,
"Metric vale for destination routing protocol\n" "Metric vale for destination routing protocol\n"
"Metric value\n") "Metric value\n")
{ {
return isis_route_set_add(vty, vty->index, "metric", argv[2]->arg); int idx_number = 2;
return isis_route_set_add(vty, vty->index, "metric", argv[idx_number]->arg);
} }
/* /*
@ -534,9 +541,10 @@ DEFUN (no_set_metric,
"Metric value for destination routing protocol\n" "Metric value for destination routing protocol\n"
"Metric value\n") "Metric value\n")
{ {
int idx_number = 3;
if (argc == 0) if (argc == 0)
return isis_route_set_delete(vty, vty->index, "metric", NULL); return isis_route_set_delete(vty, vty->index, "metric", NULL);
return isis_route_set_delete(vty, vty->index, "metric", argv[3]->arg); return isis_route_set_delete(vty, vty->index, "metric", argv[idx_number]->arg);
} }
{ {

View File

@ -1163,11 +1163,12 @@ DEFUN (isis_mpls_te_router_addr,
"Stable IP address of the advertising router\n" "Stable IP address of the advertising router\n"
"MPLS-TE router address in IPv4 address format\n") "MPLS-TE router address in IPv4 address format\n")
{ {
int idx_ipv4 = 2;
struct in_addr value; struct in_addr value;
struct listnode *node; struct listnode *node;
struct isis_area *area; struct isis_area *area;
if (! inet_aton (argv[2]->arg, &value)) if (! inet_aton (argv[idx_ipv4]->arg, &value))
{ {
vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE); vty_out (vty, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
@ -1317,6 +1318,7 @@ DEFUN (show_isis_mpls_te_interface,
"Interface information\n" "Interface information\n"
"Interface name\n") "Interface name\n")
{ {
int idx_interface = 4;
struct interface *ifp; struct interface *ifp;
struct listnode *node; struct listnode *node;
@ -1329,7 +1331,7 @@ DEFUN (show_isis_mpls_te_interface,
/* Interface name is specified. */ /* Interface name is specified. */
else else
{ {
if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL) if ((ifp = if_lookup_by_name (argv[idx_interface]->arg)) == NULL)
vty_out (vty, "No such interface name%s", VTY_NEWLINE); vty_out (vty, "No such interface name%s", VTY_NEWLINE);
else else
show_mpls_te_sub (vty, ifp); show_mpls_te_sub (vty, ifp);

View File

@ -61,11 +61,13 @@ DEFUN (ip_router_isis,
"IS-IS Routing for IP\n" "IS-IS Routing for IP\n"
"Routing process tag\n") "Routing process tag\n")
{ {
int idx_afi = 0;
int idx_word = 3;
struct interface *ifp; struct interface *ifp;
struct isis_circuit *circuit; struct isis_circuit *circuit;
struct isis_area *area; struct isis_area *area;
const char *af = argv[0]->arg; const char *af = argv[idx_afi]->arg;
const char *area_tag = argv[3]->arg; const char *area_tag = argv[idx_word]->arg;
ifp = (struct interface *) vty->index; ifp = (struct interface *) vty->index;
assert (ifp); assert (ifp);
@ -115,11 +117,13 @@ DEFUN (no_ip_router_isis,
"IS-IS Routing for IP\n" "IS-IS Routing for IP\n"
"Routing process tag\n") "Routing process tag\n")
{ {
int idx_afi = 1;
int idx_word = 4;
struct interface *ifp; struct interface *ifp;
struct isis_area *area; struct isis_area *area;
struct isis_circuit *circuit; struct isis_circuit *circuit;
const char *af = argv[1]->arg; const char *af = argv[idx_afi]->arg;
const char *area_tag = argv[4]->arg; const char *area_tag = argv[idx_word]->arg;
ifp = (struct interface *) vty->index; ifp = (struct interface *) vty->index;
if (!ifp) if (!ifp)
@ -132,7 +136,7 @@ DEFUN (no_ip_router_isis,
if (!area) if (!area)
{ {
vty_out (vty, "Can't find ISIS instance %s%s", vty_out (vty, "Can't find ISIS instance %s%s",
argv[1]->arg, VTY_NEWLINE); argv[idx_afi]->arg, VTY_NEWLINE);
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
} }
@ -199,12 +203,13 @@ DEFUN (isis_circuit_type,
"Level-1-2 adjacencies are formed\n" "Level-1-2 adjacencies are formed\n"
"Level-2 only adjacencies are formed\n") "Level-2 only adjacencies are formed\n")
{ {
int idx_level = 2;
int is_type; int is_type;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
is_type = string2circuit_t (argv[2]->arg); is_type = string2circuit_t (argv[idx_level]->arg);
if (!is_type) if (!is_type)
{ {
vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE); vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
@ -305,15 +310,17 @@ DEFUN (isis_passwd,
"Cleartext password\n" "Cleartext password\n"
"Circuit password\n") "Circuit password\n")
{ {
int idx_encryption = 2;
int idx_word = 3;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
int rv; int rv;
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
if (argv[2]->arg[0] == 'm') if (argv[idx_encryption]->arg[0] == 'm')
rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[3]->arg); rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[idx_word]->arg);
else else
rv = isis_circuit_passwd_cleartext_set(circuit, argv[3]->arg); rv = isis_circuit_passwd_cleartext_set(circuit, argv[idx_word]->arg);
if (rv) if (rv)
{ {
vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE); vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
@ -358,12 +365,13 @@ DEFUN (isis_priority,
"Set priority for Designated Router election\n" "Set priority for Designated Router election\n"
"Priority value\n") "Priority value\n")
{ {
int idx_number = 2;
int prio; int prio;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
prio = atoi (argv[2]->arg); prio = atoi (argv[idx_number]->arg);
if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
{ {
vty_out (vty, "Invalid priority %d - should be <0-127>%s", vty_out (vty, "Invalid priority %d - should be <0-127>%s",
@ -412,12 +420,13 @@ DEFUN (isis_priority_l1,
"Priority value\n" "Priority value\n"
"Specify priority for level-1 routing\n") "Specify priority for level-1 routing\n")
{ {
int idx_number = 2;
int prio; int prio;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
prio = atoi (argv[2]->arg); prio = atoi (argv[idx_number]->arg);
if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
{ {
vty_out (vty, "Invalid priority %d - should be <0-127>%s", vty_out (vty, "Invalid priority %d - should be <0-127>%s",
@ -466,12 +475,13 @@ DEFUN (isis_priority_l2,
"Priority value\n" "Priority value\n"
"Specify priority for level-2 routing\n") "Specify priority for level-2 routing\n")
{ {
int idx_number = 2;
int prio; int prio;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
prio = atoi (argv[2]->arg); prio = atoi (argv[idx_number]->arg);
if (prio < MIN_PRIORITY || prio > MAX_PRIORITY) if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
{ {
vty_out (vty, "Invalid priority %d - should be <0-127>%s", vty_out (vty, "Invalid priority %d - should be <0-127>%s",
@ -520,12 +530,13 @@ DEFUN (isis_metric,
"Set default metric for circuit\n" "Set default metric for circuit\n"
"Default metric value\n") "Default metric value\n")
{ {
int idx_number = 2;
int met; int met;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
met = atoi (argv[2]->arg); met = atoi (argv[idx_number]->arg);
/* RFC3787 section 5.1 */ /* RFC3787 section 5.1 */
if (circuit->area && circuit->area->oldmetric == 1 && if (circuit->area && circuit->area->oldmetric == 1 &&
@ -586,12 +597,13 @@ DEFUN (isis_metric_l1,
"Default metric value\n" "Default metric value\n"
"Specify metric for level-1 routing\n") "Specify metric for level-1 routing\n")
{ {
int idx_number = 2;
int met; int met;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
met = atoi (argv[2]->arg); met = atoi (argv[idx_number]->arg);
/* RFC3787 section 5.1 */ /* RFC3787 section 5.1 */
if (circuit->area && circuit->area->oldmetric == 1 && if (circuit->area && circuit->area->oldmetric == 1 &&
@ -652,12 +664,13 @@ DEFUN (isis_metric_l2,
"Default metric value\n" "Default metric value\n"
"Specify metric for level-2 routing\n") "Specify metric for level-2 routing\n")
{ {
int idx_number = 2;
int met; int met;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
met = atoi (argv[2]->arg); met = atoi (argv[idx_number]->arg);
/* RFC3787 section 5.1 */ /* RFC3787 section 5.1 */
if (circuit->area && circuit->area->oldmetric == 1 && if (circuit->area && circuit->area->oldmetric == 1 &&
@ -719,12 +732,13 @@ DEFUN (isis_hello_interval,
"Hello interval value\n" "Hello interval value\n"
"Holdtime 1 seconds, interval depends on multiplier\n") "Holdtime 1 seconds, interval depends on multiplier\n")
{ {
int idx_number = 2;
int interval; int interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atoi (argv[2]->arg); interval = atoi (argv[idx_number]->arg);
if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
{ {
vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s", vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
@ -775,12 +789,13 @@ DEFUN (isis_hello_interval_l1,
"Holdtime 1 second, interval depends on multiplier\n" "Holdtime 1 second, interval depends on multiplier\n"
"Specify hello-interval for level-1 IIHs\n") "Specify hello-interval for level-1 IIHs\n")
{ {
int idx_number = 2;
long interval; long interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atoi (argv[2]->arg); interval = atoi (argv[idx_number]->arg);
if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
{ {
vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
@ -831,12 +846,13 @@ DEFUN (isis_hello_interval_l2,
"Holdtime 1 second, interval depends on multiplier\n" "Holdtime 1 second, interval depends on multiplier\n"
"Specify hello-interval for level-2 IIHs\n") "Specify hello-interval for level-2 IIHs\n")
{ {
int idx_number = 2;
long interval; long interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atoi (argv[2]->arg); interval = atoi (argv[idx_number]->arg);
if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL) if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
{ {
vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s", vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
@ -885,12 +901,13 @@ DEFUN (isis_hello_multiplier,
"Set multiplier for Hello holding time\n" "Set multiplier for Hello holding time\n"
"Hello multiplier value\n") "Hello multiplier value\n")
{ {
int idx_number = 2;
int mult; int mult;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
mult = atoi (argv[2]->arg); mult = atoi (argv[idx_number]->arg);
if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
{ {
vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
@ -939,12 +956,13 @@ DEFUN (isis_hello_multiplier_l1,
"Hello multiplier value\n" "Hello multiplier value\n"
"Specify hello multiplier for level-1 IIHs\n") "Specify hello multiplier for level-1 IIHs\n")
{ {
int idx_number = 2;
int mult; int mult;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
mult = atoi (argv[2]->arg); mult = atoi (argv[idx_number]->arg);
if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
{ {
vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
@ -993,12 +1011,13 @@ DEFUN (isis_hello_multiplier_l2,
"Hello multiplier value\n" "Hello multiplier value\n"
"Specify hello multiplier for level-2 IIHs\n") "Specify hello multiplier for level-2 IIHs\n")
{ {
int idx_number = 2;
int mult; int mult;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
mult = atoi (argv[2]->arg); mult = atoi (argv[idx_number]->arg);
if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER) if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
{ {
vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s", vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
@ -1081,12 +1100,13 @@ DEFUN (csnp_interval,
"Set CSNP interval in seconds\n" "Set CSNP interval in seconds\n"
"CSNP interval value\n") "CSNP interval value\n")
{ {
int idx_number = 2;
unsigned long interval; unsigned long interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atol (argv[2]->arg); interval = atol (argv[idx_number]->arg);
if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
{ {
vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
@ -1135,12 +1155,13 @@ DEFUN (csnp_interval_l1,
"CSNP interval value\n" "CSNP interval value\n"
"Specify interval for level-1 CSNPs\n") "Specify interval for level-1 CSNPs\n")
{ {
int idx_number = 2;
unsigned long interval; unsigned long interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atol (argv[2]->arg); interval = atol (argv[idx_number]->arg);
if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
{ {
vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
@ -1189,12 +1210,13 @@ DEFUN (csnp_interval_l2,
"CSNP interval value\n" "CSNP interval value\n"
"Specify interval for level-2 CSNPs\n") "Specify interval for level-2 CSNPs\n")
{ {
int idx_number = 2;
unsigned long interval; unsigned long interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atol (argv[2]->arg); interval = atol (argv[idx_number]->arg);
if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL) if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
{ {
vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s", vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
@ -1242,12 +1264,13 @@ DEFUN (psnp_interval,
"Set PSNP interval in seconds\n" "Set PSNP interval in seconds\n"
"PSNP interval value\n") "PSNP interval value\n")
{ {
int idx_number = 2;
unsigned long interval; unsigned long interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atol (argv[2]->arg); interval = atol (argv[idx_number]->arg);
if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
{ {
vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
@ -1296,12 +1319,13 @@ DEFUN (psnp_interval_l1,
"PSNP interval value\n" "PSNP interval value\n"
"Specify interval for level-1 PSNPs\n") "Specify interval for level-1 PSNPs\n")
{ {
int idx_number = 2;
unsigned long interval; unsigned long interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atol (argv[2]->arg); interval = atol (argv[idx_number]->arg);
if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
{ {
vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
@ -1350,12 +1374,13 @@ DEFUN (psnp_interval_l2,
"PSNP interval value\n" "PSNP interval value\n"
"Specify interval for level-2 PSNPs\n") "Specify interval for level-2 PSNPs\n")
{ {
int idx_number = 2;
unsigned long interval; unsigned long interval;
struct isis_circuit *circuit = isis_circuit_lookup (vty); struct isis_circuit *circuit = isis_circuit_lookup (vty);
if (!circuit) if (!circuit)
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
interval = atol (argv[2]->arg); interval = atol (argv[idx_number]->arg);
if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL) if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
{ {
vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s", vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
@ -1442,12 +1467,13 @@ DEFUN (metric_style,
"Send and accept both styles of TLVs during transition\n" "Send and accept both styles of TLVs during transition\n"
"Use new style of TLVs to carry wider metric\n") "Use new style of TLVs to carry wider metric\n")
{ {
int idx_metric_style = 1;
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
int ret; int ret;
assert(area); assert(area);
if (strncmp (argv[1]->arg, "w", 1) == 0) if (strncmp (argv[idx_metric_style]->arg, "w", 1) == 0)
{ {
isis_area_metricstyle_set(area, false, true); isis_area_metricstyle_set(area, false, true);
return CMD_SUCCESS; return CMD_SUCCESS;
@ -1457,9 +1483,9 @@ DEFUN (metric_style,
if (ret != CMD_SUCCESS) if (ret != CMD_SUCCESS)
return ret; return ret;
if (strncmp (argv[1]->arg, "t", 1) == 0) if (strncmp (argv[idx_metric_style]->arg, "t", 1) == 0)
isis_area_metricstyle_set(area, true, true); isis_area_metricstyle_set(area, true, true);
else if (strncmp (argv[1]->arg, "n", 1) == 0) else if (strncmp (argv[idx_metric_style]->arg, "n", 1) == 0)
isis_area_metricstyle_set(area, true, false); isis_area_metricstyle_set(area, true, false);
return CMD_SUCCESS; return CMD_SUCCESS;
@ -1597,9 +1623,10 @@ DEFUN (area_lsp_mtu,
"Configure the maximum size of generated LSPs\n" "Configure the maximum size of generated LSPs\n"
"Maximum size of generated LSPs\n") "Maximum size of generated LSPs\n")
{ {
int idx_number = 1;
unsigned int lsp_mtu; unsigned int lsp_mtu;
VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[1]->arg, 128, 4352); VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[idx_number]->arg, 128, 4352);
return area_lsp_mtu_set(vty, lsp_mtu); return area_lsp_mtu_set(vty, lsp_mtu);
} }
@ -1630,6 +1657,7 @@ DEFUN (is_type,
"Act as both a station router and an area router\n" "Act as both a station router and an area router\n"
"Act as an area router only\n") "Act as an area router only\n")
{ {
int idx_level = 1;
struct isis_area *area; struct isis_area *area;
int type; int type;
@ -1641,7 +1669,7 @@ DEFUN (is_type,
return CMD_ERR_NO_MATCH; return CMD_ERR_NO_MATCH;
} }
type = string2circuit_t (argv[1]->arg); type = string2circuit_t (argv[idx_level]->arg);
if (!type) if (!type)
{ {
vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
@ -1719,12 +1747,13 @@ DEFUN (lsp_gen_interval,
"Minimum interval between regenerating same LSP\n" "Minimum interval between regenerating same LSP\n"
"Minimum interval in seconds\n") "Minimum interval in seconds\n")
{ {
int idx_number = 1;
struct isis_area *area; struct isis_area *area;
uint16_t interval; uint16_t interval;
int level; int level;
area = vty->index; area = vty->index;
interval = atoi (argv[1]->arg); interval = atoi (argv[idx_number]->arg);
level = IS_LEVEL_1 | IS_LEVEL_2; level = IS_LEVEL_1 | IS_LEVEL_2;
return set_lsp_gen_interval (vty, area, interval, level); return set_lsp_gen_interval (vty, area, interval, level);
} }
@ -1761,12 +1790,13 @@ DEFUN (lsp_gen_interval_l1,
"Set interval for level 1 only\n" "Set interval for level 1 only\n"
"Minimum interval in seconds\n") "Minimum interval in seconds\n")
{ {
int idx_number = 2;
struct isis_area *area; struct isis_area *area;
uint16_t interval; uint16_t interval;
int level; int level;
area = vty->index; area = vty->index;
interval = atoi (argv[2]->arg); interval = atoi (argv[idx_number]->arg);
level = IS_LEVEL_1; level = IS_LEVEL_1;
return set_lsp_gen_interval (vty, area, interval, level); return set_lsp_gen_interval (vty, area, interval, level);
} }
@ -1805,12 +1835,13 @@ DEFUN (lsp_gen_interval_l2,
"Set interval for level 2 only\n" "Set interval for level 2 only\n"
"Minimum interval in seconds\n") "Minimum interval in seconds\n")
{ {
int idx_number = 2;
struct isis_area *area; struct isis_area *area;
uint16_t interval; uint16_t interval;
int level; int level;
area = vty->index; area = vty->index;
interval = atoi (argv[2]->arg); interval = atoi (argv[idx_number]->arg);
level = IS_LEVEL_2; level = IS_LEVEL_2;
return set_lsp_gen_interval (vty, area, interval, level); return set_lsp_gen_interval (vty, area, interval, level);
} }
@ -1848,11 +1879,12 @@ DEFUN (spf_interval,
"Minimum interval between SPF calculations\n" "Minimum interval between SPF calculations\n"
"Minimum interval between consecutive SPFs in seconds\n") "Minimum interval between consecutive SPFs in seconds\n")
{ {
int idx_number = 1;
struct isis_area *area; struct isis_area *area;
u_int16_t interval; u_int16_t interval;
area = vty->index; area = vty->index;
interval = atoi (argv[1]->arg); interval = atoi (argv[idx_number]->arg);
area->min_spf_interval[0] = interval; area->min_spf_interval[0] = interval;
area->min_spf_interval[1] = interval; area->min_spf_interval[1] = interval;
@ -1903,11 +1935,12 @@ DEFUN (spf_interval_l1,
"Set interval for level 1 only\n" "Set interval for level 1 only\n"
"Minimum interval between consecutive SPFs in seconds\n") "Minimum interval between consecutive SPFs in seconds\n")
{ {
int idx_number = 2;
struct isis_area *area; struct isis_area *area;
u_int16_t interval; u_int16_t interval;
area = vty->index; area = vty->index;
interval = atoi (argv[2]->arg); interval = atoi (argv[idx_number]->arg);
area->min_spf_interval[0] = interval; area->min_spf_interval[0] = interval;
return CMD_SUCCESS; return CMD_SUCCESS;
@ -1937,11 +1970,12 @@ DEFUN (spf_interval_l2,
"Set interval for level 2 only\n" "Set interval for level 2 only\n"
"Minimum interval between consecutive SPFs in seconds\n") "Minimum interval between consecutive SPFs in seconds\n")
{ {
int idx_number = 2;
struct isis_area *area; struct isis_area *area;
u_int16_t interval; u_int16_t interval;
area = vty->index; area = vty->index;
interval = atoi (argv[2]->arg); interval = atoi (argv[idx_number]->arg);
area->min_spf_interval[1] = interval; area->min_spf_interval[1] = interval;
return CMD_SUCCESS; return CMD_SUCCESS;
@ -2022,7 +2056,8 @@ DEFUN (max_lsp_lifetime,
"Maximum LSP lifetime\n" "Maximum LSP lifetime\n"
"LSP lifetime in seconds\n") "LSP lifetime in seconds\n")
{ {
return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[1]->arg)); int idx_number = 1;
return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[idx_number]->arg));
} }
/* /*
@ -2050,7 +2085,8 @@ DEFUN (max_lsp_lifetime_l1,
"Maximum LSP lifetime for Level 1 only\n" "Maximum LSP lifetime for Level 1 only\n"
"LSP lifetime for Level 1 only in seconds\n") "LSP lifetime for Level 1 only in seconds\n")
{ {
return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[2]->arg)); int idx_number = 2;
return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[idx_number]->arg));
} }
/* /*
@ -2077,7 +2113,8 @@ DEFUN (max_lsp_lifetime_l2,
"Maximum LSP lifetime for Level 2 only\n" "Maximum LSP lifetime for Level 2 only\n"
"LSP lifetime for Level 2 only in seconds\n") "LSP lifetime for Level 2 only in seconds\n")
{ {
return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[2]->arg)); int idx_number = 2;
return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[idx_number]->arg));
} }
/* /*
@ -2148,7 +2185,8 @@ DEFUN (lsp_refresh_interval,
"LSP refresh interval\n" "LSP refresh interval\n"
"LSP refresh interval in seconds\n") "LSP refresh interval in seconds\n")
{ {
return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[1]->arg)); int idx_number = 1;
return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[idx_number]->arg));
} }
/* /*
@ -2176,7 +2214,8 @@ DEFUN (lsp_refresh_interval_l1,
"LSP refresh interval for Level 1 only\n" "LSP refresh interval for Level 1 only\n"
"LSP refresh interval for Level 1 only in seconds\n") "LSP refresh interval for Level 1 only in seconds\n")
{ {
return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[2]->arg)); int idx_number = 2;
return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[idx_number]->arg));
} }
/* /*
@ -2204,7 +2243,8 @@ DEFUN (lsp_refresh_interval_l2,
"LSP refresh interval for Level 2 only\n" "LSP refresh interval for Level 2 only\n"
"LSP refresh interval for Level 2 only in seconds\n") "LSP refresh interval for Level 2 only in seconds\n")
{ {
return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[2]->arg)); int idx_number = 2;
return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[idx_number]->arg));
} }
/* /*
@ -2271,8 +2311,10 @@ DEFUN (area_passwd_md5,
"Authentication type\n" "Authentication type\n"
"Level-wide password\n") "Level-wide password\n")
{ {
int idx_password = 0;
int idx_word = 2;
u_char snp_auth = 0; u_char snp_auth = 0;
int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1;
if (argc > 2) if (argc > 2)
{ {
@ -2282,7 +2324,7 @@ DEFUN (area_passwd_md5,
} }
return area_passwd_set(vty, level, isis_area_passwd_hmac_md5_set, return area_passwd_set(vty, level, isis_area_passwd_hmac_md5_set,
argv[2]->arg, snp_auth); argv[idx_word]->arg, snp_auth);
} }
@ -2307,8 +2349,10 @@ DEFUN (area_passwd_clear,
"Authentication type\n" "Authentication type\n"
"Area password\n") "Area password\n")
{ {
int idx_password = 0;
int idx_word = 2;
u_char snp_auth = 0; u_char snp_auth = 0;
int level = (argv[0]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1;
if (argc > 2) if (argc > 2)
{ {
@ -2318,7 +2362,7 @@ DEFUN (area_passwd_clear,
} }
return area_passwd_set(vty, level, isis_area_passwd_cleartext_set, return area_passwd_set(vty, level, isis_area_passwd_cleartext_set,
argv[2]->arg, snp_auth); argv[idx_word]->arg, snp_auth);
} }
@ -2329,7 +2373,8 @@ DEFUN (no_area_passwd,
"Configure the authentication password for an area\n" "Configure the authentication password for an area\n"
"Set the authentication password for a routing domain\n") "Set the authentication password for a routing domain\n")
{ {
int level = (argv[1]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1; int idx_password = 1;
int level = (argv[idx_password]->arg[0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1;
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
if (!area) if (!area)

View File

@ -533,7 +533,8 @@ DEFUN (show_isis_interface_arg,
"ISIS interface\n" "ISIS interface\n"
"ISIS interface name\n") "ISIS interface name\n")
{ {
return show_isis_interface_common (vty, argv[3]->arg, ISIS_UI_LEVEL_DETAIL); int idx_word = 3;
return show_isis_interface_common (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL);
} }
/* /*
@ -707,7 +708,8 @@ DEFUN (show_isis_neighbor_arg,
"ISIS neighbor adjacencies\n" "ISIS neighbor adjacencies\n"
"System id\n") "System id\n")
{ {
return show_isis_neighbor_common (vty, argv[3]->arg, 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, DEFUN (clear_isis_neighbor,
@ -728,7 +730,8 @@ DEFUN (clear_isis_neighbor_arg,
"ISIS neighbor adjacencies\n" "ISIS neighbor adjacencies\n"
"System id\n") "System id\n")
{ {
return clear_isis_neighbor_common (vty, argv[3]->arg); int idx_word = 3;
return clear_isis_neighbor_common (vty, argv[idx_word]->arg);
} }
/* /*
@ -1530,7 +1533,8 @@ DEFUN (show_database_lsp_brief,
"IS-IS link state database\n" "IS-IS link state database\n"
"LSP ID\n") "LSP ID\n")
{ {
return show_isis_database (vty, argv[3]->arg, 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, DEFUN (show_database_lsp_detail,
@ -1542,7 +1546,8 @@ DEFUN (show_database_lsp_detail,
"LSP ID\n" "LSP ID\n"
"Detailed information\n") "Detailed information\n")
{ {
return show_isis_database (vty, argv[3]->arg, 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, DEFUN (show_database_detail,
@ -1564,7 +1569,8 @@ DEFUN (show_database_detail_lsp,
"Detailed information\n" "Detailed information\n"
"LSP ID\n") "LSP ID\n")
{ {
return show_isis_database (vty, argv[4]->arg, ISIS_UI_LEVEL_DETAIL); int idx_word = 4;
return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL);
} }
/* /*
@ -1577,7 +1583,8 @@ DEFUN (router_isis,
"ISO IS-IS\n" "ISO IS-IS\n"
"ISO Routing area tag") "ISO Routing area tag")
{ {
return isis_area_get (vty, argv[2]->arg); int idx_word = 2;
return isis_area_get (vty, argv[idx_word]->arg);
} }
/* /*
@ -1588,7 +1595,8 @@ DEFUN (no_router_isis,
"no router isis WORD", "no router isis WORD",
"no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
{ {
return isis_area_destroy (vty, argv[3]->arg); int idx_word = 3;
return isis_area_destroy (vty, argv[idx_word]->arg);
} }
/* /*
@ -1600,7 +1608,8 @@ DEFUN (net,
"A Network Entity Title for this process (OSI only)\n" "A Network Entity Title for this process (OSI only)\n"
"XX.XXXX. ... .XXX.XX Network entity title (NET)\n") "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
{ {
return area_net_title (vty, argv[1]->arg); int idx_word = 1;
return area_net_title (vty, argv[idx_word]->arg);
} }
/* /*
@ -1613,7 +1622,8 @@ DEFUN (no_net,
"A Network Entity Title for this process (OSI only)\n" "A Network Entity Title for this process (OSI only)\n"
"XX.XXXX. ... .XXX.XX Network entity title (NET)\n") "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
{ {
return area_clear_net_title (vty, argv[2]->arg); 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) void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu)
@ -1966,14 +1976,15 @@ DEFUN (topology_baseis,
"A Network IS Base for this topology\n" "A Network IS Base for this topology\n"
"XXXX.XXXX.XXXX Network entity title (NET)\n") "XXXX.XXXX.XXXX Network entity title (NET)\n")
{ {
int idx_word = 2;
struct isis_area *area; struct isis_area *area;
u_char buff[ISIS_SYS_ID_LEN]; u_char buff[ISIS_SYS_ID_LEN];
area = vty->index; area = vty->index;
assert (area); assert (area);
if (sysid2buff (buff, argv[2]->arg)) if (sysid2buff (buff, argv[idx_word]->arg))
sysid2buff (area->topology_baseis, argv[2]->arg); sysid2buff (area->topology_baseis, argv[idx_word]->arg);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -2011,13 +2022,14 @@ DEFUN (topology_basedynh,
"Dynamic hostname base for this topology\n" "Dynamic hostname base for this topology\n"
"Dynamic hostname base\n") "Dynamic hostname base\n")
{ {
int idx_word = 2;
struct isis_area *area; struct isis_area *area;
area = vty->index; area = vty->index;
assert (area); assert (area);
/* I hope that it's enough. */ /* I hope that it's enough. */
area->topology_basedynh = strndup (argv[2]->arg, 16); area->topology_basedynh = strndup (argv[idx_word]->arg, 16);
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -313,9 +313,21 @@ def get_token_index_variable_name(line_number, token):
elif token == '(1-500)|WORD' or token == '(1-99)|(100-500)|WORD': elif token == '(1-500)|WORD' or token == '(1-99)|(100-500)|WORD':
return 'idx_comm_list' return 'idx_comm_list'
elif token == 'ipv4|ipv6': elif token == 'ipv4|ipv6' or token == 'ip|ipv6':
return 'idx_afi' return 'idx_afi'
elif token == 'md5|clear':
return 'idx_encryption'
elif token == 'narrow|transition|wide':
return 'idx_metric_style'
elif token == 'area-password|domain-password':
return 'idx_password'
elif token == 'param':
return 'idx_param'
elif token == 'advertised-routes|received-routes': elif token == 'advertised-routes|received-routes':
return 'idx_adv_rcvd_routes' return 'idx_adv_rcvd_routes'
@ -334,6 +346,12 @@ def get_token_index_variable_name(line_number, token):
elif token == 'A.B.C.D/M|X:X::X:X/M': elif token == 'A.B.C.D/M|X:X::X:X/M':
return 'idx_ipv4_ipv6_prefixlen' return 'idx_ipv4_ipv6_prefixlen'
elif token == 'level-1|level-2' or token == 'level-1|level-1-2|level-2-only':
return 'idx_level'
elif token == 'metric (0-16777215)|route-map WORD' or token == 'always|metric (0-16777215)|route-map WORD':
return 'idx_metric_rmap'
elif token == 'urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix': elif token == 'urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix':
return 'idx_rpf_lookup_mode' return 'idx_rpf_lookup_mode'