types

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: GPL-2.0-or-later Imports: 12 Imported by: 6 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotSet = errors.New("no key set in object")
)
View Source
var ErrLogicalNetworkNotFound = errors.New("Network Not Found")

ErrLogicalNetworkNotFound returned when a logical <-> physical network mapping doesn't exist

Functions

This section is empty.

Types

type ChassisLocation

type ChassisLocation struct {
	Building string
	Room     string
	Rack     string
	BottomU  uint
}

type Environment

type Environment struct {
	IPXEUrl  string
	Networks map[string]string
	Metadata map[string]interface{} `json:",omitempty"`
}

Environment holds ipxe configuration as well as a mapping between logical and physical networks.

func (*Environment) LookupLogicalNetworkName

func (e *Environment) LookupLogicalNetworkName(physicalName string) (string, error)

LookupLogicalNetworkName finds the logical network name associated with the physical network name provided

type IPReservation

type IPReservation struct {
	HostInformation string
	IP              *net.IPNet       `json:"ip"`
	MAC             net.HardwareAddr `json:"mac"`
	Gateway         net.IP           `json:"gateway"`
	DNS             []net.IP         `json:"dns"`
	Start           *time.Time       `json:"start"`
	End             *time.Time       `json:"end"`
	Metadata        Metadata         `json:"metadata"`
}

func NewDynamicIPReservation

func NewDynamicIPReservation(ttl time.Duration) *IPReservation

func NewStaticIPReservation

func NewStaticIPReservation() *IPReservation

func (*IPReservation) MarshalDynamoDBAttributeValue

func (r *IPReservation) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

func (*IPReservation) MarshalJSON

func (r *IPReservation) MarshalJSON() ([]byte, error)

func (*IPReservation) SetRandomIP

func (r *IPReservation) SetRandomIP() error

func (*IPReservation) SetSubnetInformation

func (r *IPReservation) SetSubnetInformation(subnet *Subnet)

func (*IPReservation) Static

func (r *IPReservation) Static() bool

func (*IPReservation) UnmarshalDynamoDBAttributeValue

func (r *IPReservation) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

func (*IPReservation) UnmarshalJSON

