ops

package
v0.0.0-...-de402c9 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// owner types
	EgressFirewallDNSOwnerType          ownerType = "EgressFirewallDNS"
	EgressFirewallOwnerType             ownerType = "EgressFirewall"
	EgressQoSOwnerType                  ownerType = "EgressQoS"
	AdminNetworkPolicyOwnerType         ownerType = "AdminNetworkPolicy"
	BaselineAdminNetworkPolicyOwnerType ownerType = "BaselineAdminNetworkPolicy"
	// NetworkPolicyOwnerType is deprecated for address sets, should only be used for sync.
	// New owner of network policy address sets, is PodSelectorOwnerType.
	NetworkPolicyOwnerType ownerType = "NetworkPolicy"
	NetpolDefaultOwnerType ownerType = "NetpolDefault"
	PodSelectorOwnerType   ownerType = "PodSelector"
	NamespaceOwnerType     ownerType = "Namespace"
	// HybridNodeRouteOwnerType is transferred from egressgw to apbRoute controller with the same dbIDs
	HybridNodeRouteOwnerType    ownerType = "HybridNodeRoute"
	EgressIPOwnerType           ownerType = "EgressIP"
	EgressServiceOwnerType      ownerType = "EgressService"
	MulticastNamespaceOwnerType ownerType = "MulticastNS"
	MulticastClusterOwnerType   ownerType = "MulticastCluster"
	NetpolNodeOwnerType         ownerType = "NetpolNode"
	NetpolNamespaceOwnerType    ownerType = "NetpolNamespace"
	VirtualMachineOwnerType     ownerType = "VirtualMachine"
	// NetworkPolicyPortIndexOwnerType is the old version of NetworkPolicyOwnerType, kept for sync only
	NetworkPolicyPortIndexOwnerType ownerType = "NetworkPolicyPortIndexOwnerType"
	// ClusterOwnerType means the object is cluster-scoped and doesn't belong to any k8s objects
	ClusterOwnerType ownerType = "Cluster"
	// UDNIsolationOwnerType means the object is needed to implement UserDefinedNetwork isolation
	UDNIsolationOwnerType ownerType = "UDNIsolation"

	// owner extra IDs, make sure to define only 1 ExternalIDKey for every string value
	PriorityKey           ExternalIDKey = "priority"
	PolicyDirectionKey    ExternalIDKey = "direction"
	GressIdxKey           ExternalIDKey = "gress-index"
	IPFamilyKey           ExternalIDKey = "ip-family"
	TypeKey               ExternalIDKey = "type"
	IpKey                 ExternalIDKey = "ip"
	PortPolicyIndexKey    ExternalIDKey = "port-policy-index"
	IpBlockIndexKey       ExternalIDKey = "ip-block-index"
	RuleIndex             ExternalIDKey = "rule-index"
	CIDRKey               ExternalIDKey = types.OvnK8sPrefix + "/cidr"
	PortPolicyProtocolKey ExternalIDKey = "port-policy-protocol"
)

Variables

View Source
var ACLEgressFirewall = newObjectIDsType(acl, EgressFirewallOwnerType, []ExternalIDKey{

	ObjectNameKey,

	RuleIndex,
})
View Source
var ACLMulticastCluster = newObjectIDsType(acl, MulticastClusterOwnerType, []ExternalIDKey{

	TypeKey,

	PolicyDirectionKey,
})
View Source
var ACLMulticastNamespace = newObjectIDsType(acl, MulticastNamespaceOwnerType, []ExternalIDKey{

	ObjectNameKey,

	PolicyDirectionKey,
})
View Source
var ACLNetpolDefault = newObjectIDsType(acl, NetpolDefaultOwnerType, []ExternalIDKey{

	ObjectNameKey,

	PolicyDirectionKey,
})
View Source
var ACLNetpolNamespace = newObjectIDsType(acl, NetpolNamespaceOwnerType, []ExternalIDKey{

	ObjectNameKey,

	PolicyDirectionKey,

	TypeKey,
})
View Source
var ACLNetpolNode = newObjectIDsType(acl, NetpolNodeOwnerType, []ExternalIDKey{

	ObjectNameKey,

	IpKey,
})

ACLNetworkPolicy define a unique index for every network policy ACL. ingress/egress + NetworkPolicy[In/E]gressRule idx - defines given gressPolicy. ACLs are created for gp.portPolicies which are grouped by protocol: - for empty policy (no selectors and no ip blocks) - empty ACL (see allIPsMatch) OR - all selector-based peers ACL - for every IPBlock +1 ACL Therefore unique id for a given gressPolicy is protocol name + IPBlock idx (protocol will be "None" if no port policy is defined, and empty policy and all selector-based peers ACLs will have idx=-1)

ACLNetworkPolicyPortIndex define a unique index for every network policy ACL. ingress/egress + NetworkPolicy[In/E]gressRule idx - defines given gressPolicy. ACLs are created for every gp.portPolicies: - for empty policy (no selectors and no ip blocks) - empty ACL (see allIPsMatch) OR - all selector-based peers ACL - for every IPBlock +1 ACL Therefore unique id for a given gressPolicy is portPolicy idx + IPBlock idx (empty policy and all selector-based peers ACLs will have idx=-1) Note: keep for backward compatibility only Deprecated, should only be used for sync

View Source
var AddressSetAdminNetworkPolicy = newObjectIDsType(addressSet, AdminNetworkPolicyOwnerType, []ExternalIDKey{

	ObjectNameKey,

	PolicyDirectionKey,

	GressIdxKey,
	IPFamilyKey,
})
View Source
var AddressSetBaselineAdminNetworkPolicy = newObjectIDsType(addressSet, BaselineAdminNetworkPolicyOwnerType, []ExternalIDKey{

	ObjectNameKey,

	PolicyDirectionKey,

	GressIdxKey,
	IPFamilyKey,
})
View Source
var AddressSetEgressFirewallDNS = newObjectIDsType(addressSet, EgressFirewallDNSOwnerType, []ExternalIDKey{

	ObjectNameKey,
	IPFamilyKey,
})
View Source
var AddressSetEgressIP = newObjectIDsType(addressSet, EgressIPOwnerType, []ExternalIDKey{

	ObjectNameKey,
	IPFamilyKey,
})
View Source
var AddressSetEgressQoS = newObjectIDsType(addressSet, EgressQoSOwnerType, []ExternalIDKey{

	ObjectNameKey,

	PriorityKey,
	IPFamilyKey,
})
View Source
var AddressSetEgressService = newObjectIDsType(addressSet, EgressServiceOwnerType, []ExternalIDKey{

	ObjectNameKey,
	IPFamilyKey,
})
View Source
var AddressSetHybridNodeRoute = newObjectIDsType(addressSet, HybridNodeRouteOwnerType, []ExternalIDKey{

	ObjectNameKey,
	IPFamilyKey,
})
View Source
var AddressSetNamespace = newObjectIDsType(addressSet, NamespaceOwnerType, []ExternalIDKey{

	ObjectNameKey,
	IPFamilyKey,
})
View Source
var AddressSetNetworkPolicy = newObjectIDsType(addressSet, NetworkPolicyOwnerType, []ExternalIDKey{

	ObjectNameKey,

	PolicyDirectionKey,

	GressIdxKey,
	IPFamilyKey,
})

deprecated, should only be used for sync

