fakes

package
v1.4.39 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HostPrimaryIP 10.0.0.4
	HostPrimaryIP = "10.0.0.4"
	// HostSubnet 10.0.0.0/24
	HostSubnet = "10.0.0.0/24"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServiceFake

type HTTPServiceFake struct {
	IPStateManager IPStateManager
	PoolMonitor    cns.IPAMPoolMonitor
}

func NewHTTPServiceFake

func NewHTTPServiceFake() *HTTPServiceFake

func (*HTTPServiceFake) GetAssignedIPConfigs

func (fake *HTTPServiceFake) GetAssignedIPConfigs() []cns.IPConfigurationStatus

func (*HTTPServiceFake) GetAvailableIPConfigs

func (fake *HTTPServiceFake) GetAvailableIPConfigs() []cns.IPConfigurationStatus

func (*HTTPServiceFake) GetOption

func (fake *HTTPServiceFake) GetOption(string) interface{}

func (*HTTPServiceFake) GetPendingProgramIPConfigs

func (fake *HTTPServiceFake) GetPendingProgramIPConfigs() []cns.IPConfigurationStatus

func (*HTTPServiceFake) GetPendingReleaseIPConfigs

func (fake *HTTPServiceFake) GetPendingReleaseIPConfigs() []cns.IPConfigurationStatus

func (*HTTPServiceFake) GetPodIPConfigState

func (fake *HTTPServiceFake) GetPodIPConfigState() map[string]cns.IPConfigurationStatus

Return union of all state maps

func (*HTTPServiceFake) Init

func (*HTTPServiceFake) MarkIPAsPendingRelease

func (fake *HTTPServiceFake) MarkIPAsPendingRelease(numberToMark int) (map[string]cns.IPConfigurationStatus, error)

TODO: Populate on scale down

func (*HTTPServiceFake) SendNCSnapShotPeriodically

func (fake *HTTPServiceFake) SendNCSnapShotPeriodically(context.Context, int)

func (*HTTPServiceFake) SetNodeOrchestrator

func (fake *HTTPServiceFake) SetNodeOrchestrator(*cns.SetOrchestratorTypeRequest)

func (*HTTPServiceFake) SetNumberOfAssignedIPs

func (fake *HTTPServiceFake) SetNumberOfAssignedIPs(assign int) error

func (*HTTPServiceFake) SetOption

func (fake *HTTPServiceFake) SetOption(string, interface{})

func (*HTTPServiceFake) Start

func (fake *HTTPServiceFake) Start(*common.ServiceConfig) error

func (*HTTPServiceFake) Stop

func (fake *HTTPServiceFake) Stop()

func (*HTTPServiceFake) SyncHostNCVersion

func (fake *HTTPServiceFake) SyncHostNCVersion(context.Context, string, time.Duration)

SyncHostNCVersion will update HostVersion in containerstatus.

func (*HTTPServiceFake) SyncNodeStatus

type IPStateManager

type IPStateManager struct {
	PendingProgramIPConfigState map[string]cns.IPConfigurationStatus
	AvailableIPConfigState      map[string]cns.IPConfigurationStatus
	AssignedIPConfigState       map[string]cns.IPConfigurationStatus
	PendingReleaseIPConfigState map[string]cns.IPConfigurationStatus
	AvailableIPIDStack          StringStack
	sync.RWMutex
}

func NewIPStateManager

func NewIPStateManager() IPStateManager

func (*IPStateManager) AddIPConfigs

func (ipm *IPStateManager) AddIPConfigs(ipconfigs []cns.IPConfigurationStatus)

func (*IPStateManager) MarkIPAsPendingRelease

func (ipm *IPStateManager) MarkIPAsPendingRelease(numberOfIPsToMark int) (map[string]cns.IPConfigurationStatus, error)

func (*IPStateManager) ReleaseIPConfig

func (ipm *IPStateManager) ReleaseIPConfig(ipconfigID string) (cns.IPConfigurationStatus, error)

