libovsdb

package module
v0.0.0-...-0b24552 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2014 License: Apache-2.0 Imports: 10 Imported by: 0

README

libovsdb

Circle CI

An OVSDB Library written in Go

What is OVSDB?

OVSDB is the Open vSwitch Database Protocol. It's defined in RFC 7047 It's used mainly for managing the configuration of Open vSwitch, but it could also be used to manage your stamp collection. Philatelists Rejoice!

## Running the tests

To run only unit tests:

make test

To run integration tests, you'll need access to docker to run an Open vSwitch container. Mac users can use boot2docker

export DOCKER_IP=192.168.59.103
fig up -d
make test-all
fig stop

Dependency Management

We use godep for dependency management with rewritten import paths. This allows the repo to be go getable.

To bump the version of a dependency, follow these instructions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCancelArgs

func NewCancelArgs(id interface{}) []interface{}

NewCancelArgs creates a new set of arguments for a cancel RPC

func NewCondition

func NewCondition(column string, function string, value interface{}) []interface{}

NewCondition creates a new condition as specified in RFC7047

func NewGetSchemaArgs

func NewGetSchemaArgs(schema string) []interface{}

NewGetSchemaArgs creates a new set of arguments for a get_schemas RPC

func NewLockArgs

func NewLockArgs(id interface{}) []interface{}

NewLockArgs creates a new set of arguments for a lock, steal or unlock RPC

func NewMonitorArgs

func NewMonitorArgs(database string, value interface{}, requests []MonitorRequest) []interface{}

NewMonitorArgs creates a new set of arguments for a monitor RPC

func NewMonitorCancelArgs

func NewMonitorCancelArgs(value interface{}) []interface{}

NewMonitorCancelArgs creates a new set of arguments for a monitor_cancel RPC

func NewMutation

func NewMutation(column string, mutator string, value interface{}) []interface{}

NewMutation creates a new mutation as specified in RFC7047

func NewNamedUUID

func NewNamedUUID(uuid string) []string

NewNamedUUID creates a new named-uuid as specified in RFC7047

func NewTransactArgs

func NewTransactArgs(database string, operations ...Operation) []interface{}

NewTransactArgs creates a new set of arguments for a transact RPC

func NewUUID

func NewUUID(uuid string) ([]string, error)

NewUUID creates a new uuid as specified in RFC7047

Types

type ColumnSchema

type ColumnSchema struct {
	Name      string      `json:"name"`
	Type      interface{} `json:"type"`
	Ephemeral bool        `json:"ephemeral,omitempty"`
	Mutable   bool        `json:"mutable,omitempty"`
}

type DatabaseSchema

type DatabaseSchema struct {
	Name    string                 `json:"name"`
	Version string                 `json:"version"`
	Tables  map[string]TableSchema `json:"tables"`
}

func (DatabaseSchema) Print

func (schema DatabaseSchema) Print()

type MonitorRequest

type MonitorRequest struct {
	Columns []string      `json:"columns,omitempty"`
	Select  MonitorSelect `json:"select,omitempty"`
}

MonitorRequest represents a monitor request according to RFC7047

type MonitorSelect

type MonitorSelect struct {
	Initial bool `json:"initial,omitempty"`
	Insert  bool `json:"insert,omitempty"`
	Delete  bool `json:"delete,omitempty"`
	Modify  bool `json:"modify,omitempty"`
}

MonitorSelect represents a monitor select according to RFC7047

type Operation

type Operation struct {
	Op        string                   `json:"op"`
	Table     string                   `json:"table"`
	Row       map[string]interface{}   `json:"row,omitempty"`
	Rows      []map[string]interface{} `json:"rows,omitempty"`
	Columns   []string                 `json:"columns,omitempty"`
	Mutations []string                 `json:"mutations,omitempty"`
	Timeout   int                      `json:"timeout,omitempty"`
	Where     []string                 `json:"where,omitempty"`
	Until     string                   `json:"until,omitempty"`
	UUIDName  string                   `json:"uuid_name,omitempty"`
}

Operation represents an operation according to RFC7047

type OvsSet

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

func (OvsSet) MarshalJSON

func (o OvsSet) MarshalJSON() ([]byte, error)

<set> notation requires special marshalling

type OvsdbClient

type OvsdbClient struct {
	Schema map[string]DatabaseSchema
	// contains filtered or unexported fields
}

func Connect

func Connect(ipAddr string, port int) (OvsdbClient, error)

func (OvsdbClient) Disconnect

func (ovs OvsdbClient) Disconnect()

func (OvsdbClient) GetSchema

func (ovs OvsdbClient) GetSchema(dbName string) (*DatabaseSchema, error)

RFC 7047 : get_schema

func (OvsdbClient) ListDbs

func (ovs OvsdbClient) ListDbs() ([]string, error)

RFC 7047 : list_dbs

func (OvsdbClient) Transact

func (ovs OvsdbClient) Transact(database string, operation ...Operation) ([]interface{}, error)

type OvsdbError

type OvsdbError struct {
	Error   string `json:"error"`
	Details string `json:"details,omitempty"`
}

OvsdbError is an OVS Error Condition

type TableSchema

type TableSchema struct {
	Columns map[string]ColumnSchema `json:"columns"`
	Indexes [][]string              `json:"indexes,omitempty"`
}

Directories

Path Synopsis
Godeps
_workspace/src/github.com/cenkalti/hub
Package hub provides a simple event dispatcher for publish/subscribe pattern.
Package hub provides a simple event dispatcher for publish/subscribe pattern.
_workspace/src/github.com/cenkalti/rpc2
Package rpc2 provides bi-directional RPC client and server similar to net/rpc.
Package rpc2 provides bi-directional RPC client and server similar to net/rpc.
_workspace/src/github.com/cenkalti/rpc2/jsonrpc
Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec for the rpc2 package.
Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec for the rpc2 package.

Jump to

Keyboard shortcuts

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