cnivpp

package
v0.0.0-...-5d7f650 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 20 Imported by: 2

README

VPP CNI Library Intro

VPP CNI Library is written in GO and used by UserSpace CNI to interface with the VPP GO-API. The UserSpace CNI is a CNI implementation designed to implement User Space networking (as apposed to kernel space networking), like DPDK based applications. For example VPP and OVS-DPDK.

The UserSpace CNI, based on the input config data, uses this library to add interfaces (memif and vhost-user interface) to a local VPP instance running on the host and add that interface to a local network, like a L2 Bridge. The UserSpace CNI then processes config data intended for the container and uses this library to add that data to a Database the container can consume.

UserSpace CNI README.md describes how to test with VPP CNI. Below are a few notes regarding packages in this sub-folder.

usrsp-app

The usrsp-app is intended to run in a container. It leverages the VPP CNI code to consume interfaces in the container.

cnivpp/localdb.go

localdb is use to store data in a DB. For the local VPP instance, the localdb is used to store the swIndex generated when the interface is created. It is used later to delete the interface. The usrspdb is used to pass configuration data to the container so the container can consume the interface.

The initial implementation of the DB is just json data written to a file. This can be expanded at a later date to write to something like an etcd DB.

The following filenames and directory structure is used to store the data:

  • Host:

    • /var/lib/cni/usrspcni/data/:

      • local-ContainerId:12-.json: Used to store local data needed to delete and cleanup.
    • /var/lib/cni/usrspcni/shared/: Not a database directory, but this directory is used for interface socket files, for example: memif-ContainerId:12-.sock This directory is mapped into that container as the same directory in the container.

    • /var/lib/cni/usrspcni//: This directory is mapped into that container as /var/lib/cni/usrspcni/data/, so appears to the container as its local data directory. This is where the container writes its local-ContainerId:12-.json file described above.

      • remote-ContainerId:12-.json: This file contains the configuration to apply the interface in the container. The data is the same json data passed into the UserSpace CNI (define in user-space-net-plugin/pkg/types/types.go), but the Container data has been copied into the Host data label. The usrsp-app processes the data as local data. Once this data is read in the container, the usrsp-app deletes the file.
      • addData-ContainerId:12-.json: This file is used to pass additional data into the the container, which is not defined by pkg/types/types.go. This includes the ContainerId itself, and the results from the IPAM plugin that were processed locally. Once this data is read in the container, the usrsp-app deletes the file.
  • Container:

    • /var/lib/cni/usrspcni/data/: Mapped from /var/lib/cni/usrspcni/container/ on the host.
    • /var/lib/cni/usrspcni/shared/: Mapped from /var/lib/cni/usrspcni/shared/ on the host.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadVppConfig

func LoadVppConfig(conf *types.NetConf, args *skel.CmdArgs, data *VppSavedData) error

func SaveVppConfig

func SaveVppConfig(conf *types.NetConf, args *skel.CmdArgs, data *VppSavedData) error

saveVppConfig() - Some data needs to be saved, like the swIfIndex, for cmdDel().

This function squirrels the data away to be retrieved later.

Types

type CniVpp

type CniVpp struct {
}

Types

func (CniVpp) AddOnContainer

func (cniVpp CniVpp) AddOnContainer(conf *types.NetConf,
	args *skel.CmdArgs,
	kubeClient kubernetes.Interface,
	sharedDir string,
	pod *v1.Pod,
	ipResult *current.Result) (*v1.Pod, error)

func (CniVpp) AddOnHost

func (cniVpp CniVpp) AddOnHost(conf *types.NetConf,
	args *skel.CmdArgs,
	kubeClient kubernetes.Interface,
	sharedDir string,
	ipResult *current.Result) error

API Functions

func (CniVpp) DelFromContainer

func (cniVpp CniVpp) DelFromContainer(conf *types.NetConf, args *skel.CmdArgs, sharedDir string, pod *v1.Pod) error

func (CniVpp) DelFromHost

func (cniVpp CniVpp) DelFromHost(conf *types.NetConf, args *skel.CmdArgs, sharedDir string) error

type VppSavedData

type VppSavedData struct {
	InterfaceSwIfIndex interface_types.InterfaceIndex `json:"swIfIndex"`     // Software Index, used to access the created interface, needed to delete interface.
	MemifSocketId      uint32                         `json:"memifSocketId"` // Memif SocketId, used to access the created memif Socket File, used for debug only.
}

This structure is a union of all the VPP data (for all types of interfaces) that need to be preserved for later use.

Directories

Path Synopsis
api
bridge
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
infra
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
interface
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
memif
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
vhostuser
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
test
ipAddDel
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
memifAddDel
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
vhostUserAddDel
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.

Jump to

Keyboard shortcuts

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