drivers

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateBasePath is the base path for all state operations.
	StateBasePath = "/contiv/"
	// StateConfigPath is the path to the root of the configuration state
	StateConfigPath = StateBasePath + "config/"
	// StateOperPath is the path to the operations stored in state.
	StateOperPath = StateBasePath + "oper/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeNetEpDriver

type FakeNetEpDriver struct {
}

FakeNetEpDriver implements core.NetworkDriver interface for use with unit-tests

func (*FakeNetEpDriver) CreateEndpoint

func (d *FakeNetEpDriver) CreateEndpoint(id string) error

CreateEndpoint is not implemented.

func (*FakeNetEpDriver) CreateNetwork

func (d *FakeNetEpDriver) CreateNetwork(id string) error

CreateNetwork is not implemented.

func (*FakeNetEpDriver) CreatePeerHost

func (d *FakeNetEpDriver) CreatePeerHost(id string) error

CreatePeerHost is not implemented.

func (*FakeNetEpDriver) Deinit

func (d *FakeNetEpDriver) Deinit()

Deinit is not implemented.

func (*FakeNetEpDriver) DeleteEndpoint

func (d *FakeNetEpDriver) DeleteEndpoint(id string) (err error)

DeleteEndpoint is not implemented.

func (*FakeNetEpDriver) DeleteNetwork

func (d *FakeNetEpDriver) DeleteNetwork(id string) error

DeleteNetwork is not implemented.

func (*FakeNetEpDriver) DeletePeerHost

func (d *FakeNetEpDriver) DeletePeerHost(id string) error

DeletePeerHost is not implemented.

func (*FakeNetEpDriver) Init

func (d *FakeNetEpDriver) Init(config *core.Config, info *core.InstanceInfo) error

Init is not implemented.

type FakeNetEpDriverConfig

type FakeNetEpDriverConfig struct{}

FakeNetEpDriverConfig represents the configuration of the fakedriver, which is an empty struct.

type OvsCfgEndpointState

type OvsCfgEndpointState struct {
	core.CommonState
	NetID      string `json:"netID"`
	ContName   string `json:"contName"`
	AttachUUID string `json:"attachUUID"`
	IPAddress  string `json:"ipAddress"`
	MacAddress string `json:"macAddress"`
	HomingHost string `json:"homingHost"`
	IntfName   string `json:"intfName"`
	VtepIP     string `json:"vtepIP"`
}

OvsCfgEndpointState implements the State interface for an endpoint implemented using vlans with ovs. The state is stored as Json objects.

func (*OvsCfgEndpointState) Clear

func (s *OvsCfgEndpointState) Clear() error

Clear removes the state.

func (*OvsCfgEndpointState) Read

func (s *OvsCfgEndpointState) Read(id string) error

Read the state for a given identifier.

func (*OvsCfgEndpointState) ReadAll

func (s *OvsCfgEndpointState) ReadAll() ([]core.State, error)

ReadAll reads all state objects for the endpoints.

func (*OvsCfgEndpointState) WatchAll

func (s *OvsCfgEndpointState) WatchAll(rsps chan core.WatchState) error

WatchAll fills a channel on each state event related to endpoints.

func (*OvsCfgEndpointState) Write

func (s *OvsCfgEndpointState) Write() error

Write the state.

type OvsCfgNetworkState

type OvsCfgNetworkState struct {
	core.CommonState
	Tenant     string        `json:"tenant"`
	PktTagType string        `json:"pktTagType"`
	PktTag     int           `json:"pktTag"`
	ExtPktTag  int           `json:"extPktTag"`
	SubnetIP   string        `json:"subnetIP"`
	SubnetLen  uint          `json:"subnetLen"`
	DefaultGw  string        `json:"defaultGw"`
	EpCount    int           `json:"epCount"`
	IPAllocMap bitset.BitSet `json:"ipAllocMap"`
}

OvsCfgNetworkState implements the State interface for a network implemented using vlans with ovs. The state is stored as Json objects.

func (*OvsCfgNetworkState) Clear

func (s *OvsCfgNetworkState) Clear() error

Clear removes the state.

func (*OvsCfgNetworkState) Read

func (s *OvsCfgNetworkState) Read(id string) error

Read the state for a given identifier

func (*OvsCfgNetworkState) ReadAll

func (s *OvsCfgNetworkState) ReadAll() ([]core.State, error)

ReadAll state and return the collection.

func (*OvsCfgNetworkState) WatchAll

func (s *OvsCfgNetworkState) WatchAll(rsps chan core.WatchState) error

WatchAll state transitions and send them through the channel.

func (*OvsCfgNetworkState) Write

func (s *OvsCfgNetworkState) Write() error

Write the state.

type OvsDriver

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

OvsDriver implements the Layer 2 Network and Endpoint Driver interfaces specific to vlan based open-vswitch.

