blob: e1ef21ff16198504d2161b44bd0a525f0effcff3 [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
Holger Hildebrandt9afc1582021-11-30 16:10:19 +000062 GetTechProfileInstanceFromParentAdapter(context.Context, uint8, string) (*ia.TechProfileDownloadMessage, error)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000063
64 GetDeviceReasonString() string
mpagenkoe4782082021-11-25 12:04:26 +000065 ReasonUpdate(context.Context, uint8, bool) error
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000066
67 GetCollectorIsRunning() bool
68 StartCollector(context.Context)
69 InitPmConfigs()
70 GetPmConfigs() *voltha.PmConfigs
71 GetMetricsEnabled() bool
72 GetOnuMetricsManager() IonuMetricsManager
73 GetOnuAlarmManager() IonuAlarmManager
74 GetOnuTP() IonuUniTechProf
75
76 GetAlarmManagerIsRunning(context.Context) bool
77 StartAlarmManager(context.Context)
78
Girish Gowdrae95687a2021-09-08 16:30:58 -070079 GetFlowMonitoringIsRunning(uniID uint8) bool
80
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000081 CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool
82
83 RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState)
84 DeviceProcStatusUpdate(context.Context, OnuDeviceEvent)
85
86 SetReadyForOmciConfig(bool)
87 IsReadyForOmciConfig() bool
88
89 StorePersistentData(context.Context) error
90 StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error
91
92 StartReconciling(context.Context, bool)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000093 IsReconciling() bool
94 IsSkipOnuConfigReconciling() bool
Holger Hildebrandt9afc1582021-11-30 16:10:19 +000095 SetReconcilingReasonUpdate(bool)
96 IsReconcilingReasonUpdate() bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000097 PrepareReconcilingWithActiveAdapter(context.Context)
Holger Hildebrandtb314f442021-11-24 12:03:10 +000098 ReconcileDeviceTechProf(context.Context) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000099 ReconcileDeviceFlowConfig(context.Context)
mpagenko101ac942021-11-16 15:01:29 +0000100 GetReconcileExpiryVlanConfigAbort() time.Duration
101 SendChUniVlanConfigFinished(value uint16)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000102
103 VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
104 VerifyVlanConfigRequest(context.Context, uint8, uint8)
105 AddAllUniPorts(context.Context)
106 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
107
108 EnableUniPortStateUpdate(context.Context)
109 DisableUniPortStateUpdate(context.Context)
110
111 SetBackend(context.Context, string) *db.Backend
112 GetBackendPathPrefix() string
113
114 RLockMutexDeletionInProgressFlag()
115 RUnlockMutexDeletionInProgressFlag()
116 GetDeletionInProgress() bool
117
khenaidoo42dcdfd2021-10-19 17:34:12 -0400118 SendOMCIRequest(context.Context, string, *ia.OmciMessage) error
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000119 CreatePortInCore(context.Context, *voltha.Port) error
Girish Gowdrae95687a2021-09-08 16:30:58 -0700120
121 PerOnuFlowHandlerRoutine(uniID uint8)
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000122}
123
124// IonuDeviceEntry interface to onuDeviceEntry
125type IonuDeviceEntry interface {
126 GetDevOmciCC() *OmciCC
127 GetOnuDB() *devdb.OnuDeviceDB
128 GetPersSerialNumber() string
129 GetPersVendorID() string
130 GetPersEquipmentID() string
131
132 GetMibUploadFsmCommChan() chan Message
133 GetMibDownloadFsmCommChan() chan Message
134
135 GetOmciRebootMsgRevChan() chan Message
136 WaitForRebootResponse(context.Context, chan Message) error
137
138 IncrementMibDataSync(context.Context)
139
140 GetActiveImageMeID(context.Context) (uint16, error)
141 LockMutexOnuSwImageIndications()
142 UnlockMutexOnuSwImageIndications()
143 GetOnuSwImageIndications() SswImageIndications
144 SetOnuSwImageIndications(SswImageIndications)
145 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 Hildebrandt4b5e73f2021-08-19 06:51:21 +0000153}
154
155// IonuMetricsManager interface to onuMetricsManager
156type IonuMetricsManager interface {
157 AddGemPortForPerfMonitoring(context.Context, uint16)
158 RemoveGemPortForPerfMonitoring(context.Context, uint16)
159}
160
161// IonuAlarmManager interface to onuAlarmManager
162type IonuAlarmManager interface {
163 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
164 ResetAlarmUploadCounters()
165 GetAlarmMgrEventChannel() chan Message
166 GetAlarmUploadSeqNo() uint16
167 IncrementAlarmUploadSeqNo()
168}
169
170// IonuUniTechProf interface to onuUniTechProf
171type IonuUniTechProf interface {
172 GetAllBidirectionalGemPortIDsForOnu() []uint16
173 SetProfileToDelete(uint8, uint8, bool)
174}
175
176// IuniVlanConfigFsm interface to uniVlanConfigFsm
177type IuniVlanConfigFsm interface {
Holger Hildebrandtc192bc42021-10-28 14:38:31 +0000178 IsFlowRemovePending(context.Context, chan<- bool) bool
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000179}