vppcalls

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Versions = map[string]HandlerVersion{}

Functions

This section is empty.

Types

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 HandlerVersion

type HandlerVersion struct {
	Msgs []govppapi.Message
	New  func(govppapi.Channel, logging.Logger) InterfaceVppAPI
}

type InterfaceDetails added in v1.8.1

type InterfaceDetails struct {
	Interface *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"`
	SupSwIfIndex   uint32           `json:"sub_sw_if_index"`
	L2Address      net.HardwareAddr `json:"l2_address"`
	InternalName   string           `json:"internal_name"`
	IsAdminStateUp bool             `json:"is_admin_state_up"`
	IsLinkStateUp  bool             `json:"is_link_state_up"`
	LinkDuplex     uint32           `json:"link_duplex"`
	LinkMTU        uint16           `json:"link_mtu"`
	MTU            []uint32         `json:"mtu"`
	LinkSpeed      uint32           `json:"link_speed"`
	SubID          uint32           `json:"sub_id"`
	Tag            string           `json:"tag"`
	// dhcp
	Dhcp *Dhcp `json:"dhcp"`
	// vrf
	VrfIPv4 uint32 `json:"vrf_ipv4"`
	VrfIPv6 uint32 `json:"vrf_ipv6"`
	// wmxnet3
	Pci uint32 `json:"pci"`
}

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

type InterfaceSpanDetails

type InterfaceSpanDetails struct {
	SwIfIndexFrom uint32
	SwIfIndexTo   uint32
	Direction     uint8
	IsL2          uint8
}

InterfaceSpanDetails is a helper struct grouping SPAN data.

type InterfaceState

type InterfaceState struct {
	SwIfIndex    uint32
	InternalName string
	PhysAddress  net.HardwareAddr

	AdminState interfaces.InterfaceState_Status
	LinkState  interfaces.InterfaceState_Status
	LinkDuplex interfaces.InterfaceState_Duplex
	LinkSpeed  uint64
	LinkMTU    uint16
}

InterfaceState is a helper function grouping interface state data.

type InterfaceVppAPI

type InterfaceVppAPI interface {
	InterfaceVppRead

	// AddAfPacketInterface calls AfPacketCreate VPP binary API.
	AddAfPacketInterface(ifName string, hwAddr string, afPacketIntf *interfaces.AfpacketLink) (swIndex uint32, err error)
	// DeleteAfPacketInterface calls AfPacketDelete VPP binary API.
	DeleteAfPacketInterface(ifName string, idx uint32, afPacketIntf *interfaces.AfpacketLink) 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.MemifLink, 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.TapLink) (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.VxlanLink) (swIndex uint32, err error)
	// DeleteVxLanTunnel calls AddDelVxLanTunnelReq with flag add=0.
	DeleteVxLanTunnel(ifName string, idx, vrf uint32, vxLan *interfaces.VxlanLink) error
	// AddVxLanGpeTunnel creates VxLAN-GPE tunnel.
	AddVxLanGpeTunnel(ifName string, vrf, multicastIf uint32, vxLan *interfaces.VxlanLink) (uint32, error)
	// DeleteVxLanGpeTunnel removes VxLAN-GPE tunnel.
	DeleteVxLanGpeTunnel(ifName string, vxLan *interfaces.VxlanLink) error
	// AddIPSecTunnelInterface adds a new IPSec tunnel interface
	AddIPSecTunnelInterface(ifName string, ipSecLink *interfaces.IPSecLink) (uint32, error)
	// DeleteIPSecTunnelInterface removes existing IPSec tunnel interface
	DeleteIPSecTunnelInterface(ifName string, ipSecLink *interfaces.IPSecLink) error
	// AddVmxNet3 configures vmxNet3 interface. Second parameter is optional in this case.
	AddVmxNet3(ifName string, vmxNet3 *interfaces.VmxNet3Link) (uint32, error)
	// DeleteVmxNet3 removes vmxNet3 interface
	DeleteVmxNet3(ifName string, ifIdx uint32) error
	// AddBondInterface configures bond interface.
	AddBondInterface(ifName string, mac string, bondLink *interfaces.BondLink) (uint32, error)
	// DeleteBondInterface removes bond interface.
	DeleteBondInterface(ifName string, ifIdx uint32) 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 string, id uint32) error
	// SetInterfaceMtu calls HwInterfaceSetMtu bin API with desired MTU value.
	SetInterfaceMtu(ifIdx uint32, mtu uint32) error
	// SetRxMode calls SwInterfaceSetRxMode bin API
	SetRxMode(ifIdx uint32, rxMode *interfaces.Interface_RxMode) error
	// SetRxPlacement configures rx-placement for interface
	SetRxPlacement(ifIdx uint32, rxPlacement *interfaces.Interface_RxPlacement) error
	// SetInterfaceVrf sets VRF table for the interface
	SetInterfaceVrf(ifaceIndex, vrfID uint32) error
	// SetInterfaceVrfIPv6 sets IPV6 VRF table for the interface
	SetInterfaceVrfIPv6(ifaceIndex, vrfID uint32) error
	// CreateSubif creates sub interface.
	CreateSubif(ifIdx, vlanID uint32) (swIfIdx uint32, err error)
	// DeleteSubif deletes sub interface.
	DeleteSubif(ifIdx uint32) error
	// AttachInterfaceToBond adds interface as a slave to the bond interface.
	AttachInterfaceToBond(ifIdx, bondIfIdx uint32, isPassive, isLongTimeout bool) error
	// DetachInterfaceFromBond removes interface slave status from any bond interfaces.
	DetachInterfaceFromBond(ifIdx uint32) error
	// SetVLanTagRewrite sets VLan tag rewrite rule for given sub-interface
	SetVLanTagRewrite(ifIdx uint32, subIf *interfaces.SubInterface) error
	// AddSpan creates new span record
	AddSpan(ifIdxFrom, ifIdxTo uint32, direction uint8, isL2 uint8) error
	// DelSpan removes new span record
	DelSpan(ifIdxFrom, ifIdxTo uint32, isL2 uint8) error
	// AddGreTunnel adds new GRE interface.
	AddGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error)
	// DelGreTunnel removes GRE interface.
	DelGreTunnel(ifName string, greLink *interfaces.GreLink) (uint32, error)
}

InterfaceVppAPI provides methods for creating and managing interface plugin

func CompatibleInterfaceVppHandler

func CompatibleInterfaceVppHandler(ch govppapi.Channel, log logging.Logger) InterfaceVppAPI

type InterfaceVppRead

type InterfaceVppRead 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
	DumpInterfaces() (map[uint32]*InterfaceDetails, error)
	// DumpInterfacesByType returns all VPP interfaces of the specified type
	DumpInterfacesByType(reqType interfaces.Interface_Type) (map[uint32]*InterfaceDetails, error)
	// DumpInterfaceStates dumps link and administrative state of every interface.
	DumpInterfaceStates(ifIdxs ...uint32) (map[uint32]*InterfaceState, error)
	// DumpSpan returns all records from span table.
	DumpSpan() ([]*InterfaceSpanDetails, 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)
	// DumpDhcpClients dumps DHCP-related information for all interfaces.
	DumpDhcpClients() (map[uint32]*Dhcp, error)
	// WatchInterfaceEvents starts watching for interface events.
	WatchInterfaceEvents(ch chan<- *InterfaceEvent) error
	// WatchDHCPLeases starts watching for DHCP leases.
	WatchDHCPLeases(ch chan<- *Lease) error
}

InterfaceVppRead provides read methods for interface plugin

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

Directories

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

Jump to

Keyboard shortcuts

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