Method: Rbeapi::Api::Bgp.parse_bgp_as

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

.parse_bgp_as(config) ⇒ Hash<Symbol, Object>

parse_bgp_as scans the BGP routing configuration for the AS number. Defined as a class method. Used by the BgpNeighbors class below.

Parameters:

  • config (String)

    The switch config.

Returns:

  • (Hash<Symbol, Object>)

    Returns the resource hash attribute.



121
122
123
124
# File 'lib/rbeapi/api/bgp.rb', line 121

def self.parse_bgp_as(config)
  value = config.scan(/^router bgp (\d+)/).first
  { bgp_as: value[0] }
end