blob: d86805de99d864016e23dda1c3195262670171d5 [file] [log] [blame]
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +00001/*
Joey Armstrong89c812c2024-01-12 19:00:20 -05002 * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +00003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
praneeth nalmas5a0a5502022-12-23 15:57:00 +053017// Package common provides global definitions
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000018package common
19
20import (
21 "context"
Girish Gowdraf7d82d02022-04-26 16:18:35 -070022 "sync"
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000023 "time"
24
Holger Hildebrandt94688c72021-12-17 12:13:02 +000025 me "github.com/opencord/omci-lib-go/v2/generated"
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000026 "github.com/opencord/voltha-lib-go/v7/pkg/db"
27 "github.com/opencord/voltha-lib-go/v7/pkg/events/eventif"
28 "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/devdb"
praneeth nalmas5a0a5502022-12-23 15:57:00 +053029 "github.com/opencord/voltha-protos/v5/go/extension"
khenaidoo42dcdfd2021-10-19 17:34:12 -040030 ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000031 "github.com/opencord/voltha-protos/v5/go/openolt"
32 "github.com/opencord/voltha-protos/v5/go/voltha"
33)
34
35// IopenONUAC interface to openONUAC
36type IopenONUAC interface {
37 GetSupportedFsms() *OmciDeviceFsms
38 LockMutexMibTemplateGenerated()
39 UnlockMutexMibTemplateGenerated()
40 GetMibTemplatesGenerated(string) (bool, bool)
41 SetMibTemplatesGenerated(string, bool)
42 RLockMutexDeviceHandlersMap()
43 RUnlockMutexDeviceHandlersMap()
44 GetDeviceHandler(string) (IdeviceHandler, bool)
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +053045 GetONUMIBDBMap() devdb.OnuMCmnMEDBMap
46 RLockMutexMIBDatabaseMap()
47 RUnlockMutexMIBDatabaseMap()
48 LockMutexMIBDatabaseMap()
49 UnlockMutexMIBDatabaseMap()
50 FetchEntryFromMibDatabaseMap(context.Context, string) (*devdb.OnuCmnMEDB, bool)
51 CreateEntryAtMibDatabaseMap(context.Context, string) (*devdb.OnuCmnMEDB, error)
52 ResetEntryFromMibDatabaseMap(context.Context, string)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000053}
54
55// IdeviceHandler interface to deviceHandler
56type IdeviceHandler interface {
57 GetDeviceID() string
58 GetLogicalDeviceID() string
59 GetDevice() *voltha.Device
60 GetDeviceType() string
61 GetProxyAddressID() string
62 GetProxyAddressType() string
63 GetProxyAddress() *voltha.Device_ProxyAddress
64 GetEventProxy() eventif.EventProxy
65 GetOmciTimeout() int
66 GetAlarmAuditInterval() time.Duration
67 GetDlToOnuTimeout4M() time.Duration
68 GetUniEntityMap() *OnuUniPortMap
69 GetUniPortMask() int
70 GetPonPortNumber() *uint32
71 GetOnuIndication() *openolt.OnuIndication
72 GetUniVlanConfigFsm(uint8) IuniVlanConfigFsm
Holger Hildebrandt9afc1582021-11-30 16:10:19 +000073 GetTechProfileInstanceFromParentAdapter(context.Context, uint8, string) (*ia.TechProfileDownloadMessage, error)
Holger Hildebrandtc572e622022-06-22 09:19:17 +000074 GetExtendedOmciSupportEnabled() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000075
76 GetDeviceReasonString() string
mpagenkoe4782082021-11-25 12:04:26 +000077 ReasonUpdate(context.Context, uint8, bool) error
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000078
79 GetCollectorIsRunning() bool
Girish Gowdraf7d82d02022-04-26 16:18:35 -070080 StartCollector(context.Context, *sync.WaitGroup)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000081 InitPmConfigs()
82 GetPmConfigs() *voltha.PmConfigs
83 GetMetricsEnabled() bool
84 GetOnuMetricsManager() IonuMetricsManager
85 GetOnuAlarmManager() IonuAlarmManager
86 GetOnuTP() IonuUniTechProf
87
88 GetAlarmManagerIsRunning(context.Context) bool
89 StartAlarmManager(context.Context)
90
Girish Gowdrae95687a2021-09-08 16:30:58 -070091 GetFlowMonitoringIsRunning(uniID uint8) bool
92
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000093 CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool
94
95 RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState)
96 DeviceProcStatusUpdate(context.Context, OnuDeviceEvent)
97
98 SetReadyForOmciConfig(bool)
99 IsReadyForOmciConfig() bool
Holger Hildebrandt2b107642022-12-09 07:56:23 +0000100 IsOltAvailable() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000101
102 StorePersistentData(context.Context) error
103 StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error
104
105 StartReconciling(context.Context, bool)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000106 IsReconciling() bool
107 IsSkipOnuConfigReconciling() bool
Holger Hildebrandt9afc1582021-11-30 16:10:19 +0000108 SetReconcilingReasonUpdate(bool)
109 IsReconcilingReasonUpdate() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000110 PrepareReconcilingWithActiveAdapter(context.Context)
Holger Hildebrandtb314f442021-11-24 12:03:10 +0000111 ReconcileDeviceTechProf(context.Context) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000112 ReconcileDeviceFlowConfig(context.Context)
Sridhar Ravindraa9cb0442025-07-21 16:55:05 +0530113 CheckForDeviceTechProf(context.Context) bool
114 DeviceFlowConfigOnReboot(context.Context)
mpagenko101ac942021-11-16 15:01:29 +0000115 GetReconcileExpiryVlanConfigAbort() time.Duration
116 SendChUniVlanConfigFinished(value uint16)
Sridhar Ravindraa9cb0442025-07-21 16:55:05 +0530117 SendChUniVlanConfigFinishedOnReboot(value uint16)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000118
119 VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
120 VerifyVlanConfigRequest(context.Context, uint8, uint8)
Akash Soni3de0e062024-12-11 16:37:26 +0530121 HandleAniConfigFSMFailure(ctx context.Context, uniID uint8)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000122 AddAllUniPorts(context.Context)
123 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
124
125 EnableUniPortStateUpdate(context.Context)
126 DisableUniPortStateUpdate(context.Context)
127
128 SetBackend(context.Context, string) *db.Backend
129 GetBackendPathPrefix() string
130
131 RLockMutexDeletionInProgressFlag()
132 RUnlockMutexDeletionInProgressFlag()
133 GetDeletionInProgress() bool
134
khenaidoo42dcdfd2021-10-19 17:34:12 -0400135 SendOMCIRequest(context.Context, string, *ia.OmciMessage) error
kesavand011d5162021-11-25 19:21:06 +0530136 SendOnuSwSectionsOfWindow(context.Context, string, *ia.OmciMessages) error
137
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000138 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700139
140 PerOnuFlowHandlerRoutine(uniID uint8)
Praneeth Kumar Nalmasaacc6122024-04-09 22:55:49 +0530141 GetDeviceDeleteCommChan(context.Context) chan bool
Praneeth Kumar Nalmas77ab2f32024-04-17 11:14:27 +0530142 GetSkipOnuConfigEnabled() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000143}
144
145// IonuDeviceEntry interface to onuDeviceEntry
146type IonuDeviceEntry interface {
147 GetDevOmciCC() *OmciCC
148 GetOnuDB() *devdb.OnuDeviceDB
149 GetPersSerialNumber() string
150 GetPersVendorID() string
Holger Hildebrandt6a001d02022-06-15 08:32:48 +0000151 GetPersVersion() string
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000152 GetPersEquipmentID() string
Holger Hildebrandt0edf5b02022-05-04 14:19:43 +0000153 GetPersIsExtOmciSupported() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000154
155 GetMibUploadFsmCommChan() chan Message
156 GetMibDownloadFsmCommChan() chan Message
157
158 GetOmciRebootMsgRevChan() chan Message
159 WaitForRebootResponse(context.Context, chan Message) error
160
161 IncrementMibDataSync(context.Context)
162
163 GetActiveImageMeID(context.Context) (uint16, error)
Holger Hildebrandtfdb4bba2022-03-10 12:12:59 +0000164 HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000165 GetPersActiveSwVersion() string
166 SetPersActiveSwVersion(string)
167 GetActiveImageVersion(context.Context) string
168 ModifySwImageInactiveVersion(context.Context, string)
169 ModifySwImageActiveCommit(context.Context, uint8)
170
171 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
172 FreeTcont(context.Context, uint16)
Holger Hildebrandtc56febd2022-02-09 13:23:30 +0000173
174 SendOnuDeviceEvent(context.Context, string, string)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000175}
176
177// IonuMetricsManager interface to onuMetricsManager
178type IonuMetricsManager interface {
179 AddGemPortForPerfMonitoring(context.Context, uint16)
180 RemoveGemPortForPerfMonitoring(context.Context, uint16)
181}
182
183// IonuAlarmManager interface to onuAlarmManager
184type IonuAlarmManager interface {
185 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
186 ResetAlarmUploadCounters()
187 GetAlarmMgrEventChannel() chan Message
188 GetAlarmUploadSeqNo() uint16
189 IncrementAlarmUploadSeqNo()
praneeth nalmas5a0a5502022-12-23 15:57:00 +0530190 GetOnuActiveAlarms(ctx context.Context) *extension.SingleGetValueResponse
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000191}
192
193// IonuUniTechProf interface to onuUniTechProf
194type IonuUniTechProf interface {
195 GetAllBidirectionalGemPortIDsForOnu() []uint16
Holger Hildebrandt5ba6c132022-10-06 13:53:14 +0000196 GetNumberOfConfiguredUsGemPorts(ctx context.Context) int
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000197 SetProfileToDelete(uint8, uint8, bool)
Akash Reddy Kankanalac28f0e22025-06-16 11:00:55 +0530198 GetGEMportToAllocIDMappingForONU(ctx context.Context, aDeviceID string) map[uint16]uint16
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000199}
200
201// IuniVlanConfigFsm interface to uniVlanConfigFsm
202type IuniVlanConfigFsm interface {
Holger Hildebrandtc192bc42021-10-28 14:38:31 +0000203 IsFlowRemovePending(context.Context, chan<- bool) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000204}
Joey Armstrong2283faa2023-06-22 17:53:59 -0400205
206// [EOF]