ovsnl

package
v0.0.0-...-76cb3ed Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

README

ovsnl

Package ovsnl enables interaction with the Linux Open vSwitch generic netlink interface.

// Dial a generic netlink connection and create a *ovsnl.Client.
c, err := ovsnl.New()
if err != nil {
    // If OVS generic netlink families aren't available, do nothing.
    if os.IsNotExist(err) {
        log.Printf("generic netlink OVS families not found: %v", err)
        return
    }

	log.Fatalf("failed to create client %v", err)
}
// Be sure to close the generic netlink connection!
defer c.Close()

// List available OVS datapaths.
dps, err := c.Datapath.List()
if err != nil {
	log.Fatalf("failed to list datapaths: %v", err)
}

for _, d := range dps {
	log.Printf("datapath: %q, flows: %d", d.Name, d.Stats.Flows)
}

Documentation

Overview

Package ovsnl enables interaction with the Linux Open vSwitch generic netlink interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Datapath provides access to DatapathService methods.
	Datapath *DatapathService
	// contains filtered or unexported fields
}

A Client is a Linux Open vSwitch generic netlink client.

func New

func New() (*Client, error)

New creates a new Linux Open vSwitch generic netlink client.

If no OvS generic netlink families are available on this system, an error will be returned which can be checked using os.IsNotExist.

func (*Client) Close

func (c *Client) Close() error

Close closes the Client's generic netlink connection.

type Datapath

type Datapath struct {
	Index         int
	Name          string
	Features      DatapathFeatures
	Stats         DatapathStats
	MegaflowStats DatapathMegaflowStats
}

A Datapath is an Open vSwitch in-kernel datapath.

type DatapathFeatures

type DatapathFeatures uint32

DatapathFeatures is a set of bit flags that specify features for a datapath.

const (
	DatapathFeaturesUnaligned DatapathFeatures = ovsh.DpFUnaligned
	DatapathFeaturesVPortPIDs DatapathFeatures = ovsh.DpFVportPids
)

Possible DatapathFeatures flag values.

func (DatapathFeatures) String

func (f DatapathFeatures) String() string

String returns the string representation of a DatapathFeatures.

type DatapathMegaflowStats

type DatapathMegaflowStats struct {
	// Number of masks used for flow lookups.
	MaskHits uint64
	// Number of masks for the datapath.
	Masks uint32
}

DatapathMegaflowStats contains statistics about mega flow mask usage for a Datapath.

type DatapathService

type DatapathService struct {
	// contains filtered or unexported fields
}

A DatapathService provides access to methods which interact with the "ovs_datapath" generic netlink family.

func (*DatapathService) List

func (s *DatapathService) List() ([]Datapath, error)

List lists all Datapaths in the kernel.

type DatapathStats

type DatapathStats struct {
	// Number of flow table matches.
	Hit uint64
	// Number of flow table misses.
	Missed uint64
	// Number of misses not sent to userspace.
	Lost uint64
	// Number of flows present.
	Flows uint64
}

DatapathStats contains statistics about packets that have passed through a Datapath.

Directories

Path Synopsis
internal
ovsh
Package ovsh is an auto-generated package which contains constants and types used to access Open vSwitch information using generic netlink.
Package ovsh is an auto-generated package which contains constants and types used to access Open vSwitch information using generic netlink.

Jump to

Keyboard shortcuts

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