vlan

package
v1.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package vlan helps with creating transient VLAN network interfaces for testing purposes. It leverages the Ginkgo testing framework and matching (erm, sic!) Gomega matchers.

These VLAN network interfaces 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

View Source
const VlanPrefix = "vln-"

VlanPrefix is the name prefix used for transient VLAN network interfaces.

Variables

This section is empty.

Functions

func NewTransient

func NewTransient(vid uint16, lnk netlink.Link, opts ...Opt) netlink.Link

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

type Opt func(*link.Link) error

Opt is a configuration option when creating a new VLAN network interface.

func InNamespace

func InNamespace(fdref int) Opt

InNamespace configures a VXLAN network interface to be created in the network namespace referenced by fdref, instead of creating it in the current network namespace.

func With8021AD

func With8021AD() Opt

With8021AD configures the IEEE 802.1AD VLAN protocol.

func With8021Q

func With8021Q() Opt

With8021Q configures the IEEE 802.1Q VLAN protocol.

func WithGVRP

func WithGVRP() Opt

WithGVRP configures that this VLAN is to be registered using the GARP VLAN Registration Protocol.

func WithLinkNamespace

func WithLinkNamespace(fdref int) Opt

WithLinkNamespace specifies the “reference” or “link” network namespace other than the current network namespace when creating a new network interface.

func WithLooseBinding

func WithLooseBinding() Opt

WithLooseBinding configures the VLAN device state to be independent from the state of the bound network interface.

func WithMVRP

func WithMVRP() Opt

WithMVRP configures that this VLAN is to be registered using the Multiple VLAN Registration Protocol.

func WithReorderingHeaders

func WithReorderingHeaders() Opt

WithReorderingHeaders configures reordering of Ethernet headers.

func WithTightBinding

func WithTightBinding() Opt

WithTightBinding configures the VLAN device state to be tightly coupled to the state of the bound network interface.

func WithoutGVRP

func WithoutGVRP() Opt

WithoutGVRP configures that this VLAN must not be registered using the GARP VLAN Registration Protocol.

func WithoutMVRP

func WithoutMVRP() Opt

WithoutMVRP configures that this VLAN must not be registered using the Multiple VLAN Registration Protocol.

func WithoutReorderingHeaders

func WithoutReorderingHeaders() Opt

WithoutReorderingHeaders configures to not reorder Ethernet headers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL