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" |
| 22 | "time" |
| 23 | |
| 24 | //"github.com/opencord/voltha-lib-go/v5/pkg/adapters/adapterif" |
| 25 | "github.com/opencord/voltha-lib-go/v7/pkg/db" |
| 26 | "github.com/opencord/voltha-lib-go/v7/pkg/events/eventif" |
| 27 | "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/devdb" |
| 28 | ic "github.com/opencord/voltha-protos/v5/go/inter_container" |
| 29 | "github.com/opencord/voltha-protos/v5/go/openolt" |
| 30 | "github.com/opencord/voltha-protos/v5/go/voltha" |
| 31 | ) |
| 32 | |
| 33 | // IopenONUAC interface to openONUAC |
| 34 | type IopenONUAC interface { |
| 35 | GetSupportedFsms() *OmciDeviceFsms |
| 36 | LockMutexMibTemplateGenerated() |
| 37 | UnlockMutexMibTemplateGenerated() |
| 38 | GetMibTemplatesGenerated(string) (bool, bool) |
| 39 | SetMibTemplatesGenerated(string, bool) |
| 40 | RLockMutexDeviceHandlersMap() |
| 41 | RUnlockMutexDeviceHandlersMap() |
| 42 | GetDeviceHandler(string) (IdeviceHandler, bool) |
| 43 | } |
| 44 | |
| 45 | // IdeviceHandler interface to deviceHandler |
| 46 | type IdeviceHandler interface { |
| 47 | GetDeviceID() string |
| 48 | GetLogicalDeviceID() string |
| 49 | GetDevice() *voltha.Device |
| 50 | GetDeviceType() string |
| 51 | GetProxyAddressID() string |
| 52 | GetProxyAddressType() string |
| 53 | GetProxyAddress() *voltha.Device_ProxyAddress |
| 54 | GetEventProxy() eventif.EventProxy |
| 55 | GetOmciTimeout() int |
| 56 | GetAlarmAuditInterval() time.Duration |
| 57 | GetDlToOnuTimeout4M() time.Duration |
| 58 | GetUniEntityMap() *OnuUniPortMap |
| 59 | GetUniPortMask() int |
| 60 | GetPonPortNumber() *uint32 |
| 61 | GetOnuIndication() *openolt.OnuIndication |
| 62 | GetUniVlanConfigFsm(uint8) IuniVlanConfigFsm |
| 63 | |
| 64 | GetDeviceReasonString() string |
| 65 | SetDeviceReason(uint8) |
| 66 | |
| 67 | GetCollectorIsRunning() bool |
| 68 | StartCollector(context.Context) |
| 69 | InitPmConfigs() |
| 70 | GetPmConfigs() *voltha.PmConfigs |
| 71 | GetMetricsEnabled() bool |
| 72 | GetOnuMetricsManager() IonuMetricsManager |
| 73 | GetOnuAlarmManager() IonuAlarmManager |
| 74 | GetOnuTP() IonuUniTechProf |
| 75 | |
| 76 | GetAlarmManagerIsRunning(context.Context) bool |
| 77 | StartAlarmManager(context.Context) |
| 78 | |
Girish Gowdra | e95687a | 2021-09-08 16:30:58 -0700 | [diff] [blame^] | 79 | GetFlowMonitoringIsRunning(uniID uint8) bool |
| 80 | |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 81 | CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool |
| 82 | |
| 83 | RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState) |
| 84 | DeviceProcStatusUpdate(context.Context, OnuDeviceEvent) |
| 85 | |
| 86 | SetReadyForOmciConfig(bool) |
| 87 | IsReadyForOmciConfig() bool |
| 88 | |
| 89 | StorePersistentData(context.Context) error |
| 90 | StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error |
| 91 | |
| 92 | StartReconciling(context.Context, bool) |
| 93 | StopReconciling(context.Context, bool) |
| 94 | IsReconciling() bool |
| 95 | IsSkipOnuConfigReconciling() bool |
| 96 | PrepareReconcilingWithActiveAdapter(context.Context) |
| 97 | ReconcileDeviceTechProf(context.Context) |
| 98 | ReconcileDeviceFlowConfig(context.Context) |
| 99 | |
| 100 | VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8) |
| 101 | VerifyVlanConfigRequest(context.Context, uint8, uint8) |
| 102 | AddAllUniPorts(context.Context) |
| 103 | RemoveVlanFilterFsm(context.Context, *OnuUniPort) |
| 104 | |
| 105 | EnableUniPortStateUpdate(context.Context) |
| 106 | DisableUniPortStateUpdate(context.Context) |
| 107 | |
| 108 | SetBackend(context.Context, string) *db.Backend |
| 109 | GetBackendPathPrefix() string |
| 110 | |
| 111 | RLockMutexDeletionInProgressFlag() |
| 112 | RUnlockMutexDeletionInProgressFlag() |
| 113 | GetDeletionInProgress() bool |
| 114 | |
| 115 | SendOMCIRequest(context.Context, string, *ic.OmciMessage) error |
| 116 | CreatePortInCore(context.Context, *voltha.Port) error |
Girish Gowdra | e95687a | 2021-09-08 16:30:58 -0700 | [diff] [blame^] | 117 | |
| 118 | PerOnuFlowHandlerRoutine(uniID uint8) |
Holger Hildebrandt | 4b5e73f | 2021-08-19 06:51:21 +0000 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | // IonuDeviceEntry interface to onuDeviceEntry |
| 122 | type IonuDeviceEntry interface { |
| 123 | GetDevOmciCC() *OmciCC |
| 124 | GetOnuDB() *devdb.OnuDeviceDB |
| 125 | GetPersSerialNumber() string |
| 126 | GetPersVendorID() string |
| 127 | GetPersEquipmentID() string |
| 128 | |
| 129 | GetMibUploadFsmCommChan() chan Message |
| 130 | GetMibDownloadFsmCommChan() chan Message |
| 131 | |
| 132 | GetOmciRebootMsgRevChan() chan Message |
| 133 | WaitForRebootResponse(context.Context, chan Message) error |
| 134 | |
| 135 | IncrementMibDataSync(context.Context) |
| 136 | |
| 137 | GetActiveImageMeID(context.Context) (uint16, error) |
| 138 | LockMutexOnuSwImageIndications() |
| 139 | UnlockMutexOnuSwImageIndications() |
| 140 | GetOnuSwImageIndications() SswImageIndications |
| 141 | SetOnuSwImageIndications(SswImageIndications) |
| 142 | GetPersActiveSwVersion() string |
| 143 | SetPersActiveSwVersion(string) |
| 144 | GetActiveImageVersion(context.Context) string |
| 145 | ModifySwImageInactiveVersion(context.Context, string) |
| 146 | ModifySwImageActiveCommit(context.Context, uint8) |
| 147 | |
| 148 | AllocateFreeTcont(context.Context, uint16) (uint16, bool, error) |
| 149 | FreeTcont(context.Context, uint16) |
| 150 | |
| 151 | LockMutexPersOnuConfig() |
| 152 | UnlockMutexPersOnuConfig() |
| 153 | |
| 154 | SetReconcilingFlows(bool) |
| 155 | SetChReconcilingFlowsFinished(bool) |
| 156 | } |
| 157 | |
| 158 | // IonuMetricsManager interface to onuMetricsManager |
| 159 | type IonuMetricsManager interface { |
| 160 | AddGemPortForPerfMonitoring(context.Context, uint16) |
| 161 | RemoveGemPortForPerfMonitoring(context.Context, uint16) |
| 162 | } |
| 163 | |
| 164 | // IonuAlarmManager interface to onuAlarmManager |
| 165 | type IonuAlarmManager interface { |
| 166 | HandleOmciAlarmNotificationMessage(context.Context, OmciMessage) |
| 167 | ResetAlarmUploadCounters() |
| 168 | GetAlarmMgrEventChannel() chan Message |
| 169 | GetAlarmUploadSeqNo() uint16 |
| 170 | IncrementAlarmUploadSeqNo() |
| 171 | } |
| 172 | |
| 173 | // IonuUniTechProf interface to onuUniTechProf |
| 174 | type IonuUniTechProf interface { |
| 175 | GetAllBidirectionalGemPortIDsForOnu() []uint16 |
| 176 | SetProfileToDelete(uint8, uint8, bool) |
| 177 | } |
| 178 | |
| 179 | // IuniVlanConfigFsm interface to uniVlanConfigFsm |
| 180 | type IuniVlanConfigFsm interface { |
| 181 | IsFlowRemovePending(chan<- bool) bool |
| 182 | } |