ovsd

package
v0.0.0-...-8dd92da Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2018 License: Apache-2.0 Imports: 22 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 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) AddPolicyRule

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

AddPolicyRule creates a policy rule

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 string, net int) (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) CreateRemoteEndpoint

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

CreateRemoteEndpoint creates a remote endpoint by named identifier

func (*OvsDriver) Deinit

func (d *OvsDriver) Deinit()

Deinit performs cleanup prior to destruction of the OvsDriver

func (*OvsDriver) DelPolicyRule

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

DelPolicyRule deletes a policy rule

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, subnet, 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) DeleteRemoteEndpoint

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

DeleteRemoteEndpoint deletes a remote endpoint by named identifier

func (*OvsDriver) GetEndpointStats

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

GetEndpointStats gets all endpoints from all ovs instances

func (*OvsDriver) GlobalConfigUpdate

func (d *OvsDriver) GlobalConfigUpdate(inst core.InstanceInfo) error

GlobalConfigUpdate sets the global level configs like arp-mode

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) InspectNameserver

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

InspectNameserver returns nameserver 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 OvsSwitch

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

OvsSwitch represents on OVS bridge instance

func NewOvsSwitch

func NewOvsSwitch(bridgeName, netType, localIP, fwdMode string,
	vlanIntf []string, hostPvtNW int, vxlanUDPPort int) (*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, network int, isHostNS bool) (string, 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) AddNameServer

func (sw *OvsSwitch) AddNameServer(ns ofnet.NameServer)

AddNameServer returns ofnet state in json form

func (*OvsSwitch) AddSvcSpec

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

AddSvcSpec invokes ofnetAgent api

func (sw *OvsSwitch) AddUplink(uplinkName string, intfList []string) error

AddUplink adds uplink port(s) 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 *drivers.OperEndpointState, 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) GetUplinkInterfaces

func (sw *OvsSwitch) GetUplinkInterfaces(uplinkID string) []string

GetUplinkInterfaces returns the list of interface associated with the uplink port

func (*OvsSwitch) GlobalConfigUpdate

func (sw *OvsSwitch) GlobalConfigUpdate(cfg ofnet.OfnetGlobalConfig) error

GlobalConfigUpdate updates the global configs like arp-mode

func (*OvsSwitch) HandleLinkUpdates

func (sw *OvsSwitch) HandleLinkUpdates(linkUpd ofnet.LinkUpdateInfo)

HandleLinkUpdates handle link updates and update the datapath

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 (sw *OvsSwitch) RemoveUplinks() error

RemoveUplinks removes uplink ports 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, vxlanUDPPort int) (*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) CreatePortBond

func (d *OvsdbDriver) CreatePortBond(intfList []string, bondName string) error

CreatePortBond creates port bond in OVS

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) DeletePortBond

func (d *OvsdbDriver) DeletePortBond(bondName string, intfList []string) error

DeletePortBond deletes a port bond 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) GetInterfacesInPort

func (d *OvsdbDriver) GetInterfacesInPort(portName string) []string

GetInterfacesInPort gets list of interfaces in a port in sorted order

func (*OvsdbDriver) GetIntfInfo

func (d *OvsdbDriver) GetIntfInfo(uuid libovsdb.UUID) libovsdb.Row

GetIntfInfo gets interface information from "Interface" table

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) IsIntfNamePresent

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

IsIntfNamePresent checks if intf already exists in OVS bridge

func (*OvsdbDriver) IsPortNamePresent

func (d *OvsdbDriver) IsPortNamePresent(portName 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