func (*IPStateManager) RemovePendingReleaseIPConfigs

func (ipm *IPStateManager) RemovePendingReleaseIPConfigs(ipconfigNames []string)

func (*IPStateManager) ReserveIPConfig

func (ipm *IPStateManager) ReserveIPConfig() (cns.IPConfigurationStatus, error)

type MonitorFake

type MonitorFake struct {
	IPsNotInUseCount  int64
	NodeNetworkConfig *v1alpha.NodeNetworkConfig
}

func (*MonitorFake) GetStateSnapshot

func (f *MonitorFake) GetStateSnapshot() cns.IpamPoolMonitorStateSnapshot

func (*MonitorFake) Reconcile

func (*MonitorFake) Reconcile() error

func (*MonitorFake) Start

func (*MonitorFake) Start(ctx context.Context) error

func (*MonitorFake) Update

func (f *MonitorFake) Update(nnc *v1alpha.NodeNetworkConfig) error

type NMAgentClientFake

type NMAgentClientFake struct {
	PutNetworkContainerF    func(context.Context, *nmagent.PutNetworkContainerRequest) error
	DeleteNetworkContainerF func(context.Context, nmagent.DeleteContainerRequest) error
	JoinNetworkF            func(context.Context, nmagent.JoinNetworkRequest) error
	SupportedAPIsF          func(context.Context) ([]string, error)
	GetNCVersionF           func(context.Context, nmagent.NCVersionRequest) (nmagent.NCVersion, error)
	GetNCVersionListF       func(context.Context) (nmagent.NCVersionList, error)
}

NMAgentClientFake can be used to query to VM Host info.

func (*NMAgentClientFake) DeleteNetworkContainer added in v1.4.38

func (c *NMAgentClientFake) DeleteNetworkContainer(ctx context.Context, req nmagent.DeleteContainerRequest) error

func (*NMAgentClientFake) GetNCVersion added in v1.4.38

func (*NMAgentClientFake) GetNCVersionList

func (c *NMAgentClientFake) GetNCVersionList(ctx context.Context) (nmagent.NCVersionList, error)

func (*NMAgentClientFake) JoinNetwork added in v1.4.38

func (*NMAgentClientFake) PutNetworkContainer added in v1.4.38

func (c *NMAgentClientFake) PutNetworkContainer(ctx context.Context, req *nmagent.PutNetworkContainerRequest) error

func (*NMAgentClientFake) SupportedAPIs

func (c *NMAgentClientFake) SupportedAPIs(ctx context.Context) ([]string, error)

type RequestControllerFake

type RequestControllerFake struct {
	NNC *v1alpha.NodeNetworkConfig
	// contains filtered or unexported fields
}

func NewRequestControllerFake

func NewRequestControllerFake(cnsService *HTTPServiceFake, scalar v1alpha.Scaler, subnetAddressSpace string, numberOfIPConfigs int64) *RequestControllerFake

func (*RequestControllerFake) CarveIPConfigsAndAddToStatusAndCNS

func (rc *RequestControllerFake) CarveIPConfigsAndAddToStatusAndCNS(numberOfIPConfigs int64) []cns.IPConfigurationStatus

func (*RequestControllerFake) Init

func (*RequestControllerFake) IsStarted

func (rc *RequestControllerFake) IsStarted() bool

func (*RequestControllerFake) Reconcile

func (rc *RequestControllerFake) Reconcile(removePendingReleaseIPs bool) error

func (*RequestControllerFake) Start

type StringStack

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

func NewStack

func NewStack() *StringStack

func (*StringStack) Pop

func (stack *StringStack) Pop() (string, error)

func (*StringStack) Push

func (stack *StringStack) Push(v string)

type WireserverClientFake

type WireserverClientFake struct{}

func (*WireserverClientFake) GetInterfaces

Jump to

Keyboard shortcuts

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