fakes

package
v1.15.22 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 16 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) AttachIPConfigsHandlerMiddleware added in v1.5.19

func (fake *HTTPServiceFake) AttachIPConfigsHandlerMiddleware(cns.IPConfigsHandlerMiddleware)

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) MarkNIPsPendingRelease added in v1.5.21

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

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) MarkNIPsPendingRelease added in v1.5.21

func (ipm *IPStateManager) MarkNIPsPendingRelease(n 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 {
	SupportedAPIsF    func(context.Context) ([]string, error)
	GetNCVersionListF func(context.Context) (nmagent.NCVersionList, error)
	GetHomeAzF        func(context.Context) (nmagent.AzResponse, error)
}

NMAgentClientFake can be used to query to VM Host info.

func (*NMAgentClientFake) GetHomeAz

func (*NMAgentClientFake) GetNCVersionList

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

func (*NMAgentClientFake) SupportedAPIs

func (n *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

type WireserverProxyFake

type WireserverProxyFake struct {
	JoinNetworkFunc func(context.Context, string) (*http.Response, error)
	PublishNCFunc   func(context.Context, cns.NetworkContainerParameters, []byte) (*http.Response, error)
	UnpublishNCFunc func(context.Context, cns.NetworkContainerParameters, []byte) (*http.Response, error)
}

func (*WireserverProxyFake) JoinNetwork

func (w *WireserverProxyFake) JoinNetwork(ctx context.Context, vnetID string) (*http.Response, error)

func (*WireserverProxyFake) PublishNC

func (w *WireserverProxyFake) PublishNC(ctx context.Context, ncParams cns.NetworkContainerParameters, payload []byte) (*http.Response, error)

func (*WireserverProxyFake) UnpublishNC

func (w *WireserverProxyFake) UnpublishNC(ctx context.Context, ncParams cns.NetworkContainerParameters, payload []byte) (*http.Response, error)

Jump to

Keyboard shortcuts

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