server

package
v0.0.0-...-05daf49 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2016 License: Apache-2.0 Imports: 32 Imported by: 1

Documentation

Index

Constants

View Source
const CONTEXT_KEY = "container_id"
View Source
const CONTEXT_VALUE = "container_data"

Variables

View Source
var ContextCache map[string]string

Functions

func AddInternalPort

func AddInternalPort(ovsClient *libovsdb.OvsdbClient, bridgeName string, portName string, tag uint) error

func AddPeer

func AddPeer(peerIp string) error

func CreateBridge

func CreateBridge() (string, error)

func CreateOVSBridge

func CreateOVSBridge(ovsClient *libovsdb.OvsdbClient, bridgeName string) (string, error)

func DeleteBridge

func DeleteBridge() error

func DeleteNetwork

func DeleteNetwork(name string) error

func DeleteOVSBridge

func DeleteOVSBridge(ovsClient *libovsdb.OvsdbClient, bridgeName, bridgeUuid string) error

func DeletePeer

func DeletePeer(peerIp string) error

func GenerateRandomName

func GenerateRandomName(prefix string, size int) (string, error)

GenerateRandomName returns a new name joined with a prefix. This size specified is used to truncate the randomly generated value

func GetAvailableGwAddress

func GetAvailableGwAddress(bridgeIP string) (gwaddr string, err error)

func GetAvailableSubnet

func GetAvailableSubnet() (subnet *net.IPNet, err error)

func GetTableCache

func GetTableCache(tableName string) map[string]libovsdb.Row

func InitAgent

func InitAgent(d *Daemon) error

func MarkUsed

func MarkUsed(VNI string, addr net.IP, subnet net.IPNet) bool

Mark a specified ip as used, return true as success

func ReleaseIP

func ReleaseIP(addr net.IP, subnet net.IPNet, VNI string) bool

Release the given IP from the subnet of vlan

func RequestIP

func RequestIP(VNI string, subnet net.IPNet) net.IP

ipStore manage the cluster ip resource key is the vlan/subnet, value is the available ip address bytes Get an IP from the unused subnet and mark it as used

func ServeApi

func ServeApi(d *Daemon)

func UpdateConnectionContext

func UpdateConnectionContext(ovsPort string, key string, context string) error

func UpdatePortContext

func UpdatePortContext(ovsClient *libovsdb.OvsdbClient, portName string, key string, context string) error

Types

type BridgeConf

type BridgeConf struct {
	BridgeIP   string `json:"bridgeIP"`
	BridgeName string `json:"bridgeName"`
	BridgeCIDR string `json:"bridgeCIDR"`
	BridgeMTU  int    `json:"bridgeMTU"`
}

type Connection

type Connection struct {
	ContainerID      string        `json:"containerID"`
	ContainerName    string        `json:"containerName"`
	ContainerPID     string        `json:"containerPID"`
	RequestIp        string        `json:"requestIP,omitempty"`
	Network          string        `json:"network"`
	OvsPortID        string        `json:"ovsPortID"`
	BandWidth        string        `json:"bandWidth,omitempty"`
	Delay            string        `json:"delay,omitempty"`
	RXTotal          uint64        `json:"rxKbytes"` // in KB
	TXTotal          uint64        `json:"txKbytes"` // in KB
	RXRate           float64       `json:"rxRate"`   // in Kb/s
	TXRate           float64       `json:"txRate"`   // in Kb/s
	ConnectionDetail OvsConnection `json:"ovs_connectionDetails"`
}

type ConnectionCtx

type ConnectionCtx struct {
	Action     int
	Connection *Connection
	Result     chan *Connection
}

type Daemon

type Daemon struct {
	Gateways map[string]struct{} //network set
	// contains filtered or unexported fields
}

func NewDaemon

func NewDaemon() *Daemon

func (*Daemon) Run

func (d *Daemon) Run(ctx *cli.Context)

type HttpApiFunc

type HttpApiFunc func(d *Daemon, w http.ResponseWriter, r *http.Request) *HttpErr

type HttpErr

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

type Listener

type Listener struct{}

func (Listener) NotifyKeyUpdate

func (l Listener) NotifyKeyUpdate(nType netAgent.NotifyUpdateType, key string, data []byte)

func (Listener) NotifyNodeUpdate

func (l Listener) NotifyNodeUpdate(nType netAgent.NotifyUpdateType, nodeAddr string)

func (Listener) NotifyStoreUpdate

func (l Listener) NotifyStoreUpdate(nType netAgent.NotifyUpdateType, store string, data map[string][]byte)

type Network

type Network struct {
	Name    string `json:"name"`
	Subnet  string `json:"subnet"`
	Gateway string `json:"gateway"`
	VNI     uint   `json:"vni"`
}

func CreateDefaultNetwork

func CreateDefaultNetwork() (*Network, error)

func CreateNetwork

func CreateNetwork(name string, subnet *net.IPNet) (*Network, error)

func GetNetwork

func GetNetwork(name string) (*Network, error)

get the network detail of a given name

func GetNetworks

func GetNetworks() ([]Network, error)

type NodeCtx

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

type Notifier

type Notifier struct {
}

func (Notifier) Disconnected

func (n Notifier) Disconnected(ovsClient *libovsdb.OvsdbClient)

func (Notifier) Echo

func (n Notifier) Echo([]interface{})

func (Notifier) Locked

func (n Notifier) Locked([]interface{})

func (Notifier) Stolen

func (n Notifier) Stolen([]interface{})

func (Notifier) Update

func (n Notifier) Update(context interface{}, tableUpdates libovsdb.TableUpdates)

type OvsConnection

type OvsConnection struct {
	Name    string `json:"name"`
	Ip      string `json:"ip"`
	Subnet  string `json:"subnet"`
	Mac     string `json:"mac"`
	Gateway string `json:"gateway"`
}

type SafeMap

type SafeMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

concurrent-safe map

func NewSafeMap

func NewSafeMap() *SafeMap

func (*SafeMap) Check

func (m *SafeMap) Check(k string) bool

func (*SafeMap) Delete

func (m *SafeMap) Delete(k string)

func (*SafeMap) Get

func (m *SafeMap) Get(k string) interface{}

func (*SafeMap) Set

func (m *SafeMap) Set(k string, v interface{}) bool

returns false if k is already in the rm and v is same with the old value

Jump to

Keyboard shortcuts

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