Documentation ¶
Index ¶
- Variables
- type ChassisLocation
- type Environment
- type IPReservation
- func (r *IPReservation) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (r *IPReservation) MarshalJSON() ([]byte, error)
- func (r *IPReservation) SetRandomIP() error
- func (r *IPReservation) SetSubnetInformation(subnet *Subnet)
- func (r *IPReservation) Static() bool
- func (r *IPReservation) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (r *IPReservation) UnmarshalJSON(data []byte) error
- func (r *IPReservation) ValidAt(t time.Time) bool
- func (r *IPReservation) Validate() bool
- type IPReservationDB
- type IPReservationList
- type IPReservationMap
- type InventoryNode
- type IpamIpRequest
- type Metadata
- type NICInfo
- type NICInfoMap
- type NICInstance
- type Network
- type NetworkDB
- type NetworkInterface
- type NetworkMap
- type NicConfig
- type Node
- type Subnet
- func (s Subnet) DynamicAllocationEnabled() bool
- func (s *Subnet) MarshalJSON() ([]byte, error)
- func (s Subnet) StaticAllocationEnabled() bool
- func (s Subnet) ToNet(ip net.IP) *net.IPNet
- func (n *Subnet) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
- func (s *Subnet) UnmarshalJSON(data []byte) error
- type SubnetList
- type System
- type SystemDB
- type SystemMap
- type Tags
Constants ¶
This section is empty.
Variables ¶
var (
ErrKeyNotSet = errors.New("no key set in object")
)
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 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) Dynamic ¶
func (l IPReservationList) Dynamic() IPReservationList
func (IPReservationList) Static ¶
func (l IPReservationList) Static() IPReservationList
func (IPReservationList) ValidAt ¶
func (l IPReservationList) ValidAt(t time.Time) IPReservationList
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 ¶
MarshalJSON marshals a NICInfo object, converting IP and MAC to strings
func (*NICInfo) UnmarshalJSON ¶
UnmarshalJSON unmarshals a NICInfo object, converting IP and MAC from strings
func (*NICInfo) UnmarshalYAML ¶
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) SetTimestamp ¶
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 ¶
func (NetworkMap) GetNetworkByID ¶
func (m NetworkMap) GetNetworkByID(id string) (*Network, error)
type NicConfig ¶
func NewNicConfig ¶
func NewNicConfig() *NicConfig
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 (*Node) SetTimestamp ¶
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 ¶
DynamicAllocationEnabled returns true if IP allocation is enabled for this subnet
func (*Subnet) MarshalJSON ¶
MarshalJSON implements the Marshaler Interface so that cidr is rendered as a string.
func (Subnet) StaticAllocationEnabled ¶
StaticAllocationEnabled returns true if IP allocation is enabled for this subnet
func (Subnet) ToNet ¶
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 ¶
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 (*System) SetTimestamp ¶
type Tags ¶
type Tags []string
func (*Tags) UnmarshalDynamoDBAttributeValue ¶
func (t *Tags) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error