virtualnetwork

package
v0.0.0-...-884d9dc Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AR

type AR struct {
	ID                string        `xml:"AR_ID,omitempty"`
	GlobalPrefix      string        `xml:"GLOBAL_PREFIX,omitempty"` // minOccurs=0
	IP                string        `xml:"IP"`                      // minOccurs=0
	MAC               string        `xml:"MAC,omitempty"`
	ParentNetworkARID string        `xml:"PARENT_NETWORK_AR_ID,omitempty"` // minOccurs=0
	Size              int           `xml:"SIZE"`
	Type              string        `xml:"TYPE"`
	ULAPrefix         string        `xml:"ULA_PREFIX,omitempty"` // minOccurs=0
	VNMAD             string        `xml:"VN_MAD,omitempty"`     // minOccurs=0
	MACEnd            string        `xml:"MAC_END,omitempty"`
	IPEnd             string        `xml:"IP_END,omitempty"`
	IP6ULA            string        `xml:"IP6_ULA,omitempty"`
	IP6ULAEnd         string        `xml:"IP6_ULA_END,omitempty"`
	IP6Global         string        `xml:"IP6_GLOBAL,omitempty"`
	IP6GlobalEnd      string        `xml:"IP6_GLOBAL_END,omitempty"`
	IP6               string        `xml:"IP6,omitempty"`
	IP6End            string        `xml:"IP6_END,omitempty"`
	UsedLeases        string        `xml:"USED_LEASES,omitempty"`
	Leases            []Lease       `xml:"LEASES>LEASE,omitempty"`
	Custom            dynamic.Pairs `xml:",any,omitempty"`

	// Not filled with Info
	Allocated string `xml:"ALLOCATED"`
}

type AddressRange

type AddressRange struct {
	dyn.Vector
}

AddressRange is a structure allowing to parse AddressRange templates. Common to VM and VRouter.

func NewAddressRange

func NewAddressRange() *AddressRange

NewAddressRange returns a structure disk entity to build

func (*AddressRange) Add

func (n *AddressRange) Add(key keys.AddressRange, value interface{})

Add adds an address range key, value pair.

func (*AddressRange) Get

func (n *AddressRange) Get(key keys.AddressRange) (string, error)

Get returns the string value for an address range keys

func (*AddressRange) GetI

func (n *AddressRange) GetI(key keys.AddressRange) (int, error)

GetI returns the integer value for an address range key

func (*AddressRange) ID

func (n *AddressRange) ID() (int, error)

ID returns the address range ID as an integer

type Lease

type Lease struct {
	IP        string `xml:"IP,omitempty"`
	IP6       string `xml:"IP6,omitempty"`
	IP6Global string `xml:"IP6GLOBAL,omitempty"`
	IP6Link   string `xml:"IP6LINK,omitempty"`
	IP6ULA    string `xml:"IP6ULA,omitempty"`
	MAC       string `xml:"MAC,omitempty"`
	VM        int    `xml:"VM,omitempty"`
	VNet      int    `xml:"VNET,omitempty"`
	VRouter   int    `xml:"VROUTER,omitempty"`
}

type Pool

type Pool struct {
	XMLName         xml.Name         `xml:"VNET_POOL"`
	VirtualNetworks []VirtualNetwork `xml:"VNET"`
}

Pool represents an OpenNebula VirtualNetwork pool

type State

type State int

State is the state of the Virtual Network

const (
	// Init Virtual Network is being initialized
	Init State = iota

	// Ready Virtual Network is ready to be used
	Ready

	// LockCreate Virtual Network driver vnet_create pending
	LockCreate

	// LockDelete Virtual Network driver vnet_delete pending
	LockDelete

	// Done Virtual Netowrk finalized
	Done

	// Error Virtual Network is in error state
	Error
)

func (State) String

func (s State) String() string

String returns the string version of the State

type Template

type Template struct {
	dyn.Template
}

Template is a virtual network template

func NewTemplate

func NewTemplate() *Template

NewTemplate returns a new virtual network Template object

func (*Template) Add

func (t *Template) Add(key keys.Template, value interface{})

Add adds a virtual network template key, value pair.

func (*Template) AddAddressRange

func (t *Template) AddAddressRange() *AddressRange

AddAR allow to add a AR to the template

func (*Template) Get

func (t *Template) Get(key keys.Template) (string, error)

Get returns the string value for a virtual network template

func (*Template) GetARs

func (t *Template) GetARs() []AddressRange

GetAR allow to retrieve ARs from template

func (*Template) GetI

func (n *Template) GetI(key keys.Template) (int, error)

GetI returns the integer value for an virtual network key

type VirtualNetwork

type VirtualNetwork struct {
	XMLName              xml.Name            `xml:"VNET"`
	ID                   int                 `xml:"ID,omitempty"`
	UID                  int                 `xml:"UID,omitempty"`
	GID                  int                 `xml:"GID,omitempty"`
	UName                string              `xml:"UNAME,omitempty"`
	GName                string              `xml:"GNAME,omitempty"`
	Name                 string              `xml:"NAME"`
	Permissions          *shared.Permissions `xml:"PERMISSIONS,omitempty"`
	Clusters             shared.EntitiesID   `xml:"CLUSTERS,omitempty"`
	Bridge               string              `xml:"BRIDGE,omitempty"`
	BridgeType           string              `xml:"BRIDGE_TYPE,omitempty"` // minOccurs=0
	ParentNetworkID      string              `xml:"PARENT_NETWORK_ID,omitempty"`
	StateRaw             int                 `xml:"STATE,omitempty"`
	VNMad                string              `xml:"VN_MAD"`
	PhyDev               string              `xml:"PHYDEV,omitempty"`
	VlanID               string              `xml:"VLAN_ID,omitempty"`       // minOccurs=0
	OuterVlanID          string              `xml:"OUTER_VLAN_ID,omitempty"` // minOccurs=0
	VlanIDAutomatic      string              `xml:"VLAN_ID_AUTOMATIC,omitempty,omitempty"`
	OuterVlanIDAutomatic string              `xml:"OUTER_VLAN_ID_AUTOMATIC,omitempty"`
	UsedLeases           int                 `xml:"USED_LEASES,omitempty"`
	VRouters             shared.EntitiesID   `xml:"VROUTERS,omitempty"`
	Template             Template            `xml:"TEMPLATE"`

	// Variable parts between one.vnpool.info and one.vn.info
	ARs  []AR         `xml:"AR_POOL>AR,omitempty"`
	Lock *shared.Lock `xml:"LOCK,omitempty"`
}

VirtualNetwork represents an OpenNebula VirtualNetwork

func (*VirtualNetwork) State

func (vn *VirtualNetwork) State() (State, error)

State looks up the state of the Virtual Network and returns the State

func (*VirtualNetwork) StateString

func (vn *VirtualNetwork) StateString() (string, error)

StateString returns the state in string format

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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