gstate

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalMutex sync.Mutex

GlobalMutex used to syncronize global configuration changes

Functions

This section is empty.

Types

type AutoParams

type AutoParams struct {
	VLANs  string `json:"VLANs"`
	VXLANs string `json:"VXLANs"`
}

AutoParams specifies various parameters for the auto allocation and resource management for networks and endpoints. This allows for hands-free allocation of resources without having to specify these each time these constructs gets created.

type Cfg

type Cfg struct {
	core.CommonState
	Auto AutoParams `json:"auto"`
}

Cfg is the configuration of a tenant.

func Parse

func Parse(configBytes []byte) (*Cfg, error)

Parse parses a JSON config into a *gstate.Cfg.

func (*Cfg) AllocVLAN

func (gc *Cfg) AllocVLAN(reqVlan uint) (uint, error)

AllocVLAN allocates a new VLAN resource. Returns an ID.

func (*Cfg) AllocVXLAN

func (gc *Cfg) AllocVXLAN(reqVxlan uint) (vxlan uint, localVLAN uint, err error)

AllocVXLAN allocates a new vxlan; ids for both the vxlan and vlan are returned.

func (*Cfg) AssignDefaultNetwork

func (gc *Cfg) AssignDefaultNetwork(networkName string) (string, error)

AssignDefaultNetwork assigns a default network for a tenant based on the configuration in case configuration is absent it uses the provided network name to be the default network. It records the default network in oper state (derived or configured)

func (*Cfg) CheckInBitRange

func (gc *Cfg) CheckInBitRange(ranges, inUse, pktTagType string) bool

CheckInBitRange to check if range includes inuse vlans

func (*Cfg) Clear

func (gc *Cfg) Clear() error

Clear the state

func (*Cfg) DeleteResources

func (gc *Cfg) DeleteResources(res string) error

DeleteResources deletes associated resources

func (*Cfg) Dump

func (gc *Cfg) Dump() error

Dump is a debugging utility.

func (*Cfg) FreeVLAN

func (gc *Cfg) FreeVLAN(vlan uint) error

FreeVLAN releases a VLAN for a given ID.

func (*Cfg) FreeVXLAN

func (gc *Cfg) FreeVXLAN(vxlan uint, localVLAN uint) error

FreeVXLAN returns a VXLAN id to the pool.

func (*Cfg) GetVlansInUse

func (gc *Cfg) GetVlansInUse() (uint, string)

GetVlansInUse gets the vlans that are currently in use

func (*Cfg) GetVxlansInUse

func (gc *Cfg) GetVxlansInUse() (uint, string)

GetVxlansInUse gets the vlans that are currently in use

func (*Cfg) Process

func (gc *Cfg) Process(res string) error

Process validates, implements, and writes the state.

func (*Cfg) Read

func (gc *Cfg) Read(dummy string) error

Read the state

func (*Cfg) ReadAll

func (gc *Cfg) ReadAll() ([]core.State, error)

ReadAll global config state

func (*Cfg) UnassignNetwork

func (gc *Cfg) UnassignNetwork(networkName string) error

UnassignNetwork clears the oper state w.r.t. default network name

func (*Cfg) UpdateResources

func (gc *Cfg) UpdateResources(res string) error

UpdateResources deletes associated resources

func (*Cfg) Write

func (gc *Cfg) Write() error

Write the state

type Oper

type Oper struct {
	core.CommonState
	DefaultNetwork  string `json:"defaultNetwork"`
	FreeVXLANsStart uint   `json:"freeVXLANsStart"`
}

Oper encapsulates operations on a tenant.

func (*Oper) Clear

func (g *Oper) Clear() error

Clear the state.

func (*Oper) Read

func (g *Oper) Read(dummy string) error

Read the state

func (*Oper) ReadAll

func (g *Oper) ReadAll() ([]core.State, error)

ReadAll the global oper state

func (*Oper) Write

func (g *Oper) Write() error

Write the state

Jump to

Keyboard shortcuts

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