vppcalls

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 30 Imported by: 74

Documentation

Overview

Package vppcalls contains wrappers over VPP binary APIs for all supported interface types and for dumping all interfaces configured in VPP.

Index

Constants

View Source
const (
	ICMP uint8 = 1
	TCP  uint8 = 6
	UDP  uint8 = 17
)

Num protocol representation

View Source
const (
	// NoInterface is sw-if-idx which means 'no interface'
	NoInterface uint32 = 0xffffffff
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BfdAuthKeyDetails added in v1.8.1

type BfdAuthKeyDetails struct {
	AuthKeys []*bfd.SingleHopBFD_Key
	Meta     *BfdAuthKeyMeta
}

BfdAuthKeyDetails is the wrapper structure for the BFD authentication key northbound API structure.

type BfdAuthKeyMeta added in v1.8.1

type BfdAuthKeyMeta struct {
	KeyIDToUseCount map[uint32]uint32
}

BfdAuthKeyMeta is combination of proto-modelled BFD session data and key-to-usage map

type BfdDetails added in v1.8.1

type BfdDetails struct {
	Bfd  *bfd.SingleHopBFD `json:"bfd"`
	Meta *BfdMeta          `json:"bfd_meta"`
}

BfdDetails is the wrapper structure for the BFD northbound API structure.

type BfdMeta added in v1.8.1

type BfdMeta struct {
	*BfdSessionMeta `json:"bfd_session_meta"`
	*BfdAuthKeyMeta `json:"bfd_authkey_meta"`
}

BfdMeta is combination of proto-modelled BFD data and VPP provided metadata

type BfdSessionDetails added in v1.8.1

type BfdSessionDetails struct {
	Session []*bfd.SingleHopBFD_Session
	Meta    *BfdSessionMeta
}

BfdSessionDetails is the wrapper structure for the BFD session northbound API structure.

type BfdSessionMeta added in v1.8.1

type BfdSessionMeta struct {
	SessionIfToIdx map[uint32]string
}

BfdSessionMeta is combination of proto-modelled BFD session data and session interface to index map

type BfdVppAPI added in v1.8.1

type BfdVppAPI interface {
	BfdVppWrite
	BfdVppRead
}

BfdVppAPI provides methods for managing BFD

type BfdVppHandler added in v1.8.1

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

BfdVppHandler is accessor for BFD-related vppcalls methods

func NewBfdVppHandler added in v1.8.1

func NewBfdVppHandler(callsChan api.Channel, ifIndexes ifaceidx.SwIfIndex, log logging.Logger) *BfdVppHandler

NewBfdVppHandler creates new instance of BFD vppcalls handler

func (*BfdVppHandler) AddBfdEchoFunction added in v1.8.1

func (h *BfdVppHandler) AddBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction, swIfIndexes ifaceidx.SwIfIndex) error

AddBfdEchoFunction implements BFD handler.

func (*BfdVppHandler) AddBfdUDPSession added in v1.8.1

func (h *BfdVppHandler) AddBfdUDPSession(bfdSess *bfd.SingleHopBFD_Session, ifIdx uint32, bfdKeyIndexes idxvpp.NameToIdx) error

AddBfdUDPSession implements BFD handler.

func (*BfdVppHandler) AddBfdUDPSessionFromDetails added in v1.8.1

func (h *BfdVppHandler) AddBfdUDPSessionFromDetails(bfdSess *bfd_api.BfdUDPSessionDetails, bfdKeyIndexes idxvpp.NameToIdx) error

AddBfdUDPSessionFromDetails implements BFD handler.

func (*BfdVppHandler) DeleteBfdEchoFunction added in v1.8.1

func (h *BfdVppHandler) DeleteBfdEchoFunction() error

DeleteBfdEchoFunction implements BFD handler.

func (*BfdVppHandler) DeleteBfdUDPAuthenticationKey added in v1.8.1

func (h *BfdVppHandler) DeleteBfdUDPAuthenticationKey(bfdKey *bfd.SingleHopBFD_Key) error

DeleteBfdUDPAuthenticationKey implements BFD handler.

func (*BfdVppHandler) DeleteBfdUDPSession added in v1.8.1

func (h *BfdVppHandler) DeleteBfdUDPSession(ifIndex uint32, sourceAddress string, destAddress string) error

DeleteBfdUDPSession implements BFD handler.

func (*BfdVppHandler) DumpBfdAuthKeys added in v1.8.1

func (h *BfdVppHandler) DumpBfdAuthKeys() (*BfdAuthKeyDetails, error)

DumpBfdAuthKeys implements BFD handler.

func (*BfdVppHandler) DumpBfdSessions added in v1.8.1

func (h *BfdVppHandler) DumpBfdSessions() (*BfdSessionDetails, error)

DumpBfdSessions implements BFD handler.

func (*BfdVppHandler) DumpBfdSingleHop added in v1.8.1

