VOL-2521 "Group-id-not-present-in-map" error message appears in rw-core logs
during multicast flow removal. Multicast flow removal request can not be
dispatched to the open-olt adapter at all.

Change-Id: I978b00028e46af99aba7e3006b1fb05f74ecc464
diff --git a/rw_core/core/logical_device_agent.go b/rw_core/core/logical_device_agent.go
index d9b5837..3fd8740 100644
--- a/rw_core/core/logical_device_agent.go
+++ b/rw_core/core/logical_device_agent.go
@@ -935,6 +935,7 @@
 
 	var meters []*ofp.OfpMeterEntry
 	var flows []*ofp.OfpFlowStats
+	var flowGroups []*ofp.OfpGroupEntry
 
 	if lDevice.Flows != nil && lDevice.Flows.Items != nil {
 		flows = lDevice.Flows.Items
@@ -943,6 +944,11 @@
 	if lDevice.Meters != nil && lDevice.Meters.Items != nil {
 		meters = lDevice.Meters.Items
 	}
+
+	if lDevice.FlowGroups != nil && lDevice.FlowGroups.Items != nil {
+		flowGroups = lDevice.FlowGroups.Items
+	}
+
 	//build a list of what to keep vs what to delete
 	toKeep := make([]*ofp.OfpFlowStats, 0)
 	toDelete := make([]*ofp.OfpFlowStats, 0)
@@ -969,7 +975,7 @@
 			log.Error("Meter-referred-in-flows-not-present")
 			return errors.New("Meter-referred-in-flows-not-present")
 		}
-		deviceRules := agent.flowDecomposer.DecomposeRules(agent, ofp.Flows{Items: toDelete}, ofp.FlowGroups{})
+		deviceRules := agent.flowDecomposer.DecomposeRules(agent, ofp.Flows{Items: toDelete}, ofp.FlowGroups{Items: flowGroups})
 		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.deleteDeviceFlowsAndGroups(deviceRules, &flowMetadata); err != nil {
@@ -1066,12 +1072,16 @@
 
 	var meters []*ofp.OfpMeterEntry
 	var flows []*ofp.OfpFlowStats
+	var flowGroups []*ofp.OfpGroupEntry
 	if lDevice.Meters != nil && lDevice.Meters.Items != nil {
 		meters = lDevice.Meters.Items
 	}
 	if lDevice.Flows != nil && lDevice.Flows.Items != nil {
 		flows = lDevice.Flows.Items
 	}
+	if lDevice.FlowGroups != nil && lDevice.FlowGroups.Items != nil {
+		flowGroups = lDevice.FlowGroups.Items
+	}
 
 	changedFlow := false
 	changedMeter := false
@@ -1104,7 +1114,7 @@
 			log.Error("meter-referred-in-flows-not-present")
 			return err
 		}
-		deviceRules := agent.flowDecomposer.DecomposeRules(agent, ofp.Flows{Items: flowsToDelete}, ofp.FlowGroups{})
+		deviceRules := agent.flowDecomposer.DecomposeRules(agent, ofp.Flows{Items: flowsToDelete}, ofp.FlowGroups{Items: flowGroups})
 		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.deleteDeviceFlowsAndGroups(deviceRules, &flowMetadata); err != nil {