mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
2de06bdeb5
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
68 lines
1.3 KiB
Text
68 lines
1.3 KiB
Text
---
|
|
title: About the interface Resource
|
|
platform: os
|
|
---
|
|
|
|
# interface
|
|
|
|
Use the `interface` InSpec audit resource to test basic network adapter properties, such as name, status, 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
|
|
|
|
<br>
|
|
|
|
## Availability
|
|
|
|
### Installation
|
|
|
|
This resource is distributed along with InSpec itself. You can use it automatically.
|
|
|
|
### Version
|
|
|
|
This resource first became available in v1.0.0 of InSpec.
|
|
|
|
## Syntax
|
|
|
|
An `interface` resource block declares network interface properties to be tested:
|
|
|
|
describe interface('eth0') do
|
|
it { should be_up }
|
|
its('speed') { should eq 1000 }
|
|
its('name') { should eq eth0 }
|
|
end
|
|
|
|
<br>
|
|
|
|
## Properties
|
|
|
|
`name`, `speed`
|
|
|
|
<br>
|
|
|
|
## Resource Property Examples
|
|
|
|
### 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 }
|
|
|
|
<br>
|
|
|
|
## Matchers
|
|
|
|
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|
|
|
|
### be_up
|
|
|
|
The `be_up` matcher tests if the network interface is available:
|
|
|
|
it { should be_up }
|
|
|