onu

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: 32 Imported by: 0

Documentation

Overview

* Copyright (c) 2019 - present. Boling Consulting Solutions (bcsw.net) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* Copyright (c) 2019 - present. Boling Consulting Solutions (bcsw.net) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* Copyright (c) 2019 - present. Boling Consulting Solutions (bcsw.net) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

Index

Constants

View Source
const DisabledState fsm.State = "disabled" // Shutdown
View Source
const DiscoverableState fsm.State = "discoverable" // Can be discovered, PLOAM only
View Source
const ImpairedState fsm.State = "impaired" // Fault (or rebooting)
View Source
const InitialState fsm.State = "initial" // State after creation of ONU
View Source
const OperationalState fsm.State = "operational" // Activated, O5 Operational state
View Source
const ShutdownState fsm.State = "shutdown" // Exiting
View Source
const StartingState fsm.State = "starting" // Set up of ONU occurs (no OMCI)
View Source
const UnassignedOnuID uint = 0xFFFF // Assigned at ONU activation

Variables

View Source
var EnergyConsumptionNameToIndex map[string]uint

Functions

func NewEnergyConsumptionPM

func NewEnergyConsumptionPM(instanceID uint16, control *interfaces.PMControlBlock, intervalEndTime uint8) *interfaces.Statistics

func NewLastTxMsg

func NewLastTxMsg(message []byte) *lastTxMsg

func NewLastTxMsgMap

func NewLastTxMsgMap() *lastTxMsgMap

func NewONU

func NewONU(parent interfaces.ICommon, serialNumber string, c *config.OnuConfig, url string) interfaces.IOnu

NewOnu creates a newly initialized ONU ONU

func StartupGenerator

func StartupGenerator(config *config.OnuConfig) (func(sync.Locker, map[string]interfaces.ICommon) <-chan interfaces.ICommon, error)

StartupGenerator returns a generator function that is responsible for ONU startup based on the startup pattern requested

Types

type AlarmTable

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

AlarmTable maintains the current MIB database for a single ONU

func NewAlarmTable

func NewAlarmTable() *AlarmTable

NewAlarmTable creates a new Alarm Table for an ONU

type GetNextMap

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

getNextMap is used to hold ME Instances that may receive a get-next operation on. This includes MibUploadNext, GetAllAlarmsNext, and GetNext message types. After 60 seconds after the last operation and a specific entry, the ME snapshots are dropped

func NewGetNextMap

func NewGetNextMap() *GetNextMap

func (*GetNextMap) AddMibUploadEntry

func (gnm *GetNextMap) AddMibUploadEntry(classID me.ClassID, entries []gopacket.SerializableLayer)

func (*GetNextMap) AddTableEntries

func (gnm *GetNextMap) AddTableEntries(classID me.ClassID, instanceID uint16, index uint, data []uint8, baseline bool) error

func (*GetNextMap) DeleteTableEntries

func (gnm *GetNextMap) DeleteTableEntries(classID me.ClassID, instanceID uint16) error

func (*GetNextMap) GetNextMibUploadEntry

func (gnm *GetNextMap) GetNextMibUploadEntry(classID me.ClassID, sequenceNumber uint) (gopacket.SerializableLayer, error)

GetNextInstance is for handling database snapshots where entries are encoded with specific OMCI Frames to return

func (*GetNextMap) GetNextTableEntry

func (gnm *GetNextMap) GetNextTableEntry(classID me.ClassID, instanceID uint16, index uint, sequenceNumber uint) (gopacket.SerializableLayer, error)

func (*GetNextMap) OnMibReset

func (gnm *GetNextMap) OnMibReset() error

func (*GetNextMap) Shutdown

func (gnm *GetNextMap) Shutdown()

type GetNextMapEntry

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

type MeAlarmClass

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

MeAlarmClass encapsulates all instances of a specific ME Class

type MeAlarmEntity

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

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

type MibDatabase

type MibDatabase struct {
	MibDataSync uint8                               `yaml:"mds"     json:"mds"`
	Classes     map[me.ClassID]interfaces.MeDbClass `yaml:"classes" json:"classes"`
	// contains filtered or unexported fields
}

MibDatabase maintains the current MIB database for a single ONU

func NewMibDatabase

func NewMibDatabase() *MibDatabase

NewMibDatabase creates a new MIB Database for an ONU

func (*MibDatabase) AllocateTCont

func (db *MibDatabase) AllocateTCont() (uint16, error)

AllocateTCont returns the EID of a free TCONT. This TCONT, if provided, is owned by the caller and the caller is responsible for setting the proper AllocID with a Set operation.

func (*MibDatabase) Delete

func (db *MibDatabase) Delete(classId me.ClassID, instanceId uint16) error

