Skip to content

[show] Fix show ip bgp sum#1194

Merged
lolyu merged 1 commit intosonic-net:masterfrom
lolyu:fix_show_ip_bgp_sum
Nov 9, 2020
Merged

[show] Fix show ip bgp sum#1194
lolyu merged 1 commit intosonic-net:masterfrom
lolyu:fix_show_ip_bgp_sum

Conversation

@lolyu
Copy link
Contributor

@lolyu lolyu commented Oct 27, 2020

Function is_ipv6_address and is_ipv4_address use ipaddress as
function argument, which override the module in global namespace.

Fix sonic-net/sonic-buildimage#5440

Signed-off-by: Longxiang Lyu lolv@microsoft.com

- What I did

- How I did it

- How to verify it

- Previous command output (if the output of a command-line utility has changed)

$ show ip bgp sum
Traceback (most recent call last):
  File "/usr/bin/show", line 12, in <module>
    sys.exit(cli())
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/show/bgp_frr_v4.py", line 26, in summary
    bgp_summary = bgp_util.get_bgp_summary_from_all_bgp_instances(constants.IPV4,  namespace,display)
  File "/usr/lib/python2.7/dist-packages/utilities_common/bgp_util.py", line 194, in get_bgp_summary_from_all_bgp_instances
    process_bgp_summary_json(bgp_summary, cmd_output_json[key], device)
  File "/usr/lib/python2.7/dist-packages/utilities_common/bgp_util.py", line 296, in process_bgp_summary_json
    peer_ip, static_neighbors, dynamic_neighbors)
  File "/usr/lib/python2.7/dist-packages/utilities_common/bgp_util.py", line 88, in get_bgp_neighbor_ip_to_name
    elif is_ipv4_address(unicode(ip)):
  File "/usr/lib/python2.7/dist-packages/utilities_common/bgp_util.py", line 23, in is_ipv4_address
    except ipaddress.AddressValueError as err:
AttributeError: 'unicode' object has no attribute 'AddressValueError'

- New command output (if the output of a command-line utility has changed)

$ show ip bgp sum

IPv4 Unicast Summary:
BGP router identifier 10.1.0.32, local AS number 64601 vrf-id 0
BGP table version 9
RIB entries 15, using 2760 bytes of memory
Peers 7, using 146440 KiB of memory
Peer groups 4, using 256 bytes of memory


Neighbhor      V     AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ  Up/Down      State/PfxRcd  NeighborName
-----------  ---  -----  ---------  ---------  --------  -----  ------  ---------  --------------  --------------
10.0.0.1       4  64802        195        204         0      0       0  03:10:47                1  ARISTA01T1
10.0.0.5       4  64802        195        204         0      0       0  03:10:47                1  ARISTA02T1
10.0.0.9       4  64802        195        204         0      0       0  03:10:47                1  ARISTA03T1
10.0.0.13      4  64802        195        201         0      0       0  03:10:47                1  ARISTA04T1
10.255.0.1     4  64523         23         25         0      0       0  00:18:03                1  BGPSLBPassive
10.255.0.2     4  64523         22         24         0      0       0  00:17:57                1  BGPSLBPassive
192.168.0.2    4  64523        194        196         0      0       0  03:09:50                1  BGPVac

Total number of neighbors 7

@lolyu
Copy link
Contributor Author

lolyu commented Oct 27, 2020

Function `is_ipv6_address` and `is_ipv4_address` use `ipaddress` as
function argument, which override the module in global namespace.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
@lolyu lolyu force-pushed the fix_show_ip_bgp_sum branch from f6b60b2 to 9db65f6 Compare October 28, 2020 01:03
@lolyu
Copy link
Contributor Author

lolyu commented Oct 29, 2020

Retest this please

4 similar comments
@lolyu
Copy link
Contributor Author

lolyu commented Oct 30, 2020

Retest this please

@lolyu
Copy link
Contributor Author

lolyu commented Oct 30, 2020

Retest this please

@lolyu
Copy link
Contributor Author

lolyu commented Nov 2, 2020

Retest this please

@lolyu
Copy link
Contributor Author

lolyu commented Nov 7, 2020

Retest this please

@lolyu lolyu merged commit a9cdd27 into sonic-net:master Nov 9, 2020
@lolyu lolyu deleted the fix_show_ip_bgp_sum branch November 9, 2020 01:36
@rlhui rlhui requested a review from arlakshm November 14, 2020 19:59
@rlhui
Copy link
Contributor

rlhui commented Nov 14, 2020

@lolyu - is this indeed needing cherry-pick to 201911? I just did "show ipv6 bgp summary" in 20191130 and don't see the issue. Thanks.

@lolyu
Copy link
Contributor Author

lolyu commented Nov 26, 2020

hi @rlhui, yes, it is. I could reproduce when BGP is not in a healthy state, the command still broke.

abdosi pushed a commit that referenced this pull request Feb 12, 2021
Function `is_ipv6_address` and `is_ipv4_address` use `ipaddress` as
function argument, which override the module in global namespace.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
603ac53 (HEAD -> 201911, origin/201911) Advertise ipv6 link local address (sonic-net#1402)
9b0680c [acl_loader] Fix default DENY rule for V6 dataplane ACLs (sonic-net#1281)
25e64ce [show] Fix `show ip bgp sum` (sonic-net#1194)
4709da0 Revert "Add FW dump with new SAI implementation (sonic-net#1298)" (sonic-net#1408)

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[201911]show ipv6 bgp summary does not work when add a BGPV6 neighbor in the FRR module

6 participants