ovsdocker

package
v0.0.0-...-5841409 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MPLSMAXLabels = 65535

Variables

This section is empty.

Functions

func AddToBridgeBulk

func AddToBridgeBulk(elements map[string][]OVSInterface) error
func ExecLink(args ...string) error

ExecLink is a wrapper around the "ip link" command

func GetOFPort

func GetOFPort(containerName, ifName string) (string, bool)

Types

type IPRoute

type IPRoute struct {
	IP     string
	Via    string
	IfName string
}

type OVSBulk

type OVSBulk map[string][]OVSInterface

type OVSDockerClient

type OVSDockerClient struct {
	PID           int
	Portname      string
	ContainerName string
	// contains filtered or unexported fields
}

func New

func New(containerName string) *OVSDockerClient

New returns an OVSDockerClient based on the container name. It fetches the matching PID and generates an UUID for future use

func (*OVSDockerClient) AddPort

func (c *OVSDockerClient) AddPort(brName, ifName string, settings PortSettings, hostIf *OVSInterface, bridge bool) error

AddPort adds a port to the container, and links it with an OVS bridge. If hostIf in not nil, it fills the struct fields. If bridge is set to false, the host part is not added to the OVS bridge

func (*OVSDockerClient) DeletePort

func (c *OVSDockerClient) DeletePort(ifName string)

DeletePort deletes a port from a container

func (*OVSDockerClient) ExecNS

func (c *OVSDockerClient) ExecNS(args ...string) error

ExecNS is a wrapper around the "ip netns exec <PID>" command (with PID auto-filled)

func (*OVSDockerClient) FindPort

func (c *OVSDockerClient) FindPort(ifName string) (string, bool)

FindPort checks if an interface ifName exists within the container, and returns the corresponding interface on the host side

func (*OVSDockerClient) IfNames

func (c *OVSDockerClient) IfNames() (string, string)

IfNames returns both portnames (host and container)

func (*OVSDockerClient) PortExists

func (c *OVSDockerClient) PortExists(ifName string) bool

PortExists checks if an interface with name ifName already exists in the container (from OVS)

func (*OVSDockerClient) PortnameContainer

func (c *OVSDockerClient) PortnameContainer() string

PortnameContainer returns the portname suffixed by "_c"

func (*OVSDockerClient) PortnameHost

func (c *OVSDockerClient) PortnameHost() string

PortnameHost returns the portname suffixed by "_l"

func (*OVSDockerClient) SysctlSet

func (c *OVSDockerClient) SysctlSet(key, val string) error

SysctlSet executes a syswtl write inside the container network namespace

type OVSInterface

type OVSInterface struct {
	HostIface      string `json:"h_if"`
	Bridge         string `json:"br"`
	ContainerIface string `json:"c_if"`
	Settings       PortSettings
}

type PortSettings

type PortSettings struct {
	MTU    int
	Speed  int
	OFPort int
	VRF    string
	IP     string
	Routes []IPRoute
}

func DefaultParams

func DefaultParams() PortSettings

Jump to

Keyboard shortcuts

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