fake

package
v1.17.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package fake is a fake datapath implementation. It does not implement any datapath specific concepts and is useful for mocking and testing.

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"fake-datapath",
	"Fake Datapath",

	cell.Provide(
		func(lifecycle cell.Lifecycle, na types.NodeAddressing, nodeManager manager.NodeManager) (types.NodeIDHandler, types.NodeHandler, types.NodeNeighbors, *fakeTypes.FakeNodeHandler) {
			fakeNodeHandler := fakeTypes.NewNodeHandler()
			nodeManager.Subscribe(fakeNodeHandler)
			return fakeNodeHandler, fakeNodeHandler, fakeNodeHandler, fakeNodeHandler
		},
		func(lifecycle cell.Lifecycle, na types.NodeAddressing, nodeManager manager.NodeManager) (types.LBMap, *mockmaps.LBMockMap) {
			lbMap := mockmaps.NewLBMockMap()
			return lbMap, lbMap
		},
		func() signalmap.Map { return fakesignalmap.NewFakeSignalMap([][]byte{}, time.Second) },
		func() authmap.Map { return fakeauthmap.NewFakeAuthMap() },
		func() egressmap.PolicyMap { return nil },
		func() *bigtcp.Configuration { return &bigtcp.Configuration{} },
		func() types.IptablesManager { return &fakeTypes.FakeIptablesManager{} },
		func() ipset.Manager { return &fakeTypes.IPSet{} },
		func() types.BandwidthManager { return &fakeTypes.BandwidthManager{} },
		func() types.IPsecKeyCustodian { return &ipsecKeyCustodian{} },
		func() mtu.MTU { return &fakeTypes.MTU{} },
		func() *wg.Agent { return nil },
		func() types.Loader { return &fakeTypes.FakeLoader{} },
		func() types.Orchestrator { return &fakeTypes.FakeOrchestrator{} },
		loader.NewCompilationLock,
		func() sysctl.Sysctl { return &Sysctl{} },
		func() (promise.Promise[nat.NatMap4], promise.Promise[nat.NatMap6]) {
			r4, p4 := promise.New[nat.NatMap4]()
			r6, p6 := promise.New[nat.NatMap6]()
			r4.Reject(nat.MapDisabled)
			r6.Reject(nat.MapDisabled)
			return p4, p6
		},

		tables.NewDeviceTable,
		tables.NewL2AnnounceTable, statedb.RWTable[*tables.L2AnnounceEntry].ToTable,
		tables.NewRouteTable, statedb.RWTable[*tables.Route].ToTable,
	),

	tables.NodeAddressCell,
	datapath.NodeAddressingCell,
	tables.DirectRoutingDeviceCell,

	cell.Invoke(
		statedb.RegisterTable[*tables.Device],
		statedb.RegisterTable[*tables.L2AnnounceEntry],
		statedb.RegisterTable[*tables.Route],
	),

	tunnel.Cell,
	cell.Provide(fakeDevices),
)

Cell provides a fake version of the datapath cell.

Used in integration tests in daemon/cmd and test/controlplane.

Functions

This section is empty.

Types

type Sysctl added in v1.16.0

type Sysctl struct{}

func (*Sysctl) ApplySettings added in v1.16.0

func (sysctl *Sysctl) ApplySettings(sysSettings []tables.Sysctl) error

func (*Sysctl) Disable added in v1.16.0

func (sysctl *Sysctl) Disable(name []string) error

func (*Sysctl) Enable added in v1.16.0

func (sysctl *Sysctl) Enable(name []string) error

func (*Sysctl) Read added in v1.16.0

func (sysctl *Sysctl) Read(name []string) (string, error)

func (*Sysctl) ReadInt added in v1.16.0

func (sysctl *Sysctl) ReadInt(name []string) (int64, error)

func (*Sysctl) Write added in v1.16.0

func (sysctl *Sysctl) Write(name []string, val string) error

func (*Sysctl) WriteInt added in v1.16.0

func (sysctl *Sysctl) WriteInt(name []string, val int64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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