+++ /dev/null
-#!/usr/bin/env python
-
-"""
-Usage:
-
- argv_translator.py rebuild-defuns [<text>]
-
-Help:
- rebuild-defuns : foo
-
-"""
-
-# This script did different things at different times as we migrated code
-# to quentin's parse engine. The following were its rebuild-defuns phases:
-#
-# - originally was used to change all of the argv[2] to argv[4]->arg. This
-# calculated the new argv index and added the ->arg.
-# - next it was used to replace the 4 in argv[4]->arg with an idx_foo variable
-#
-# idx-logic
-# - used to take a command string and build out an idx_ logic skeleton
-#
-
-import argparse
-import re
-import sys
-import os
-import subprocess
-from collections import OrderedDict
-from copy import deepcopy
-from pprint import pformat, pprint
-from network_docopt import NetworkDocopt, get_network_docopt_info
-
-
-def token_is_variable(line_number, token):
-
- if token.isdigit():
- return True
-
- if token.startswith('('):
- assert token.endswith(')') or token.endswith(')...'), "%d: token %s should end with )" % (line_number, token)
- return True
-
- if token.startswith('['):
- assert token.endswith(']'), "%d: token %s should end with ]" % (line_number, token)
- return True
-
- if token.startswith('<'):
- assert token.endswith('>'), "%d: token %s should end with >" % (line_number, token)
- return True
-
- if token.startswith('{'):
- # I don't really care about checking for this I just put
- # these asserts in here to bug sharpd
- assert token.endswith('}'), "%d: token %s should end with }" % (line_number, token)
- return True
-
- assert '|' not in token, "%d: Weird token %s has a | but does not start with [ or (" % (line_number, token)
-
- if token in ('WORD',
- '.LINE',
- '.AA:NN',
- 'A.B.C.D',
- 'A.B.C.D/M',
- 'X:X::X:X',
- 'X:X::X:X/M',
- 'ASN:nn_or_IP-address:nn'):
- return True
-
- # Anything in all caps in a variable
- if token.upper() == token:
- return True
-
- re_number_range = re.search('^<\d+-\d+>$', token)
- if re_number_range:
- return True
-
- return False
-
-
-def line_to_tokens(line_number, text):
- """
- Most of the time whitespace can be used to split tokens
- (set|clear) <interface> clagd-enable (no|yes)
-
- tokens
- - (set|clear)
- - <interface>
- - clagd-enable
- - (no|yes)
-
- But if we are dealing with multiword keywords, such as "soft in", that approach
- does not work. We can only split on whitespaces if we are not inside a () or []
- bgp (<ipv4>|<ipv6>|<interface>|*) [soft in|soft out]
-
- tokens:
- - bgp
- - (<ipv4>|<ipv6>|<interface>|*)
- - [soft in|soft out]
- """
- tokens = []
- token_index = 0
- token_text = []
- parens = 0
- curlys = 0
- brackets = 0
- less_greater = 0
-
- for char in text:
- if char == ' ':
- if parens == 0 and brackets == 0 and curlys == 0 and less_greater == 0:
- if token_text:
- tokens.append(''.join(token_text))
- token_index += 1
- token_text = []
- else:
- token_text.append(char)
- else:
- if char == '(':
- parens += 1
-
- elif char == ')':
- parens -= 1
-
- elif char == '[':
- brackets += 1
-
- elif char == ']':
- brackets -= 1
-
- elif char == '{':
- curlys += 1
-
- elif char == '}':
- curlys -= 1
-
- elif char == '<':
- less_greater += 1
-
- elif char == '>':
- less_greater -= 1
-
- if char:
- token_text.append(char)
-
- if token_text:
- tokens.append(''.join(token_text))
-
- return tokens
-
-
-'''
-# No longer used now that all indexes have been updated
-def get_argv_translator(line_number, line):
- table = {}
- line = line.strip()
- assert line.startswith('"'), "%d: line does not start with \"\n%s" % (line_number, line)
- assert line.endswith('",'), "%d: line does not end with \",\n%s" % (line_number, line)
-
- line = line[1:-2]
-
- funky_chars = ('+', '"')
- for char in funky_chars:
- if char in line:
- raise Exception("%d: Add support for tokens in\n%s\n\nsee BGP_INSTANCE_CMD down below" % (line_number, line))
-
- old_style_index = 0
- for (token_index, token) in enumerate(line_to_tokens(line)):
- if not token:
- continue
-
- if token_is_variable(line_number, token):
- # print "%s is a token" % token
- table[old_style_index] = token_index
- old_style_index += 1
- else:
- # print "%s is NOT a token" % token
- pass
-
- return table
-'''
-
-def get_command_string_variable_indexes(line_number, line):
- indexes = {}
-
- line = line.strip()
- assert line.startswith('"'), "%d: line does not start with \"\n%s" % (line_number, line)
- assert line.endswith('",'), "%d: line does not end with \",\n%s" % (line_number, line)
- line = line[1:-2]
- max_index = 0
-
- for (token_index, token) in enumerate(line_to_tokens(line_number, line)):
- if not token:
- raise Exception("%d: empty token" % line_number)
-
- if token_is_variable(line_number, token):
- # print "%s is a token" % token
- indexes[token_index] = True
- max_index = token_index
-
- return (max_index, indexes)
-
-
-def get_token_index_variable_name(line_number, token):
-
- re_range = re.search('\(\d+-\d+\)', token)
-
- if token.startswith('['):
- assert token.endswith(']'), "Token %s should end with ]" % token
- token = token[1:-1]
-
- if token.startswith('<'):
- assert token.endswith('>'), "Token %s should end with >" % token
- token = token[1:-1]
-
- if token == 'A.B.C.D':
- return 'idx_ipv4'
-
- elif token == 'A.B.C.D/M':
- return 'idx_ipv4_prefixlen'
-
- elif token == 'X:X::X:X':
- return 'idx_ipv6'
-
- elif token == 'X:X::X:X/M':
- return 'idx_ipv6_prefixlen'
-
- elif token == 'ASN:nn_or_IP-address:nn':
- return 'idx_ext_community'
-
- elif token == '.AA:NN':
- return 'idx_community'
-
- elif token == 'WORD':
- return 'idx_word'
-
- elif token == 'json':
- return 'idx_json'
-
- elif token == '.LINE':
- return 'idx_regex'
-
- elif token == 'A.B.C.D|INTERFACE':
- return 'idx_ipv4_ifname'
-
- elif token == 'A.B.C.D|INTERFACE|null0':
- return 'idx_ipv4_ifname_null'
-
- elif token == 'X:X::X:X|INTERFACE':
- return 'idx_ipv6_ifname'
-
- elif token == 'reject|blackhole':
- return 'idx_reject_blackhole'
-
- elif token == 'route-map NAME':
- return 'idx_route_map'
-
- elif token == 'recv|send|detail':
- return 'idx_recv_send'
-
- elif token == 'recv|send':
- return 'idx_recv_send'
-
- elif token == 'up|down':
- return 'idx_up_down'
-
- elif token == 'off-link':
- return 'idx_off_link'
-
- elif token == 'no-autoconfig':
- return 'idx_no_autoconfig'
-
- elif token == 'router-address':
- return 'idx_router_address'
-
- elif token == 'high|medium|low':
- return 'idx_high_medium_low'
-
- elif token == '(0-4294967295)|infinite':
- return 'idx_number_infinite'
-
- elif token == '(1-199)|(1300-2699)|WORD':
- return 'idx_acl'
-
- elif token == 'A.B.C.D|X:X::X:X':
- return 'idx_ip'
-
- elif token == 'in|out':
- return 'idx_in_out'
-
- elif token == 'deny|permit':
- return 'idx_permit_deny'
-
- elif token == 'view|vrf':
- return 'idx_view_vrf'
-
- elif token == 'unicast|multicast':
- return 'idx_safi'
-
- elif token == 'bestpath|multipath':
- return 'idx_bestpath'
-
- elif token == 'egp|igp|incomplete':
- return 'idx_origin'
-
- elif token == 'cisco|zebra' or token == 'cisco|ibm|shortcut|standard':
- return 'idx_vendor'
-
- elif token == 'as-set|no-as-set':
- return 'idx_as_set'
-
- elif token == 'confed|missing-as-worst':
- return 'idx_med_knob'
-
- elif token == 'both|send|receive' or token == 'send|recv':
- return 'idx_send_recv'
-
- elif token == 'both|extended|standard' or token == '1|2':
- return 'idx_type'
-
- elif token == 'A.B.C.D|WORD' or token == 'A.B.C.D/M|WORD':
- return 'idx_ipv4_word'
-
- elif token == 'advertise-queue|advertised-routes|packet-queue':
- return 'idx_type'
-
- elif token == 'ospf|table':
- return 'idx_ospf_table'
-
- elif token == 'as-path|next-hop|med' or token == 'next-hop|med' or token == 'as-path|med' or token == 'as-path|next-hop':
- return 'idx_attribute'
-
- elif token == '(1-4294967295)|external|internal' or token == '(1-4294967295)|internal|external':
- return 'idx_remote_as'
-
- elif token == '(1-500)|WORD' or token == '(1-99)|(100-500)|WORD':
- return 'idx_comm_list'
-
- elif token == 'ipv4|ipv6' or token == 'ip|ipv6':
- return 'idx_afi'
-
- elif token == 'md5|clear' or token == 'null|message-digest' or token == 'md5|text':
- return 'idx_encryption'
-
- elif token == 'IFNAME|default':
- return 'idx_ifname'
-
- elif token == 'type-1|type-2':
- return 'idx_external'
-
- elif token == 'table|intra-area|inter-area|memory':
- return 'idx_type'
-
- elif token == 'translate-candidate|translate-never|translate-always':
- return 'idx_translate'
-
- elif token == 'intra-area (1-255)|inter-area (1-255)|external (1-255)':
- return 'idx_area_distance'
-
- elif token == 'metric (0-16777214)|metric-type <1|2>|route-map WORD' or token == 'always|metric (0-16777214)|metric-type <1|2>|route-map WORD':
- return 'idx_redist_param'
-
- elif token == 'default|enable|disable' or token == 'enable|disable':
- return 'idx_enable_disable'
-
- elif token == 'unknown|hello|dbdesc|lsreq|lsupdate|lsack|all' or token == 'hello|dd|ls-request|ls-update|ls-ack|all':
- return 'idx_packet'
-
- elif token == 'router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown' or token == 'intra-area|inter-area|external-1|external-2' or token == 'router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix' or token == 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as':
- return 'idx_lsa'
-
- elif token == 'broadcast|point-to-point' or token == 'broadcast|non-broadcast|point-to-multipoint|point-to-point':
- return 'idx_network'
-
- elif token == 'A.B.C.D|(0-4294967295)':
- return 'idx_ipv4_number'
-
- 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':
- return 'idx_adv_rcvd_routes'
-
- elif token == 'encap|multicast|unicast|vpn' or token == 'unicast|multicast|vpn|encap':
- return 'idx_safi'
-
- elif token == 'AA:NN|local-AS|no-advertise|no-export':
- return 'idx_community'
-
- elif token == 'all|all-et|updates|updates-et|routes-mrt':
- return 'idx_dump_routes'
-
- elif token == 'A.B.C.D|X:X::X:X|WORD':
- return 'idx_peer'
-
- elif token == 'A.B.C.D/M|X:X::X:X/M':
- 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':
- return 'idx_rpf_lookup_mode'
-
- elif token == 'hello|joins':
- return 'idx_hello_join'
-
- elif token == 'nocache|wrongvif|wholepkt':
- return 'idx_type'
-
- elif token == 'file|memory|terminal':
- return 'idx_type'
-
- elif token == 'prefix':
- return 'idx_prefix'
-
- elif token == 'A.B.C.D/M|any':
- return 'idx_ipv4_any'
-
- elif token == 'X:X::X:X/M|any':
- return 'idx_ipv6_any'
-
- elif token == '(1-99)|(1300-1999)' or token == '(100-199)|(2000-2699)' or token == '(1-99)|(100-199)|(1300-1999)|(2000-2699)|WORD':
- return 'idx_acl'
-
- elif token == 'kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7':
- return 'idx_target'
-
-
- elif token in ('kernel|connected|static|rip|ospf|isis|pim|table',
- 'kernel|connected|static|ripng|ospf6|isis|table',
- 'kernel|connected|static|rip|isis|bgp|pim|table',
- 'kernel|connected|static|rip|ospf|isis|bgp|pim|table',
- 'kernel|connected|static|rip|ospf|isis|bgp|pim|table',
- 'kernel|connected|static|rip|ospf|isis|bgp|pim|table|any',
- 'kernel|connected|static|ripng|ospf6|isis|bgp|table|any',
- 'kernel|connected|static|ripng|ospf6|isis|bgp|table',
- 'kernel|connected|static|ospf6|isis|bgp|table',
- 'kernel|connected|static|ospf|isis|bgp|pim|table',
- 'kernel|connected|static|ripng|isis|bgp|table',
- # '',
- 'zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pimd',
- 'zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd',
- 'bgp|ospf|rip|ripng|isis|ospf6|connected|system|kernel|static',
- 'kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table'):
- return 'idx_protocol'
-
- elif '|' in token:
- raise Exception("%d: what variable name for %s" % (line_number, token))
-
- elif re_range:
- return 'idx_number'
-
- elif token.upper() == token:
- return 'idx_%s' % token.lower()
-
- else:
- raise Exception("%d: what variable name for %s" % (line_number, token))
-
-
-def get_command_string_index_variable_table(line_number, line):
- """
- Return a table that maps an index position to a variable name such as 'idx_ipv4'
- """
- indexes = OrderedDict()
-
- line = line.strip()
- assert line.startswith('"'), "line does not start with \"\n%s" % (line)
- assert line.endswith('",'), "line does not end with \",\n%s" % (line)
- line = line[1:-2]
- max_index = 0
-
- for (token_index, token) in enumerate(line_to_tokens(line_number, line)):
- if not token:
- raise Exception("%d: empty token" % line_number)
-
- if token_is_variable(line_number, token):
- # print "%s is a token" % token
- idx_variable_name = get_token_index_variable_name(line_number, token)
- count = 0
- for tmp in indexes.itervalues():
- if tmp == idx_variable_name:
- count += 1
- elif re.search('^%s_\d+' % idx_variable_name, tmp):
- count += 1
- if count:
- idx_variable_name = "%s_%d" % (idx_variable_name, count + 1)
- indexes[token_index] = idx_variable_name
-
- return indexes
-
-
-def expand_command_string(line):
-
- # in the middle
- line = line.replace('" CMD_AS_RANGE "', '(1-4294967295)')
- line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE "', '(1-5000)')
- line = line.replace('" BGP_INSTANCE_CMD "', '<view|vrf> WORD')
- line = line.replace('" BGP_INSTANCE_ALL_CMD "', '<view|vrf> all')
- line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM) "', '(1-255)')
- line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD "', '<kernel|connected|static|rip|ospf|isis|pim|table>')
- line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD "', '<kernel|connected|static|ripng|ospf6|isis|table>')
- line = line.replace('" OSPF_LSA_TYPES_CMD_STR "', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as')
- line = line.replace('" QUAGGA_REDIST_STR_OSPFD "', '<kernel|connected|static|rip|isis|bgp|pim|table>')
- line = line.replace('" VRF_CMD_STR "', 'vrf NAME')
- line = line.replace('" VRF_ALL_CMD_STR "', 'vrf all')
- line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA "', '<kernel|connected|static|rip|ospf|isis|bgp|pim|table|any>')
- line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '<kernel|connected|static|ripng|ospf6|isis|bgp|table|any>')
- line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '<kernel|connected|static|ospf6|isis|bgp|table>')
- line = line.replace('" QUAGGA_REDIST_STR_RIPD "', '<kernel|connected|static|ospf|isis|bgp|pim|table>')
- line = line.replace('" QUAGGA_REDIST_STR_OSPF6D "', '<kernel|connected|static|ripng|isis|bgp|table>')
- line = line.replace('" QUAGGA_REDIST_STR_ISISD "', '<kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table>')
- line = line.replace('" LOG_FACILITIES "', '<kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>')
- line = line.replace('" LOG_LEVELS "', ' <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>')
-
- # endswith
- line = line.replace('" CMD_AS_RANGE,', ' (1-4294967295)",')
- line = line.replace('" DYNAMIC_NEIGHBOR_LIMIT_RANGE,', ' (1-5000)",')
- line = line.replace('" BGP_INSTANCE_CMD,', ' <view|vrf> WORD",')
- line = line.replace('" BGP_INSTANCE_ALL_CMD,', ' <view|vrf> all",')
- line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '(1-255)",')
- line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '(1-255)",')
- line = line.replace('" BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,', '(2-255) (50-60000) (50-60000)",')
- line = line.replace('" OSPF_LSA_TYPES_CMD_STR,',
- ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",')
- line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' <A.B.C.D|X:X::X:X|WORD>",')
- line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' [A.B.C.D|X:X::X:X|WORD]",')
- line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' <kernel|connected|static|rip|ospf|isis|pim|table>",')
- line = line.replace('" QUAGGA_IP6_REDIST_STR_BGPD,', ' <kernel|connected|static|ripng|ospf6|isis|table>",')
- line = line.replace('" QUAGGA_REDIST_STR_OSPFD,', ' <kernel|connected|static|rip|isis|bgp|pim|table>",')
- line = line.replace('" VRF_CMD_STR,', ' vrf NAME",')
- line = line.replace('" VRF_ALL_CMD_STR,', ' vrf all",')
- line = line.replace('" QUAGGA_IP_REDIST_STR_ZEBRA,', ' <kernel|connected|static|rip|ospf|isis|bgp|pim|table>",')
- line = line.replace('" QUAGGA_IP6_REDIST_STR_ZEBRA,', ' <kernel|connected|static|ripng|ospf6|isis|bgp|table>",')
- line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,', ' <kernel|connected|static|rip|ospf|isis|bgp|pim|table|any>",')
- line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' <kernel|connected|static|ripng|ospf6|isis|bgp|table|any>",')
- line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' <kernel|connected|static|ospf6|isis|bgp|table>",')
- line = line.replace('" QUAGGA_REDIST_STR_RIPD,', ' <kernel|connected|static|ospf|isis|bgp|pim|table>",')
- line = line.replace('" PIM_CMD_IP_MULTICAST_ROUTING,', ' ip multicast-routing",')
- line = line.replace('" PIM_CMD_IP_IGMP_QUERY_INTERVAL,', ' ip igmp query-interval",')
- line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,', ' ip igmp query-max-response-time-dsec",')
- line = line.replace('" PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,', ' ip igmp query-max-response-time",')
- line = line.replace('" QUAGGA_REDIST_STR_OSPF6D,', ' <kernel|connected|static|ripng|isis|bgp|table>",')
- line = line.replace('" QUAGGA_REDIST_STR_ISISD,', ' <kernel|connected|static|rip|ripng|ospf|ospf6|bgp|pim|table>",')
- line = line.replace('" LOG_FACILITIES,', ' <kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>",')
- line = line.replace('" LOG_LEVELS,', ' <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",')
-
- # startswith
- line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range <A.B.C.D/M|X:X::X:X/M> ')
- line = line.replace('NO_NEIGHBOR_CMD2 "', '"no neighbor <A.B.C.D|X:X::X:X|WORD> ')
- line = line.replace('NEIGHBOR_CMD2 "', '"neighbor <A.B.C.D|X:X::X:X|WORD> ')
- line = line.replace('NO_NEIGHBOR_CMD "', '"no neighbor <A.B.C.D|X:X::X:X> ')
- line = line.replace('NEIGHBOR_CMD "', '"neighbor <A.B.C.D|X:X::X:X> ')
- line = line.replace('PIM_CMD_NO "', '"no ')
- line = line.replace('PIM_CMD_IP_IGMP_QUERY_INTERVAL "', '"ip igmp query-interval ')
- line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME "', '"ip igmp query-max-response-time ')
- line = line.replace('PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC "', '"ip igmp query-max-response-time-dsec ')
- line = line.replace('LOG_LEVELS "', '"<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging> ')
-
- # solo
- line = line.replace('NO_NEIGHBOR_CMD2,', '"no neighbor <A.B.C.D|X:X::X:X|WORD>",')
- line = line.replace('NEIGHBOR_CMD2,', '"neighbor <A.B.C.D|X:X::X:X|WORD>",')
- line = line.replace('NO_NEIGHBOR_CMD,', '"no neighbor <A.B.C.D|X:X::X:X>",')
- line = line.replace('NEIGHBOR_CMD,', '"neighbor <A.B.C.D|X:X::X:X>",')
- line = line.replace('PIM_CMD_IP_MULTICAST_ROUTING,', '"ip multicast-routing",')
-
- if line.rstrip().endswith('" ,'):
- line = line.replace('" ,', '",')
-
- # compress duplicate white spaces
- re_space = re.search('^(\s*).*(\s*)$', line)
- line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2)
-
- return line
-
-
-class DEFUN(object):
-
- def __init__(self, line_number, command_string_expanded, lines):
- # name, name_cmd, command_string, help_strings, guts):
- self.line_number = line_number
- self.name = None
- self.name_cmd = None
- self.command_string = None
- self.command_string_expanded = command_string_expanded
- self.help_strings = []
- self.guts = []
-
- '''
-DEFUN (no_bgp_maxmed_onstartup,
- no_bgp_maxmed_onstartup_cmd,
- "no bgp max-med on-startup",
- NO_STR
- BGP_STR
- "Advertise routes with max-med\n"
- "Effective on a startup\n")
-
- '''
- state = 'HEADER'
- for (line_number, line) in enumerate(lines):
-
- if state == 'HEADER':
- if line_number == 0:
- re_name = re.search('DEFUN \((.*),', line.strip())
- self.name = re_name.group(1)
-
- elif line_number == 1:
- self.name_cmd = line.strip()[0:-1] # chop the trailing comma
-
- elif line_number == 2:
- self.command_string = line
- state = 'HELP'
-
- elif state == 'HELP':
- if line.strip() == '{':
- # self.guts.append(line)
- state = 'BODY'
- else:
- self.help_strings.append(line)
-
- elif state == 'BODY':
- if line.rstrip() == '}':
- # self.guts.append(line)
- state = None
- else:
- self.guts.append(line)
-
- else:
- raise Exception("invalid state %s" % state)
-
- # print "%d %7s: %s" % (line_number, state, line.rstrip())
-
- assert self.command_string, "No command string for\n%s" % pformat(lines)
-
- def __str__(self):
- return self.name
-
- def sanity_check(self):
- (max_index, variable_indexes) = get_command_string_variable_indexes(self.line_number, self.command_string_expanded)
-
- # sanity check that each argv index matches a variable in the command string
- for line in self.guts:
- if 'argv[' in line and '->arg' in line:
- tmp_line = deepcopy(line)
- re_argv = re.search('^.*?argv\[(\d+)\]->arg(.*)$', tmp_line)
-
- while re_argv:
- index = int(re_argv.group(1))
- if index not in variable_indexes and index <= max_index:
- print "%d: index %s is not a variable in the command string" % (self.line_number, index)
- tmp_line = re_argv.group(2)
- re_argv = re.search('^.*?argv\[(\d+)\]->arg(.*)$', tmp_line)
-
- def get_new_command_string(self):
- line = self.command_string
- # Change <1-255> to (1-255)
- # Change (foo|bar) to <foo|bar>
- # Change {wazzup} to [wazzup]....there shouldn't be many of these
-
- line = line.replace('(', '<')
- line = line.replace(')', '>')
- line = line.replace('{', '[')
- line = line.replace('}', ']')
- re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line)
-
- # A one off to handle "CMD_RANGE_STR(1, MULTIPATH_NUM)"
- if 'CMD_RANGE_STR<' in line:
- line = line.replace('CMD_RANGE_STR<', 'CMD_RANGE_STR(')
- line = line.replace('>', ')')
-
- while re_range:
- line = "%s(%s)%s" % (re_range.group(1), re_range.group(2), re_range.group(3))
- re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line)
-
- 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)
-
- '''
- # I ran this once and cleaned them all up...this spews many
- # false positives so we don't want to leave this on
- 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):
- used = {}
-
- # sanity check that each argv index matches a variable in the command string
- for line in self.guts:
- if 'argv[' in line and '->arg' in line:
- tmp_line = deepcopy(line)
- re_argv = re.search('^.*?argv\[(\w+)\]->arg(.*)$', tmp_line)
-
- while re_argv:
- index = re_argv.group(1)
-
- if index.isdigit():
- index = int(index)
- if index in idx_table:
- used[index] = idx_table[index]
- else:
- print "%d: could not find idx variable for %d" % (self.line_number, index)
- else:
- for (key, value) in idx_table.iteritems():
- if value == index:
- used[key] = value
- break
-
- tmp_line = re_argv.group(2)
- re_argv = re.search('^.*?argv\[(\w+)\]->arg(.*)$', tmp_line)
-
- return used
-
- def uses_argc(self):
- for line in self.guts:
- if 'CHECK ME argc referenced below' in line:
- return False
-
- if 'use_json (argc, argv)' in line:
- continue
-
- if 'use_json(argc, argv)' in line:
- continue
-
- if 'bgp_get_argv_vrf (argc,)' in line:
- continue
-
- if 'bgp_get_argv_afi_safi (argc,' in line:
- continue
-
- if 'zebra_vty_ip_route_tdv_helper (argc,' in line:
- continue
-
- if 'argc' in line:
- return True
- 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_expanded = self.get_new_command_string()
- lines = []
-
- lines.append("DEFUN (%s,\n" % self.name)
- lines.append(" %s,\n" % self.name_cmd)
- # lines.append(new_command_string)
- lines.append(new_command_string_expanded)
- lines.extend(self.help_strings)
- lines.append('{\n')
-
- # if self.uses_argc():
- # lines.append(" /* CHECK ME argc referenced below */\n")
- lines.extend(self.guts)
-
- '''
- This is no longer used but was used to do the "- next it was used to
- replace the 4 in argv[4]->arg with an idx_foo variable" run mentioned
- at the top of this file.
-
- # only print the variables that will be used else we get a compile error
- idx_table = get_command_string_index_variable_table(self.line_number, new_command_string_expanded)
- idx_table_used = self.get_used_idx_variables(idx_table)
-
- for index in sorted(idx_table_used.keys()):
- idx_variable = idx_table_used[index]
- lines.append(" int %s = %d;\n" % (idx_variable, index))
-
- # sanity check that each argv index matches a variable in the command string
- for line in self.guts:
- if line.startswith(' int idx_'):
- pass
- elif 'argv[' in line and '->arg' in line:
- for (index, idx_variable) in idx_table.iteritems():
- line = line.replace("argv[%d]->arg" % index, "argv[%s]->arg" % idx_variable)
- lines.append(line)
- else:
- lines.append(line)
- '''
-
- lines.append('}\n')
- return ''.join(lines)
-
-
-def update_argvs(filename):
- lines = []
-
- with open(filename, 'r') as fh:
- state = None
- defun_line_number = None
- cmd_string = None
- # argv_translator = {}
- # print_translator = False
- variable_indexes = {}
- max_index = 0
- defun_lines = []
- defuns = {}
- command_string = None
-
- for (line_number, line) in enumerate(fh.readlines()):
- # new_line = line
-
- if state is None:
- if line.startswith('DEFUN ('):
- assert line.count(',') == 1, "%d: Too many commas in\n%s" % (line_number, line)
- state = 'DEFUN_HEADER'
- defun_line_number = line_number
- defun_lines.append(line)
-
- elif state == 'DEFUN_HEADER':
- defun_lines.append(line)
-
- if line.startswith('DEFUN'):
- raise Exception("ERROR on line %d, found DEFUN inside DEFUN" % line_number)
-
- elif line.startswith('ALIAS'):
- raise Exception("ERROR on line %d, found ALIAS inside DEFUN" % line_number)
-
- elif line.strip() == '{':
- state = 'DEFUN_BODY'
-
- elif line_number == defun_line_number + 2:
- line = expand_command_string(line)
- command_string = line
-
- '''
- # No longer used now that all indexes have been updated
- argv_translator = get_argv_translator(line_number, line)
- print_translator = True
- '''
-
- elif state == 'DEFUN_BODY':
- defun_lines.append(line)
-
- if line.rstrip() == '}':
- new_defun = DEFUN(defun_line_number, command_string, defun_lines)
- defuns[new_defun.name] = new_defun
- state = None
- command_string = None
- defun_lines = []
-
- # cmd_string = None
- # defun_line_number = None
- # argv_translator = {}
-
- '''
- # No longer used now that all indexes have been updated
- elif 'argv[' in new_line and '->arg' not in new_line:
- for index in reversed(argv_translator.keys()):
- old_argv = "argv[%d]" % index
- new_argv = "argv[%d]->arg" % argv_translator[index]
- new_line = new_line.replace(old_argv, new_argv)
- '''
-
- # uncomment to debug state machine
- # print "%5d %12s: %s" % (line_number, state, line.rstrip())
-
- '''
- # No longer used now that all indexes have been updated
- if print_translator:
- print "%s\n" % pformat(argv_translator)
- print_translator = False
- '''
-
- lines.append(line)
-
- for defun in defuns.itervalues():
- defun.sanity_check()
-
- # Now write the file but allow the DEFUN object to update the contents of the DEFUN ()
- with open(filename, 'w') as fh:
- state = None
-
- for (line_number, line) in enumerate(lines):
-
- if state is None:
- if 'The following ALIASes need to be implemented in this DEFUN' in line:
- state = 'CHANGE ME'
- fh.write(line)
-
- elif line.startswith('DEFUN ('):
- state = 'DEFUN_HEADER'
- re_name = re.search('DEFUN \((.*),', line.strip())
- name = re_name.group(1)
- defun = defuns.get(name)
- fh.write(defun.dump())
- else:
- fh.write(line)
-
- elif state == 'CHANGE ME':
- if line.strip() == '*/':
- state = None
- fh.write(line)
- elif line.strip().startswith('* ') and not line.strip().startswith('* '):
- new_line = expand_command_string(line[3:]) # chop the leading " * "
- fh.write(" * %s" % new_line)
- else:
- fh.write(line)
-
- elif state == 'DEFUN_HEADER':
- if line.strip() == '{':
- state = 'DEFUN_BODY'
-
- elif state == 'DEFUN_BODY':
- if line.rstrip() == '}':
- state = None
-
- # uncomment to debug state machine
- # print "%5d %12s: %s" % (line_number, state, line.rstrip())
-
-
-if __name__ == '__main__':
- (print_options, ended_with_space, sys.argv) = get_network_docopt_info(sys.argv)
- cli = NetworkDocopt(__doc__)
-
- if print_options:
- cli.print_options(ended_with_space)
- else:
- cli.run()
-
- if cli.get('rebuild-defuns'):
- if cli.get('<text>'):
- filename = cli.get('<text>')
- update_argvs(filename)
-
- else:
- output = subprocess.check_output("grep -l DEFUN *.c", shell=True).splitlines()
- for filename in output:
- filename = filename.strip()
- print "crunching %s" % filename
- update_argvs(filename)
+++ /dev/null
-#!/usr/bin/env python
-
-"""
-The primary use case of this tool is to print a network-docopt compatible
-docstring that covers all bgp and ospf commands in quagga.
-"""
-
-import argparse
-import logging
-import os
-import re
-import sys
-from pprint import pprint, pformat
-
-# All of the clear commands in bgp_clear_ignore will be covered by these clear commands:
-# quagga clear bgp (<ipv4>|<ipv6>|<interface>|*)
-# quagga clear bgp (<ipv4>|<ipv6>|<interface>|*) soft [in|out]
-# quagga clear bgp prefix <ipv4/prefixlen>
-bgp_clear_ignore = """ quagga clear bgp (<ipv4>|<ipv6>|<interface>)
- quagga clear bgp (<ipv4>|<ipv6>|<interface>) in
- quagga clear bgp (<ipv4>|<ipv6>|<interface>) in prefix-filter
- quagga clear bgp (<ipv4>|<ipv6>|<interface>) out
- quagga clear bgp (<ipv4>|<ipv6>|<interface>) soft
- quagga clear bgp (<ipv4>|<ipv6>|<interface>) soft in
- quagga clear bgp (<ipv4>|<ipv6>|<interface>) soft out
- quagga clear bgp *
- quagga clear bgp * in
- quagga clear bgp * in prefix-filter
- quagga clear bgp * out
- quagga clear bgp * soft
- quagga clear bgp * soft in
- quagga clear bgp * soft out
- quagga clear bgp <1-4294967295>
- quagga clear bgp <1-4294967295> in
- quagga clear bgp <1-4294967295> in prefix-filter
- quagga clear bgp <1-4294967295> out
- quagga clear bgp <1-4294967295> soft
- quagga clear bgp <1-4294967295> soft in
- quagga clear bgp <1-4294967295> soft out
- quagga clear bgp BGP_INSTANCE_CMD *
- quagga clear bgp BGP_INSTANCE_CMD * soft
- quagga clear bgp BGP_INSTANCE_CMD * soft in
- quagga clear bgp BGP_INSTANCE_CMD * soft out
- quagga clear bgp external
- quagga clear bgp external in
- quagga clear bgp external in prefix-filter
- quagga clear bgp external out
- quagga clear bgp external soft
- quagga clear bgp external soft in
- quagga clear bgp external soft out
- quagga clear bgp ipv6 (<ipv4>|<ipv6>|<interface>)
- quagga clear bgp ipv6 (<ipv4>|<ipv6>|<interface>) in
- quagga clear bgp ipv6 (<ipv4>|<ipv6>|<interface>) in prefix-filter
- quagga clear bgp ipv6 (<ipv4>|<ipv6>|<interface>) out
- quagga clear bgp ipv6 (<ipv4>|<ipv6>|<interface>) soft
- quagga clear bgp ipv6 (<ipv4>|<ipv6>|<interface>) soft in
- quagga clear bgp ipv6 (<ipv4>|<ipv6>|<interface>) soft out
- quagga clear bgp ipv6 (unicast|multicast) prefix <ipv6/prefixlen>
- quagga clear bgp ipv6 *
- quagga clear bgp ipv6 * in
- quagga clear bgp ipv6 * in prefix-filter
- quagga clear bgp ipv6 * out
- quagga clear bgp ipv6 * soft
- quagga clear bgp ipv6 * soft in
- quagga clear bgp ipv6 * soft out
- quagga clear bgp ipv6 <1-4294967295>
- quagga clear bgp ipv6 <1-4294967295> in
- quagga clear bgp ipv6 <1-4294967295> in prefix-filter
- quagga clear bgp ipv6 <1-4294967295> out
- quagga clear bgp ipv6 <1-4294967295> soft
- quagga clear bgp ipv6 <1-4294967295> soft in
- quagga clear bgp ipv6 <1-4294967295> soft out
- quagga clear bgp ipv6 external
- quagga clear bgp ipv6 external WORD in
- quagga clear bgp ipv6 external WORD out
- quagga clear bgp ipv6 external in prefix-filter
- quagga clear bgp ipv6 external soft
- quagga clear bgp ipv6 external soft in
- quagga clear bgp ipv6 external soft out
- quagga clear bgp ipv6 peer-group WORD
- quagga clear bgp ipv6 peer-group WORD in
- quagga clear bgp ipv6 peer-group WORD in prefix-filter
- quagga clear bgp ipv6 peer-group WORD out
- quagga clear bgp ipv6 peer-group WORD soft
- quagga clear bgp ipv6 peer-group WORD soft in
- quagga clear bgp ipv6 peer-group WORD soft out
- quagga clear bgp peer-group WORD
- quagga clear bgp peer-group WORD in
- quagga clear bgp peer-group WORD in prefix-filter
- quagga clear bgp peer-group WORD out
- quagga clear bgp peer-group WORD soft
- quagga clear bgp peer-group WORD soft in
- quagga clear bgp peer-group WORD soft out
- quagga clear ip bgp (<ipv4>|<interface>) in
- quagga clear ip bgp (<ipv4>|<interface>) in prefix-filter
- quagga clear ip bgp (<ipv4>|<interface>) ipv4 (unicast|multicast) in
- quagga clear ip bgp (<ipv4>|<interface>) ipv4 (unicast|multicast) in prefix-filter
- quagga clear ip bgp (<ipv4>|<interface>) ipv4 (unicast|multicast) out
- quagga clear ip bgp (<ipv4>|<interface>) ipv4 (unicast|multicast) soft
- quagga clear ip bgp (<ipv4>|<interface>) ipv4 (unicast|multicast) soft in
- quagga clear ip bgp (<ipv4>|<interface>) ipv4 (unicast|multicast) soft out
- quagga clear ip bgp (<ipv4>|<interface>) out
- quagga clear ip bgp (<ipv4>|<interface>) soft
- quagga clear ip bgp (<ipv4>|<interface>) soft in
- quagga clear ip bgp (<ipv4>|<interface>) soft out
- quagga clear ip bgp (<ipv4>|<interface>) vpnv4 unicast in
- quagga clear ip bgp (<ipv4>|<interface>) vpnv4 unicast out
- quagga clear ip bgp (<ipv4>|<interface>) vpnv4 unicast soft
- quagga clear ip bgp (<ipv4>|<interface>) vpnv4 unicast soft in
- quagga clear ip bgp (<ipv4>|<interface>) vpnv4 unicast soft out
- quagga clear ip bgp (<ipv4>|<ipv6>|<interface>)
- quagga clear ip bgp *
- quagga clear ip bgp * in
- quagga clear ip bgp * in prefix-filter
- quagga clear ip bgp * ipv4 (unicast|multicast) in
- quagga clear ip bgp * ipv4 (unicast|multicast) in prefix-filter
- quagga clear ip bgp * ipv4 (unicast|multicast) out
- quagga clear ip bgp * ipv4 (unicast|multicast) soft
- quagga clear ip bgp * ipv4 (unicast|multicast) soft in
- quagga clear ip bgp * ipv4 (unicast|multicast) soft out
- quagga clear ip bgp * out
- quagga clear ip bgp * soft
- quagga clear ip bgp * soft in
- quagga clear ip bgp * soft out
- quagga clear ip bgp * vpnv4 unicast in
- quagga clear ip bgp * vpnv4 unicast out
- quagga clear ip bgp * vpnv4 unicast soft
- quagga clear ip bgp * vpnv4 unicast soft in
- quagga clear ip bgp * vpnv4 unicast soft out
- quagga clear ip bgp <1-4294967295>
- quagga clear ip bgp <1-4294967295> in
- quagga clear ip bgp <1-4294967295> in prefix-filter
- quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in
- quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) in prefix-filter
- quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) out
- quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft
- quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft in
- quagga clear ip bgp <1-4294967295> ipv4 (unicast|multicast) soft out
- quagga clear ip bgp <1-4294967295> out
- quagga clear ip bgp <1-4294967295> soft
- quagga clear ip bgp <1-4294967295> soft in
- quagga clear ip bgp <1-4294967295> soft out
- quagga clear ip bgp <1-4294967295> vpnv4 unicast in
- quagga clear ip bgp <1-4294967295> vpnv4 unicast out
- quagga clear ip bgp <1-4294967295> vpnv4 unicast soft
- quagga clear ip bgp <1-4294967295> vpnv4 unicast soft in
- quagga clear ip bgp <1-4294967295> vpnv4 unicast soft out
- quagga clear ip bgp BGP_INSTANCE_CMD *
- quagga clear ip bgp BGP_INSTANCE_CMD * in prefix-filter
- quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) in prefix-filter
- quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft
- quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft in
- quagga clear ip bgp BGP_INSTANCE_CMD * ipv4 (unicast|multicast) soft out
- quagga clear ip bgp BGP_INSTANCE_CMD * soft
- quagga clear ip bgp BGP_INSTANCE_CMD * soft in
- quagga clear ip bgp BGP_INSTANCE_CMD * soft out
- quagga clear ip bgp dampening
- quagga clear ip bgp dampening <ipv4/prefixlen>
- quagga clear ip bgp dampening <ipv4>
- quagga clear ip bgp dampening <ipv4> <ipv4>
- quagga clear ip bgp external
- quagga clear ip bgp external in
- quagga clear ip bgp external in prefix-filter
- quagga clear ip bgp external ipv4 (unicast|multicast) in
- quagga clear ip bgp external ipv4 (unicast|multicast) in prefix-filter
- quagga clear ip bgp external ipv4 (unicast|multicast) out
- quagga clear ip bgp external ipv4 (unicast|multicast) soft
- quagga clear ip bgp external ipv4 (unicast|multicast) soft in
- quagga clear ip bgp external ipv4 (unicast|multicast) soft out
- quagga clear ip bgp external out
- quagga clear ip bgp external soft
- quagga clear ip bgp external soft in
- quagga clear ip bgp external soft out
- quagga clear ip bgp peer-group WORD
- quagga clear ip bgp peer-group WORD in
- quagga clear ip bgp peer-group WORD in prefix-filter
- quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in
- quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter
- quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) out
- quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft
- quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in
- quagga clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out
- quagga clear ip bgp peer-group WORD out
- quagga clear ip bgp peer-group WORD soft
- quagga clear ip bgp peer-group WORD soft in
- quagga clear ip bgp peer-group WORD soft out
- quagga clear ip bgp prefix <ipv4/prefixlen>""".splitlines()
-
-# All of the debug commands in bgp_debug_ignore will be covered by these debug commands:
-# quagga (add|del) debug bgp bestpath <ip/prefixlen>
-# quagga (add|del) debug bgp keepalives (<ipv4>|<ipv6>|<interface>)
-# quagga (add|del) debug bgp neighbor-events (<ipv4>|<ipv6>|<interface>)
-# quagga (add|del) debug bgp nht
-# quagga (add|del) debug bgp update-groups
-# quagga (add|del) debug bgp updates prefix <ip/prefixlen>
-# quagga (add|del) debug bgp zebra prefix <ip/prefixlen>
-bgp_debug_ignore = """ quagga debug bgp as4
- quagga debug bgp as4 segment
- quagga debug bgp bestpath (<ipv4/prefixlen>|<ipv6/prefixlen>)
- quagga debug bgp keepalives
- quagga debug bgp keepalives (<ipv4>|<ipv6>|<interface>)
- quagga debug bgp neighbor-events
- quagga debug bgp neighbor-events (<ipv4>|<ipv6>|<interface>)
- quagga debug bgp nht
- quagga debug bgp update-groups
- quagga debug bgp updates
- quagga debug bgp updates (in|out)
- quagga debug bgp updates (in|out) (<ipv4>|<ipv6>|<interface>)
- quagga debug bgp updates prefix (<ipv4/prefixlen>|<ipv6/prefixlen>)
- quagga debug bgp zebra
- quagga debug bgp zebra prefix (<ipv4/prefixlen>|<ipv6/prefixlen>)""".splitlines()
-
-
-bgp_show_ignore = """ quagga show bgp (ipv4) (vpnv4) statistics
- quagga show bgp (ipv4|ipv6) (unicast|multicast) statistics
- quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups
- quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)
- quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID
- quagga show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)
- quagga show bgp <ipv6/prefixlen> (bestpath|multipath) [json]
- quagga show bgp <ipv6/prefixlen> [json]
- quagga show bgp <ipv6/prefixlen> longer-prefixes
- quagga show bgp <ipv6> (bestpath|multipath) [json]
- quagga show bgp <ipv6> [json]
- quagga show bgp BGP_INSTANCE_CMD (ipv4) (vpnv4) statistics
- quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community
- quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) (advertised-routes|received-routes) [json]
- quagga show bgp BGP_INSTANCE_CMD (ipv4|ipv6) (unicast|multicast) statistics
- quagga show bgp BGP_INSTANCE_CMD <ipv6/prefixlen> (bestpath|multipath) [json]
- quagga show bgp BGP_INSTANCE_CMD <ipv6/prefixlen> [json]
- quagga show bgp BGP_INSTANCE_CMD <ipv6/prefixlen> longer-prefixes
- quagga show bgp BGP_INSTANCE_CMD <ipv6> (bestpath|multipath) [json]
- quagga show bgp BGP_INSTANCE_CMD <ipv6> [json]
- quagga show bgp BGP_INSTANCE_CMD [json]
- quagga show bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD)
- quagga show bgp BGP_INSTANCE_CMD filter-list WORD
- quagga show bgp BGP_INSTANCE_CMD ipv6 (unicast|multicast) summary [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 <ipv6/prefixlen> (bestpath|multipath) [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 <ipv6/prefixlen> [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 <ipv6/prefixlen> longer-prefixes
- quagga show bgp BGP_INSTANCE_CMD ipv6 <ipv6> (bestpath|multipath) [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 <ipv6> [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 community-list (<1-500>|WORD)
- quagga show bgp BGP_INSTANCE_CMD ipv6 filter-list WORD
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (<ipv4>|<ipv6>|<interface>) [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (<ipv4>|<ipv6>|<interface>) dampened-routes [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (<ipv4>|<ipv6>|<interface>) flap-statistics [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (<ipv4>|<ipv6>|<interface>) prefix-counts [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (<ipv4>|<ipv6>|<interface>) received prefix-filter [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 neighbors [json]
- quagga show bgp BGP_INSTANCE_CMD ipv6 prefix-list WORD
- quagga show bgp BGP_INSTANCE_CMD ipv6 route-map WORD
- quagga show bgp BGP_INSTANCE_CMD ipv6 summary [json]
- quagga show bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) [json]
- quagga show bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) dampened-routes [json]
- quagga show bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) flap-statistics [json]
- quagga show bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) received prefix-filter [json]
- quagga show bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show bgp BGP_INSTANCE_CMD neighbors [json]
- quagga show bgp BGP_INSTANCE_CMD prefix-list WORD
- quagga show bgp BGP_INSTANCE_CMD route-map WORD
- quagga show bgp BGP_INSTANCE_CMD summary [json]
- quagga show bgp BGP_INSTANCE_CMD update-groups
- quagga show bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue)
- quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID
- quagga show bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)
- quagga show bgp [json]
- quagga show bgp community
- quagga show bgp community (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show bgp community-list (<1-500>|WORD)
- quagga show bgp community-list (<1-500>|WORD) exact-match
- quagga show bgp filter-list WORD
- quagga show bgp ipv4 (unicast|multicast) <ipv4/prefixlen> (bestpath|multipath) [json]
- quagga show bgp ipv4 (unicast|multicast) <ipv4/prefixlen> [json]
- quagga show bgp ipv4 (unicast|multicast) <ipv4> (bestpath|multipath) [json]
- quagga show bgp ipv4 (unicast|multicast) <ipv4> [json]
- quagga show bgp ipv4 (unicast|multicast) [json]
- quagga show bgp ipv4 (unicast|multicast) summary [json]
- quagga show bgp ipv6 (unicast|multicast) <ipv6/prefixlen> (bestpath|multipath) [json]
- quagga show bgp ipv6 (unicast|multicast) <ipv6/prefixlen> [json]
- quagga show bgp ipv6 (unicast|multicast) <ipv6> (bestpath|multipath) [json]
- quagga show bgp ipv6 (unicast|multicast) <ipv6> [json]
- quagga show bgp ipv6 (unicast|multicast) [json]
- quagga show bgp ipv6 (unicast|multicast) summary [json]
- quagga show bgp ipv6 <ipv6/prefixlen> (bestpath|multipath) [json]
- quagga show bgp ipv6 <ipv6/prefixlen> [json]
- quagga show bgp ipv6 <ipv6/prefixlen> longer-prefixes
- quagga show bgp ipv6 <ipv6> (bestpath|multipath) [json]
- quagga show bgp ipv6 <ipv6> [json]
- quagga show bgp ipv6 [json]
- quagga show bgp ipv6 community
- quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show bgp ipv6 community (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show bgp ipv6 community-list (<1-500>|WORD)
- quagga show bgp ipv6 community-list (<1-500>|WORD) exact-match
- quagga show bgp ipv6 filter-list WORD
- quagga show bgp ipv6 neighbors (<ipv4>|<ipv6>|<interface>) [json]
- quagga show bgp ipv6 neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show bgp ipv6 neighbors (<ipv4>|<ipv6>|<interface>) dampened-routes [json]
- quagga show bgp ipv6 neighbors (<ipv4>|<ipv6>|<interface>) flap-statistics [json]
- quagga show bgp ipv6 neighbors (<ipv4>|<ipv6>|<interface>) prefix-counts [json]
- quagga show bgp ipv6 neighbors (<ipv4>|<ipv6>|<interface>) received prefix-filter [json]
- quagga show bgp ipv6 neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show bgp ipv6 neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show bgp ipv6 neighbors [json]
- quagga show bgp ipv6 prefix-list WORD
- quagga show bgp ipv6 regexp LINE
- quagga show bgp ipv6 route-map WORD
- quagga show bgp ipv6 summary [json]
- quagga show bgp memory
- quagga show bgp neighbors (<ipv4>|<ipv6>|<interface>) [json]
- quagga show bgp neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show bgp neighbors (<ipv4>|<ipv6>|<interface>) dampened-routes [json]
- quagga show bgp neighbors (<ipv4>|<ipv6>|<interface>) flap-statistics [json]
- quagga show bgp neighbors (<ipv4>|<ipv6>|<interface>) received prefix-filter [json]
- quagga show bgp neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show bgp neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show bgp neighbors [json]
- quagga show bgp prefix-list WORD
- quagga show bgp regexp LINE
- quagga show bgp route-map WORD
- quagga show bgp summary [json]
- quagga show bgp update-groups
- quagga show bgp update-groups (advertise-queue|advertised-routes|packet-queue)
- quagga show bgp update-groups SUBGROUP-ID
- quagga show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)
- quagga show bgp view WORD ipv4 (unicast|multicast) summary [json]
- quagga show bgp views
- quagga show bgp vrfs [json]
- quagga show debugging bgp
- quagga show ip as-path-access-list
- quagga show ip as-path-access-list WORD
- quagga show ip bgp <ipv4/prefixlen> (bestpath|multipath) [json]
- quagga show ip bgp <ipv4/prefixlen> [json]
- quagga show ip bgp <ipv4/prefixlen> longer-prefixes
- quagga show ip bgp <ipv4> (bestpath|multipath) [json]
- quagga show ip bgp <ipv4> [json]
- quagga show ip bgp BGP_INSTANCE_CMD <ipv4/prefixlen> (bestpath|multipath) [json]
- quagga show ip bgp BGP_INSTANCE_CMD <ipv4/prefixlen> [json]
- quagga show ip bgp BGP_INSTANCE_CMD <ipv4/prefixlen> longer-prefixes
- quagga show ip bgp BGP_INSTANCE_CMD <ipv4> (bestpath|multipath) [json]
- quagga show ip bgp BGP_INSTANCE_CMD <ipv4> [json]
- quagga show ip bgp BGP_INSTANCE_CMD [json]
- quagga show ip bgp BGP_INSTANCE_CMD community-list (<1-500>|WORD)
- quagga show ip bgp BGP_INSTANCE_CMD filter-list WORD
- quagga show ip bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) [json]
- quagga show ip bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show ip bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes route-map WORD [json]
- quagga show ip bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) prefix-counts [json]
- quagga show ip bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show ip bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) received-routes route-map WORD [json]
- quagga show ip bgp BGP_INSTANCE_CMD neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show ip bgp BGP_INSTANCE_CMD neighbors [json]
- quagga show ip bgp BGP_INSTANCE_CMD nexthop
- quagga show ip bgp BGP_INSTANCE_CMD nexthop detail
- quagga show ip bgp BGP_INSTANCE_CMD peer-group
- quagga show ip bgp BGP_INSTANCE_CMD peer-group WORD
- quagga show ip bgp BGP_INSTANCE_CMD prefix-list WORD
- quagga show ip bgp BGP_INSTANCE_CMD route-map WORD
- quagga show ip bgp BGP_INSTANCE_CMD summary [json]
- quagga show ip bgp BGP_INSTANCE_CMD update-groups
- quagga show ip bgp BGP_INSTANCE_CMD update-groups (advertise-queue|advertised-routes|packet-queue)
- quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID
- quagga show ip bgp BGP_INSTANCE_CMD update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)
- quagga show ip bgp [json]
- quagga show ip bgp attribute-info
- quagga show ip bgp cidr-only
- quagga show ip bgp community
- quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export)
- quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ip bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ip bgp community-info
- quagga show ip bgp community-list (<1-500>|WORD)
- quagga show ip bgp community-list (<1-500>|WORD) exact-match
- quagga show ip bgp dampened-paths
- quagga show ip bgp filter-list WORD
- quagga show ip bgp flap-statistics
- quagga show ip bgp flap-statistics <ipv4/prefixlen>
- quagga show ip bgp flap-statistics <ipv4/prefixlen> longer-prefixes
- quagga show ip bgp flap-statistics <ipv4>
- quagga show ip bgp flap-statistics cidr-only
- quagga show ip bgp flap-statistics filter-list WORD
- quagga show ip bgp flap-statistics prefix-list WORD
- quagga show ip bgp flap-statistics regexp LINE
- quagga show ip bgp flap-statistics route-map WORD
- quagga show ip bgp ipv4 (unicast|multicast) <ipv4/prefixlen> (bestpath|multipath) [json]
- quagga show ip bgp ipv4 (unicast|multicast) <ipv4/prefixlen> [json]
- quagga show ip bgp ipv4 (unicast|multicast) <ipv4/prefixlen> longer-prefixes
- quagga show ip bgp ipv4 (unicast|multicast) <ipv4> [json]
- quagga show ip bgp ipv4 (unicast|multicast) [json]
- quagga show ip bgp ipv4 (unicast|multicast) cidr-only
- quagga show ip bgp ipv4 (unicast|multicast) community
- quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)
- quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ip bgp ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD)
- quagga show ip bgp ipv4 (unicast|multicast) community-list (<1-500>|WORD) exact-match
- quagga show ip bgp ipv4 (unicast|multicast) filter-list WORD
- quagga show ip bgp ipv4 (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) [json]
- quagga show ip bgp ipv4 (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show ip bgp ipv4 (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes route-map WORD [json]
- quagga show ip bgp ipv4 (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) prefix-counts [json]
- quagga show ip bgp ipv4 (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) received prefix-filter [json]
- quagga show ip bgp ipv4 (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show ip bgp ipv4 (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) received-routes route-map WORD [json]
- quagga show ip bgp ipv4 (unicast|multicast) neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show ip bgp ipv4 (unicast|multicast) neighbors [json]
- quagga show ip bgp ipv4 (unicast|multicast) paths
- quagga show ip bgp ipv4 (unicast|multicast) prefix-list WORD
- quagga show ip bgp ipv4 (unicast|multicast) regexp LINE
- quagga show ip bgp ipv4 (unicast|multicast) route-map WORD
- quagga show ip bgp ipv4 (unicast|multicast) summary [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes route-map WORD [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) dampened-routes [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) flap-statistics [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) prefix-counts [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) received prefix-filter [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) received-routes route-map WORD [json]
- quagga show ip bgp neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show ip bgp neighbors [json]
- quagga show ip bgp nexthop
- quagga show ip bgp nexthop detail
- quagga show ip bgp paths
- quagga show ip bgp peer-group
- quagga show ip bgp peer-group WORD
- quagga show ip bgp prefix-list WORD
- quagga show ip bgp regexp LINE
- quagga show ip bgp route-map WORD
- quagga show ip bgp summary [json]
- quagga show ip bgp update-groups
- quagga show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)
- quagga show ip bgp update-groups SUBGROUP-ID
- quagga show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)
- quagga show ip bgp view WORD ipv4 (unicast|multicast) summary [json]
- quagga show ip bgp vpnv4 all
- quagga show ip bgp vpnv4 all <ipv4/prefixlen> [json]
- quagga show ip bgp vpnv4 all <ipv4> [json]
- quagga show ip bgp vpnv4 all neighbors (<ipv4>|<ipv6>|<interface>) prefix-counts [json]
- quagga show ip bgp vpnv4 all neighbors <ipv4> [json]
- quagga show ip bgp vpnv4 all neighbors <ipv4> advertised-routes [json]
- quagga show ip bgp vpnv4 all neighbors <ipv4> routes [json]
- quagga show ip bgp vpnv4 all neighbors [json]
- quagga show ip bgp vpnv4 all summary [json]
- quagga show ip bgp vpnv4 all tags
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn <ipv4/prefixlen> [json]
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn <ipv4> [json]
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors <ipv4> [json]
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors <ipv4> advertised-routes [json]
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors <ipv4> routes [json]
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json]
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json]
- quagga show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags
- quagga show ip community-list
- quagga show ip community-list (<1-500>|WORD)
- quagga show ip extcommunity-list
- quagga show ip extcommunity-list (<1-500>|WORD)
- quagga show ipv6 bgp <ipv6/prefixlen> [json]
- quagga show ipv6 bgp <ipv6/prefixlen> longer-prefixes
- quagga show ipv6 bgp <ipv6> [json]
- quagga show ipv6 bgp [json]
- quagga show ipv6 bgp community
- quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export)
- quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ipv6 bgp community (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ipv6 bgp community-list WORD
- quagga show ipv6 bgp community-list WORD exact-match
- quagga show ipv6 bgp filter-list WORD
- quagga show ipv6 bgp neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show ipv6 bgp neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show ipv6 bgp neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show ipv6 bgp prefix-list WORD
- quagga show ipv6 bgp regexp LINE
- quagga show ipv6 bgp summary [json]
- quagga show ipv6 mbgp <ipv6/prefixlen> [json]
- quagga show ipv6 mbgp <ipv6/prefixlen> longer-prefixes
- quagga show ipv6 mbgp <ipv6> [json]
- quagga show ipv6 mbgp [json]
- quagga show ipv6 mbgp community
- quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export)
- quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)
- quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ipv6 mbgp community (AA:NN|local-AS|no-advertise|no-export) exact-match
- quagga show ipv6 mbgp community-list WORD
- quagga show ipv6 mbgp community-list WORD exact-match
- quagga show ipv6 mbgp filter-list WORD
- quagga show ipv6 mbgp neighbors (<ipv4>|<ipv6>|<interface>) advertised-routes [json]
- quagga show ipv6 mbgp neighbors (<ipv4>|<ipv6>|<interface>) received-routes [json]
- quagga show ipv6 mbgp neighbors (<ipv4>|<ipv6>|<interface>) routes [json]
- quagga show ipv6 mbgp prefix-list WORD
- quagga show ipv6 mbgp regexp LINE
- quagga show ipv6 mbgp summary [json]""".splitlines()
-
-bgp_config_ignore = """ quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) activate
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) addpath-tx-all-paths
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) addpath-tx-bestpath-per-AS
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) allowas-in
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) allowas-in <1-10>
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) as-override
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged (as-path|next-hop|med)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged as-path (next-hop|med)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged as-path med next-hop
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged as-path next-hop med
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged med (as-path|next-hop)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged med as-path next-hop
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged med next-hop as-path
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged next-hop (as-path|med)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged next-hop as-path med
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) attribute-unchanged next-hop med as-path
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) capability orf prefix-list (both|send|receive)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) default-originate
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) default-originate route-map WORD
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) filter-list WORD (in|out)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) maximum-prefix <1-4294967295>
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) maximum-prefix <1-4294967295> <1-100>
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) maximum-prefix <1-4294967295> <1-100> restart <1-65535>
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) maximum-prefix <1-4294967295> <1-100> warning-only
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) maximum-prefix <1-4294967295> restart <1-65535>
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) maximum-prefix <1-4294967295> warning-only
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) next-hop-self
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) next-hop-self force
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) peer-group WORD
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) prefix-list WORD (in|out)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) remove-private-AS
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) remove-private-AS all
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) remove-private-AS all replace-AS
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) remove-private-AS replace-AS
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) route-map WORD (in|out)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) route-reflector-client
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) route-server-client
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) send-community
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) send-community (both|extended|standard)
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) soft-reconfiguration inbound
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ipv4>|<ipv6>|<interface>) unsuppress-map WORD
- quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map WORD
- quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths <1-255>
- quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255>
- quagga (add|del) bgp [ipv4|ipv6] unicast maximum-paths ibgp <1-255> equal-cluster-length
- quagga (add|del) bgp always-compare-med
- quagga (add|del) bgp bestpath as-path confed
- quagga (add|del) bgp bestpath as-path ignore
- quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set]
- quagga (add|del) bgp bestpath compare-routerid
- quagga (add|del) bgp bestpath med (confed|missing-as-worst)
- quagga (add|del) bgp bestpath med confed missing-as-worst
- quagga (add|del) bgp bestpath med missing-as-worst confed
- quagga (add|del) bgp client-to-client reflection
- quagga (add|del) bgp cluster-id <1-4294967295>
- quagga (add|del) bgp cluster-id <ipv4>
- quagga (add|del) bgp confederation identifier <1-4294967295>
- quagga (add|del) bgp confederation peers . <1-4294967295>
- quagga (add|del) bgp default ipv4-unicast
- quagga (add|del) bgp default local-preference <0-4294967295>
- quagga (add|del) bgp default show-hostname
- quagga (add|del) bgp default subgroup-pkt-queue-max <20-100>
- quagga (add|del) bgp deterministic-med
- quagga (add|del) bgp disable-ebgp-connected-route-check
- quagga (add|del) bgp enforce-first-as
- quagga (add|del) bgp fast-external-failover
- quagga (add|del) bgp graceful-restart
- quagga (add|del) bgp graceful-restart stalepath-time <1-3600>
- quagga (add|del) bgp listen limit <1-5000>
- quagga (add|del) bgp listen range (<ipv4/prefixlen>|<ipv6/prefixlen>) peer-group WORD
- quagga (add|del) bgp log-neighbor-changes
- quagga (add|del) bgp max-med administrative
- quagga (add|del) bgp max-med administrative <0-4294967294>
- quagga (add|del) bgp max-med on-startup <5-86400>
- quagga (add|del) bgp max-med on-startup <5-86400> <0-4294967294>
- quagga (add|del) bgp network import-check
- quagga (add|del) bgp route-map delay-timer <0-600>
- quagga (add|del) bgp route-reflector allow-outbound-policy
- quagga (add|del) bgp router-id <ipv4>
- quagga (add|del) bgp coalesce-time <0-4294967295>
- quagga (add|del) bgp distance <1-255> <ipv4/prefixlen>
- quagga (add|del) bgp distance <1-255> <ipv4/prefixlen> WORD
- quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255>
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4/prefixlen>
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4/prefixlen> as-set
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4/prefixlen> as-set summary-only
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4/prefixlen> summary-only
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4/prefixlen> summary-only as-set
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4> <ipv4>
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4> <ipv4> as-set
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4> <ipv4> as-set summary-only
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4> <ipv4> summary-only
- quagga (add|del) bgp ipv4 [unicast|multicast] aggregate-address <ipv4> <ipv4> summary-only as-set
- quagga (add|del) bgp ipv4 [unicast|multicast] network <ipv4/prefixlen>
- quagga (add|del) bgp ipv4 [unicast|multicast] network <ipv4/prefixlen> route-map WORD
- quagga (add|del) bgp ipv4 [unicast|multicast] network <ipv4>
- quagga (add|del) bgp ipv4 [unicast|multicast] network <ipv4> prefixlen <ipv4>
- quagga (add|del) bgp ipv4 [unicast|multicast] network <ipv4> prefixlen <ipv4> route-map WORD
- quagga (add|del) bgp ipv4 [unicast|multicast] network <ipv4> route-map WORD
- quagga (add|del) bgp ipv4 unicast bgp dampening
- quagga (add|del) bgp ipv4 unicast bgp dampening <1-45>
- quagga (add|del) bgp ipv4 unicast bgp dampening <1-45> <1-20000> <1-20000> <1-255>
- quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis)
- quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295>
- quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) metric <0-4294967295> route-map WORD
- quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD
- quagga (add|del) bgp ipv4 unicast redistribute (kernel|connected|static|rip|ospf|isis) route-map WORD metric <0-4294967295>
- quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535>
- quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295>
- quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD
- quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD
- quagga (add|del) bgp ipv4 unicast redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>
- quagga (add|del) bgp ipv6 [unicast|multicast] network <ipv6/prefixlen>
- quagga (add|del) bgp ipv6 bgp aggregate-address <ipv6/prefixlen>
- quagga (add|del) bgp ipv6 bgp aggregate-address <ipv6/prefixlen> summary-only
- quagga (add|del) bgp ipv6 bgp network <ipv6/prefixlen>
- quagga (add|del) bgp ipv6 unicast aggregate-address <ipv6/prefixlen>
- quagga (add|del) bgp ipv6 unicast aggregate-address <ipv6/prefixlen> summary-only
- quagga (add|del) bgp ipv6 unicast neighbor (<ipv4>|<ipv6>|<interface>) nexthop-local unchanged
- quagga (add|del) bgp ipv6 unicast network <ipv6/prefixlen> route-map WORD
- quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis)
- quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295>
- quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) metric <0-4294967295> route-map WORD
- quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD
- quagga (add|del) bgp ipv6 unicast redistribute (kernel|connected|static|ripng|ospf6|isis) route-map WORD metric <0-4294967295>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>) interface WORD
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>) port <0-65535>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>) strict-capability-match
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) advertisement-interval <0-600>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) bfd
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) capability dynamic
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) capability extended-nexthop
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) description LINE
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) disable-connected-check
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) dont-capability-negotiate
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) ebgp-multihop
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) ebgp-multihop <1-255>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) enforce-multihop
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) local-as <1-4294967295>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) local-as <1-4294967295> no-prepend
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) local-as <1-4294967295> no-prepend replace-as
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) override-capability
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) passive
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) password LINE
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) remote-as (<1-4294967295>|external|internal)
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) shutdown
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) solo
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) timers <0-65535> <0-65535>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) timers connect <1-65535>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) ttl-security hops <1-254>
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) update-source (<ipv4>|<ipv6>|<interface>)
- quagga (add|del) bgp neighbor (<ipv4>|<ipv6>|<interface>) weight <0-65535>
- quagga (add|del) bgp neighbor WORD interface
- quagga (add|del) bgp neighbor WORD interface peer-group WORD
- quagga (add|del) bgp neighbor WORD interface v6only
- quagga (add|del) bgp neighbor WORD interface v6only peer-group WORD
- quagga (add|del) bgp neighbor WORD peer-group
- quagga (add|del) bgp network <ipv4/prefixlen> backdoor
- quagga (add|del) bgp network <ipv4> backdoor
- quagga (add|del) bgp network <ipv4> prefixlen <ipv4> backdoor
- quagga (add|del) bgp timers bgp <0-65535> <0-65535>
- quagga (add|del) bgp update-delay <0-3600>
- quagga (add|del) bgp update-delay <0-3600> <1-3600>
- quagga (add|del) bgp write-quanta <1-10000>""".splitlines()
-
-ospf_clear_ignore = [" quagga clear ip ospf interface [IFNAME]", ]
-
-ospf_debug_ignore = """ quagga debug ospf <1-65535> event
- quagga debug ospf <1-65535> ism
- quagga debug ospf <1-65535> ism (status|events|timers)
- quagga debug ospf <1-65535> lsa
- quagga debug ospf <1-65535> lsa (generate|flooding|install|refresh)
- quagga debug ospf <1-65535> nsm
- quagga debug ospf <1-65535> nsm (status|events|timers)
- quagga debug ospf <1-65535> nssa
- quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all)
- quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)
- quagga debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)
- quagga debug ospf <1-65535> zebra
- quagga debug ospf <1-65535> zebra (interface|redistribute)
- quagga debug ospf event
- quagga debug ospf ism
- quagga debug ospf ism (status|events|timers)
- quagga debug ospf lsa
- quagga debug ospf lsa (generate|flooding|install|refresh)
- quagga debug ospf nsm
- quagga debug ospf nsm (status|events|timers)
- quagga debug ospf nssa
- quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all)
- quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)
- quagga debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)
- quagga debug ospf zebra
- quagga debug ospf zebra (interface|redistribute)""".splitlines()
-
-ospf_show_ignore = """ quagga show debugging ospf
- quagga show debugging ospf <1-65535>
- quagga show ip ospf <1-65535> [json]
- quagga show ip ospf <1-65535> border-routers
- quagga show ip ospf <1-65535> database
- quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|)
- quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) <ipv4>
- quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) <ipv4> (self-originate|)
- quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) <ipv4> adv-router <ipv4>
- quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router <ipv4>
- quagga show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate)
- quagga show ip ospf <1-65535> interface [INTERFACE] [json]
- quagga show ip ospf <1-65535> neighbor <ipv4> [json]
- quagga show ip ospf <1-65535> neighbor IFNAME [json]
- quagga show ip ospf <1-65535> neighbor IFNAME detail [json]
- quagga show ip ospf <1-65535> neighbor [json]
- quagga show ip ospf <1-65535> neighbor all [json]
- quagga show ip ospf <1-65535> neighbor detail [json]
- quagga show ip ospf <1-65535> neighbor detail all [json]
- quagga show ip ospf <1-65535> route
- quagga show ip ospf [json]
- quagga show ip ospf border-routers
- quagga show ip ospf database
- quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|)
- quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) <ipv4>
- quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) <ipv4> (self-originate|)
- quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) <ipv4> adv-router <ipv4>
- quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) adv-router <ipv4>
- quagga show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate)
- quagga show ip ospf interface [INTERFACE] [json]
- quagga show ip ospf neighbor <ipv4> [json]
- quagga show ip ospf neighbor IFNAME [json]
- quagga show ip ospf neighbor IFNAME detail [json]
- quagga show ip ospf neighbor [json]
- quagga show ip ospf neighbor all [json]
- quagga show ip ospf neighbor detail [json]
- quagga show ip ospf neighbor detail all [json]
- quagga show ip ospf route
- quagga show mpls-te interface [INTERFACE]
- quagga show mpls-te router""".splitlines()
-
-ospf_config_ignore = """ quagga (add|del) <interface> ip ospf <1-65535> area (<ipv4>|<0-4294967295>)
- quagga (add|del) <interface> ip ospf area (<ipv4>|<0-4294967295>)
- quagga (add|del) <interface> ip ospf authentication
- quagga (add|del) <interface> ip ospf authentication (null|message-digest)
- quagga (add|del) <interface> ip ospf authentication (null|message-digest) <ipv4>
- quagga (add|del) <interface> ip ospf authentication <ipv4>
- quagga (add|del) <interface> ip ospf authentication-key AUTH_KEY
- quagga (add|del) <interface> ip ospf authentication-key AUTH_KEY <ipv4>
- quagga (add|del) <interface> ip ospf bfd
- quagga (add|del) <interface> ip ospf bfd <2-255> BFD_CMD_MIN_RX_RANGE <50-60000>
- quagga (add|del) <interface> ip ospf cost <1-65535>
- quagga (add|del) <interface> ip ospf cost <1-65535> <ipv4>
- quagga (add|del) <interface> ip ospf dead-interval <1-65535>
- quagga (add|del) <interface> ip ospf dead-interval <1-65535> <ipv4>
- quagga (add|del) <interface> ip ospf dead-interval minimal hello-multiplier <1-10>
- quagga (add|del) <interface> ip ospf dead-interval minimal hello-multiplier <1-10> <ipv4>
- quagga (add|del) <interface> ip ospf hello-interval <1-65535>
- quagga (add|del) <interface> ip ospf hello-interval <1-65535> <ipv4>
- quagga (add|del) <interface> ip ospf message-digest-key <1-255> md5 KEY
- quagga (add|del) <interface> ip ospf message-digest-key <1-255> md5 KEY <ipv4>
- quagga (add|del) <interface> ip ospf mtu-ignore
- quagga (add|del) <interface> ip ospf mtu-ignore <ipv4>
- quagga (add|del) <interface> ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)
- quagga (add|del) <interface> ip ospf priority <0-255>
- quagga (add|del) <interface> ip ospf priority <0-255> <ipv4>
- quagga (add|del) <interface> ip ospf retransmit-interval <3-65535>
- quagga (add|del) <interface> ip ospf retransmit-interval <3-65535> <ipv4>
- quagga (add|del) <interface> ip ospf transmit-delay <1-65535>
- quagga (add|del) <interface> ip ospf transmit-delay <1-65535> <ipv4>
- quagga (add|del) <interface> mpls-te link max-bw BANDWIDTH
- quagga (add|del) <interface> mpls-te link max-rsv-bw BANDWIDTH
- quagga (add|del) <interface> mpls-te link metric <0-4294967295>
- quagga (add|del) <interface> mpls-te link rsc-clsclr BITPATTERN
- quagga (add|del) <interface> mpls-te link unrsv-bw <0-7> BANDWIDTH
- quagga (add|del) ospf abr-type (cisco|ibm|shortcut|standard)
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) authentication
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) authentication message-digest
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) default-cost <0-16777215>
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) export-list NAME
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) filter-list prefix WORD (in|out)
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) import-list NAME
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) nssa
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) nssa no-summary
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) range <ipv4/prefixlen>
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) range <ipv4/prefixlen> advertise
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) range <ipv4/prefixlen> advertise cost <0-16777215>
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) range <ipv4/prefixlen> cost <0-16777215>
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) range <ipv4/prefixlen> not-advertise
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) range <ipv4/prefixlen> substitute <ipv4/prefixlen>
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) shortcut (default|enable|disable)
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) stub
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) stub no-summary
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) virtual-link <ipv4>
- quagga (add|del) ospf area (<ipv4>|<0-4294967295>) virtual-link <ipv4>
- quagga (add|del) ospf auto-cost reference-bandwidth <1-4294967>
- quagga (add|del) ospf capability opaque
- quagga (add|del) ospf compatible rfc1583
- quagga (add|del) ospf default-information originate
- quagga (add|del) ospf default-metric <0-16777214>
- quagga (add|del) ospf distance <1-255>
- quagga (add|del) ospf distance <1-255> <ipv4/prefixlen>
- quagga (add|del) ospf distance <1-255> <ipv4/prefixlen> WORD
- quagga (add|del) ospf distance ospf
- quagga (add|del) ospf distribute-list WORD out QUAGGA_REDIST_STR_OSPFD
- quagga (add|del) ospf log-adjacency-changes
- quagga (add|del) ospf log-adjacency-changes detail
- quagga (add|del) ospf max-metric router-lsa administrative
- quagga (add|del) ospf max-metric router-lsa on-shutdown <5-100>
- quagga (add|del) ospf max-metric router-lsa on-startup <5-86400>
- quagga (add|del) ospf mpls-te
- quagga (add|del) ospf mpls-te on
- quagga (add|del) ospf mpls-te router-address <ipv4>
- quagga (add|del) ospf neighbor <ipv4>
- quagga (add|del) ospf neighbor <ipv4> poll-interval <1-65535>
- quagga (add|del) ospf neighbor <ipv4> poll-interval <1-65535> priority <0-255>
- quagga (add|del) ospf neighbor <ipv4> priority <0-255>
- quagga (add|del) ospf neighbor <ipv4> priority <0-255> poll-interval <1-65535>
- quagga (add|del) ospf network <ipv4/prefixlen> area (<ipv4>|<0-4294967295>)
- quagga (add|del) ospf opaque-lsa
- quagga (add|del) ospf passive-interface IFNAME
- quagga (add|del) ospf passive-interface IFNAME <ipv4>
- quagga (add|del) ospf passive-interface default
- quagga (add|del) ospf redistribute (ospf|table) <1-65535>
- quagga (add|del) ospf redistribute QUAGGA_REDIST_STR_OSPFD
- quagga (add|del) ospf rfc1583compatibility
- quagga (add|del) ospf router-id <ipv4>
- quagga (add|del) ospf timers lsa arrival <0-1000>
- quagga (add|del) ospf timers lsa min-arrival <0-600000>
- quagga (add|del) ospf timers throttle lsa all <0-5000>
- quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000>
- quagga (add|del) ospf write-multiplier <1-100>
- quagga (add|del) ospf write-multiplier <1-100>""".splitlines()
-
-def replace_constants(line):
- line = line.replace('NO_NEIGHBOR_CMD2', 'no neighbor (A.B.C.D|X:X::X:X|WORD) ')
- line = line.replace('NEIGHBOR_CMD2', 'neighbor (A.B.C.D|X:X::X:X|WORD) ')
- line = line.replace('NO_NEIGHBOR_CMD', 'no neighbor (A.B.C.D|X:X::X:X) ')
- line = line.replace('NEIGHBOR_CMD', 'neighbor (A.B.C.D|X:X::X:X) ')
- line = line.replace('CMD_AS_RANGE', '<1-4294967295>')
- line = line.replace('LISTEN_RANGE_CMD', 'bgp listen range (A.B.C.D/M|X:X::X:X/M) ')
- line = line.replace('DYNAMIC_NEIGHBOR_LIMIT_RANGE', '<1-5000>')
- line = line.replace('QUAGGA_IP_REDIST_STR_BGPD', '(kernel|connected|static|rip|ospf|isis)')
- line = line.replace('QUAGGA_IP6_REDIST_STR_BGPD', '(kernel|connected|static|ripng|ospf6|isis)')
- line = line.replace('QUAGGA_IP6_REDIST_STR_ZEBRA', '(kernel|connected|static|ripng|ospf6|isis|bgp)')
- line = line.replace('QUAGGA_IP_REDIST_STR_ZEBRA', '(kernel|connected|static|rip|ospf|isis|bgp)')
- line = line.replace('OSPF_LSA_TYPES_CMD_STR', 'asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as')
- line = line.replace('CMD_RANGE_STR(1, MULTIPATH_NUM)', '<1-255>')
- line = line.replace('CMD_RANGE_STR(1, MAXTTL)', '<1-255>')
- line = line.replace('BFD_CMD_DETECT_MULT_RANGE', '<2-255>')
- line = line.replace('BFD_CMD_MIN_TX_RANGE', '<50-60000>')
- line = line.replace('BGP_UPDATE_SOURCE_REQ_STR', '(A.B.C.D|X:X::X:X|WORD)')
- line = line.replace('BGP_UPDATE_SOURCE_OPT_STR', '{A.B.C.D|X:X::X:X|WORD}')
- line = line.replace('.LINE', 'LINE')
- line = line.replace('.AA:NN', 'AA:NN')
- # line = line.replace('', '')
- return line
-
-
-ignore = {}
-ignore['bgpd'] = []
-ignore['bgpd'].append('address-family ipv4')
-ignore['bgpd'].append('address-family ipv4 (unicast|multicast)')
-ignore['bgpd'].append('address-family ipv6')
-ignore['bgpd'].append('address-family ipv6 (unicast|multicast)')
-ignore['bgpd'].append('address-family vpnv4')
-ignore['bgpd'].append('address-family vpnv4 unicast')
-ignore['bgpd'].append('exit-address-family')
-
-ignore['ospfd'] = []
-
-
-class Command(object):
-
- def __init__(self, defun, text, line_number):
- self.defun = defun
- self.text = text
- self.line_number = line_number
- self.context = []
- self.docstring = None
-
- def __str__(self):
- return "%s - %s" % (self.context, self.text)
-
- def set_docstring(self):
- ds = self.text
-
- if self.text in ignore['bgpd']:
- return None
-
- # For these two WORD means an interface name
- ds = ds.replace('A.B.C.D|X:X::X:X|WORD', '<ipv4>|<ipv6>|<interface>')
- ds = ds.replace('A.B.C.D|WORD', '<ipv4>|<interface>')
-
- ds = ds.replace('A.B.C.D/M', '<ipv4/prefixlen>')
- ds = ds.replace('A.B.C.D', '<ipv4>')
- ds = ds.replace('X:X::X:X/M', '<ipv6/prefixlen>')
- ds = ds.replace('X:X::X:X', '<ipv6>')
- ds = ds.replace('{json}', '[json]')
- ds = ds.replace('{', '[')
- ds = ds.replace('}', ']')
- ds = ds.replace(' PATH ', ' <text> ')
-
- afis = []
- safis = []
-
- if 'BGP_IPV4_NODE' in self.context:
- afis.append('ipv4')
- safis.append('unicast')
-
- if 'BGP_IPV4M_NODE' in self.context:
- afis.append('ipv4')
- safis.append('multicast')
-
- if 'BGP_IPV6_NODE' in self.context:
- afis.append('ipv6')
- safis.append('unicast')
-
- if 'BGP_IPV6M_NODE' in self.context:
- afis.append('ipv6')
- safis.append('multicast')
-
- afis = list(set(afis))
- safis = list(set(safis))
-
- # clear, debug, show, etc
- if 'ENABLE_NODE' in self.context:
- pass
-
- # config command so need to add (add|del) and maybe afi/safi
- else:
- if afis:
- if len(afis) > 1:
- afi_string = "[%s]" % '|'.join(afis)
- else:
- afi_string = afis[0]
-
- if len(safis) > 1:
- safi_string = "[%s]" % '|'.join(safis)
- else:
- safi_string = safis[0]
-
- ds = "(add|del) bgp %s %s " % (afi_string, safi_string) + ds
-
- elif 'BGP_NODE' in self.context:
- if ds.startswith('bgp'):
- ds = "(add|del) " + ds
- else:
- ds = "(add|del) bgp " + ds
-
- elif 'INTERFACE_NODE' in self.context:
- ds = "(add|del) <interface> " + ds
-
- elif 'OSPF_NODE' in self.context:
- if ds.startswith('ospf'):
- ds = "(add|del) " + ds
- else:
- ds = "(add|del) ospf " + ds
-
- # Ignore the route-map commands, ip community-list, etc for now
- else:
- ds = None
-
- if ds:
- ds = ds.rstrip()
- self.docstring = ' quagga ' + ds
-
-
-if __name__ == '__main__':
-
- parser = argparse.ArgumentParser(description='Parse the quagga parser')
- parser.add_argument('directory', help='quagga directory')
- parser.add_argument('daemon', help='bgpd, ospfd, etc')
- parser.add_argument('--print-quagga', action='store_true', help='print the raw quagga commands')
- parser.add_argument('--print-docstring', action='store_true', help='print a docstring for network-docopt')
- parser.add_argument('--print-context', action='store_true', help='print quagga commands with their context')
- args = parser.parse_args()
-
- logging.basicConfig(level=logging.INFO,
- format='%(asctime)s %(levelname)7s: %(message)s')
- log = logging.getLogger(__name__)
-
- # Color the errors and warnings in red
- logging.addLevelName(logging.ERROR, "\033[91m %s\033[0m" % logging.getLevelName(logging.ERROR))
- logging.addLevelName(logging.WARNING, "\033[91m%s\033[0m" % logging.getLevelName(logging.WARNING))
-
- bgpd = os.path.join(args.directory, 'bgpd')
- isisd = os.path.join(args.directory, 'isisd')
- ospfd = os.path.join(args.directory, 'ospfd')
- ospf6d = os.path.join(args.directory, 'ospf6d')
- ripd = os.path.join(args.directory, 'ripd')
- ripngd = os.path.join(args.directory, 'ripngd')
- zebra = os.path.join(args.directory, 'zebra')
- parser_files = []
-
- for (directory, foo, files) in sorted(os.walk(args.directory)):
-
- # We do not care about crunching files in these directories
- if (directory.endswith('vtysh') or
- directory.endswith('quagga-0.99.23.1/') or
- directory.endswith('lib') or
- directory.endswith('isisd') or
- directory.endswith('ripd') or
- directory.endswith('ripngd') or
- directory.endswith('m4') or
- directory.endswith('tests')):
- continue
-
- if args.daemon not in directory:
- continue
-
- for x in sorted(files):
- if x.endswith('.c'):
- filename = os.path.join(directory, x)
- parser_files.append(filename)
-
- commands = {}
- defun_to_context = {}
-
- for filename in parser_files:
-
- with open(filename, 'r') as fh:
- state = 'LIMBO'
- line_number = 1
-
- for line in fh.readlines():
-
- if state == 'LIMBO':
- if (line.startswith('DEFUN ') or line.startswith('ALIAS ')):
- state = 'DEFUN_LINE_1'
-
- elif 'install_element' in line:
- # install_element (BGP_NODE, &neighbor_bfd_cmd);
- re_line = re.search('install_element\s*\(\s*(\S+)\s*, \&(\S+)\)', line)
-
- if re_line:
- context = re_line.group(1)
- defun = re_line.group(2)
-
- if defun not in defun_to_context:
- defun_to_context[defun] = []
- defun_to_context[defun].append(context)
- else:
- log.warning("regex failed on '%s'" % line.strip())
-
- elif state == 'DEFUN_LINE_1':
- state = 'DEFUN_LINE_2'
- # remove spaces and trailing comma
- defun = line.strip()[0:-1]
-
- elif state == 'DEFUN_LINE_2':
- if 'ifdef HAVE_IPV6' in line:
- pass
- else:
- state = 'LIMBO'
-
- # remove the leading and trailing spaces
- # remove the leading and trailing "
- # remove the trailing ,
- line = line.strip()
- line = replace_constants(line)
-
- if line.endswith(','):
- line = line.rstrip().lstrip()[:-1]
-
- if line.startswith('"'):
- line = line.rstrip().lstrip()[1:]
-
- if line.endswith('"'):
- line = line.rstrip().lstrip()[:-1]
-
- line = line.replace(' " ', ' ')
- line = line.replace(' "', ' ')
- line = line.replace('" ', ' ')
- line = line.replace('( ', '(')
- line = line.replace(' )', ')')
-
- line = line.replace('| ', '|')
- line = line.replace(' |', '|')
-
- # compress multiple whitespaces
- while ' ' in line:
- line = line.replace(' ', ' ')
-
- commands[line] = Command(defun, line, line_number)
- defun = None
- line_number += 1
-
- # Fill in the context for each Command based on its defun
- for cmd in commands.itervalues():
- cmd.context = defun_to_context.get(cmd.defun)
- if cmd.context is None:
- log.error("%s: could not find defun for %s" % (cmd, cmd.defun))
- continue
- cmd.set_docstring()
-
- normal = []
- expert = []
-
- if args.print_docstring:
- if args.daemon == 'bgpd':
- normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] summary [json]')
- normal.append(' quagga show bgp [ipv4|ipv6] [unicast|multicast] [<ip>|<ip/prefixlen>] [bestpath|multipath] [json]')
- normal.append(' quagga show bgp neighbor [<ip>|<interface>]')
- normal.append(' quagga clear bgp (<ip>|<interface>|*)')
- normal.append(' quagga clear bgp (<ip>|<interface>|*) soft [in|out]')
- normal.append(' quagga clear bgp prefix <ip/prefixlen>')
- normal.append(' quagga (add|del) debug bgp bestpath <ip/prefixlen>')
- normal.append(' quagga (add|del) debug bgp keepalives (<ip><interface>)')
- normal.append(' quagga (add|del) debug bgp neighbor-events (<ip>|<interface>)')
- expert.append(' quagga (add|del) debug bgp nht')
- expert.append(' quagga (add|del) debug bgp update-groups')
- normal.append(' quagga (add|del) debug bgp updates prefix <ip/prefixlen>')
- normal.append(' quagga (add|del) debug bgp zebra prefix <ip/prefixlen>')
-
- bgp_bgp = ['always-compare-med',
- 'bestpath',
- 'client-to-client reflection',
- 'cluster-id',
- 'confederation peers',
- 'default ipv4-unicast',
- 'default local-preference',
- 'default show-hostname',
- 'default subgroup-pkt-queue-max',
- 'deterministic-med',
- 'disable-ebgp-connected-route-check',
- 'enforce-first-as',
- 'fast-external-failover',
- 'graceful-restart',
- 'listen',
- 'log-neighbor-changes',
- 'max-med',
- 'network import-check',
- 'route-map delay-timer',
- 'route-reflector allow-outbound-policy',
- 'router-id']
-
- # ======
- # global
- # ======
- normal.append(' quagga (add|del) bgp always-compare-med')
- expert.append(' quagga (add|del) bgp bestpath as-path (confed|ignore)')
- normal.append(' quagga (add|del) bgp bestpath as-path multipath-relax [as-set|no-as-set]')
- expert.append(' quagga (add|del) bgp bestpath med (confed|missing-as-worst)')
- expert.append(' quagga (add|del) bgp client-to-client reflection')
- expert.append(' quagga (add|del) bgp cluster-id (<ipv4>|<1-4294967295>)')
- expert.append(' quagga (add|del) bgp confederation peers <1-4294967295>')
- expert.append(' quagga (add|del) bgp default ipv4-unicast')
- expert.append(' quagga (add|del) bgp default local-preference <0-4294967295>')
- expert.append(' quagga (add|del) bgp default show-hostname')
- expert.append(' quagga (add|del) bgp default subgroup-pkt-queue-max <20-100>')
- expert.append(' quagga (add|del) bgp deterministic-med')
- expert.append(' quagga (add|del) bgp disable-ebgp-connected-route-check')
- expert.append(' quagga (add|del) bgp enforce-first-as')
- expert.append(' quagga (add|del) bgp fast-external-failover')
- expert.append(' quagga (add|del) bgp graceful-restart')
- expert.append(' quagga (add|del) bgp listen limit <1-5000>')
- expert.append(' quagga (add|del) bgp listen range (<ipv4/prefixlen>|<ipv6/prefixlen>) peer-group <text>')
- expert.append(' quagga (add|del) bgp log-neighbor-changes')
- expert.append(' quagga (add|del) bgp max-med administrative <0-4294967294>')
- expert.append(' quagga (add|del) bgp max-med on-startup <5-86400> [<0-4294967294>]')
- expert.append(' quagga (add|del) bgp network import-check')
- expert.append(' quagga (add|del) bgp route-map delay-timer <0-600>')
- expert.append(' quagga (add|del) bgp route-reflector allow-outbound-policy')
- normal.append(' quagga (add|del) bgp router-id <ipv4>')
- expert.append(' quagga (add|del) bgp coalesce-time <0-4294967295>')
- expert.append(' quagga (add|del) bgp distance <1-255> <ipv4/prefixlen> <text>')
- expert.append(' quagga (add|del) bgp distance bgp <1-255> <1-255> <1-255>')
- expert.append(' quagga (add|del) bgp timers bgp <0-65535> <0-65535>')
- expert.append(' quagga (add|del) bgp update-delay <0-3600> [<1-3600>]')
- expert.append(' quagga (add|del) bgp write-quanta <1-10000>')
-
- # ====================
- # peer global afi/safi
- # ====================
- normal.append(' quagga (add|del) bgp neighbor <interface> interface')
- normal.append(' quagga (add|del) bgp neighbor <interface> interface peer-group <text>')
- expert.append(' quagga (add|del) bgp neighbor <interface> interface v6only')
- expert.append(' quagga (add|del) bgp neighbor <interface> interface v6only peer-group <text>')
- normal.append(' quagga (add|del) bgp neighbor <interface> peer-group')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) advertisement-interval <0-600>')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) bfd')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) capability dynamic')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) capability extended-nexthop')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) description <text>')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) disable-connected-check')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) dont-capability-negotiate')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) ebgp-multihop [<1-255>]')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) enforce-multihop')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) local-as <1-4294967295> [no-prepend] [replace-as]')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) override-capability')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) passive')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) password <text>')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) port <0-65535>')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) remote-as (<1-4294967295>|external|internal)')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) shutdown')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) solo')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) strict-capability-match')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) timers <0-65535> <0-65535>')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) timers connect <1-65535>')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) ttl-security hops <1-254>')
- normal.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) update-source (<ipv4>|<ipv6>|<interface>)')
- expert.append(' quagga (add|del) bgp neighbor (<ip>|<interface>) weight <0-65535>')
-
- # =================
- # peer per afi/safi
- # =================
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) addpath-tx-all-paths')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) addpath-tx-bestpath-per-AS')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) allowas-in [<1-10>]')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) as-override')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) attribute-unchanged [as-path] [next-hop] [med]')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) capability orf prefix-list (both|send|receive)')
- normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) default-originate [route-map <text>]')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) distribute-list (<1-199>|<1300-2699>|<text>) (in|out)')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) filter-list <text> (in|out)')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) maximum-prefix <1-4294967295>')
- normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) next-hop-self [force]')
- normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) peer-group <text>')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) prefix-list <text> (in|out)')
- normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) remove-private-AS [all] [replace-AS]')
- normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) route-map <text> (in|out)')
- normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) route-reflector-client')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) route-server-client')
- normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) send-community [both|extended|standard]')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) soft-reconfiguration inbound')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] neighbor (<ip>|<interface>) unsuppress-map <text>')
- expert.append(' quagga (add|del) bgp ipv6 unicast neighbor (<ip>|<interface>) nexthop-local unchanged')
-
- # ============
- # per afi/safi
- # ============
- normal.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] maximum-paths [ibgp] <1-255> [equal-cluster-length]')
- normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] aggregate-address <ipv4/prefixlen> [as-set] [summary-only]')
- normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (<ipv4/prefixlen>|<ipv6/prefixlen>)')
- expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] network (<ipv4/prefixlen>|<ipv6/prefixlen>) route-map <text>')
- expert.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] bgp dampening <1-45> <1-20000> <1-20000> <1-255>')
- normal.append(' quagga (add|del) bgp (ipv4|ipv6) [unicast|multicast] redistribute (kernel|connected|static|rip|ospf|isis) [metric <0-4294967295>] [route-map <text>]')
- expert.append(' quagga (add|del) bgp [ipv4|ipv6] [unicast|multicast] table-map <text>')
-
- if args.daemon == 'ospfd':
- normal.append(' quagga clear ip ospf interface [<interface>]')
- normal.append(' quagga (add|del) debug ospf [<1-65535>] ism [status|events|timers]')
- normal.append(' quagga (add|del) debug ospf [<1-65535>] lsa [generate|flooding|install|refresh]')
- normal.append(' quagga (add|del) debug ospf [<1-65535>] nsm [status|events|timers]')
- expert.append(' quagga (add|del) debug ospf [<1-65535>] nssa')
- normal.append(' quagga (add|del) debug ospf [<1-65535>] packet [hello|dd|ls-request|ls-update|ls-ack|all] [send|recv|detail]')
- normal.append(' quagga (add|del) debug ospf [<1-65535>] zebra [interface|redistribute]')
- normal.append(' quagga show ip ospf [<1-65535>]')
- expert.append(' quagga show ip ospf [<1-65535>] border-routers')
- expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) [self-originate]')
- expert.append(' quagga show ip ospf [<1-65535>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate) adv-router <ipv4>')
- normal.append(' quagga show ip ospf [<1-65535>] interface [<interface>] [json]')
- normal.append(' quagga show ip ospf [<1-65535>] neighbor (all|<interface>|<ipv4>) [detail] [json]')
- normal.append(' quagga show ip ospf [<1-65535>] route')
-
- normal.append(' quagga (add|del) <interface> ip ospf [<1-65535>] area (<ipv4>|<0-4294967295>)')
- normal.append(' quagga (add|del) <interface> ip ospf dead-interval <1-65535>')
- normal.append(' quagga (add|del) <interface> ip ospf hello-interval <1-65535>')
- normal.append(' quagga (add|del) <interface> ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)')
- normal.append(' quagga (add|del) ospf network <ipv4/prefixlen> area (<ipv4>|<0-4294967295>)')
- normal.append(' quagga (add|del) ospf passive-interface IFNAME')
- normal.append(' quagga (add|del) ospf router-id <ipv4>')
- normal.append(' quagga (add|del) ospf timers throttle spf <0-600000> <0-600000> <0-600000>')
-
-
-
- ignore_list = bgp_clear_ignore + bgp_debug_ignore + bgp_show_ignore + bgp_config_ignore
- ignore_list += ospf_clear_ignore + ospf_debug_ignore + ospf_show_ignore + ospf_config_ignore
-
- for cmd in commands.itervalues():
- if not cmd.text.startswith('no ') and cmd.context:
- if cmd.docstring:
- if cmd.docstring not in ignore_list:
- normal.append(cmd.docstring)
-
- elif args.print_quagga:
- for cmd in commands.itervalues():
- if not cmd.text.startswith('no ') and cmd.context:
- normal.append(cmd.text)
-
- elif args.print_context:
- for cmd in commands.itervalues():
- if not cmd.text.startswith('no ') and cmd.context:
- normal.append("%s - %s" % (cmd.context, cmd.text))
- else:
- raise Exception("No print option specified")
-
- normal = sorted(normal)
- print '\n'.join(map(str, normal))