blob: e1cc2ecdce82d77470efc8387b9dd198945fd8ae [file] [log] [blame]
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +00001/*
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
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 Hildebrandt4b5e73f2021-08-19 06:51:21 +000065
66 GetDeviceReasonString() string
mpagenkoe4782082021-11-25 12:04:26 +000067 ReasonUpdate(context.Context, uint8, bool) error
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000068
69 GetCollectorIsRunning() bool
Girish Gowdraf7d82d02022-04-26 16:18:35 -070070 StartCollector(context.Context, *sync.WaitGroup)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000071 InitPmConfigs()
72 GetPmConfigs() *voltha.PmConfigs
73 GetMetricsEnabled() bool
74 GetOnuMetricsManager() IonuMetricsManager
75 GetOnuAlarmManager() IonuAlarmManager
76 GetOnuTP() IonuUniTechProf
77
78 GetAlarmManagerIsRunning(context.Context) bool
79 StartAlarmManager(context.Context)
80
Girish Gowdrae95687a2021-09-08 16:30:58 -070081 GetFlowMonitoringIsRunning(uniID uint8) bool
82
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000083 CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool
84
85 RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState)
86 DeviceProcStatusUpdate(context.Context, OnuDeviceEvent)
87
88 SetReadyForOmciConfig(bool)
89 IsReadyForOmciConfig() bool
90
91 StorePersistentData(context.Context) error
92 StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error
93
94 StartReconciling(context.Context, bool)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000095 IsReconciling() bool
96 IsSkipOnuConfigReconciling() bool
Holger Hildebrandt9afc1582021-11-30 16:10:19 +000097 SetReconcilingReasonUpdate(bool)
98 IsReconcilingReasonUpdate() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000099 PrepareReconcilingWithActiveAdapter(context.Context)
Holger Hildebrandtb314f442021-11-24 12:03:10 +0000100 ReconcileDeviceTechProf(context.Context) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000101 ReconcileDeviceFlowConfig(context.Context)
mpagenko101ac942021-11-16 15:01:29 +0000102 GetReconcileExpiryVlanConfigAbort() time.Duration
103 SendChUniVlanConfigFinished(value uint16)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000104
105 VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
106 VerifyVlanConfigRequest(context.Context, uint8, uint8)
107 AddAllUniPorts(context.Context)
108 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
109
110 EnableUniPortStateUpdate(context.Context)
111 DisableUniPortStateUpdate(context.Context)
112
113 SetBackend(context.Context, string) *db.Backend
114 GetBackendPathPrefix() string
115
116 RLockMutexDeletionInProgressFlag()
117 RUnlockMutexDeletionInProgressFlag()
118 GetDeletionInProgress() bool
119
khenaidoo42dcdfd2021-10-19 17:34:12 -0400120 SendOMCIRequest(context.Context, string, *ia.OmciMessage) error
kesavand011d5162021-11-25 19:21:06 +0530121 SendOnuSwSectionsOfWindow(context.Context, string, *ia.OmciMessages) error
122
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000123 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700124
125 PerOnuFlowHandlerRoutine(uniID uint8)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000126}
127
128// IonuDeviceEntry interface to onuDeviceEntry
129type IonuDeviceEntry interface {
130 GetDevOmciCC() *OmciCC
131 GetOnuDB() *devdb.OnuDeviceDB
132 GetPersSerialNumber() string
133 GetPersVendorID() string
134 GetPersEquipmentID() string
Holger Hildebrandt0edf5b02022-05-04 14:19:43 +0000135 GetPersIsExtOmciSupported() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000136
137 GetMibUploadFsmCommChan() chan Message
138 GetMibDownloadFsmCommChan() chan Message
139
140 GetOmciRebootMsgRevChan() chan Message
141 WaitForRebootResponse(context.Context, chan Message) error
142
143 IncrementMibDataSync(context.Context)
144
145 GetActiveImageMeID(context.Context) (uint16, error)
Holger Hildebrandtfdb4bba2022-03-10 12:12:59 +0000146 HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000147 GetPersActiveSwVersion() string
148 SetPersActiveSwVersion(string)
149 GetActiveImageVersion(context.Context) string
150 ModifySwImageInactiveVersion(context.Context, string)
151 ModifySwImageActiveCommit(context.Context, uint8)
152
153 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
154 FreeTcont(context.Context, uint16)
Holger Hildebrandtc56febd2022-02-09 13:23:30 +0000155
156 SendOnuDeviceEvent(context.Context, string, string)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000157}
158
159// IonuMetricsManager interface to onuMetricsManager
160type IonuMetricsManager interface {
161 AddGemPortForPerfMonitoring(context.Context, uint16)
162 RemoveGemPortForPerfMonitoring(context.Context, uint16)
163}
164
165// IonuAlarmManager interface to onuAlarmManager
166type IonuAlarmManager interface {
167 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
168 ResetAlarmUploadCounters()
169 GetAlarmMgrEventChannel() chan Message
170 GetAlarmUploadSeqNo() uint16
171 IncrementAlarmUploadSeqNo()
172}
173
174// IonuUniTechProf interface to onuUniTechProf
175type IonuUniTechProf interface {
176 GetAllBidirectionalGemPortIDsForOnu() []uint16
177 SetProfileToDelete(uint8, uint8, bool)
178}
179
180// IuniVlanConfigFsm interface to uniVlanConfigFsm
181type IuniVlanConfigFsm interface {
Holger Hildebrandtc192bc42021-10-28 14:38:31 +0000182 IsFlowRemovePending(context.Context, chan<- bool) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000183}