[VOL-4178, VOL-3952] This commit removes flows/groups/meters persistency
This commit removes flows/groups/meters persistency from rw-core.
As part of this change, it also fixes a bug where devices were not
being loaded on an rw-core restart. This is a necessary condition
to allow the non-persistency of flows/groups/meters to work.
This commit also renames "loader" to "cache" for the flows/groups/
meters to differentiate between data that is loaded from the KV
store and the one in cache.
Change-Id: Ib14e1450021abe30b17673c2910768fb740dba51
diff --git a/rw_core/core/device/logical_agent_meter.go b/rw_core/core/device/logical_agent_meter.go
index f3a1c89..d67b2df 100644
--- a/rw_core/core/device/logical_agent_meter.go
+++ b/rw_core/core/device/logical_agent_meter.go
@@ -29,10 +29,10 @@
// listLogicalDeviceMeters returns logical device meters
func (agent *LogicalAgent) listLogicalDeviceMeters() map[uint32]*ofp.OfpMeterEntry {
- meterIDs := agent.meterLoader.ListIDs()
+ meterIDs := agent.meterCache.ListIDs()
meters := make(map[uint32]*ofp.OfpMeterEntry, len(meterIDs))
for meterID := range meterIDs {
- if meterHandle, have := agent.meterLoader.Lock(meterID); have {
+ if meterHandle, have := agent.meterCache.Lock(meterID); have {
meters[meterID] = meterHandle.GetReadOnly()
meterHandle.Unlock()
}
@@ -67,7 +67,7 @@
meterEntry := fu.MeterEntryFromMeterMod(ctx, meterMod)
- meterHandle, created, err := agent.meterLoader.LockOrCreate(ctx, meterEntry)
+ meterHandle, created, err := agent.meterCache.LockOrCreate(ctx, meterEntry)
if err != nil {
return err
}
@@ -88,7 +88,7 @@
}
logger.Debug(ctx, "meterDelete", log.Fields{"meterMod": *meterMod, "logical-device-id": agent.logicalDeviceID})
- meterHandle, have := agent.meterLoader.Lock(meterMod.MeterId)
+ meterHandle, have := agent.meterCache.Lock(meterMod.MeterId)
if !have {
logger.Warnw(ctx, "meter-not-found", log.Fields{"meterID": meterMod.MeterId, "logical-device-id": agent.logicalDeviceID})
return nil
@@ -116,7 +116,7 @@
return nil
}
- meterHandle, have := agent.meterLoader.Lock(meterMod.MeterId)
+ meterHandle, have := agent.meterCache.Lock(meterMod.MeterId)
if !have {
return fmt.Errorf("no-meter-to-modify: %d, logical-device-id: %s", meterMod.MeterId, agent.logicalDeviceID)
}