inspec/docs/resources/interface.md.erb

66 lines
1.2 KiB
Text
Raw Normal View History

2016-09-22 12:43:57 +00:00
---
title: About the interface Resource
---
# interface
Use the `interface` InSpec audit resource to test basic network adapter properties, such as name, status, and link speed (in MB/sec).
2016-09-22 12:43:57 +00:00
* On Linux platforms, `/sys/class/net/#{iface}` is used as source
* On the Windows platform, the `Get-NetAdapter` cmdlet is used as source
## Syntax
2016-09-22 12:43:57 +00:00
An `interface` resource block declares network interface properties to be tested:
describe interface('eth0') do
2016-09-22 12:43:57 +00:00
it { should be_up }
its('speed') { should eq 1000 }
its('name') { should eq eth0 }
end
## Matchers
2016-09-22 12:43:57 +00:00
This InSpec audit resource has the following matchers:
### be
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_be" %>
### be_up
2016-09-22 12:43:57 +00:00
The `be_up` matcher tests if the network interface is available:
it { should be_up }
### cmp
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_cmp" %>
### eq
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_eq" %>
### include
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_include" %>
### match
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_match" %>
### name
2016-09-22 12:43:57 +00:00
The `name` matcher tests if the named network interface exists:
its('name') { should eq eth0 }
### speed
2016-09-22 12:43:57 +00:00
The `speed` matcher tests the speed of the network interface, in MB/sec:
its('speed') { should eq 1000 }
## Examples
2016-09-22 12:43:57 +00:00
None.