blob: e761a3dc8a95bfc90abb5c0915ab08fbbf786d8a [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)
Akash Soni3de0e062024-12-11 16:37:26 +0530118 HandleAniConfigFSMFailure(ctx context.Context, uniID uint8)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000119 AddAllUniPorts(context.Context)
120 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
121
122 EnableUniPortStateUpdate(context.Context)
123 DisableUniPortStateUpdate(context.Context)
124
125 SetBackend(context.Context, string) *db.Backend
126 GetBackendPathPrefix() string
127
128 RLockMutexDeletionInProgressFlag()
129 RUnlockMutexDeletionInProgressFlag()
130 GetDeletionInProgress() bool
131
khenaidoo42dcdfd2021-10-19 17:34:12 -0400132 SendOMCIRequest(context.Context, string, *ia.OmciMessage) error
kesavand011d5162021-11-25 19:21:06 +0530133 SendOnuSwSectionsOfWindow(context.Context, string, *ia.OmciMessages) error
134
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000135 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700136
137 PerOnuFlowHandlerRoutine(uniID uint8)
Praneeth Kumar Nalmasaacc6122024-04-09 22:55:49 +0530138 GetDeviceDeleteCommChan(context.Context) chan bool
Praneeth Kumar Nalmas77ab2f32024-04-17 11:14:27 +0530139 GetSkipOnuConfigEnabled() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000140}
141
142// IonuDeviceEntry interface to onuDeviceEntry
143type IonuDeviceEntry interface {
144 GetDevOmciCC() *OmciCC
145 GetOnuDB() *devdb.OnuDeviceDB
146 GetPersSerialNumber() string
147 GetPersVendorID() string
Holger Hildebrandt6a001d02022-06-15 08:32:48 +0000148 GetPersVersion() string
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000149 GetPersEquipmentID() string
Holger Hildebrandt0edf5b02022-05-04 14:19:43 +0000150 GetPersIsExtOmciSupported() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000151
152 GetMibUploadFsmCommChan() chan Message
153 GetMibDownloadFsmCommChan() chan Message
154
155 GetOmciRebootMsgRevChan() chan Message
156 WaitForRebootResponse(context.Context, chan Message) error
157
158 IncrementMibDataSync(context.Context)
159
160 GetActiveImageMeID(context.Context) (uint16, error)
Holger Hildebrandtfdb4bba2022-03-10 12:12:59 +0000161 HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000162 GetPersActiveSwVersion() string
163 SetPersActiveSwVersion(string)
164 GetActiveImageVersion(context.Context) string
165 ModifySwImageInactiveVersion(context.Context, string)
166 ModifySwImageActiveCommit(context.Context, uint8)
167
168 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
169 FreeTcont(context.Context, uint16)
Holger Hildebrandtc56febd2022-02-09 13:23:30 +0000170
171 SendOnuDeviceEvent(context.Context, string, string)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000172}
173
174// IonuMetricsManager interface to onuMetricsManager
175type IonuMetricsManager interface {
176 AddGemPortForPerfMonitoring(context.Context, uint16)
177 RemoveGemPortForPerfMonitoring(context.Context, uint16)
178}
179
180// IonuAlarmManager interface to onuAlarmManager
181type IonuAlarmManager interface {
182 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
183 ResetAlarmUploadCounters()
184 GetAlarmMgrEventChannel() chan Message
185 GetAlarmUploadSeqNo() uint16
186 IncrementAlarmUploadSeqNo()
praneeth nalmas5a0a5502022-12-23 15:57:00 +0530187 GetOnuActiveAlarms(ctx context.Context) *extension.SingleGetValueResponse
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000188}
189
190// IonuUniTechProf interface to onuUniTechProf
191type IonuUniTechProf interface {
192 GetAllBidirectionalGemPortIDsForOnu() []uint16
Holger Hildebrandt5ba6c132022-10-06 13:53:14 +0000193 GetNumberOfConfiguredUsGemPorts(ctx context.Context) int
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000194 SetProfileToDelete(uint8, uint8, bool)
195}
196
197// IuniVlanConfigFsm interface to uniVlanConfigFsm
198type IuniVlanConfigFsm interface {
Holger Hildebrandtc192bc42021-10-28 14:38:31 +0000199 IsFlowRemovePending(context.Context, chan<- bool) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000200}
Joey Armstrong2283faa2023-06-22 17:53:59 -0400201
202// [EOF]