model

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cable

type Cable struct {
	AEnd CableEnd
	BEnd CableEnd
}

func (Cable) String

func (c Cable) String() string

func (*Cable) ToProto

func (c *Cable) ToProto() *octopuspb.Cable

type CableEnd

type CableEnd struct {
	DeviceName   string
	EndpointName string
	EndpointType octopuspb.CableEndpointType
}

type Circuit

type Circuit struct {
	CID      string
	Provider string
	Type     string
	Status   string
	MetaData *MetaData
}

func NewCircuit

func NewCircuit(CID string, provider string, cType string, status string) *Circuit

func (*Circuit) ToProto

func (c *Circuit) ToProto() *octopuspb.Circuit

type Colo

type Colo struct {
	Id        uint16
	Name      string
	Status    string
	Region    string
	Tier      uint8
	Animal    string
	IsMCP     bool
	IsFedramp bool
	Pop       *Pop
	Sites     []*Site
}

func NewColo

func NewColo(id uint16, name string, pop *Pop) *Colo

func (*Colo) ToProto

func (c *Colo) ToProto() *octopuspb.Colo

type Device

type Device struct {
	Name       string
	Status     string
	Role       string
	Platform   string
	DeviceType string

	Colo *Colo
	Site *Site

	Interfaces map[string]*Interface
	FrontPorts map[string]*FrontPort
	RearPorts  map[string]*RearPort

	MetaData *MetaData
}

func NewDevice

func NewDevice(name string) *Device

func (*Device) AddInterfaceItNotExists

func (d *Device) AddInterfaceItNotExists(ifName string) *Interface

func (*Device) GetInterface

func (d *Device) GetInterface(ifName string) *Interface

func (*Device) ToProto

func (d *Device) ToProto() *octopuspb.Device

type FrontPort

type FrontPort struct {
	Name             string
	RearPort         string
	RearPortPosition uint32
}

func (*FrontPort) ToProto

func (fp *FrontPort) ToProto() *octopuspb.FrontPort

type IP

type IP struct {
	Address  bnet.Prefix
	MetaData *MetaData
}

Our IP data type which will get more attributes in the future

func NewIP

func NewIP(ip bnet.Prefix) IP

func (*IP) ToProto

func (ip *IP) ToProto() *octopuspb.IPAddress

type Interface

type Interface struct {
	Name        string
	Type        string
	LAGMemberOf string
	Units       map[VLANTag]*InterfaceUnit
	MetaData    *MetaData
}

func (*Interface) AddIPAddressIfNotExists

func (iface *Interface) AddIPAddressIfNotExists(vlanTag VLANTag, newIP IP)

func (*Interface) AddUnitIfNotExists

func (iface *Interface) AddUnitIfNotExists(vlanTag VLANTag) *InterfaceUnit

func (*Interface) ToProto

func (iface *Interface) ToProto() *octopuspb.Interface

type InterfaceUnit

type InterfaceUnit struct {
	VLANTag
	ID            uint32
	IPv4Addresses []IP
	IPv6Addresses []IP
	MetaData      *MetaData
}

func (*InterfaceUnit) ToProto

func (unit *InterfaceUnit) ToProto() *octopuspb.InterfaceUnit

type MetaData

type MetaData struct {
	Tags            []string
	SemanticTags    map[string]string
	CustomFieldData string
}

func NewMetaData

func NewMetaData() *MetaData

func (*MetaData) ToProto

func (m *MetaData) ToProto() *octopuspb.MetaData

type Pop

type Pop struct {
	Name  string
	Colos []*Colo
}

func NewPop

func NewPop(name string) *Pop

func (*Pop) ToProto

func (p *Pop) ToProto() *octopuspb.Pop

type Prefix

type Prefix struct {
	Prefix   bnet.Prefix
	Tags     []string
	MetaData *MetaData
}

func NewPrefix

func NewPrefix(pfx bnet.Prefix) *Prefix

func (*Prefix) ToProto

func (p *Prefix) ToProto() *octopuspb.Prefix

type RearPort

type RearPort struct {
	Name      string
	Positions int16
}

func (*RearPort) ToProto

func (rp *RearPort) ToProto() *octopuspb.RearPort

type Site

type Site struct {
	Name  string
	Colos []*Colo
}

func NewSite

func NewSite(name string) *Site

func (*Site) ToProto

func (s *Site) ToProto() *octopuspb.Site

type Topology

type Topology struct {
	Timestamp time.Time

	Sites                map[string]*Site
	Pops                 map[string]*Pop
	Colos                map[uint16]*Colo
	Nodes                map[string]*Device
	Interfaces           map[int64]*Interface
	DevicesByInterfaceID map[int64]*Device
	Cables               map[string]*Cable
	Prefixes             map[int64]*Prefix
	Circuits             map[string]*Circuit
}

func NewTopology

func NewTopology() *Topology

func (*Topology) AddColoIfNotExists

func (t *Topology) AddColoIfNotExists(id uint16, name string, popName string) *Colo

func (*Topology) AddDeviceIfNotExists

func (t *Topology) AddDeviceIfNotExists(name string) *Device

GetAddDevice will return the pointer to the Device with the given name. If no device with that name currently exists, it will be created.

func (*Topology) AddPopIfNotExists

func (t *Topology) AddPopIfNotExists(name string) *Pop

func (*Topology) AddSiteIfNotExists

func (t *Topology) AddSiteIfNotExists(name string) *Site

func (*Topology) DeviceAndInterfaceExists

func (t *Topology) DeviceAndInterfaceExists(devName string, ifName string) error

func (*Topology) FindInterfaceUnitByMetaDataAndRole

func (t *Topology) FindInterfaceUnitByMetaDataAndRole(key string, value string, role string) []*InterfaceUnit

func (*Topology) GetColo

func (t *Topology) GetColo(id uint16) *Colo

func (*Topology) GetDevice

func (t *Topology) GetDevice(name string) *Device

func (*Topology) ToProto

func (t *Topology) ToProto() *octopuspb.Topology

type VLANTag

type VLANTag struct {
	OuterTag uint16
	InnerTag uint16
}

func NewVLANTag

func NewVLANTag(outerTag, innerTag uint16) VLANTag

Jump to

Keyboard shortcuts

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