Commit 5a251d26930e8a128762e00d7b2199f1d58d839d

Authored by adumas
1 parent c225df30

flow deletion

src/main/java/net/floodlightcontroller/pelstats/PELStats.java
... ... @@ -248,18 +248,67 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
248 248 return Command.CONTINUE;
249 249 }
250 250 public static void sendOFFlowMod(IOFSwitch sw,int port){
251   - //System.out.println("@PELStats,sendOFFlowMod: trying to craft message");
  251 +
  252 +
  253 +
  254 +
252 255 //OpenFlow message for flow tables modifications
253   - //
  256 + //Delete all the flows created by the switch
254 257 OFFlowMod OFmessage= new OFFlowMod();
255 258 OFMatch OFmatch= new OFMatch();
256 259 OFActionEnqueue enqueue= new OFActionEnqueue();
257 260  
  261 + OFmessage.setCommand((short)3);
  262 + OFmessage.setCookie(0);
  263 + OFmessage.setIdleTimeout((short) 0);
  264 + OFmessage.setHardTimeout((short)0);
  265 + OFmessage.setPriority((short)0xffff);
  266 + OFmessage.setBufferId(0);
  267 + OFmessage.setOutPort((short)0xffff);
  268 + OFmessage.setFlags((short) 0);
  269 +
  270 + OFmatch.setTransportSource((short)port);
  271 +
  272 + OFmatch.setWildcards(OFMatch.OFPFW_ALL //- OFMatch.OFPFW_IN_PORT
  273 + - OFMatch.OFPFW_TP_SRC - OFMatch.OFPFW_NW_PROTO
  274 + - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE
  275 + - OFMatch.OFPFW_NW_TOS);//*/
  276 + OFmatch.setNetworkTypeOfService((byte) 0);
  277 + OFmatch.setNetworkProtocol((byte)0x11);
  278 + OFmatch.setDataLayerType((short)0x0800);
  279 + OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0);
  280 +
  281 + //OFmatch.setInputPort((short)1);
  282 + OFmessage.setMatch(OFmatch);
  283 +
  284 +
  285 + OFmessage.setLength((short)(OFFlowMod.MINIMUM_LENGTH));
  286 + //System.out.println("@PELStats,sendOFFlowMod: trying to send message");
  287 + try {
  288 + sw.write(OFmessage, null);
  289 + sw.flush();
  290 + //System.out.println("@PELStats,sendOFFlowMod: message sent: "+OFmessage);
  291 + } catch (IOException e) {
  292 + e.printStackTrace();
  293 + }
  294 +
  295 +
  296 +
  297 +
  298 +
  299 +
  300 + //System.out.println("@PELStats,sendOFFlowMod: trying to craft message");
  301 + //OpenFlow message for flow tables modifications
  302 + //
  303 + OFmessage= new OFFlowMod();
  304 + OFmatch= new OFMatch();
  305 + enqueue= new OFActionEnqueue();
  306 +
258 307 OFmessage.setCommand((short)queueInfos.get(sw).get(2).intValue());
259 308 OFmessage.setCookie(0);
260 309 OFmessage.setIdleTimeout((short) 0);
261 310 OFmessage.setHardTimeout((short)0);
262   - OFmessage.setPriority((short)0xffff);//queueInfos.get(sw).get(1).shortValue());
  311 + OFmessage.setPriority((short)0xffff);
263 312 OFmessage.setBufferId(0);
264 313 OFmessage.setOutPort((short)0xffff);
265 314 OFmessage.setFlags((short) 0);
... ... @@ -386,6 +435,8 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
386 435 } catch (IOException e) {
387 436 e.printStackTrace();
388 437 }
  438 +
  439 +
389 440 //OpenFlow message for flow tables modifications
390 441 //RTCP
391 442 OFmessage= new OFFlowMod();
... ...