Documentation ¶
Overview ¶
Package ovsdb implements OVSDB (JSON-RPC 1.0) Client per RFC 7047.
Index ¶
- type Client
- type ClusterPeer
- type ClusterState
- type Column
- type Condition
- type Error
- type Operation
- type OvnChassis
- type OvnClient
- func (cli *OvnClient) AppListCommands(db string) (map[string]bool, error)
- func (cli *OvnClient) Close()
- func (cli *OvnClient) Connect() error
- func (cli *OvnClient) GetAppClusteringInfo(db string) (ClusterState, error)
- func (cli *OvnClient) GetAppCoverageMetrics(db string) (map[string]map[string]float64, error)
- func (cli *OvnClient) GetAppMemoryMetrics(db string) (map[string]float64, error)
- func (cli *OvnClient) GetChassis() ([]*OvnChassis, error)
- func (cli *OvnClient) GetLogFileEventStats(name string) (map[string]map[string]uint64, error)
- func (cli *OvnClient) GetLogFileInfo(name string) (OvsDataFile, error)
- func (cli *OvnClient) GetLogicalSwitchPorts() ([]*OvnLogicalSwitchPort, error)
- func (cli *OvnClient) GetLogicalSwitches() ([]*OvnLogicalSwitch, error)
- func (cli *OvnClient) GetProcessInfo(name string) (OvsProcess, error)
- func (cli *OvnClient) GetSystemID() error
- func (cli *OvnClient) GetSystemInfo() error
- func (cli *OvnClient) IsDefaultPortUp(db string) (int, error)
- func (cli *OvnClient) IsRaftPortUp(db string) (int, error)
- func (cli *OvnClient) IsSslPortUp(db string) (int, error)
- func (cli *OvnClient) MapPortToChassis(vteps []*OvnChassis, logicalSwitchPorts []*OvnLogicalSwitchPort)
- func (cli *OvnClient) MapPortToSwitch(logicalSwitches []*OvnLogicalSwitch, ...)
- type OvnLogicalSwitch
- type OvnLogicalSwitchPort
- type OvnLogicalSwitchPortAddress
- type OvsBridge
- type OvsClient
- func (cli *OvsClient) AppListCommands(db string) (map[string]bool, error)
- func (cli *OvsClient) Close()
- func (cli *OvsClient) Connect() error
- func (cli *OvsClient) GetAppCoverageMetrics(db string) (map[string]map[string]float64, error)
- func (cli *OvsClient) GetAppDatapath(db string) ([]*OvsDatapath, []*OvsBridge, []*OvsInterface, error)
- func (cli *OvsClient) GetAppMemoryMetrics(db string) (map[string]float64, error)
- func (cli *OvsClient) GetDbInterfaces() ([]*OvsInterface, error)
- func (cli *OvsClient) GetLogFileEventStats(name string) (map[string]map[string]uint64, error)
- func (cli *OvsClient) GetLogFileInfo(name string) (OvsDataFile, error)
- func (cli *OvsClient) GetOvsFlows() ([]*OvsFlow, error)
- func (cli *OvsClient) GetProcessInfo(name string) (OvsProcess, error)
- func (cli *OvsClient) GetRxqPmdUsage(db string) ([]*OvsPmd, []*OvsRxq, error)
- func (cli *OvsClient) GetSystemID() error
- func (cli *OvsClient) GetSystemInfo() error
- func (cli *OvsClient) GetTunnels() ([]*OvsTunnel, error)
- func (cli *OvsClient) IsDefaultPortUp(db string) (int, error)
- func (cli *OvsClient) IsSslPortUp(db string) (int, error)
- type OvsDaemon
- type OvsDataFile
- type OvsDatabase
- type OvsDatapath
- type OvsFlow
- type OvsInterface
- type OvsPmd
- type OvsPort
- type OvsProcess
- type OvsRxq
- type OvsTunnel
- type Request
- type Response
- type Result
- type RouteFilter
- type RouteFilterEntry
- type Row
- type Schema
- type Table
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Endpoint string Timeout int MaxRetries int Schemas map[string]Schema References map[string]map[string]map[string]string // contains filtered or unexported fields }
Client DOCS-TBD
func (*Client) DatabaseExists ¶
DatabaseExists - DOCS-TBD
type ClusterPeer ¶
type ClusterPeer struct { ID string Address string NextIndex uint64 MatchIndex uint64 Connection struct { Inbound int Outbound int } }
ClusterPeer contains information about a cluster peer.
type ClusterState ¶
type ClusterState struct { ID string UUID string Database string ClusterID string ClusterUUID string Address string Status int Role int Term uint64 IsLeaderSelf int IsVotedSelf int Log struct { Low uint64 High uint64 } NextIndex uint64 MatchIndex uint64 NotCommittedEntries uint64 NotAppliedEntries uint64 Peers map[string]*ClusterPeer Connections struct { Inbound int Outbound int } }
ClusterState contains information about the state of a cluster of a server perspective.
type Column ¶
type Column struct { Type interface{} `json:"type"` Ephemeral bool `json:"ephemeral"` Mutable bool `json:"mutable"` }
Column - TODO
type Condition ¶
Condition represents condition for select operation, as described in [Notation](https://tools.ietf.org/html/rfc7047#section-5.1) section. The meaning of the <function> depends on the type of <column>.
func (Condition) MarshalJSON ¶
MarshalJSON - DOCS-TBD
type Error ¶
type Error struct { Message string `json:"error"` Details string `json:"details"` Syntax string `json:"syntax"` }
Error - TODO
type Operation ¶
type Operation struct { Name string `json:"op"` Table string `json:"table"` Conditions []Condition `json:"where"` Columns []string `json:"columns,omitempty"` }
Operation represents Transact Method, as described in https://tools.ietf.org/html/rfc7047#section-4.1.3
type OvnChassis ¶
type OvnChassis struct { UUID string Name string IPAddress net.IP Encaps struct { UUID string Proto string } Up int Ports []string Switches []string }
OvnChassis represent an OVN chassis.
type OvnClient ¶
type OvnClient struct { Database struct { Northbound OvsDatabase Southbound OvsDatabase Vswitch OvsDatabase } Service struct { Northd OvsDaemon Vswitchd OvsDaemon } Timeout int System struct { ID string RunDir string Hostname string Type string Version string } }
OvnClient holds connection to all OVN databases.
func NewOvnClient ¶
func NewOvnClient() *OvnClient
NewOvnClient creates an instance of a client for OVN stack.
func (*OvnClient) AppListCommands ¶
AppListCommands returns the list of commands supported by ovs-appctl tool and the database.
func (*OvnClient) GetAppClusteringInfo ¶
func (cli *OvnClient) GetAppClusteringInfo(db string) (ClusterState, error)
GetAppClusteringInfo returns the counters associated with clustering setup.
func (*OvnClient) GetAppCoverageMetrics ¶
GetAppCoverageMetrics returns the counters of the the number of times particular events occur during a daemon's runtime. The counters include averaged per-second rates for the last few seconds, the last minute and the last hour, and the total counts of all of the coverage counters.
func (*OvnClient) GetAppMemoryMetrics ¶
GetAppMemoryMetrics returns memory usage counters.
func (*OvnClient) GetChassis ¶
func (cli *OvnClient) GetChassis() ([]*OvnChassis, error)
GetChassis returns a list of OVN chassis.
func (*OvnClient) GetLogFileEventStats ¶
GetLogFileEventStats TODO
func (*OvnClient) GetLogFileInfo ¶
func (cli *OvnClient) GetLogFileInfo(name string) (OvsDataFile, error)
GetLogFileInfo TODO
func (*OvnClient) GetLogicalSwitchPorts ¶
func (cli *OvnClient) GetLogicalSwitchPorts() ([]*OvnLogicalSwitchPort, error)
GetLogicalSwitchPorts returns a list of OVN logical switch ports.
func (*OvnClient) GetLogicalSwitches ¶
func (cli *OvnClient) GetLogicalSwitches() ([]*OvnLogicalSwitch, error)
GetLogicalSwitches returns a list of OVN logical switches.
func (*OvnClient) GetProcessInfo ¶
func (cli *OvnClient) GetProcessInfo(name string) (OvsProcess, error)
GetProcessInfo returns information about a service or database process.
func (*OvnClient) GetSystemInfo ¶
GetSystemInfo returns a hash containing system information, e.g. `system_id` associated with the Open_vSwitch database.
func (*OvnClient) IsDefaultPortUp ¶
IsDefaultPortUp returns the TCP port used for database connection. If the value if greater than 0, then the port is in LISTEN state.
func (*OvnClient) IsRaftPortUp ¶
IsRaftPortUp returns the TCP port used for clustering (raft). If the value if greater than 0, then the port is in LISTEN state.
func (*OvnClient) IsSslPortUp ¶
IsSslPortUp returns the TCP port used for secure database connection. If the value if greater than 0, then the port is in LISTEN state.
func (*OvnClient) MapPortToChassis ¶
func (cli *OvnClient) MapPortToChassis(vteps []*OvnChassis, logicalSwitchPorts []*OvnLogicalSwitchPort)
MapPortToChassis updates logical switch ports with the entries from the chassis associated with the ports.
func (*OvnClient) MapPortToSwitch ¶
func (cli *OvnClient) MapPortToSwitch(logicalSwitches []*OvnLogicalSwitch, logicalSwitchPorts []*OvnLogicalSwitchPort)
MapPortToSwitch update logical switch ports with the entries from the logical switches associated with the ports.
type OvnLogicalSwitch ¶
type OvnLogicalSwitch struct { UUID string `json:"uuid" yaml:"uuid"` Name string `json:"name" yaml:"name"` TunnelKey uint64 `json:"tunnel_key" yaml:"tunnel_key"` DatapathID string ExternalIDs map[string]string Ports []string `json:"ports" yaml:"ports"` }
OvnLogicalSwitch holds basic information about a logical switch.
type OvnLogicalSwitchPort ¶
type OvnLogicalSwitchPort struct { UUID string Name string Addresses []OvnLogicalSwitchPortAddress ExternalIDs map[string]string Encapsulation string TunnelKey uint64 Up bool PortBindingUUID string ChassisUUID string ChassisIPAddress net.IP DatapathUUID string LogicalSwitchUUID string LogicalSwitchName string }
OvnLogicalSwitchPort holds a consolidated record from both NB and SB databases about a logical switch port and the workload attached to it.
type OvsBridge ¶
type OvsBridge struct { UUID string Name string AutoAttach []string // TODO: unverified data type Controller []string // TODO: unverified data type DatapathName string // reference from ovs-appctl dpif/show DatapathID string DatapathType string DatapathVersion string ExternalIDs map[string]string FailMode string FloodVlans []string // TODO: unverified data type FlowTables map[string]string // TODO: unverified data type Ipfix []string // TODO: unverified data type McastSnoopingEnable bool Mirrors []string // TODO: unverified data type Netflow []string // TODO: unverified data type OtherConfig map[string]string Ports []string Protocols []string // TODO: unverified data type RstpEnable bool RstpStatus map[string]string // TODO: unverified data type Sflow []string // TODO: unverified data type Status map[string]string // TODO: unverified data type StpEnable bool }
OvsBridge represents an OVS bridge. The data help by the data structure is the same as the output of `ovs-vsctl list Bridge` command.
type OvsClient ¶
type OvsClient struct { Database struct { Vswitch OvsDatabase } Service struct { OvnController OvsDaemon Vswitchd OvsDaemon } Timeout int System struct { ID string RunDir string Hostname string Type string Version string } }
OvsClient holds connection to OVS databases.
func NewOvsClient ¶
func NewOvsClient() *OvsClient
NewOvsClient creates an instance of a client for OVS stack.
func (*OvsClient) AppListCommands ¶
AppListCommands returns the list of commands supported by ovs-appctl tool and the database.
func (*OvsClient) GetAppCoverageMetrics ¶
GetAppCoverageMetrics returns the counters of the the number of times particular events occur during a daemon's runtime. The counters include averaged per-second rates for the last few seconds, the last minute and the last hour, and the total counts of all of the coverage counters.
func (*OvsClient) GetAppDatapath ¶
func (cli *OvsClient) GetAppDatapath(db string) ([]*OvsDatapath, []*OvsBridge, []*OvsInterface, error)
GetAppDatapath returns the information about available datapaths.
func (*OvsClient) GetAppMemoryMetrics ¶
GetAppMemoryMetrics returns memory usage counters.
func (*OvsClient) GetDbInterfaces ¶
func (cli *OvsClient) GetDbInterfaces() ([]*OvsInterface, error)
GetDbInterfaces returns a list of interfaces from the Interface table of OVS database.
func (*OvsClient) GetLogFileEventStats ¶
GetLogFileEventStats TODO
func (*OvsClient) GetLogFileInfo ¶
func (cli *OvsClient) GetLogFileInfo(name string) (OvsDataFile, error)
GetLogFileInfo TODO
func (*OvsClient) GetOvsFlows ¶
GetOvsFlows returns a list of datapath flows of an OVS instance.
func (*OvsClient) GetProcessInfo ¶
func (cli *OvsClient) GetProcessInfo(name string) (OvsProcess, error)
GetProcessInfo returns information about a service or database process.
func (*OvsClient) GetRxqPmdUsage ¶
GetAppDatapath returns the information about available datapaths.
func (*OvsClient) GetSystemInfo ¶
GetSystemInfo returns a hash containing system information, e.g. `system_id` associated with the Open_vSwitch database.
func (*OvsClient) GetTunnels ¶
GetTunnels returns a list of tunnels originating from an OVS instance.
func (*OvsClient) IsDefaultPortUp ¶
IsDefaultPortUp returns the TCP port used for database connection. If the value if greater than 0, then the port is in LISTEN state.
type OvsDaemon ¶
type OvsDaemon struct { File struct { Log OvsDataFile Pid OvsDataFile } Process OvsProcess Socket struct { Control string } }
OvsDaemon stores information about a process or database, together with associated log and process id files.
type OvsDataFile ¶
type OvsDataFile struct { Path string Component string Info os.FileInfo Reader struct { Offset int64 } }
OvsDataFile stores information about the files related to OVS operations, e.g. log files, database files, etc.
type OvsDatabase ¶
type OvsDatabase struct { Client *Client Name string Socket struct { Remote string Control string Raft string } Port struct { Default int Ssl int Raft int } File struct { Log OvsDataFile Data OvsDataFile Pid OvsDataFile SystemID OvsDataFile } Process OvsProcess Version string Schema struct { Version string } // contains filtered or unexported fields }
OvsDatabase represents an instance of OVS DB.
type OvsDatapath ¶
type OvsDatapath struct { Name string Lookups struct { Hit float64 Missed float64 Lost float64 } Flows float64 Masks struct { Hit float64 Total float64 HitRatio float64 } }
OvsDatapath represents an OVS datapath. A datapath is a collection of the ports attached to bridges. Each datapath also has associated with it a flow table that userspace populates with flows that map from keys based on packet headers and metadata to sets of actions. Importantly, a datapath is a userspace concept.
type OvsFlow ¶
type OvsFlow struct { EthType string Statistics struct { Packets float64 Bytes float64 Used float64 } Flags string Raw string }
OvsFlow is a datapath flow.
func NewOvsFlowFromString ¶
NewOvsFlowFromString retuns OvsFlow instance from an input string.
type OvsInterface ¶
type OvsInterface struct { UUID string Name string Index float64 // reference from ovs-appctl dpif/show, e.g. OVN `tunnel_key` BridgeName string // reference to datapath from ovs-appctl dpif/show DatapathName string // reference to datapath from ovs-appctl dpif/show AdminState string Bfd map[string]string // TODO: unverified data type BfdStatus map[string]string // TODO: unverified data type CfmFault []string // TODO: unverified data type CfmFaultStatus []string // TODO: unverified data type CfmFlapCount []string // TODO: unverified data type CfmHealth []string // TODO: unverified data type CfmMpid []string // TODO: unverified data type CfmRemoteMpids []string // TODO: unverified data type CfmRemoteOpState []string // TODO: unverified data type Duplex string Error []string // TODO: unverified data type ExternalIDs map[string]string IfIndex float64 IngressPolicingBurst float64 IngressPolicingRate float64 LacpCurrent []string // TODO: unverified data type LinkResets float64 LinkSpeed float64 LinkState string Lldp map[string]string // TODO: unverified data type Mac []string // TODO: unverified data type MacInUse string // TODO: unverified data type Mtu float64 MtuRequest []string // TODO: unverified data type OfPort float64 OfPortRequest []string // TODO: unverified data type Options map[string]string OtherConfig map[string]string // TODO: unverified data type Statistics map[string]int Status map[string]string Type string }
OvsInterface represents an OVS interface. The data help by the data structure is the same as the output of `ovs-vsctl list Interface` command.
Reference: http://www.openvswitch.org/support/dist-docs/ovs-vswitchd.conf.db.5.html
type OvsPmd ¶
OvsDatapath represents an OVS datapath. A datapath is a collection of the ports attached to bridges. Each datapath also has associated with it a flow table that userspace populates with flows that map from keys based on packet headers and metadata to sets of actions. Importantly, a datapath is a userspace concept.
type OvsPort ¶
type OvsPort struct { UUID string Name string BondActiveSlave []string // TODO: unverified data type BondDowndelay float64 BondFakeIface bool BondMode []string // TODO: unverified data type BondUpdelay float64 Cvlans []string // TODO: unverified data type ExternalIDs map[string]string FakeBridge bool Interfaces []string Lacp []string // TODO: unverified data type Mac []string // TODO: unverified data type OtherConfig map[string]string // TODO: unverified data type Protected bool Qos []string // TODO: unverified data type RstpStatistics map[string]float64 // TODO: unverified data type RstpStatus map[string]string // TODO: unverified data type Statistics map[string]float64 // TODO: unverified data type Status map[string]string // TODO: unverified data type Tag []string // TODO: unverified data type Trunks []string // TODO: unverified data type VlanMode []string // TODO: unverified data type }
OvsPort represents an OVS bridge. The data help by the data structure is the same as the output of `ovs-vsctl list Port` command.
type OvsProcess ¶
OvsProcess stores information about a process, e.g. user and group, current parent process ids.
type OvsTunnel ¶
type OvsTunnel struct { Name string Encapsulation string ID uint64 Key string PacketType string TTL uint64 Checksum bool RemoteIP string LocalIP string InKey string OutKey string DstPort string Tos string DfDefault bool EgressPktMark string Extensions string Raw string }
OvsTunnel is a remote tunnel endpoint.
func NewOvsTunnelFromString ¶
NewOvsTunnelFromString retuns OvsTunnel instance from an input string.
type Response ¶
type Response struct { Result json.RawMessage `json:"result"` Error Seq uint64 `json:"id"` }
Response - TODO
func (*Response) UnmarshalJSON ¶
UnmarshalJSON - TODO
type Result ¶
type Result struct { Rows []Row `json:"rows"` Database string Table string Columns map[string]string }
Result - TODO
type RouteFilter ¶
type RouteFilter struct {
Entries []*RouteFilterEntry
}
RouteFilter TODO
func NewRouteFilter ¶
func NewRouteFilter(networks []string) (*RouteFilter, error)
NewRouteFilter TODO
func NewRouteFilterExcludeGateway ¶
func NewRouteFilterExcludeGateway(networks []string) (*RouteFilter, error)
NewRouteFilterExcludeGateway TODO
type RouteFilterEntry ¶
RouteFilterEntry TODO
func NewRouteFilterEntry ¶
func NewRouteFilterEntry(network string, excludeGateway bool) (*RouteFilterEntry, error)
NewRouteFilterEntry TODO
type Schema ¶
type Schema struct { Tables map[string]Table `json:"tables"` Checksum string `json:"cksum"` Name string `json:"name"` Version string `json:"version"` }
Schema - TODO
func (*Schema) GetColumnType ¶
GetColumnType - TODO
func (*Schema) GetColumnsTypes ¶
GetColumnsTypes - TODO
type Table ¶
type Table struct { Columns map[string]Column `json:"columns"` Indexes []interface{} `json:"indexes"` MaxRows int `json:"maxRows"` IsRoot bool `json:"isRoot"` }
Table - TODO
type Transaction ¶
Transaction - TODO
Source Files ¶
- app_cluster.go
- app_coverage.go
- app_datapath.go
- app_list_cmd.go
- app_memory.go
- app_pmd.go
- client.go
- condition.go
- database.go
- echo.go
- encoder.go
- error.go
- log.go
- operation.go
- ovn.go
- ovn_chassis.go
- ovn_logical_switch.go
- ovn_logical_switch_port.go
- ovn_tcp_port.go
- ovs.go
- ovs_bridge.go
- ovs_datapath.go
- ovs_flow.go
- ovs_interface.go
- ovs_pmd.go
- ovs_port.go
- ovs_tunnel.go
- process.go
- request.go
- response.go
- result.go
- route_filter.go
- schema.go
- system.go
- transact.go
- util.go