Method: Rbeapi::Api::Bgp#get

Defined in:
lib/rbeapi/api/bgp.rb

#getnil, Hash<Symbol, Object>

get returns the BGP routing configuration from the nodes current configuration.

Examples:

{
  bgp_as: <string>,
  router_id: <string>,
  shutdown: <string>,
  maximum_paths: <integer>,
  maximum_ecmp_paths: <integer>
  networks: [
    {
      prefix: <string>,
      masklen: <integer>,
      route_map: <string>
    },
    {
      prefix: <string>,
      masklen: <integer>,
      route_map: <string>
    }
  ],
  neighbors: {
    name: {
      peer_group: <string>,
      remote_as: <string>,
      send_community: <boolean>,
      shutdown: <boolean>,
      description: <string>,
      next_hop_selp: <boolean>,
      route_map_in: <string>,
      route_map_out: <string>
    },
    name: {
      peer_group: <string>,
      remote_as: <string>,
      send_community: <boolean>,
      shutdown: <boolean>,
      description: <string>,
      next_hop_selp: <boolean>,
      route_map_in: <string>,
      route_map_out: <string>
    },
    ...
  }
}


100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/rbeapi/api/bgp.rb', line 100

def get
  config = get_block('^router bgp .*')
  return nil unless config

  response = Bgp.parse_bgp_as(config)
  response.merge!(parse_router_id(config))
  response.merge!(parse_shutdown(config))
  response.merge!(parse_maximum_paths(config))
  response.merge!(parse_networks(config))
  response[:neighbors] = @neighbors.getall
  response
end