func (*MibDatabase) DisableMDSIncrement

func (db *MibDatabase) DisableMDSIncrement()

DisableMDSIncrement is used to disable MIB Data Sync increment on successful Create and Set attributes. Currently, an OLT using this library would disable this only during a MIB Upload.

func (*MibDatabase) EnableMDSIncrement

func (db *MibDatabase) EnableMDSIncrement()

EnableMDSIncrement is used to enable MIB Data Sync increment on successful Create and Set attributes. Currently, an OLT using this library would disable this only during a MIB Upload.

func (*MibDatabase) GetAniMap

func (db *MibDatabase) GetAniMap() map[uint16]interfaces.MeDbInstance

func (*MibDatabase) GetFreeTContAllocID

func (db *MibDatabase) GetFreeTContAllocID() uint16

GetFreeTContAllocID returns the value that is used to specify that a TCONT is not currently assigned to an ONU for data traffic

func (*MibDatabase) GetPptpMap

func (db *MibDatabase) GetPptpMap() map[uint16]interfaces.MeDbInstance

func (*MibDatabase) GetUniGMap

func (db *MibDatabase) GetUniGMap() map[uint16]interfaces.MeDbInstance

func (*MibDatabase) GetVeipMap

func (db *MibDatabase) GetVeipMap() map[uint16]interfaces.MeDbInstance

func (*MibDatabase) QueryAttribute

func (db *MibDatabase) QueryAttribute(classID me.ClassID, instanceID uint16, index uint) (interface{}, error)

func (*MibDatabase) QueryClass

func (db *MibDatabase) QueryClass(classID me.ClassID) (map[uint16]interfaces.MeDbInstance, error)

QueryClass returns all instances of a Managed Entity. The results are a copy of what is in the database

func (*MibDatabase) QueryInstance

func (db *MibDatabase) QueryInstance(classID me.ClassID, instanceID uint16) (*interfaces.MeDbEntry, error)

QueryInstance returns a unique Managed Entity Class instance. This instances is a copy of what is in the database. For table attributes, the entire table is returned

func (*MibDatabase) ReadJSON

func (db *MibDatabase) ReadJSON(reader io.Reader) error

ReadYAML reads in a Managed Entity Database (JSON) file

func (*MibDatabase) ReadYAML

func (db *MibDatabase) ReadYAML(reader io.Reader) error

ReadYAML reads in a Managed Entity Database (YAML) file

func (*MibDatabase) ReleaseTCont

func (db *MibDatabase) ReleaseTCont(eid uint16) error

ReleaseTCont is used to release an allocated TCONT once it is not longer in use

func (*MibDatabase) Set

func (db *MibDatabase) Set(classID me.ClassID, instanceID uint16, attributes me.AttributeValueMap, createIfNeeded ...bool) me.OmciErrors

func (*MibDatabase) SetAttribute

func (db *MibDatabase) SetAttribute(classID me.ClassID, instanceID uint16, attr string, value interface{}) error

SetAttribute is for internal ONU use and is often called to set read-only status/gauge values in the database on a periodic basis. It does not update the MDS and should not be called due to an OLT Set request

func (*MibDatabase) SnapshotDatabase

func (db *MibDatabase) SnapshotDatabase(lock bool) (*MibDatabase, error)

SnapshotDatabase will get an exact copy of an existing MIB Database

func (*MibDatabase) UnmarshalJSON

func (db *MibDatabase) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller that will refactor integer values (decoded initially as float32) and []byte values (decoded initially as Base64-encoded strings) into their proper sizes

func (*MibDatabase) WriteJSON

func (db *MibDatabase) WriteJSON(path string) error

WriteJSON outputs a Managed Entity Database to a JSON encoded file

func (*MibDatabase) WriteYAML

func (db *MibDatabase) WriteYAML(path string) error

WriteYAML outputs a Managed Entity Database to a YAML encoded file

type ONU

type ONU struct {
	Pon interfaces.ICommon // PON Port

	SerialNumber string // ASCII serial number (not base64)

	URL string // Vendor Info URL

	FSM *fsm.Machine // Finite state machine

	PMClock *PMClock
	// contains filtered or unexported fields
}

ONU is used to encapsulates a single simulated ONU

func (*ONU) AddManagedEntity

func (onu *ONU) AddManagedEntity(item interface{}, attr me.AttributeValueMap) me.OmciErrors

AddManagedEntity adds a variety of ONU created Managed Entity structs to the ONU. It is called on an OMCI create request while the ONU mutex is held.

func (*ONU) AddTimers

func (onu *ONU) AddTimers(timer *time.Timer)

func (*ONU) Configuration

