interfaces

package
v0.0.0-...-4bc4564 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ManagedEntityIdAttributeName = "ManagedEntityId"

Variables

This section is empty.

Functions

func GetAllAttributesExceptCounters

func GetAllAttributesExceptCounters(attributes me.AttributeValueMap, attrDef me.AttributeDefinitionMap) me.AttributeValueMap

func GetNewAndModifiedWriteAttributes

func GetNewAndModifiedWriteAttributes(newValues me.AttributeValueMap, existing me.AttributeValueMap, attrDef me.AttributeDefinitionMap) me.AttributeValueMap

func GetNumCounterAttributes

func GetNumCounterAttributes(attributes *me.AttributeDefinitionMap) int

func GetReadAttributes

func GetReadAttributes(m *me.ManagedEntity, existing me.AttributeValueMap) (me.AttributeValueMap, mapset.Set)

func LoadPmIndexMap

func LoadPmIndexMap(indexMap map[string]uint, attrDefs me.AttributeDefinitionMap)

LoadPmIndexMap will load a map that relates the counter/gauge name (key) to the attribute index (1..16). These maps are used to simplify incrementer functions for statistics.

Types

type ErrorCode

type ErrorCode common.ErrorCode

Define PON error codes

const (
	// ErrorUnknown is the default value
	ErrorUnknown ErrorCode = iota

	// ErrorPonUnknownStartupPattern is an error returned when requesting a
	// PON startup generator with an statup pattern
	ErrorPonUnknownStartupPattern

	// ErrorOnuUnknownStartupPattern is an error returned when requesting a
	// ONU startup generator with an statup pattern
	ErrorOnuUnknownStartupPattern
)

func (ErrorCode) String

func (e ErrorCode) String() string

type IBridge

type IBridge interface {
	GetExtendedStatistics(me.ClassID, uint16) *Statistics
	SetExtendedStatistics(me.ClassID, *Statistics) me.OmciErrors
}

type IBridgeManager

type IBridgeManager interface {
	GetBridgeService(uint16) IBridge
	GetBridgePort(uint16) IBridgePort
}

type IBridgePort

type IBridgePort interface {
	GetExtendedStatistics(me.ClassID, uint16) *Statistics
	SetExtendedStatistics(me.ClassID, *Statistics) me.OmciErrors
}

type ICommon

type ICommon interface {
	// Parent returns the next higher layer ICommon entity
	Parent() ICommon

	// ID returns the unique ID for this entity. This ID is only unique
	// among common types
	ID() uint

	// Name or serial number of entity
	Name() string

	IsEnabled() bool

	Configuration() interface{}

	AddTimers(timer *time.Timer)

	Input() chan<- interface{}

	State() fsm.State
}

ICommon provides an interface that PON and ONU structs can follow and is used to keep from having a circular import of pon/onu go packages

type IMib

type IMib interface {
	Set(me.ClassID, uint16, me.AttributeValueMap, ...bool) me.OmciErrors
	// TODO: Move back to just errors returned or 'nil' on no error to make processing simpler
	SetAttribute(me.ClassID, uint16, string, interface{}) error
	Delete(me.ClassID, uint16) error
	QueryClass(me.ClassID) (map[uint16]MeDbInstance, error)
	QueryInstance(me.ClassID, uint16) (*MeDbEntry, error)

	// Special Allocation routines
	AllocateTCont() (uint16, error)
	ReleaseTCont(uint16) error
	GetFreeTContAllocID() uint16
}

IMib implements the MIB database

type IOltOmciEndpoint

type IOltOmciEndpoint interface {
	RxOmci() chan *omci_pb.OmciResponse
	RxPloam() chan *omci_pb.PloamDiscoveryResponse
}

IOltOmciEndpoint sends and receives OMCI gRPC messages as if it was an OLT

type IOnu

type IOnu interface {
	ICommon
	GetMIB() IMib
	GetCurrentIntervalEndTime() uint8
	GetMibCache() OnuReadOnlyInfo

	AddManagedEntity(item interface{}, attr me.AttributeValueMap) me.OmciErrors
	DeleteManagedEntity(cid me.ClassID, eid uint16) interface{}
	GetNextMacAddress() []byte
	GetHandler(*me.ManagedEntity, me.AttributeValueMap) gopacket.SerializableLayer
	SetHandler(*me.ManagedEntity, me.AttributeValueMap, me.Results, uint16, uint16) gopacket.SerializableLayer

	GetBridgeManager() IBridgeManager
}

type IOnuOmciEndpoint

type IOnuOmciEndpoint interface {
	RxOmci() chan *OmciRequest
	RxPloam() chan *PloamRequest
}

IOnuOmciEndpoint sends and receives OMCI gRPC messages as if it was an ONU

type IPMCounterGroup

type IPMCounterGroup interface {
	Name() string
	GetAttributeValues([]int) me.AttributeValueMap
	Increment(uint, uint64) error
	Set(uint, uint64) error

	Reset()
	On15MinuteIntervalEnd()
}

