From ac903386ce8973fd563f7d0a251469d38bec00b8 Mon Sep 17 00:00:00 2001
From: Marius Reimer <reime005@gmail.com>
Date: Fri, 3 Mar 2017 18:02:32 +0100
Subject: [PATCH] Using utility function to set the actions depending on the
 OpenFlow version

---
 .../learningswitch/LearningSwitch.java                    | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java
index b933d4a8a..f2b730bbb 100644
--- a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java
+++ b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java
@@ -40,6 +40,7 @@ import net.floodlightcontroller.debugcounter.IDebugCounterService;
 import net.floodlightcontroller.debugcounter.IDebugCounterService.MetaData;
 import net.floodlightcontroller.packet.Ethernet;
 import net.floodlightcontroller.restserver.IRestApiService;
+import net.floodlightcontroller.util.FlowModUtils;
 import net.floodlightcontroller.util.OFMessageUtils;
 import org.projectfloodlight.openflow.protocol.*;
 import org.projectfloodlight.openflow.protocol.action.OFAction;
@@ -253,12 +254,7 @@ implements IFloodlightModule, ILearningSwitchService, IOFMessageListener, IContr
 		List<OFAction> al = new ArrayList<OFAction>();
 		al.add(sw.getOFFactory().actions().buildOutput().setPort(outPort).setMaxLen(0xffFFffFF).build());
 
-		ArrayList<OFInstruction> instructionsList = new ArrayList<OFInstruction>();
-		OFInstructionApplyActions applyActions = sw.getOFFactory().instructions().buildApplyActions()
-				.setActions(al)
-				.build();
-		instructionsList.add(applyActions);
-		fmb.setInstructions(instructionsList);
+		FlowModUtils.setActions(fmb, al, sw);
 
 		if (log.isTraceEnabled()) {
 			log.trace("{} {} flow mod {}",
-- 
GitLab