func (*OvsDriver) CreateEndpoint

func (d *OvsDriver) CreateEndpoint(id string) error

CreateEndpoint creates an endpoint by named identifier

func (*OvsDriver) CreateNetwork

func (d *OvsDriver) CreateNetwork(id string) error

CreateNetwork creates a network by named identifier

func (*OvsDriver) CreatePeerHost

func (d *OvsDriver) CreatePeerHost(id string) error

CreatePeerHost creates peer host object and adds VTEPs if necessary

func (*OvsDriver) Deinit

func (d *OvsDriver) Deinit()

Deinit performs cleanup prior to destruction of the OvsDriver

func (*OvsDriver) DeleteEndpoint

func (d *OvsDriver) DeleteEndpoint(id string) (err error)

DeleteEndpoint deletes an endpoint by named identifier.

func (*OvsDriver) DeleteNetwork

func (d *OvsDriver) DeleteNetwork(id string) error

DeleteNetwork deletes a network by named identifier

func (*OvsDriver) DeletePeerHost

func (d *OvsDriver) DeletePeerHost(id string) error

DeletePeerHost deletes peer host info and associated VTEP

func (*OvsDriver) Init

func (d *OvsDriver) Init(config *core.Config, info *core.InstanceInfo) error

Init initializes the OVS driver.

type OvsDriverConfig

type OvsDriverConfig struct {
	Ovs struct {
		DbIP   string
		DbPort int
	}
}

OvsDriverConfig defines the configuration required to initialize the OvsDriver.

type OvsDriverOperState

type OvsDriverOperState struct {
	core.CommonState
	// used to allocate port names. XXX: should it be user controlled?
	CurrPortNum int `json:"currPortNum"`
}

OvsDriverOperState carries operational state of the OvsDriver.

func (*OvsDriverOperState) Clear

func (s *OvsDriverOperState) Clear() error

Clear removes the state.

func (*OvsDriverOperState) Read

func (s *OvsDriverOperState) Read(id string) error

Read the state given an ID.

func (*OvsDriverOperState) ReadAll

func (s *OvsDriverOperState) ReadAll() ([]core.State, error)

ReadAll reads all the state

func (*OvsDriverOperState) Write

func (s *OvsDriverOperState) Write() error

Write the state

type OvsOperEndpointState

type OvsOperEndpointState struct {
	core.CommonState
	NetID      string `json:"netID"`
	ContName   string `json:"contName"`
	ContUUID   string `json:"contUUID"`
	AttachUUID string `json:"attachUUID"`
	IPAddress  string `json:"ipAddress"`
	MacAddress string `json:"macAddress"`
	HomingHost string `json:"homingHost"`
	IntfName   string `json:"intfName"`
	PortName   string `json:"portName"`
	VtepIP     string `json:"vtepIP"`
}

OvsOperEndpointState is the necessary data used to perform operations on endpoints.

func (*OvsOperEndpointState) Clear

func (s *OvsOperEndpointState) Clear() error

Clear removes the state.

func (*OvsOperEndpointState) Matches

Matches matches the fields updated from configuration state

func (*OvsOperEndpointState) Read

func (s *OvsOperEndpointState) Read(id string) error

Read the state for a given identifier.

func (*OvsOperEndpointState) ReadAll

func (s *OvsOperEndpointState) ReadAll() ([]core.State, error)

ReadAll reads all state into separate objects.

func (*OvsOperEndpointState) Write

func (s *OvsOperEndpointState) Write() error

Write the state.

type OvsSwitch

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

OvsSwitch represents on OVS bridge instance

func NewOvsSwitch

func NewOvsSwitch(bridgeName, netType, localIP string) (*OvsSwitch, error)

NewOvsSwitch Creates a new OVS switch instance

func (*OvsSwitch) AddUplinkPort

func (sw *OvsSwitch) AddUplinkPort(intfName string) error

AddUplinkPort adds uplink port to the OVS

func (*OvsSwitch) CreateNetwork

func (sw *OvsSwitch) CreateNetwork(pktTag uint16, extPktTag uint32) error

CreateNetwork creates a new network/vlan

func (*OvsSwitch) CreatePort

func (sw *OvsSwitch) CreatePort(intfName, intfType string, cfgEp *OvsCfgEndpointState,
	pktTag int) error

CreatePort creates a port in ovs switch

func (*OvsSwitch) CreateVtep

func (sw *OvsSwitch) CreateVtep(vtepIP string) error

CreateVtep creates a VTEP interface

func (*OvsSwitch) Delete

func (sw *OvsSwitch) Delete()

Delete performs cleanup prior to destruction of the OvsDriver

func (*OvsSwitch) DeleteNetwork