func (h *BfdVppHandler) DumpBfdSingleHop() (*BfdDetails, error)

DumpBfdSingleHop implements BFD handler.

func (*BfdVppHandler) DumpBfdUDPSessionsWithID added in v1.8.1

func (h *BfdVppHandler) DumpBfdUDPSessionsWithID(authKeyIndex uint32) (*BfdSessionDetails, error)

DumpBfdUDPSessionsWithID implements BFD handler.

func (*BfdVppHandler) ModifyBfdUDPSession added in v1.8.1

func (h *BfdVppHandler) ModifyBfdUDPSession(bfdSess *bfd.SingleHopBFD_Session, swIfIndexes ifaceidx.SwIfIndex) error

ModifyBfdUDPSession implements BFD handler.

func (*BfdVppHandler) SetBfdUDPAuthenticationKey added in v1.8.1

func (h *BfdVppHandler) SetBfdUDPAuthenticationKey(bfdKey *bfd.SingleHopBFD_Key) error

SetBfdUDPAuthenticationKey implements BFD handler.

type BfdVppRead added in v1.8.1

type BfdVppRead interface {
	// DumpBfdSingleHop returns complete BFD configuration
	DumpBfdSingleHop() (*BfdDetails, error)
	// DumpBfdUDPSessions returns a list of BFD session's metadata
	DumpBfdSessions() (*BfdSessionDetails, error)
	// DumpBfdUDPSessionsWithID returns a list of BFD session's metadata filtered according to provided authentication key
	DumpBfdUDPSessionsWithID(authKeyIndex uint32) (*BfdSessionDetails, error)
	// DumpBfdKeys looks up all BFD auth keys and saves their name-to-index mapping
	DumpBfdAuthKeys() (*BfdAuthKeyDetails, error)
}

BfdVppRead provides read methods for BFD

type BfdVppWrite added in v1.8.1

type BfdVppWrite interface {
	// AddBfdUDPSession adds new BFD session with authentication if available.
	AddBfdUDPSession(bfdSess *bfd.SingleHopBFD_Session, ifIdx uint32, bfdKeyIndexes idxvpp.NameToIdx) error
	// AddBfdUDPSessionFromDetails adds new BFD session with authentication if available.
	AddBfdUDPSessionFromDetails(bfdSess *bfd_api.BfdUDPSessionDetails, bfdKeyIndexes idxvpp.NameToIdx) error
	// ModifyBfdUDPSession modifies existing BFD session excluding authentication which cannot be changed this way.
	ModifyBfdUDPSession(bfdSess *bfd.SingleHopBFD_Session, swIfIndexes ifaceidx.SwIfIndex) error
	// DeleteBfdUDPSession removes an existing BFD session.
	DeleteBfdUDPSession(ifIndex uint32, sourceAddress string, destAddress string) error
	// SetBfdUDPAuthenticationKey creates new authentication key.
	SetBfdUDPAuthenticationKey(bfdKey *bfd.SingleHopBFD_Key) error
	// DeleteBfdUDPAuthenticationKey removes the authentication key.
	DeleteBfdUDPAuthenticationKey(bfdKey *bfd.SingleHopBFD_Key) error
	// AddBfdEchoFunction sets up an echo function for the interface.
	AddBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction, swIfIndexes ifaceidx.SwIfIndex) error
	// DeleteBfdEchoFunction removes an echo function.
	DeleteBfdEchoFunction() error
}

BfdVppWrite provides write methods for BFD

type Client added in v1.8.1

type Client struct {
	SwIfIndex        uint32
	Hostname         string
	ID               string
	WantDhcpEvent    bool
	SetBroadcastFlag bool
	Pid              uint32
}

Client is helper struct grouping DHCP client data

type Dhcp added in v1.8.1

type Dhcp struct {
	Client *Client `json:"dhcp_client"`
	Lease  *Lease  `json:"dhcp_lease"`
}

Dhcp is helper struct for DHCP metadata, split to client and lease (similar to VPP binary API)

type IdentityMappingContext

type IdentityMappingContext struct {
	Tag       string
	IPAddress []byte
	Protocol  uint8
	Port      uint16
	IfIdx     uint32
	Vrf       uint32
}

IdentityMappingContext groups common fields required for identity mapping

type IfVppAPI added in v1.8.1

type IfVppAPI interface {
	IfVppWrite
	IfVppRead
}

IfVppAPI provides methods for creating and managing interface plugin

type IfVppHandler added in v1.8.1

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

IfVppHandler is accessor for interface-related vppcalls methods

func NewIfVppHandler added in v1.8.1

func NewIfVppHandler(callsChan api.Channel, log logging.Logger) *IfVppHandler

NewIfVppHandler creates new instance of interface vppcalls handler

func (*IfVppHandler) AddAfPacketInterface added in v1.8.1

func (h *IfVppHandler) AddAfPacketInterface(ifName string, hwAddr string, afPacketIntf *intf.Interfaces_Interface_Afpacket) (swIndex uint32, err error)

