salt.runners.bgp

BGP Finder

New in version 2017.7.0.

Runner to search BGP neighbors details.

Configuration

  • Minion (proxy) config

    The bgp.neighbors function must be appened in the list of mine_functions:

    mine_functions:
      bgp.neighbors: []
    

    Which instructs Salt to cache the data returned by the neighbors function from the NAPALM BGP module.

    How often the mines are refreshed, can be specified using:

    mine_interval: <X minutes>
    
  • Master config

    By default the following options can be configured on the master. They are not mandatory, but available in case the user has different requirements.

    tgt: *

    From what minions will collect the mine data. Default: * (collect mine data from all minions)

    tgt_type: glob

    Minion matching expression form. Default: glob.

    return_fields

    What fields to return in the output. It can display all the fields from the neighbors function from the NAPALM BGP module.

    Some fields cannot be removed:

    • as_number: the AS number of the neighbor
    • device: the minion ID
    • neighbor_address: the neighbor remote IP address

    By default, the following extra fields are returned (displayed):

    • connection_stats: connection stats, as descibed below
    • import_policy: the name of the import policy
    • export_policy: the name of the export policy

    Special fields:

    • vrf: return the name of the VRF.
    • connection_stats: returning an output of the form

    <State> <Active>/<Received>/<Accepted>/<Damped>, e.g. Established 398/399/399/0 similar to the usual output from network devices. - interface_description: matches the neighbor details with the corresponding interface and returns its description. This will reuse functionality from the net runner, so the user needs to enable the mines as specified in the documentation. - interface_name: matches the neighbor details with the corresponding interface and returns the name. Similar to interface_description, this will reuse functionality from the net runner, so the user needs to enable the mines as specified in the documentation.

    display: True

    Display on the screen or return structured object? Default: True (return on the CLI).

    outputter: table

    Specify the outputter name when displaying on the CLI. Default: table.

    Configuration example:

    runners:
      bgp:
        tgt: 'edge*'
        tgt_type: 'glob'
        return_fields:
          - up
          - connection_state
          - previous_connection_state
          - suppress_4byte_as
          - holdtime
          - flap_count
        outputter: yaml
    
salt.runners.bgp.neighbors(*asns, **kwargs)

Search for BGP neighbors details in the mines of the bgp.neighbors function.

Arguments:

*asns
A list of AS numbers to search for. The runner will return only the neighbors of these AS numbers.
device
Filter by device name (minion ID).
ip
Search BGP neighbor using the IP address. In multi-VRF environments, the same IP address could be used by more than one neighbors, in different routing tables.
network
Search neighbors within a certain IP network.
title
Custom title.
display: True
Display on the screen or return structured object? Default: True (return on the CLI).
outputter: table
Specify the outputter name when displaying on the CLI. Default: table.

In addition, any field from the output of the neighbors function from the NAPALM BGP module can be used as a filter.

CLI Example:

salt-run bgp.neighbors 13335 15169
salt-run bgp.neighbors 13335 ip=172.17.19.1
salt-run bgp.neighbors multipath=True
salt-run bgp.neighbors up=False export_policy=my-export-policy multihop=False
salt-run bgp.neighbors network=192.168.0.0/16

Output example:

BGP Neighbors for 13335, 15169
________________________________________________________________________________________________________________________________________________________________
|    Device    | AS Number |         Neighbor Address        | State|#Active/Received/Accepted/Damped |         Policy IN         |         Policy OUT         |
________________________________________________________________________________________________________________________________________________________________
| edge01.bjm01 |   13335   |          172.17.109.11          |        Established 0/398/398/0         |       import-policy       |        export-policy       |
________________________________________________________________________________________________________________________________________________________________
| edge01.bjm01 |   13335   |          172.17.109.12          |       Established 397/398/398/0        |       import-policy       |        export-policy       |
________________________________________________________________________________________________________________________________________________________________
| edge01.flw01 |   13335   |          192.168.172.11         |        Established 1/398/398/0         |       import-policy       |        export-policy       |
________________________________________________________________________________________________________________________________________________________________
| edge01.oua01 |   13335   |          172.17.109.17          |          Established 0/0/0/0           |       import-policy       |        export-policy       |
________________________________________________________________________________________________________________________________________________________________
| edge01.bjm01 |   15169   |             2001::1             |       Established 102/102/102/0        |       import-policy       |        export-policy       |
________________________________________________________________________________________________________________________________________________________________
| edge01.bjm01 |   15169   |             2001::2             |       Established 102/102/102/0        |       import-policy       |        export-policy       |
________________________________________________________________________________________________________________________________________________________________
| edge01.tbg01 |   13335   |          192.168.172.17         |          Established 0/1/1/0           |       import-policy       |        export-policy       |
________________________________________________________________________________________________________________________________________________________________