Method: Rbeapi::Api::BaseInterface#get

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

#get(name) ⇒ nil, Hash<String, Object>

get returns the specified interface resource hash that represents the node’s current interface configuration. The BaseInterface class provides all the set of attributes that are common to all interfaces in EOS. This method will return an interface type of generic.

Examples:

{
  name: <string>
  type: 'generic'
  description: <string>
  encapsulation: <integer>
  shutdown: [true, false]
  load_interval: <string>
}

Parameters:

  • The name of the interface to return from the running-configuration.

Returns:

  • Returns a hash of the interface properties if the interface name was found in the running configuration. If the interface was not found, nil is returned.



179
180
181
182
183
184
185
186
187
188
189
# File 'lib/rbeapi/api/interfaces.rb', line 179

def get(name)
  config = get_block("^interface #{name}")
  return nil unless config

  response = { name: name, type: 'generic' }
  response.merge!(parse_description(config))
  response.merge!(parse_encapsulation(config))
  response.merge!(parse_shutdown(config))
  response.merge!(parse_load_interval(config))
  response
end