func (onu *ONU) Configuration() interface{}

func (*ONU) DeleteManagedEntity

func (onu *ONU) DeleteManagedEntity(cid me.ClassID, eid uint16) interface{}

DeleteManagedEntity deletes a variety of ONU created Managed Entity structs to the ONU. It is called on an OMCI create request while the ONU mutex is held.

func (*ONU) EnergyConsumptionPerformanceMonitoringHistoryDataHandler

func (onu *ONU) EnergyConsumptionPerformanceMonitoringHistoryDataHandler(request *me.ManagedEntity, existing *interfaces.MeDbEntry, mt omci.MessageType) gopacket.SerializableLayer

func (*ONU) GetBridgeManager

func (onu *ONU) GetBridgeManager() interfaces.IBridgeManager

GetBridgeManager gets the bridge manager for this ONU

func (*ONU) GetBridgeService

func (onu *ONU) GetBridgeService(eid uint16) interface{}

func (*ONU) GetCurrentIntervalEndTime

func (onu *ONU) GetCurrentIntervalEndTime() uint8

func (*ONU) GetHandler

func (onu *ONU) GetHandler(request *me.ManagedEntity, existing me.AttributeValueMap) gopacket.SerializableLayer

GetHandler encodes the requested existing attributes into a GET Response. MEs that contain all their data in the MIB can call this directly. For MEs that have to update status can update the value, save to MIB, and then save to the 'existing' Attribute Value map and then call this method.

If the get request is sending back the size of any table attributes, the caller will need to update the 'existing' attribute value map before calling this method since the original existing data is from the MIB and it is an octet string.

func (*ONU) GetMIB

func (onu *ONU) GetMIB() interfaces.IMib

Get current MIB database

func (*ONU) GetManagedEntity

func (onu *ONU) GetManagedEntity(cid me.ClassID, eid uint16) interface{}

GetManagedEntity retrieves a variety of ONU created Managed Entity structs to the ONU. It is called on an OMCI create request while the ONU mutex is held.

func (*ONU) GetMibCache

func (onu *ONU) GetMibCache() interfaces.OnuReadOnlyInfo

func (*ONU) GetNextMacAddress

func (onu *ONU) GetNextMacAddress() []byte

func (*ONU) ID

func (onu *ONU) ID() uint

func (*ONU) Input

func (onu *ONU) Input() chan<- interface{}

Input returns the channel that can receive requests from other objects

func (*ONU) IsEnabled

func (onu *ONU) IsEnabled() bool

IsEnabled returns the current ONU enable state. An enabled ONU will receive/transmit OMCI messages.

func (*ONU) IsOperational

func (onu *ONU) IsOperational() bool

IsOperational returns true if the ONU is in the operational state and can process OMCI (non-PLOAM) messages

func (*ONU) Name

func (onu *ONU) Name() string

func (*ONU) OnCreateRequest

func (onu *ONU) OnCreateRequest(msgObj *omci.CreateRequest) gopacket.SerializableLayer

func (*ONU) OnDeleteRequest

func (onu *ONU) OnDeleteRequest(msgObj *omci.DeleteRequest) gopacket.SerializableLayer

func (*ONU) OnGetNextRequest

func (onu *ONU) OnGetNextRequest(msgObj *omci.GetNextRequest) (gopacket.SerializableLayer, error)

func (*ONU) OnGetRequest

func (onu *ONU) OnGetRequest(msgObj *omci.GetRequest) gopacket.SerializableLayer

OnGetRequest is responsible for processing a GET Request from an OLT. It will look up the requested ME Instance and if found, returned the requested attributes.

func (*ONU) OnMibReset

func (onu *ONU) OnMibReset() error

func (*ONU) OnMibUploadNextRequest

func (onu *ONU) OnMibUploadNextRequest(seqNumber uint16) (gopacket.SerializableLayer, error)

func (*ONU) OnMibUploadRequest

func (onu *ONU) OnMibUploadRequest() (gopacket.SerializableLayer, error)

func (*ONU) OnSetRequest

func (onu *ONU) OnSetRequest(msgObj *omci.SetRequest) gopacket.SerializableLayer

func (*ONU) OnSynchronizeTime

func (onu *ONU) OnSynchronizeTime(time time.Time, delta time.Duration, dateProvided bool) (gopacket.SerializableLayer, error)

func (*ONU) OnuDataHandler

func (onu *ONU) OnuDataHandler(request *me.ManagedEntity, existing *interfaces.MeDbEntry, mt omci.MessageType) gopacket.SerializableLayer

func (*ONU) Parent

func (onu *ONU) Parent() interfaces.ICommon

Parent returns the parent object of this ONU (a PON)

func (*ONU) SetActiveANI

