descriptor

package
v3.3.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DNAT44DescriptorName is the name of the descriptor for VPP NAT44
	// Destination-NAT configurations.
	DNAT44DescriptorName = "vpp-nat44-dnat"
)
View Source
const (
	// NAT44AddressPoolDescriptorName is the name of the descriptor for NAT44 IP address pools.
	NAT44AddressPoolDescriptorName = "vpp-nat44-address-pool"
)
View Source
const (
	// NAT44GlobalAddressDescriptorName is the name of the descriptor for IP addresses
	// from the VPP NAT44 address pool.
	NAT44GlobalAddressDescriptorName = "vpp-nat44-global-address"
)
View Source
const (
	// NAT44GlobalDescriptorName is the name of the descriptor for VPP NAT44 global
	// configuration.
	NAT44GlobalDescriptorName = "vpp-nat44-global"
)
View Source
const (
	// NAT44GlobalInterfaceDescriptorName is the name of the descriptor for VPP NAT44
	// features applied to interfaces.
	NAT44GlobalInterfaceDescriptorName = "vpp-nat44-global-interface"
)
View Source
const (
	// NAT44InterfaceDescriptorName is the name of the descriptor for VPP NAT44 features applied to interfaces.
	NAT44InterfaceDescriptorName = "vpp-nat44-interface"
)

Variables

View Source
var (
	// ErrDNAT44WithEmptyLabel is returned when NAT44 DNAT configuration is defined
	// with empty label
	ErrDNAT44WithEmptyLabel = errors.New("NAT44 DNAT configuration defined with empty label")

	// ErrDNAT44TwiceNATPoolIPNeedsTwiceNAT is returned when NAT44 DNAT static configuration is defined
	// with non-empty twiceNAT pool IP, but twiceNAT is not enabled for given static mapping.
	ErrDNAT44TwiceNATPoolIPNeedsTwiceNAT = errors.New("NAT44 DNAT static mapping configuration with " +
		"non-empty twiceNAT pool IP have to have also enabled twiceNAT (use enabled, not self-twiceNAT)")

	// ErrDNAT44TwiceNATPoolIPIsNotSupportedForLBStMappings is returned when twiceNAT pool IP is used with
	// loadbalanced version of static mapping. This combination is not supported by VPP.
	ErrDNAT44TwiceNATPoolIPIsNotSupportedForLBStMappings = errors.New("NAT44 DNAT static mapping's " +
		"twiceNAT pool IP feature is not supported(by VPP) when the loadbalanced version of static mapping " +
		"is used. Use non-loadbalanced version of static mappings(<=>len(local IP)<=1) or don't use twiceNAT " +
		"pool IP feature.")
)

A list of non-retriable errors:

View Source
var (
	// ErrNATInterfaceFeatureCollision is returned when VPP NAT features assigned
	// to a single interface collide.
	ErrNATInterfaceFeatureCollision = errors.New("VPP NAT interface feature collision")

	// ErrDuplicateNATAddress is returned when VPP NAT address pool contains duplicate
	// IP addresses.
	ErrDuplicateNATAddress = errors.New("Duplicate VPP NAT address")
)

A list of non-retriable errors:

View Source
var (
	// ErrInvalidNATAddress is returned when IP address from VPP NAT address pool
	// cannot be parsed.
	ErrInvalidNATAddress = errors.New("Invalid VPP NAT address")
)

A list of non-retriable errors:

Functions

func NewDNAT44Descriptor

func NewDNAT44Descriptor(natHandler vppcalls.NatVppAPI, log logging.PluginLogger) *kvs.KVDescriptor

NewDNAT44Descriptor creates a new instance of the DNAT44 descriptor.

func NewNAT44AddressPoolDescriptor

func NewNAT44AddressPoolDescriptor(nat44GlobalDesc *NAT44GlobalDescriptor,
	natHandler vppcalls.NatVppAPI, log logging.PluginLogger) *kvs.KVDescriptor

NewNAT44AddressPoolDescriptor creates a new instance of the NAT44AddressPoolDescriptor.