AddAfPacketInterface implements AfPacket handler.

func (*IfVppHandler) AddContainerIP added in v1.8.1

func (h *IfVppHandler) AddContainerIP(ifIdx uint32, addr string) error

AddContainerIP implements interface handler.

func (*IfVppHandler) AddInterfaceIP added in v1.8.1

func (h *IfVppHandler) AddInterfaceIP(ifIdx uint32, addr *net.IPNet) error

AddInterfaceIP implements interface handler.

func (*IfVppHandler) AddLoopbackInterface added in v1.8.1

func (h *IfVppHandler) AddLoopbackInterface(ifName string) (swIndex uint32, err error)

AddLoopbackInterface implements interface handler.

func (*IfVppHandler) AddMemifInterface added in v1.8.1

func (h *IfVppHandler) AddMemifInterface(ifName string, memIface *intf.Interfaces_Interface_Memif, socketID uint32) (swIdx uint32, err error)

AddMemifInterface implements interface handler.

func (*IfVppHandler) AddTapInterface added in v1.8.1

func (h *IfVppHandler) AddTapInterface(ifName string, tapIf *interfaces.Interfaces_Interface_Tap) (swIfIdx uint32, err error)

AddTapInterface implements interface handler.

func (*IfVppHandler) AddVmxNet3 added in v1.8.1

func (h *IfVppHandler) AddVmxNet3(ifName string, vmxNet3 *interfaces.Interfaces_Interface_VmxNet3) (swIdx uint32, err error)

AddVmxNet3 implements interface handler

func (*IfVppHandler) AddVxLanTunnel added in v1.8.1

func (h *IfVppHandler) AddVxLanTunnel(ifName string, vrf, multicastIf uint32, vxLan *intf.Interfaces_Interface_Vxlan) (swIndex uint32, err error)

AddVxLanTunnel implements VxLan handler.

func (*IfVppHandler) CreateVrf added in v1.8.1

func (h *IfVppHandler) CreateVrf(vrfID uint32) error

CreateVrf implements interface handler.

func (*IfVppHandler) CreateVrfIPv6 added in v1.8.1

func (h *IfVppHandler) CreateVrfIPv6(vrfID uint32) error

CreateVrfIPv6 implements interface handler.

func (*IfVppHandler) DelContainerIP added in v1.8.1

func (h *IfVppHandler) DelContainerIP(ifIdx uint32, addr string) error

DelContainerIP implements interface handler.

func (*IfVppHandler) DelInterfaceIP added in v1.8.1

func (h *IfVppHandler) DelInterfaceIP(ifIdx uint32, addr *net.IPNet) error

DelInterfaceIP implements interface handler.

func (*IfVppHandler) DelVmxNet3 added in v1.8.1

func (h *IfVppHandler) DelVmxNet3(ifName string, ifIdx uint32) error

DelVmxNet3 implements interface handler

func (*IfVppHandler) DeleteAfPacketInterface added in v1.8.1

func (h *IfVppHandler) DeleteAfPacketInterface(ifName string, idx uint32, afPacketIntf *intf.Interfaces_Interface_Afpacket) error

DeleteAfPacketInterface implements AfPacket handler.

func (*IfVppHandler) DeleteLoopbackInterface added in v1.8.1

func (h *IfVppHandler) DeleteLoopbackInterface(ifName string, idx uint32) error

DeleteLoopbackInterface implements interface handler.

func (*IfVppHandler) DeleteMemifInterface added in v1.8.1

func (h *IfVppHandler) DeleteMemifInterface(ifName string, idx uint32) error

DeleteMemifInterface implements interface handler.

func (*IfVppHandler) DeleteTapInterface added in v1.8.1

func (h *IfVppHandler) DeleteTapInterface(ifName string, idx uint32, version uint32) error

DeleteTapInterface implements interface handler.

func (*IfVppHandler) DeleteVxLanTunnel added in v1.8.1

func (h *IfVppHandler) DeleteVxLanTunnel(ifName string, idx, vrf uint32, vxLan *intf.Interfaces_Interface_Vxlan) error

DeleteVxLanTunnel implements VxLan handler.

func (*IfVppHandler) DumpInterfaces added in v1.8.1

func (h *IfVppHandler) DumpInterfaces() (map[uint32]*InterfaceDetails, error)

DumpInterfaces implements interface handler.

func (*IfVppHandler) DumpInterfacesByType added in v1.8.1

func (h *IfVppHandler) DumpInterfacesByType(reqType ifnb.InterfaceType) (map[uint32]*InterfaceDetails, error)

DumpInterfacesByType implements interface handler.

func (*IfVppHandler) DumpMemifSocketDetails added in v1.8.1

func (h *IfVppHandler) DumpMemifSocketDetails() (map[string]uint32, error)

DumpMemifSocketDetails implements interface handler.

func (*IfVppHandler) GetInterfaceVrf added in v1.8.1

func (h *IfVppHandler) GetInterfaceVrf(ifIdx uint32) (vrfID uint32, err error)

GetInterfaceVrf implements interface handler.

func (*IfVppHandler) GetInterfaceVrfIPv6 added in v1.8.1

func (h *IfVppHandler) GetInterfaceVrfIPv6(ifIdx uint32) (vrfID uint32, err error)

GetInterfaceVrfIPv6 implements interface handler.

func (*IfVppHandler) InterfaceAdminDown added in v1.8.1

func (h *IfVppHandler) InterfaceAdminDown(ifIdx uint32) error

InterfaceAdminDown implements interface handler.

func (*IfVppHandler) InterfaceAdminUp added in v1.8.1

func (h *IfVppHandler) InterfaceAdminUp(ifIdx uint32) error

InterfaceAdminUp implements interface handler.

func (*IfVppHandler) RegisterMemifSocketFilename added in v1.8.1

func (h *IfVppHandler) RegisterMemifSocketFilename(filename []byte, id uint32) error

RegisterMemifSocketFilename implements interface handler.

func (*IfVppHandler) RemoveInterfaceTag added in v1.8.1

func (h *IfVppHandler) RemoveInterfaceTag(tag string, ifIdx uint32) error

RemoveInterfaceTag implements interface handler.

func (*IfVppHandler) SetInterfaceAsDHCPClient added in v1.8.1

func (h *IfVppHandler) SetInterfaceAsDHCPClient(ifIdx uint32, hostName string) error

SetInterfaceAsDHCPClient implements interface handler.

func (*IfVppHandler) SetInterfaceMac added in v1.8.1

func (h *IfVppHandler) SetInterfaceMac(ifIdx uint32, macAddress string) error

SetInterfaceMac implements interface handler.

func (*IfVppHandler) SetInterfaceMtu added in v1.8.1

func (h *IfVppHandler) SetInterfaceMtu(ifIdx uint32, mtu uint32) error

SetInterfaceMtu implements interface handler.

func (*IfVppHandler) SetInterfaceTag added in v1.8.1

func (h *IfVppHandler) SetInterfaceTag(tag string, ifIdx uint32) error

SetInterfaceTag implements interface handler.

func (*IfVppHandler) SetInterfaceVrf added in v1.8.1

func (h *IfVppHandler) SetInterfaceVrf(ifIdx, vrfID uint32) error

SetInterfaceVrf implements interface handler.

func (*IfVppHandler) SetInterfaceVrfIPv6 added in v1.8.1

func (h *IfVppHandler) SetInterfaceVrfIPv6(ifIdx, vrfID uint32) error

SetInterfaceVrfIPv6 implements interface handler.

func (*IfVppHandler) SetRxMode added in v1.8.1

func (h *IfVppHandler) SetRxMode(ifIdx uint32, rxModeSettings *intf.Interfaces_Interface_RxModeSettings) error

SetRxMode implements interface handler.

func (*IfVppHandler) SetRxPlacement added in v1.8.1

func (h *IfVppHandler) SetRxPlacement(ifIdx uint32, rxPlacement *intf.Interfaces_Interface_RxPlacementSettings) error

SetRxPlacement implements interface handler.

func (*IfVppHandler) SetUnnumberedIP added in v1.8.1

func (h *IfVppHandler) SetUnnumberedIP(uIfIdx uint32, ifIdxWithIP uint32) error

SetUnnumberedIP implements interface handler.

func (*IfVppHandler) UnsetInterfaceAsDHCPClient added in v1.8.1

func (h *IfVppHandler) UnsetInterfaceAsDHCPClient(ifIdx uint32, hostName string) error

UnsetInterfaceAsDHCPClient implements interface handler.

func (*IfVppHandler) UnsetUnnumberedIP added in v1.8.1

func (h *IfVppHandler) UnsetUnnumberedIP(uIfIdx uint32) error

UnsetUnnumberedIP implements interface handler.

func (*IfVppHandler) WatchInterfaceEvents added in v1.8.1

func (h *IfVppHandler) WatchInterfaceEvents(events chan<- *InterfaceEvent) error

WatchInterfaceEvents starts watching for interface events.

type IfVppRead added in v1.8.1

type IfVppRead interface {
	// DumpInterfaces dumps VPP interface data into the northbound API data structure
	// map indexed by software interface index.
	//
	// LIMITATIONS:
	// - there is no af_packet dump binary API. We relay on naming conventions of the internal VPP interface names
	// - ip.IPAddressDetails has wrong internal structure, as a workaround we need to handle them as notifications
	DumpInterfaces() (map[uint32]*InterfaceDetails, error)
	// DumpInterfacesByType returns all VPP interfaces of the specified type
	DumpInterfacesByType(reqType interfaces.InterfaceType) (map[uint32]*InterfaceDetails, error)
	// GetInterfaceVrf reads VRF table to interface
	GetInterfaceVrf(ifIdx uint32) (vrfID uint32, err error)
	// GetInterfaceVrfIPv6 reads IPv6 VRF table to interface
	GetInterfaceVrfIPv6(ifIdx uint32) (vrfID uint32, err error)
	// DumpMemifSocketDetails dumps memif socket details from the VPP
	DumpMemifSocketDetails() (map[string]uint32, error)
	// WatchInterfaceEvents starts watching for interface events.
	WatchInterfaceEvents(ch chan<- *InterfaceEvent) error
}

