lldp

package
v0.0.0-...-a124909 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package lldp provide lldp data structre and endpoint data collection implementations

Index

Constants

This section is empty.

Variables

View Source
var (
	// OIDChassisID is exact OID to get switch ChassisId
	OIDChassisID = "1.0.8802.1.1.2.1.3.2.0"
	// OIDName is exact OID to get switch Name
	OIDName = "1.0.8802.1.1.2.1.3.3.0"
	// OIDDescription is exact OID to get switch Description
	OIDDescription = "1.0.8802.1.1.2.1.3.4.0"
	// OIDLocalPortTableNumber is root OID to get a subtree of port number
	OIDLocalPortTableNumber = "1.0.8802.1.1.2.1.3.7.1.1"
	// OIDLocalPortTableID is root OID to get a subtree of port id
	OIDLocalPortTableID = "1.0.8802.1.1.2.1.3.7.1.3"
	// OIDLocalPortTableDesc is root OID to get a subtree of port description
	OIDLocalPortTableDesc = "1.0.8802.1.1.2.1.3.7.1.4"
)

Functions

This section is empty.

Types

type Endpoint

type Endpoint interface {
	Start() (chan *Snapshot, chan error)
	Stop() error
}

Endpoint is the abtraction of a LLDP endpoint Typically it is a SNMP agent

func NewDefaultSNMPEndpoint

func NewDefaultSNMPEndpoint(addr string) Endpoint

NewDefaultSNMPEndpoint create SNMPEndpiont with default configurations

func NewSNMPEndpoint

func NewSNMPEndpoint(ep *SNMPEndpoint) Endpoint

NewSNMPEndpoint create SNMPEndpiont with provided configurations

type LocalSystemData

type LocalSystemData struct {
	ChassisID   string
	Name        string
	Description string
	PortTable   []PortTableEntry
}

LocalSystemData is the local lldp data structure

type PortTableEntry

type PortTableEntry struct {
	Number      int
	ID          string
	Description string
}

PortTableEntry is the porttable entry data structure

type SNMPEndpoint

type SNMPEndpoint struct {
	Address string
	Port    uint16
	// sleep time interval after collecting data from endpoint
	Interval  time.Duration
	Community string
	// SNMP version used, import "github.com/soniah/gosnmp" type SnmpVersion
	// default v2c
	Version gosnmp.SnmpVersion
	Timeout time.Duration
	Retries int
	MaxOids int
	// contains filtered or unexported fields
}

SNMPEndpoint is an LLDP endpoint using SNMP

func (*SNMPEndpoint) Start

func (s *SNMPEndpoint) Start() (chan *Snapshot, chan error)

Start SNMPEndpoint collecting data snapshots

func (*SNMPEndpoint) Stop

func (s *SNMPEndpoint) Stop() error

Stop the SNMPEndpoint

type Snapshot

type Snapshot struct {
	Local LocalSystemData
}

Snapshot represents the data snapshot gatherred from a LLDP endpoint

Jump to

Keyboard shortcuts

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