View Source
var AddressSetPodSelector = newObjectIDsType(addressSet, PodSelectorOwnerType, []ExternalIDKey{

	ObjectNameKey,
	IPFamilyKey,
})
View Source
var LogicalRouterPolicyEgressIP = newObjectIDsType(logicalRouterPolicy, EgressIPOwnerType, []ExternalIDKey{

	PriorityKey,

	ObjectNameKey,

	IPFamilyKey,
})
View Source
var PortGroupAdminNetworkPolicy = newObjectIDsType(portGroup, AdminNetworkPolicyOwnerType, []ExternalIDKey{

	ObjectNameKey,
})
View Source
var PortGroupBaselineAdminNetworkPolicy = newObjectIDsType(portGroup, BaselineAdminNetworkPolicyOwnerType, []ExternalIDKey{

	ObjectNameKey,
})
View Source
var PortGroupCluster = newObjectIDsType(portGroup, ClusterOwnerType, []ExternalIDKey{

	ObjectNameKey,
})
View Source
var PortGroupNamespace = newObjectIDsType(portGroup, NamespaceOwnerType, []ExternalIDKey{

	ObjectNameKey,
})
View Source
var PortGroupNetpolNamespace = newObjectIDsType(portGroup, NetpolNamespaceOwnerType, []ExternalIDKey{

	ObjectNameKey,

	PolicyDirectionKey,
})

every namespace that has at least 1 network policy, has resources that are shared by all network policies in that namespace.

View Source
var PortGroupNetworkPolicy = newObjectIDsType(portGroup, NetworkPolicyOwnerType, []ExternalIDKey{

	ObjectNameKey,
})
View Source
var PortGroupUDN = newObjectIDsType(portGroup, UDNIsolationOwnerType, []ExternalIDKey{

	ObjectNameKey,
})
View Source
var QoSEgressQoS = newObjectIDsType(qos, EgressQoSOwnerType, []ExternalIDKey{

	PriorityKey,

	ObjectNameKey,
})
View Source
var QoSRuleEgressIP = newObjectIDsType(qos, EgressIPOwnerType, []ExternalIDKey{

	PriorityKey,

	ObjectNameKey,

	IPFamilyKey,
})
View Source
var VirtualMachineDHCPOptions = newObjectIDsType(dhcpOptions, VirtualMachineOwnerType, []ExternalIDKey{

	ObjectNameKey,

	CIDRKey,
})

Functions

func AddACLsToLogicalSwitchOps

func AddACLsToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, acls ...*nbdb.ACL) ([]libovsdb.Operation, error)

AddACLsToLogicalSwitchOps adds the provided ACLs to the provided logical switch and returns the corresponding ops

func AddACLsToPortGroupOps

func AddACLsToPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, acls ...*nbdb.ACL) ([]libovsdb.Operation, error)

AddACLsToPortGroupOps adds the provided ACLs to the provided port group and returns the corresponding ops

func AddAddressesToAddressSetOps

func AddAddressesToAddressSetOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, as *nbdb.AddressSet, addresses ...string) ([]libovsdb.Operation, error)

AddAddressesToAddressSetOps adds the provided addresses to the provided address set and returns the corresponding ops

func AddLoadBalancersToGroupOps

func AddLoadBalancersToGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, group *nbdb.LoadBalancerGroup, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error)

AddLoadBalancersToGroupOps adds the provided load balancers to the provided group and returns the corresponding ops

func AddLoadBalancersToLogicalRouterOps

func AddLoadBalancersToLogicalRouterOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, router *nbdb.LogicalRouter, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error)

AddLoadBalancersToLogicalRouterOps adds the provided load balancers to the provided logical router and returns the corresponding ops

func AddLoadBalancersToLogicalSwitchOps

func AddLoadBalancersToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error)

AddLoadBalancersToLogicalSwitchOps adds the provided load balancers to the provided logical switch and returns the corresponding ops

func AddPortsToPortGroup

func AddPortsToPortGroup(nbClient libovsdbclient.Client, name string, ports ...string) error

AddPortsToPortGroup adds the provided ports to the provided port group

func AddPortsToPortGroupOps

func AddPortsToPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, ports ...string) ([]libovsdb.Operation, error)

func AddQoSesToLogicalSwitchOps

func AddQoSesToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error)

AddQoSesToLogicalSwitchOps returns the ops to add the provided QoSes to the switch

func BuildACL

func BuildACL(name string, direction nbdb.ACLDirection, priority int, match string, action nbdb.ACLAction, meter string,
	severity nbdb.ACLSeverity, log bool, externalIds map[string]string, options map[string]string, tier int) *nbdb.ACL

BuildACL builds an ACL with empty optional properties unset

func BuildDNATAndSNAT

func BuildDNATAndSNAT(
	externalIP *net.IP,
	logicalIP *net.IPNet,
	logicalPort string,
	externalMac string,
	externalIDs map[string]string,
) *nbdb.NAT

BuildDNATAndSNAT builds a logical router DNAT/SNAT

func BuildDNATAndSNATWithMatch

func BuildDNATAndSNATWithMatch(
	externalIP *net.IP,
	logicalIP *net.IPNet,
	logicalPort string,
	externalMac string,
	externalIDs map[string]string,
	match string,
) *nbdb.NAT

func BuildLoadBalancer

func BuildLoadBalancer(name string, protocol nbdb.LoadBalancerProtocol, selectionFields []nbdb.LoadBalancerSelectionFields, vips, options, externalIds map[string]string) *nbdb.LoadBalancer

BuildLoadBalancer builds a load balancer

func BuildNamespaceNameKey

func BuildNamespaceNameKey(namespace, name string) string

func BuildSNAT

func BuildSNAT(
	externalIP *net.IP,
	logicalIP *net.IPNet,
	logicalPort string,
	externalIDs map[string]string,
) *nbdb.NAT

BuildSNAT builds a logical router SNAT

func BuildSNATWithMatch

func BuildSNATWithMatch(
	externalIP *net.IP,
	logicalIP *net.IPNet,
	logicalPort string,
	externalIDs map[string]string,
	match string,
) *nbdb.NAT

func CreateAddressSets

func CreateAddressSets(nbClient libovsdbclient.Client, addrSets ...*nbdb.AddressSet) error

CreateAddressSets creates the provided address sets

func CreateAddressSetsOps

func CreateAddressSetsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, addrSets ...*nbdb.AddressSet) ([]libovsdb.Operation, error)

CreateAddressSetsOps creates the create-ops for the provided address sets

func CreateMeterBandOps

func CreateMeterBandOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, meterBand *nbdb.MeterBand) ([]ovsdb.Operation, error)

CreateMeterBandOps creates the provided meter band if it does not exist

func CreateOrAddNextHopsToLogicalRouterPolicyWithPredicateOps

func CreateOrAddNextHopsToLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, lrp *nbdb.LogicalRouterPolicy, p logicalRouterPolicyPredicate) ([]libovsdb.Operation, error)

CreateOrAddNextHopsToLogicalRouterPolicyWithPredicateOps looks up a logical router policy from the cache based on a given predicate. If it doesn't find any, it creates the provided logical router policy. If it does, adds any missing Nexthops to the existing logical router policy. The logical router policy is added to the provided logical router. Returns the corresponding ops

func CreateOrReplaceLogicalRouterStaticRouteWithPredicate

func CreateOrReplaceLogicalRouterStaticRouteWithPredicate(nbClient libovsdbclient.Client, routerName string,
	lrsr *nbdb.LogicalRouterStaticRoute, p logicalRouterStaticRoutePredicate, fields ...interface{}) error

CreateOrReplaceLogicalRouterStaticRouteWithPredicate looks up a logical router static route from the cache based on a given predicate. If it does not exist, it creates the provided logical router static route. If it does, it updates it. The logical router static route is added to the provided logical router. If more than one route matches the predicate on the router, the additional routes are removed.

func CreateOrUpdateACLs

func CreateOrUpdateACLs(nbClient libovsdbclient.Client, samplingConfig *SamplingConfig, acls ...*nbdb.ACL) error

CreateOrUpdateACLs creates or updates the provided ACLs

func CreateOrUpdateACLsOps

func CreateOrUpdateACLsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, samplingConfig *SamplingConfig, acls ...*nbdb.ACL) ([]libovsdb.Operation, error)

CreateOrUpdateACLsOps creates or updates the provided ACLs returning the corresponding ops

