Sha256: c24225367cfaed70f066654bd996ae034b840fe02610045628edbe8fab7e6b68

Contents?: true

Size: 1.21 KB

Versions: 34

Compression:

Stored size: 1.21 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

34 entries across 34 versions & 1 rubygems

Version Path
inspec-1.25.1 docs/resources/interface.md.erb
inspec-1.25.0 docs/resources/interface.md.erb
inspec-1.24.0 docs/resources/interface.md.erb
inspec-1.23.0 docs/resources/interface.md.erb
inspec-1.22.0 docs/resources/interface.md.erb
inspec-1.21.0 docs/resources/interface.md.erb
inspec-1.20.0 docs/resources/interface.md.erb
inspec-1.19.2 docs/resources/interface.md.erb
inspec-1.19.1 docs/resources/interface.md.erb
inspec-1.19.0 docs/resources/interface.md.erb
inspec-1.18.0 docs/resources/interface.md.erb
inspec-1.17.0 docs/resources/interface.md.erb
inspec-1.16.1 docs/resources/interface.md.erb
inspec-1.16.0 docs/resources/interface.md.erb
inspec-1.15.0 docs/resources/interface.md.erb
inspec-1.14.1 docs/resources/interface.md.erb
inspec-1.14.0 docs/resources/interface.md.erb
inspec-1.13.0 docs/resources/interface.md.erb
inspec-1.12.0 docs/resources/interface.md.erb
inspec-1.11.0 docs/resources/interface.md.erb