Method: Rbeapi::Api::Ipinterfaces#get

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

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

get returns a resource hash that represents the configuration of the IP interface from the nodes running configuration.

Examples:

{
  address: <string>
  mtu: <string>
  helper_addresses: array<strings>
}

Parameters:

  • :name (String)

    The full interface identifier of the interface to return the resource configuration hash for. The name must be the full name (Ethernet, not Et)

Returns:

  • (nil, Hash<Symbol, Object>)

    returns the ip interface configuration as a hash. If the provided interface name is not a configured ip address, nil is returned.



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/rbeapi/api/ipinterfaces.rb', line 62

def get(name)
  config = get_block("interface #{name}")
  return nil unless config
  return nil if /\s{3}switchport$/ =~ config

  response = {}
  response.merge!(parse_address(config))
  response.merge!(parse_mtu(config))
  response.merge!(parse_helper_addresses(config))
  response
end