func NewNAT44GlobalAddressDescriptor

func NewNAT44GlobalAddressDescriptor(natHandler vppcalls.NatVppAPI, log logging.PluginLogger) *kvs.KVDescriptor

NewNAT44GlobalAddressDescriptor creates a new instance of the NAT44Address descriptor. Deprecated. Functionality moved to NAT44AddressPoolDescriptor. Kept for backward compatibility.

func NewNAT44GlobalInterfaceDescriptor

func NewNAT44GlobalInterfaceDescriptor(natHandler vppcalls.NatVppAPI, log logging.PluginLogger) *kvs.KVDescriptor

NewNAT44GlobalInterfaceDescriptor creates a new instance of the NAT44GlobalInterface descriptor. Deprecated. Functionality moved to NAT44InterfaceDescriptor. Kept for backward compatibility.

func NewNAT44InterfaceDescriptor

func NewNAT44InterfaceDescriptor(nat44GlobalDesc *NAT44GlobalDescriptor,
	natHandler vppcalls.NatVppAPI, log logging.PluginLogger) *kvs.KVDescriptor

NewNAT44InterfaceDescriptor creates a new instance of the NAT44Interface descriptor.

func ParseIPv4 added in v3.2.0

func ParseIPv4(str string) (net.IP, error)

ParseIPv4 parses string <str> to IPv4 address

Types

type DNAT44Descriptor

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

DNAT44Descriptor teaches KVScheduler how to configure Destination NAT44 in VPP.

func (*DNAT44Descriptor) Create

func (d *DNAT44Descriptor) Create(key string, dnat *nat.DNat44) (metadata interface{}, err error)

Create adds new destination-NAT44 configuration.

func (*DNAT44Descriptor) Delete

func (d *DNAT44Descriptor) Delete(key string, dnat *nat.DNat44, metadata interface{}) error

Delete removes existing destination-NAT44 configuration.

func (*DNAT44Descriptor) Dependencies

func (d *DNAT44Descriptor) Dependencies(key string, dnat *nat.DNat44) (dependencies []kvs.Dependency)

Dependencies lists endpoint-dependent mode, external interfaces and non-zero VRFs from mappings as dependencies.

func (*DNAT44Descriptor) EquivalentDNAT44

func (d *DNAT44Descriptor) EquivalentDNAT44(key string, oldDNAT, newDNAT *nat.DNat44) bool

EquivalentDNAT44 compares two instances of DNAT44 for equality.

func (*DNAT44Descriptor) IsRetriableFailure

func (d *DNAT44Descriptor) IsRetriableFailure(err error) bool

IsRetriableFailure returns <false> for errors related to invalid configuration.

func (*DNAT44Descriptor) Retrieve

func (d *DNAT44Descriptor) Retrieve(correlate []adapter.DNAT44KVWithMetadata) (
	retrieved []adapter.DNAT44KVWithMetadata, err error,
)

Retrieve returns the current NAT44 global configuration.

func (*DNAT44Descriptor) Update

func (d *DNAT44Descriptor) Update(key string, oldDNAT, newDNAT *nat.DNat44, oldMetadata interface{}) (newMetadata interface{}, err error)

Update updates destination-NAT44 configuration.

func (*DNAT44Descriptor) Validate

func (d *DNAT44Descriptor) Validate(key string, dnat *nat.DNat44) error

Validate validates VPP destination-NAT44 configuration.

type NAT44AddressPoolDescriptor

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

NAT44AddressPoolDescriptor teaches KVScheduler how to add/remove VPP NAT44 IP addresses pools.

func (*NAT44AddressPoolDescriptor) Create

func (d *NAT44AddressPoolDescriptor) Create(key string, natAddr *nat.Nat44AddressPool) (metadata interface{}, err error)

Create adds IP address pool into VPP NAT44 address pools.

func (*NAT44AddressPoolDescriptor) Delete

func (d *NAT44AddressPoolDescriptor) Delete(key string, natAddr *nat.Nat44AddressPool, metadata interface{}) error

