addressset

package
v0.0.0-...-12c5f08 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const FakeASFError = "fake asf error"

Variables

This section is empty.

Functions

func GetHashNamesForAS

func GetHashNamesForAS(dbIDs *libovsdbops.DbObjectIDs) (string, string)

GetHashNamesForAS returns hashed address set names for given dbIDs for both ip families. Can be used to cleanup e.g. address set references if the address set was deleted.

func GetTestDbAddrSets

func GetTestDbAddrSets(dbIDs *libovsdbops.DbObjectIDs, addresses []string) (*nbdb.AddressSet, *nbdb.AddressSet)

GetTestDbAddrSets returns nbdb.AddressSet objects both for ipv4 and ipv6, regardless of current config. May only be used for testing.

Types

type AddressSet

type AddressSet interface {
	// GetASHashNames returns the hashed name for v6 and v4 addressSets
	GetASHashNames() (string, string)
	// GetName returns the descriptive name of the address set
	GetName() string
	// AddAddresses adds the slice of addresses to the address set
	AddAddresses(addresses []string) error
	// AddAddressesReturnOps returns the ops needed to add the slice of addresses to the address set
	AddAddressesReturnOps(addresses []string) ([]ovsdb.Operation, error)
	// GetAddresses gets the list of v4 & v6 addresses from the address set
	GetAddresses() ([]string, []string)
	// SetAddresses sets the address set to the given slice of addresses
	SetAddresses(addresses []string) error
	// DeleteAddresses deletes the provided slice of addresses from the address set
	DeleteAddresses(addresses []string) error
	// DeleteAddressesReturnOps returns the ops needed to delete the slice of addresses from the address set
	DeleteAddressesReturnOps(addresses []string) ([]ovsdb.Operation, error)
	// Destroy deletes the entire address set
	Destroy() error
}

AddressSet is an interface for address set objects

type AddressSetFactory

type AddressSetFactory interface {
	// NewAddressSet returns a new object that implements AddressSet
	// and contains the given slice of addresses which today can be string
	// representations of net.IPs or net.IPNets, or an error. Internally it creates
	// an address set for v4 and v6 families each.
	NewAddressSet(dbIDs *libovsdbops.DbObjectIDs, addresses []string) (AddressSet, error)
	// NewAddressSetOps returns a new object that implements AddressSet
	// and contains the given slice of addresses which today can be string
	// representations of net.IPs or net.IPNets, or an error. Internally it creates
	// ops to create an address set for for v4 and v6 families each.
	NewAddressSetOps(dbIDs *libovsdbops.DbObjectIDs, addresses []string) (AddressSet, []ovsdb.Operation, error)
	// EnsureAddressSet makes sure that an address set object exists in ovn
	// with the given dbIDs.
	EnsureAddressSet(dbIDs *libovsdbops.DbObjectIDs) (AddressSet, error)
	// ProcessEachAddressSet calls the given function for each address set of type dbIDsType owned by given ownerController.
	ProcessEachAddressSet(ownerController string, dbIDsType *libovsdbops.ObjectIDsType, iteratorFn AddressSetIterFunc) error
	// DestroyAddressSet deletes the address sets with given dbIDs.
	DestroyAddressSet(dbIDs *libovsdbops.DbObjectIDs) error
	// GetAddressSet returns the address-set that matches the given dbIDs
	GetAddressSet(dbIDs *libovsdbops.DbObjectIDs) (AddressSet, error)
}

AddressSetFactory is an interface for managing address set objects.

func NewOvnAddressSetFactory

func NewOvnAddressSetFactory(nbClient libovsdbclient.Client, v4Mode, v6Mode bool) AddressSetFactory

NewOvnAddressSetFactory creates a new AddressSetFactory backed by address set objects that execute OVN commands

type AddressSetIterFunc

type AddressSetIterFunc func(dbIDs *libovsdbops.DbObjectIDs) error

type FakeAddressSetFactory

type FakeAddressSetFactory struct {
	// ControllerName is stored here for convenience, it is used to build dbIDs for fake-only methods like
	// AddressSetExists, EventuallyExpectAddressSet, etc.
	ControllerName string

	sync.Mutex
	// contains filtered or unexported fields
}