type IPMCounterOrGauge

type IPMCounterOrGauge interface {
	Name() string
	Increment(uint64)
	Set(uint64)
	Get() interface{}
	Reset()
}

type IPacket

type IPacket interface {
	RxFrame(gopacket.Packet, interface{})
}

IPacket providers are OMCI ME objects in the path of frame transmission and reception

type MeDbClass

type MeDbClass struct {
	ClassId   me.ClassID              `yaml:"classId"   json:"classId"`
	Instances map[uint16]MeDbInstance `yaml:"instances" json:"instances"`
}

MeDbClass encapsulates all instances of a specific ME Class

func NewMeDbClass

func NewMeDbClass(classID me.ClassID) MeDbClass

func (*MeDbClass) Copy

func (cls *MeDbClass) Copy() MeDbClass

type MeDbEntry

type MeDbEntry struct {
	ClassId    me.ClassID
	InstanceId uint16
	Attributes me.AttributeValueMap
}

MeDbEntries are returned by query

type MeDbInstance

type MeDbInstance struct {
	InstanceId uint16               `yaml:"instanceId" json:"instanceId"`
	Attributes me.AttributeValueMap `yaml:"attributes" json:"attributes"`
	// contains filtered or unexported fields
}

MeDbInstance encapsulates the Attributes for a single instance of an ME Class

func NewMeDbInstance

func NewMeDbInstance(instanceID uint16) MeDbInstance

func (*MeDbInstance) AddReference

func (inst *MeDbInstance) AddReference(ref ReferenceLink)

AddReference adds a reference link from another ME Instance (ref) to this one

func (*MeDbInstance) ContainsReference

func (inst *MeDbInstance) ContainsReference(ref ReferenceLink) bool

func (*MeDbInstance) Copy

func (inst *MeDbInstance) Copy() MeDbInstance

func (*MeDbInstance) DropReference

func (inst *MeDbInstance) DropReference(ref ReferenceLink)

DropReference removes a reference link from another ME Instance (ref) to this one

func (*MeDbInstance) IsReferenced

func (inst *MeDbInstance) IsReferenced() bool

type OmciOltServiceEndpoint

type OmciOltServiceEndpoint struct {
	OmciServiceEndpoint // Common elements

	// Client (OLT side specific fields)
	Olt IOltOmciEndpoint

	OmciTxChannel  chan *omci_pb.OmciRequest
	PloamTxChannel chan *omci_pb.PloamRequest
	// contains filtered or unexported fields
}

func NewOltOmciEndpoint

func NewOltOmciEndpoint(endPt IOltOmciEndpoint, host string, port string) (*OmciOltServiceEndpoint, error)

NewO)ltOmciEndpoint create a new Client/OLT object with the provided configuration It returns the created Service type

func (*OmciOltServiceEndpoint) Cancel

func (e *OmciOltServiceEndpoint) Cancel()

func (*OmciOltServiceEndpoint) Close

func (e *OmciOltServiceEndpoint) Close()

func (*OmciOltServiceEndpoint) OmciSend

func (e *OmciOltServiceEndpoint) OmciSend(message *omci_pb.OmciRequest) error

func (*OmciOltServiceEndpoint) PloamSend

func (e *OmciOltServiceEndpoint) PloamSend(message *omci_pb.PloamRequest) error

type OmciOnuServiceEndpoint

type OmciOnuServiceEndpoint struct {
	OmciServiceEndpoint // Common elements

	// Server (ONU side specific fields)
	OnuMockService IOnuOmciEndpoint
	// contains filtered or unexported fields
}

func NewOnuOmciEndpoint

func NewOnuOmciEndpoint(endPt IOnuOmciEndpoint, port string, omciChan chan *OmciRequest, ploamChan chan *PloamRequest) (*OmciOnuServiceEndpoint, error)

NewOnuOmciEndpoint create a new Service object with the provided configuration. The service acts as the ONU side of an OMCI channel and receives OMCI Requests and generates OMCI Responses and Autonomous OMCI Notifications. The NewOnuOmciEndpoint function returns the created Service type

func (*OmciOnuServiceEndpoint) Close

func (e *OmciOnuServiceEndpoint) Close()

func (*OmciOnuServiceEndpoint) OmciChannel

OmciChannel is used to send/receive OMCI Requests/Responses. The ONU Mock will also use this channel for autonomous ONU notifications.

func (*OmciOnuServiceEndpoint) OmciSend

func (*OmciOnuServiceEndpoint) PloamChannel

PloamChannel is used to send PLOAM (or Impairment) messages from the OLT to the ONU Mock. Only the Discovery request returns a response.

func (*OmciOnuServiceEndpoint) PloamSend

type OmciRequest

type OmciRequest struct {
	Request *omci_pb.OmciRequest
	Stream  omci_pb.OMCI_OmciChannelServer
	// contains filtered or unexported fields
}

func (*OmciRequest) Lock

func (o *OmciRequest) Lock()