func (r *IPReservation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements Unmarshaler interface so that cidr can be directly read from a string

func (*IPReservation) ValidAt

func (r *IPReservation) ValidAt(t time.Time) bool

ValidAt returns true if an IPReservation is valid at the time specified

func (*IPReservation) Validate

func (r *IPReservation) Validate() bool

Validate checks that the reservation is internally consistent and fully populated

type IPReservationDB

type IPReservationDB interface {
	GetIPReservationsByMac(net.HardwareAddr) (IPReservationList, error)
}

type IPReservationList

type IPReservationList []*IPReservation

func (IPReservationList) Contains

func (l IPReservationList) Contains(ip net.IP) bool

func (IPReservationList) Dynamic

func (IPReservationList) Static

func (IPReservationList) ValidAt

type IPReservationMap

type IPReservationMap map[string]IPReservationList

func (IPReservationMap) Add

func (m IPReservationMap) Add(reservation *IPReservation)

func (IPReservationMap) GetIPReservationsByMac

func (m IPReservationMap) GetIPReservationsByMac(mac net.HardwareAddr) (IPReservationList, error)

type InventoryNode

type InventoryNode struct {
	Hostname        string
	LocationString  string
	InventoryID     string
	Tags            []string
	Networks        map[string]*NICInstance
	Role            string
	Location        *ChassisLocation
	ChassisSubIndex string
	System          *System
	Environment     *Environment
	Metadata        Metadata
	LastUpdated     time.Time
	// contains filtered or unexported fields
}

func NewInventoryNode

func NewInventoryNode(node *Node, networkDB NetworkDB, systemDB SystemDB, ipReservationDB IPReservationDB) (*InventoryNode, error)

func (*InventoryNode) ID

func (i *InventoryNode) ID() string

func (*InventoryNode) IPs

func (i *InventoryNode) IPs() []net.IP

IPs returns a slice containing all non-nil IPs assigned to the node

func (*InventoryNode) Timestamp

func (i *InventoryNode) Timestamp() int64

type IpamIpRequest

type IpamIpRequest struct {
	Subnet    string   `json:"subnet"`
	HwAddress string   `json:"mac"`
	TTL       string   `json:"ttl"`
	Metadata  Metadata `json:"metadata"`
}

func (*IpamIpRequest) Reservation

func (req *IpamIpRequest) Reservation(ip net.IP) (*IPReservation, error)

type Metadata

type Metadata map[string]interface{}

func (*Metadata) UnmarshalDynamoDBAttributeValue

func (m *Metadata) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

type NICInfo

type NICInfo struct {
	MAC net.HardwareAddr
	IP  net.IP
}

NICInfo describes a network interface

func (*NICInfo) MarshalJSON

func (n *NICInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals a NICInfo object, converting IP and MAC to strings

func (*NICInfo) UnmarshalJSON

func (n *NICInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a NICInfo object, converting IP and MAC from strings

func (*NICInfo) UnmarshalYAML

func (n *NICInfo) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals a NICInfo object, converting IP and MAC from strings

type NICInfoMap

type NICInfoMap map[string]*NetworkInterface

func (*NICInfoMap) UnmarshalDynamoDBAttributeValue

func (n *NICInfoMap) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

type NICInstance

type NICInstance struct {
	Network   Network
	Interface NetworkInterface
	Config    NicConfig
}

type Network

type Network struct {
	Name        string
	MTU         uint
	Subnets     SubnetList
	Domain      string
	Metadata    Metadata
	LastUpdated time.Time
}

func NewNetwork

func NewNetwork() *Network

func (*Network) GetNicConfig

func (n *Network) GetNicConfig(reservations IPReservationList) *NicConfig

GetNicConfig builds a NicConfig object fo the specified interface on this network

func (*Network) GetSubnetContainingIP

func (n *Network) GetSubnetContainingIP(ip net.IP) *Subnet

func (*Network) ID

func (n *Network) ID() string

func (*Network) SetTimestamp

func (n *Network) SetTimestamp(timestamp time.Time)

func (*Network) Timestamp

func (n *Network) Timestamp() int64

type NetworkDB

type NetworkDB interface {
	GetNetworkByID(string) (*Network, error)
}

type NetworkInterface

type NetworkInterface struct {
	NICs     []net.HardwareAddr `json:"-" dynamodbav:"nics"`
	Metadata Metadata
}

func (*NetworkInterface) MarshalJSON

func (n *NetworkInterface) MarshalJSON() ([]byte, error)

MarshalJSON marshals a NICInfo object, converting IP and MAC to strings

func (*NetworkInterface) UnmarshalDynamoDBAttributeValue

func (n *NetworkInterface) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

func (*NetworkInterface) UnmarshalJSON

func (n *NetworkInterface) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a NICInfo object, converting IP and MAC from strings

type NetworkMap

type NetworkMap map[string]*Network

func (NetworkMap) GetNetworkByID

func (m NetworkMap) GetNetworkByID(id string) (*Network, error)

type NicConfig

type NicConfig struct {
	IP      []string
	Gateway []string
	DNS     []string
}

func NewNicConfig

func NewNicConfig() *NicConfig

func (*NicConfig) Append

func (c *NicConfig) Append(ip net.IPNet, dns []net.IP, gateway *net.IP)

type Node

type Node struct {
	InventoryID string
	*ChassisLocation
	ChassisSubIndex string
	Tags            Tags
	Networks        NICInfoMap
	Role            string
	Environment     string
	System          string
	Metadata        Metadata
	LastUpdated     time.Time
}

func NewNode

func NewNode() *Node

func (*Node) Hostname

func (n *Node) Hostname() string

func (*Node) ID

func (n *Node) ID() string

func (*Node) Location

func (n *Node) Location() string

func (*Node) NumericId

func (n *Node) NumericId() (int, error)

func (*Node) SetTimestamp

func (n *Node) SetTimestamp(timestamp time.Time)

func (*Node) Timestamp

func (n *Node) Timestamp() int64

type Subnet

type Subnet struct {
	Name                    string
	Cidr                    *net.IPNet
	Gateway                 net.IP
	DNS                     []net.IP
	StaticAllocationMethod  string
	DynamicAllocationMethod string
}

Subnet stores information about an IP subnet

func (Subnet) DynamicAllocationEnabled

func (s Subnet) DynamicAllocationEnabled() bool

DynamicAllocationEnabled returns true if IP allocation is enabled for this subnet

func (*Subnet) MarshalJSON

func (s *Subnet) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler Interface so that cidr is rendered as a string.

func (Subnet) StaticAllocationEnabled

func (s Subnet) StaticAllocationEnabled() bool

StaticAllocationEnabled returns true if IP allocation is enabled for this subnet

func (Subnet) ToNet

func (s Subnet) ToNet(ip net.IP) *net.IPNet

ToNet creates an IPNet object from the supplied ip with the Cidr mask for this subnet

func (*Subnet) UnmarshalDynamoDBAttributeValue

func (n *Subnet) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

func (*Subnet) UnmarshalJSON

func (s *Subnet) UnmarshalJSON(data []byte) error

UnmarshalJSON implements Unmarshaler interface so that cidr can be directly read from a string

type SubnetList

type SubnetList []*Subnet

func (*SubnetList) UnmarshalDynamoDBAttributeValue

func (n *SubnetList) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

type System

type System struct {
	Name         string
	ShortName    string
	Environments map[string]*Environment
	Roles        []string
	Metadata     Metadata
	LastUpdated  time.Time
}

func NewSystem

func NewSystem() *System

func (*System) ID

func (s *System) ID() string

func (*System) SetTimestamp

func (s *System) SetTimestamp(timestamp time.Time)

func (*System) Timestamp

func (s *System) Timestamp() int64

type SystemDB

type SystemDB interface {
	GetSystemByID(string) (*System, error)
}

type SystemMap

type SystemMap map[string]*System

func (SystemMap) GetSystemByID

func (m SystemMap) GetSystemByID(id string) (*System, error)

type Tags

type Tags []string

func (*Tags) UnmarshalDynamoDBAttributeValue

func (t *Tags) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error

Jump to

Keyboard shortcuts

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