drivers

package
v0.0.0-...-a17b09b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2016 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EpInfo

type EpInfo struct {
	Ovsportname string `json:"Ovsportname"`
	EpgKey      string `json:"EpgKey"`
	BridgeType  string `json:"BridgeType"`
}

EpInfo contains the ovsport and id of the group

type FakeNetEpDriver

type FakeNetEpDriver struct {
}

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

func (*FakeNetEpDriver) AddBgp

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

AddBgp is not implemented.

func (*FakeNetEpDriver) AddMaster

func (d *FakeNetEpDriver) AddMaster(node core.ServiceInfo) error

AddMaster is not implemented

func (*FakeNetEpDriver) AddPeerHost

func (d *FakeNetEpDriver) AddPeerHost(node core.ServiceInfo) error

AddPeerHost is not implemented.

func (*FakeNetEpDriver) AddSvcSpec

func (d *FakeNetEpDriver) AddSvcSpec(svcName string, spec *core.ServiceSpec) error

AddSvcSpec is not implemented.

func (*FakeNetEpDriver) CreateEndpoint

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

CreateEndpoint is not implemented.

func (*FakeNetEpDriver) CreateHostAccPort

func (d *FakeNetEpDriver) CreateHostAccPort(id, a, b string) (err error)

CreateHostAccPort is not implemented.

func (*FakeNetEpDriver) CreateNetwork

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

CreateNetwork is not implemented.

func (*FakeNetEpDriver) Deinit

func (d *FakeNetEpDriver) Deinit()

Deinit is not implemented.

func (*FakeNetEpDriver) DelSvcSpec

func (d *FakeNetEpDriver) DelSvcSpec(svcName string, spec *core.ServiceSpec) error

DelSvcSpec is not implemented.

func (*FakeNetEpDriver) DeleteBgp

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

DeleteBgp is not implemented.

func (*FakeNetEpDriver) DeleteEndpoint

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

DeleteEndpoint is not implemented.

func (*FakeNetEpDriver) DeleteHostAccPort

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

DeleteHostAccPort is not implemented.

func (*FakeNetEpDriver) DeleteMaster

func (d *FakeNetEpDriver) DeleteMaster(node core.ServiceInfo) error

DeleteMaster is not implemented

func (*FakeNetEpDriver) DeleteNetwork

func (d *FakeNetEpDriver) DeleteNetwork(id, nwType, encap string, pktTag, extPktTag int, gateway string, tenant string) error

DeleteNetwork is not implemented.

func (*FakeNetEpDriver) DeletePeerHost

func (d *FakeNetEpDriver) DeletePeerHost(node core.ServiceInfo) error

DeletePeerHost is not implemented.

func (*FakeNetEpDriver) GetEndpointStats

func (d *FakeNetEpDriver) GetEndpointStats() ([]byte, error)

GetEndpointStats is not implemented

func (*FakeNetEpDriver) Init

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

Init is not implemented.

func (*FakeNetEpDriver) InspectBgp

func (d *FakeNetEpDriver) InspectBgp() ([]byte, error)

InspectBgp is not implemented

func (*FakeNetEpDriver) InspectState

func (d *FakeNetEpDriver) InspectState() ([]byte, error)

InspectState is not implemented

func (*FakeNetEpDriver) SvcProviderUpdate

func (d *FakeNetEpDriver) SvcProviderUpdate(svcName string, providers []string)

SvcProviderUpdate is not implemented.

func (*FakeNetEpDriver) UpdateEndpointGroup

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

UpdateEndpointGroup is not implemented.

type FakeNetEpDriverConfig

type FakeNetEpDriverConfig struct{}

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

type NodeSvcProxy

type NodeSvcProxy struct {
	Mutex   sync.Mutex
	SvcMap  map[string]core.ServiceSpec // service name as key
	ProvMap map[string]Presence         // service name as key
	LocalIP map[string]string           // globalIP as key
	// contains filtered or unexported fields
}

NodeSvcProxy holds service proxy info

func NewNodeProxy

func NewNodeProxy() (*NodeSvcProxy, error)

NewNodeProxy creates an instance of the node proxy

func (*NodeSvcProxy) AddLocalIP

func (p *NodeSvcProxy) AddLocalIP(globalIP, localIP string)

AddLocalIP adds an entry to the localIP map

