hw

package
Version: v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gb

func Gb(value uint64) uint64

func Gbps

func Gbps(value uint64) uint64

func Mb

func Mb(value uint64) uint64

func Mbps

func Mbps(value uint64) uint64

func Mhz

func Mhz(value uint64) uint64

Types

type Base

type Base struct {
	Manufacturer string   `json:"manufacturer"`
	Model        string   `json:"model"`
	Tags         []string `json:"tags"`
}

func (*Base) Tag

func (b *Base) Tag(tags ...string)

type Cable

type Cable struct {
	Base
	Kind       CableKind
	Connectors [2][]*Connector
	Length     uint64 //meters
	Props      xir.Props
}

func GenericCable

func GenericCable(capacity uint64) *Cable

func (*Cable) Connect

func (t *Cable) Connect(a, b *Port)

Connect a simple straight cable. Breakouts require more detailed attention.

func (c *Cable) Link() *xir.Link

type CableKind

type CableKind uint16
const (
	UnspecCable CableKind = iota
	Cat5
	Cat5e
	Cat6
	DAC
	FiberLC
	FiberMPOTrunk
	FiberMPOBreakout
)

type Connector

type Connector struct {
	Base
	Kind     ConnectorKind
	Protocol Layer1
	Capacity uint64

	Port *Port `json:"-" yaml:"-"`
}

func (*Connector) Connect

func (c *Connector) Connect(p *Port)

type ConnectorKind

type ConnectorKind uint16
const (
	UnspecConnector ConnectorKind = iota
	RJ45
	SFP
	QSFP
	SFPP
	QSFPP
	SFP28
	QSFP28
	CXP
	LC
	MPO
)

type Device

type Device struct {
	Base
	Procs  []Proc
	Memory []Dimm
	Nics   []Nic
	Usbs   []Usb
	Ttys   []Tty
}

func GenericServer

func GenericServer(ports int, portSpeed uint64) *Device

func GenericSwitch

func GenericSwitch(radix int, portSpeed uint64) *Device

func (*Device) Node

func (d *Device) Node(id string) *xir.Node

type Dimm

type Dimm struct {
	Capacity uint64 `json:"capacity"`
}

type ISA

type ISA uint
const (
	X86_64 ISA = iota
)

type Layer1

type Layer1 uint

Layer 1 (physical) protocol

const (
	UnspecProtocol Layer1 = iota

	// 100 mbps
	Base100T

	// 1 gbps
	Base1000T
	Base1000X
	Base1000CX
	Base1000SX
	Base1000LX
	Base1000LX10
	Base1000EX
	Base1000BX10
	Base1000ZX

	// 10 gbps
	GBase10T
	GBase10CR
	GBase10SR
	GBase10LR
	GBase10LRM
	GBase10ER
	GBase10ZR
	GBase10LX4
	GBase10PR

	// 25 gbps
	GBase25CR
	GBase25SR
	GBase25LR
	GBase25ER

	// 40 gbps
	GBase40CR4
	GBase40SR4
	GBase40LR4
	GBase40ER4

	// 100 gbps
	GBase100CR4
	GBase100SR4
	GBase100SR10
	GBase100LR4
	GBase100ER4

	// Console
	RS232
	Uart
)

type Nic

type Nic struct {
	Base
	Ports []*Port `json:"ports"`
	Kind  string  `json:"kind"`
}

func (*Nic) GetKind

func (n *Nic) GetKind() string

type Port

type Port struct {
	Protocol  Layer1     `json:"protocol"`
	Capacity  uint64     `json:"capacity"` //bits per second
	Mac       string     `json:"capacity"`
	Connector *Connector `json:"connector"`

	Endpoint *xir.Endpoint `json:"-"`
}

type Proc

type Proc struct {
	Base
	ISA           ISA    `json:"isa"`
	Family        string `json:"family"`
	BaseFrequency uint64 `json:"basefrequency:`
	L2            uint64 `json:"l2"`
	Cores         uint64 `json:"cores"`
	Threads       uint   `json:"threads"`
	Tdp           uint   `json:"tdp"`
}

type Tty

type Tty struct {
	Port *Port `json:"port"`
}

type Usb

type Usb struct {
	Version UsbVersion `json:"version"`
}

type UsbVersion

type UsbVersion float32
const (
	USB1  UsbVersion = 1.0
	USB11 UsbVersion = 1.1
	USB20 UsbVersion = 2.0
	USB21 UsbVersion = 2.1
	USB30 UsbVersion = 3.0
	USB31 UsbVersion = 3.1
)

Jump to

Keyboard shortcuts

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