func (*OmciRequest) Unlock

func (o *OmciRequest) Unlock()

type OmciServiceEndpoint

type OmciServiceEndpoint struct {
	// Common elements
	//mutex     sync.Mutex
	Done chan struct{}
	// contains filtered or unexported fields
}

OmciServiceReceiver is responsible for receiving and sending gRPC messages as defined by the OMCI Service

func NewOmciServiceEndpoint

func NewOmciServiceEndpoint() OmciServiceEndpoint

type OnuReadOnlyInfo

type OnuReadOnlyInfo struct {
	// ONU-G
	TrafficManagementOption byte

	// ONU-2G
	OmccVersion            byte
	SecurityCapability     byte
	PriorityQueueCount     uint16
	TrafficSchedulerCount  byte
	GemPortCount           uint16
	ConnectivityCapability uint16

	// QOS Flexibility values
	PriorityQueuePortReadWrite     bool
	PriorityQueueSchedulerFlexible bool
	PriorityQueuePriorityReadWrite bool
	SchedulerTContReadWrite        bool
	SchedulerPolicyReadWrite       bool
	TContPolicyReadWrite           bool
}

onuInfo provides a cache from the MIB database for some commonly used read-only attributes

type PMControlBlock

type PMControlBlock struct {
	ThresholdDataID     uint16
	ParentMEClass       me.ClassID
	ParentMEInstance    uint16
	AccumulationDisable uint16
	TCADisable          uint16
	TCI                 uint16

	// Following from control fields
	ContinuousCollection bool
	DownstreamTraffic    bool
	TCIEnabled           bool
	VIDEnabled           bool

	// Following dictates if extended or not
	Extended bool
}

PMControlBlock is present in extended PM statistics

func NewPMControlBlock

func NewPMControlBlock(octets []byte) *PMControlBlock

func (*PMControlBlock) Serialize

func (pm *PMControlBlock) Serialize() []byte

type PMCounter

type PMCounter struct {
	// contains filtered or unexported fields
}

PMCounter models a statistical counter that

func NewPMCounter

func NewPMCounter(name string, size int) *PMCounter

func (*PMCounter) Get

func (cntr *PMCounter) Get() interface{}

func (*PMCounter) Increment

func (cntr *PMCounter) Increment(amount uint64)

func (*PMCounter) Name

func (cntr *PMCounter) Name() string

func (*PMCounter) Reset

func (cntr *PMCounter) Reset()

func (*PMCounter) Set

func (cntr *PMCounter) Set(value uint64)

type PMGauge

type PMGauge struct {
	// contains filtered or unexported fields
}

PMGauge is used to store discrete values

func NewPMGauge

func NewPMGauge(name string, size int, initialValue uint64, constraint ...func(uint64) error) *PMGauge

func (*PMGauge) Get

func (gauge *PMGauge) Get() interface{}

func (*PMGauge) Increment

func (gauge *PMGauge) Increment(value uint64)

func (*PMGauge) Name

func (gauge *PMGauge) Name() string

func (*PMGauge) Reset

func (gauge *PMGauge) Reset()

func (*PMGauge) Set

func (gauge *PMGauge) Set(value uint64)

type PloamRequest

type PloamRequest struct {
	Request *omci_pb.PloamRequest
	Stream  omci_pb.OMCI_PloamChannelServer
}
type ReferenceLink struct {
	ClassID    me.ClassID
	InstanceID uint16
}

ReferenceLink is held by an ME Instance when another (the Referencing cid/eid) has linked to the ME. The ME cannot be deleted while other instances still reference it.

type Statistics

type Statistics struct {
	ClassID  me.ClassID
	EntityID uint16

	// This attribute identifies the most recently finished 15 min interval
	IntervalEndTime uint8

	// This attribute points to an instance of the threshold data 1/2 ME that contains PM
	// threshold values for regular PM or the Control Block for extended PM
	ControlBlock PMControlBlock

	// Data/counters for current interval
	CurrentInterval map[uint]IPMCounterOrGauge
	// contains filtered or unexported fields
}

Statistics tracks the current interval (or free-running counters). For previous intervals, this is stored in the MIB database

func NewStatistics

func NewStatistics(entity *me.ManagedEntity, control *PMControlBlock, intervalEndTime uint8) *Statistics

func (*Statistics) GetAttributeValues

func (stats *Statistics) GetAttributeValues(indexes []int) me.AttributeValueMap

func (*Statistics) Increment

func (stats *Statistics) Increment(index uint, value uint64) error

func (*Statistics) Lock

func (stats *Statistics) Lock()

func (*Statistics) On15MinuteIntervalEnd

func (stats *Statistics) On15MinuteIntervalEnd()

func (*Statistics) Reset

func (stats *Statistics) Reset()

func (*Statistics) Set

func (stats *Statistics) Set(index uint, value uint64) error

func (*Statistics) Unlock

func (stats *Statistics) Unlock()

Jump to

Keyboard shortcuts

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