netlink

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Link interface {
	netlink.Link
}

type NetlinkLib

type NetlinkLib interface {
	// LinkSetVfNodeGUID sets the node GUID of a vf for the link.
	// Equivalent to: `ip link set dev $link vf $vf node_guid $nodeguid`
	LinkSetVfNodeGUID(link Link, vf int, nodeguid net.HardwareAddr) error
	// LinkSetVfPortGUID sets the port GUID of a vf for the link.
	// Equivalent to: `ip link set dev $link vf $vf port_guid $portguid`
	LinkSetVfPortGUID(link Link, vf int, portguid net.HardwareAddr) error
	// LinkByName finds a link by name and returns a pointer to the object.
	LinkByName(name string) (Link, error)
	// LinkByIndex finds a link by index and returns a pointer to the object.
	LinkByIndex(index int) (Link, error)
	// LinkList gets a list of link devices.
	// Equivalent to: `ip link show`
	LinkList() ([]Link, error)
	// LinkSetVfHardwareAddr sets the hardware address of a vf for the link.
	// Equivalent to: `ip link set $link vf $vf mac $hwaddr`
	LinkSetVfHardwareAddr(link Link, vf int, hwaddr net.HardwareAddr) error
	// LinkSetUp enables the link device.
	// Equivalent to: `ip link set $link up`
	LinkSetUp(link Link) error
	// LinkSetMTU sets the mtu of the link device.
	// Equivalent to: `ip link set $link mtu $mtu`
	LinkSetMTU(link Link, mtu int) error
	// DevlinkGetDeviceByName provides a pointer to devlink device and nil error,
	// otherwise returns an error code.
	DevLinkGetDeviceByName(bus string, device string) (*netlink.DevlinkDevice, error)
	// DevLinkSetEswitchMode sets eswitch mode if able to set successfully or
	// returns an error code.
	// Equivalent to: `devlink dev eswitch set $dev mode switchdev`
	// Equivalent to: `devlink dev eswitch set $dev mode legacy`
	DevLinkSetEswitchMode(dev *netlink.DevlinkDevice, newMode string) error
	// VDPAGetDevByName returns VDPA device selected by name
	// Equivalent to: `vdpa dev show <name>`
	VDPAGetDevByName(name string) (*netlink.VDPADev, error)
	// VDPADelDev removes VDPA device
	// Equivalent to: `vdpa dev del <name>`
	VDPADelDev(name string) error
	// VDPANewDev adds new VDPA device
	// Equivalent to: `vdpa dev add name <name> mgmtdev <mgmtBus>/mgmtName [params]`
	VDPANewDev(name, mgmtBus, mgmtName string, params netlink.VDPANewDevParams) error
	// DevlinkGetDeviceParamByName returns specific parameter for devlink device
	// Equivalent to: `devlink dev param show <bus>/<device> name <param>`
	DevlinkGetDeviceParamByName(bus string, device string, param string) (*netlink.DevlinkParam, error)
	// DevlinkSetDeviceParam set specific parameter for devlink device
	// Equivalent to: `devlink dev param set <bus>/<device> name <param> cmode <cmode> value <value>`
	// cmode argument should contain valid cmode value as uint8, modes are define in nl.DEVLINK_PARAM_CMODE_* constants
	// value argument should have one of the following types: uint8, uint16, uint32, string, bool
	DevlinkSetDeviceParam(bus string, device string, param string, cmode uint8, value interface{}) error
	// RdmaLinkByName finds a link by name and returns a pointer to the object if
	// found and nil error, otherwise returns error code.
	RdmaLinkByName(name string) (*netlink.RdmaLink, error)
	// IsLinkAdminStateUp checks if the admin state of a link is up
	IsLinkAdminStateUp(link Link) bool
}

func New

func New() NetlinkLib

Directories

Path Synopsis
Package mock_netlink is a generated GoMock package.
Package mock_netlink is a generated GoMock package.

Jump to

Keyboard shortcuts

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