original_docstring: Define the grammar for the BGP output.
      
          See also:
          http://stackoverflow.com/questions/30997205/pyparsing-parsing-ciscos-show-ip-bgp
          
docstring: Define the grammar for the BGP output.
docstring_tokens: Define the grammar for the BGP output .
code: def define_grammar(self):
          """Define the grammar for the BGP output.
      
          See also:
          http://stackoverflow.com/questions/30997205/pyparsing-parsing-ciscos-show-ip-bgp
          """
          ip4Field = Word(nums, max=3)
          ip4Addr = Combine(ip4Field + "." + ip4Field + "." + ip4Field + "." + ip4Field)
          hexint = Word(hexnums,exact=2)
          ip6Field = Or([hexint, Literal(":")])
          ip6Addr = Combine(OneOrMore(ip6Field))
          ipAddr = Or([ip4Addr, ip6Addr])
          ipNet = Optional(Combine(ipAddr("pfx") + Literal("/") + Word(nums,max=2)("pfxlen")))
          status_code = Combine(Optional(oneOf("s d h * r")) + Optional(Literal(">")) + Optional(Literal("i")))
          next_hop = ipAddr
          integer = Word(nums).setParseAction(lambda t: int(t[0])).setName("integer")
          metric = Optional(self._tableValue(integer, 41, 46))
          locpref = Optional(self._tableValue(integer, 48, 53))
          weight = Optional(self._tableValue(integer, 55, 60))
          path = Group(OneOrMore(Word(nums)))
          origin = oneOf("i e ?")
  
          return status_code("status") + ipNet + ipAddr("nexthop") + \
              metric("metric") + locpref("locpref") + weight("weight") + \
              path("path") + origin("route_orig")
code_tokens: def define_grammar ( self ) : ip4Field = Word ( nums , max = 3 ) ip4Addr = Combine ( ip4Field + "." + ip4Field + "." + ip4Field + "." + ip4Field ) hexint = Word ( hexnums , exact = 2 ) ip6Field = Or ( [ hexint , Literal ( ":" ) ] ) ip6Addr = Combine ( OneOrMore ( ip6Field ) ) ipAddr = Or ( [ ip4Addr , ip6Addr ] ) ipNet = Optional ( Combine ( ipAddr ( "pfx" ) + Literal ( "/" ) + Word ( nums , max = 2 ) ( "pfxlen" ) ) ) status_code = Combine ( Optional ( oneOf ( "s d h * r" ) ) + Optional ( Literal ( ">" ) ) + Optional ( Literal ( "i" ) ) ) next_hop = ipAddr integer = Word ( nums ) . setParseAction ( lambda t : int ( t [ 0 ] ) ) . setName ( "integer" ) metric = Optional ( self . _tableValue ( integer , 41 , 46 ) ) locpref = Optional ( self . _tableValue ( integer , 48 , 53 ) ) weight = Optional ( self . _tableValue ( integer , 55 , 60 ) ) path = Group ( OneOrMore ( Word ( nums ) ) ) origin = oneOf ( "i e ?" ) return status_code ( "status" ) + ipNet + ipAddr ( "nexthop" ) + metric ( "metric" ) + locpref ( "locpref" ) + weight ( "weight" ) + path ( "path" ) + origin ( "route_orig" )
short_docstring: Define the grammar for the BGP output.
short_docstring_tokens: Define the grammar for the BGP output .
comment: """Define the grammar for the BGP output.
      
          See also:
          http://stackoverflow.com/questions/30997205/pyparsing-parsing-ciscos-show-ip-bgp
          """