vppcalls

package
v3.5.0-alpha Latest Latest
Warning

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

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

Documentation

Overview

Package vppcalls contains wrappers over VPP ACL binary APIs and helpers to dump ACLs configured in VPP - per interface and total.

Index

Constants

View Source
const (
	ICMPv4Proto = 1
	TCPProto    = 6
	UDPProto    = 17
	ICMPv6Proto = 58
)

Protocol types that can occur in ACLs

Variables

View Source
var Handler = vpp.RegisterHandler(vpp.HandlerDesc{
	Name:       "acl",
	HandlerAPI: (*ACLVppAPI)(nil),
})

Functions

func AddHandlerVersion

func AddHandlerVersion(version vpp.Version, msgs []govppapi.Message, h NewHandlerFunc)

Types

type ACLDetails

type ACLDetails struct {
	ACL  *acl.ACL `json:"acl"`
	Meta *ACLMeta `json:"acl_meta"`
}

ACLDetails is combination of proto-modelled ACL data and VPP provided metadata

type ACLMeta

type ACLMeta struct {
	Index uint32 `json:"acl_index"`
	Tag   string `json:"acl_tag"`
}

ACLMeta holds VPP-specific metadata

type ACLToInterface

type ACLToInterface struct {
	SwIfIdx    uint32
	IngressACL []uint32
	EgressACL  []uint32
}

ACLToInterface is definition of interface and all ACLs which are bound to the interface either as ingress or egress

type ACLVppAPI

type ACLVppAPI interface {
	ACLVppRead

	// AddACL create new ACL (L3/L4). Returns ACL index provided by VPP.
	AddACL(rules []*acl.ACL_Rule, aclName string) (aclIdx uint32, err error)
	// AddMACIPACL creates new MACIP ACL (L2). Returns ACL index provided by VPP.
	AddMACIPACL(rules []*acl.ACL_Rule, aclName string) (aclIdx uint32, err error)
	// ModifyACL modifies ACL (L3/L4) by updating its rules. It uses ACL index to identify ACL.
	ModifyACL(aclIdx uint32, rules []*acl.ACL_Rule, aclName string) error
	// ModifyMACIPACL modifies MACIP ACL (L2) by updating its rules. It uses ACL index to identify ACL.
	ModifyMACIPACL(aclIdx uint32, rules []*acl.ACL_Rule, aclName string) error
	// DeleteACL removes ACL (L3/L4).
	DeleteACL(aclIdx uint32) error
	// DeleteMACIPACL removes MACIP ACL (L2).
	DeleteMACIPACL(aclIdx uint32) error
	// SetACLToInterfacesAsIngress sets ACL to interfaces as ingress.
	SetACLToInterfacesAsIngress(ACLIndex uint32, ifIndices []uint32) error
	// RemoveACLFromInterfacesAsIngress removes ACL from interfaces as ingress.
	RemoveACLFromInterfacesAsIngress(ACLIndex uint32, ifIndices []uint32) error
	// SetACLToInterfacesAsEgress sets ACL to interfaces as egress.
	SetACLToInterfacesAsEgress(ACLIndex uint32, ifIndices []uint32) error
	// RemoveACLFromInterfacesAsEgress removes ACL from interfaces as egress.
	RemoveACLFromInterfacesAsEgress(ACLIndex uint32, ifIndices []uint32) error
	// SetMACIPACLToInterfaces sets MACIP ACL to interfaces.
	SetMACIPACLToInterfaces(aclIndex uint32, ifIndices []uint32) error
	// RemoveMACIPACLFromInterfaces removes MACIP ACL from interfaces.
	RemoveMACIPACLFromInterfaces(removedACLIndex uint32, ifIndices []uint32) error
	// AddACLToInterfaceAsIngress adds ACL (L3/L4) to single interface as ingress.
	AddACLToInterfaceAsIngress(aclIndex uint32, ifName string) error
	// AddACLToInterfaceAsEgress adds ACL (L3/L4) to single interface as egress.
	AddACLToInterfaceAsEgress(aclIndex uint32, ifName string) error
	// DeleteACLFromInterfaceAsIngress deletes ACL (L3/L4) from single interface as ingress.
	DeleteACLFromInterfaceAsIngress(aclIndex uint32, ifName string) error
	// DeleteACLFromInterfaceAsEgress deletes ACL (L3/L4) from single interface as egress.
	DeleteACLFromInterfaceAsEgress(aclIndex uint32, ifName string) error
	// AddMACIPACLToInterface adds MACIP ACL (L2) to single interface.
	AddMACIPACLToInterface(aclIndex uint32, ifName string) error
	// DeleteMACIPACLFromInterface deletes MACIP ACL (L2) from single interface.
	DeleteMACIPACLFromInterface(aclIndex uint32, ifName string) error
}

ACLVppAPI provides read/write methods required to handle VPP access lists

func CompatibleACLHandler

func CompatibleACLHandler(c vpp.Client, ifIdx ifaceidx.IfaceMetadataIndex) ACLVppAPI

type ACLVppRead

type ACLVppRead interface {
	// DumpACL dumps all ACLs (L3/L4).
	DumpACL() ([]*ACLDetails, error)
	// DumpMACIPACL dumps all MACIP ACLs (L2).
	DumpMACIPACL() ([]*ACLDetails, error)
	// DumpACLInterfaces dumps all ACLs (L3/L4) for given ACL indexes. Returns map of ACL indexes with assigned interfaces.
	DumpACLInterfaces(indices []uint32) (map[uint32]*acl.ACL_Interfaces, error)
	// DumpMACIPACLInterfaces dumps all ACLs (L2) for given ACL indexes. Returns map of MACIP ACL indexes with assigned interfaces.
	DumpMACIPACLInterfaces(indices []uint32) (map[uint32]*acl.ACL_Interfaces, error)
	// DumpInterfaceACLs finds interface in VPP and returns its ACL (L3/L4) configuration.
	DumpInterfaceACLs(ifIdx uint32) ([]*acl.ACL, error)
	// DumpInterfaceMACIPACLs finds interface in VPP and returns its MACIP ACL (L2) configuration.
	DumpInterfaceMACIPACLs(ifIdx uint32) ([]*acl.ACL, error)
}

ACLVppRead provides read methods for ACL plugin

type NewHandlerFunc

type NewHandlerFunc func(c vpp.Client, ifIdx ifaceidx.IfaceMetadataIndex) ACLVppAPI

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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