From acd47014b40cc45060b464a4cc5a8538d8431c7a Mon Sep 17 00:00:00 2001 From: reime005 <m-d.reimer@ostfalia.de> Date: Fri, 3 Mar 2017 13:31:47 +0100 Subject: [PATCH] Learningswitch OF Exception from InstructionApplyActions fixed --- .../learningswitch/LearningSwitch.java | 49 ++++++------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java index 337eb683b..b933d4a8a 100644 --- a/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java +++ b/src/main/java/net/floodlightcontroller/learningswitch/LearningSwitch.java @@ -29,21 +29,7 @@ package net.floodlightcontroller.learningswitch; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import net.floodlightcontroller.core.FloodlightContext; -import net.floodlightcontroller.core.IControllerCompletionListener; -import net.floodlightcontroller.core.IFloodlightProviderService; -import net.floodlightcontroller.core.IOFMessageListener; -import net.floodlightcontroller.core.IOFSwitch; +import net.floodlightcontroller.core.*; import net.floodlightcontroller.core.module.FloodlightModuleContext; import net.floodlightcontroller.core.module.FloodlightModuleException; import net.floodlightcontroller.core.module.IFloodlightModule; @@ -55,29 +41,20 @@ import net.floodlightcontroller.debugcounter.IDebugCounterService.MetaData; import net.floodlightcontroller.packet.Ethernet; import net.floodlightcontroller.restserver.IRestApiService; import net.floodlightcontroller.util.OFMessageUtils; - -import org.projectfloodlight.openflow.protocol.OFFlowMod; -import org.projectfloodlight.openflow.protocol.OFFlowRemoved; +import org.projectfloodlight.openflow.protocol.*; +import org.projectfloodlight.openflow.protocol.action.OFAction; +import org.projectfloodlight.openflow.protocol.instruction.OFInstruction; +import org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions; import org.projectfloodlight.openflow.protocol.match.Match; import org.projectfloodlight.openflow.protocol.match.MatchField; -import org.projectfloodlight.openflow.protocol.OFFlowModCommand; -import org.projectfloodlight.openflow.protocol.OFFlowModFlags; -import org.projectfloodlight.openflow.protocol.OFMessage; -import org.projectfloodlight.openflow.protocol.OFPacketIn; -import org.projectfloodlight.openflow.protocol.OFPacketOut; -import org.projectfloodlight.openflow.protocol.OFType; -import org.projectfloodlight.openflow.protocol.OFVersion; -import org.projectfloodlight.openflow.protocol.action.OFAction; -import org.projectfloodlight.openflow.types.MacAddress; -import org.projectfloodlight.openflow.types.OFBufferId; -import org.projectfloodlight.openflow.types.OFPort; -import org.projectfloodlight.openflow.types.OFVlanVidMatch; -import org.projectfloodlight.openflow.types.U64; -import org.projectfloodlight.openflow.types.VlanVid; +import org.projectfloodlight.openflow.types.*; import org.projectfloodlight.openflow.util.LRULinkedHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + // paag: with IControllerCompletionListener that logswhen an input event has been consumed public class LearningSwitch implements IFloodlightModule, ILearningSwitchService, IOFMessageListener, IControllerCompletionListener { @@ -275,7 +252,13 @@ implements IFloodlightModule, ILearningSwitchService, IOFMessageListener, IContr // and port, max_len are arguments to this constructor List<OFAction> al = new ArrayList<OFAction>(); al.add(sw.getOFFactory().actions().buildOutput().setPort(outPort).setMaxLen(0xffFFffFF).build()); - fmb.setActions(al); + + ArrayList<OFInstruction> instructionsList = new ArrayList<OFInstruction>(); + OFInstructionApplyActions applyActions = sw.getOFFactory().instructions().buildApplyActions() + .setActions(al) + .build(); + instructionsList.add(applyActions); + fmb.setInstructions(instructionsList); if (log.isTraceEnabled()) { log.trace("{} {} flow mod {}", -- GitLab