IfVppRead provides read methods for interface plugin

type IfVppWrite added in v1.8.1

type IfVppWrite interface {
	// AddAfPacketInterface calls AfPacketCreate VPP binary API.
	AddAfPacketInterface(ifName string, hwAddr string, afPacketIntf *interfaces.Interfaces_Interface_Afpacket) (swIndex uint32, err error)
	// DeleteAfPacketInterface calls AfPacketDelete VPP binary API.
	DeleteAfPacketInterface(ifName string, idx uint32, afPacketIntf *interfaces.Interfaces_Interface_Afpacket) error
	// AddLoopbackInterface calls CreateLoopback bin API.
	AddLoopbackInterface(ifName string) (swIndex uint32, err error)
	// DeleteLoopbackInterface calls DeleteLoopback bin API.
	DeleteLoopbackInterface(ifName string, idx uint32) error
	// AddMemifInterface calls MemifCreate bin API.
	AddMemifInterface(ifName string, memIface *interfaces.Interfaces_Interface_Memif, socketID uint32) (swIdx uint32, err error)
	// DeleteMemifInterface calls MemifDelete bin API.
	DeleteMemifInterface(ifName string, idx uint32) error
	// AddTapInterface calls TapConnect bin API.
	AddTapInterface(ifName string, tapIf *interfaces.Interfaces_Interface_Tap) (swIfIdx uint32, err error)
	// DeleteTapInterface calls TapDelete bin API.
	DeleteTapInterface(ifName string, idx uint32, version uint32) error
	// AddVxLanTunnel calls AddDelVxLanTunnelReq with flag add=1.
	AddVxLanTunnel(ifName string, vrf, multicastIf uint32, vxLan *interfaces.Interfaces_Interface_Vxlan) (swIndex uint32, err error)
	// DeleteVxLanTunnel calls AddDelVxLanTunnelReq with flag add=0.
	DeleteVxLanTunnel(ifName string, idx, vrf uint32, vxLan *interfaces.Interfaces_Interface_Vxlan) error
	// InterfaceAdminDown calls binary API SwInterfaceSetFlagsReply with AdminUpDown=0.
	InterfaceAdminDown(ifIdx uint32) error
	// InterfaceAdminUp calls binary API SwInterfaceSetFlagsReply with AdminUpDown=1.
	InterfaceAdminUp(ifIdx uint32) error
	// SetInterfaceTag registers new interface index/tag pair
	SetInterfaceTag(tag string, ifIdx uint32) error
	// RemoveInterfaceTag un-registers new interface index/tag pair
	RemoveInterfaceTag(tag string, ifIdx uint32) error
	// SetInterfaceAsDHCPClient sets provided interface as a DHCP client
	SetInterfaceAsDHCPClient(ifIdx uint32, hostName string) error
	// UnsetInterfaceAsDHCPClient un-sets interface as DHCP client
	UnsetInterfaceAsDHCPClient(ifIdx uint32, hostName string) error
	// AddContainerIP calls IPContainerProxyAddDel VPP API with IsAdd=1
	AddContainerIP(ifIdx uint32, addr string) error
	// DelContainerIP calls IPContainerProxyAddDel VPP API with IsAdd=0
	DelContainerIP(ifIdx uint32, addr string) error
	// AddInterfaceIP calls SwInterfaceAddDelAddress bin API with IsAdd=1.
	AddInterfaceIP(ifIdx uint32, addr *net.IPNet) error
	// DelInterfaceIP calls SwInterfaceAddDelAddress bin API with IsAdd=00.
	DelInterfaceIP(ifIdx uint32, addr *net.IPNet) error
	// SetUnnumberedIP sets interface as un-numbered, linking IP address of the another interface (ifIdxWithIP)
	SetUnnumberedIP(uIfIdx uint32, ifIdxWithIP uint32) error
	// UnsetUnnumberedIP unset provided interface as un-numbered. IP address of the linked interface is removed
	UnsetUnnumberedIP(uIfIdx uint32) error
	// SetInterfaceMac calls SwInterfaceSetMacAddress bin API.
	SetInterfaceMac(ifIdx uint32, macAddress string) error
	// RegisterMemifSocketFilename registers new socket file name with provided ID.
	RegisterMemifSocketFilename(filename []byte, id uint32) error
	// SetInterfaceMtu calls HwInterfaceSetMtu bin API with desired MTU value.
	SetInterfaceMtu(ifIdx uint32, mtu uint32) error
	// SetRxMode calls SwInterfaceSetRxMode bin
	SetRxMode(ifIdx uint32, rxModeSettings *interfaces.Interfaces_Interface_RxModeSettings) error
	// SetRxPlacement configures rx-placement for interface
	SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interfaces_Interface_RxPlacementSettings) error
	// AddVmxNet3 configures vmxNet3 interface. Second parameter is optional in this case.
	AddVmxNet3(ifName string, vmxNet3 *interfaces.Interfaces_Interface_VmxNet3) (uint32, error)
	// DelVmxNet3 removes vmxNet3 interface
	DelVmxNet3(ifName string, ifIdx uint32) error
	// CreateVrf checks if VRF exists and creates it if not
	CreateVrf(vrfID uint32) error
	// CreateVrfIPv6 checks if IPv6 VRF exists and creates it if not
	CreateVrfIPv6(vrfID uint32) error
	// SetInterfaceVrf retrieves VRF table from interface
	SetInterfaceVrf(ifaceIndex, vrfID uint32) error
	// SetInterfaceVrfIPv6 retrieves IPV6 VRF table from interface
	SetInterfaceVrfIPv6(ifaceIndex, vrfID uint32) error
}

