gstate

package
v0.0.0-11-12-2015.00-5... Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2015 License: Apache-2.0 Imports: 8 Imported by: 14

Documentation

Index

Constants

View Source
const (
	VersionBeta1 = "0.01"
)

Version constants. Used in managing state variance.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoParams

type AutoParams struct {
	SubnetPool     string `json:"subnetPool"`
	SubnetLen      uint   `json:"subnetLen"`
	AllocSubnetLen uint   `json:"AllocSubnetLen"`
	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
	Version     string       `json:"version"`
	Tenant      string       `json:"tenant"`
	Auto        AutoParams   `json:"auto"`
	Deploy      DeployParams `json:"deploy"`
	NwInfraMode string       `json:"nw-infra-mode"`
}

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) AllocSubnet

func (gc *Cfg) AllocSubnet(ra core.ResourceManager) (string, error)

AllocSubnet allocates a new subnet. Returns a CIDR.

func (*Cfg) AllocVLAN

func (gc *Cfg) AllocVLAN(ra core.ResourceManager) (uint, error)

AllocVLAN allocates a new VLAN resource. Returns an ID.

func (*Cfg) AllocVXLAN

func (gc *Cfg) AllocVXLAN(ra core.ResourceManager) (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) Clear

func (gc *Cfg) Clear() error

Clear the state

func (*Cfg) Dump

func (gc *Cfg) Dump() error

Dump is a debugging utility.

func (*Cfg) FreeSubnet

func (gc *Cfg) FreeSubnet(ra core.ResourceManager, subnetIP string) error

FreeSubnet releases a subnet derived from it's CIDR.

func (*Cfg) FreeVLAN

func (gc *Cfg) FreeVLAN(ra core.ResourceManager, vlan uint) error

FreeVLAN releases a VLAN for a given ID.

func (*Cfg) FreeVXLAN

func (gc *Cfg) FreeVXLAN(ra core.ResourceManager, vxlan uint, localVLAN uint) error

FreeVXLAN returns a VXLAN id to the pool.

func (*Cfg) Process

func (gc *Cfg) Process(ra core.ResourceManager) error

Process validates, implements, and writes the state.

func (*Cfg) Read

func (gc *Cfg) Read(tenant 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) Write

func (gc *Cfg) Write() error

Write the state

type DeployParams

type DeployParams struct {
	DefaultNetType string `json:"defaultNetType"`
	DefaultNetwork string `json:"defaultNetwork"`
}

DeployParams specifies parameters that decides the deployment choices

type Oper

type Oper struct {
	core.CommonState
	Tenant          string `json:"tenant"`
	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(tenant 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