func CreateOrUpdateAddressSets

func CreateOrUpdateAddressSets(nbClient libovsdbclient.Client, addrSets ...*nbdb.AddressSet) error

CreateOrUpdateAddressSets creates or updates the provided address sets

func CreateOrUpdateAddressSetsOps

func CreateOrUpdateAddressSetsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	addrSets ...*nbdb.AddressSet) ([]libovsdb.Operation, error)

func CreateOrUpdateBFDOps

func CreateOrUpdateBFDOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, bfds ...*nbdb.BFD) ([]libovsdb.Operation, error)

CreateOrUpdateBFDOps creates or updates the provided BFDs and returns the corresponding ops

func CreateOrUpdateCOPPsOps

func CreateOrUpdateCOPPsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, copps ...*nbdb.Copp) ([]ovsdb.Operation, error)

CreateOrUpdateCOPPsOps creates or updates the provided COPP returning the corresponding ops

func CreateOrUpdateChassis

func CreateOrUpdateChassis(sbClient libovsdbclient.Client, chassis *sbdb.Chassis, encap *sbdb.Encap) error

CreateOrUpdateChassis creates or updates the chassis record along with the encap record

func CreateOrUpdateChassisTemplateVarOps

func CreateOrUpdateChassisTemplateVarOps(nbClient libovsdbclient.Client,
	ops []libovsdb.Operation, template *nbdb.ChassisTemplateVar) ([]libovsdb.Operation, error)

CreateOrUpdateChassisTemplateVarOps creates or updates the provided 'template' variable and returns the corresponding ops.

func CreateOrUpdateDhcpOptions

func CreateOrUpdateDhcpOptions(nbClient libovsdbclient.Client, lsp *nbdb.LogicalSwitchPort, dhcpIPv4Options, dhcpIPv6Options *nbdb.DHCPOptions) error

func CreateOrUpdateDhcpOptionsOps

func CreateOrUpdateDhcpOptionsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, lsp *nbdb.LogicalSwitchPort, dhcpIPv4Options, dhcpIPv6Options *nbdb.DHCPOptions) ([]libovsdb.Operation, error)

CreateOrUpdateDhcpOptionsOps will configure logical switch port DHCPv4Options and DHCPv6Options fields with options at dhcpv4Options and dhcpv6Options arguments and create/update DHCPOptions objects that matches the pv4 and pv6 predicates. The missing DHCP options will default to nil in the LSP attributes.

func CreateOrUpdateLoadBalancerGroupOps

func CreateOrUpdateLoadBalancerGroupOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, group *nbdb.LoadBalancerGroup) ([]ovsdb.Operation, error)

CreateOrUpdateLoadBalancerGroupOps returns the ops to create or update the provided load balancer group

func CreateOrUpdateLoadBalancersOps

func CreateOrUpdateLoadBalancersOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error)

CreateOrUpdateLoadBalancersOps creates or updates the provided load balancers returning the corresponding ops

func CreateOrUpdateLogicalRouter

func CreateOrUpdateLogicalRouter(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter, fields ...interface{}) error

CreateOrUpdateLogicalRouter creates or updates the provided logical router

func CreateOrUpdateLogicalRouterPolicyWithPredicate

func CreateOrUpdateLogicalRouterPolicyWithPredicate(nbClient libovsdbclient.Client, routerName string, lrp *nbdb.LogicalRouterPolicy, p logicalRouterPolicyPredicate, fields ...interface{}) error

CreateOrUpdateLogicalRouterPolicyWithPredicate looks up a logical router policy from the cache based on a given predicate. If it does not exist, it creates the provided logical router policy. If it does, it updates it. The logical router policy is added to the provided logical router. fields determines which columns to updated. Passing no fields is assumes all fields need to be updated. Passing a single nil field indicates no fields should be updated. Otherwise a caller may pass as many individual fields as desired to specify which columsn need updating.

func CreateOrUpdateLogicalRouterPolicyWithPredicateOps

func CreateOrUpdateLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	routerName string, lrp *nbdb.LogicalRouterPolicy, p logicalRouterPolicyPredicate, fields ...interface{}) ([]libovsdb.Operation, error)

CreateOrUpdateLogicalRouterPolicyWithPredicateOps looks up a logical router policy from the cache based on a given predicate. If it does not exist, it creates the provided logical router policy. If it does, it updates it. The logical router policy is added to the provided logical router. Returns the corresponding ops

func CreateOrUpdateLogicalRouterPort

func CreateOrUpdateLogicalRouterPort(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter,
	lrp *nbdb.LogicalRouterPort, chassis *nbdb.GatewayChassis, fields ...interface{}) error

CreateOrUpdateLogicalRouterPort creates or updates the provided logical router port together with the gateway chassis (if not nil), and adds it to the provided logical router

func CreateOrUpdateLogicalRouterStaticRoutesWithPredicateOps

func CreateOrUpdateLogicalRouterStaticRoutesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	routerName string, lrsr *nbdb.LogicalRouterStaticRoute, p logicalRouterStaticRoutePredicate, fields ...interface{}) ([]libovsdb.Operation, error)

CreateOrUpdateLogicalRouterStaticRoutesWithPredicateOps looks up a logical router static route from the cache based on a given predicate. If it does not exist, it creates the provided logical router static route. If it does, it updates it. The logical router static route is added to the provided logical router. Returns the corresponding ops

func CreateOrUpdateLogicalSwitch

func CreateOrUpdateLogicalSwitch(nbClient libovsdbclient.Client, sw *nbdb.LogicalSwitch, fields ...interface{}) error

CreateOrUpdateLogicalSwitch creates or updates the provided logical switch

func CreateOrUpdateLogicalSwitchPortsAndSwitch

func CreateOrUpdateLogicalSwitchPortsAndSwitch(nbClient libovsdbclient.Client, sw *nbdb.LogicalSwitch, lsps ...*nbdb.LogicalSwitchPort) error

CreateOrUpdateLogicalSwitchPortsAndSwitch creates or updates the provided logical switch ports and adds them to the provided logical switch creating it if it does not exist

func CreateOrUpdateLogicalSwitchPortsOnSwitch

func CreateOrUpdateLogicalSwitchPortsOnSwitch(nbClient libovsdbclient.Client, sw *nbdb.LogicalSwitch, lsps ...*nbdb.LogicalSwitchPort) error

CreateOrUpdateLogicalSwitchPortsOnSwitch creates or updates the provided logical switch ports and adds them to the provided logical switch

func CreateOrUpdateLogicalSwitchPortsOnSwitchOps

func CreateOrUpdateLogicalSwitchPortsOnSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, lsps ...*nbdb.LogicalSwitchPort) ([]libovsdb.Operation, error)

CreateOrUpdateLogicalSwitchPortsOnSwitchOps creates or updates the provided logical switch ports, adds them to the provided logical switch and returns the corresponding ops

func CreateOrUpdateMeterOps

func CreateOrUpdateMeterOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, meter *nbdb.Meter, meterBands []*nbdb.MeterBand, fields ...interface{}) ([]ovsdb.Operation, error)

CreateOrUpdateMeterOps creates or updates the provided meter associated to the provided meter bands and returns the corresponding ops

func CreateOrUpdateNATs

func CreateOrUpdateNATs(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter, nats ...*nbdb.NAT) error

CreateOrUpdateNATs creates or updates the provided NATs and adds them to the provided logical router

func CreateOrUpdateNATsOps

func CreateOrUpdateNATsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, router *nbdb.LogicalRouter, nats ...*nbdb.NAT) ([]libovsdb.Operation, error)

CreateOrUpdateNATsOps creates or updates the provided NATs, adds them to the provided logical router and returns the corresponding ops

func CreateOrUpdatePortGroups

func CreateOrUpdatePortGroups(nbClient libovsdbclient.Client, pgs ...*nbdb.PortGroup) error