func (*NodeSvcProxy) AddSvcSpec

func (p *NodeSvcProxy) AddSvcSpec(svcName string, spec *core.ServiceSpec) error

AddSvcSpec adds a service to the proxy

func (*NodeSvcProxy) DelSvcSpec

func (p *NodeSvcProxy) DelSvcSpec(svcName string, spec *core.ServiceSpec) error

DelSvcSpec deletes a service from the proxy

func (*NodeSvcProxy) DeleteLocalIP

func (p *NodeSvcProxy) DeleteLocalIP(globalIP string)

DeleteLocalIP removes an entry from the localIP map

func (*NodeSvcProxy) SvcProviderUpdate

func (p *NodeSvcProxy) SvcProviderUpdate(svcName string, providers []string)

SvcProviderUpdate invokes switch api

type OvsDriver

type OvsDriver struct {
	HostProxy *NodeSvcProxy
	// contains filtered or unexported fields
}

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

func (*OvsDriver) AddBgp

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

AddBgp adds bgp config by named identifier

func (*OvsDriver) AddMaster

func (d *OvsDriver) AddMaster(node core.ServiceInfo) error

AddMaster adds master node

func (*OvsDriver) AddPeerHost

func (d *OvsDriver) AddPeerHost(node core.ServiceInfo) error

AddPeerHost adds VTEPs if necessary

func (*OvsDriver) AddSvcSpec

func (d *OvsDriver) AddSvcSpec(svcName string, spec *core.ServiceSpec) error

AddSvcSpec invokes switch api

func (*OvsDriver) CreateEndpoint

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

CreateEndpoint creates an endpoint by named identifier

func (*OvsDriver) CreateHostAccPort

func (d *OvsDriver) CreateHostAccPort(portName, globalIP, hostIP string) error

CreateHostAccPort creates an access port

func (*OvsDriver) CreateNetwork

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

CreateNetwork creates a network by named identifier

func (*OvsDriver) Deinit

func (d *OvsDriver) Deinit()

Deinit performs cleanup prior to destruction of the OvsDriver

func (*OvsDriver) DelSvcSpec

func (d *OvsDriver) DelSvcSpec(svcName string, spec *core.ServiceSpec) error

DelSvcSpec invokes switch api

func (*OvsDriver) DeleteBgp

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

DeleteBgp deletes bgp config by named identifier

func (*OvsDriver) DeleteEndpoint

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

DeleteEndpoint deletes an endpoint by named identifier.

func (*OvsDriver) DeleteHostAccPort

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

DeleteHostAccPort deletes the access port

func (*OvsDriver) DeleteMaster

func (d *OvsDriver) DeleteMaster(node core.ServiceInfo) error

DeleteMaster deletes master node

func (*OvsDriver) DeleteNetwork

func (d *OvsDriver) DeleteNetwork(id, nwType, encap string, pktTag, extPktTag int, gateway string, tenant string) error

DeleteNetwork deletes a network by named identifier

func (*OvsDriver) DeletePeerHost

func (d *OvsDriver) DeletePeerHost(node core.ServiceInfo) error

DeletePeerHost deletes associated VTEP

func (*OvsDriver) GetEndpointStats

func (d *OvsDriver) GetEndpointStats() ([]byte, error)

GetEndpointStats gets all endpoints from all ovs instances

func (*OvsDriver) Init

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

Init initializes the OVS driver.

func (*OvsDriver) InspectBgp

func (d *OvsDriver) InspectBgp() ([]byte, error)

InspectBgp returns bgp state as json string

func (*OvsDriver) InspectState

func (d *OvsDriver) InspectState() ([]byte, error)

InspectState returns driver state as json string

func (*OvsDriver) SvcProviderUpdate

func (d *OvsDriver) SvcProviderUpdate(svcName string, providers []string)

SvcProviderUpdate invokes switch api

func (*OvsDriver) UpdateEndpointGroup

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

UpdateEndpointGroup updates the epg

type OvsDriverOperState

type OvsDriverOperState struct {
	core.CommonState

	// used to allocate port names. XXX: should it be user controlled?
	CurrPortNum int                `json:"currPortNum"`
	LocalEpInfo map[string]*EpInfo `json:"LocalEpInfo"` // info about local endpoints
	// contains filtered or unexported fields
}

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"`
	EndpointID  string `json:"endpointID"`
	ServiceName string `json:"serviceName"`
	ContUUID    string `json:"contUUID"`
	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, fwdMode string,
	routerInfo ...string) (*OvsSwitch, error)

