utils

package
v0.0.0-...-8dd92da Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EtcdNameStr is a string constant for etcd state-store
	EtcdNameStr = "etcd"
	// ConsulNameStr is a string constant for consul state-store
	ConsulNameStr = "consul"
	// OvsNameStr is a string constant for ovs driver
	OvsNameStr = "ovs"
	// VppNameStr is a string constant for vpp driver
	VppNameStr = "vpp"
)

Variables

View Source
var (
	// DefaultHTTPHost Default HTTP Host
	DefaultHTTPHost = "localhost"
	// DefaultHTTPPort Default HTTP Port
	DefaultHTTPPort = 2375
	// DefaultUnixSocket Path for the unix socket.
	DefaultUnixSocket = "/var/run/docker.sock"
)

Functions

func BuildDBFlags

func BuildDBFlags(binary string) []cli.Flag

BuildDBFlags CLI storage flags for given binary

func BuildLogFlags

func BuildLogFlags(binary string) []cli.Flag

BuildLogFlags CLI logging flags for given binary

func BuildNetworkFlags

func BuildNetworkFlags(binary string) []cli.Flag

BuildNetworkFlags CLI networking flags for given binary

func FetchSysAttrs

func FetchSysAttrs() error

FetchSysAttrs would read the system attributes and store them in the exported vars for the plugin to use; some of the attributes may need OS spefici methods to fetch, thus the first attribute to fetch is the OS type

func FlattenFlags

func FlattenFlags(flagSlices ...[]cli.Flag) []cli.Flag

FlattenFlags concatenate slices of flags into one slice

func GetDockerClient

func GetDockerClient() (*dockerclient.Client, error)

GetDockerClient returns a new Docker Client based on the environment settings

func GetEndpoint

func GetEndpoint(epID string) (*drivers.OperEndpointState, error)

GetEndpoint is a utility that reads the EP oper state

func GetNetwork

func GetNetwork(networkID string) (*mastercfg.CfgNetworkState, error)

GetNetwork is a utility that reads the n/w oper state

func GetStateDriver

func GetStateDriver() (core.StateDriver, error)

GetStateDriver returns the singleton instance of the state-driver

func HTTPDel

func HTTPDel(url string) error

HTTPDel performs http DELETE operation

func HTTPPost

func HTTPPost(url string, req interface{}, resp interface{}) error

HTTPPost performs http POST operation

func InitLogging

func InitLogging(binary string, ctx *cli.Context) error

InitLogging initiates logging from CLI options

func ListenWrapper

func ListenWrapper(l net.Listener) net.Listener

ListenWrapper is a wrapper over net.Listener

func MakeHTTPHandler

func MakeHTTPHandler(handlerFunc httpAPIFunc) http.HandlerFunc

MakeHTTPHandler is a simple Wrapper for http handlers

func NewNetworkDriver

func NewNetworkDriver(name string, instInfo *core.InstanceInfo) (core.NetworkDriver, error)

NewNetworkDriver instantiates a 'named' network-driver with specified configuration

func NewStateDriver

func NewStateDriver(name string, instInfo *core.InstanceInfo) (core.StateDriver, error)

NewStateDriver instantiates a 'named' state-driver with specified configuration

func ReleaseStateDriver

func ReleaseStateDriver()

ReleaseStateDriver releases the singleton instance of the state-driver

func UnknownAction

func UnknownAction(w http.ResponseWriter, r *http.Request)

UnknownAction is a catchall handler for additional driver functions

Types

type DBConfigs

type DBConfigs struct {
	StoreDriver string
	StoreURL    string
}

DBConfigs validated db configs

func ValidateDBOptions

func ValidateDBOptions(binary string, ctx *cli.Context) (*DBConfigs, error)

ValidateDBOptions returns error if db options are not valid

type LLDPNeighbor

type LLDPNeighbor struct {
	SystemName        string
	SystemDescription string
	PortID            string
	PortDesc          string
	CiscoACIPodID     string
	CiscoACINodeID    string
}

LLDPNeighbor lists the neighbor attributes as learned by the host

type NetworkConfigs

type NetworkConfigs struct {
	Mode        string
	NetworkMode string
	ForwardMode string
}

NetworkConfigs validated net configs

func ValidateNetworkOptions

func ValidateNetworkOptions(binary string, ctx *cli.Context) (*NetworkConfigs, error)

ValidateNetworkOptions returns error if network options are not valid

type SystemAttributes

type SystemAttributes struct {
	OsType      string
	TotalRAM    int
	TotalDiskGB int
	TotalNetBw  int
}

SystemAttributes enlist the system specific attributes and are read upon the system start

var SysAttrs SystemAttributes

SysAttrs are the exported system attributes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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