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