blob: a15bf3564d5de179e85e8dec45c8df320e88c4ef [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
24 //"github.com/opencord/voltha-lib-go/v5/pkg/adapters/adapterif"
25 "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"
28 ic "github.com/opencord/voltha-protos/v5/go/inter_container"
29 "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
63
64 GetDeviceReasonString() string
65 SetDeviceReason(uint8)
66
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
79 CheckAuditStartCondition(context.Context, UsedOmciConfigFsms) bool
80
81 RemoveOnuUpgradeFsm(context.Context, *voltha.ImageState)
82 DeviceProcStatusUpdate(context.Context, OnuDeviceEvent)
83
84 SetReadyForOmciConfig(bool)
85 IsReadyForOmciConfig() bool
86
87 StorePersistentData(context.Context) error
88 StorePersUniFlowConfig(context.Context, uint8, *[]UniVlanFlowParams, bool) error
89
90 StartReconciling(context.Context, bool)
91 StopReconciling(context.Context, bool)
92 IsReconciling() bool
93 IsSkipOnuConfigReconciling() bool
94 PrepareReconcilingWithActiveAdapter(context.Context)
95 ReconcileDeviceTechProf(context.Context)
96 ReconcileDeviceFlowConfig(context.Context)
97
98 VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
99 VerifyVlanConfigRequest(context.Context, uint8, uint8)
100 AddAllUniPorts(context.Context)
101 RemoveVlanFilterFsm(context.Context, *OnuUniPort)
102
103 EnableUniPortStateUpdate(context.Context)
104 DisableUniPortStateUpdate(context.Context)
105
106 SetBackend(context.Context, string) *db.Backend
107 GetBackendPathPrefix() string
108
109 RLockMutexDeletionInProgressFlag()
110 RUnlockMutexDeletionInProgressFlag()
111 GetDeletionInProgress() bool
112
113 SendOMCIRequest(context.Context, string, *ic.OmciMessage) error
114 CreatePortInCore(context.Context, *voltha.Port) error
115}
116
117// IonuDeviceEntry interface to onuDeviceEntry
118type IonuDeviceEntry interface {
119 GetDevOmciCC() *OmciCC
120 GetOnuDB() *devdb.OnuDeviceDB
121 GetPersSerialNumber() string
122 GetPersVendorID() string
123 GetPersEquipmentID() string
124
125 GetMibUploadFsmCommChan() chan Message
126 GetMibDownloadFsmCommChan() chan Message
127
128 GetOmciRebootMsgRevChan() chan Message
129 WaitForRebootResponse(context.Context, chan Message) error
130
131 IncrementMibDataSync(context.Context)
132
133 GetActiveImageMeID(context.Context) (uint16, error)
134 LockMutexOnuSwImageIndications()
135 UnlockMutexOnuSwImageIndications()
136 GetOnuSwImageIndications() SswImageIndications
137 SetOnuSwImageIndications(SswImageIndications)
138 GetPersActiveSwVersion() string
139 SetPersActiveSwVersion(string)
140 GetActiveImageVersion(context.Context) string
141 ModifySwImageInactiveVersion(context.Context, string)
142 ModifySwImageActiveCommit(context.Context, uint8)
143
144 AllocateFreeTcont(context.Context, uint16) (uint16, bool, error)
145 FreeTcont(context.Context, uint16)
146
147 LockMutexPersOnuConfig()
148 UnlockMutexPersOnuConfig()
149
150 SetReconcilingFlows(bool)
151 SetChReconcilingFlowsFinished(bool)
152}
153
154// IonuMetricsManager interface to onuMetricsManager
155type IonuMetricsManager interface {
156 AddGemPortForPerfMonitoring(context.Context, uint16)
157 RemoveGemPortForPerfMonitoring(context.Context, uint16)
158}
159
160// IonuAlarmManager interface to onuAlarmManager
161type IonuAlarmManager interface {
162 HandleOmciAlarmNotificationMessage(context.Context, OmciMessage)
163 ResetAlarmUploadCounters()
164 GetAlarmMgrEventChannel() chan Message
165 GetAlarmUploadSeqNo() uint16
166 IncrementAlarmUploadSeqNo()
167}
168
169// IonuUniTechProf interface to onuUniTechProf
170type IonuUniTechProf interface {
171 GetAllBidirectionalGemPortIDsForOnu() []uint16
172 SetProfileToDelete(uint8, uint8, bool)
173}
174
175// IuniVlanConfigFsm interface to uniVlanConfigFsm
176type IuniVlanConfigFsm interface {
177 IsFlowRemovePending(chan<- bool) bool
178}