network

package
v0.3.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SetupPodNetwork = SetupDefaultPodNetwork

Allow mocking for tests

Functions

func SetupDefaultPodNetwork

func SetupDefaultPodNetwork(domain *api.Domain) error

SetupDefaultPodNetwork will prepare the pod management network to be used by a virtual machine which will own the pod network IP and MAC. Pods MAC address will be changed to a random address and IP will be deleted. This will also create a macvlan device with a fake IP. DHCP server will be started and bounded to the macvlan interface to server the original pod ip to the guest OS

Types

type MockNetworkHandler

type MockNetworkHandler struct {
	// contains filtered or unexported fields
}

Mock of NetworkHandler interface

func NewMockNetworkHandler

func NewMockNetworkHandler(ctrl *gomock.Controller) *MockNetworkHandler

func (*MockNetworkHandler) AddrAdd

func (_m *MockNetworkHandler) AddrAdd(link netlink.Link, addr *netlink.Addr) error

func (*MockNetworkHandler) AddrDel

func (_m *MockNetworkHandler) AddrDel(link netlink.Link, addr *netlink.Addr) error

func (*MockNetworkHandler) AddrList

func (_m *MockNetworkHandler) AddrList(link netlink.Link, family int) ([]netlink.Addr, error)

func (*MockNetworkHandler) ChangeMacAddr

func (_m *MockNetworkHandler) ChangeMacAddr(iface string) (net.HardwareAddr, error)

func (*MockNetworkHandler) EXPECT

func (_m *MockNetworkHandler) EXPECT() *_MockNetworkHandlerRecorder

func (*MockNetworkHandler) GetMacDetails

func (_m *MockNetworkHandler) GetMacDetails(iface string) (net.HardwareAddr, error)

func (*MockNetworkHandler) LinkAdd

func (_m *MockNetworkHandler) LinkAdd(link netlink.Link) error

func (*MockNetworkHandler) LinkByName

func (_m *MockNetworkHandler) LinkByName(name string) (netlink.Link, error)

func (*MockNetworkHandler) LinkSetDown

func (_m *MockNetworkHandler) LinkSetDown(link netlink.Link) error

func (*MockNetworkHandler) LinkSetUp

func (_m *MockNetworkHandler) LinkSetUp(link netlink.Link) error

func (*MockNetworkHandler) ParseAddr

func (_m *MockNetworkHandler) ParseAddr(s string) (*netlink.Addr, error)

func (*MockNetworkHandler) RouteList

func (_m *MockNetworkHandler) RouteList(link netlink.Link, family int) ([]netlink.Route, error)

func (*MockNetworkHandler) StartDHCP

func (_m *MockNetworkHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr)

type NetworkHandler

type NetworkHandler interface {
	LinkByName(name string) (netlink.Link, error)
	AddrList(link netlink.Link, family int) ([]netlink.Addr, error)
	RouteList(link netlink.Link, family int) ([]netlink.Route, error)
	AddrDel(link netlink.Link, addr *netlink.Addr) error
	AddrAdd(link netlink.Link, addr *netlink.Addr) error
	LinkSetDown(link netlink.Link) error
	LinkSetUp(link netlink.Link) error
	LinkAdd(link netlink.Link) error
	ParseAddr(s string) (*netlink.Addr, error)
	ChangeMacAddr(iface string) (net.HardwareAddr, error)
	GetMacDetails(iface string) (net.HardwareAddr, error)
	StartDHCP(nic *VIF, serverAddr *netlink.Addr)
}
var Handler NetworkHandler

type NetworkUtilsHandler

type NetworkUtilsHandler struct{}

func (*NetworkUtilsHandler) AddrAdd

func (h *NetworkUtilsHandler) AddrAdd(link netlink.Link, addr *netlink.Addr) error

func (*NetworkUtilsHandler) AddrDel

func (h *NetworkUtilsHandler) AddrDel(link netlink.Link, addr *netlink.Addr) error

func (*NetworkUtilsHandler) AddrList

func (h *NetworkUtilsHandler) AddrList(link netlink.Link, family int) ([]netlink.Addr, error)

func (*NetworkUtilsHandler) ChangeMacAddr

func (h *NetworkUtilsHandler) ChangeMacAddr(iface string) (net.HardwareAddr, error)

ChangeMacAddr changes the MAC address for a agiven interface

func (*NetworkUtilsHandler) GetMacDetails

func (h *NetworkUtilsHandler) GetMacDetails(iface string) (net.HardwareAddr, error)

GetMacDetails from an interface

func (*NetworkUtilsHandler) LinkAdd

func (h *NetworkUtilsHandler) LinkAdd(link netlink.Link) error

func (*NetworkUtilsHandler) LinkByName

func (h *NetworkUtilsHandler) LinkByName(name string) (netlink.Link, error)

func (*NetworkUtilsHandler) LinkSetDown

func (h *NetworkUtilsHandler) LinkSetDown(link netlink.Link) error

func (*NetworkUtilsHandler) LinkSetUp

func (h *NetworkUtilsHandler) LinkSetUp(link netlink.Link) error

func (*NetworkUtilsHandler) ParseAddr

func (h *NetworkUtilsHandler) ParseAddr(s string) (*netlink.Addr, error)

func (*NetworkUtilsHandler) RouteList

func (h *NetworkUtilsHandler) RouteList(link netlink.Link, family int) ([]netlink.Route, error)

func (*NetworkUtilsHandler) StartDHCP

func (h *NetworkUtilsHandler) StartDHCP(nic *VIF, serverAddr *netlink.Addr)

type VIF

type VIF struct {
	Name    string
	IP      netlink.Addr
	MAC     net.HardwareAddr
	Gateway net.IP
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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