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

[show] Add 'ip/ipv6 bgp network' commands #888

Merged
merged 5 commits into from
Apr 24, 2020

Conversation

tsvanduyn
Copy link
Contributor

… normal commands for 'show ip bgp'

- What I did
I updated the bgp_frr_v4.py and bgp_frr_v6.py files to have a new function for "network" since the Click framework required this. I was going to use "route" but this conflicted with "route-map" in the vtysh so I found "network" was not something that would conflict and used that as it made the most sense. The will support the normal networking commands of "show ip bgp [ipaddress|prefix] [options]" and "show ipv6 bgp [ipaddress|prefix] [options]"

- How I did it
Add a new "network" function so the VTYSH commands can be referenced by the SONIC CLI.

- How to verify it
The command didn't exist on the SONIC CLI. I had to add it.

- Previous command output (if the output of a command-line utility has changed)
For both IPv4 and IPv6 these commands didn't exist.

For IPv4:

admin@str-s6000-acs-11:~$ show ip bgp -h
Usage: show ip bgp [OPTIONS] COMMAND [ARGS]...

  Show IPv4 BGP (Border Gateway Protocol) information

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  neighbors  Show IP (IPv4) BGP neighbors
  summary    Show summarized information of IPv4 BGP state
admin@str-s6000-acs-11:~$ 

For IPv6

admin@str-s6000-acs-11:~$ show ipv6 bgp -h
Usage: show ipv6 bgp [OPTIONS] COMMAND [ARGS]...

  Show IPv6 BGP (Border Gateway Protocol) information

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  neighbors  Show IPv6 BGP neighbors
  summary    Show summarized information of IPv6 BGP state
admin@str-s6000-acs-11:~$ 

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

So these two commands have some subcommands as well.

Here are the IPv4 commands

admin@str-s6000-acs-11:~$ show ip bgp -h
Usage: show ip bgp [OPTIONS] COMMAND [ARGS]...

  Show IPv4 BGP (Border Gateway Protocol) information

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  neighbors  Show IP (IPv4) BGP neighbors
  network    Show IP (IPv4) BGP network
  summary    Show summarized information of IPv4 BGP state
admin@str-s6000-acs-11:~$ 

admin@str-s6000-acs-11:~$ show ip bgp network -h
Usage: show ip bgp network [OPTIONS] [IPADDRESS|PREFIX] [bestpath|json|longer-
                           prefixes|multipath]

  Show IP (IPv4) BGP network

Options:
  -?, -h, --help  Show this message and exit.
admin@str-s6000-acs-11:~$ 

admin@str-s6000-acs-11:~$ show ip bgp network 
BGP table version is 1, local router ID is 10.1.0.32, vrf id 0
Default local pref 100, local AS 65100
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.0.32/32     0.0.0.0                  0         32768 i

Displayed  1 routes and 1 total paths
admin@str-s6000-acs-11:~$ 

admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32
BGP routing table entry for 10.1.0.32/32
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0 from 0.0.0.0 (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32 bestpath
BGP routing table entry for 10.1.0.32/32
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0 from 0.0.0.0 (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32 multipath
BGP routing table entry for 10.1.0.32/32
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0 from 0.0.0.0 (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32 json
{
  "prefix":"10.1.0.32\/32",
  "paths":[
    {
      "aspath":{
        "string":"Local",
        "segments":[
        ],
        "length":0
      },
      "origin":"IGP",
      "med":0,
      "metric":0,
      "weight":32768,
      "valid":true,
      "sourced":true,
      "local":true,
      "bestpath":{
        "overall":true,
        "selectionReason":"First path received"
      },
      "lastUpdate":{
        "epoch":1586989571,
        "string":"Wed Apr 15 22:26:11 2020\n"
      },
      "nexthops":[
        {
          "ip":"0.0.0.0",
          "afi":"ipv4",
          "metric":0,
          "accessible":true,
          "used":true
        }
      ],
      "peer":{
        "peerId":"0.0.0.0",
        "routerId":"10.1.0.32"
      }
    }
  ]
}
admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32 longer-prefixes
The parameter option: "longer-prefixes" only available if passing a network prefix
EX: 'show ip bgp network 10.0.0.0/24 longer-prefixes'
Aborted!
admin@str-s6000-acs-11:~$ 
admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32/32 longer-prefixes
BGP table version is 1, local router ID is 10.1.0.32, vrf id 0
Default local pref 100, local AS 65100
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.0.32/32     0.0.0.0                  0         32768 i

Displayed  1 routes and 1 total paths
admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32/32 bestpath
BGP routing table entry for 10.1.0.32/32
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0 from 0.0.0.0 (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32/32 multipath
BGP routing table entry for 10.1.0.32/32
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    0.0.0.0 from 0.0.0.0 (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ip bgp network 10.1.0.32/32 json
{
  "prefix":"10.1.0.32\/32",
  "paths":[
    {
      "aspath":{
        "string":"Local",
        "segments":[
        ],
        "length":0
      },
      "origin":"IGP",
      "med":0,
      "metric":0,
      "weight":32768,
      "valid":true,
      "sourced":true,
      "local":true,
      "bestpath":{
        "overall":true,
        "selectionReason":"First path received"
      },
      "lastUpdate":{
        "epoch":1586989571,
        "string":"Wed Apr 15 22:26:11 2020\n"
      },
      "nexthops":[
        {
          "ip":"0.0.0.0",
          "afi":"ipv4",
          "metric":0,
          "accessible":true,
          "used":true
        }
      ],
      "peer":{
        "peerId":"0.0.0.0",
        "routerId":"10.1.0.32"
      }
    }
  ]
}
admin@str-s6000-acs-11:~$ 

Here are the IPv6 command outputs:

admin@str-s6000-acs-11:~$ show ipv6 bgp -h
Usage: show ipv6 bgp [OPTIONS] COMMAND [ARGS]...

  Show IPv6 BGP (Border Gateway Protocol) information

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  neighbors  Show IPv6 BGP neighbors
  network    Show BGP ipv6 network
  summary    Show summarized information of IPv6 BGP state
admin@str-s6000-acs-11:~$ show ipv6 bgp network -h
Usage: show ipv6 bgp network [OPTIONS] [IPADDRESS|PREFIX] [bestpath|json
                             |longer-prefixes|multipath]

  Show BGP ipv6 network

Options:
  -?, -h, --help  Show this message and exit.
admin@str-s6000-acs-11:~$ 

admin@str-s6000-acs-11:~$ show ipv6 bgp network 
BGP table version is 1, local router ID is 10.1.0.32, vrf id 0
Default local pref 100, local AS 65100
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> fc00:1::/64      ::                       0         32768 i

Displayed  1 routes and 1 total paths
admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1::
BGP routing table entry for fc00:1::/64
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    :: from :: (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1:: bestpath
BGP routing table entry for fc00:1::/64
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    :: from :: (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1:: multipath
BGP routing table entry for fc00:1::/64
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    :: from :: (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1:: json
{
  "prefix":"fc00:1::\/64",
  "paths":[
    {
      "aspath":{
        "string":"Local",
        "segments":[
        ],
        "length":0
      },
      "origin":"IGP",
      "med":0,
      "metric":0,
      "weight":32768,
      "valid":true,
      "sourced":true,
      "local":true,
      "bestpath":{
        "overall":true,
        "selectionReason":"First path received"
      },
      "lastUpdate":{
        "epoch":1586989571,
        "string":"Wed Apr 15 22:26:11 2020\n"
      },
      "nexthops":[
        {
          "ip":"::",
          "afi":"ipv6",
          "scope":"global",
          "metric":0,
          "accessible":true,
          "used":true
        }
      ],
      "peer":{
        "peerId":"::",
        "routerId":"10.1.0.32"
      }
    }
  ]
}
admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1:: longer-prefixes
The parameter option: "longer-prefixes" only available if passing a network prefix
EX: 'show ipv6 bgp network fc00:1::/64 longer-prefixes'
Aborted!
admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1::/64 longer-prefixes
BGP table version is 1, local router ID is 10.1.0.32, vrf id 0
Default local pref 100, local AS 65100
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> fc00:1::/64      ::                       0         32768 i

Displayed  1 routes and 1 total paths
admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1::/64 bestpath
BGP routing table entry for fc00:1::/64
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    :: from :: (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1::/64 multipath
BGP routing table entry for fc00:1::/64
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    :: from :: (10.1.0.32)
      Origin IGP, metric 0, weight 32768, valid, sourced, local, best (First path received)
      Last update: Wed Apr 15 22:26:11 2020

admin@str-s6000-acs-11:~$ show ipv6 bgp network fc00:1::/64 json
{
  "prefix":"fc00:1::\/64",
  "paths":[
    {
      "aspath":{
        "string":"Local",
        "segments":[
        ],
        "length":0
      },
      "origin":"IGP",
      "med":0,
      "metric":0,
      "weight":32768,
      "valid":true,
      "sourced":true,
      "local":true,
      "bestpath":{
        "overall":true,
        "selectionReason":"First path received"
      },
      "lastUpdate":{
        "epoch":1586989571,
        "string":"Wed Apr 15 22:26:11 2020\n"
      },
      "nexthops":[
        {
          "ip":"::",
          "afi":"ipv6",
          "scope":"global",
          "metric":0,
          "accessible":true,
          "used":true
        }
      ],
      "peer":{
        "peerId":"::",
        "routerId":"10.1.0.32"
      }
    }
  ]
}
admin@str-s6000-acs-11:~$ 

pavel-shirshov
pavel-shirshov previously approved these changes Apr 24, 2020
Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wait for Joe's review

doc/Command-Reference.md Outdated Show resolved Hide resolved
show/bgp_frr_v4.py Outdated Show resolved Hide resolved
show/bgp_frr_v6.py Outdated Show resolved Hide resolved
doc/Command-Reference.md Outdated Show resolved Hide resolved
doc/Command-Reference.md Outdated Show resolved Hide resolved
@jleveque jleveque changed the title Added 'show ip bgp' and 'show ipv6 bgp" commands. [show] Add 'ip/ipv6 bgp network' commands Apr 24, 2020
@jleveque jleveque merged commit fc719ad into sonic-net:master Apr 24, 2020
abdosi pushed a commit that referenced this pull request Apr 27, 2020
Co-authored-by: Travis Van Duyn <trvanduy@microsoft.com>
abdosi pushed a commit to abdosi/sonic-utilities that referenced this pull request Aug 4, 2020
Co-authored-by: Travis Van Duyn <trvanduy@microsoft.com>
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
[Vxlan] : adding show vnet/vxlan cmds (sonic-net#880)
[show][bgp] Use only 'show ip bgp' as the base and use bgp_frr_v4 file
for FRR routing stack (sonic-net#884)
[fast reboot] set a fast-reboot DB flag (sonic-net#887)
[show] Add 'ip/ipv6 bgp network' commands (sonic-net#888)
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.

4 participants