Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix errors of "show ip bgp summary" and "show ip bgp neigh" under alias #28

Open
wants to merge 1 commit into
base: 202311.X
Choose a base branch
from

Conversation

JoshYangEC
Copy link

In alias mode, the output of "show ip/ipv6 bgp summary" and "show ip/ipv6 bgp neigh" return errors. This PR is used to fix these errors.

What I did

After setting alias mode, the output of "show ip/ipv6 bgp summary" and "show ip/ipv6 bgp neighbors" return errors. This PR fixes the issue to support alias mode for these bgp commands.

How I did it

enhance the function run_bgp_show_command in bgp_util.py to support alias mode for the following commands:

  • show ip|ipv6 bgp summary
  • show ip|ipv6 bgp neighbors

In the original function run_bgp_show_command, it only handles the command show ip|ipv6 route. Here, we define a new dict structure to map the vtysh commands, as these commands require specific functions to handle the output of the vtysh command. Additionally, the function needs to convert interface names to alias names in the output of the vtysh command.

How to verify it

  1. execute "show ip bgp summary" to verify
admin@sonic:~$ SONIC_CLI_IFACE_MODE=alias show ip bgp summary

IPv4 Unicast Summary:
BGP router identifier 10.1.0.32, local AS number 65100 vrf-id 0
BGP table version 1
RIB entries 1, using 192 bytes of memory
Peers 2, using 1483952 KiB of memory
Peer groups 2, using 128 bytes of memory


Neighbhor      V     AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ  Up/Down    State/PfxRcd    NeighborName
-----------  ---  -----  ---------  ---------  --------  -----  ------  ---------  --------------  --------------
10.0.0.1       4  65200          0          0         0      0       0  never      Active          ARISTA01T2
10.0.0.3       4  65200          0          0         0      0       0  never      Active          ARISTA02T2

Total number of neighbors 2
  1. execute "show ipv6 bgp summary" to verify
admin@sonic:~$ SONIC_CLI_IFACE_MODE=alias show ipv6 bgp summary

IPv6 Unicast Summary:
BGP router identifier 10.1.0.32, local AS number 65100 vrf-id 0
BGP table version 1
RIB entries 1, using 192 bytes of memory
Peers 2, using 1483952 KiB of memory
Peer groups 2, using 128 bytes of memory


Neighbhor      V     AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ  Up/Down    State/PfxRcd    NeighborName
-----------  ---  -----  ---------  ---------  --------  -----  ------  ---------  --------------  --------------
fc00::2        4  65200          0          0         0      0       0  never      Active          ARISTA01T2
fc00::4a       4  64003          0          0         0      0       0  never      Active          ARISTA03T0

Total number of neighbors 2
  1. execute "show ip bgp neighbors" to verify
admin@sonic:~$ SONIC_CLI_IFACE_MODE=alias show ip bgp neighbors
BGP neighbor is 10.0.0.1, remote AS 65200, local AS 65100, external link
  Local Role: undefined
  Remote Role: undefined
 Description: ARISTA01T2
 Member of peer-group PEER_V4 for session parameters
  BGP version 4, remote router ID 0.0.0.0, local router ID 10.1.0.32
  BGP state = Active
  Last read 00:18:03, Last write never
  Hold time is 10 seconds, keepalive interval is 3 seconds
  Configured hold time is 10 seconds, keepalive interval is 3 seconds
  Configured conditional advertisements interval is 60 seconds
  Graceful restart information:
    Local GR Mode: Helper*

    Remote GR Mode: NotApplicable

    R bit: False
    N bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    .......
    
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  0          0
  Minimum time between advertisement runs is 0 seconds

 For address family: IPv6 Unicast
  PEER_V6 peer-group member
  Not part of any update group
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor(all)
  Inbound path policy configured
  Outbound path policy configured
  Route map for incoming advertisements is *FROM_BGP_PEER_V6
  Route map for outgoing advertisements is *TO_BGP_PEER_V6
  0 accepted prefixes

  Connections established 0; dropped 0
  Last reset 00:18:03,  Waiting for peer OPEN
  External BGP neighbor may be up to 1 hops away.
BGP Connect Retry Timer in Seconds: 10
Next connect timer due in 5 seconds
Read thread: off  Write thread: off  FD used: -1
  1. execute "show ipv6 bgp neighbors" to verify
admin@sonic:~$ SONIC_CLI_IFACE_MODE=alias show ipv6 bgp neighbors
BGP neighbor is 10.0.0.1, remote AS 65200, local AS 65100, external link
  Local Role: undefined
  Remote Role: undefined
 Description: ARISTA01T2
 Member of peer-group PEER_V4 for session parameters
  BGP version 4, remote router ID 0.0.0.0, local router ID 10.1.0.32
  BGP state = Active
  Last read 00:18:03, Last write never
  Hold time is 10 seconds, keepalive interval is 3 seconds
  Configured hold time is 10 seconds, keepalive interval is 3 seconds
  Configured conditional advertisements interval is 60 seconds
  Graceful restart information:
    Local GR Mode: Helper*

    Remote GR Mode: NotApplicable

    R bit: False
    N bit: False
    Timers:
      Configured Restart Time(sec): 120
      Received Restart Time(sec): 0
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    .......
    
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  0          0
  Minimum time between advertisement runs is 0 seconds

 For address family: IPv6 Unicast
  PEER_V6 peer-group member
  Not part of any update group
  Inbound soft reconfiguration allowed
  Community attribute sent to this neighbor(all)
  Inbound path policy configured
  Outbound path policy configured
  Route map for incoming advertisements is *FROM_BGP_PEER_V6
  Route map for outgoing advertisements is *TO_BGP_PEER_V6
  0 accepted prefixes

  Connections established 0; dropped 0
  Last reset 00:18:03,  Waiting for peer OPEN
  External BGP neighbor may be up to 1 hops away.
BGP Connect Retry Timer in Seconds: 10
Next connect timer due in 5 seconds
Read thread: off  Write thread: off  FD used: -1

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

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

In alias mode, the output of "show ip/ipv6 bgp summary" and "show ip/ipv6
bgp neigh" return errors. This PR is used to fix these errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant