vppcalls

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package vppcalls contains wrappers over VPP binary APIs for all supported interface types.

Index

Constants

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

Num protocol representation

View Source
const NoInterface uint32 = 0xffffffff

NoInterface is sw-if-idx which means 'no interface'

Variables

This section is empty.

Functions

func AddAfPacketInterface

func AddAfPacketInterface(ifName string, afPacketIntf *intf.Interfaces_Interface_Afpacket, vppChan VPPChannel, stopwatch *measure.Stopwatch) (swIndex uint32, err error)

AddAfPacketInterface calls AfPacketCreate VPP binary API.

func AddBfdEchoFunction

func AddBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction, swIfIndexes ifaceidx.SwIfIndex, vppChan VPPChannel, stopwatch *measure.Stopwatch) (err error)

AddBfdEchoFunction sets up an echo function for the interface.

func AddBfdUDPSession

func AddBfdUDPSession(bfdSess *bfd.SingleHopBFD_Session, ifIdx uint32, bfdKeyIndexes idxvpp.NameToIdx,
	log logging.Logger, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddBfdUDPSession adds new BFD session with authentication if available.

func AddBfdUDPSessionFromDetails

func AddBfdUDPSessionFromDetails(bfdSess *bfd_api.BfdUDPSessionDetails, bfdKeyIndexes idxvpp.NameToIdx, log logging.Logger,
	vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddBfdUDPSessionFromDetails adds new BFD session with authentication if available.

func AddContainerIP added in v1.4.0

func AddContainerIP(ifIdx uint32, addr string, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddContainerIP calls IPContainerProxyAddDel VPP API with IsAdd=1

func AddInterfaceIP

func AddInterfaceIP(ifIdx uint32, addr *net.IPNet, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddInterfaceIP calls SwInterfaceAddDelAddress bin API with IsAdd=1.

func AddLoopbackInterface

func AddLoopbackInterface(ifName string, vppChan VPPChannel, stopwatch *measure.Stopwatch) (swIndex uint32, err error)

AddLoopbackInterface calls CreateLoopback bin API.

func AddMemifInterface

func AddMemifInterface(ifName string, memIface *intf.Interfaces_Interface_Memif, socketID uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) (swIdx uint32, err error)

AddMemifInterface calls MemifCreate bin API.

func AddNat44AddressPool added in v1.4.0

func AddNat44AddressPool(first, last []byte, vrf uint32, twiceNat bool, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddNat44AddressPool sets new NAT address pool

func AddNat44IdentityMapping added in v1.4.0

func AddNat44IdentityMapping(ctx *IdentityMappingContext, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddNat44IdentityMapping sets new NAT address pool

func AddNat44StaticMapping added in v1.4.0

func AddNat44StaticMapping(ctx *StaticMappingContext, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddNat44StaticMapping creates new static mapping entry (considering address only or both, address and port depending on the context)

func AddNat44StaticMappingLb added in v1.4.0

func AddNat44StaticMappingLb(ctx *StaticMappingLbContext, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddNat44StaticMappingLb creates new static mapping entry with load balancer

func AddStnRule added in v1.0.8

func AddStnRule(ifIdx uint32, addr *net.IP, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

AddStnRule calls StnAddDelRule bin API with IsAdd=1

func AddTapInterface

func AddTapInterface(ifName string, tapIf *interfaces.Interfaces_Interface_Tap, vppChan VPPChannel, stopwatch *measure.Stopwatch) (swIfIdx uint32, err error)

AddTapInterface calls TapConnect bin API.

func AddVxlanTunnel

func AddVxlanTunnel(ifName string, vxlanIntf *intf.Interfaces_Interface_Vxlan, encapVrf uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) (swIndex uint32, err error)

AddVxlanTunnel calls AddDelVxlanTunnelReq with flag add=1.

func CheckMsgCompatibilityForBfd

func CheckMsgCompatibilityForBfd(vppChan VPPChannel) error

CheckMsgCompatibilityForBfd checks if bfd CRSs are compatible with VPP in runtime.

func CheckMsgCompatibilityForInterface

func CheckMsgCompatibilityForInterface(log logging.Logger, vppChan VPPChannel) error

CheckMsgCompatibilityForInterface checks if interface CRSs are compatible with VPP in runtime.

func CheckMsgCompatibilityForNat added in v1.4.0

func CheckMsgCompatibilityForNat(vppChan VPPChannel) error

CheckMsgCompatibilityForNat verifies compatibility of used binary API calls

func CheckMsgCompatibilityForStn added in v1.4.0

func CheckMsgCompatibilityForStn(vppChan VPPChannel) error

CheckMsgCompatibilityForStn verifies compatibility of used binary API calls

func CreateVrfIfNeeded added in v1.4.0

func CreateVrfIfNeeded(vrf uint32, vppChan VPPChannel) error

CreateVrfIfNeeded checks if VRF exists and creates it if not

func DelContainerIP added in v1.4.0

func DelContainerIP(ifIdx uint32, addr string, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DelContainerIP calls IPContainerProxyAddDel VPP API with IsAdd=0

func DelInterfaceIP

func DelInterfaceIP(ifIdx uint32, addr *net.IPNet, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DelInterfaceIP calls SwInterfaceAddDelAddress bin API with IsAdd=00.

func DelNat44AddressPool added in v1.4.0

func DelNat44AddressPool(first, last []byte, vrf uint32, twiceNat bool, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DelNat44AddressPool removes existing NAT address pool

func DelNat44IdentityMapping added in v1.4.0

func DelNat44IdentityMapping(ctx *IdentityMappingContext, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DelNat44IdentityMapping sets new NAT address pool

func DelNat44StaticMapping added in v1.4.0

func DelNat44StaticMapping(ctx *StaticMappingContext, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DelNat44StaticMapping removes existing static mapping entry

func DelNat44StaticMappingLb added in v1.4.0

func DelNat44StaticMappingLb(ctx *StaticMappingLbContext, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DelNat44StaticMappingLb removes existing static mapping entry with load balancer

func DelStnRule added in v1.0.8

func DelStnRule(ifIdx uint32, addr *net.IP, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DelStnRule calls StnAddDelRule bin API with IsAdd=0

func DeleteAfPacketInterface

func DeleteAfPacketInterface(ifName string, idx uint32, afPacketIntf *intf.Interfaces_Interface_Afpacket, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DeleteAfPacketInterface calls AfPacketDelete VPP binary API.

func DeleteBfdEchoFunction

func DeleteBfdEchoFunction(vppChan VPPChannel, stopwatch *measure.Stopwatch) (err error)

DeleteBfdEchoFunction removes an echo function.

func DeleteBfdUDPAuthenticationKey

func DeleteBfdUDPAuthenticationKey(bfdKey *bfd.SingleHopBFD_Key, vppChan VPPChannel, stopwatch *measure.Stopwatch) (err error)

DeleteBfdUDPAuthenticationKey removes the authentication key.

func DeleteBfdUDPSession

func DeleteBfdUDPSession(ifIndex uint32, sourceAddress string, destAddress string, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DeleteBfdUDPSession removes an existing BFD session.

func DeleteLoopbackInterface

func DeleteLoopbackInterface(ifName string, idx uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DeleteLoopbackInterface calls DeleteLoopback bin API.

func DeleteMemifInterface

func DeleteMemifInterface(ifName string, idx uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DeleteMemifInterface calls MemifDelete bin API.

func DeleteTapInterface

func DeleteTapInterface(ifName string, idx uint32, version uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DeleteTapInterface calls TapDelete bin API.

func DeleteVxlanTunnel

func DeleteVxlanTunnel(ifName string, idx uint32, vxlanIntf *intf.Interfaces_Interface_Vxlan, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DeleteVxlanTunnel calls AddDelVxlanTunnelReq with flag add=0.

func DisableNat44Interface added in v1.4.0

func DisableNat44Interface(ifIdx uint32, isInside bool, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DisableNat44Interface enables NAT feature for provided interface

func DisableNat44InterfaceOutput added in v1.4.0

func DisableNat44InterfaceOutput(ifIdx uint32, isInside bool, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

DisableNat44InterfaceOutput disables NAT output feature for provided interface

func DumpBfdKeys added in v1.4.0

func DumpBfdKeys(vppChan VPPChannel, stopwatch *measure.Stopwatch) (keys []*bfd_api.BfdAuthKeysDetails, err error)

DumpBfdKeys looks up all BFD auth keys and saves their name-to-index mapping

func DumpBfdUDPSessions added in v1.4.0

func DumpBfdUDPSessions(vppChan VPPChannel, stopwatch *measure.Stopwatch) ([]*bfd_api.BfdUDPSessionDetails, error)

DumpBfdUDPSessions returns a list of BFD session's metadata

func DumpBfdUDPSessionsWithID

func DumpBfdUDPSessionsWithID(authKeyIndex uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) ([]*bfd_api.BfdUDPSessionDetails, error)

DumpBfdUDPSessionsWithID returns a list of BFD session's metadata filtered according to provided authentication key

func EnableNat44Interface added in v1.4.0

func EnableNat44Interface(ifIdx uint32, isInside bool, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

EnableNat44Interface enables NAT feature for provided interface

func EnableNat44InterfaceOutput added in v1.4.0

func EnableNat44InterfaceOutput(ifIdx uint32, isInside bool, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

EnableNat44InterfaceOutput enables NAT output feature for provided interface

func GetInterfaceVRF added in v1.0.8

func GetInterfaceVRF(ifIdx uint32, log logging.Logger, vppChan VPPChannel) (vrfID uint32, err error)

GetInterfaceVRF assigns VRF table to interface

func InterfaceAdminDown

func InterfaceAdminDown(ifIdx uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

InterfaceAdminDown calls binary API SwInterfaceSetFlagsReply with AdminUpDown=0.

func InterfaceAdminUp

func InterfaceAdminUp(ifIdx uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

InterfaceAdminUp calls binary API SwInterfaceSetFlagsReply with AdminUpDown=1.

func ModifyBfdUDPSession

func ModifyBfdUDPSession(bfdSess *bfd.SingleHopBFD_Session, swIfIndexes ifaceidx.SwIfIndex, vppChan VPPChannel, stopwatch *measure.Stopwatch) (err error)

ModifyBfdUDPSession modifies existing BFD session excluding authentication which cannot be changed this way.

func RegisterMemifSocketFilename added in v1.4.0

func RegisterMemifSocketFilename(filename []byte, id uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

RegisterMemifSocketFilename registers new socket file name with provided ID.

func RemoveInterfaceTag added in v1.4.0

func RemoveInterfaceTag(tag string, ifIdx uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

RemoveInterfaceTag un-registers new interface index/tag pair

func SetBfdUDPAuthenticationKey

func SetBfdUDPAuthenticationKey(bfdKey *bfd.SingleHopBFD_Key, log logging.Logger, vppChan VPPChannel, stopwatch *measure.Stopwatch) (err error)

SetBfdUDPAuthenticationKey creates new authentication key.

func SetInterfaceAsDHCPClient added in v1.4.0

func SetInterfaceAsDHCPClient(ifIdx uint32, hostName string, vppChan VPPChannel, stopwatch *measure.Stopwatch) (err error)

SetInterfaceAsDHCPClient sets provided interface as a DHCP client

func SetInterfaceMac

func SetInterfaceMac(ifIdx uint32, macAddress string, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

SetInterfaceMac calls SwInterfaceSetMacAddress bin API.

func SetInterfaceMtu added in v1.0.5

func SetInterfaceMtu(ifIdx uint32, mtu uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

SetInterfaceMtu calls SwInterfaceSetMtu bin API with desired MTU value.

func SetInterfaceTag added in v1.4.0

func SetInterfaceTag(tag string, ifIdx uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

SetInterfaceTag registers new interface index/tag pair

func SetInterfaceVRF added in v1.0.8

func SetInterfaceVRF(ifaceIndex, vrfIndex uint32, log logging.Logger, vppChan VPPChannel) error

SetInterfaceVRF retrieves VRF table from interface

func SetNat44Forwarding added in v1.4.0

func SetNat44Forwarding(enableFwd bool, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

SetNat44Forwarding configures global forwarding setup for NAT44

func SetRxMode added in v1.0.8

func SetRxMode(ifIdx uint32, rxModeSettings *intf.Interfaces_Interface_RxModeSettings, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

SetRxMode calls SwInterfaceSetRxMode bin

func SetUnnumberedIP added in v1.4.0

func SetUnnumberedIP(uIfIdx uint32, ifIdxWithIP uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

SetUnnumberedIP sets interface as un-numbered, linking IP address of the another interface (ifIdxWithIP)

func UnsetInterfaceAsDHCPClient added in v1.4.0

func UnsetInterfaceAsDHCPClient(ifIdx uint32, hostName string, vppChan VPPChannel, stopwatch *measure.Stopwatch) (err error)

UnsetInterfaceAsDHCPClient un-sets interface as DHCP client

func UnsetUnnumberedIP added in v1.4.0

func UnsetUnnumberedIP(uIfIdx uint32, vppChan VPPChannel, stopwatch *measure.Stopwatch) error

UnsetUnnumberedIP unset provided interface as un-numbered. IP address of the linked interface is removed

Types

type IdentityMappingContext added in v1.4.0

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

IdentityMappingContext groups common fields required for identity mapping

type LocalLbAddress added in v1.4.0

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

LocalLbAddress represents one local IP and address entry

type StaticMappingContext added in v1.4.0

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 added in v1.4.0

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

StaticMappingLbContext groups common fields required for static mapping with load balancer

type StnRule added in v1.0.8

type StnRule struct {
	IPAddress net.IP
	IfaceIdx  uint32
}

StnRule represents stn rule entry

type VPPChannel added in v1.4.0

type VPPChannel interface {
	SendRequest(msg govppapi.Message) *govppapi.RequestCtx

	SendMultiRequest(msg govppapi.Message) *govppapi.MultiRequestCtx

	CheckMessageCompatibility(messages ...govppapi.Message) error

	SubscribeNotification(notifChan chan govppapi.Message, msgFactory func() govppapi.Message) (*govppapi.NotifSubscription, error)

	UnsubscribeNotification(subscription *govppapi.NotifSubscription) error
}

VPPChannel is interface for send request to VPP channel

Jump to

Keyboard shortcuts

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