NewOvsSwitch Creates a new OVS switch instance

func (*OvsSwitch) AddBgp

func (sw *OvsSwitch) AddBgp(hostname string, routerIP string,
	As string, neighborAs, neighbor string) error

AddBgp adds a bgp config to host

func (*OvsSwitch) AddHostPort

func (sw *OvsSwitch) AddHostPort(intfName string, intfNum int, isHostNS bool) error

AddHostPort adds a host port to the OVS

func (*OvsSwitch) AddMaster

func (sw *OvsSwitch) AddMaster(node core.ServiceInfo) error

AddMaster adds master node

func (*OvsSwitch) AddSvcSpec

func (sw *OvsSwitch) AddSvcSpec(svcName string, spec *ofnet.ServiceSpec) error

AddSvcSpec invokes ofnetAgent api

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, defaultGw string, Vrf string) error

CreateNetwork creates a new network/vlan

func (*OvsSwitch) CreatePort

func (sw *OvsSwitch) CreatePort(intfName string, cfgEp *mastercfg.CfgEndpointState, pktTag, nwPktTag, burst, dscp int, skipVethPair bool, bandwidth int64) 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) DelHostPort

func (sw *OvsSwitch) DelHostPort(intfName string, isHostNS bool) error

DelHostPort removes a host port from the OVS

func (*OvsSwitch) DelSvcSpec

func (sw *OvsSwitch) DelSvcSpec(svcName string, spec *ofnet.ServiceSpec) error

DelSvcSpec invokes ofnetAgent api

func (*OvsSwitch) Delete

func (sw *OvsSwitch) Delete()

Delete performs cleanup prior to destruction of the OvsDriver

func (*OvsSwitch) DeleteBgp

func (sw *OvsSwitch) DeleteBgp() error

DeleteBgp deletes bgp config from host

func (*OvsSwitch) DeleteMaster

func (sw *OvsSwitch) DeleteMaster(node core.ServiceInfo) error

DeleteMaster deletes master node

func (*OvsSwitch) DeleteNetwork

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

DeleteNetwork deletes a network/vlan

func (*OvsSwitch) DeletePort

func (sw *OvsSwitch) DeletePort(epOper *OvsOperEndpointState, skipVethPair bool) error

DeletePort removes a port from OVS

func (*OvsSwitch) DeleteVtep

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

DeleteVtep deletes a VTEP

func (*OvsSwitch) GetEndpointStats

func (sw *OvsSwitch) GetEndpointStats() (map[string]*ofnet.OfnetEndpointStats, error)

GetEndpointStats invokes ofnetAgent api

func (*OvsSwitch) InspectBgp

func (sw *OvsSwitch) InspectBgp() (interface{}, error)

InspectBgp returns ofnet state in json form

func (*OvsSwitch) InspectState

func (sw *OvsSwitch) InspectState() (interface{}, error)

InspectState ireturns ofnet state in json form

func (*OvsSwitch) RemoveUplinkPort

func (sw *OvsSwitch) RemoveUplinkPort() error

RemoveUplinkPort removes uplink port from the OVS

func (*OvsSwitch) SvcProviderUpdate

func (sw *OvsSwitch) SvcProviderUpdate(svcName string, providers []string)

SvcProviderUpdate invokes ofnetAgent api

func (*OvsSwitch) UpdateEndpoint

func (sw *OvsSwitch) UpdateEndpoint(ovsPortName string, burst, dscp int, epgBandwidth int64) error

UpdateEndpoint updates endpoint state

func (*OvsSwitch) UpdatePort

func (sw *OvsSwitch) UpdatePort(intfName string, cfgEp *mastercfg.CfgEndpointState, pktTag, nwPktTag, dscp int, skipVethPair bool) 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, burst int, bandwidth int64) 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 returns 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.

func (*OvsdbDriver) UpdatePolicingRate

func (d *OvsdbDriver) UpdatePolicingRate(intfName string, burst int, bandwidth int64) error

UpdatePolicingRate will update the ingress policing rate in interface table.

type Presence

type Presence struct {
	Items map[string]bool
}

Presence indicates presence of an item

Jump to

Keyboard shortcuts

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