[VOL-3731] Delete etcd stale data after olt reboot

Change-Id: Ib6669511327870d180262e1f8c2bd6c1e8315496
(cherry picked from commit 4f5ed59bf6dbcacbdef33ed25b4601334364275b)
diff --git a/vendor/github.com/opencord/voltha-lib-go/v5/pkg/ponresourcemanager/ponresourcemanager.go b/vendor/github.com/opencord/voltha-lib-go/v5/pkg/ponresourcemanager/ponresourcemanager.go
index 804a6f3..a8738ee 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v5/pkg/ponresourcemanager/ponresourcemanager.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v5/pkg/ponresourcemanager/ponresourcemanager.go
@@ -1263,12 +1263,10 @@
 	*/
 	ByteArray, err := ToByte(Resource[POOL])
 	if err != nil {
-		logger.Error(ctx, "Failed to convert resource to byte array")
 		return 0, err
 	}
 	Data := bitmap.TSFromData(ByteArray, false)
 	if Data == nil {
-		logger.Error(ctx, "Failed to get data from byte array")
 		return 0, errors.New("Failed to get data from byte array")
 	}
 
@@ -1279,6 +1277,9 @@
 			break
 		}
 	}
+	if Idx == Len {
+		return 0, errors.New("resource-exhausted--no-free-id-in-the-pool")
+	}
 	Data.Set(Idx, true)
 	res := uint32(Resource[START_IDX].(float64))
 	Resource[POOL] = Data.Data(false)
@@ -1303,6 +1304,10 @@
 		return false
 	}
 	Idx := Id - uint32(Resource[START_IDX].(float64))
+	if Idx >= uint32(Data.Len()) {
+		logger.Errorf(ctx, "ID %d is out of the boundaries of the pool", Id)
+		return false
+	}
 	Data.Set(int(Idx), false)
 	Resource[POOL] = Data.Data(false)
 
@@ -1320,6 +1325,10 @@
 		return false
 	}
 	Idx := Id - StartIndex
+	if Idx >= uint32(Data.Len()) {
+		logger.Errorf(ctx, "Reservation failed. ID %d is out of the boundaries of the pool", Id)
+		return false
+	}
 	Data.Set(int(Idx), true)
 	return true
 }