vppcalls

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: Apache-2.0 Imports: 26 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, hwAddr string, afPacketIntf *intf.Interfaces_Interface_Afpacket, vppChan govppapi.Channel, 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 govppapi.Channel, 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 govppapi.Channel, 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 govppapi.Channel, stopwatch *measure.Stopwatch) error

AddBfdUDPSessionFromDetails adds new BFD session with authentication if available.

func AddContainerIP

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

AddContainerIP calls IPContainerProxyAddDel VPP API with IsAdd=1

func AddInterfaceIP

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

AddInterfaceIP calls SwInterfaceAddDelAddress bin API with IsAdd=1.

func AddLoopbackInterface

func AddLoopbackInterface(ifName string, vppChan govppapi.Channel, 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 govppapi.Channel, stopwatch *measure.Stopwatch) (swIdx uint32, err error)

AddMemifInterface calls MemifCreate bin API.

func AddNat44AddressPool

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

AddNat44AddressPool sets new NAT address pool

func AddNat44IdentityMapping

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

AddNat44IdentityMapping sets new NAT address pool

func AddNat44StaticMapping

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

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

func AddNat44StaticMappingLb

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

AddNat44StaticMappingLb creates new static mapping entry with load balancer

func AddStnRule

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

AddStnRule calls StnAddDelRule bin API with IsAdd=1

func AddTapInterface

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

AddTapInterface calls TapConnect bin API.

func AddVxlanTunnel

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

AddVxlanTunnel calls AddDelVxlanTunnelReq with flag add=1.

func CheckMsgCompatibilityForBfd

func CheckMsgCompatibilityForBfd(vppChan govppapi.Channel) error

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

func CheckMsgCompatibilityForInterface

func CheckMsgCompatibilityForInterface(log logging.Logger, vppChan govppapi.Channel) error

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

func CheckMsgCompatibilityForNat

func CheckMsgCompatibilityForNat(vppChan govppapi.Channel) error

CheckMsgCompatibilityForNat verifies compatibility of used binary API calls

func CheckMsgCompatibilityForStn

func CheckMsgCompatibilityForStn(vppChan govppapi.Channel) error

CheckMsgCompatibilityForStn verifies compatibility of used binary API calls

func CreateVrfIfNeeded

func CreateVrfIfNeeded(vrfID uint32, vppChan govppapi.Channel) error

CreateVrfIfNeeded checks if VRF exists and creates it if not

func DelContainerIP

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

DelContainerIP calls IPContainerProxyAddDel VPP API with IsAdd=0

func DelInterfaceIP

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

DelInterfaceIP calls SwInterfaceAddDelAddress bin API with IsAdd=00.

func DelNat44AddressPool

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

DelNat44AddressPool removes existing NAT address pool

func DelNat44IdentityMapping

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

DelNat44IdentityMapping sets new NAT address pool

func DelNat44StaticMapping

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

DelNat44StaticMapping removes existing static mapping entry

func DelNat44StaticMappingLb

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

DelNat44StaticMappingLb removes existing static mapping entry with load balancer

func DelStnRule

func DelStnRule(ifIdx uint32, addr *net.IP, vppChan govppapi.Channel, 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 govppapi.Channel, stopwatch *measure.Stopwatch) error

DeleteAfPacketInterface calls AfPacketDelete VPP binary API.

func DeleteBfdEchoFunction

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

DeleteBfdEchoFunction removes an echo function.

func DeleteBfdUDPAuthenticationKey

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

DeleteBfdUDPAuthenticationKey removes the authentication key.

func DeleteBfdUDPSession

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

DeleteBfdUDPSession removes an existing BFD session.

func DeleteLoopbackInterface

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

DeleteLoopbackInterface calls DeleteLoopback bin API.

func DeleteMemifInterface

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

DeleteMemifInterface calls MemifDelete bin API.

func DeleteTapInterface

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

DeleteTapInterface calls TapDelete bin API.

func DeleteVxlanTunnel

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

DeleteVxlanTunnel calls AddDelVxlanTunnelReq with flag add=0.

func DisableNat44Interface

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

DisableNat44Interface enables NAT feature for provided interface

func DisableNat44InterfaceOutput

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

DisableNat44InterfaceOutput disables NAT output feature for provided interface

func DumpBfdKeys

func DumpBfdKeys(vppChan govppapi.Channel, 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

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

DumpBfdUDPSessions returns a list of BFD session's metadata

func DumpBfdUDPSessionsWithID

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

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

func EnableNat44Interface

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

EnableNat44Interface enables NAT feature for provided interface

func EnableNat44InterfaceOutput

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

EnableNat44InterfaceOutput enables NAT output feature for provided interface

func GetInterfaceVRF

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

GetInterfaceVRF assigns VRF table to interface

func InterfaceAdminDown

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

InterfaceAdminDown calls binary API SwInterfaceSetFlagsReply with AdminUpDown=0.

func InterfaceAdminUp

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

InterfaceAdminUp calls binary API SwInterfaceSetFlagsReply with AdminUpDown=1.

func ModifyBfdUDPSession

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

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

func RegisterMemifSocketFilename

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

RegisterMemifSocketFilename registers new socket file name with provided ID.

func RemoveInterfaceTag

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

RemoveInterfaceTag un-registers new interface index/tag pair

func SetBfdUDPAuthenticationKey

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

SetBfdUDPAuthenticationKey creates new authentication key.

func SetInterfaceAsDHCPClient

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

SetInterfaceAsDHCPClient sets provided interface as a DHCP client

func SetInterfaceMac

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

SetInterfaceMac calls SwInterfaceSetMacAddress bin API.

func SetInterfaceMtu

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

SetInterfaceMtu calls HwInterfaceSetMtu bin API with desired MTU value.

func SetInterfaceTag

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

SetInterfaceTag registers new interface index/tag pair

func SetInterfaceVRF

func SetInterfaceVRF(ifaceIndex, vrfID uint32, log logging.Logger, vppChan govppapi.Channel) error

SetInterfaceVRF retrieves VRF table from interface

func SetNat44Forwarding

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

SetNat44Forwarding configures global forwarding setup for NAT44

func SetRxMode

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

SetRxMode calls SwInterfaceSetRxMode bin

func SetRxPlacement

func SetRxPlacement(vppInternalName string, rxPlacement *intf.Interfaces_Interface_RxPlacementSettings,
	vppChan govppapi.Channel, stopwatch *measure.Stopwatch) error

SetRxPlacement

func SetUnnumberedIP

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

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

func UnsetInterfaceAsDHCPClient

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

UnsetInterfaceAsDHCPClient un-sets interface as DHCP client

func UnsetUnnumberedIP

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

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

Types

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 LocalLbAddress

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

LocalLbAddress represents one local IP and address entry

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
	Vrf          uint32
	TwiceNat     bool
	SelfTwiceNat bool
}

StaticMappingLbContext groups common fields required for static mapping with load balancer

type StnRule

type StnRule struct {
	IPAddress net.IP
	IfaceIdx  uint32
}

StnRule represents stn rule entry

Jump to

Keyboard shortcuts

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