networkutils

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteCommand

func ExecuteCommand(command string) (string, error)

func SetupNetworkFakeHelper

func SetupNetworkFakeHelper()

func SetupNetworkHelper

func SetupNetworkHelper()

func UpdateLinkIPAddrAndLease added in v1.0.5

func UpdateLinkIPAddrAndLease(nic *rpc.HostNic) error

Types

type NetworkUtils

type NetworkUtils struct {
}

func (NetworkUtils) CheckAndRepairNetwork

func (n NetworkUtils) CheckAndRepairNetwork(nic *rpc.HostNic) (rpc.Phase, error)

func (NetworkUtils) CleanupNetwork

func (n NetworkUtils) CleanupNetwork(nic *rpc.HostNic) error

After the Response is uninstalled, the relevant routes are cleared, so you only need to delete the rule.

func (NetworkUtils) CleanupPodNetwork

func (n NetworkUtils) CleanupPodNetwork(nic *rpc.HostNic, podIP string) error

After the Response is uninstalled, the relevant routes are cleared, so you only need to delete the rule.

func (NetworkUtils) IsNSorErr

func (n NetworkUtils) IsNSorErr(nspath string) error

func (NetworkUtils) LinkByMacAddr

func (n NetworkUtils) LinkByMacAddr(macAddr string) (netlink.Link, error)

should check result, maybe empty

func (NetworkUtils) SetupNetwork

func (n NetworkUtils) SetupNetwork(nic *rpc.HostNic) (rpc.Phase, error)

Note: setup NetworkManager to disable dhcp on nic SetupNicNetwork adds default route to route table (nic-<nic_table>)

func (NetworkUtils) SetupPodNetwork

func (n NetworkUtils) SetupPodNetwork(nic *rpc.HostNic, ip string) error

type NetworkUtilsFake

type NetworkUtilsFake struct {
	Links  map[string]netlink.Link
	Rules  map[string]netlink.Rule
	Routes map[int][]netlink.Route
}

func (NetworkUtilsFake) CheckAndRepairNetwork

func (n NetworkUtilsFake) CheckAndRepairNetwork(nic *rpc.HostNic) (rpc.Phase, error)

func (NetworkUtilsFake) CleanupNetwork

func (n NetworkUtilsFake) CleanupNetwork(nic *rpc.HostNic) error

func (NetworkUtilsFake) CleanupPodNetwork

func (n NetworkUtilsFake) CleanupPodNetwork(nic *rpc.HostNic, ip string) error

func (NetworkUtilsFake) IsNSorErr

func (n NetworkUtilsFake) IsNSorErr(nspath string) error

func (NetworkUtilsFake) LinkByMacAddr

func (n NetworkUtilsFake) LinkByMacAddr(macAddr string) (netlink.Link, error)

func (NetworkUtilsFake) SetupNetwork

func (n NetworkUtilsFake) SetupNetwork(nic *rpc.HostNic) (rpc.Phase, error)

func (NetworkUtilsFake) SetupPodNetwork

func (n NetworkUtilsFake) SetupPodNetwork(nic *rpc.HostNic, ip string) error

type NetworkUtilsWrap

type NetworkUtilsWrap interface {
	// for hostnic-node
	SetupNetwork(nic *rpc.HostNic) (rpc.Phase, error)
	CleanupNetwork(nic *rpc.HostNic) error
	CheckAndRepairNetwork(nic *rpc.HostNic) (rpc.Phase, error)

	// for hostnic-cni
	SetupPodNetwork(nic *rpc.HostNic, ip string) error
	CleanupPodNetwork(nic *rpc.HostNic, ip string) error

	LinkByMacAddr(macAddr string) (netlink.Link, error)
	IsNSorErr(nspath string) error
}
var (
	NetworkHelper NetworkUtilsWrap
)

Jump to

Keyboard shortcuts

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