CreateOrUpdatePortGroups creates or updates the provided port groups

func CreateOrUpdatePortGroupsOps

func CreateOrUpdatePortGroupsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, pgs ...*nbdb.PortGroup) ([]libovsdb.Operation, error)

CreateOrUpdatePortGroupsOps creates or updates the provided port groups returning the corresponding ops

func CreateOrUpdateQoSesOps

func CreateOrUpdateQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error)

CreateOrUpdateQoSesOps returns the ops to create or update the provided QoSes.

func CreateOrUpdateSampleCollector

func CreateOrUpdateSampleCollector(nbClient libovsdbclient.Client, collector *nbdb.SampleCollector) error

func CreateOrUpdateSamplingAppsOps

func CreateOrUpdateSamplingAppsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, samplingApps ...*nbdb.SamplingApp) ([]libovsdb.Operation, error)

func CreateOrUpdateStaticMacBinding

func CreateOrUpdateStaticMacBinding(nbClient libovsdbclient.Client, smbs ...*nbdb.StaticMACBinding) error

CreateOrUpdateStaticMacBinding creates or updates the provided static mac binding

func CreatePortGroup

func CreatePortGroup(nbClient libovsdbclient.Client, portGroup *nbdb.PortGroup) error

CreatePortGroup creates the provided port group if it doesn't exist

func DeleteACLsFromAllPortGroups

func DeleteACLsFromAllPortGroups(nbClient libovsdbclient.Client, acls ...*nbdb.ACL) error

func DeleteACLsFromPortGroupOps

func DeleteACLsFromPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, acls ...*nbdb.ACL) ([]libovsdb.Operation, error)

DeleteACLsFromPortGroupOps removes the provided ACLs from the provided port group and returns the corresponding ops

func DeleteACLsFromPortGroups

func DeleteACLsFromPortGroups(nbClient libovsdbclient.Client, names []string, acls ...*nbdb.ACL) error

func DeleteAddressSets

func DeleteAddressSets(nbClient libovsdbclient.Client, addrSets ...*nbdb.AddressSet) error

DeleteAddressSets deletes the provided address sets

func DeleteAddressSetsOps

func DeleteAddressSetsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, addrSets ...*nbdb.AddressSet) ([]libovsdb.Operation, error)

func DeleteAddressSetsWithPredicate

func DeleteAddressSetsWithPredicate(nbClient libovsdbclient.Client, p addressSetPredicate) error

DeleteAddressSetsWithPredicate looks up address sets from the cache based on a given predicate and deletes them

func DeleteAddressSetsWithPredicateOps

func DeleteAddressSetsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, p addressSetPredicate) ([]libovsdb.Operation, error)

DeleteAddressSetsWithPredicateOps returns the ops to delete address sets based on a given predicate

func DeleteAddressesFromAddressSetOps

func DeleteAddressesFromAddressSetOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, as *nbdb.AddressSet, addresses ...string) ([]libovsdb.Operation, error)

DeleteAddressesFromAddressSetOps removes the provided addresses from the provided address set and returns the corresponding ops

func DeleteAllChassisTemplateVarVariables

func DeleteAllChassisTemplateVarVariables(nbClient libovsdbclient.Client, varNames []string) error

DeleteAllChassisTemplateVarVariables removes the variables listed as in 'varNames' and commits the transaction to the database. It applies the mutation to all records that contain these variable names.

func DeleteBFDs

func DeleteBFDs(nbClient libovsdbclient.Client, bfds ...*nbdb.BFD) error

DeleteBFDs deletes the provided BFDs

func DeleteCOPPsWithPredicateOps

func DeleteCOPPsWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, p coppPredicate) ([]ovsdb.Operation, error)

DeleteCOPPsOps deletes the provided COPPs found using the predicate, returning the corresponding ops

func DeleteChassis

func DeleteChassis(sbClient libovsdbclient.Client, chassis ...*sbdb.Chassis) error

DeleteChassis deletes the provided chassis and associated private chassis

func DeleteChassisTemplateVar

func DeleteChassisTemplateVar(nbClient libovsdbclient.Client, templates ...*nbdb.ChassisTemplateVar) error

DeleteChassisTemplateVar deletes all complete Chassis_Template_Var records matching 'templates'.

func DeleteChassisTemplateVarVariablesOps

func DeleteChassisTemplateVarVariablesOps(nbClient libovsdbclient.Client,
	ops []libovsdb.Operation, template *nbdb.ChassisTemplateVar) ([]libovsdb.Operation, error)

DeleteChassisTemplateVarVariablesOps removes all variables listed as keys of 'template.Variables' from the record matching the same chassis as 'template'. It returns the corresponding ops.

func DeleteChassisWithPredicate

func DeleteChassisWithPredicate(sbClient libovsdbclient.Client, p chassisPredicate) error

DeleteChassisWithPredicate looks up chassis from the cache based on a given predicate and deletes them as well as the associated private chassis

func DeleteDHCPOptions

func DeleteDHCPOptions(nbClient libovsdbclient.Client, dhcpOptions *nbdb.DHCPOptions) error

func DeleteDHCPOptionsWithPredicate

func DeleteDHCPOptionsWithPredicate(nbClient libovsdbclient.Client, p DHCPOptionsPredicate) error

func DeleteLoadBalancers

func DeleteLoadBalancers(nbClient libovsdbclient.Client, lbs []*nbdb.LoadBalancer) error

DeleteLoadBalancers deletes the provided load balancers

func DeleteLoadBalancersOps

func DeleteLoadBalancersOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error)

DeleteLoadBalancersOps deletes the provided load balancers and returns the corresponding ops

func DeleteLogicalRouter

func DeleteLogicalRouter(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter) error

DeleteLogicalRouter deletes the provided logical router

func DeleteLogicalRouterOps

func DeleteLogicalRouterOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	router *nbdb.LogicalRouter) ([]libovsdb.Operation, error)

DeleteLogicalRouterOps returns the operations to delete the provided logical router

func DeleteLogicalRouterPolicies

func DeleteLogicalRouterPolicies(nbClient libovsdbclient.Client, routerName string, lrps ...*nbdb.LogicalRouterPolicy) error

DeleteLogicalRouterPolicies deletes the logical router policies and removes them from the provided logical router

func DeleteLogicalRouterPoliciesOps

func DeleteLogicalRouterPoliciesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, lrps ...*nbdb.LogicalRouterPolicy) ([]libovsdb.Operation, error)

DeleteLogicalRouterPoliciesOps builds and returns corresponding delete operations for Logical Router Policies from the provided logical router.

func DeleteLogicalRouterPoliciesWithPredicate

func DeleteLogicalRouterPoliciesWithPredicate(nbClient libovsdbclient.Client, routerName string, p logicalRouterPolicyPredicate) error

DeleteLogicalRouterPoliciesWithPredicate looks up logical router policies from the cache based on a given predicate, deletes them and removes them from the provided logical router

func DeleteLogicalRouterPolicyWithPredicateOps

func DeleteLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, p logicalRouterPolicyPredicate) ([]libovsdb.Operation, error)

DeleteLogicalRouterPolicyWithPredicateOps looks up a logical router policy from the cache based on a given predicate and returns the corresponding ops to delete it and remove it from the provided router.

func DeleteLogicalRouterPorts

func DeleteLogicalRouterPorts(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter, lrps ...*nbdb.LogicalRouterPort) error

DeleteLogicalRouterPorts deletes the provided logical router ports and removes them from the provided logical router

func DeleteLogicalRouterStaticRoutes

func DeleteLogicalRouterStaticRoutes(nbClient libovsdbclient.Client, routerName string, lrsrs ...*nbdb.LogicalRouterStaticRoute) error

DeleteLogicalRouterStaticRoutes deletes the logical router static routes and removes them from the provided logical router

func DeleteLogicalRouterStaticRoutesWithPredicate

