Commit 722c33830f599aab8d6280e398b2f44a1a25aad8

Authored by adumas
1 parent 5a251d26

deletion of RTCP flows created by the switch

src/main/java/net/floodlightcontroller/pelstats/PELStats.java
... ... @@ -250,15 +250,14 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
250 250 public static void sendOFFlowMod(IOFSwitch sw,int port){
251 251  
252 252  
253   -
254   -
  253 + //System.out.println("@PELStats,sendOFFlowMod: trying to craft message");
255 254 //OpenFlow message for flow tables modifications
256   - //Delete all the flows created by the switch
  255 + //
257 256 OFFlowMod OFmessage= new OFFlowMod();
258 257 OFMatch OFmatch= new OFMatch();
259 258 OFActionEnqueue enqueue= new OFActionEnqueue();
260 259  
261   - OFmessage.setCommand((short)3);
  260 + OFmessage.setCommand((short)queueInfos.get(sw).get(2).intValue());
262 261 OFmessage.setCookie(0);
263 262 OFmessage.setIdleTimeout((short) 0);
264 263 OFmessage.setHardTimeout((short)0);
... ... @@ -267,22 +266,27 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
267 266 OFmessage.setOutPort((short)0xffff);
268 267 OFmessage.setFlags((short) 0);
269 268  
  269 + //OFmatch.setTransportDestination((short)port);
270 270 OFmatch.setTransportSource((short)port);
  271 +
271 272  
272   - OFmatch.setWildcards(OFMatch.OFPFW_ALL //- OFMatch.OFPFW_IN_PORT
  273 +
  274 + OFmatch.setWildcards(OFMatch.OFPFW_ALL - OFMatch.OFPFW_IN_PORT
273 275 - 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);
  276 + - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE);//*/
277 277 OFmatch.setNetworkProtocol((byte)0x11);
278 278 OFmatch.setDataLayerType((short)0x0800);
279 279 OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0);
280 280  
281   - //OFmatch.setInputPort((short)1);
  281 + OFmatch.setInputPort((short)1);
282 282 OFmessage.setMatch(OFmatch);
283 283  
284   -
285   - OFmessage.setLength((short)(OFFlowMod.MINIMUM_LENGTH));
  284 + List<OFAction> actions= new ArrayList<OFAction>(1);
  285 + enqueue=new OFActionEnqueue((short)2,queueInfos.get(sw).get(0));
  286 + actions.add(enqueue);
  287 +
  288 + OFmessage.setActions(actions);
  289 + OFmessage.setLength((short)(OFFlowMod.MINIMUM_LENGTH +OFActionEnqueue.MINIMUM_LENGTH));
286 290 //System.out.println("@PELStats,sendOFFlowMod: trying to send message");
287 291 try {
288 292 sw.write(OFmessage, null);
... ... @@ -291,15 +295,8 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
291 295 } catch (IOException e) {
292 296 e.printStackTrace();
293 297 }
294   -
295   -
296   -
297   -
298   -
299   -
300   - //System.out.println("@PELStats,sendOFFlowMod: trying to craft message");
301 298 //OpenFlow message for flow tables modifications
302   - //
  299 + //The same as before, only the input and output ports are inverted
303 300 OFmessage= new OFFlowMod();
304 301 OFmatch= new OFMatch();
305 302 enqueue= new OFActionEnqueue();
... ... @@ -319,17 +316,17 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
319 316  
320 317  
321 318 OFmatch.setWildcards(OFMatch.OFPFW_ALL - OFMatch.OFPFW_IN_PORT
322   - - OFMatch.OFPFW_TP_SRC - OFMatch.OFPFW_NW_PROTO
323   - - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE);//*/
  319 + - OFMatch.OFPFW_TP_SRC - OFMatch.OFPFW_NW_PROTO
  320 + - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE);//*/
