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) |
| 45 | } |
| 46 | |
| 47 | // IdeviceHandler interface to deviceHandler |
| 48 | type IdeviceHandler interface { |
| 49 | GetDeviceID() string |
| 50 | GetLogicalDeviceID() string |
| 51 | GetDevice() *voltha.Device |
| 52 | GetDeviceType() string |
| 53 | GetProxyAddressID() string |
| 54 | GetProxyAddressType() string |
| 55 | GetProxyAddress() *voltha.Device_ProxyAddress |
| 56 | GetEventProxy() eventif.EventProxy |
| 57 | GetOmciTimeout() int |
| 58 | GetAlarmAuditInterval() time.Duration |
| 59 | GetDlToOnuTimeout4M() time.Duration |
| 60 | GetUniEntityMap() *OnuUniPortMap |
| 61 | GetUniPortMask() int |
| 62 | GetPonPortNumber() *uint32 |
| 63 | GetOnuIndication() *openolt.OnuIndication |
| 64 | GetUniVlanConfigFsm(uint8) IuniVlanConfigFsm |
Holger Hildebrandt | 9afc158 | 2021-11-30 16:10:19 +0000 | [diff] [blame] | 65 | GetTechProfileInstanceFromParentAdapter(context.Context, uint8, string) (*ia.TechProfileDownloadMessage, error) |
Holger Hildebrandt | c572e62 | 2022-06-22 09:19:17 +0000 | [diff] [blame] | 66 | GetExtendedOmciSupportEnabled() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 67 | |
| 68 | GetDeviceReasonString() string |
mpagenko | e478208 | 2021-11-25 12:04:26 +0000 | [diff] [blame] | 69 | ReasonUpdate(context.Context, uint8, bool) error |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 70 | |
| 71 | GetCollectorIsRunning() bool |
Girish Gowdra | f7d82d0 | 2022-04-26 16:18:35 -0700 | [diff] [blame] | 72 | StartCollector(context.Context, *sync.WaitGroup) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 73 | InitPmConfigs() |
| 74 | GetPmConfigs() *voltha.PmConfigs |
| 75 | GetMetricsEnabled() bool |
| 76 | GetOnuMetricsManager() IonuMetricsManager |
| 77 | GetOnuAlarmManager() IonuAlarmManager |
| 78 | GetOnuTP() IonuUniTechProf |
| 79 | |
| 80 | GetAlarmManagerIsRunning(context.Context) bool |
| 81 | StartAlarmManager(context.Context) |
| 82 | |
Girish Gowdra | e95687a | 2021-09-08 16:30:58 -0700 | [diff] [blame] | 83 | GetFlowMonitoringIsRunning(uniID uint8) bool |
| 84 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 85 | CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool |
| 86 | |
| 87 | RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState) |
| 88 | DeviceProcStatusUpdate(context.Context, OnuDeviceEvent) |
| 89 | |
| 90 | SetReadyForOmciConfig(bool) |
| 91 | IsReadyForOmciConfig() bool |
Holger Hildebrandt | 2b10764 | 2022-12-09 07:56:23 +0000 | [diff] [blame] | 92 | IsOltAvailable() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 93 | |
| 94 | StorePersistentData(context.Context) error |
| 95 | StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error |
| 96 | |
| 97 | StartReconciling(context.Context, bool) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 98 | IsReconciling() bool |
| 99 | IsSkipOnuConfigReconciling() bool |
Holger Hildebrandt | 9afc158 | 2021-11-30 16:10:19 +0000 | [diff] [blame] | 100 | SetReconcilingReasonUpdate(bool) |
| 101 | IsReconcilingReasonUpdate() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 102 | PrepareReconcilingWithActiveAdapter(context.Context) |
Holger Hildebrandt | b314f44 | 2021-11-24 12:03:10 +0000 | [diff] [blame] | 103 | ReconcileDeviceTechProf(context.Context) bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 104 | ReconcileDeviceFlowConfig(context.Context) |
mpagenko | 101ac94 | 2021-11-16 15:01:29 +0000 | [diff] [blame] | 105 | GetReconcileExpiryVlanConfigAbort() time.Duration |
| 106 | SendChUniVlanConfigFinished(value uint16) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 107 | |
| 108 | VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8) |
| 109 | VerifyVlanConfigRequest(context.Context, uint8, uint8) |
| 110 | AddAllUniPorts(context.Context) |
| 111 | RemoveVlanFilterFsm(context.Context, *OnuUniPort) |
| 112 | |
| 113 | EnableUniPortStateUpdate(context.Context) |
| 114 | DisableUniPortStateUpdate(context.Context) |
| 115 | |
| 116 | SetBackend(context.Context, string) *db.Backend |
| 117 | GetBackendPathPrefix() string |
| 118 | |
| 119 | RLockMutexDeletionInProgressFlag() |
| 120 | RUnlockMutexDeletionInProgressFlag() |
| 121 | GetDeletionInProgress() bool |
| 122 | |
khenaidoo | 42dcdfd | 2021-10-19 17:34:12 -0400 | [diff] [blame] | 123 | SendOMCIRequest(context.Context, string, *ia.OmciMessage) error |
kesavand | 011d516 | 2021-11-25 19:21:06 +0530 | [diff] [blame] | 124 | SendOnuSwSectionsOfWindow(context.Context, string, *ia.OmciMessages) error |
| 125 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 126 | CreatePortInCore(context.Context, *voltha.Port) error |
Girish Gowdra | e95687a | 2021-09-08 16:30:58 -0700 | [diff] [blame] | 127 | |
| 128 | PerOnuFlowHandlerRoutine(uniID uint8) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | // IonuDeviceEntry interface to onuDeviceEntry |
| 132 | type IonuDeviceEntry interface { |
| 133 | GetDevOmciCC() *OmciCC |
| 134 | GetOnuDB() *devdb.OnuDeviceDB |
| 135 | GetPersSerialNumber() string |
| 136 | GetPersVendorID() string |
Holger Hildebrandt | 6a001d0 | 2022-06-15 08:32:48 +0000 | [diff] [blame] | 137 | GetPersVersion() string |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 138 | GetPersEquipmentID() string |
Holger Hildebrandt | 0edf5b0 | 2022-05-04 14:19:43 +0000 | [diff] [blame] | 139 | GetPersIsExtOmciSupported() bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 140 | |
| 141 | GetMibUploadFsmCommChan() chan Message |
| 142 | GetMibDownloadFsmCommChan() chan Message |
| 143 | |
| 144 | GetOmciRebootMsgRevChan() chan Message |
| 145 | WaitForRebootResponse(context.Context, chan Message) error |
| 146 | |
| 147 | IncrementMibDataSync(context.Context) |
| 148 | |
| 149 | GetActiveImageMeID(context.Context) (uint16, error) |
Holger Hildebrandt | fdb4bba | 2022-03-10 12:12:59 +0000 | [diff] [blame] | 150 | HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap) bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 151 | GetPersActiveSwVersion() string |
| 152 | SetPersActiveSwVersion(string) |
| 153 | GetActiveImageVersion(context.Context) string |
| 154 | ModifySwImageInactiveVersion(context.Context, string) |
| 155 | ModifySwImageActiveCommit(context.Context, uint8) |
| 156 | |
| 157 | AllocateFreeTcont(context.Context, uint16) (uint16, bool, error) |
| 158 | FreeTcont(context.Context, uint16) |
Holger Hildebrandt | c56febd | 2022-02-09 13:23:30 +0000 | [diff] [blame] | 159 | |
| 160 | SendOnuDeviceEvent(context.Context, string, string) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | // IonuMetricsManager interface to onuMetricsManager |
| 164 | type IonuMetricsManager interface { |
| 165 | AddGemPortForPerfMonitoring(context.Context, uint16) |
| 166 | RemoveGemPortForPerfMonitoring(context.Context, uint16) |
| 167 | } |
| 168 | |
| 169 | // IonuAlarmManager interface to onuAlarmManager |
| 170 | type IonuAlarmManager interface { |
| 171 | HandleOmciAlarmNotificationMessage(context.Context, OmciMessage) |
| 172 | ResetAlarmUploadCounters() |
| 173 | GetAlarmMgrEventChannel() chan Message |
| 174 | GetAlarmUploadSeqNo() uint16 |
| 175 | IncrementAlarmUploadSeqNo() |
praneeth nalmas | 5a0a550 | 2022-12-23 15:57:00 +0530 | [diff] [blame] | 176 | GetOnuActiveAlarms(ctx context.Context) *extension.SingleGetValueResponse |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | // IonuUniTechProf interface to onuUniTechProf |
| 180 | type IonuUniTechProf interface { |
| 181 | GetAllBidirectionalGemPortIDsForOnu() []uint16 |
Holger Hildebrandt | 5ba6c13 | 2022-10-06 13:53:14 +0000 | [diff] [blame] | 182 | GetNumberOfConfiguredUsGemPorts(ctx context.Context) int |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 183 | SetProfileToDelete(uint8, uint8, bool) |
| 184 | } |
| 185 | |
| 186 | // IuniVlanConfigFsm interface to uniVlanConfigFsm |
| 187 | type IuniVlanConfigFsm interface { |
Holger Hildebrandt | c192bc4 | 2021-10-28 14:38:31 +0000 | [diff] [blame] | 188 | IsFlowRemovePending(context.Context, chan<- bool) bool |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 189 | } |
Joey Armstrong | 2283faa | 2023-06-22 17:53:59 -0400 | [diff] [blame] | 190 | |
| 191 | // [EOF] |