blob: 54cbc18bc58e928c080a8eb9bdc306d3789ccac2 [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 Hildebrandt4b5e73f2021-08-19 06:51:21 +000024 "github.com/opencord/voltha-lib-go/v7/pkg/db"
25 "github.com/opencord/voltha-lib-go/v7/pkg/events/eventif"
26 "github.com/opencord/voltha-openonu-adapter-go/internal/pkg/devdb"
khenaidoo42dcdfd2021-10-19 17:34:12 -040027 ia "github.com/opencord/voltha-protos/v5/go/inter_adapter"
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000028 "github.com/opencord/voltha-protos/v5/go/openolt"
29 "github.com/opencord/voltha-protos/v5/go/voltha"
30)
31
32// IopenONUAC interface to openONUAC
33type IopenONUAC interface {
34 GetSupportedFsms() *OmciDeviceFsms
35 LockMutexMibTemplateGenerated()
36 UnlockMutexMibTemplateGenerated()
37 GetMibTemplatesGenerated(string) (bool, bool)
38 SetMibTemplatesGenerated(string, bool)
39 RLockMutexDeviceHandlersMap()
40 RUnlockMutexDeviceHandlersMap()
41 GetDeviceHandler(string) (IdeviceHandler, bool)
42}
43
44// IdeviceHandler interface to deviceHandler
45type IdeviceHandler interface {
46 GetDeviceID() string
47 GetLogicalDeviceID() string
48 GetDevice() *voltha.Device
49 GetDeviceType() string
50 GetProxyAddressID() string
51 GetProxyAddressType() string
52 GetProxyAddress() *voltha.Device_ProxyAddress
53 GetEventProxy() eventif.EventProxy
54 GetOmciTimeout() int
55 GetAlarmAuditInterval() time.Duration
56 GetDlToOnuTimeout4M() time.Duration
57 GetUniEntityMap() *OnuUniPortMap
58 GetUniPortMask() int
59 GetPonPortNumber() *uint32
60 GetOnuIndication() *openolt.OnuIndication
61 GetUniVlanConfigFsm(uint8) IuniVlanConfigFsm
62
63 GetDeviceReasonString() string
64 SetDeviceReason(uint8)
65
66 GetCollectorIsRunning() bool
67 StartCollector(context.Context)
68 InitPmConfigs()
69 GetPmConfigs() *voltha.PmConfigs
70 GetMetricsEnabled() bool
71 GetOnuMetricsManager() IonuMetricsManager
72 GetOnuAlarmManager() IonuAlarmManager
73 GetOnuTP() IonuUniTechProf
74
75 GetAlarmManagerIsRunning(context.Context) bool
76 StartAlarmManager(context.Context)
77
Girish Gowdrae95687a2021-09-08 16:30:58 -070078 GetFlowMonitoringIsRunning(uniID uint8) bool
79
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000080 CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool
81
82 RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState)
83 DeviceProcStatusUpdate(context.Context, OnuDeviceEvent)
84
85 SetReadyForOmciConfig(bool)
86 IsReadyForOmciConfig() bool
87
88 StorePersistentData(context.Context) error
89 StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error
90
91 StartReconciling(context.Context, bool)
92 StopReconciling(context.Context, bool)
93 IsReconciling() bool
94 IsSkipOnuConfigReconciling() bool
95 PrepareReconcilingWithActiveAdapter(context.Context)
96 ReconcileDeviceTechProf(context.Context)
97 ReconcileDeviceFlowConfig(context.Context)
98
99 VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
100 VerifyVlanConfigRequest(context.Context, uint8, uint8)
101 AddAllUniPorts(context.Context)
102 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
103
104 EnableUniPortStateUpdate(context.Context)
105 DisableUniPortStateUpdate(context.Context)
106
107 SetBackend(context.Context, string) *db.Backend
108 GetBackendPathPrefix() string
109
110 RLockMutexDeletionInProgressFlag()
111 RUnlockMutexDeletionInProgressFlag()
112 GetDeletionInProgress() bool
113
khenaidoo42dcdfd2021-10-19 17:34:12 -0400114 SendOMCIRequest(context.Context, string, *ia.OmciMessage) error
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000115 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700116
117 PerOnuFlowHandlerRoutine(uniID uint8)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000118}
119
120// IonuDeviceEntry interface to onuDeviceEntry
121type IonuDeviceEntry interface {
122 GetDevOmciCC() *OmciCC
123 GetOnuDB() *devdb.OnuDeviceDB
124 GetPersSerialNumber() string
125 GetPersVendorID() string
126 GetPersEquipmentID() string
127
128 GetMibUploadFsmCommChan() chan Message
129 GetMibDownloadFsmCommChan() chan Message
130
131 GetOmciRebootMsgRevChan() chan Message
132 WaitForRebootResponse(context.Context, chan Message) error
133
134 IncrementMibDataSync(context.Context)
135
136 GetActiveImageMeID(context.Context) (uint16, error)
137 LockMutexOnuSwImageIndications()
138 UnlockMutexOnuSwImageIndications()
139 GetOnuSwImageIndications() SswImageIndications
140 SetOnuSwImageIndications(SswImageIndications)
141 GetPersActiveSwVersion() string
142 SetPersActiveSwVersion(string)
143 GetActiveImageVersion(context.Context) string
144 ModifySwImageInactiveVersion(context.Context, string)
145 ModifySwImageActiveCommit(context.Context, uint8)
146
147 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
148 FreeTcont(context.Context, uint16)
149
150 LockMutexPersOnuConfig()
151 UnlockMutexPersOnuConfig()
152
153 SetReconcilingFlows(bool)
154 SetChReconcilingFlowsFinished(bool)
155}
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}