324 321 OFmatch.setNetworkProtocol((byte)0x11);
325 322 OFmatch.setDataLayerType((short)0x0800);
326 323 OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0);
327 324  
328   - OFmatch.setInputPort((short)1);
  325 + OFmatch.setInputPort((short)2);
329 326 OFmessage.setMatch(OFmatch);
330 327  
331   - List<OFAction> actions= new ArrayList<OFAction>(1);
332   - enqueue=new OFActionEnqueue((short)2,queueInfos.get(sw).get(0));
  328 + actions= new ArrayList<OFAction>(1);
  329 + enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw).get(0));
333 330 actions.add(enqueue);
334 331  
335 332 OFmessage.setActions(actions);
... ... @@ -342,8 +339,13 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
342 339 } catch (IOException e) {
343 340 e.printStackTrace();
344 341 }
  342 +
  343 +
  344 +
  345 +
  346 +
345 347 //OpenFlow message for flow tables modifications
346   - //The same as before, only the input and output ports are inverted
  348 + //RTCP
347 349 OFmessage= new OFFlowMod();
348 350 OFmatch= new OFMatch();
349 351 enqueue= new OFActionEnqueue();
... ... @@ -358,7 +360,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
358 360 OFmessage.setFlags((short) 0);
359 361  
360 362 //OFmatch.setTransportDestination((short)port);
361   - OFmatch.setTransportSource((short)port);
  363 + OFmatch.setTransportSource((short)(port+1));
362 364  
363 365  
364 366  
... ... @@ -369,11 +371,11 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
369 371 OFmatch.setDataLayerType((short)0x0800);
370 372 OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0);
371 373  
372   - OFmatch.setInputPort((short)2);
  374 + OFmatch.setInputPort((short)1);
373 375 OFmessage.setMatch(OFmatch);
374 376  
375 377 actions= new ArrayList<OFAction>(1);
376   - enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw).get(0));
  378 + enqueue=new OFActionEnqueue((short)2,queueInfos.get(sw).get(0));
377 379 actions.add(enqueue);
378 380  
379 381 OFmessage.setActions(actions);
... ... @@ -388,9 +390,6 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
388 390 }
389 391  
390 392  
391   -
392   -
393   -
394 393 //OpenFlow message for flow tables modifications
395 394 //RTCP
396 395 OFmessage= new OFFlowMod();
... ... @@ -418,11 +417,11 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
418 417 OFmatch.setDataLayerType((short)0x0800);
419 418 OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0);
420 419  
421   - OFmatch.setInputPort((short)1);
  420 + OFmatch.setInputPort((short)2);
422 421 OFmessage.setMatch(OFmatch);
423 422  
424 423 actions= new ArrayList<OFAction>(1);
425   - enqueue=new OFActionEnqueue((short)2,queueInfos.get(sw).get(0));
  424 + enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw).get(0));
426 425 actions.add(enqueue);
427 426  
428 427 OFmessage.setActions(actions);
... ... @@ -437,13 +436,14 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
437 436 }
438 437  
439 438  
  439 +
440 440 //OpenFlow message for flow tables modifications
441   - //RTCP
  441 + //Delete all the flows created by the switch for the voip
442 442 OFmessage= new OFFlowMod();
443 443 OFmatch= new OFMatch();
444 444 enqueue= new OFActionEnqueue();
445 445  
446   - OFmessage.setCommand((short)queueInfos.get(sw).get(2).intValue());
  446 + OFmessage.setCommand((short)3);