IfVppWrite provides write methods for interface plugin

type InterfaceDetails added in v1.8.1

type InterfaceDetails struct {
	Interface *ifnb.Interfaces_Interface `json:"interface"`
	Meta      *InterfaceMeta             `json:"interface_meta"`
}

InterfaceDetails is the wrapper structure for the interface northbound API structure.

type InterfaceEvent added in v1.8.1

type InterfaceEvent struct {
	SwIfIndex  uint32
	AdminState uint8
	LinkState  uint8
	Deleted    bool
}

InterfaceEvent represents interface event from VPP.

type InterfaceMeta added in v1.8.1

type InterfaceMeta struct {
	SwIfIndex    uint32 `json:"sw_if_index"`
	Tag          string `json:"tag"`
	InternalName string `json:"internal_name"`
	Dhcp         *Dhcp  `json:"dhcp"`
	VrfIPv4      uint32 `json:"vrf_ipv4"`
	VrfIPv6      uint32 `json:"vrf_ipv6"`
	Pci          uint32 `json:"pci"`
	AdminState   uint8  `json:"admin_state"`
	LinkState    uint8  `json:"link_state"`
	LinkMTU      uint16 `json:"link_mtu"`
	LinkSpeed    uint32 `json:"link_speed"`
}

InterfaceMeta is combination of proto-modelled Interface data and VPP provided metadata

type Lease added in v1.8.1

type Lease struct {
	SwIfIndex     uint32
	State         uint8
	Hostname      string
	IsIPv6        bool
	MaskWidth     uint8
	HostAddress   string
	RouterAddress string
	HostMac       string
}

Lease is helper struct grouping DHCP lease data

type LocalLbAddress

type LocalLbAddress struct {
	Vrf         uint32
	Tag         string
	LocalIP     []byte
	LocalPort   uint16
	Probability uint8
}

LocalLbAddress represents one local IP and address entry

type Nat44Details added in v1.8.1

type Nat44Details struct {
	Global *nat.Nat44Global
	DNat   *nat.Nat44DNat
}

Nat44Details contains all configuration available for network address translation. Note: SNAT is currently skipped, since there is no model defined for it

type NatVppAPI added in v1.8.1

type NatVppAPI interface {
	NatVppWrite
	NatVppRead
}

NatVppAPI provides methods for managing NAT

type NatVppHandler added in v1.8.1

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

NatVppHandler is accessor for NAT-related vppcalls methods

func NewNatVppHandler added in v1.8.1

func NewNatVppHandler(callsChan, dumpChan api.Channel, ifIndexes ifaceidx.SwIfIndex, log logging.Logger) *NatVppHandler

NewNatVppHandler creates new instance of NAT vppcalls handler

func (*NatVppHandler) AddNat44AddressPool added in v1.8.1

func (h *NatVppHandler) AddNat44AddressPool(first, last []byte, vrf uint32, twiceNat bool) error

AddNat44AddressPool implements NAT handler.

func (*NatVppHandler) AddNat44IdentityMapping added in v1.8.1

func (h *NatVppHandler) AddNat44IdentityMapping(ctx *IdentityMappingContext) error

AddNat44IdentityMapping implements NAT handler.

func (*NatVppHandler) AddNat44StaticMapping added in v1.8.1

func (h *NatVppHandler) AddNat44StaticMapping(ctx *StaticMappingContext) error

AddNat44StaticMapping implements NAT handler.

func (*NatVppHandler) AddNat44StaticMappingLb added in v1.8.1

func (h *NatVppHandler) AddNat44StaticMappingLb(ctx *StaticMappingLbContext) error

AddNat44StaticMappingLb implements NAT handler.

