blob: ce91062a687f31e0bd0e75a51087b502ed87a812 [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)
mpagenko101ac942021-11-16 15:01:29 +0000113 GetReconcileExpiryVlanConfigAbort() time.Duration
114 SendChUniVlanConfigFinished(value uint16)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000115
116 VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
117 VerifyVlanConfigRequest(context.Context, uint8, uint8)
118 AddAllUniPorts(context.Context)
119 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
120
121 EnableUniPortStateUpdate(context.Context)
122 DisableUniPortStateUpdate(context.Context)
123
124 SetBackend(context.Context, string) *db.Backend
125 GetBackendPathPrefix() string
126
127 RLockMutexDeletionInProgressFlag()
128 RUnlockMutexDeletionInProgressFlag()
129 GetDeletionInProgress() bool
130
khenaidoo42dcdfd2021-10-19 17:34:12 -0400131 SendOMCIRequest(context.Context, string, *ia.OmciMessage) error
kesavand011d5162021-11-25 19:21:06 +0530132 SendOnuSwSectionsOfWindow(context.Context, string, *ia.OmciMessages) error
133
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000134 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700135
136 PerOnuFlowHandlerRoutine(uniID uint8)
Praneeth Kumar Nalmasaacc6122024-04-09 22:55:49 +0530137 GetDeviceDeleteCommChan(context.Context) chan bool
Praneeth Kumar Nalmas77ab2f32024-04-17 11:14:27 +0530138 GetSkipOnuConfigEnabled() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000139}
140
141// IonuDeviceEntry interface to onuDeviceEntry
142type IonuDeviceEntry interface {
143 GetDevOmciCC() *OmciCC
144 GetOnuDB() *devdb.OnuDeviceDB
145 GetPersSerialNumber() string
146 GetPersVendorID() string
Holger Hildebrandt6a001d02022-06-15 08:32:48 +0000147 GetPersVersion() string
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000148 GetPersEquipmentID() string
Holger Hildebrandt0edf5b02022-05-04 14:19:43 +0000149 GetPersIsExtOmciSupported() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000150
151 GetMibUploadFsmCommChan() chan Message
152 GetMibDownloadFsmCommChan() chan Message
153
154 GetOmciRebootMsgRevChan() chan Message
155 WaitForRebootResponse(context.Context, chan Message) error
156
157 IncrementMibDataSync(context.Context)
158
159 GetActiveImageMeID(context.Context) (uint16, error)
Holger Hildebrandtfdb4bba2022-03-10 12:12:59 +0000160 HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000161 GetPersActiveSwVersion() string
162 SetPersActiveSwVersion(string)
163 GetActiveImageVersion(context.Context) string
164 ModifySwImageInactiveVersion(context.Context, string)
165 ModifySwImageActiveCommit(context.Context, uint8)
166
167 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
168 FreeTcont(context.Context, uint16)
Holger Hildebrandtc56febd2022-02-09 13:23:30 +0000169
170 SendOnuDeviceEvent(context.Context, string, string)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000171}
172
173// IonuMetricsManager interface to onuMetricsManager
174type IonuMetricsManager interface {
175 AddGemPortForPerfMonitoring(context.Context, uint16)
176 RemoveGemPortForPerfMonitoring(context.Context, uint16)
177}
178
179// IonuAlarmManager interface to onuAlarmManager
180type IonuAlarmManager interface {
181 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
182 ResetAlarmUploadCounters()
183 GetAlarmMgrEventChannel() chan Message
184 GetAlarmUploadSeqNo() uint16
185 IncrementAlarmUploadSeqNo()
praneeth nalmas5a0a5502022-12-23 15:57:00 +0530186 GetOnuActiveAlarms(ctx context.Context) *extension.SingleGetValueResponse
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000187}
188
189// IonuUniTechProf interface to onuUniTechProf
190type IonuUniTechProf interface {
191 GetAllBidirectionalGemPortIDsForOnu() []uint16
Holger Hildebrandt5ba6c132022-10-06 13:53:14 +0000192 GetNumberOfConfiguredUsGemPorts(ctx context.Context) int
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000193 SetProfileToDelete(uint8, uint8, bool)
194}
195
196// IuniVlanConfigFsm interface to uniVlanConfigFsm
197type IuniVlanConfigFsm interface {
Holger Hildebrandtc192bc42021-10-28 14:38:31 +0000198 IsFlowRemovePending(context.Context, chan<- bool) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000199}
Joey Armstrong2283faa2023-06-22 17:53:59 -0400200
201// [EOF]