VOL-2119 bugfix for sending meter-stats replies properly
Change-Id: Ideb0e1d962c08b4f28ad9d2383129d1ea3b593f4
diff --git a/rw_core/core/logical_device_agent.go b/rw_core/core/logical_device_agent.go
index bf30cc5..2c72b6d 100644
--- a/rw_core/core/logical_device_agent.go
+++ b/rw_core/core/logical_device_agent.go
@@ -215,6 +215,9 @@
defer agent.lockLogicalDevice.RUnlock()
logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
+ if lDevice.Meters == nil {
+ return &ofp.Meters{}, nil
+ }
cMeters := (proto.Clone(lDevice.Meters)).(*ofp.Meters)
return cMeters, nil
}
@@ -1115,7 +1118,7 @@
flowsToDelete := make([]*ofp.OfpFlowStats, 0)
idx := fu.FindFlows(flows, flow)
if idx >= 0 {
- changedMeter = agent.updateFlowCountOfMeterStats(mod, meters, flow)
+ changedMeter = agent.updateFlowCountOfMeterStats(mod, meters, flows[idx])
flowsToDelete = append(flowsToDelete, flows[idx])
flows = append(flows[:idx], flows[idx+1:]...)
changedFlow = true