func (*NatVppHandler) DelNat44AddressPool added in v1.8.1

func (h *NatVppHandler) DelNat44AddressPool(first, last []byte, vrf uint32, twiceNat bool) error

DelNat44AddressPool implements NAT handler.

func (*NatVppHandler) DelNat44IdentityMapping added in v1.8.1

func (h *NatVppHandler) DelNat44IdentityMapping(ctx *IdentityMappingContext) error

DelNat44IdentityMapping implements NAT handler.

func (*NatVppHandler) DelNat44StaticMapping added in v1.8.1

func (h *NatVppHandler) DelNat44StaticMapping(ctx *StaticMappingContext) error

DelNat44StaticMapping implements NAT handler.

func (*NatVppHandler) DelNat44StaticMappingLb added in v1.8.1

func (h *NatVppHandler) DelNat44StaticMappingLb(ctx *StaticMappingLbContext) error

DelNat44StaticMappingLb implements NAT handler.

func (*NatVppHandler) DisableNat44Interface added in v1.8.1

func (h *NatVppHandler) DisableNat44Interface(ifIdx uint32, isInside bool) error

DisableNat44Interface implements NAT handler.

func (*NatVppHandler) DisableNat44InterfaceOutput added in v1.8.1

func (h *NatVppHandler) DisableNat44InterfaceOutput(ifIdx uint32, isInside bool) error

DisableNat44InterfaceOutput implements NAT handler.

func (*NatVppHandler) EnableNat44Interface added in v1.8.1

func (h *NatVppHandler) EnableNat44Interface(ifIdx uint32, isInside bool) error

EnableNat44Interface implements NAT handler.

func (*NatVppHandler) EnableNat44InterfaceOutput added in v1.8.1

func (h *NatVppHandler) EnableNat44InterfaceOutput(ifIdx uint32, isInside bool) error

EnableNat44InterfaceOutput implements NAT handler.

func (*NatVppHandler) Nat44DNatDump added in v1.8.1

func (h *NatVppHandler) Nat44DNatDump() (*nat.Nat44DNat, error)

Nat44DNatDump implements NAT handler.

func (*NatVppHandler) Nat44Dump added in v1.8.1

func (h *NatVppHandler) Nat44Dump() (*Nat44Details, error)

Nat44Dump implements NAT handler.

func (*NatVppHandler) Nat44GlobalConfigDump added in v1.8.1

func (h *NatVppHandler) Nat44GlobalConfigDump() (*nat.Nat44Global, error)

Nat44GlobalConfigDump implements NAT handler.

func (*NatVppHandler) Nat44InterfaceDump added in v1.8.1

func (h *NatVppHandler) Nat44InterfaceDump() (interfaces []*nat.Nat44Global_NatInterface, err error)

Nat44InterfaceDump implements NAT handler.

func (*NatVppHandler) SetNat44Forwarding added in v1.8.1

func (h *NatVppHandler) SetNat44Forwarding(enableFwd bool) error

SetNat44Forwarding implements NAT handler.

func (*NatVppHandler) SetVirtualReassemblyIPv4 added in v1.8.1

func (h *NatVppHandler) SetVirtualReassemblyIPv4(vrCfg *nat2.Nat44Global_VirtualReassembly) error

SetVirtualReassemblyIPv4 implements NAT handler.

func (*NatVppHandler) SetVirtualReassemblyIPv6 added in v1.8.1

func (h *NatVppHandler) SetVirtualReassemblyIPv6(vrCfg *nat2.Nat44Global_VirtualReassembly) error

SetVirtualReassemblyIPv6 implements NAT handler.

type NatVppRead added in v1.8.1

type NatVppRead interface {
	// Nat44Dump retuns global NAT configuration together with the DNAT configs
	Nat44Dump() (*Nat44Details, error)
	// Nat44GlobalConfigDump returns global config in NB format
	Nat44GlobalConfigDump() (*nat.Nat44Global, error)
	// NAT44NatDump dumps all types of mappings, sorts it according to tag (DNAT label) and creates a set of DNAT configurations
	Nat44DNatDump() (*nat.Nat44DNat, error)
	// Nat44InterfaceDump returns a list of interfaces enabled for NAT44
	Nat44InterfaceDump() (interfaces []*nat.Nat44Global_NatInterface, err error)
}

NatVppRead provides read methods for NAT

type NatVppWrite added in v1.8.1