Delete removes IP address pool from VPP NAT44 address pools.

func (*NAT44AddressPoolDescriptor) Dependencies

func (d *NAT44AddressPoolDescriptor) Dependencies(key string, natAddr *nat.Nat44AddressPool) (deps []kvs.Dependency)

Dependencies lists endpoint-dependent mode and non-zero/non-all-ones VRF as dependencies.

func (*NAT44AddressPoolDescriptor) DerivedValues added in v3.2.0

func (d *NAT44AddressPoolDescriptor) DerivedValues(key string, addrPool *nat.Nat44AddressPool) (derValues []kvs.KeyValuePair)

DerivedValues derives:

  • for twiceNAT address pool the pool itself with exposed IP addresses and VRF in derived key

func (*NAT44AddressPoolDescriptor) Retrieve

Retrieve returns VPP IP address pools configured on VPP.

func (*NAT44AddressPoolDescriptor) Validate

func (d *NAT44AddressPoolDescriptor) Validate(key string, natAddr *nat.Nat44AddressPool) error

Validate validates configuration for NAT44 IP addresses pool.

type NAT44GlobalAddressDescriptor

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

NAT44GlobalAddressDescriptor teaches KVScheduler how to add/remove IP addresses to/from the VPP NAT44 address pool. Deprecated. Functionality moved to NAT44AddressPoolDescriptor. Kept for backward compatibility.

func (*NAT44GlobalAddressDescriptor) Create

func (d *NAT44GlobalAddressDescriptor) Create(key string, natAddr *nat.Nat44Global_Address) (metadata interface{}, err error)

Create adds IP address into the NAT44 address pool.

func (*NAT44GlobalAddressDescriptor) Delete

func (d *NAT44GlobalAddressDescriptor) Delete(key string, natAddr *nat.Nat44Global_Address, metadata interface{}) error

Delete removes IP address from the NAT44 address pool.

func (*NAT44GlobalAddressDescriptor) Dependencies

func (d *NAT44GlobalAddressDescriptor) Dependencies(key string, natAddr *nat.Nat44Global_Address) (deps []kvs.Dependency)

Dependencies lists endpoint-dependent mode and non-zero VRF as dependencies.

func (*NAT44GlobalAddressDescriptor) IsNat44DerivedAddressKey

func (d *NAT44GlobalAddressDescriptor) IsNat44DerivedAddressKey(key string) bool

IsNat44DerivedAddressKey returns true if the key is identifying configuration for a single address from the NAT44 address pool.

func (*NAT44GlobalAddressDescriptor) Validate

Validate validates configuration for NAT44 address.

type NAT44GlobalDescriptor

type NAT44GlobalDescriptor struct {

	// UseDeprecatedAPI tracks whether deprecated global API (NAT interfaces, addresses) is being used on NB.
	// Used to orchestrate which data should be dumped from which descriptor on Retrieve.
	UseDeprecatedAPI bool
	// contains filtered or unexported fields
}

NAT44GlobalDescriptor teaches KVScheduler how to configure global options for VPP NAT44.

func NewNAT44GlobalDescriptor

func NewNAT44GlobalDescriptor(natHandler vppcalls.NatVppAPI, log logging.PluginLogger) (*NAT44GlobalDescriptor, *kvs.KVDescriptor)

NewNAT44GlobalDescriptor creates a new instance of the NAT44Global descriptor.

func (*NAT44GlobalDescriptor) Create

func (d *NAT44GlobalDescriptor) Create(key string, globalCfg *nat.Nat44Global) (metadata interface{}, err error)

Create applies NAT44 global options.

func (*NAT44GlobalDescriptor) Delete

func (d *NAT44GlobalDescriptor) Delete(key string, globalCfg *nat.Nat44Global, metadata interface{}) error

Delete sets NAT44 global options back to the defaults.

func (*NAT44GlobalDescriptor) DerivedValues

