class Inspec::Resources::NetworkInterface

def exists?

def exists?
  !interface_info.nil? && !interface_info[:name].nil?
end

def initialize(iface)

def initialize(iface)
  @iface = iface
  @interface_provider = nil
  if inspec.os.linux?
    @interface_provider = LinuxInterface.new(inspec)
  elsif inspec.os.windows?
    @interface_provider = WindowsInterface.new(inspec)
  else
    return skip_resource 'The `interface` resource is not supported on your OS yet.'
  end
end

def interface_info

def interface_info
  return @cache if defined?(@cache)
  @cache = @interface_provider.interface_info(@iface) if !@interface_provider.nil?
end

def speed

returns link speed in Mbits/sec
def speed
  interface_info.nil? ? nil : interface_info[:speed]
end

def to_s

def to_s
  "Interface #{@iface}"
end

def up?

def up?
  interface_info.nil? ? false : interface_info[:up]
end