type NatVppWrite interface {
	// SetNat44Forwarding configures global forwarding setup for NAT44
	SetNat44Forwarding(enableFwd bool) error
	// EnableNat44Interface enables NAT feature for provided interface
	EnableNat44Interface(ifIdx uint32, isInside bool) error
	// DisableNat44Interface enables NAT feature for provided interface
	DisableNat44Interface(ifIdx uint32, isInside bool) error
	// EnableNat44InterfaceOutput enables NAT output feature for provided interface
	EnableNat44InterfaceOutput(ifIdx uint32, isInside bool) error
	// DisableNat44InterfaceOutput disables NAT output feature for provided interface
	DisableNat44InterfaceOutput(ifIdx uint32, isInside bool) error
	// AddNat44AddressPool sets new NAT address pool
	AddNat44AddressPool(first, last []byte, vrf uint32, twiceNat bool) error
	// DelNat44AddressPool removes existing NAT address pool
	DelNat44AddressPool(first, last []byte, vrf uint32, twiceNat bool) error
	// SetVirtualReassemblyIPv4 configures NAT virtual reassembly for IPv4 packets
	SetVirtualReassemblyIPv4(vrCfg *nat.Nat44Global_VirtualReassembly) error
	// SetVirtualReassemblyIPv4 configures NAT virtual reassembly for IPv6 packets
	SetVirtualReassemblyIPv6(vrCfg *nat.Nat44Global_VirtualReassembly) error
	// AddNat44IdentityMapping adds new NAT44 identity mapping
	AddNat44IdentityMapping(ctx *IdentityMappingContext) error
	// DelNat44IdentityMapping removes NAT44 identity mapping
	DelNat44IdentityMapping(ctx *IdentityMappingContext) error
	// AddNat44StaticMapping creates new static mapping entry (considering address only or both, address and port
	// depending on the context)
	AddNat44StaticMapping(ctx *StaticMappingContext) error
	// DelNat44StaticMapping removes existing static mapping entry
	DelNat44StaticMapping(ctx *StaticMappingContext) error
	// AddNat44StaticMappingLb creates new static mapping entry with load balancer
	AddNat44StaticMappingLb(ctx *StaticMappingLbContext) error
	// DelNat44StaticMappingLb removes existing static mapping entry with load balancer
	DelNat44StaticMappingLb(ctx *StaticMappingLbContext) error
}

NatVppWrite provides write methods for NAT

type StaticMappingContext

type StaticMappingContext struct {
	Tag           string
	AddressOnly   bool
	LocalIP       []byte
	LocalPort     uint16
	ExternalIP    []byte
	ExternalPort  uint16
	ExternalIfIdx uint32
	Protocol      uint8
	Vrf           uint32
	TwiceNat      bool
	SelfTwiceNat  bool
}

StaticMappingContext groups common fields required for static mapping

type StaticMappingLbContext

type StaticMappingLbContext struct {
	Tag          string
	LocalIPs     []*LocalLbAddress
	ExternalIP   []byte
	ExternalPort uint16
	Protocol     uint8
	TwiceNat     bool
	SelfTwiceNat bool
}

StaticMappingLbContext groups common fields required for static mapping with load balancer

type StnDetails added in v1.8.1

type StnDetails struct {
	Rules []*stn.STN_Rule
	Meta  *StnMeta
}

StnDetails contains proto-modelled STN data and vpp specific metadata

type StnMeta added in v1.8.1

type StnMeta struct {
	IfNameToIdx map[uint32]string
}

StnMeta contains map of interface name/index

type StnRule

type StnRule struct {
	IPAddress net.IP
	IfaceIdx  uint32
}

StnRule represents stn rule entry

type StnVppAPI added in v1.8.1

type StnVppAPI interface {
	StnVppWrite
	StnVppRead
}

StnVppAPI provides methods for managing STN

type StnVppHandler added in v1.8.1

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

StnVppHandler is accessor for STN-related vppcalls methods

func NewStnVppHandler added in v1.8.1

func NewStnVppHandler(callsChan api.Channel, ifIndexes ifaceidx.SwIfIndex, log logging.Logger) *StnVppHandler

NewStnVppHandler creates new instance of STN vppcalls handler

func (*StnVppHandler) AddStnRule added in v1.8.1

func (h *StnVppHandler) AddStnRule(ifIdx uint32, addr *net.IP) error

AddStnRule implements STN handler.

func (*StnVppHandler) DelStnRule added in v1.8.1

func (h *StnVppHandler) DelStnRule(ifIdx uint32, addr *net.IP) error

DelStnRule implements STN handler.

func (*StnVppHandler) DumpStnRules added in v1.8.1

func (h *StnVppHandler) DumpStnRules() (rules *StnDetails, err error)

DumpStnRules implements STN handler.

type StnVppRead added in v1.8.1

type StnVppRead interface {
	// DumpStnRules returns a list of all STN rules configured on the VPP
	DumpStnRules() (rules *StnDetails, err error)
}

StnVppRead provides read methods for STN

type StnVppWrite added in v1.8.1

type StnVppWrite interface {
	// AddStnRule calls StnAddDelRule bin API with IsAdd=1
	AddStnRule(ifIdx uint32, addr *net.IP) error
	// DelStnRule calls StnAddDelRule bin API with IsAdd=0
	DelStnRule(ifIdx uint32, addr *net.IP) error
}

StnVppWrite provides write methods for STN

Jump to

Keyboard shortcuts

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