func NewFakeAddressSetFactory

func NewFakeAddressSetFactory(controllerName string) *FakeAddressSetFactory

func (*FakeAddressSetFactory) AddressSetExists

func (f *FakeAddressSetFactory) AddressSetExists(dbIDsOrNsName any) bool

func (*FakeAddressSetFactory) DestroyAddressSet

func (f *FakeAddressSetFactory) DestroyAddressSet(dbIDs *libovsdbops.DbObjectIDs) error

func (*FakeAddressSetFactory) EnsureAddressSet

func (f *FakeAddressSetFactory) EnsureAddressSet(dbIDs *libovsdbops.DbObjectIDs) (AddressSet, error)

EnsureAddressSet returns set object

func (*FakeAddressSetFactory) ErrOnNextNewASCall

func (f *FakeAddressSetFactory) ErrOnNextNewASCall()

ErrOnNextNewASCall will make FakeAddressSetFactory return FakeASFError on the next NewAddressSet call

func (*FakeAddressSetFactory) EventuallyExpectAddressSet

func (f *FakeAddressSetFactory) EventuallyExpectAddressSet(dbIDsOrNsName any)

EventuallyExpectAddressSet ensures the named address set eventually exists

func (*FakeAddressSetFactory) EventuallyExpectAddressSetWithAddresses

func (f *FakeAddressSetFactory) EventuallyExpectAddressSetWithAddresses(dbIDsOrNsName any, addresses []string)

func (*FakeAddressSetFactory) EventuallyExpectEmptyAddressSetExist

func (f *FakeAddressSetFactory) EventuallyExpectEmptyAddressSetExist(dbIDsOrNsName any)

EventuallyExpectEmptyAddressSetExist ensures the named address set eventually exists with no Addresses

func (*FakeAddressSetFactory) EventuallyExpectNoAddressSet

func (f *FakeAddressSetFactory) EventuallyExpectNoAddressSet(dbIDsOrNsName any)

EventuallyExpectNoAddressSet ensures the named address set eventually does not exist For namespaces address set deletion is delayed by 20 seconds, it is only tested once in namespace_test to not slow down tests. Don't use for namespace-owned address sets

func (*FakeAddressSetFactory) ExpectAddressSetWithAddresses

func (f *FakeAddressSetFactory) ExpectAddressSetWithAddresses(dbIDsOrNsName any, addresses []string)

ExpectAddressSetWithAddresses ensure address set exists with the given set of ips. Address set is identified by dbIDsOrNsName, which may be a namespace name (string) or a *libovsdbops.DbObjectIDs.

func (*FakeAddressSetFactory) ExpectEmptyAddressSet

func (f *FakeAddressSetFactory) ExpectEmptyAddressSet(dbIDsOrNsName any)

ExpectEmptyAddressSet ensures the address set owned by dbIDsOrNsName exists with no Addresses

func (*FakeAddressSetFactory) ExpectNumberOfAddressSets

func (f *FakeAddressSetFactory) ExpectNumberOfAddressSets(n int)

ExpectNumberOfAddressSets ensures the number of created address sets equals given number

func (*FakeAddressSetFactory) GetAddressSet

func (f *FakeAddressSetFactory) GetAddressSet(dbIDs *libovsdbops.DbObjectIDs) (AddressSet, error)

GetAddressSet returns set object

func (*FakeAddressSetFactory) NewAddressSet

func (f *FakeAddressSetFactory) NewAddressSet(dbIDs *libovsdbops.DbObjectIDs, addresses []string) (AddressSet, error)

NewAddressSet returns a new address set object

func (*FakeAddressSetFactory) NewAddressSetOps

func (f *FakeAddressSetFactory) NewAddressSetOps(dbIDs *libovsdbops.DbObjectIDs, addresses []string) (AddressSet, []ovsdb.Operation, error)

NewAddressSetOps returns a new address set object

func (*FakeAddressSetFactory) ProcessEachAddressSet

func (f *FakeAddressSetFactory) ProcessEachAddressSet(ownerController string, indexT *libovsdbops.ObjectIDsType, iteratorFn AddressSetIterFunc) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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