func DeleteLogicalRouterStaticRoutesWithPredicate(nbClient libovsdbclient.Client, routerName string, p logicalRouterStaticRoutePredicate) error

DeleteLogicalRouterStaticRoutesWithPredicate looks up logical router static routes from the cache based on a given predicate, deletes them and removes them from the provided logical router

func DeleteLogicalRouterStaticRoutesWithPredicateOps

func DeleteLogicalRouterStaticRoutesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, p logicalRouterStaticRoutePredicate) ([]libovsdb.Operation, error)

DeleteLogicalRouterStaticRoutesWithPredicateOps looks up logical router static routes from the cache based on a given predicate, and returns the ops to delete them and remove them from the provided logical router

func DeleteLogicalRoutersWithPredicateOps

func DeleteLogicalRoutersWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	p logicalRouterPredicate) ([]libovsdb.Operation, error)

DeleteLogicalRoutersWithPredicateOps returns the operations to delete the logical routers matching the provided predicate

func DeleteLogicalSwitch

func DeleteLogicalSwitch(nbClient libovsdbclient.Client, swName string) error

DeleteLogicalSwitch deletes the provided logical switch

func DeleteLogicalSwitchOps

func DeleteLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	swName string) ([]libovsdb.Operation, error)

DeleteLogicalSwitchOps returns the operations to delete the provided logical switch

func DeleteLogicalSwitchPorts

func DeleteLogicalSwitchPorts(nbClient libovsdbclient.Client, sw *nbdb.LogicalSwitch, lsps ...*nbdb.LogicalSwitchPort) error

DeleteLogicalSwitchPorts deletes the provided logical switch ports and removes them from the provided logical switch

func DeleteLogicalSwitchPortsOps

func DeleteLogicalSwitchPortsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, lsps ...*nbdb.LogicalSwitchPort) ([]libovsdb.Operation, error)

DeleteLogicalSwitchPortsOps deletes the provided logical switch ports, removes them from the provided logical switch and returns the corresponding ops

func DeleteLogicalSwitchPortsWithPredicateOps

func DeleteLogicalSwitchPortsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, p logicalSwitchPortPredicate) ([]libovsdb.Operation, error)

DeleteLogicalSwitchPortsWithPredicateOps looks up logical switch ports from the cache based on a given predicate and removes from them the provided logical switch

func DeleteLogicalSwitchesWithPredicateOps

func DeleteLogicalSwitchesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	p logicalSwitchPredicate) ([]libovsdb.Operation, error)

DeleteLogicalSwitchesWithPredicateOps returns the operations to delete the logical switches matching the provided predicate

func DeleteNATs

func DeleteNATs(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter, nats ...*nbdb.NAT) error

DeleteNATs deletes the provided NATs and removes them from the provided logical router

func DeleteNATsOps

func DeleteNATsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, router *nbdb.LogicalRouter, nats ...*nbdb.NAT) ([]libovsdb.Operation, error)

DeleteNATsOps deletes the provided NATs, removes them from the provided logical router and returns the corresponding ops

func DeleteNATsWithPredicateOps

func DeleteNATsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, p natPredicate) ([]libovsdb.Operation, error)

DeleteNATsWithPredicateOps looks up NATs from the cache based on a given predicate, deletes them, removes them from associated logical routers and returns the corresponding ops

func DeleteNextHopFromLogicalRouterPoliciesWithPredicate

func DeleteNextHopFromLogicalRouterPoliciesWithPredicate(nbClient libovsdbclient.Client, routerName string, p logicalRouterPolicyPredicate, nextHop string) error

DeleteNextHopFromLogicalRouterPoliciesWithPredicate looks up a logical router policy from the cache based on a given predicate and removes the provided Nexthop from it. If the logical router policy ends up with no Nexthops, it is deleted and removed from the provided logical router.

func DeleteNextHopFromLogicalRouterPoliciesWithPredicateOps

func DeleteNextHopFromLogicalRouterPoliciesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, p logicalRouterPolicyPredicate, nextHop string) ([]libovsdb.Operation, error)

DeleteNextHopFromLogicalRouterPoliciesWithPredicateOps looks up a logical router policy from the cache based on a given predicate and removes the provided Nexthop from it. If the logical router policy ends up with no Nexthops, it is deleted and removed from the provided logical router. Returns the corresponding ops

func DeleteNextHopsFromLogicalRouterPolicies

func DeleteNextHopsFromLogicalRouterPolicies(nbClient libovsdbclient.Client, routerName string, lrps ...*nbdb.LogicalRouterPolicy) error

DeleteNextHopsFromLogicalRouterPolicies removes the Nexthops from the provided logical router policies. If a logical router policy ends up with no Nexthops, it is deleted and removed from the provided logical router.

func DeleteNextHopsFromLogicalRouterPolicyOps

func DeleteNextHopsFromLogicalRouterPolicyOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, lrps []*nbdb.LogicalRouterPolicy, nextHops ...string) ([]libovsdb.Operation, error)

DeleteNextHopsFromLogicalRouterPolicyOps removes the Nexthops from the provided logical router policies.

func DeletePortGroups

func DeletePortGroups(nbClient libovsdbclient.Client, names ...string) error

DeletePortGroups deletes the provided port groups and returns the corresponding ops

func DeletePortGroupsOps

func DeletePortGroupsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, names ...string) ([]libovsdb.Operation, error)

DeletePortGroupsOps deletes the provided port groups and returns the corresponding ops

func DeletePortGroupsWithPredicate

func DeletePortGroupsWithPredicate(nbClient libovsdbclient.Client, p portGroupPredicate) error

DeletePortGroupsWithPredicate deletes the port groups based on the provided predicate

func DeletePortGroupsWithPredicateOps

func DeletePortGroupsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, p portGroupPredicate) ([]libovsdb.Operation, error)

DeletePortGroupsWithPredicateOps returns the corresponding ops to delete port groups based on a given predicate

func DeletePortsFromPortGroup

func DeletePortsFromPortGroup(nbClient libovsdbclient.Client, name string, ports ...string) error

DeletePortsFromPortGroup removes the provided ports from the provided port group

func DeletePortsFromPortGroupOps

func DeletePortsFromPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, ports ...string) ([]libovsdb.Operation, error)

DeletePortsFromPortGroupOps removes the provided ports from the provided port group and returns the corresponding ops

func DeleteQoSesOps

func DeleteQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error)

DeleteQoSesOps returns the ops to delete the provided QoSes.

func DeleteSampleCollector

func DeleteSampleCollector(nbClient libovsdbclient.Client, collector *nbdb.SampleCollector) error

func DeleteSampleCollectorWithPredicate

func DeleteSampleCollectorWithPredicate(nbClient libovsdbclient.Client, p func(collector *nbdb.SampleCollector) bool) error

func DeleteSamplingAppsWithPredicate

func DeleteSamplingAppsWithPredicate(nbClient libovsdbclient.Client, p func(collector *nbdb.SamplingApp) bool) error

func DeleteStaticMACBindingWithPredicate

func DeleteStaticMACBindingWithPredicate(nbClient libovsdbclient.Client, p staticMACBindingPredicate) error

DeleteStaticMACBindingWithPredicate deletes a Static MAC entry for a logical port from the cache

func DeleteStaticMacBindings

func DeleteStaticMacBindings(nbClient libovsdbclient.Client, smbs ...*nbdb.StaticMACBinding) error

DeleteStaticMacBindings deletes the provided static mac bindings

func FindACLs

func FindACLs(nbClient libovsdbclient.Client, acls []*nbdb.ACL) ([]*nbdb.ACL, error)

func FindACLsWithPredicate

func FindACLsWithPredicate(nbClient libovsdbclient.Client, p aclPredicate) ([]*nbdb.ACL, error)

FindACLsWithPredicate looks up ACLs from the cache based on a given predicate

