platform

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 13 Imported by: 15

Documentation

Index

Constants

View Source
const (
	// CNMRuntimePath is the path where CNM state files are stored.
	CNMRuntimePath = "/var/lib/azure-network/"
	// CNIRuntimePath is the path where CNI state files are stored.
	CNIRuntimePath = "/var/run/"
	// CNILockPath is the path where CNI lock files are stored.
	CNILockPath = "/var/run/azure-vnet/"
	// CNIStateFilePath is the path to the CNI state file
	CNIStateFilePath = "/var/run/azure-vnet.json"
	// CNIIpamStatePath is the name of IPAM state file
	CNIIpamStatePath = "/var/run/azure-vnet-ipam.json"
	// CNIBinaryPath is the path to the CNI binary
	CNIBinaryPath = "/opt/cni/bin/azure-vnet"
	// CNSRuntimePath is the path where CNS state files are stored.
	CNSRuntimePath = "/var/run/"
	// CNI runtime path on a Kubernetes cluster
	K8SCNIRuntimePath = "/opt/cni/bin"
	// Network configuration file path on a Kubernetes cluster
	K8SNetConfigPath = "/etc/cni/net.d"
	// NPMRuntimePath is the path where NPM logging files are stored.
	NPMRuntimePath = "/var/run/"
	// DNCRuntimePath is the path where DNC logging files are stored.
	DNCRuntimePath = "/var/run/"
)

Variables

View Source
var ErrMockExec = errors.New("mock exec error")

ErrMockExec - mock exec error

Functions

func CheckIfFileExists

func CheckIfFileExists(filepath string) (bool, error)

func ConvertStringToIPAddress

func ConvertStringToIPAddress(address string) net.IP

ConvertStringToIPAddress converts the given IP address string to a net.IP object. The input string can be in regular dotted notation or CIDR notation.

func ConvertStringToIPNet

func ConvertStringToIPNet(address string) (*net.IPNet, error)

ConvertStringToIPNet converts the given IP address string to a net.IPNet object.

func CreateDirectory

func CreateDirectory(dirPath string) error

func GenerateAddress

func GenerateAddress(subnet *net.IPNet, hostID net.IP) net.IP

GenerateAddress generates an IP address from the given network and host ID.

func GetOSDetails

func GetOSDetails() (map[string]string, error)

func GetOSInfo

func GetOSInfo() string

GetOSInfo returns OS version information.

func GetProcessNameByID

func GetProcessNameByID(pidstr string) (string, error)

func GetProcessSupport

func GetProcessSupport() error

func HasMellanoxAdapter

func HasMellanoxAdapter() bool

Mellanox adapter not applicable for linux

func MonitorAndSetMellanoxRegKeyPriorityVLANTag

func MonitorAndSetMellanoxRegKeyPriorityVLANTag(_ context.Context, _ int)

Not needed for Linux

func PrintDependencyPackageDetails

func PrintDependencyPackageDetails()

func ReadFileByLines

func ReadFileByLines(filename string) ([]string, error)

ReadFileByLines reads file line by line and return array of lines.

func ReplaceFile

func ReplaceFile(source, destination string) error

func SetOutboundSNAT

func SetOutboundSNAT(subnet string) error

func SetSdnRemoteArpMacAddress

func SetSdnRemoteArpMacAddress(_ ExecClient) error

SetSdnRemoteArpMacAddress sets the regkey for SDNRemoteArpMacAddress needed for multitenancy This operation is specific to windows OS

Types

type AddressFamily

type AddressFamily int

AddressFamily specifies a protocol address family number.

const (
	AfUnspec AddressFamily = 0
	AfINET   AddressFamily = 0x2
	AfINET6  AddressFamily = 0xa
)

func GetAddressFamily

func GetAddressFamily(address *net.IP) AddressFamily

GetAddressFamily returns the address family of an IP address.

type ExecClient

type ExecClient interface {
	ExecuteCommand(command string) (string, error)
	GetLastRebootTime() (time.Time, error)
	ClearNetworkConfiguration() (bool, error)
	ExecutePowershellCommand(command string) (string, error)
	KillProcessByName(processName string) error
}

func NewExecClient

func NewExecClient(logger *zap.Logger) ExecClient

func NewExecClientTimeout

func NewExecClientTimeout(timeout time.Duration) ExecClient

type MockExecClient

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

func NewMockExecClient

func NewMockExecClient(returnErr bool) *MockExecClient

func (*MockExecClient) ClearNetworkConfiguration

func (e *MockExecClient) ClearNetworkConfiguration() (bool, error)

func (*MockExecClient) ExecuteCommand

func (e *MockExecClient) ExecuteCommand(cmd string) (string, error)

func (*MockExecClient) ExecutePowershellCommand

func (e *MockExecClient) ExecutePowershellCommand(cmd string) (string, error)

func (*MockExecClient) GetLastRebootTime

func (e *MockExecClient) GetLastRebootTime() (time.Time, error)

func (*MockExecClient) KillProcessByName

func (e *MockExecClient) KillProcessByName(_ string) error

func (*MockExecClient) SetExecCommand

func (e *MockExecClient) SetExecCommand(fn execCommandValidator)

func (*MockExecClient) SetPowershellCommandResponder

func (e *MockExecClient) SetPowershellCommandResponder(fn powershellCommandResponder)

Directories

Path Synopsis
windows
adapter/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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