2016-09-22 12:43:57 +00:00
---
title: About the bond Resource
---
# bond
Use the `bond` InSpec audit resource to test a logical, bonded network interface (i.e. "two or more network interfaces aggregated into a single, logical network interface"). On Linux platforms, any value in the `/proc/net/bonding` directory may be tested.
2016-09-27 19:03:23 +00:00
## Syntax
2016-09-22 12:43:57 +00:00
A `bond` resource block declares a bonded network interface, and then specifies the properties of that bonded network interface to be tested:
describe bond('name') do
it { should exist }
end
where
* `'name'` is the name of the bonded network interface
* `{ should exist }` is a valid matcher for this resource
2016-09-27 19:03:23 +00:00
## Matchers
2016-09-22 12:43:57 +00:00
This InSpec audit resource has the following matchers:
2016-09-27 19:03:23 +00:00
### be
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_be" %>
2016-09-27 19:03:23 +00:00
### cmp
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_cmp" %>
2016-09-27 19:03:23 +00:00
### content
2016-09-22 12:43:57 +00:00
The `content` matcher tests if contents in the file that defines the bonded network interface match the value specified in the test. The values of the `content` matcher are arbitrary:
its('content') { should match('value') }
2016-09-27 19:03:23 +00:00
### eq
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_eq" %>
2016-09-27 19:03:23 +00:00
### exist
2016-09-22 12:43:57 +00:00
The `exist` matcher tests if the bonded network interface is available:
it { should exist }
2016-09-27 19:03:23 +00:00
### have_interface
2016-09-22 12:43:57 +00:00
The `have_interface` matcher tests if the bonded network interface has one (or more) secondary interfaces:
it { should have_interface }
2016-09-27 19:03:23 +00:00
### include
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_include" %>
2016-09-27 19:03:23 +00:00
### interfaces
2016-09-22 12:43:57 +00:00
The `interfaces` matcher tests if the named secondary interfaces are available:
its('interfaces') { should eq ['eth0', 'eth1', ...] }
2016-09-27 19:03:23 +00:00
### match
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_match" %>
2016-09-27 19:03:23 +00:00
### params
2016-09-22 12:43:57 +00:00
The `params` matcher tests arbitrary parameters for the bonded network interface:
its('params') { should eq 'value' }
2016-09-27 19:03:23 +00:00
## Examples
2016-09-22 12:43:57 +00:00
The following examples show how to use this InSpec audit resource.
2016-09-27 19:03:23 +00:00
### Test if eth0 is a secondary interface for bond0
2016-09-22 12:43:57 +00:00
describe bond('bond0') do
it { should exist }
it { should have_interface 'eth0' }
end
2016-09-27 19:03:23 +00:00
### Test parameters for bond0
2016-09-22 12:43:57 +00:00
describe bond('bond0') do
its('Bonding Mode') { should eq 'IEEE 802.3ad Dynamic link aggregation' }
its('Transmit Hash Policy') { should eq 'layer3+4 (1)' }
its('MII Status') { should eq 'up' }
its('MII Polling Interval (ms)') { should eq '100' }
its('Up Delay (ms)') { should eq '0' }
its('Down Delay (ms)') { should eq '0' }
end