Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 1 | /* |
Joey Armstrong | 89c812c | 2024-01-12 19:00:20 -0500 | [diff] [blame] | 2 | * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 3 | * |
| 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 nalmas | 5a0a550 | 2022-12-23 15:57:00 +0530 | [diff] [blame] | 17 | // Package common provides global definitions |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 18 | package common |
| 19 | |
| 20 | import ( |
| 21 | "context" |
Girish Gowdra | f7d82d0 | 2022-04-26 16:18:35 -0700 | [diff] [blame] | 22 | "sync" |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 23 | "time" |
| 24 | |
Holger Hildebrandt | 94688c7 | 2021-12-17 12:13:02 +0000 | [diff] [blame] | 25 | me "github.com/opencord/omci-lib-go/v2/generated" |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 26 | "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 nalmas | 5a0a550 | 2022-12-23 15:57:00 +0530 | [diff] [blame] | 29 | "github.com/opencord/voltha-protos/v5/go/extension" |
khenaidoo | 42dcdfd | 2021-10-19 17:34:12 -0400 | [diff] [blame] | 30 | ia "github.com/opencord/voltha-protos/v5/go/inter_adapter" |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 31 | "github.com/opencord/voltha-protos/v5/go/openolt" |
| 32 | "github.com/opencord/voltha-protos/v5/go/voltha" |
| 33 | ) |
| 34 | |
| 35 | // IopenONUAC interface to openONUAC |
| 36 | type 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 Nalmas | 8f8f0c0 | 2024-10-22 19:29:09 +0530 | [diff] [blame] | 45 | 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 Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | // IdeviceHandler interface to deviceHandler |
| 56 | type 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 Hildebrandt | 9afc158 | 2021-11-30 16:10:19 +0000 | [diff] [blame] | 73 | GetTechProfileInstanceFromParentAdapter(context.Context, uint8, string) (*ia.TechProfileDownloadMessage, error) |
Holger Hildebrandt | c572e62 | 2022-06-22 09:19:17 +0000 | [diff] [blame] | 74 | GetExtendedOmciSupportEnabled() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 75 | |
| 76 | GetDeviceReasonString() string |
mpagenko | e478208 | 2021-11-25 12:04:26 +0000 | [diff] [blame] | 77 | ReasonUpdate(context.Context, uint8, bool) error |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 78 | |
| 79 | GetCollectorIsRunning() bool |
Girish Gowdra | f7d82d0 | 2022-04-26 16:18:35 -0700 | [diff] [blame] | 80 | StartCollector(context.Context, *sync.WaitGroup) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 81 | 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 Gowdra | e95687a | 2021-09-08 16:30:58 -0700 | [diff] [blame] | 91 | GetFlowMonitoringIsRunning(uniID uint8) bool |
| 92 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 93 | 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 Hildebrandt | 2b10764 | 2022-12-09 07:56:23 +0000 | [diff] [blame] | 100 | IsOltAvailable() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 101 | |
| 102 | StorePersistentData(context.Context) error |
| 103 | StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error |
| 104 | |
| 105 | StartReconciling(context.Context, bool) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 106 | IsReconciling() bool |
| 107 | IsSkipOnuConfigReconciling() bool |
Holger Hildebrandt | 9afc158 | 2021-11-30 16:10:19 +0000 | [diff] [blame] | 108 | SetReconcilingReasonUpdate(bool) |
| 109 | IsReconcilingReasonUpdate() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 110 | PrepareReconcilingWithActiveAdapter(context.Context) |
Holger Hildebrandt | b314f44 | 2021-11-24 12:03:10 +0000 | [diff] [blame] | 111 | ReconcileDeviceTechProf(context.Context) bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 112 | ReconcileDeviceFlowConfig(context.Context) |
mpagenko | 101ac94 | 2021-11-16 15:01:29 +0000 | [diff] [blame] | 113 | GetReconcileExpiryVlanConfigAbort() time.Duration |
| 114 | SendChUniVlanConfigFinished(value uint16) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 115 | |
| 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 | |
khenaidoo | 42dcdfd | 2021-10-19 17:34:12 -0400 | [diff] [blame] | 131 | SendOMCIRequest(context.Context, string, *ia.OmciMessage) error |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 132 | SendOnuSwSectionsOfWindow(context.Context, string, *ia.OmciMessages) error |
| 133 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 134 | CreatePortInCore(context.Context, *voltha.Port) error |
Girish Gowdra | e95687a | 2021-09-08 16:30:58 -0700 | [diff] [blame] | 135 | |
| 136 | PerOnuFlowHandlerRoutine(uniID uint8) |
Praneeth Kumar Nalmas | aacc612 | 2024-04-09 22:55:49 +0530 | [diff] [blame] | 137 | GetDeviceDeleteCommChan(context.Context) chan bool |
Praneeth Kumar Nalmas | 77ab2f3 | 2024-04-17 11:14:27 +0530 | [diff] [blame] | 138 | GetSkipOnuConfigEnabled() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | // IonuDeviceEntry interface to onuDeviceEntry |
| 142 | type IonuDeviceEntry interface { |
| 143 | GetDevOmciCC() *OmciCC |
| 144 | GetOnuDB() *devdb.OnuDeviceDB |
| 145 | GetPersSerialNumber() string |
| 146 | GetPersVendorID() string |
Holger Hildebrandt | 6a001d0 | 2022-06-15 08:32:48 +0000 | [diff] [blame] | 147 | GetPersVersion() string |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 148 | GetPersEquipmentID() string |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 149 | GetPersIsExtOmciSupported() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 150 | |
| 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 Hildebrandt | fdb4bba | 2022-03-10 12:12:59 +0000 | [diff] [blame] | 160 | HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap) bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 161 | 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 Hildebrandt | c56febd | 2022-02-09 13:23:30 +0000 | [diff] [blame] | 169 | |
| 170 | SendOnuDeviceEvent(context.Context, string, string) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | // IonuMetricsManager interface to onuMetricsManager |
| 174 | type IonuMetricsManager interface { |
| 175 | AddGemPortForPerfMonitoring(context.Context, uint16) |
| 176 | RemoveGemPortForPerfMonitoring(context.Context, uint16) |
| 177 | } |
| 178 | |
| 179 | // IonuAlarmManager interface to onuAlarmManager |
| 180 | type IonuAlarmManager interface { |
| 181 | HandleOmciAlarmNotificationMessage(context.Context, OmciMessage) |
| 182 | ResetAlarmUploadCounters() |
| 183 | GetAlarmMgrEventChannel() chan Message |
| 184 | GetAlarmUploadSeqNo() uint16 |
| 185 | IncrementAlarmUploadSeqNo() |
praneeth nalmas | 5a0a550 | 2022-12-23 15:57:00 +0530 | [diff] [blame] | 186 | GetOnuActiveAlarms(ctx context.Context) *extension.SingleGetValueResponse |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | // IonuUniTechProf interface to onuUniTechProf |
| 190 | type IonuUniTechProf interface { |
| 191 | GetAllBidirectionalGemPortIDsForOnu() []uint16 |
Holger Hildebrandt | 5ba6c13 | 2022-10-06 13:53:14 +0000 | [diff] [blame] | 192 | GetNumberOfConfiguredUsGemPorts(ctx context.Context) int |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 193 | SetProfileToDelete(uint8, uint8, bool) |
| 194 | } |
| 195 | |
| 196 | // IuniVlanConfigFsm interface to uniVlanConfigFsm |
| 197 | type IuniVlanConfigFsm interface { |
Holger Hildebrandt | c192bc4 | 2021-10-28 14:38:31 +0000 | [diff] [blame] | 198 | IsFlowRemovePending(context.Context, chan<- bool) bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 199 | } |
Joey Armstrong | 2283faa | 2023-06-22 17:53:59 -0400 | [diff] [blame] | 200 | |
| 201 | // [EOF] |