Documentation ¶
Index ¶
- Constants
- Variables
- func InterfaceIDToPortNo(intfID uint32, intfType string) uint32
- func NewSN(oltid int, intfid uint32, onuid uint32) *openolt.SerialNumber
- type AllocIDKey
- type AllocIDVal
- type FlowAddSpy
- type FlowKey
- type NniPort
- type OltDevice
- func (o *OltDevice) ActivateOnu(context context.Context, onu *openolt.Onu) (*openolt.Empty, error)
- func (o *OltDevice) CollectStatistics(context.Context, *openolt.Empty) (*openolt.Empty, error)
- func (s *OltDevice) CreateTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error)
- func (s *OltDevice) CreateTrafficSchedulers(_ context.Context, trafficSchedulers *tech_profile.TrafficSchedulers) (*openolt.Empty, error)
- func (o *OltDevice) DeactivateOnu(_ context.Context, onu *openolt.Onu) (*openolt.Empty, error)
- func (o *OltDevice) DeleteGroup(ctx context.Context, group *openolt.Group) (*openolt.Empty, error)
- func (o *OltDevice) DeleteOnu(_ context.Context, onu *openolt.Onu) (*openolt.Empty, error)
- func (o *OltDevice) DisableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error)
- func (o *OltDevice) DisablePonIf(_ context.Context, intf *openolt.Interface) (*openolt.Empty, error)
- func (o *OltDevice) Enable(stream openolt.Openolt_EnableIndicationServer) error
- func (o *OltDevice) EnableIndication(_ *openolt.Empty, stream openolt.Openolt_EnableIndicationServer) error
- func (o *OltDevice) EnablePonIf(_ context.Context, intf *openolt.Interface) (*openolt.Empty, error)
- func (o *OltDevice) FindOnuById(intfId uint32, onuId uint32) (*Onu, error)
- func (o *OltDevice) FindOnuBySn(serialNumber string) (*Onu, error)
- func (o *OltDevice) FindServiceByMacAddress(mac net.HardwareAddr) (ServiceIf, error)
- func (o *OltDevice) FlowAdd(ctx context.Context, flow *openolt.Flow) (*openolt.Empty, error)
- func (o *OltDevice) FlowRemove(_ context.Context, flow *openolt.Flow) (*openolt.Empty, error)
- func (o *OltDevice) GetDeviceInfo(context.Context, *openolt.Empty) (*openolt.DeviceInfo, error)
- func (o *OltDevice) GetExtValue(ctx context.Context, in *openolt.ValueParam) (*extension.ReturnValues, error)
- func (o *OltDevice) GetGemPortStatistics(ctx context.Context, in *openolt.OnuPacket) (*openolt.GemPortStatistics, error)
- func (o *OltDevice) GetLogicalOnuDistance(ctx context.Context, in *openolt.Onu) (*openolt.OnuLogicalDistance, error)
- func (o *OltDevice) GetLogicalOnuDistanceZero(ctx context.Context, in *openolt.Onu) (*openolt.OnuLogicalDistance, error)
- func (o *OltDevice) GetOnuByFlowId(flowId uint64) (*Onu, error)
- func (o *OltDevice) GetOnuInfo(context context.Context, packet *openolt.Onu) (*openolt.OnuIndication, error)
- func (o *OltDevice) GetOnuStatistics(ctx context.Context, in *openolt.Onu) (*openolt.OnuStatistics, error)
- func (o *OltDevice) GetPonById(id uint32) (*PonPort, error)
- func (o *OltDevice) GetPonIf(context context.Context, packet *openolt.Interface) (*openolt.IntfIndication, error)
- func (o *OltDevice) GetPonRxPower(ctx context.Context, in *openolt.Onu) (*openolt.PonRxPowerData, error)
- func (o *OltDevice) HasNni(id uint32) bool
- func (o *OltDevice) HasPon(id uint32) bool
- func (o *OltDevice) HeartbeatCheck(context.Context, *openolt.Empty) (*openolt.Heartbeat, error)
- func (o *OltDevice) InitOlt()
- func (o *OltDevice) OmciMsgOut(ctx context.Context, omci_msg *openolt.OmciMsg) (*openolt.Empty, error)
- func (o *OltDevice) OnuItuPonAlarmSet(ctx context.Context, in *config.OnuItuPonAlarm) (*openolt.Empty, error)
- func (o *OltDevice) OnuPacketOut(ctx context.Context, onuPkt *openolt.OnuPacket) (*openolt.Empty, error)
- func (o *OltDevice) PerformGroupOperation(ctx context.Context, group *openolt.Group) (*openolt.Empty, error)
- func (o *OltDevice) Reboot(context.Context, *openolt.Empty) (*openolt.Empty, error)
- func (o *OltDevice) ReenableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error)
- func (s *OltDevice) RemoveTrafficQueues(_ context.Context, tq *tech_profile.TrafficQueues) (*openolt.Empty, error)
- func (s *OltDevice) RemoveTrafficSchedulers(context context.Context, trafficSchedulers *tech_profile.TrafficSchedulers) (*openolt.Empty, error)
- func (o *OltDevice) RestartOLT() error
- func (o *OltDevice) SetAlarm(interfaceId uint32, interfaceType string, alarmStatus string) error
- func (o *OltDevice) StartOltServer() (*grpc.Server, error)
- func (o *OltDevice) StopOltServer()
- func (o *OltDevice) UplinkPacketOut(context context.Context, packet *openolt.UplinkPacket) (*openolt.Empty, error)
- type Onu
- func (onu *Onu) DeleteFlow(key FlowKey)
- func (o *Onu) FindPotsByEntityId(meId uint16) (*PotsPort, error)
- func (o *Onu) FindPotsById(uniID uint32) (*PotsPort, error)
- func (o *Onu) FindUniByEntityId(meId uint16) (*UniPort, error)
- func (o *Onu) FindUniById(uniID uint32) (*UniPort, error)
- func (o *Onu) HandlePowerOnONU() error
- func (o *Onu) HandleShutdownONU() error
- func (o *Onu) IncrementAlarmSequenceNumber(key omcilib.OnuAlarmInfoMapKey) uint8
- func (o *Onu) InvalidateMibDataSync()
- func (o *Onu) ProcessOnuMessages(ctx context.Context, stream openolt.Openolt_EnableIndicationServer, ...)
- func (onu *Onu) ReDiscoverOnu(isReboot bool)
- func (o *Onu) Reboot(timeout time.Duration) error
- func (o *Onu) SendOMCIAlarmNotificationMsg(raiseOMCIAlarm bool, alarmType string)
- func (o *Onu) SetAlarm(alarmType string, status string) error
- func (o *Onu) SetID(id uint32)
- func (o *Onu) Sn() string
- func (o *Onu) StartOmci(client openolt.OpenoltClient)
- type PonPort
- type PotsPort
- type PotsPortIf
- type Service
- type ServiceIf
- type UniPort
- func (u *UniPort) Disable() error
- func (u *UniPort) Enable() error
- func (u *UniPort) GetID() uint32
- func (u *UniPort) HandleAuth()
- func (u *UniPort) HandleDhcp(oPbit uint8, oVid int)
- func (u *UniPort) HandlePackets()
- func (u *UniPort) StorePortNo(portNo uint32)
- func (u *UniPort) UpdateStream(stream bbsimTypes.Stream)
- type UniPortIf
Constants ¶
const ( Default mode = iota OnlyONU OnlyPON Both )
Constants for Controlled Activation modes
const ( //InternalState FSM states and transitions OltInternalStateCreated = "created" OltInternalStateInitialized = "initialized" OltInternalStateEnabled = "enabled" OltInternalStateDisabled = "disabled" OltInternalStateDeleted = "deleted" OltInternalTxInitialize = "initialize" OltInternalTxEnable = "enable" OltInternalTxDisable = "disable" OltInternalTxDelete = "delete" )
const ( // ONU transitions OnuTxInitialize = "initialize" OnuTxDiscover = "discover" OnuTxEnable = "enable" OnuTxDisable = "disable" OnuTxPonDisable = "pon_disable" OnuTxStartImageDownload = "start_image_download" OnuTxProgressImageDownload = "progress_image_download" OnuTxCompleteImageDownload = "complete_image_download" OnuTxFailImageDownload = "fail_image_download" OnuTxActivateImage = "activate_image" OnuTxCommitImage = "commit_image" // ONU States OnuStateCreated = "created" OnuStateInitialized = "initialized" OnuStateDiscovered = "discovered" OnuStateEnabled = "enabled" OnuStateDisabled = "disabled" OnuStatePonDisabled = "pon_disabled" OnuStateImageDownloadStarted = "image_download_started" OnuStateImageDownloadInProgress = "image_download_in_progress" OnuStateImageDownloadComplete = "image_download_completed" OnuStateImageDownloadError = "image_download_error" OnuStateImageActivated = "software_image_activated" OnuStateImageCommitted = "software_image_committed" // BBR ONU States and Transitions BbrOnuTxSendEapolFlow = "send_eapol_flow" BbrOnuStateEapolFlowSent = "eapol_flow_sent" BbrOnuTxSendDhcpFlow = "send_dhcp_flow" BbrOnuStateDhcpFlowSent = "dhcp_flow_sent" )
const ( PotsStateUp = "up" PotsStateDown = "down" )
const ( ServiceStateCreated = "created" ServiceStateInitialized = "initialized" ServiceStateDisabled = "disabled" ServiceTxInitialize = "initialize" ServiceTxDisable = "disable" )
const ( UniStateUp = "up" UniStateDown = "down" )
Variables ¶
var ControlledActivationModes = map[string]mode{ "default": Default, "only-onu": OnlyONU, "only-pon": OnlyPON, "both": Both, }
ControlledActivationModes maps string to int value of mode
Functions ¶
func InterfaceIDToPortNo ¶ added in v0.0.19
InterfaceIDToPortNo converts InterfaceID to voltha PortID Refer openolt adapter code(master) voltha-openolt-adapter/adaptercore/olt_platform.go: IntfIDToPortNo()
Types ¶
type AllocIDKey ¶ added in v1.10.4
type AllocIDVal ¶ added in v1.11.0
type AllocIDVal struct { OnuSn *openolt.SerialNumber AllocID uint16 }
type FlowAddSpy ¶ added in v0.0.5
type NniPort ¶
type OltDevice ¶
type OltDevice struct { sync.Mutex OltServer *grpc.Server // BBSIM Internals ID int SerialNumber string NumNni int NniSpeed uint32 NumPon int NumOnuPerPon int NumUni int NumPots int NniDhcpTrapVid int InternalState *fsm.FSM Flows sync.Map Delay int ControlledActivation mode EventChannel chan common.Event PublishEvents bool PortStatsInterval int PreviouslyConnected bool Pons []*PonPort Nnis []*NniPort // OLT Attributes OperState *fsm.FSM OpenoltStream openolt.Openolt_EnableIndicationServer // Allocated Resources // this data are to verify that the openolt adapter does not duplicate resources AllocIDsLock sync.RWMutex AllocIDs map[uint32]map[uint32]map[uint32]map[int32]map[uint64]bool // map[ponPortId]map[OnuId]map[PortNo]map[AllocIds]map[FlowId]bool GemPortIDsLock sync.RWMutex GemPortIDs map[uint32]map[uint32]map[uint32]map[int32]map[uint64]bool // map[ponPortId]map[OnuId]map[PortNo]map[GemPortIDs]map[FlowId]bool OmciResponseRate uint8 // contains filtered or unexported fields }
func CreateOLT ¶
func CreateOLT(options common.GlobalConfig, services []common.ServiceYaml, isMock bool) *OltDevice
func (*OltDevice) ActivateOnu ¶
func (*OltDevice) CollectStatistics ¶
func (*OltDevice) CreateTrafficQueues ¶
func (s *OltDevice) CreateTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error)
func (*OltDevice) CreateTrafficSchedulers ¶
func (s *OltDevice) CreateTrafficSchedulers(_ context.Context, trafficSchedulers *tech_profile.TrafficSchedulers) (*openolt.Empty, error)
func (*OltDevice) DeactivateOnu ¶
func (*OltDevice) DeleteGroup ¶ added in v1.0.0
func (*OltDevice) DisableOlt ¶
func (*OltDevice) DisablePonIf ¶
func (*OltDevice) Enable ¶
func (o *OltDevice) Enable(stream openolt.Openolt_EnableIndicationServer) error
Enable implements the OpenOLT EnableIndicationServer functionality
func (*OltDevice) EnableIndication ¶
func (*OltDevice) EnablePonIf ¶
func (*OltDevice) FindOnuById ¶ added in v0.0.2
returns an ONU with a given interface/Onu Id
func (*OltDevice) FindOnuBySn ¶ added in v0.0.2
returns an ONU with a given Serial Number
func (*OltDevice) FindServiceByMacAddress ¶ added in v1.0.0
func (o *OltDevice) FindServiceByMacAddress(mac net.HardwareAddr) (ServiceIf, error)
returns a Service with a given Mac Address
func (*OltDevice) FlowRemove ¶
FlowRemove request from VOLTHA
func (*OltDevice) GetDeviceInfo ¶
func (*OltDevice) GetExtValue ¶ added in v1.0.0
func (o *OltDevice) GetExtValue(ctx context.Context, in *openolt.ValueParam) (*extension.ReturnValues, error)
func (*OltDevice) GetGemPortStatistics ¶ added in v1.5.1
func (*OltDevice) GetLogicalOnuDistance ¶ added in v1.0.0
func (*OltDevice) GetLogicalOnuDistanceZero ¶ added in v1.0.0
func (*OltDevice) GetOnuByFlowId ¶ added in v0.2.5
func (*OltDevice) GetOnuInfo ¶
func (*OltDevice) GetOnuStatistics ¶ added in v1.5.1
func (*OltDevice) GetPonById ¶ added in v0.0.2
func (*OltDevice) GetPonRxPower ¶ added in v1.8.0
func (*OltDevice) HeartbeatCheck ¶
func (*OltDevice) OmciMsgOut ¶
func (*OltDevice) OnuItuPonAlarmSet ¶ added in v1.0.0
func (*OltDevice) OnuPacketOut ¶
func (o *OltDevice) OnuPacketOut(ctx context.Context, onuPkt *openolt.OnuPacket) (*openolt.Empty, error)
this gRPC methods receives packets from VOLTHA and sends them to the subscriber on the ONU
func (*OltDevice) PerformGroupOperation ¶ added in v1.0.0
func (*OltDevice) ReenableOlt ¶
func (*OltDevice) RemoveTrafficQueues ¶
func (s *OltDevice) RemoveTrafficQueues(_ context.Context, tq *tech_profile.TrafficQueues) (*openolt.Empty, error)
func (*OltDevice) RemoveTrafficSchedulers ¶
func (s *OltDevice) RemoveTrafficSchedulers(context context.Context, trafficSchedulers *tech_profile.TrafficSchedulers) (*openolt.Empty, error)
func (*OltDevice) RestartOLT ¶ added in v0.0.7
func (*OltDevice) StartOltServer ¶ added in v1.4.1
StartOltServer will create the grpc server that VOLTHA uses to communicate with the device
func (*OltDevice) StopOltServer ¶ added in v0.0.8
func (o *OltDevice) StopOltServer()
StopOltServer stops the OpenOLT grpc server
func (*OltDevice) UplinkPacketOut ¶
type Onu ¶
type Onu struct { ID uint32 PonPortID uint32 PonPort *PonPort InternalState *fsm.FSM DiscoveryRetryDelay time.Duration // this is the time between subsequent Discovery Indication DiscoveryDelay time.Duration // this is the time to send the first Discovery Indication Backoff *backoff.Backoff // ONU State UniPorts []UniPortIf PotsPorts []PotsPortIf Flows []FlowKey FlowIds []uint64 // keep track of the flows we currently have in the ONU OperState *fsm.FSM SerialNumber *openolt.SerialNumber AdminLockState uint8 // 0 is enabled, 1 is disabled. Channel chan bbsim.Message // this Channel is to track state changes OMCI messages, EAPOL and DHCP packets // OMCI params MibDataSync uint8 ImageSoftwareExpectedSections uint32 ImageSoftwareReceivedSections uint32 ActiveImageEntityId uint16 CommittedImageEntityId uint16 StandbyImageVersion string ActiveImageVersion string InDownloadImageVersion string CommittedImageVersion string OmciResponseRate uint8 OmciMsgCounter uint8 ImageSectionData []byte MibDb *omcilib.MibDb DoneChannel chan bool // this channel is used to signal once the onu is complete (when the struct is used by BBR) TrafficSchedulers *tech_profile.TrafficSchedulers // contains filtered or unexported fields }
func (*Onu) DeleteFlow ¶ added in v0.0.18
DeleteFlow method search and delete flowKey from the onu flows slice
func (*Onu) FindPotsByEntityId ¶ added in v1.10.0
FindPotsByEntityId retrieves a POTS uni by MeID (the OMCI entity ID)
func (*Onu) FindPotsById ¶ added in v1.10.0
FindPotsById retrieves a POTS port by ID
func (*Onu) FindUniByEntityId ¶ added in v1.8.0
FindUniByEntityId retrieves a uni by MeID (the OMCI entity ID)
func (*Onu) FindUniById ¶ added in v1.8.0
FindUniById retrieves a UNI by ID
func (*Onu) HandlePowerOnONU ¶ added in v1.5.0
func (*Onu) HandleShutdownONU ¶ added in v1.5.0
func (*Onu) IncrementAlarmSequenceNumber ¶ added in v1.5.2
func (o *Onu) IncrementAlarmSequenceNumber(key omcilib.OnuAlarmInfoMapKey) uint8
func (*Onu) InvalidateMibDataSync ¶ added in v1.10.0
func (o *Onu) InvalidateMibDataSync()
func (*Onu) ProcessOnuMessages ¶ added in v0.0.2
func (o *Onu) ProcessOnuMessages(ctx context.Context, stream openolt.Openolt_EnableIndicationServer, client openolt.OpenoltClient)
ProcessOnuMessages starts indication channel for each ONU
func (*Onu) ReDiscoverOnu ¶ added in v0.3.0
when ReDiscoverOnu is called during reboot, true is passed so that there is no delay in onu discoveries
It is assumed that all onu resources are cleared and no sleep is required
func (*Onu) SendOMCIAlarmNotificationMsg ¶ added in v1.5.2
func (*Onu) StartOmci ¶ added in v0.0.2
func (o *Onu) StartOmci(client openolt.OpenoltClient)
TODO move this method in responders/omcisim StartOmci is called in BBR to start the OMCI state machine
type PonPort ¶
type PonPort struct { // BBSIM Internals ID uint32 Technology common.PonTechnology NumOnu int Onus []*Onu Olt *OltDevice PacketCount uint64 InternalState *fsm.FSM // PON Attributes OperState *fsm.FSM Type string // Allocated resources // Some resources (eg: OnuId, AllocId and GemPorts) have to be unique per PON port // we are keeping a list so that we can throw an error in cases we receive duplicates AllocatedGemPorts map[uint16]*openolt.SerialNumber AllocatedOnuIds map[uint32]*openolt.SerialNumber AllocatedAllocIds map[AllocIDKey]*AllocIDVal // key is AllocIDKey // contains filtered or unexported fields }
func CreatePonPort ¶ added in v0.0.10
func CreatePonPort(olt *OltDevice, id uint32, tech common.PonTechnology) *PonPort
CreatePonPort creates pon port object
func (*PonPort) GetNumOfActiveOnus ¶ added in v0.0.19
GetNumOfActiveOnus returns number of active ONUs for PON port
func (*PonPort) GetOnuBySn ¶ added in v0.0.2
func (p *PonPort) GetOnuBySn(sn *openolt.SerialNumber) (*Onu, error)
type PotsPort ¶ added in v1.10.0
type PotsPort struct { ID uint32 MeId omcilib.EntityID PortNo uint32 OperState *fsm.FSM Onu *Onu // contains filtered or unexported fields }
func (*PotsPort) StorePortNo ¶ added in v1.10.0
type PotsPortIf ¶ added in v1.10.0
type Service ¶ added in v1.0.0
type Service struct { Id uint32 Name string HwAddress net.HardwareAddr UniPort *UniPort CTag int STag int NeedsEapol bool NeedsDhcp bool NeedsIgmp bool NeedsPPPoE bool TechnologyProfileID int UniTagMatch int ConfigureMacAddress bool EnableMacLearning bool UsPonCTagPriority uint8 UsPonSTagPriority uint8 DsPonCTagPriority uint8 DsPonSTagPriority uint8 // state GemPort uint32 InternalState *fsm.FSM EapolState *fsm.FSM DHCPState *fsm.FSM IGMPState *fsm.FSM Channel chan bbsimTypes.Message // drive Service lifecycle PacketCh chan bbsimTypes.OnuPacketMessage // handle packets Stream bbsimTypes.Stream // the gRPC stream to communicate with the adapter, created in the initialize transition }
func NewService ¶ added in v1.0.0
func NewService(id uint32, name string, hwAddress net.HardwareAddr, uni *UniPort, cTag int, sTag int, needsEapol bool, needsDchp bool, needsIgmp bool, needsPPPoE bool, tpID int, uniTagMatch int, configMacAddress bool, enableMacLearning bool, usPonCTagPriority uint8, usPonSTagPriority uint8, dsPonCTagPriority uint8, dsPonSTagPriority uint8) (*Service, error)
func (*Service) HandleAuth ¶ added in v1.0.0
func (s *Service) HandleAuth()
HandleAuth is used to start EAPOL for a particular Service when the corresponding flow is received
func (*Service) HandleChannel ¶ added in v1.0.0
func (s *Service) HandleChannel()
func (*Service) HandleDhcp ¶ added in v1.0.0
HandleDhcp is used to start DHCP for a particular Service when the corresponding flow is received
func (*Service) HandlePackets ¶ added in v1.0.0
func (s *Service) HandlePackets()
func (*Service) Initialize ¶ added in v1.0.0
func (s *Service) Initialize(stream bbsimTypes.Stream)
func (*Service) UpdateStream ¶ added in v1.6.0
func (s *Service) UpdateStream(stream bbsimTypes.Stream)
type ServiceIf ¶ added in v1.0.0
type ServiceIf interface { HandlePackets() // start listening on the PacketCh HandleAuth() // Sends the EapoStart packet HandleDhcp(oPbit uint8, oVid int) // Sends the DHCPDiscover packet Initialize(stream bbsimTypes.Stream) UpdateStream(stream bbsimTypes.Stream) Disable() }
type UniPort ¶ added in v1.8.0
type UniPort struct { ID uint32 MeId omcilib.EntityID PortNo uint32 OperState *fsm.FSM Onu *Onu Services []ServiceIf PacketCh chan bbsimTypes.OnuPacketMessage // handle packets // contains filtered or unexported fields }
func NewUniPort ¶ added in v1.8.0
func (*UniPort) HandleAuth ¶ added in v1.8.0
func (u *UniPort) HandleAuth()
func (*UniPort) HandleDhcp ¶ added in v1.8.0
func (*UniPort) HandlePackets ¶ added in v1.8.0
func (u *UniPort) HandlePackets()
this method simply forwards the packet to the correct service
func (*UniPort) StorePortNo ¶ added in v1.8.0
func (*UniPort) UpdateStream ¶ added in v1.8.0
func (u *UniPort) UpdateStream(stream bbsimTypes.Stream)
type UniPortIf ¶ added in v1.8.0
type UniPortIf interface { GetID() uint32 StorePortNo(portNo uint32) UpdateStream(stream bbsimTypes.Stream) Enable() error Disable() error HandlePackets() // start listening on the PacketCh HandleAuth() // Sends the EapoStart packet HandleDhcp(pbit uint8, cTag int) // Sends the DHCPDiscover packet }