func FindAddressSetsWithPredicate

func FindAddressSetsWithPredicate(nbClient libovsdbclient.Client, p addressSetPredicate) ([]*nbdb.AddressSet, error)

FindAddressSetsWithPredicate looks up address sets from the cache based on a given predicate

func FindLoadBalancerGroupsWithPredicate

func FindLoadBalancerGroupsWithPredicate(nbClient libovsdbclient.Client, p loadBalancerGroupPredicate) ([]*nbdb.LoadBalancerGroup, error)

FindLoadBalancerGroupsWithPredicate looks up load balancer groups from the cache based on a given predicate

func FindLoadBalancersWithPredicate

func FindLoadBalancersWithPredicate(nbClient libovsdbclient.Client, p loadBalancerPredicate) ([]*nbdb.LoadBalancer, error)

FindLoadBalancersWithPredicate looks up loadbalancers from the cache based on a given predicate

func FindLogicalRouterPoliciesWithPredicate

func FindLogicalRouterPoliciesWithPredicate(nbClient libovsdbclient.Client, p logicalRouterPolicyPredicate) ([]*nbdb.LogicalRouterPolicy, error)

FindLogicalRouterPoliciesWithPredicate looks up logical router policies from the cache based on a given predicate

func FindLogicalRouterPortWithPredicate

func FindLogicalRouterPortWithPredicate(nbClient libovsdbclient.Client, p logicalRouterPortPredicate) ([]*nbdb.LogicalRouterPort, error)

FindLogicalRouterPortWithPredicate looks up logical router port from the cache based on a given predicate

func FindLogicalRouterStaticRoutesWithPredicate

func FindLogicalRouterStaticRoutesWithPredicate(nbClient libovsdbclient.Client, p logicalRouterStaticRoutePredicate) ([]*nbdb.LogicalRouterStaticRoute, error)

FindLogicalRouterStaticRoutesWithPredicate looks up logical router static routes from the cache based on a given predicate

func FindLogicalRoutersWithPredicate

func FindLogicalRoutersWithPredicate(nbClient libovsdbclient.Client, p logicalRouterPredicate) ([]*nbdb.LogicalRouter, error)

FindLogicalRoutersWithPredicate looks up logical routers from the cache based on a given predicate

func FindLogicalSwitchesWithPredicate

func FindLogicalSwitchesWithPredicate(nbClient libovsdbclient.Client, p switchPredicate) ([]*nbdb.LogicalSwitch, error)

FindLogicalSwitchesWithPredicate looks up logical switches from the cache based on a given predicate

func FindNATsWithPredicate

func FindNATsWithPredicate(nbClient libovsdbclient.Client, predicate natPredicate) ([]*nbdb.NAT, error)

FindNATsWithPredicate looks up NATs from the cache based on a given predicate

func FindPortGroupsWithPredicate

func FindPortGroupsWithPredicate(nbClient libovsdbclient.Client, p portGroupPredicate) ([]*nbdb.PortGroup, error)

FindPortGroupsWithPredicate looks up port groups from the cache based on a given predicate

func FindQoSesWithPredicate

func FindQoSesWithPredicate(nbClient libovsdbclient.Client, p QoSPredicate) ([]*nbdb.QoS, error)

FindQoSesWithPredicate looks up QoSes from the cache based on a given predicate

func FindSample

func FindSample(nbClient libovsdbclient.Client, sampleMetadata int) (*nbdb.Sample, error)

func FindSampleCollectorWithPredicate

func FindSampleCollectorWithPredicate(nbClient libovsdbclient.Client, p func(*nbdb.SampleCollector) bool) ([]*nbdb.SampleCollector, error)

func GetACLName

func GetACLName(acl *nbdb.ACL) string

GetACLName returns the ACL name if it has one otherwise returns an empty string.

func GetACLSampleID

func GetACLSampleID(acl *nbdb.ACL) uint32

func GetAddressSet

func GetAddressSet(nbClient libovsdbclient.Client, as *nbdb.AddressSet) (*nbdb.AddressSet, error)

GetAddressSet looks up an address sets from the cache

func GetChassis

func GetChassis(sbClient libovsdbclient.Client, chassis *sbdb.Chassis) (*sbdb.Chassis, error)

GetChassis looks up a chassis from the cache using the 'Name' column which is an indexed column.

func GetLogicalRouter

func GetLogicalRouter(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter) (*nbdb.LogicalRouter, error)

GetLogicalRouter looks up a logical router from the cache

func GetLogicalRouterPolicy

func GetLogicalRouterPolicy(nbClient libovsdbclient.Client, policy *nbdb.LogicalRouterPolicy) (*nbdb.LogicalRouterPolicy, error)

GetLogicalRouterPolicy looks up a logical router policy from the cache

func GetLogicalRouterPort

func GetLogicalRouterPort(nbClient libovsdbclient.Client, lrp *nbdb.LogicalRouterPort) (*nbdb.LogicalRouterPort, error)

GetLogicalRouterPort looks up a logical router port from the cache

func GetLogicalSwitch

func GetLogicalSwitch(nbClient libovsdbclient.Client, sw *nbdb.LogicalSwitch) (*nbdb.LogicalSwitch, error)

GetLogicalSwitch looks up a logical switch from the cache

func GetLogicalSwitchPort

func GetLogicalSwitchPort(nbClient libovsdbclient.Client, lsp *nbdb.LogicalSwitchPort) (*nbdb.LogicalSwitchPort, error)

GetLogicalSwitchPort looks up a logical switch port from the cache

func GetNAT

func GetNAT(nbClient libovsdbclient.Client, nat *nbdb.NAT) (*nbdb.NAT, error)

GetNAT looks up an NAT from the cache

func GetNBGlobal

func GetNBGlobal(nbClient libovsdbclient.Client, nbGlobal *nbdb.NBGlobal) (*nbdb.NBGlobal, error)

GetNBGlobal looks up the NB Global entry from the cache

func GetNoOwnerPredicate

func GetNoOwnerPredicate[T hasExternalIDs]() func(item T) bool

GetNoOwnerPredicate should only be used on initial sync when switching to new ExternalIDs. Otherwise, use GetPredicate with the specific OwnerControllerKey id.

func GetPortBinding

func GetPortBinding(sbClient libovsdbclient.Client, portBinding *sbdb.PortBinding) (*sbdb.PortBinding, error)

GetPortBinding looks up a portBinding in SBDB

func GetPortGroup

func GetPortGroup(nbClient libovsdbclient.Client, pg *nbdb.PortGroup) (*nbdb.PortGroup, error)

GetPortGroup looks up a port group from the cache

func GetPredicate

func GetPredicate[nbdbT hasExternalIDs](objectIDs *DbObjectIDs, f func(item nbdbT) bool) func(item nbdbT) bool

GetPredicate returns a predicate to search for db obj of type nbdbT. Only non-empty ids will be matched (that always includes DbObjectIDs.OwnerTypeKey and DbObjectIDs.ownerControllerName), but the other IDs may be empty and will be ignored in the filtering, additional filter function f may be passed, or set to nil.

func GetRouterNATs

func GetRouterNATs(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter) ([]*nbdb.NAT, error)

GetRouterNATs looks up NATs associated to the provided logical router from the cache

func GetSBGlobal

func GetSBGlobal(sbClient libovsdbclient.Client, sbGlobal *sbdb.SBGlobal) (*sbdb.SBGlobal, error)

GetNBGlobal looks up the SB Global entry from the cache

func GetSample

func GetSample(nbClient libovsdbclient.Client, sample *nbdb.Sample) (*nbdb.Sample, error)

func ListChassis

func ListChassis(sbClient libovsdbclient.Client) ([]*sbdb.Chassis, error)

ListChassis looks up all chassis from the cache

func ListChassisPrivate

func ListChassisPrivate(sbClient libovsdbclient.Client) ([]*sbdb.ChassisPrivate, error)