func (sw *OvsSwitch) DeleteNetwork(pktTag uint16, extPktTag uint32) error

DeleteNetwork deletes a network/vlan

func (*OvsSwitch) DeletePort

func (sw *OvsSwitch) DeletePort(epOper *OvsOperEndpointState) error

DeletePort removes a port from OVS

func (*OvsSwitch) DeleteVtep

func (sw *OvsSwitch) DeleteVtep(vtepIP string) error

DeleteVtep deletes a VTEP

func (*OvsSwitch) UpdatePort

func (sw *OvsSwitch) UpdatePort(intfName string, cfgEp *OvsCfgEndpointState, pktTag int) error

UpdatePort updates an OVS port without creating it

type OvsdbDriver

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

OvsdbDriver is responsible for programming OVS using ovsdb protocol. It also implements the libovsdb.Notifier interface to keep cache of ovs table state.

func NewOvsdbDriver

func NewOvsdbDriver(bridgeName string, failMode string) (*OvsdbDriver, error)

NewOvsdbDriver creates a new OVSDB driver instance. Create one ovsdb driver instance per OVS bridge that needs to be managed

func (*OvsdbDriver) AddController

func (d *OvsdbDriver) AddController(ipAddr string, portNo uint16) error

AddController : Add controller configuration to OVS

func (*OvsdbDriver) CreatePort

func (d *OvsdbDriver) CreatePort(intfName, intfType, id string, tag int) error

CreatePort creates an OVS port

func (*OvsdbDriver) CreateVtep

func (d *OvsdbDriver) CreateVtep(intfName string, vtepRemoteIP string) error

CreateVtep creates a VTEP port on the OVS

func (*OvsdbDriver) Delete

func (d *OvsdbDriver) Delete() error

Delete : Cleanup the ovsdb driver. delete the bridge we created.

func (*OvsdbDriver) DeletePort

func (d *OvsdbDriver) DeletePort(intfName string) error

DeletePort deletes a port from OVS

func (*OvsdbDriver) DeleteVtep

func (d *OvsdbDriver) DeleteVtep(intfName string) error

DeleteVtep deletes a VTEP port

func (*OvsdbDriver) Echo

func (d *OvsdbDriver) Echo([]interface{})

Echo satisfies a libovsdb interface dependency.

func (*OvsdbDriver) GetOfpPortNo

func (d *OvsdbDriver) GetOfpPortNo(intfName string) (uint32, error)

GetOfpPortNo : Return OFP port number for an interface

func (*OvsdbDriver) GetPortOrIntfNameFromID

func (d *OvsdbDriver) GetPortOrIntfNameFromID(id string, isPort bool) (string, error)

GetPortOrIntfNameFromID gets interface name from id

func (*OvsdbDriver) IsControllerPresent

func (d *OvsdbDriver) IsControllerPresent(target string) bool

IsControllerPresent : Check if Controller already exists

func (*OvsdbDriver) IsPortNamePresent

func (d *OvsdbDriver) IsPortNamePresent(intfName string) bool

IsPortNamePresent checks if port already exists in OVS bridge

func (*OvsdbDriver) IsVtepPresent

func (d *OvsdbDriver) IsVtepPresent(remoteIP string) (bool, string)

IsVtepPresent checks if VTEP already exists

func (*OvsdbDriver) Locked

func (d *OvsdbDriver) Locked([]interface{})

Locked satisfies a libovsdb interface dependency.

func (*OvsdbDriver) RemoveController

func (d *OvsdbDriver) RemoveController(target string) error

RemoveController : Remove controller configuration

func (*OvsdbDriver) Stolen

func (d *OvsdbDriver) Stolen([]interface{})

Stolen satisfies a libovsdb interface dependency.

func (*OvsdbDriver) Update

func (d *OvsdbDriver) Update(context interface{}, tableUpdates libovsdb.TableUpdates)

Update updates the ovsdb with the libovsdb.TableUpdates.

type PeerHostState

type PeerHostState struct {
	core.CommonState
	Hostname   string // Name of this host
	HostAddr   string // control plane IP address of the host
	VtepIPAddr string // VTEP IP address to use
}

PeerHostState : Information about the peer host

func (*PeerHostState) Clear

func (s *PeerHostState) Clear() error

Clear removes the state.

func (*PeerHostState) Read

func (s *PeerHostState) Read(id string) error

Read the state for a given identifier.

func (*PeerHostState) ReadAll

func (s *PeerHostState) ReadAll() ([]core.State, error)

ReadAll reads all state objects for the peer.

func (*PeerHostState) WatchAll

func (s *PeerHostState) WatchAll(rsps chan core.WatchState) error

WatchAll fills a channel on each state event related to peers.

func (*PeerHostState) Write

func (s *PeerHostState) Write() error

Write the state.

Jump to

Keyboard shortcuts

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