Sha256: c1fbc1638aea12b395bf3e73aea80ea38b54e9a5fefac91802944a72d14bcc63

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

---
title: About the interface Resource
---

# interface

Use the `interface` InSpec audit resource to test basic network adapter properties, such as name, status, state, address, and link speed (in MB/sec).

* On Linux platforms, `/sys/class/net/#{iface}` is used as source
* On the Windows platform, the `Get-NetAdapter` cmdlet is used as source

# Syntax

An `interface` resource block declares network interface properties to be tested:

    describe interface do
      it { should be_up }
      its('speed') { should eq 1000 }
      its('name') { should eq eth0 }
    end

# Matchers

This InSpec audit resource has the following matchers:

## be

<%= partial "/shared/matcher_be" %>

## be_up

The `be_up` matcher tests if the network interface is available:

    it { should be_up }

## cmp

<%= partial "/shared/matcher_cmp" %>

## eq

<%= partial "/shared/matcher_eq" %>

## include

<%= partial "/shared/matcher_include" %>

## match

<%= partial "/shared/matcher_match" %>

## name

The `name` matcher tests if the named network interface exists:

    its('name') { should eq eth0 }

## speed

The `speed` matcher tests the speed of the network interface, in MB/sec:

    its('speed') { should eq 1000 }

# Examples

None.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inspec-1.0.0 docs/resources/interface.md.erb
inspec-1.0.0.beta3 docs/resources/interface.md.erb