sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
201 stars 727 forks source link

TextFSM Template issue for show bgp ipv6/ipv4 #3097

Open gollarharsha opened 3 years ago

gollarharsha commented 3 years ago

Description:

Some of the fields like LOCAL PREF/ METRIC are not parsed properly.

image

Here is the partial output from the parser/template. As you can see, weight and local preference are empty {u'router_id': '193.1.1.1', u'origin': '', u'network': '101.1.1.0/24', u'weight': '0', u'status_code': '*>', u'metric': '', u'as_path': '200 0 65001 i', u'next_hop': '11.1.1.2', u'version': '4', u'vrf_id': '0', u'local_pref': '', u'internal': ''}

This example uses show_ip_bgp.tmpl

gollarharsha commented 3 years ago

Example test case: Link for template: https://github.com/Azure/sonic-mgmt/blob/master/spytest/templates/show_ip_bgp.tmpl Test script: https://github.com/Azure/sonic-mgmt/blob/master/spytest/tests/routing/BGP/test_bgp.py test_redistribute_connected_ipv6

2021-02-14 01:46:08,999 T0000: INFO  [D2-R2] Hello, this is FRRouting (version 7.2.1-sonic).
2021-02-14 01:46:08,999 T0000: INFO  [D2-R2] Copyright 1996-2005 Kunihiro Ishiguro, et al.
2021-02-14 01:46:09,000 T0000: INFO  [D2-R2]
2021-02-14 01:46:09,000 T0000: INFO  [D2-R2] sonic#
2021-02-14 01:46:09,207 T0000: INFO  [D2-R2] FCMD: show bgp ipv6
2021-02-14 01:46:09,259 T0000: INFO  [D2-R2] BGP table version is 17, local router ID is 193.1.1.1, vrf id 0
2021-02-14 01:46:09,259 T0000: INFO  [D2-R2] Default local pref 100, local AS 650002
2021-02-14 01:46:09,260 T0000: INFO  [D2-R2] Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
2021-02-14 01:46:09,260 T0000: INFO  [D2-R2]                i internal, r RIB-failure, S Stale, R Removed
2021-02-14 01:46:09,260 T0000: INFO  [D2-R2] Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
2021-02-14 01:46:09,261 T0000: INFO  [D2-R2] Origin codes:  i - IGP, e - EGP, ? - incomplete
2021-02-14 01:46:09,261 T0000: INFO  [D2-R2]
2021-02-14 01:46:09,261 T0000: INFO  [D2-R2]    Network          Next Hop            Metric LocPrf Weight Path
2021-02-14 01:46:09,261 T0000: INFO  [D2-R2] *> 101:1::/64       67fe:1:1::2              0    100      0 (65001) i
2021-02-14 01:46:09,262 T0000: INFO  [D2-R2] *> 102:1::/64       67fe:1:1::2              0    100      0 (65001) i
2021-02-14 01:46:09,262 T0000: INFO  [D2-R2] *> 201:1::/64       ::                       0         32768 i
2021-02-14 01:46:09,262 T0000: INFO  [D2-R2] *> 202:1::/64       ::                       0         32768 i
2021-02-14 01:46:09,263 T0000: INFO  [D2-R2] *> 1093:2:1::/64    67fe:1:1::2              0    100      0 (65001) ?
2021-02-14 01:46:09,263 T0000: INFO  [D2-R2] *> 6002::2/128      67fe:1:1::2              0    100      0 (65001) ?
2021-02-14 01:46:09,263 T0000: INFO  [D2-R2] *> 67fe:1:1::/64    67fe:1:1::2              0    100      0 (65001) ?
2021-02-14 01:46:09,264 T0000: INFO  [D2-R2]
2021-02-14 01:46:09,264 T0000: INFO  [D2-R2] Displayed  7 routes and 7 total paths
2021-02-14 01:46:09,264 T0000: INFO  [D2-R2] sonic#
2021-02-14 01:46:09,304 T0000: INFO  List of connected network on dut1
2021-02-14 01:46:09,304 T0000: INFO  ['1093:2:1::/64', '6002::2/128', '67fe:1:1::/64']
2021-02-14 01:46:09,304 T0000: INFO  List of network redistributed to dut2 from dut1
2021-02-14 01:46:09,304 T0000: INFO  []
yxieca commented 3 years ago

@ramakristipati please help.