Method: Rbeapi::Api::EthernetInterface#get

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

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

get returns the specified Etherent interface resource hash that respresents the interface’s current configuration in th e node.

The resource hash returned contains the following information:

  • name (string): the interface name (eg Ethernet1)

  • type (string): will always be ‘ethernet’

  • description (string): the interface description value

  • speed (string): the current speed setting for the interface speed

  • forced (boolean): true if autonegotiation is disabled otherwise false

  • sflow (boolean): true if sflow is enabled on the interface otherwise false

  • flowcontrol_send (string): the inteface flowcontrol send value. Valid values are ‘on’ or ‘off’

  • flowconrol_receive (string): the interface flowcontrol receive value. Valid values are ‘on’ or ‘off’

Parameters:

  • :name (String)

    The interface name to return a resource hash for from the node’s running configuration

Returns:

  • (nil, Hash<Symbol, Object>)

    Returns the interface resource as a hash. If the specified interface name is not found in the node’s configuration a nil object is returned



346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/rbeapi/api/interfaces.rb', line 346

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

  response = super(name)
  response[:type] = 'ethernet'

  response.merge!(parse_speed(config))
  response.merge!(parse_sflow(config))
  response.merge!(parse_flowcontrol_send(config))
  response.merge!(parse_flowcontrol_receive(config))

  response
end