ListChassisPrivate looks up all chassis private models from the cache

func ListLoadBalancers

func ListLoadBalancers(nbClient libovsdbclient.Client) ([]*nbdb.LoadBalancer, error)

ListLoadBalancers looks up all load balancers from the cache

func ListSampleCollectors

func ListSampleCollectors(nbClient libovsdbclient.Client) ([]*nbdb.SampleCollector, error)

func ListTemplateVar

func ListTemplateVar(nbClient libovsdbclient.Client) ([]*nbdb.ChassisTemplateVar, error)

ListTemplateVar looks up all chassis template variables.

func LookupBFD

func LookupBFD(nbClient libovsdbclient.Client, bfd *nbdb.BFD) (*nbdb.BFD, error)

func ParseNamespaceNameKey

func ParseNamespaceNameKey(key string) (namespace, name string, err error)

func PolicyEqualPredicate

func PolicyEqualPredicate(p1, p2 *nbdb.LogicalRouterStaticRoutePolicy) bool

PolicyEqualPredicate determines if two static routes have the same routing policy (dst-ip or src-ip) If policy is nil, OVN considers that as dst-ip

func RemoveACLsFromLogicalSwitchesWithPredicate

func RemoveACLsFromLogicalSwitchesWithPredicate(nbClient libovsdbclient.Client, p switchPredicate, acls ...*nbdb.ACL) error

RemoveACLsFromLogicalSwitchesWithPredicate looks up logical switches from the cache based on a given predicate and removes from them the provided ACLs

func RemoveACLsFromLogicalSwitchesWithPredicateOps

func RemoveACLsFromLogicalSwitchesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	p switchPredicate, acls ...*nbdb.ACL) ([]libovsdb.Operation, error)

RemoveACLsFromLogicalSwitchesWithPredicateOps looks up logical switches from the cache based on a given predicate, removes from them the provided ACLs, and returns the corresponding ops

func RemoveLoadBalancerVipsOps

func RemoveLoadBalancerVipsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, lb *nbdb.LoadBalancer, vips ...string) ([]libovsdb.Operation, error)

RemoveLoadBalancerVipsOps removes the provided VIPs from the provided load balancer set and returns the corresponding ops

func RemoveLoadBalancersFromGroupOps

func RemoveLoadBalancersFromGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, group *nbdb.LoadBalancerGroup, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error)

RemoveLoadBalancersFromGroupOps removes the provided load balancers from the provided group and returns the corresponding ops

func RemoveLoadBalancersFromLogicalRouterOps

func RemoveLoadBalancersFromLogicalRouterOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, router *nbdb.LogicalRouter, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error)

RemoveLoadBalancersFromLogicalRouterOps removes the provided load balancers from the provided logical router and returns the corresponding ops

func RemoveLoadBalancersFromLogicalSwitchOps

func RemoveLoadBalancersFromLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error)

RemoveLoadBalancersFromLogicalSwitchOps removes the provided load balancers from the provided logical switch and returns the corresponding ops

func RemoveQoSesFromLogicalSwitchOps

func RemoveQoSesFromLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error)

RemoveQoSesFromLogicalSwitchOps returns the ops to remove the provided QoSes from the provided switch.

func SetACLLogging

func SetACLLogging(acl *nbdb.ACL, severity nbdb.ACLSeverity, log bool)

func TransactAndCheck

func TransactAndCheck(c client.Client, ops []ovsdb.Operation) ([]ovsdb.OperationResult, error)

func TransactAndCheckAndSetUUIDs

func TransactAndCheckAndSetUUIDs(client client.Client, models interface{}, ops []ovsdb.Operation) ([]ovsdb.OperationResult, error)

TransactAndCheckAndSetUUIDs transacts the given ops against client and returns results if no error occurred or an error otherwise. It sets the real uuids for the passed models if they were inserted and have a named-uuid (as built by BuildNamedUUID)

func TransactWithRetry

func TransactWithRetry(ctx context.Context, c client.Client, ops []ovsdb.Operation) ([]ovsdb.OperationResult, error)

TransactWithRetry will attempt a transaction several times if it receives an error indicating that the client was not connected when the transaction occurred.

func UpdateACLsLoggingOps

func UpdateACLsLoggingOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, acls ...*nbdb.ACL) ([]libovsdb.Operation, error)

UpdateACLsLoggingOps updates the log and severity on the provided ACLs and returns the corresponding ops

func UpdateACLsOps

func UpdateACLsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, acls ...*nbdb.ACL) ([]libovsdb.Operation, error)

func UpdateAddressSetsAddresses

func UpdateAddressSetsAddresses(nbClient libovsdbclient.Client, addrSets ...*nbdb.AddressSet) error

UpdateAddressSetsAddresses updates the Addresses on the provided address sets

func UpdateLogicalRouterPoliciesOps

func UpdateLogicalRouterPoliciesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation,
	lrps ...*nbdb.LogicalRouterPolicy) ([]libovsdb.Operation, error)

func UpdateLogicalRouterSetExternalIDs

func UpdateLogicalRouterSetExternalIDs(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter) error

UpdateLogicalRouterSetExternalIDs sets external IDs on the provided logical router adding any missing, removing the ones set to an empty value and updating existing

func UpdateLogicalSwitchPortSetOptions

func UpdateLogicalSwitchPortSetOptions(nbClient libovsdbclient.Client, lsp *nbdb.LogicalSwitchPort) error

UpdateLogicalSwitchPortSetOptions sets options on the provided logical switch port adding any missing, removing the ones set to an empty value and updating existing

func UpdateLogicalSwitchSetExternalIDs

func UpdateLogicalSwitchSetExternalIDs(nbClient libovsdbclient.Client, logicalSwitch *nbdb.LogicalSwitch) error

UpdateLogicalSwitchSetExternalIDs updates the external IDs on the provided logical switch. Empty values means the corresponding keys are to be deleted.

func UpdateLogicalSwitchSetOtherConfig

func UpdateLogicalSwitchSetOtherConfig(nbClient libovsdbclient.Client, sw *nbdb.LogicalSwitch) error

UpdateLogicalSwitchSetOtherConfig sets other config on the provided logical switch adding any missing, removing the ones set to an empty value and updating existing

func UpdateNBGlobalSetOptions

func UpdateNBGlobalSetOptions(nbClient libovsdbclient.Client, nbGlobal *nbdb.NBGlobal) error

UpdateNBGlobalSetOptions sets options on the NB Global entry adding any missing, removing the ones set to an empty value and updating existing

func UpdatePortBindingSetChassis

func UpdatePortBindingSetChassis(sbClient libovsdbclient.Client, portBinding *sbdb.PortBinding, chassis *sbdb.Chassis) error

UpdatePortBindingSetChassis sets the chassis column of the 'portBinding' row so that the OVN thinks that the port binding 'portBinding' is bound on the chassis. Ideally its ovn-controller which claims/binds a port binding. But for a remote chassis, we have to bind it as we created the remote chassis record for the remote zone nodes. TODO (numans) remove this function once OVN supports binding a port binding for a remote chassis.

func UpdatePortGroupSetACLsOps

func UpdatePortGroupSetACLsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, acls []*nbdb.ACL) ([]libovsdb.Operation, error)

UpdatePortGroupSetACLsOps updates the provided ACLs on the provided port group and returns the corresponding ops. It entirely replaces the existing ACLs on the PG with the newly provided list

func UpdateQoSesOps

func UpdateQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error)

func UpdateSampleCollectorExternalIDs

func UpdateSampleCollectorExternalIDs(nbClient libovsdbclient.Client, collector *nbdb.SampleCollector) error

Types

type DHCPOptionsPredicate

type DHCPOptionsPredicate func(*nbdb.DHCPOptions) bool

type DbObjectIDs

type DbObjectIDs struct {
	// contains filtered or unexported fields
}

