addressset

package
v6.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ACLNetworkUsage

func ACLNetworkUsage(s *state.State, aclProjectName string, aclNames []string, aclNets map[string]NetworkACLUsage) error

ACLNetworkUsage populates the provided aclNets map with networks that are using any of the specified ACLs.

func ACLUsedBy

func ACLUsedBy(s *state.State, aclProjectName string, usageFunc func(ctx context.Context, tx *db.ClusterTx, matchedACLNames []string, usageType any, nicName string, nicConfig map[string]string) error, matchACLNames ...string) error

ACLUsedBy finds all networks, profiles and instance NICs that use any of the specified ACLs and executes usageFunc once for each resource using one or more of the ACLs with info about the resource and matched ACLs being used.

func ACLisInUseByDevice

func ACLisInUseByDevice(d deviceConfig.Device, matchACLNames ...string) []string

ACLisInUseByDevice returns any of the supplied matching ACL names found referenced by the NIC device.

func AddressSetNetworkUsage

func AddressSetNetworkUsage(s *state.State, projectName string, addressSetName string, addresses []string, asNets map[string]AddressSetUsage) error

AddressSetNetworkUsage retrieve the networks that use an address set by checking ACLs.

func AddressSetUsedBy

func AddressSetUsedBy(s *state.State, projectName string, usageFunc func(aclName string) error, addressSetName string) error

AddressSetUsedBy calls usageFunc for each ACL that references the specified address set name.

func Create

func Create(s *state.State, projectName string, asInfo *api.NetworkAddressSetsPost) error

Create validates supplied record and creates a new network address set record in the database.

func Exists

func Exists(s *state.State, projectName string, name ...string) error

Exists checks the address set name(s) provided exist in the project. If multiple names are provided, also checks that duplicate names aren't specified in the list.

func FirewallAddressSets

func FirewallAddressSets(s *state.State, addrSetProjectName string) ([]firewallDrivers.AddressSet, error)

FirewallAddressSets returns address sets for a network firewall.

func FirewallApplyAddressSets

func FirewallApplyAddressSets(s *state.State, projectName string, addressSet AddressSetUsage) error

FirewallApplyAddressSets applies address set rules to the network firewall.

func FirewallApplyAddressSetsForACLRules

func FirewallApplyAddressSetsForACLRules(s *state.State, nftTable string, projectName string, ACLNames []string) error

FirewallApplyAddressSetsForACLRules apply address-sets from ACLNames to the correct nft Table.

func GetAddressSetsForACLs

func GetAddressSetsForACLs(s *state.State, projectName string, ACLNames []string) ([]string, error)

GetAddressSetsForACLs return the set of address sets used by given ACLs.

func OVNAddressSetDeleteIfUnused

func OVNAddressSetDeleteIfUnused(s *state.State, l logger.Logger, client *ovn.NB, projectName string, setName string) error

OVNAddressSetDeleteIfUnused checks if the specified address set is unused and if so, removes it from OVN.

func OVNAddressSetsDeleteIfUnused

func OVNAddressSetsDeleteIfUnused(s *state.State, l logger.Logger, client *ovn.NB, projectName string) error

OVNAddressSetsDeleteIfUnused remove all address sets in OVN that are not used.

func OVNDeleteAddressSetsViaACLs

func OVNDeleteAddressSetsViaACLs(s *state.State, l logger.Logger, client *ovn.NB, projectName string, ACLNames []string) error

OVNDeleteAddressSetsViaACLs remove address sets used by network ACLS.

func OVNEnsureAddressSets

func OVNEnsureAddressSets(s *state.State, l logger.Logger, client *ovn.NB, projectName string, addressSetNames []string) (revert.Hook, error)

OVNEnsureAddressSets ensures that the address sets and their addresses are created in OVN NB DB. Returns a revert function to undo changes if needed.

func OVNEnsureAddressSetsViaACLs

func OVNEnsureAddressSetsViaACLs(s *state.State, l logger.Logger, client *ovn.NB, projectName string, ACLNames []string) (revert.Hook, error)

OVNEnsureAddressSetsViaACLs ensure that every address set referenced by given acls are created in OVN NB DB.

func ValidName

func ValidName(name string) error

ValidName checks the address set name is valid.

Types

type AddressSetUsage

type AddressSetUsage struct {
	ID         int
	Name       string
	Type       string
	DeviceName string
	Addresses  []string
	Config     map[string]string
	ACLNames   []string
}

AddressSetUsage holds info about a network using the address set.

type NetworkACLUsage

type NetworkACLUsage struct {
	ID           int64
	Name         string
	Type         string
	Config       map[string]string
	InstanceName string
	DeviceName   string
}

NetworkACLUsage info about a network and what ACL it uses.

type NetworkAddressSet

type NetworkAddressSet interface {

	// Info
	ID() int
	Project() string
	Info() *api.NetworkAddressSet
	Etag() []any
	UsedBy() ([]string, error)

	// Modifications.
	Update(config *api.NetworkAddressSetPut, clientType request.ClientType) error
	Rename(newName string) error
	Delete() error
	// contains filtered or unexported methods
}

NetworkAddressSet represents a network address set.

func LoadByName

func LoadByName(s *state.State, projectName string, name string) (NetworkAddressSet, error)

LoadByName loads and initializes a network address set from the database by project and name.

Jump to

Keyboard shortcuts

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