Documentation
¶
Overview ¶
Package bridge helps with creating transient bridge type virtual network interfaces for testing purposes. It leverages the Ginkgo testing framework and matching (erm, sic!) Gomega matchers.
The "dummy" network interfaces created by this package are transient because they automatically get removed at the end of the a test (spec, block/group, suite, et cetera) using Ginkgo's DeferCleanup.
Index ¶
Constants ¶
const BridgePrefix = "bri-"
BridgePrefix is the name prefix used for transient bridge (network interfaces). Note that we don't want to interfere with Docker's “br-” namespace.
Variables ¶
This section is empty.
Functions ¶
func AddPort ¶
AddPort adds the specified “port” link to the passed “br” bridge, failing the current test in case the link cannot be added as a port to the bridge.
func NewTransient ¶
NewTransient creates and returns a new (and transient) VLAN network interface with VLAN ID passed in vid, and attached to the specified network interface. NewTransient automatically defers proper automatic removal of the VLAN network interface.
Types ¶
type Opt ¶
Opt is a configuration option when creating a new bridge (network interface).
func InNamespace ¶
InNamespace configures a bridge network interface to be created in the network namespace referenced by fdref, instead of creating it in the current network namespace.
func WithAgeing ¶
WithAgeing configures the bridge's FDB entries ageing time (duration). Please note that this duration is rounded down to the corresponding USER_HZ-granular duration. The default duration is 300s.
func WithHello ¶
WithHello configures the time (duration) between hello packets sent by the bridge. Please note that this duration is rounded down to the corresponding USER_HZ-granular duration. The default duration is 2s.
func WithLinkNamespace ¶
WithLinkNamespace specifies the “reference” or “link” network namespace other than the current network namespace when creating a new network interface.
func WithMulticastSnooping ¶
func WithMulticastSnooping() Opt
WithMulticastSnooping configures multicast snooping. The default is for multicast snooping to be turned on.
func WithVLANFiltering ¶
func WithVLANFiltering() Opt
WithVLANFiltering configures the bridge with VLAN filtering.
func WithoutMulticastSnooping ¶
func WithoutMulticastSnooping() Opt
WithoutMulticastSnooping configures multicast snooping to be turned off.
func WithoutVLANFiltering ¶
func WithoutVLANFiltering() Opt
WithoutVLANFiltering configures the bridge to not use VLAN filtering.