ovsdb

package
v0.0.0-...-3fa228a Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InterfaceTypePatch is the logical interface type `patch`
	InterfaceTypePatch = "patch"

	// InterfaceTypeInternal is the logical interface type `internal`
	InterfaceTypeInternal = "internal"

	// InterfaceTypeGeneve is the logical interface type `geneve`
	InterfaceTypeGeneve = "geneve"
)

Variables

View Source
var Open = func() (Client, error) {
	client, err := ovs.Connect("127.0.0.1", 6640)
	return Client{ovsdbClient{client}}, err
}

Open creates a new Ovsdb connection. It's stored in a variable so we can mock it out for the unit tests.

Functions

This section is empty.

Types

type Acl

type Acl struct {
	Core AclCore
	Log  bool
	// contains filtered or unexported fields
}

Acl is a firewall rule in OVN.

type AclCore

type AclCore struct {
	Priority  int
	Direction string
	Match     string
	Action    string
}

AclCore is the actual ACL rule that will be matched, without various OVSDB metadata found in Acl.

type Client

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

Client is a connection to the ovsdb-server database.

func NewFakeOvsdbClient

func NewFakeOvsdbClient() Client

NewFakeOvsdbClient returns an ovsdb client with mocked ovsdb.

func (Client) Close

func (ovsdb Client) Close()

Close destroys an Ovsdb connection created by Open.

func (Client) CreateACL

func (ovsdb Client) CreateACL(lswitch string, direction string, priority int,
	match string, action string) error

CreateACL creates an access control rule in OVN.

direction, unless wildcarded, must be either "from-lport" or "to-lport"

priority, unless wildcarded, must be in [1,32767]

match, unless wildcarded or empty, must be a valid OpenFlow expression

action must be one of {"allow", "allow-related", "drop", "reject"}

direction and match may be wildcarded by passing the value "*". priority may also be wildcarded by passing a value less than 0.

func (Client) CreateInterface

func (ovsdb Client) CreateInterface(bridge, name string) error

CreateInterface creates an openflow port on specified bridge.

A port cannot be created without an interface, that is why the "default" interface (one with the same name as the port) is created along with it.

func (Client) CreateLogicalPort

func (ovsdb Client) CreateLogicalPort(lswitch, name, mac, ip string) error

CreateLogicalPort creates a new logical port in OVN.

func (Client) CreateLogicalSwitch

func (ovsdb Client) CreateLogicalSwitch(lswitch string) error

CreateLogicalSwitch creates a new logical switch in OVN.

func (Client) DeleteACL

func (ovsdb Client) DeleteACL(lswitch string, ovsdbACL Acl) error

DeleteACL removes an access control rule from OVN.

func (Client) DeleteInterface

func (ovsdb Client) DeleteInterface(iface Interface) error

DeleteInterface deletes an openflow interface.

func (Client) DeleteLogicalPort

func (ovsdb Client) DeleteLogicalPort(lswitch string, lport LPort) error

DeleteLogicalPort removes a logical port from OVN.

func (Client) ListACLs

func (ovsdb Client) ListACLs(lswitch string) ([]Acl, error)

ListACLs lists the access control rules in OVN.

func (Client) ListInterfaces

func (ovsdb Client) ListInterfaces() ([]Interface, error)

ListInterfaces gets all openflow interfaces.

func (Client) ListLogicalPorts

func (ovsdb Client) ListLogicalPorts(lswitch string) ([]LPort, error)

ListLogicalPorts lists the logical ports in OVN.

func (Client) ModifyInterface

func (ovsdb Client) ModifyInterface(iface Interface) error

ModifyInterface modifies the openflow interface.

func (Client) SetBridgeMac

func (ovsdb Client) SetBridgeMac(bridge, mac string) error

SetBridgeMac sets the MAC address of the bridge.

type Interface

type Interface struct {
	Name        string
	Peer        string
	AttachedMAC string
	IfaceID     string
	Bridge      string
	Type        string
	OFPort      *int
	// contains filtered or unexported fields
}

Interface is a logical interface in OVN.

type InterfaceSlice

type InterfaceSlice []Interface

InterfaceSlice is used for HashJoin.

func (InterfaceSlice) Get

func (ovsps InterfaceSlice) Get(i int) interface{}

Get is required for HashJoin.

func (InterfaceSlice) Len

func (ovsps InterfaceSlice) Len() int

Len is required for HashJoin.

type LPort

type LPort struct {
	Bridge    string
	Name      string
	Addresses []string
	// contains filtered or unexported fields
}

LPort is a logical port in OVN.

type LPortSlice

type LPortSlice []LPort

LPortSlice is a wrapper around []LPort so it can be used in joins

func (LPortSlice) Get

func (lps LPortSlice) Get(i int) interface{}

Get gets the element at the ith index

func (LPortSlice) Len

func (lps LPortSlice) Len() int

Len returns the length of the slice

Jump to

Keyboard shortcuts

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