inspec/docs/resources/bridge.md.erb
hannah-radish 9cfc86d2ab Resource documentation update (#2207)
Light formatting changes, change order of example and matchers, slight
color changes

Signed-off-by: hannah-radish <hmaddy@chef.io>
2017-10-03 17:35:10 -04:00

47 lines
1.4 KiB
Text

---
title: About the bridge Resource
---
# bridge
Use the `bridge` InSpec audit resource to test basic network bridge properties, such as name, if an interface is defined, and the associations for any defined interface.
* On Linux platforms, any value in the `/sys/class/net/{interface}/bridge` directory may be tested
* On the Windows platform, the `Get-NetAdapter` cmdlet is associated with the `Get-NetAdapterBinding` cmdlet and returns the `ComponentID ms_bridge` value as a JSON object
<br>
## Syntax
A `bridge` resource block declares the bridge to be tested and what interface it should be associated with:
describe bridge('br0') do
it { should exist }
it { should have_interface 'eth0' }
end
<br>
## Matchers
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
### exist
The `exist` matcher tests if the network bridge is available:
it { should exist }
### have_interface
The `have_interface` matcher tests if the named interface is defined for the network bridge:
it { should have_interface 'eth0' }
### interfaces
The `interfaces` matcher tests if the named interface is present:
its('interfaces') { should eq 'foo' }
its('interfaces') { should eq 'bar' }
its('interfaces') { should include('foo') }