[VOL-5406] MIB templates are not getting generated after deleting them manually
Change-Id: I1eb5445e52d76a1856c2314b017aea594ac0b18c
Signed-off-by: pnalmas <praneeth.nalmas@radisys.com>
diff --git a/internal/pkg/mib/mib_sync.go b/internal/pkg/mib/mib_sync.go
index 2e71364..39a9584 100755
--- a/internal/pkg/mib/mib_sync.go
+++ b/internal/pkg/mib/mib_sync.go
@@ -315,6 +315,22 @@
oo.pOpenOnuAc.LockMutexMibTemplateGenerated()
oo.pOnuDB.CommonMeDb = cmnMEDBVal
+ //VOL-5406:If the Instance is present but the MIB templates are cleaned up . Check and create one.
+ Value, err := oo.mibTemplateKVStore.Get(log.WithSpanFromContext(context.TODO(), ctx), oo.mibTemplatePath)
+ if err == nil {
+ if Value == nil {
+
+ error := oo.createAndPersistMibTemplate(ctx)
+ if error != nil {
+ logger.Errorw(ctx, "MibSync - MibTemplate - Failed to create and persist the mib template", log.Fields{"error": err, "device-id": oo.deviceID})
+ } else {
+ logger.Infow(ctx, "MIB Template created and stored ", log.Fields{"device-id": oo.deviceID, "mibTemplatePath": oo.mibTemplatePath})
+ }
+ }
+ } else {
+ logger.Errorw(ctx, "MibSync - MibTemplate - Failed to create and persist the mib template", log.Fields{"error": err, "device-id": oo.deviceID})
+ }
+
if cmnMEDBVal.MIBUploadStatus == devdb.Completed {
oo.pOnuDB.CommonMeDb.MeDbLock.Lock()
oo.updateOnuSpecificEntries(ctx)