blob: 39b37ba0e6cf34bec303684943b05ff201fee830 [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
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000120 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700121
122 PerOnuFlowHandlerRoutine(uniID uint8)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000123}
124
125// IonuDeviceEntry interface to onuDeviceEntry
126type IonuDeviceEntry interface {
127 GetDevOmciCC() *OmciCC
128 GetOnuDB() *devdb.OnuDeviceDB
129 GetPersSerialNumber() string
130 GetPersVendorID() string
131 GetPersEquipmentID() string
132
133 GetMibUploadFsmCommChan() chan Message
134 GetMibDownloadFsmCommChan() chan Message
135
136 GetOmciRebootMsgRevChan() chan Message
137 WaitForRebootResponse(context.Context, chan Message) error
138
139 IncrementMibDataSync(context.Context)
140
141 GetActiveImageMeID(context.Context) (uint16, error)
Holger Hildebrandt94688c72021-12-17 12:13:02 +0000142 HandleSwImageIndications(context.Context, uint16, me.AttributeValueMap)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000143 GetPersActiveSwVersion() string
144 SetPersActiveSwVersion(string)
145 GetActiveImageVersion(context.Context) string
146 ModifySwImageInactiveVersion(context.Context, string)
147 ModifySwImageActiveCommit(context.Context, uint8)
148
149 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
150 FreeTcont(context.Context, uint16)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000151}
152
153// IonuMetricsManager interface to onuMetricsManager
154type IonuMetricsManager interface {
155 AddGemPortForPerfMonitoring(context.Context, uint16)
156 RemoveGemPortForPerfMonitoring(context.Context, uint16)
157}
158
159// IonuAlarmManager interface to onuAlarmManager
160type IonuAlarmManager interface {
161 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
162 ResetAlarmUploadCounters()
163 GetAlarmMgrEventChannel() chan Message
164 GetAlarmUploadSeqNo() uint16
165 IncrementAlarmUploadSeqNo()
166}
167
168// IonuUniTechProf interface to onuUniTechProf
169type IonuUniTechProf interface {
170 GetAllBidirectionalGemPortIDsForOnu() []uint16
171 SetProfileToDelete(uint8, uint8, bool)
172}
173
174// IuniVlanConfigFsm interface to uniVlanConfigFsm
175type IuniVlanConfigFsm interface {
Holger Hildebrandtc192bc42021-10-28 14:38:31 +0000176 IsFlowRemovePending(context.Context, chan<- bool) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000177}