Documentation ¶
Index ¶
- Constants
- func GetConnAddress(ovsRunDir string) string
- func ParseTunnelInterfaceOptions(portData *OVSPortData) (net.IP, net.IP, string, bool)
- type AccessPort
- type Bridge
- type Error
- type Interface
- type InvalidArgumentsError
- type OVSBridge
- func (br *OVSBridge) AddBridgeOtherConfig(configs map[string]interface{}) Error
- func (br *OVSBridge) AddOVSOtherConfig(configs map[string]interface{}) Error
- func (br *OVSBridge) Create() Error
- func (br *OVSBridge) CreateAccessPort(name, ifDev string, externalIDs map[string]interface{}, vlanID uint16) (string, Error)
- func (br *OVSBridge) CreateInternalPort(name string, ofPortRequest int32, externalIDs map[string]interface{}) (string, Error)
- func (br *OVSBridge) CreatePort(name, ifDev string, externalIDs map[string]interface{}) (string, Error)
- func (br *OVSBridge) CreateTunnelPort(name string, tunnelType TunnelType, ofPortRequest int32) (string, Error)
- func (br *OVSBridge) CreateTunnelPortExt(name string, tunnelType TunnelType, ofPortRequest int32, csum bool, ...) (string, Error)
- func (br *OVSBridge) CreateUplinkPort(name string, ofPortRequest int32, externalIDs map[string]interface{}) (string, Error)
- func (br *OVSBridge) Delete() Error
- func (br *OVSBridge) DeleteOVSOtherConfig(configs map[string]interface{}) Error
- func (br *OVSBridge) DeletePort(portUUID string) Error
- func (br *OVSBridge) DeletePorts(portUUIDList []string) Error
- func (br *OVSBridge) GetBridgeName() string
- func (br *OVSBridge) GetDatapathID() (string, Error)
- func (br *OVSBridge) GetExternalIDs() (map[string]string, Error)
- func (br *OVSBridge) GetInterfaceOptions(name string) (map[string]string, Error)
- func (br *OVSBridge) GetOFPort(ifName string, waitUntilValid bool) (int32, Error)
- func (br *OVSBridge) GetOVSDatapathType() OVSDatapathType
- func (br *OVSBridge) GetOVSOtherConfig() (map[string]string, Error)
- func (br *OVSBridge) GetOVSVersion() (string, Error)
- func (br *OVSBridge) GetPortData(portUUID, ifName string) (*OVSPortData, Error)
- func (br *OVSBridge) GetPortList() ([]OVSPortData, Error)
- func (br *OVSBridge) GetPortUUIDList() ([]string, Error)
- func (br *OVSBridge) IsHardwareOffloadEnabled() bool
- func (br *OVSBridge) SetBridgeMcastSnooping(enabled bool) Error
- func (br *OVSBridge) SetDatapathID(datapathID string) Error
- func (br *OVSBridge) SetExternalIDs(externalIDs map[string]interface{}) Error
- func (br *OVSBridge) SetInterfaceMTU(name string, MTU int) error
- func (br *OVSBridge) SetInterfaceOptions(name string, options map[string]interface{}) Error
- func (br *OVSBridge) SetInterfaceType(name, ifType string) Error
- func (br *OVSBridge) SetPortExternalIDs(portName string, externalIDs map[string]interface{}) Error
- type OVSBridgeClient
- type OVSDatapathType
- type OVSPortData
- type Port
- type TransactionError
- type TunnelType
Constants ¶
const ( GeneveTunnel = "geneve" VXLANTunnel = "vxlan" GRETunnel = "gre" STTTunnel = "stt" OVSDatapathSystem OVSDatapathType = "system" OVSDatapathNetdev OVSDatapathType = "netdev" )
const (
DefaultOVSRunDir = "/var/run/openvswitch"
)
Variables ¶
This section is empty.
Functions ¶
func GetConnAddress ¶
func ParseTunnelInterfaceOptions ¶
ParseTunnelInterfaceOptions reads remote IP, local IP, IPsec PSK, and csum from the tunnel interface options and returns them.
Types ¶
type AccessPort ¶ added in v1.6.0
type Error ¶
type Error interface { error Timeout() bool // Is the error a timeout? Temporary() bool // Is the error temporary? }
func NewOVSDBConnectionUDS ¶
NewOVSDBConnectionUDS connects to the OVSDB server on the UNIX domain socket specified by address. If address is set to "", the default UNIX domain socket path "/run/openvswitch/db.sock" will be used. Returns the OVSDB struct on success.
type InvalidArgumentsError ¶
type InvalidArgumentsError string
func (InvalidArgumentsError) Error ¶
func (e InvalidArgumentsError) Error() string
func (InvalidArgumentsError) Temporary ¶
func (e InvalidArgumentsError) Temporary() bool
func (InvalidArgumentsError) Timeout ¶
func (e InvalidArgumentsError) Timeout() bool
type OVSBridge ¶
type OVSBridge struct {
// contains filtered or unexported fields
}
func NewOVSBridge ¶
func NewOVSBridge(bridgeName string, ovsDatapathType OVSDatapathType, ovsdb *ovsdb.OVSDB) *OVSBridge
NewOVSBridge creates and returns a new OVSBridge struct.
func (*OVSBridge) AddBridgeOtherConfig ¶ added in v1.5.0
AddBridgeOtherConfig adds the given configs to the "other_config" column of the single record in the "Bridge" table. For each config, it will only be added if its key doesn't already exist. No error is returned if configs already exist.
func (*OVSBridge) AddOVSOtherConfig ¶
AddOVSOtherConfig adds the given configs to the "other_config" column of the single record in the "Open_vSwitch" table. For each config, it will only be added if its key doesn't already exist. No error is returned if configs already exist.
func (*OVSBridge) Create ¶
Create looks up or creates the bridge. If the bridge with name bridgeName does not exist, it will be created. Openflow protocol version 1.0 and 1.3 will be enabled for the bridge.
func (*OVSBridge) CreateAccessPort ¶ added in v1.6.0
func (br *OVSBridge) CreateAccessPort(name, ifDev string, externalIDs map[string]interface{}, vlanID uint16) (string, Error)
CreateAccessPort creates a port with the specified name and VLAN ID on the bridge, and connects the interface specified by ifDev to the port. If externalIDs is not empty, the map key/value pairs will be set to the port's external_ids. vlanID=0 will perform same behavior as CreatePort.
func (*OVSBridge) CreateInternalPort ¶
func (br *OVSBridge) CreateInternalPort(name string, ofPortRequest int32, externalIDs map[string]interface{}) (string, Error)
CreateInternalPort creates an internal port with the specified name on the bridge. If externalIDs is not empty, the map key/value pairs will be set to the port's external_ids. If ofPortRequest is not zero, it will be passed to the OVS port creation.
func (*OVSBridge) CreatePort ¶
func (br *OVSBridge) CreatePort(name, ifDev string, externalIDs map[string]interface{}) (string, Error)
CreatePort creates a port with the specified name on the bridge, and connects the interface specified by ifDev to the port. If externalIDs is not empty, the map key/value pairs will be set to the port's external_ids.
func (*OVSBridge) CreateTunnelPort ¶
func (br *OVSBridge) CreateTunnelPort(name string, tunnelType TunnelType, ofPortRequest int32) (string, Error)
CreateTunnelPort creates a tunnel port with the specified name and type on the bridge. If ofPortRequest is not zero, it will be passed to the OVS port creation.
func (*OVSBridge) CreateTunnelPortExt ¶
func (br *OVSBridge) CreateTunnelPortExt( name string, tunnelType TunnelType, ofPortRequest int32, csum bool, localIP string, remoteIP string, psk string, externalIDs map[string]interface{}) (string, Error)
CreateTunnelPortExt creates a tunnel port with the specified name and type on the bridge. If ofPortRequest is not zero, it will be passed to the OVS port creation. If remoteIP is not empty, it will be set to the tunnel port interface options; otherwise flow based tunneling will be configured. psk is for the pre-shared key of IPsec ESP tunnel. If it is not empty, it will be set to the tunnel port interface options. Flow based IPsec tunnel is not supported, so remoteIP must be provided too when psk is not empty. If externalIDs is not nill, the IDs in it will be added to the port's external_ids.
func (*OVSBridge) CreateUplinkPort ¶
func (br *OVSBridge) CreateUplinkPort(name string, ofPortRequest int32, externalIDs map[string]interface{}) (string, Error)
CreateUplinkPort creates uplink port.
func (*OVSBridge) DeleteOVSOtherConfig ¶
DeleteOVSOtherConfig deletes the given configs from the "other_config" column of the single record in the "Open_vSwitch" table. For each config, it will only be deleted if its key exists and its value matches the stored one. No error is returned if configs don't exist or don't match.
func (*OVSBridge) DeletePort ¶
DeletePort deletes the port with the provided portUUID. If the port does not exist no change will be done.
func (*OVSBridge) DeletePorts ¶
DeletePorts deletes ports in portUUIDList on the bridge
func (*OVSBridge) GetBridgeName ¶
func (*OVSBridge) GetDatapathID ¶
func (*OVSBridge) GetExternalIDs ¶
GetExternalIDs returns the external IDs of the bridge.
func (*OVSBridge) GetInterfaceOptions ¶
GetInterfaceOptions returns the options of the provided interface.
func (*OVSBridge) GetOFPort ¶
GetOFPort retrieves the ofport value of an interface given the interface name. The function will invoke OVSDB "wait" operation with 5 seconds timeout to wait the ofport is set on the interface, and so could be blocked for 5 seconds. If the "wait" operation times out or the interface is not found, or the ofport is invalid, value 0 and an error will be returned. If waitUntilValid is true, the function will wait the ofport is not -1 with 5 seconds timeout. This parameter is used after the interface type is changed by the client.
func (*OVSBridge) GetOVSDatapathType ¶
func (br *OVSBridge) GetOVSDatapathType() OVSDatapathType
func (*OVSBridge) GetOVSOtherConfig ¶
func (*OVSBridge) GetOVSVersion ¶
GetOVSVersion either returns the version of OVS, or an error.
func (*OVSBridge) GetPortData ¶
func (br *OVSBridge) GetPortData(portUUID, ifName string) (*OVSPortData, Error)
GetPortData retrieves port data given the OVS port UUID and interface name. nil is returned, if the port or interface could not be found, or the interface is not attached to the port. The port's OFPort will be set to 0, if its ofport is not assigned by OVS yet.
func (*OVSBridge) GetPortList ¶
func (br *OVSBridge) GetPortList() ([]OVSPortData, Error)
GetPortList returns all ports on the bridge. A port's OFPort will be set to 0, if its ofport is not assigned by OVS yet.
func (*OVSBridge) GetPortUUIDList ¶
GetPortUUIDList returns UUIDs of all ports on the bridge.
func (*OVSBridge) IsHardwareOffloadEnabled ¶
func (*OVSBridge) SetBridgeMcastSnooping ¶ added in v1.5.0
SetBridgeMcastSnooping configures bridge to enable multicast snooping
func (*OVSBridge) SetDatapathID ¶
SetDatapathID sets the provided datapath ID to the bridge. If datapath ID is not configured, reconfigure bridge(add/delete port or set different Mac address for local port) will change its datapath ID. And the change of datapath ID and interrupt OpenFlow connection. See question "My bridge disconnects from my controller on add-port/del-port" in: http://openvswitch.org/support/dist-docs-2.5/FAQ.md.html
func (*OVSBridge) SetExternalIDs ¶
SetExternalIDs sets the provided external IDs to the bridge.
func (*OVSBridge) SetInterfaceMTU ¶
func (*OVSBridge) SetInterfaceOptions ¶
SetInterfaceOptions sets the specified options of the provided interface.
func (*OVSBridge) SetInterfaceType ¶ added in v1.5.0
SetInterfaceType modifies the OVS Interface type to the given ifType. This function is used on Windows when the Pod interface is created after the OVS port creation.
type OVSBridgeClient ¶
type OVSBridgeClient interface { Create() Error Delete() Error GetExternalIDs() (map[string]string, Error) SetExternalIDs(externalIDs map[string]interface{}) Error SetDatapathID(datapathID string) Error GetInterfaceOptions(name string) (map[string]string, Error) SetInterfaceOptions(name string, options map[string]interface{}) Error CreatePort(name, ifDev string, externalIDs map[string]interface{}) (string, Error) CreateAccessPort(name, ifDev string, externalIDs map[string]interface{}, vlanID uint16) (string, Error) CreateInternalPort(name string, ofPortRequest int32, externalIDs map[string]interface{}) (string, Error) CreateTunnelPort(name string, tunnelType TunnelType, ofPortRequest int32) (string, Error) CreateTunnelPortExt(name string, tunnelType TunnelType, ofPortRequest int32, csum bool, localIP string, remoteIP string, psk string, externalIDs map[string]interface{}) (string, Error) CreateUplinkPort(name string, ofPortRequest int32, externalIDs map[string]interface{}) (string, Error) DeletePort(portUUID string) Error DeletePorts(portUUIDList []string) Error GetOFPort(ifName string, waitUntilValid bool) (int32, Error) GetPortData(portUUID, ifName string) (*OVSPortData, Error) GetPortList() ([]OVSPortData, Error) SetInterfaceMTU(name string, MTU int) error GetOVSVersion() (string, Error) AddOVSOtherConfig(configs map[string]interface{}) Error GetOVSOtherConfig() (map[string]string, Error) DeleteOVSOtherConfig(configs map[string]interface{}) Error AddBridgeOtherConfig(configs map[string]interface{}) Error SetBridgeMcastSnooping(enabled bool) Error GetBridgeName() string IsHardwareOffloadEnabled() bool GetOVSDatapathType() OVSDatapathType SetInterfaceType(name, ifType string) Error SetPortExternalIDs(portName string, externalIDs map[string]interface{}) Error }
type OVSDatapathType ¶
type OVSDatapathType string
type OVSPortData ¶
type Port ¶
type Port struct { Name string `json:"name"` Interfaces []interface{} `json:"interfaces"` ExternalIDs []interface{} `json:"external_ids,omitempty"` }
type TransactionError ¶
type TransactionError struct {
// contains filtered or unexported fields
}
func NewTransactionError ¶
func NewTransactionError(err error, temporary bool) *TransactionError
func (*TransactionError) Temporary ¶
func (e *TransactionError) Temporary() bool
func (*TransactionError) Timeout ¶
func (e *TransactionError) Timeout() bool
type TunnelType ¶
type TunnelType string