ipnet

package
v0.0.0-...-2d08fe4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockIPNet

type MockIPNet struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MockIPNet is a mock for the ipnet Plugin.

func NewMockIPNet

func NewMockIPNet() *MockIPNet

NewMockIPNet is a constructor for MockIPNet.

func (*MockIPNet) GetExternalIfName

func (mn *MockIPNet) GetExternalIfName(extIfName string, vlan uint32) (ifName string)

GetExternalIfName returns logical name that corresponds to the specified external interface name and VLAN ID.

func (*MockIPNet) GetExternalIfNetworkName

func (mn *MockIPNet) GetExternalIfNetworkName(ifName string) (string, error)

GetExternalIfNetworkName returns the name of custom network which should contain given external interface or error otherwise.

func (*MockIPNet) GetHostIPs

func (mn *MockIPNet) GetHostIPs() []net.IP

GetHostIPs returns all IP addresses of this node present in the host network namespace (Linux).

func (*MockIPNet) GetHostInterconnectIfName

func (mn *MockIPNet) GetHostInterconnectIfName() string

GetHostInterconnectIfName returns the name of the TAP/AF_PACKET interface interconnecting VPP with the host stack.

func (*MockIPNet) GetNodeIP

func (mn *MockIPNet) GetNodeIP() (net.IP, *net.IPNet)

GetNodeIP returns the IP+network address of this node.

func (*MockIPNet) GetOrAllocateVrfID

func (mn *MockIPNet) GetOrAllocateVrfID(networkName string) (vrf uint32, err error)

GetOrAllocateVrfID returns the allocated VRF ID number for the given network. Allocates a new VRF ID if not already allocated.

func (*MockIPNet) GetOrAllocateVxlanVNI

func (mn *MockIPNet) GetOrAllocateVxlanVNI(networkName string) (vni uint32, err error)

GetOrAllocateVxlanVNI returns the allocated VXLAN VNI number for the given network. Allocates a new VNI if not already allocated.

func (*MockIPNet) GetPodByIf

func (mn *MockIPNet) GetPodByIf(ifname string) (podNamespace string, podName string, exists bool)

GetPodByIf looks up podName and podNamespace that is associated with logical interface name.

func (*MockIPNet) GetPodCustomIfNames

func (mn *MockIPNet) GetPodCustomIfNames(podNamespace, podName, customIfName string) (ifName string,
	linuxIfName string, exists bool)

GetPodCustomIfNames looks up logical interface name that corresponds to the custom interface with specified name and type associated with the given local pod name + namespace.

func (*MockIPNet) GetPodCustomIfNetworkName

func (mn *MockIPNet) GetPodCustomIfNetworkName(podID podmodel.ID, ifName string) (string, error)

GetPodCustomIfNetworkName returns the name of custom network which should contain given pod custom interface or error otherwise. This supports both type of pods, remote and local

func (*MockIPNet) GetPodIfNames

func (mn *MockIPNet) GetPodIfNames(podNamespace string, podName string) (vppIfName, linuxIfName,
	loopIfName string, exists bool)

GetPodIfNames returns pod's interface name as set previously using SetPodIfName.

func (*MockIPNet) GetPodLoopIfName

func (mn *MockIPNet) GetPodLoopIfName(podNamespace string, podName string) string

GetPodLoopIfName computes logical name of loop interface for given pod

func (*MockIPNet) GetVxlanBVIIfName

func (mn *MockIPNet) GetVxlanBVIIfName() string

GetVxlanBVIIfName returns the name of an BVI interface facing towards VXLAN tunnels to other hosts. Returns an empty string if VXLAN is not used (in L2 interconnect mode).

func (*MockIPNet) ReleaseVrfID

func (mn *MockIPNet) ReleaseVrfID(networkName string) (err error)

ReleaseVrfID releases the allocated VRF ID number for the given network.

func (*MockIPNet) ReleaseVxlanVNI

func (mn *MockIPNet) ReleaseVxlanVNI(networkName string) (err error)

ReleaseVxlanVNI releases the allocated VXLAN VNI number for the given network.

func (*MockIPNet) SetGetExternalIfNetworkName

func (mn *MockIPNet) SetGetExternalIfNetworkName(ifName string, networkName string)

SetGetExternalIfNetworkName sets network name that external interface belongs to.

func (*MockIPNet) SetGetPodCustomIfNetworkName

func (mn *MockIPNet) SetGetPodCustomIfNetworkName(podID podmodel.ID, ifName string, networkName string)

SetGetPodCustomIfNetworkName sets network name that pod custom interface belongs to.

func (*MockIPNet) SetHostIPs

func (mn *MockIPNet) SetHostIPs(ips []net.IP)

SetHostIPs sets IP addresses of this node present in the host network namespace (Linux).

func (*MockIPNet) SetHostInterconnectIfName

func (mn *MockIPNet) SetHostInterconnectIfName(ifName string)

SetHostInterconnectIfName allows to set what tests will assume the name of the host-interconnect interface is.

func (*MockIPNet) SetNetworkVrfID

func (mn *MockIPNet) SetNetworkVrfID(networkName string, vrfID uint32)

SetNetworkVrfID sets VRF table ID to network name that it should belong to.

func (*MockIPNet) SetNodeIP

func (mn *MockIPNet) SetNodeIP(nodeIP *net.IPNet)

SetNodeIP allows to set what tests will assume the node IP is.

func (*MockIPNet) SetPodIfName

func (mn *MockIPNet) SetPodIfName(pod podmodel.ID, ifName string)

SetPodIfName allows to create a fake association between a pod and an interface.

func (*MockIPNet) SetVxlanBVIIfName

func (mn *MockIPNet) SetVxlanBVIIfName(ifName string)

SetVxlanBVIIfName allows to set what tests will assume the name of the VXLAN BVI interface is.

Jump to

Keyboard shortcuts

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