blob: a204539bf851e4d0150f866e6b3c585ec50357d1 [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"
22 "time"
23
Holger Hildebrandt94688c72021-12-17 12:13:02 +000024 me "github.com/opencord/omci-lib-go/v2/generated"
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000025 "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"
khenaidoo42dcdfd2021-10-19 17:34:12 -040028 ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000029 "github.com/opencord/voltha-protos/v5/go/openolt"
30 "github.com/opencord/voltha-protos/v5/go/voltha"
31)
32
33// IopenONUAC interface to openONUAC
34type 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
46type 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
Holger Hildebrandt9afc1582021-11-30 16:10:19 +000063 GetTechProfileInstanceFromParentAdapter(context.Context, uint8, string) (*ia.TechProfileDownloadMessage, error)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000064
65 GetDeviceReasonString() string
mpagenkoe4782082021-11-25 12:04:26 +000066 ReasonUpdate(context.Context, uint8, bool) error
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000067
68 GetCollectorIsRunning() bool
69 StartCollector(context.Context)
70 InitPmConfigs()
71 GetPmConfigs() *voltha.PmConfigs
72 GetMetricsEnabled() bool
73 GetOnuMetricsManager() IonuMetricsManager
74 GetOnuAlarmManager() IonuAlarmManager
75 GetOnuTP() IonuUniTechProf
76
77 GetAlarmManagerIsRunning(context.Context) bool
78 StartAlarmManager(context.Context)
79
Girish Gowdrae95687a2021-09-08 16:30:58 -070080 GetFlowMonitoringIsRunning(uniID uint8) bool
81
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000082 CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool
83
84 RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState)
85 DeviceProcStatusUpdate(context.Context, OnuDeviceEvent)
86
87 SetReadyForOmciConfig(bool)
88 IsReadyForOmciConfig() bool
89
90 StorePersistentData(context.Context) error
91 StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error
92
93 StartReconciling(context.Context, bool)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000094 IsReconciling() bool
95 IsSkipOnuConfigReconciling() bool
Holger Hildebrandt9afc1582021-11-30 16:10:19 +000096 SetReconcilingReasonUpdate(bool)
97 IsReconcilingReasonUpdate() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000098 PrepareReconcilingWithActiveAdapter(context.Context)
Holger Hildebrandtb314f442021-11-24 12:03:10 +000099 ReconcileDeviceTechProf(context.Context) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000100 ReconcileDeviceFlowConfig(context.Context)
mpagenko101ac942021-11-16 15:01:29 +0000101 GetReconcileExpiryVlanConfigAbort() time.Duration
102 SendChUniVlanConfigFinished(value uint16)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000103
104 VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
105 VerifyVlanConfigRequest(context.Context, uint8, uint8)
106 AddAllUniPorts(context.Context)
107 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
108
109 EnableUniPortStateUpdate(context.Context)
110 DisableUniPortStateUpdate(context.Context)
111
112 SetBackend(context.Context, string) *db.Backend
113 GetBackendPathPrefix() string
114
115 RLockMutexDeletionInProgressFlag()
116 RUnlockMutexDeletionInProgressFlag()
117 GetDeletionInProgress() bool
118
khenaidoo42dcdfd2021-10-19 17:34:12 -0400119 SendOMCIRequest(context.Context, string, *ia.OmciMessage) error
kesavand011d5162021-11-25 19:21:06 +0530120 SendOnuSwSectionsOfWindow(context.Context, string, *ia.OmciMessages) error
121
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000122 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700123
124 PerOnuFlowHandlerRoutine(uniID uint8)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000125}
126
127// IonuDeviceEntry interface to onuDeviceEntry
128type IonuDeviceEntry interface {
129 GetDevOmciCC() *OmciCC
130 GetOnuDB() *devdb.OnuDeviceDB
131 GetPersSerialNumber() string
132 GetPersVendorID() string
133 GetPersEquipmentID() string
134
135 GetMibUploadFsmCommChan() chan Message
136 GetMibDownloadFsmCommChan() chan Message
137
138 GetOmciRebootMsgRevChan() chan Message
139 WaitForRebootResponse(context.Context, chan Message) error
140
141 IncrementMibDataSync(context.Context)
142
143 GetActiveImageMeID(context.Context) (uint16, error)
Holger Hildebrandt94688c72021-12-17 12:13:02 +0000144 HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000145 GetPersActiveSwVersion() string
146 SetPersActiveSwVersion(string)
147 GetActiveImageVersion(context.Context) string
148 ModifySwImageInactiveVersion(context.Context, string)
149 ModifySwImageActiveCommit(context.Context, uint8)
150
151 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
152 FreeTcont(context.Context, uint16)
Holger Hildebrandtc56febd2022-02-09 13:23:30 +0000153
154 SendOnuDeviceEvent(context.Context, string, string)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000155}
156
157// IonuMetricsManager interface to onuMetricsManager
158type IonuMetricsManager interface {
159 AddGemPortForPerfMonitoring(context.Context, uint16)
160 RemoveGemPortForPerfMonitoring(context.Context, uint16)
161}
162
163// IonuAlarmManager interface to onuAlarmManager
164type IonuAlarmManager interface {
165 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
166 ResetAlarmUploadCounters()
167 GetAlarmMgrEventChannel() chan Message
168 GetAlarmUploadSeqNo() uint16
169 IncrementAlarmUploadSeqNo()
170}
171
172// IonuUniTechProf interface to onuUniTechProf
173type IonuUniTechProf interface {
174 GetAllBidirectionalGemPortIDsForOnu() []uint16
175 SetProfileToDelete(uint8, uint8, bool)
176}
177
178// IuniVlanConfigFsm interface to uniVlanConfigFsm
179type IuniVlanConfigFsm interface {
Holger Hildebrandtc192bc42021-10-28 14:38:31 +0000180 IsFlowRemovePending(context.Context, chan<- bool) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000181}