blob: 423f0d99bf9a41af5ccbd81b255eae10fdf9769e [file] [log] [blame]
Holger Hildebrandt24d51952020-05-04 14:03:42 +00001/*
Joey Armstrong89c812c2024-01-12 19:00:20 -05002 * Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors
Holger Hildebrandt24d51952020-05-04 14:03:42 +00003 *
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
praneeth kumar nalmas3947c582023-12-13 15:38:50 +053017// Package devdb provides access to internal device ME DB
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000018package devdb
Holger Hildebrandt24d51952020-05-04 14:03:42 +000019
20import (
21 "context"
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +000022 "encoding/hex"
Holger Hildebrandt2ff21f12020-08-13 14:38:02 +000023 "fmt"
24 "reflect"
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +000025 "sort"
Mahir Gunyel7f4483a2021-05-06 12:53:43 -070026 "sync"
Holger Hildebrandt24d51952020-05-04 14:03:42 +000027
mpagenko836a1fd2021-11-01 16:12:42 +000028 me "github.com/opencord/omci-lib-go/v2/generated"
khenaidoo7d3c5582021-08-11 18:09:44 -040029 "github.com/opencord/voltha-lib-go/v7/pkg/log"
Holger Hildebrandt24d51952020-05-04 14:03:42 +000030)
31
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +053032// MeDbMap type holds MEs that are known to the ONT.
33type MeDbMap map[me.ClassID]map[uint16]me.AttributeValueMap
34
35// UnknownMeAndAttribDbMap type holds MEs that are Unknown to the ONT.
36type UnknownMeAndAttribDbMap map[UnknownMeOrAttribName]map[me.ClassID]map[uint16]unknownAttribs
37
38// OnuMCmnMEDBMap type holds MEs that are classified as Unknown to the ONT.
39type OnuMCmnMEDBMap map[string]*OnuCmnMEDB
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +000040
Holger Hildebrandt39080022022-03-16 10:03:17 +000041// UnknownMeOrAttribName type to be used for unknown ME and attribute names
42type UnknownMeOrAttribName string
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +000043
Holger Hildebrandt39080022022-03-16 10:03:17 +000044// names for unknown ME and attribute identifiers
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +000045const (
46 CUnknownItuG988ManagedEntity = "UnknownItuG988ManagedEntity"
47 CUnknownVendorSpecificManagedEntity = "UnknownVendorSpecificManagedEntity"
Holger Hildebrandt39080022022-03-16 10:03:17 +000048 CUnknownAttributesManagedEntity = "UnknownAttributesManagedEntity"
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +000049)
50
Holger Hildebrandt39080022022-03-16 10:03:17 +000051// CStartUnknownMeAttribsInBaseLayerPayload defines start of unknown ME attribs after ClassID, InstanceID and AttribMask
52const CStartUnknownMeAttribsInBaseLayerPayload = 6
53
54type unknownAttribs struct {
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +000055 AttribMask string `json:"AttributeMask"`
56 AttribBytes string `json:"AttributeBytes"`
57}
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +000058
praneeth kumar nalmas3947c582023-12-13 15:38:50 +053059// OnuDeviceDB structure holds information about ME's
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000060type OnuDeviceDB struct {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +053061 ctx context.Context
62 deviceID string
63 CommonMeDb *OnuCmnMEDB // Reference to OnuCmnMEDB
64 OnuSpecificMeDbLock sync.RWMutex
65 OnuSpecificMeDb MeDbMap
66}
67
68// MIBUploadStatus represents the status of MIBUpload for a particular ONT.
69type MIBUploadStatus int
70
71// Values for Status of the ONT MIB Upload.
72const (
73 NotStarted MIBUploadStatus = iota // MIB upload has not started
74 InProgress // MIB upload is in progress
75 Failed // MIB upload has failed
76 Completed // MIB upload is completed
77)
78
79// OnuCmnMEDB structure holds information about ME's common to ONT possessing same MIB Template.
80type OnuCmnMEDB struct {
81 MeDbLock sync.RWMutex
82 MeDb MeDbMap
83 UnknownMeAndAttribDb UnknownMeAndAttribDbMap
84 MIBUploadStatus MIBUploadStatus
85}
86
87// NewOnuCmnMEDB returns a new instance of OnuCmnMEDB
88func NewOnuCmnMEDB(ctx context.Context) *OnuCmnMEDB {
89
90 return &OnuCmnMEDB{
91 MeDbLock: sync.RWMutex{},
92 MeDb: make(MeDbMap),
93 UnknownMeAndAttribDb: make(UnknownMeAndAttribDbMap),
94 MIBUploadStatus: NotStarted,
95 }
Holger Hildebrandt24d51952020-05-04 14:03:42 +000096}
97
praneeth kumar nalmas3947c582023-12-13 15:38:50 +053098// NewOnuDeviceDB returns a new instance for a specific ONU_Device_Entry
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +000099func NewOnuDeviceDB(ctx context.Context, aDeviceID string) *OnuDeviceDB {
100 logger.Debugw(ctx, "Init OnuDeviceDB for:", log.Fields{"device-id": aDeviceID})
101 var OnuDeviceDB OnuDeviceDB
102 OnuDeviceDB.ctx = ctx
103 OnuDeviceDB.deviceID = aDeviceID
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530104 OnuDeviceDB.CommonMeDb = nil
105 OnuDeviceDB.OnuSpecificMeDb = make(MeDbMap)
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000106
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000107 return &OnuDeviceDB
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000108}
109
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530110// PutMe puts an ME instance into internal ONU DB
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000111func (OnuDeviceDB *OnuDeviceDB) PutMe(ctx context.Context, meClassID me.ClassID, meEntityID uint16, meAttributes me.AttributeValueMap) {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530112
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000113 //filter out the OnuData
Himani Chawla4d908332020-08-31 12:30:20 +0530114 if me.OnuDataClassID == meClassID {
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000115 return
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000116 }
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530117
118 // Dereference the MeDb pointer
119 if OnuDeviceDB.CommonMeDb == nil || OnuDeviceDB.CommonMeDb.MeDb == nil {
120 logger.Errorw(ctx, "MeDb is nil", log.Fields{"device-id": OnuDeviceDB.deviceID})
121 return
122 }
123 meDb := OnuDeviceDB.CommonMeDb.MeDb
124 _, ok := meDb[meClassID]
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000125 if !ok {
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000126 logger.Debugw(ctx, "meClassID not found - add to db :", log.Fields{"device-id": OnuDeviceDB.deviceID})
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530127 meDb[meClassID] = make(map[uint16]me.AttributeValueMap)
128 meDb[meClassID][meEntityID] = make(me.AttributeValueMap)
129 meDb[meClassID][meEntityID] = meAttributes
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000130 } else {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530131 meAttribs, ok := meDb[meClassID][meEntityID]
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000132 if !ok {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530133 meDb[meClassID][meEntityID] = make(me.AttributeValueMap)
134 meDb[meClassID][meEntityID] = meAttributes
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000135 } else {
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000136 for k, v := range meAttributes {
137 meAttribs[k] = v
138 }
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530139 meDb[meClassID][meEntityID] = meAttribs
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000140 }
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000141 }
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000142}
143
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530144// GetMe returns an ME instance from internal ONU DB
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000145func (OnuDeviceDB *OnuDeviceDB) GetMe(meClassID me.ClassID, meEntityID uint16) me.AttributeValueMap {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530146 OnuDeviceDB.CommonMeDb.MeDbLock.RLock()
147 defer OnuDeviceDB.CommonMeDb.MeDbLock.RUnlock()
148
149 // Check in the common MeDb
150 if meAttributes, present := OnuDeviceDB.CommonMeDb.MeDb[meClassID][meEntityID]; present {
151 return meAttributes
152 }
153
154 OnuDeviceDB.OnuSpecificMeDbLock.RLock()
155 defer OnuDeviceDB.OnuSpecificMeDbLock.RUnlock()
156
157 // Check in the ONU-specific MeDb
158 if meAttributes, present := OnuDeviceDB.OnuSpecificMeDb[meClassID][meEntityID]; present {
Holger Hildebrandt9ca8b132020-08-07 14:45:03 +0000159 return meAttributes
Holger Hildebrandt9ca8b132020-08-07 14:45:03 +0000160 }
Himani Chawla4d908332020-08-31 12:30:20 +0530161 return nil
Holger Hildebrandt9ca8b132020-08-07 14:45:03 +0000162}
163
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530164// GetUint32Attrib converts JSON numbers to uint32
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000165func (OnuDeviceDB *OnuDeviceDB) GetUint32Attrib(meAttribute interface{}) (uint32, error) {
Holger Hildebrandt2ff21f12020-08-13 14:38:02 +0000166
167 switch reflect.TypeOf(meAttribute).Kind() {
168 case reflect.Float64:
169 //JSON numbers by default are unmarshaled into values of float64 type if type information is not present
170 return uint32(meAttribute.(float64)), nil
171 case reflect.Uint32:
Girish Gowdra09e5f212021-09-30 16:28:36 -0700172 return meAttribute.(uint32), nil
Holger Hildebrandt2ff21f12020-08-13 14:38:02 +0000173 default:
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000174 return uint32(0), fmt.Errorf(fmt.Sprintf("wrong-interface-type-%v-received-for-device-%s", reflect.TypeOf(meAttribute).Kind(), OnuDeviceDB.deviceID))
Holger Hildebrandt2ff21f12020-08-13 14:38:02 +0000175 }
176}
177
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530178// GetUint16Attrib converts JSON numbers to uint16
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000179func (OnuDeviceDB *OnuDeviceDB) GetUint16Attrib(meAttribute interface{}) (uint16, error) {
Girish Gowdra041dcb32020-11-16 16:54:30 -0800180
181 switch reflect.TypeOf(meAttribute).Kind() {
Girish Gowdra09e5f212021-09-30 16:28:36 -0700182 case reflect.Float64:
183 //JSON numbers by default are unmarshaled into values of float64 type if type information is not present
184 return uint16(meAttribute.(float64)), nil
Girish Gowdra041dcb32020-11-16 16:54:30 -0800185 case reflect.Uint16:
186 return meAttribute.(uint16), nil
187 default:
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000188 return uint16(0), fmt.Errorf(fmt.Sprintf("wrong-interface-type-%v-received-for-device-%s", reflect.TypeOf(meAttribute).Kind(), OnuDeviceDB.deviceID))
Girish Gowdra041dcb32020-11-16 16:54:30 -0800189 }
190}
Girish Gowdra041dcb32020-11-16 16:54:30 -0800191
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530192// GetSortedInstKeys returns a sorted list of all instances of an ME
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000193func (OnuDeviceDB *OnuDeviceDB) GetSortedInstKeys(ctx context.Context, meClassID me.ClassID) []uint16 {
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000194
195 var meInstKeys []uint16
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530196 OnuDeviceDB.CommonMeDb.MeDbLock.RLock()
197 defer OnuDeviceDB.CommonMeDb.MeDbLock.RUnlock()
198 meDb := OnuDeviceDB.CommonMeDb.MeDb
Holger Hildebrandt9ca8b132020-08-07 14:45:03 +0000199
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530200 // Check if the class ID exists in the MeDb map
201 if meInstMap, found := meDb[meClassID]; found {
202 for k := range meInstMap {
203 meInstKeys = append(meInstKeys, k)
204 }
205 logger.Debugw(ctx, "meInstKeys - input order :", log.Fields{"meInstKeys": meInstKeys}) //TODO: delete the line after test phase!
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000206 }
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000207 sort.Slice(meInstKeys, func(i, j int) bool { return meInstKeys[i] < meInstKeys[j] })
dbainbri4d3a0dc2020-12-02 00:33:42 +0000208 logger.Debugw(ctx, "meInstKeys - output order :", log.Fields{"meInstKeys": meInstKeys}) //TODO: delete the line after test phase!
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530209
210 // Return the sorted instance keys
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000211 return meInstKeys
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000212}
213
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530214// GetNumberOfInst returns the number of instances of an ME
Holger Hildebrandt5ba6c132022-10-06 13:53:14 +0000215func (OnuDeviceDB *OnuDeviceDB) GetNumberOfInst(meClassID me.ClassID) int {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530216 var count int
217
218 OnuDeviceDB.CommonMeDb.MeDbLock.RLock()
219 defer OnuDeviceDB.CommonMeDb.MeDbLock.RUnlock()
220
221 if meClassMap, found := OnuDeviceDB.CommonMeDb.MeDb[meClassID]; found {
222 count = len(meClassMap)
223 }
224
225 OnuDeviceDB.OnuSpecificMeDbLock.RLock()
226 defer OnuDeviceDB.OnuSpecificMeDbLock.RUnlock()
227
228 if onuSpecificMap, found := OnuDeviceDB.OnuSpecificMeDb[meClassID]; found {
229 count += len(onuSpecificMap)
230 }
231
232 return count
Holger Hildebrandt5ba6c132022-10-06 13:53:14 +0000233}
234
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530235// LogMeDb logs content of internal ONU DB
Holger Hildebrandt4b5e73f2021-08-19 06:51:21 +0000236func (OnuDeviceDB *OnuDeviceDB) LogMeDb(ctx context.Context) {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530237 logger.Debugw(ctx, "Logging ME instances for device:", log.Fields{"device-id": OnuDeviceDB.deviceID})
238
239 if OnuDeviceDB.CommonMeDb != nil && OnuDeviceDB.CommonMeDb.MeDb != nil {
240 meDb := OnuDeviceDB.CommonMeDb.MeDb
241
242 for meClassID, meInstMap := range meDb {
243 for meEntityID, meAttribs := range meInstMap {
244 logger.Debugw(ctx, "Common ME instance: ", log.Fields{"meClassID": meClassID, "meEntityID": meEntityID, "meAttribs": meAttribs,
245 "device-id": OnuDeviceDB.deviceID})
246 }
247 }
248 } else {
249 logger.Warnw(ctx, "Common MeDb is nil", log.Fields{"device-id": OnuDeviceDB.deviceID})
250 }
251
252 // Log ONU-specific ME instances
253 OnuDeviceDB.OnuSpecificMeDbLock.RLock()
254 defer OnuDeviceDB.OnuSpecificMeDbLock.RUnlock()
255
256 for meClassID, meInstMap := range OnuDeviceDB.OnuSpecificMeDb {
Himani Chawla4d908332020-08-31 12:30:20 +0530257 for meEntityID, meAttribs := range meInstMap {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530258 logger.Debugw(ctx, "ONU Specific ME instance:", log.Fields{
259 "meClassID": meClassID,
260 "meEntityID": meEntityID,
261 "meAttribs": meAttribs,
262 "device-id": OnuDeviceDB.deviceID,
263 })
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000264 }
265 }
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530266
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000267}
268
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530269// PutUnknownMeOrAttrib puts an instance with unknown ME or attributes into internal ONU DB
Holger Hildebrandt39080022022-03-16 10:03:17 +0000270func (OnuDeviceDB *OnuDeviceDB) PutUnknownMeOrAttrib(ctx context.Context, aMeName UnknownMeOrAttribName, aMeClassID me.ClassID, aMeEntityID uint16,
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000271 aMeAttributeMask uint16, aMePayload []byte) {
272
Holger Hildebrandt39080022022-03-16 10:03:17 +0000273 meAttribMaskStr := fmt.Sprintf("0x%04x", aMeAttributeMask)
274 attribs := unknownAttribs{meAttribMaskStr, hex.EncodeToString(aMePayload)}
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000275
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530276 unknownMeDb := OnuDeviceDB.CommonMeDb.UnknownMeAndAttribDb
277
278 _, ok := unknownMeDb[aMeName]
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000279 if !ok {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530280 unknownMeDb[aMeName] = make(map[me.ClassID]map[uint16]unknownAttribs)
281 unknownMeDb[aMeName][aMeClassID] = make(map[uint16]unknownAttribs)
282 unknownMeDb[aMeName][aMeClassID][aMeEntityID] = attribs
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000283 } else {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530284 _, ok := unknownMeDb[aMeName][aMeClassID]
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000285 if !ok {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530286 unknownMeDb[aMeName][aMeClassID] = make(map[uint16]unknownAttribs)
287 unknownMeDb[aMeName][aMeClassID][aMeEntityID] = attribs
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000288 } else {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530289 _, ok := unknownMeDb[aMeName][aMeClassID][aMeEntityID]
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000290 if !ok {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530291 unknownMeDb[aMeName][aMeClassID][aMeEntityID] = attribs
Holger Hildebrandtf3c7a182021-11-17 13:42:08 +0000292 }
Holger Hildebrandt9ac0d0f2020-05-13 11:22:02 +0000293 }
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000294 }
Holger Hildebrandt24d51952020-05-04 14:03:42 +0000295}
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530296
297// DeleteMe deletes an ME instance from internal ONU DB
298func (OnuDeviceDB *OnuDeviceDB) DeleteMe(meClassID me.ClassID, meEntityID uint16) {
Praneeth Kumar Nalmas8f8f0c02024-10-22 19:29:09 +0530299 OnuDeviceDB.CommonMeDb.MeDbLock.Lock()
300 defer OnuDeviceDB.CommonMeDb.MeDbLock.Unlock()
301 meDb := OnuDeviceDB.CommonMeDb.MeDb
302 delete(meDb[meClassID], meEntityID)
303
304 OnuDeviceDB.OnuSpecificMeDbLock.Lock()
305 defer OnuDeviceDB.OnuSpecificMeDbLock.Unlock()
306 delete(OnuDeviceDB.OnuSpecificMeDb[meClassID], meEntityID)
307}
308
309// PutOnuSpeficMe puts an ME instance into specifically to the ONU DB maintained per ONU.
310func (OnuDeviceDB *OnuDeviceDB) PutOnuSpeficMe(ctx context.Context, meClassID me.ClassID, meEntityID uint16, meAttributes me.AttributeValueMap) {
311 OnuDeviceDB.OnuSpecificMeDbLock.Lock()
312 defer OnuDeviceDB.OnuSpecificMeDbLock.Unlock()
313 //filter out the OnuData
314 if me.OnuDataClassID == meClassID {
315 return
316 }
317 _, ok := OnuDeviceDB.OnuSpecificMeDb[meClassID]
318 if !ok {
319 logger.Debugw(ctx, "meClassID not found - add to db :", log.Fields{"device-id": OnuDeviceDB.deviceID})
320 OnuDeviceDB.OnuSpecificMeDb[meClassID] = make(map[uint16]me.AttributeValueMap)
321 OnuDeviceDB.OnuSpecificMeDb[meClassID][meEntityID] = make(me.AttributeValueMap)
322 OnuDeviceDB.OnuSpecificMeDb[meClassID][meEntityID] = meAttributes
323 } else {
324 meAttribs, ok := OnuDeviceDB.OnuSpecificMeDb[meClassID][meEntityID]
325 if !ok {
326 OnuDeviceDB.OnuSpecificMeDb[meClassID][meEntityID] = make(me.AttributeValueMap)
327 OnuDeviceDB.OnuSpecificMeDb[meClassID][meEntityID] = meAttributes
328 } else {
329 for k, v := range meAttributes {
330 meAttribs[k] = v
331 }
332 OnuDeviceDB.OnuSpecificMeDb[meClassID][meEntityID] = meAttribs
333 }
334 }
praneeth kumar nalmas3947c582023-12-13 15:38:50 +0530335}