DbObjectIDs is a structure representing a set of db object ExternalIDs, used to identify an object in the db (as a primary/secondary index) or for a predicate search. DbObjectIDs consists of 3 parts: - idsType defines which IDs are used for a given object, as an ObjectIDsType, idsType.ownerObjectType will be written to ExternalIDs[OwnerTypeKey] - ownerControllerName defines who manages given object. It is required in case there are more than 1 controllers using the same idsType to make sure every controller only updates objects it owns. - objectIDs provide values for keys that are used by given idsType. To create a new object, all fields should be set. For predicate search, only some values that need to be matched may be set.

 dbIndex := NewDbObjectIDs(AddressSetEgressFirewallDNS, "DefaultController",
		map[ExternalIDKey]string{
			ObjectNameKey: "dns.name",
			IPFamilyKey:   "ipv4"
	})

uses AddressSetEgressFirewallDNS = newObjectIDsType(addressSet, EgressFirewallDNSOwnerType, []ExternalIDKey{
		// dnsName
		ObjectNameKey,
		IPFamilyKey,
 })

its dbIndex will be mapped to the following ExternalIDs

 {
		"k8s.ovn.org/owner-controller": "DefaultController"
		"k8s.ovn.org/owner-type": "EgressFirewallDNS" (value of EgressFirewallDNSOwnerType)
		"k8s.ovn.org/name": "dns.name"
		"k8s.ovn.org/ipFamily": "ipv4"
		"k8s.ovn.org/id": "DefaultController:EgressFirewallDNS:dns.name:ipv4"
 }

func NewDbObjectIDs

func NewDbObjectIDs(idsType *ObjectIDsType, controller string, objectIds map[ExternalIDKey]string) *DbObjectIDs

NewDbObjectIDs is used to construct DbObjectIDs, idsType and controller are always required, objectIds may be empty, or half-filled for predicate search. objectIds keys that are not used by given idsType will cause panic.

func NewDbObjectIDsFromExternalIDs

func NewDbObjectIDsFromExternalIDs(objectIDsType *ObjectIDsType, externalIDs map[string]string) (*DbObjectIDs, error)

NewDbObjectIDsFromExternalIDs is used to parse object ExternalIDs, it sets DbObjectIDs.ownerControllerName based on OwnerControllerKey key, and verifies OwnerControllerKey value matches given objectIDsType. All the other ids from objectIDsType will be set to DbObjectIDs.objectIDs.

func (*DbObjectIDs) AddIDs

func (objectIDs *DbObjectIDs) AddIDs(extraObjectIds map[ExternalIDKey]string) *DbObjectIDs

AddIDs creates new DbObjectIDs with the additional extraObjectIds. If at least one of extraObjectIds keys is not used by the objectIDs.idsType it will cause panic.

func (*DbObjectIDs) GetExternalIDs

func (objectIDs *DbObjectIDs) GetExternalIDs() map[string]string

GetExternalIDs should only be used to build ids before creating the new db object. If at least one of required by DbObjectIDs.idsType keys is not present in the DbObjectIDs.objectIDs it will panic. GetExternalIDs returns a map of ids, that always includes keys - OwnerControllerKey - OwnerTypeKey - PrimaryIDKey and also all keys that are preset in objectIDs.objectIDs. PrimaryIDKey value consists of the following values joined with ":" - objectIDs.ownerControllerName - objectIDs.idsType.ownerObjectType - values from DbObjectIDs.objectIDs are added in order set in ObjectIDsType.externalIDKeys

func (*DbObjectIDs) GetIDsType

func (objectIDs *DbObjectIDs) GetIDsType() *ObjectIDsType

func (*DbObjectIDs) GetObjectID

func (objectIDs *DbObjectIDs) GetObjectID(key ExternalIDKey) string

GetObjectID returns value from objectIDs.objectIDs map, and empty string for not found values. Usually objectIDs.objectIDs doesn't include PrimaryIDKey, OwnerTypeKey, and OwnerControllerKey.

func (*DbObjectIDs) GetUnsetKeys

func (objectIDs *DbObjectIDs) GetUnsetKeys() []ExternalIDKey

func (*DbObjectIDs) HasSameOwner

func (objectIDs *DbObjectIDs) HasSameOwner(ownerController string, objectIDsType *ObjectIDsType) bool

func (*DbObjectIDs) RemoveIDs

func (objectIDs *DbObjectIDs) RemoveIDs(idsToDelete ...ExternalIDKey) *DbObjectIDs

func (*DbObjectIDs) String

func (objectIDs *DbObjectIDs) String() string

String returns a string that is similar to PrimaryIDKey value, but if some required keys are not present in the DbObjectIDs.objectIDs, they will be replaced with empty strings. String returns the representation of all the information set in DbObjectIDs.

type ExternalIDKey

type ExternalIDKey string
const (
	// ExternalIDs keys that will be a part of a client index.
	// OwnerControllerKey and OwnerTypeKey define managing entity (a.k.a. owner) for given db object.
	// All the other ids are object-related.
	// PrimaryIDKey will be used a primary client index.
	// A combination of OwnerControllerKey, OwnerTypeKey, and ObjectNameKey will be used a secondary client index.
	// While owner-related keys together with PrimaryIDKey will always be present in the ExternalIDs,
	// ObjectNameKey may or may not be used, based on ObjectIDsType.
	OwnerControllerKey ExternalIDKey = types.OvnK8sPrefix + "/owner-controller"
	OwnerTypeKey       ExternalIDKey = types.OvnK8sPrefix + "/owner-type"
	// ObjectNameKey is a part of a secondary index, together with OwnerControllerKey and OwnerTypeKey
	// May be used by controllers to store e.g. namespace+name of the object.
	ObjectNameKey ExternalIDKey = types.OvnK8sPrefix + "/name"
	// PrimaryIDKey will be used as a primary index, that is unique for every db object,
	// and can be built based on the combination of all the other ids.
	PrimaryIDKey ExternalIDKey = types.PrimaryIDKey
)

func (ExternalIDKey) String

func (key ExternalIDKey) String() string

type ObjectIDsType

type ObjectIDsType struct {
	// contains filtered or unexported fields
}

ObjectIDsType defines which ExternalIDs are used to indentify db objects. ExternalIDs are defined based on dbObjType and ownerType, e.g. default network controller creates address sets for namespaces and network policies, and needs to use different sets of ids for them. So it will create ObjectIDsType with the same dbObjType=addressSet, but different ownerTypes NamespaceOwnerType and NetworkPolicyOwnerType. Then it can define a set of ExternalIDs that will be used for each type. From the db perspective, dbObjType is identified based on the db table, and ownerType is used directly in the ExternalIDs with OwnerTypeKey key.

func (ObjectIDsType) GetExternalIDKeys

func (it ObjectIDsType) GetExternalIDKeys() []ExternalIDKey

func (ObjectIDsType) HasKey

func (it ObjectIDsType) HasKey(key ExternalIDKey) bool

func (ObjectIDsType) IsSameType

func (it ObjectIDsType) IsSameType(it2 *ObjectIDsType) bool

type QoSPredicate

type QoSPredicate func(*nbdb.QoS) bool

type SampleFeature

type SampleFeature = string
const (
	EgressFirewallSample     SampleFeature = "EgressFirewall"
	NetworkPolicySample      SampleFeature = "NetworkPolicy"
	AdminNetworkPolicySample SampleFeature = "AdminNetworkPolicy"
	MulticastSample          SampleFeature = "Multicast"
	UDNIsolationSample       SampleFeature = "UDNIsolation"
)

type SamplingConfig

type SamplingConfig struct {
	// contains filtered or unexported fields
}

SamplingConfig is used to configure sampling for different db objects.

func NewSamplingConfig

func NewSamplingConfig(featureCollectors map[SampleFeature][]string) *SamplingConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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