447 447 OFmessage.setCookie(0);
448 448 OFmessage.setIdleTimeout((short) 0);
449 449 OFmessage.setHardTimeout((short)0);
... ... @@ -452,27 +452,62 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
452 452 OFmessage.setOutPort((short)0xffff);
453 453 OFmessage.setFlags((short) 0);
454 454  
455   - //OFmatch.setTransportDestination((short)port);
456   - OFmatch.setTransportSource((short)(port+1));
  455 + OFmatch.setTransportSource((short)port);
  456 +
  457 + OFmatch.setWildcards(OFMatch.OFPFW_ALL //- OFMatch.OFPFW_IN_PORT
  458 + - OFMatch.OFPFW_TP_SRC - OFMatch.OFPFW_NW_PROTO
  459 + - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE
  460 + - OFMatch.OFPFW_NW_TOS);//*/
  461 + OFmatch.setNetworkTypeOfService((byte) 0);
  462 + OFmatch.setNetworkProtocol((byte)0x11);
  463 + OFmatch.setDataLayerType((short)0x0800);
  464 + OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0);
  465 +
  466 + //OFmatch.setInputPort((short)1);
  467 + OFmessage.setMatch(OFmatch);
457 468  
458 469  
  470 + OFmessage.setLength((short)(OFFlowMod.MINIMUM_LENGTH));
  471 + //System.out.println("@PELStats,sendOFFlowMod: trying to send message");
  472 + try {
  473 + sw.write(OFmessage, null);
  474 + sw.flush();
  475 + //System.out.println("@PELStats,sendOFFlowMod: message sent: "+OFmessage);
  476 + } catch (IOException e) {
  477 + e.printStackTrace();
  478 + }
459 479  
460   - OFmatch.setWildcards(OFMatch.OFPFW_ALL - OFMatch.OFPFW_IN_PORT
461   - - OFMatch.OFPFW_TP_SRC - OFMatch.OFPFW_NW_PROTO
462   - - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE);//*/
  480 + //OpenFlow message for flow tables modifications
  481 + //Delete all the flows created by the switch for the RTCP
  482 + OFmessage= new OFFlowMod();
  483 + OFmatch= new OFMatch();
  484 + enqueue= new OFActionEnqueue();
  485 +
  486 + OFmessage.setCommand((short)3);
  487 + OFmessage.setCookie(0);
  488 + OFmessage.setIdleTimeout((short) 0);
  489 + OFmessage.setHardTimeout((short)0);
  490 + OFmessage.setPriority((short)0xffff);
  491 + OFmessage.setBufferId(0);
  492 + OFmessage.setOutPort((short)0xffff);
  493 + OFmessage.setFlags((short) 0);
  494 +
  495 + OFmatch.setTransportSource((short)(port+1));
  496 +
  497 + OFmatch.setWildcards(OFMatch.OFPFW_ALL //- OFMatch.OFPFW_IN_PORT
  498 + - OFMatch.OFPFW_TP_SRC - OFMatch.OFPFW_NW_PROTO
  499 + - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE
  500 + - OFMatch.OFPFW_NW_TOS);//*/
  501 + OFmatch.setNetworkTypeOfService((byte) 0);
463 502 OFmatch.setNetworkProtocol((byte)0x11);
464 503 OFmatch.setDataLayerType((short)0x0800);
465 504 OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0);
466 505  
467   - OFmatch.setInputPort((short)2);
  506 + //OFmatch.setInputPort((short)1);
468 507 OFmessage.setMatch(OFmatch);
469 508  
470   - actions= new ArrayList<OFAction>(1);
471   - enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw).get(0));
472   - actions.add(enqueue);
473   -
474   - OFmessage.setActions(actions);
475   - OFmessage.setLength((short)(OFFlowMod.MINIMUM_LENGTH +OFActionEnqueue.MINIMUM_LENGTH));
  509 +
  510 + OFmessage.setLength((short)(OFFlowMod.MINIMUM_LENGTH));
476 511 //System.out.println("@PELStats,sendOFFlowMod: trying to send message");
477 512 try {
478 513 sw.write(OFmessage, null);
... ... @@ -481,6 +516,11 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP
481 516 } catch (IOException e) {
482 517 e.printStackTrace();
483 518 }
  519 +
  520 +
  521 +
  522 +
  523 +
484 524 }
485 525 private void sendThreshold(IOFSwitch sw, double mos, FloodlightContext cntx) {
486 526  
... ...