blob: c56f8f8d192cb3ee46fa01a7c19f999de7a98181 [file] [log] [blame]
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +00001/*
Joey Armstronge8c091f2023-01-17 16:56:26 -05002 * Copyright 2020-2023 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
17//Package common provides global definitions
18package 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"
khenaidoo42dcdfd2021-10-19 17:34:12 -040029 ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000030 "github.com/opencord/voltha-protos/v5/go/openolt"
31 "github.com/opencord/voltha-protos/v5/go/voltha"
32)
33
34// IopenONUAC interface to openONUAC
35type 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
47type 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 Hildebrandt9afc1582021-11-30 16:10:19 +000064 GetTechProfileInstanceFromParentAdapter(context.Context, uint8, string) (*ia.TechProfileDownloadMessage, error)
Holger Hildebrandtc572e622022-06-22 09:19:17 +000065 GetExtendedOmciSupportEnabled() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000066
67 GetDeviceReasonString() string
mpagenkoe4782082021-11-25 12:04:26 +000068 ReasonUpdate(context.Context, uint8, bool) error
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000069
70 GetCollectorIsRunning() bool
Girish Gowdraf7d82d02022-04-26 16:18:35 -070071 StartCollector(context.Context, *sync.WaitGroup)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000072 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 Gowdrae95687a2021-09-08 16:30:58 -070082 GetFlowMonitoringIsRunning(uniID uint8) bool
83
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000084 CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool
85
86 RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState)
87 DeviceProcStatusUpdate(context.Context, OnuDeviceEvent)
88
89 SetReadyForOmciConfig(bool)
90 IsReadyForOmciConfig() bool
Holger Hildebrandt2b107642022-12-09 07:56:23 +000091 IsOltAvailable() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000092
93 StorePersistentData(context.Context) error
94 StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error
95
96 StartReconciling(context.Context, bool)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000097 IsReconciling() bool
98 IsSkipOnuConfigReconciling() bool
Holger Hildebrandt9afc1582021-11-30 16:10:19 +000099 SetReconcilingReasonUpdate(bool)
100 IsReconcilingReasonUpdate() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000101 PrepareReconcilingWithActiveAdapter(context.Context)
Holger Hildebrandtb314f442021-11-24 12:03:10 +0000102 ReconcileDeviceTechProf(context.Context) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000103 ReconcileDeviceFlowConfig(context.Context)
mpagenko101ac942021-11-16 15:01:29 +0000104 GetReconcileExpiryVlanConfigAbort() time.Duration
105 SendChUniVlanConfigFinished(value uint16)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000106
107 VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
108 VerifyVlanConfigRequest(context.Context, uint8, uint8)
109 AddAllUniPorts(context.Context)
110 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
111
112 EnableUniPortStateUpdate(context.Context)
113 DisableUniPortStateUpdate(context.Context)
114
115 SetBackend(context.Context, string) *db.Backend
116 GetBackendPathPrefix() string
117
118 RLockMutexDeletionInProgressFlag()
119 RUnlockMutexDeletionInProgressFlag()
120 GetDeletionInProgress() bool
121
khenaidoo42dcdfd2021-10-19 17:34:12 -0400122 SendOMCIRequest(context.Context, string, *ia.OmciMessage) error
kesavand011d5162021-11-25 19:21:06 +0530123 SendOnuSwSectionsOfWindow(context.Context, string, *ia.OmciMessages) error
124
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000125 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700126
127 PerOnuFlowHandlerRoutine(uniID uint8)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000128}
129
130// IonuDeviceEntry interface to onuDeviceEntry
131type IonuDeviceEntry interface {
132 GetDevOmciCC() *OmciCC
133 GetOnuDB() *devdb.OnuDeviceDB
134 GetPersSerialNumber() string
135 GetPersVendorID() string
Holger Hildebrandt6a001d02022-06-15 08:32:48 +0000136 GetPersVersion() string
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000137 GetPersEquipmentID() string
Holger Hildebrandt0edf5b02022-05-04 14:19:43 +0000138 GetPersIsExtOmciSupported() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000139
140 GetMibUploadFsmCommChan() chan Message
141 GetMibDownloadFsmCommChan() chan Message
142
143 GetOmciRebootMsgRevChan() chan Message
144 WaitForRebootResponse(context.Context, chan Message) error
145
146 IncrementMibDataSync(context.Context)
147
148 GetActiveImageMeID(context.Context) (uint16, error)
Holger Hildebrandtfdb4bba2022-03-10 12:12:59 +0000149 HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000150 GetPersActiveSwVersion() string
151 SetPersActiveSwVersion(string)
152 GetActiveImageVersion(context.Context) string
153 ModifySwImageInactiveVersion(context.Context, string)
154 ModifySwImageActiveCommit(context.Context, uint8)
155
156 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
157 FreeTcont(context.Context, uint16)
Holger Hildebrandtc56febd2022-02-09 13:23:30 +0000158
159 SendOnuDeviceEvent(context.Context, string, string)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000160}
161
162// IonuMetricsManager interface to onuMetricsManager
163type IonuMetricsManager interface {
164 AddGemPortForPerfMonitoring(context.Context, uint16)
165 RemoveGemPortForPerfMonitoring(context.Context, uint16)
166}
167
168// IonuAlarmManager interface to onuAlarmManager
169type IonuAlarmManager interface {
170 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
171 ResetAlarmUploadCounters()
172 GetAlarmMgrEventChannel() chan Message
173 GetAlarmUploadSeqNo() uint16
174 IncrementAlarmUploadSeqNo()
175}
176
177// IonuUniTechProf interface to onuUniTechProf
178type IonuUniTechProf interface {
179 GetAllBidirectionalGemPortIDsForOnu() []uint16
Holger Hildebrandt5ba6c132022-10-06 13:53:14 +0000180 GetNumberOfConfiguredUsGemPorts(ctx context.Context) int
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000181 SetProfileToDelete(uint8, uint8, bool)
182}
183
184// IuniVlanConfigFsm interface to uniVlanConfigFsm
185type IuniVlanConfigFsm interface {
Holger Hildebrandtc192bc42021-10-28 14:38:31 +0000186 IsFlowRemovePending(context.Context, chan<- bool) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000187}