Documentation ¶
Index ¶
- Constants
- type Bridge
- type Error
- type Interface
- type OVSBridge
- func (br *OVSBridge) Create() Error
- func (br *OVSBridge) CreateGenevePort(name string, ofPortRequest int32, remoteIP string) (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) CreateVXLANPort(name string, ofPortRequest int32, remoteIP string) (string, Error)
- func (br *OVSBridge) Delete() Error
- func (br *OVSBridge) DeletePort(portUUID string) Error
- func (br *OVSBridge) DeletePorts(portUUIDList []string) Error
- func (br *OVSBridge) GetExternalIDs() (map[string]string, Error)
- func (br *OVSBridge) GetOFPort(ifName string) (int32, 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) SetExternalIDs(externalIDs map[string]interface{}) Error
- func (br *OVSBridge) SetInterfaceMTU(name string, MTU int) error
- type OVSBridgeClient
- type OVSPortData
- type Port
- type TransactionError
Constants ¶
const ( GENEVE_TUNNEL = "geneve" VXLAN_TUNNEL = "vxlan" OVSDatapathSystem = "system" OVSDatapathNetdev = "netdev" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 OVSBridge ¶
type OVSBridge struct {
// contains filtered or unexported fields
}
func NewOVSBridge ¶
NewOVSBridge creates and returns a new OVSBridge struct.
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) CreateGenevePort ¶
func (br *OVSBridge) CreateGenevePort(name string, ofPortRequest int32, remoteIP string) (string, Error)
CreateGenevePort creates a Geneve tunnel port with the specified name 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.
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) CreateVXLANPort ¶
func (br *OVSBridge) CreateVXLANPort(name string, ofPortRequest int32, remoteIP string) (string, Error)
CreateVXLANPort creates a VXLAN tunnel port with the specified name 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.
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) GetExternalIDs ¶
GetExternalIDs returns the external IDs of the bridge.
func (*OVSBridge) GetOFPort ¶
GetOFPort retrieves the ofport value of an interface given the interface name. The function will invoke OVSDB "wait" operation with 1 second timeout to wait the ofport is set on the interface, and so could be blocked for 1 second. If the "wait" operation timeout, value 0 will be returned.
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) SetExternalIDs ¶
SetExternalIDs sets the provided external IDs to the bridge.
type OVSBridgeClient ¶
type OVSBridgeClient interface { Create() Error Delete() Error GetExternalIDs() (map[string]string, Error) SetExternalIDs(externalIDs map[string]interface{}) Error CreatePort(name, ifDev string, externalIDs map[string]interface{}) (string, Error) CreateGenevePort(name string, ofPortRequest int32, remoteIP string) (string, Error) CreateInternalPort(name string, ofPortRequest int32, externalIDs map[string]interface{}) (string, Error) CreateVXLANPort(name string, ofPortRequest int32, remoteIP string) (string, Error) DeletePort(portUUID string) Error DeletePorts(portUUIDList []string) Error GetOFPort(ifName string) (int32, Error) GetPortData(portUUID, ifName string) (*OVSPortData, Error) GetPortList() ([]OVSPortData, Error) SetInterfaceMTU(name string, MTU int) error }
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