func (onu *ONU) SetActiveANI(eid uint16) error

func (*ONU) SetHandler

func (onu *ONU) SetHandler(request *me.ManagedEntity, changed me.AttributeValueMap, result me.Results, failed uint16, unsupported uint16) gopacket.SerializableLayer

func (*ONU) SetOnuID

func (onu *ONU) SetOnuID(id uint) error

func (*ONU) State

func (onu *ONU) State() fsm.State

func (*ONU) StateTransitionCallback

func (onu *ONU) StateTransitionCallback(state fsm.State) error

StateTransitionCallback is called after transition to the new state and when the FSM mutex is locked. If synchronous, it will call directly into method. If async, uses a go routine to call the callback

func (*ONU) String

func (onu *ONU) String() string

Convert type to string

type ONUG

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

ONUG is used to centralize the ONU-G, ONU-2G, and ONU-3G properties

type Omcc

type Omcc struct {
	Extended bool // If true, extended messaging allowed, baseline otherwise
	// contains filtered or unexported fields
}

Omcc is used to model the OMCI communications channel

func NewOmcc

func NewOmcc(onu *ONU, managedEntities *[]me.ClassID, messageTypes *[]me.MsgType) *Omcc

Create a new OMCI Communications channel

func (*Omcc) OnMibReset

func (cc *Omcc) OnMibReset() error

func (*Omcc) OnRanging

func (cc *Omcc) OnRanging() error

OnRanging is called when the ONU enters the discoverable state

func (*Omcc) RxOmci

func (cc *Omcc) RxOmci(request *interfaces.OmciRequest) error

RxOmci is responsible for requesting Rx Processing and sending any response

func (*Omcc) String

func (cc *Omcc) String() string

Convert type to string

func (*Omcc) TxAutonomousMessage

func (cc *Omcc) TxAutonomousMessage(responseStream omci_pb.OMCI_OmciChannelServer, response *omci_pb.OmciResponse)

func (*Omcc) TxOmci

func (cc *Omcc) TxOmci(responseStream omci_pb.OMCI_OmciChannelServer, response *omci_pb.OmciResponse)

type PMClock

type PMClock struct {
	SupportsDate    bool  // 24-hour clock supported
	TrackingDate    bool  // Date & boundary set successfully
	IntervalEndTime uint8 // 15min interval end time counter
	// contains filtered or unexported fields
}

PMClock provides 15-minute time interval support for the ONU. Note that the clock uses a Timer and not a Ticker. The initial tick interval for the clock will probably be less than 15 minutes, so a fixed interval Ticker did not seem to be the best choice.

func NewPMClock

func NewPMClock(onu *ONU, supportsDate bool) *PMClock

func (*PMClock) Now

func (p *PMClock) Now() time.Time

func (*PMClock) OnSynchronizeTimeRequest

func (p *PMClock) OnSynchronizeTimeRequest(time time.Time, delta time.Duration, dateProvided bool)

OnSynchronizeTimeRequest handles a new sync time request from the OLT and will reset/restart any PM intervals as necessary.

func (*PMClock) Seconds

func (p *PMClock) Seconds() int

Seconds returns the seconds since midnight for the PM clock

func (*PMClock) Start

func (p *PMClock) Start()

func (*PMClock) Stop

func (p *PMClock) Stop()

func (*PMClock) Subscribe

func (p *PMClock) Subscribe(observer chan<- interface{})

Subscribe registers a channel to receive 15-min PM interval-end events.

The previous & current interval end time (uint8) is sent as the data on the channel

func (*PMClock) Unsubscribe

func (p *PMClock) Unsubscribe(observer chan<- interface{})

Unsubscribe removes a channel from receiving any PM interval-end events

type PMTimerInterval

type PMTimerInterval struct {
	PreviousInterval uint8    // The interval that just expired
	CurrentInterval  uint8    // The current 15-minute interval
	PMClock          *PMClock // The clock in case they need something
}

type Port

type Port struct {
	PortNumber uint8
}

type Slot

type Slot struct {
	SlotNumber uint8
	Ports      map[uint8]Port
}

type SlotPortModel

type SlotPortModel struct {
	Slots map[uint8]Slot
}

SlotPort models the slots and ports of the ONU TODO: Create this from the Port Mapping packing MEs and use it to enforce

numbering contstraints. If MEs are not present in the MIB, be as lenient
as is reasonable.

TODO: This is not yet integrated as generated ME support of the PortMapping ME

is not yet supported

Directories

Path Synopsis
* Copyright (c) 2019 - present.
* Copyright (c) 2019 - present.
* Copyright (c) 2019 - present.
* Copyright (c) 2019 - present.

Jump to

Keyboard shortcuts

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