func (d *NAT44GlobalDescriptor) DerivedValues(key string, globalCfg *nat.Nat44Global) (derValues []kvs.KeyValuePair)

DerivedValues derives:

  • nat.NatAddress for every IP address to be added into the NAT address pool,
  • nat.NatInterface for every interface with assigned NAT configuration.
  • empty proto value if NAT44 runs in the endpoint-dependent mode

func (*NAT44GlobalDescriptor) EquivalentNAT44Global

func (d *NAT44GlobalDescriptor) EquivalentNAT44Global(key string, oldGlobalCfg, newGlobalCfg *nat.Nat44Global) bool

EquivalentNAT44Global compares two NAT44 global configs for equality.

func (*NAT44GlobalDescriptor) Retrieve

Retrieve returns the current NAT44 global configuration.

func (*NAT44GlobalDescriptor) Update

func (d *NAT44GlobalDescriptor) Update(key string, oldGlobalCfg, newGlobalCfg *nat.Nat44Global, oldMetadata interface{}) (newMetadata interface{}, err error)

Update updates NAT44 global options.

func (*NAT44GlobalDescriptor) UpdateWithRecreate added in v3.3.0

func (d *NAT44GlobalDescriptor) UpdateWithRecreate(key string, oldGlobalCfg, newGlobalCfg *nat.Nat44Global, metadata interface{}) bool

Change in the endpoint-dependency mode requires NAT44 plugin to be disabled and re-enabled.

func (*NAT44GlobalDescriptor) Validate

func (d *NAT44GlobalDescriptor) Validate(key string, globalCfg *nat.Nat44Global) error

Validate validates VPP NAT44 global configuration.

type NAT44GlobalInterfaceDescriptor

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

NAT44GlobalInterfaceDescriptor teaches KVScheduler how to configure VPP NAT interface features. Deprecated. Functionality moved to NAT44InterfaceDescriptor. Kept for backward compatibility.

func (*NAT44GlobalInterfaceDescriptor) Create

func (d *NAT44GlobalInterfaceDescriptor) Create(key string, natIface *nat.Nat44Global_Interface) (metadata interface{}, err error)

Create enables NAT44 for an interface.

func (*NAT44GlobalInterfaceDescriptor) Delete

func (d *NAT44GlobalInterfaceDescriptor) Delete(key string, natIface *nat.Nat44Global_Interface, metadata interface{}) error

Delete disables NAT44 for an interface.

func (*NAT44GlobalInterfaceDescriptor) Dependencies

Dependencies lists the interface as the only dependency.

func (*NAT44GlobalInterfaceDescriptor) IsNAT44DerivedInterfaceKey

func (d *NAT44GlobalInterfaceDescriptor) IsNAT44DerivedInterfaceKey(key string) bool

IsNAT44DerivedInterfaceKey returns true if the key is identifying NAT-44 configuration for interface.

type NAT44InterfaceDescriptor

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

NAT44InterfaceDescriptor teaches KVScheduler how to configure VPP NAT interface features.

func (*NAT44InterfaceDescriptor) Create

func (d *NAT44InterfaceDescriptor) Create(key string, natIface *nat.Nat44Interface) (metadata interface{}, err error)

Create enables NAT44 on an interface.

func (*NAT44InterfaceDescriptor) Delete

func (d *NAT44InterfaceDescriptor) Delete(key string, natIface *nat.Nat44Interface, metadata interface{}) (err error)

Delete disables NAT44 on an interface.

func (*NAT44InterfaceDescriptor) Dependencies

func (d *NAT44InterfaceDescriptor) Dependencies(key string, natIface *nat.Nat44Interface) (deps []kvs.Dependency)

Dependencies lists the interface and the NAT44 global configuration as dependencies.

func (*NAT44InterfaceDescriptor) Retrieve

Retrieve returns the current NAT44 interface configuration.

func (*NAT44InterfaceDescriptor) Validate

func (d *NAT44InterfaceDescriptor) Validate(key string, natIface *nat.Nat44Interface) error

Validate validates VPP NAT44 interface configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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