/* BGP route print out function. */
DEFUN (show_ip_bgp_ipv4,
show_ip_bgp_ipv4_cmd,
- "show [ip] bgp [<view|vrf> WORD] [<<ipv4|ipv6|vpnv4|encap> [unicast]|ipv4 multicast>] [cidr-only|community|<[dampening] <flap-statistics|dampened-paths>>|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community <AA:NN|local-AS|no-advertise|no-export> [exact-match]|community-list <(1-500)|WORD> [exact-match]|<A.B.C.D/M|k X:X::X:X/M> longer-prefixes] [json]",
+ "show [ip] bgp [<view|vrf> WORD] [<<ipv4|ipv6|vpnv4|encap> [unicast]|ipv4 multicast>] [<cidr-only|community|dampening <flap-statistics|dampened-paths>|regexp .LINE|route-map WORD|prefix-list WORD|filter-list WORD|community <AA:NN|local-AS|no-advertise|no-export> [exact-match]|community-list <(1-500)|WORD> [exact-match]|A.B.C.D/M longer-prefixes|X:X::X:X/M longer-prefixes>] [json]",
SHOW_STR
IP_STR
BGP_STR
DEFUN (show_ip_bgp_route,
show_ip_bgp_route_cmd,
- "show [ip] bgp [<view|vrf> WORD] [<<ipv4|ipv6|encap> [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] <A.B.C.D|A.B.C.D/M|X:X::X:X|X:X::X:X/M> [bestpath|multipath] [json]",
+ "show [ip] bgp [<view|vrf> WORD] [<<ipv4|ipv6|encap> [unicast]|ipv4 multicast|vpnv4 unicast [rd ASN:nn_or_IP-address:nn]>] <A.B.C.D|A.B.C.D/M|X:X::X:X|X:X::X:X/M> [<bestpath|multipath>] [json]",
SHOW_STR
IP_STR
BGP_STR
DEFUN (no_match_ip_next_hop,
no_match_ip_next_hop_cmd,
- "no match ip next-hop [<(1-199)|(1300-2699)|WORD]",
+ "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]",
NO_STR
MATCH_STR
IP_STR
DEFUN (no_match_ip_route_source,
no_match_ip_route_source_cmd,
- "no match ip route-source [(1-199)|(1300-2699)|WORD]",
+ "no match ip route-source [<(1-199)|(1300-2699)|WORD>]",
NO_STR
MATCH_STR
IP_STR
DEFUN (isis_redistribute,
isis_redistribute_cmd,
- "redistribute <ipv4|ipv6> <kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table> <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"
DEFUN (config_log_stdout,
config_log_stdout_cmd,
- "log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
+ "log stdout [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
"Logging control\n"
"Set stdout logging level\n"
LOG_LEVEL_DESC)
DEFUN (no_config_log_stdout,
no_config_log_stdout_cmd,
- "no log stdout [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
+ "no log stdout [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
NO_STR
"Logging control\n"
"Cancel logging to stdout\n"
DEFUN (config_log_monitor,
config_log_monitor_cmd,
- "log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
+ "log monitor [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
"Logging control\n"
"Set terminal line (monitor) logging level\n"
LOG_LEVEL_DESC)
DEFUN (no_config_log_monitor,
no_config_log_monitor_cmd,
- "no log monitor [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
+ "no log monitor [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
NO_STR
"Logging control\n"
"Disable terminal line (monitor) logging\n"
DEFUN (config_log_file,
config_log_file_cmd,
- "log file FILENAME [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
+ "log file FILENAME [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
"Logging control\n"
"Logging to file\n"
"Logging filename\n"
DEFUN (config_log_syslog,
config_log_syslog_cmd,
- "log syslog [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
+ "log syslog [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
"Logging control\n"
"Set syslog logging level\n"
LOG_LEVEL_DESC)
DEFUN (no_config_log_syslog,
no_config_log_syslog_cmd,
- "no log syslog [<kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>] [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
+ "no log syslog [<kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>] [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
NO_STR
"Logging control\n"
"Cancel logging to syslog\n"
DEFUN (area_range,
area_range_cmd,
- "area <A.B.C.D|(0-4294967295) range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>]",
+ "area <A.B.C.D|(0-4294967295)> range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>]",
"OSPF area parameters\n"
OSPF6_AREA_ID_STR
"Configured address range\n"
DEFUN (debug_ospf6_lsa_type,
debug_ospf6_lsa_hex_cmd,
- "debug ospf6 lsa <router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown> [originate|examine|flooding]",
+ "debug ospf6 lsa <router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown> [<originate|examine|flooding>]",
DEBUG_STR
OSPF6_STR
"Debug Link State Advertisements (LSAs)\n"
DEFUN (no_debug_ospf6_lsa_type,
no_debug_ospf6_lsa_hex_cmd,
- "no debug ospf6 lsa <router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown> [originate|examine|flooding]",
+ "no debug ospf6 lsa <router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown> [<originate|examine|flooding>]",
NO_STR
DEBUG_STR
OSPF6_STR
DEFUN (show_ipv6_ospf6_neighbor,
show_ipv6_ospf6_neighbor_cmd,
- "show ipv6 ospf6 neighbor [detail|drchoice]",
+ "show ipv6 ospf6 neighbor [<detail|drchoice>]",
SHOW_STR
IP6_STR
OSPF6_STR
DEFUN (debug_ospf6_neighbor,
debug_ospf6_neighbor_cmd,
- "debug ospf6 neighbor [state|event]",
+ "debug ospf6 neighbor [<state|event>]",
DEBUG_STR
OSPF6_STR
"Debug OSPFv3 Neighbor\n"
DEFUN (no_debug_ospf6_neighbor,
no_debug_ospf6_neighbor_cmd,
- "no debug ospf6 neighbor [state|event]",
+ "no debug ospf6 neighbor [<state|event>]",
NO_STR
DEBUG_STR
OSPF6_STR
DEFUN (show_ipv6_ospf6_route,
show_ipv6_ospf6_route_cmd,
- "show ipv6 ospf6 route [intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary]",
+ "show ipv6 ospf6 route [<intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary>]",
SHOW_STR
IP6_STR
OSPF6_STR
DEFUN (show_ipv6_ospf6_database,
show_ipv6_ospf6_database_cmd,
- "show ipv6 ospf6 database [detail|dump|internal]",
+ "show ipv6 ospf6 database [<detail|dump|internal>]",
SHOW_STR
IPV6_STR
OSPF6_STR
if (inst) // user passed instance ID
{
- if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10)))
+ if (!ospf_lookup_instance (strtoul (inst, NULL, 10)))
return CMD_SUCCESS;
}
DEFUN (debug_ospf_nsm,
debug_ospf_nsm_cmd,
- "debug ospf nsm [status|events|timers]",
+ "debug ospf nsm [<status|events|timers>]",
DEBUG_STR
OSPF_STR
"OSPF Neighbor State Machine\n"
DEFUN (debug_ospf_instance_nsm,
debug_ospf_instance_nsm_cmd,
- "debug ospf (1-65535) nsm [status|events|timers]",
+ "debug ospf (1-65535) nsm [<status|events|timers>]",
DEBUG_STR
OSPF_STR
"Instance ID\n"
DEFUN (no_debug_ospf_nsm,
no_debug_ospf_nsm_cmd,
- "no debug ospf nsm [status|events|timers]",
+ "no debug ospf nsm [<status|events|timers>]",
NO_STR
DEBUG_STR
OSPF_STR
DEFUN (no_debug_ospf_instance_nsm,
no_debug_ospf_instance_nsm_cmd,
- "no debug ospf (1-65535) nsm [status|events|timers]",
+ "no debug ospf (1-65535) nsm [<status|events|timers>]",
NO_STR
DEBUG_STR
OSPF_STR
DEFUN (debug_ospf_lsa,
debug_ospf_lsa_cmd,
- "debug ospf lsa [generate|flooding|install|refresh]",
+ "debug ospf lsa [<generate|flooding|install|refresh>]",
DEBUG_STR
OSPF_STR
"OSPF Link State Advertisement\n"
DEFUN (debug_ospf_instance_lsa,
debug_ospf_instance_lsa_cmd,
- "debug ospf (1-65535) lsa [generate|flooding|install|refresh]",
+ "debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]",
DEBUG_STR
OSPF_STR
"Instance ID\n"
DEFUN (no_debug_ospf_lsa,
no_debug_ospf_lsa_cmd,
- "no debug ospf lsa [generate|flooding|install|refresh]",
+ "no debug ospf lsa [<generate|flooding|install|refresh>]",
NO_STR
DEBUG_STR
OSPF_STR
DEFUN (no_debug_ospf_instance_lsa,
no_debug_ospf_instance_lsa_cmd,
- "no debug ospf (1-65535) lsa [generate|flooding|install|refresh]",
+ "no debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]",
NO_STR
DEBUG_STR
OSPF_STR
DEFUN (debug_ospf_zebra,
debug_ospf_zebra_cmd,
- "debug ospf zebra [interface|redistribute]",
+ "debug ospf zebra [<interface|redistribute>]",
DEBUG_STR
OSPF_STR
"OSPF Zebra information\n"
DEFUN (debug_ospf_instance_zebra,
debug_ospf_instance_zebra_cmd,
- "debug ospf (1-65535) zebra [interface|redistribute]",
+ "debug ospf (1-65535) zebra [<interface|redistribute>]",
DEBUG_STR
OSPF_STR
"Instance ID\n"
DEFUN (no_debug_ospf_zebra,
no_debug_ospf_zebra_cmd,
- "no debug ospf zebra [interface|redistribute]",
+ "no debug ospf zebra [<interface|redistribute>]",
NO_STR
DEBUG_STR
OSPF_STR
DEFUN (no_debug_ospf_instance_zebra,
no_debug_ospf_instance_zebra_cmd,
- "no debug ospf (1-65535) zebra [interface|redistribute]",
+ "no debug ospf (1-65535) zebra [<interface|redistribute>]",
NO_STR
DEBUG_STR
OSPF_STR
DEFUN (no_ip_rip_receive_version,
no_ip_rip_receive_version_cmd,
- "no ip rip receive version [(1-1)|(2-2)]",
+ "no ip rip receive version [<1|2>]",
NO_STR
IP_STR
"Routing Information Protocol\n"
DEFUN (no_ip_rip_send_version,
no_ip_rip_send_version_cmd,
- "no ip rip send version [(1-1)|(2-2)]",
+ "no ip rip send version [<1|2>]",
NO_STR
IP_STR
"Routing Information Protocol\n"
if not line.endswith('\n'):
line += '\n'
+ if '|<' in line:
+ print "%d: ERROR |< is illegal in '%s'" % (self.line_number, line)
+
+ if '|[' in line:
+ print "%d: ERROR |[ is illegal in '%s'" % (self.line_number, line)
+
# compress duplicate whitespaces
re_space = re.search('^(\s*).*(\s*)$', line)
line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2)
+
+ for token in line_to_tokens(self.line_number, line):
+ token = token.strip()
+
+ if token.endswith('",'):
+ token = token[0:-2]
+
+ if token.startswith('[') and '|' in token:
+ if not token.startswith('[<') or not token.endswith('>]'):
+ print "%s: suspend token '%s'" % (self.line_number, token)
+
return line
def get_used_idx_variables(self, idx_table):
return False
def dump(self):
- new_command_string = self.get_new_command_string()
- new_command_string_expanded = expand_command_string(new_command_string)
+ # new_command_string = self.get_new_command_string()
+ # new_command_string_expanded = expand_command_string(new_command_string)
+ new_command_string_expanded = self.get_new_command_string()
lines = []
lines.append("DEFUN (%s,\n" % self.name)
state = None
fh.write(line)
elif line.strip().startswith('* ') and not line.strip().startswith('* '):
- # dwalton
new_line = expand_command_string(line[3:]) # chop the leading " * "
fh.write(" * %s" % new_line)
else:
DEFUN (debug_zebra_kernel_msgdump,
debug_zebra_kernel_msgdump_cmd,
- "debug zebra kernel msgdump [recv|send]",
+ "debug zebra kernel msgdump [<recv|send>]",
DEBUG_STR
"Zebra configuration\n"
"Debug option set for zebra between kernel interface\n"
DEFUN (no_debug_zebra_kernel_msgdump,
no_debug_zebra_kernel_msgdump_cmd,
- "no debug zebra kernel msgdump [recv|send]",
+ "no debug zebra kernel msgdump [<recv|send>]",
DEBUG_STR
"Zebra configuration\n"
"Debug option set for zebra between kernel interface\n"
"Nexthop interface name\n"
"Distance\n")
{
- char *destprefix = argv[2]->arg;
- char *nexthop = argv[3]->arg;
- char *distance = (argc == 5) ? argv[4]->arg : NULL;
+ char *destprefix = argv[3]->arg;
+ char *nexthop = argv[4]->arg;
+ char *distance = (argc == 6) ? argv[5]->arg : NULL;
return zebra_static_ipv4 (vty, SAFI_MULTICAST, 0, destprefix, NULL, nexthop, NULL, NULL, distance, NULL);
}
"Show only routes with tag\n"
"Tag value\n")
{
+ int idx_vrf = 3;
+ int idx_name = 4;
+ int idx_tag = 6;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
u_short tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (strmatch(argv[3]->text, "vrf"))
+ if (strmatch(argv[idx_vrf]->text, "vrf"))
{
- VRF_GET_ID (vrf_id, argv[4]->arg);
- tag = atoi(argv[6]->arg);
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
+ tag = atoi(argv[idx_tag]->arg);
}
else
{
- tag = atoi(argv[4]->arg);
+ idx_tag -= 2;
+ tag = atoi(argv[idx_tag]->arg);
}
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
"Show only routes with tag\n"
"Tag value\n")
{
+ int idx_vrf = 3;
+ int idx_name = 4;
+ int idx_tag = 6;
struct route_table *table;
struct route_node *rn;
struct rib *rib;
u_short tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
- if (strmatch(argv[3]->text, "vrf"))
+ if (strmatch(argv[idx_vrf]->text, "vrf"))
{
- VRF_GET_ID (vrf_id, argv[4]->arg);
- tag = atoi(argv[6]->arg);
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
+ tag = atoi(argv[idx_tag]->arg);
}
else
{
- tag = atoi(argv[4]->arg);
+ idx_tag -= 2;
+ tag = atoi(argv[idx_tag]->arg);
}
table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
VRF_ALL_CMD_HELP_STR
QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
{
+ int idx_protocol = 5;
int type;
struct route_table *table;
struct route_node *rn;
int first = 1;
int vrf_header = 1;
- type = proto_redistnum (AFI_IP6, argv[4]->arg);
+ type = proto_redistnum (AFI_IP6, argv[idx_protocol]->arg);
if (type < 0)
{
vty_out (vty, "Unknown route type%s", VTY_NEWLINE);