Commit 81a0fe239d9953ae640f981fc8328e3f5f1098a3
1 parent
d564a295
flowMod for RTCP packets
Showing
1 changed file
with
93 additions
and
0 deletions
src/main/java/net/floodlightcontroller/pelstats/PELStats.java
| ... | ... | @@ -337,6 +337,99 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 337 | 337 | } catch (IOException e) { |
| 338 | 338 | e.printStackTrace(); |
| 339 | 339 | } |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + //OpenFlow message for flow tables modifications | |
| 346 | + //RTCP | |
| 347 | + OFmessage= new OFFlowMod(); | |
| 348 | + OFmatch= new OFMatch(); | |
| 349 | + enqueue= new OFActionEnqueue(); | |
| 350 | + | |
| 351 | + OFmessage.setCommand((short)0); | |
| 352 | + OFmessage.setCookie(0); | |
| 353 | + OFmessage.setIdleTimeout((short) 0); | |
| 354 | + OFmessage.setHardTimeout((short)0); | |
| 355 | + OFmessage.setPriority((short)0xffff); | |
| 356 | + OFmessage.setBufferId(0); | |
| 357 | + OFmessage.setOutPort((short)0xffff); | |
| 358 | + OFmessage.setFlags((short) 0); | |
| 359 | + | |
| 360 | + //OFmatch.setTransportDestination((short)port); | |
| 361 | + OFmatch.setTransportSource((short)(port+1)); | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + OFmatch.setWildcards(OFMatch.OFPFW_ALL - OFMatch.OFPFW_IN_PORT | |
| 366 | + - OFMatch.OFPFW_TP_SRC - OFMatch.OFPFW_NW_PROTO | |
| 367 | + - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE);//*/ | |
| 368 | + OFmatch.setNetworkProtocol((byte)0x11); | |
| 369 | + OFmatch.setDataLayerType((short)0x0800); | |
| 370 | + OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0); | |
| 371 | + | |
| 372 | + OFmatch.setInputPort((short)1); | |
| 373 | + OFmessage.setMatch(OFmatch); | |
| 374 | + | |
| 375 | + actions= new ArrayList<OFAction>(1); | |
| 376 | + enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw).get(0)); | |
| 377 | + actions.add(enqueue); | |
| 378 | + | |
| 379 | + OFmessage.setActions(actions); | |
| 380 | + OFmessage.setLength((short)(OFFlowMod.MINIMUM_LENGTH +OFActionEnqueue.MINIMUM_LENGTH)); | |
| 381 | + //System.out.println("@PELStats,sendOFFlowMod: trying to send message"); | |
| 382 | + try { | |
| 383 | + sw.write(OFmessage, null); | |
| 384 | + sw.flush(); | |
| 385 | + //System.out.println("@PELStats,sendOFFlowMod: message sent: "+OFmessage); | |
| 386 | + } catch (IOException e) { | |
| 387 | + e.printStackTrace(); | |
| 388 | + } | |
| 389 | + //OpenFlow message for flow tables modifications | |
| 390 | + //RTCP | |
| 391 | + OFmessage= new OFFlowMod(); | |
| 392 | + OFmatch= new OFMatch(); | |
| 393 | + enqueue= new OFActionEnqueue(); | |
| 394 | + | |
| 395 | + OFmessage.setCommand((short)0); | |
| 396 | + OFmessage.setCookie(0); | |
| 397 | + OFmessage.setIdleTimeout((short) 0); | |
| 398 | + OFmessage.setHardTimeout((short)0); | |
| 399 | + OFmessage.setPriority((short)0xffff); | |
| 400 | + OFmessage.setBufferId(0); | |
| 401 | + OFmessage.setOutPort((short)0xffff); | |
| 402 | + OFmessage.setFlags((short) 0); | |
| 403 | + | |
| 404 | + //OFmatch.setTransportDestination((short)port); | |
| 405 | + OFmatch.setTransportSource((short)(port+1)); | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + OFmatch.setWildcards(OFMatch.OFPFW_ALL - OFMatch.OFPFW_IN_PORT | |
| 410 | + - OFMatch.OFPFW_TP_SRC - OFMatch.OFPFW_NW_PROTO | |
| 411 | + - OFMatch.OFPFW_DL_VLAN_PCP -OFMatch.OFPFW_DL_TYPE);//*/ | |
| 412 | + OFmatch.setNetworkProtocol((byte)0x11); | |
| 413 | + OFmatch.setDataLayerType((short)0x0800); | |
| 414 | + OFmatch.setDataLayerVirtualLanPriorityCodePoint((byte)0x0); | |
| 415 | + | |
| 416 | + OFmatch.setInputPort((short)2); | |
| 417 | + OFmessage.setMatch(OFmatch); | |
| 418 | + | |
| 419 | + actions= new ArrayList<OFAction>(1); | |
| 420 | + enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw).get(0)); | |
| 421 | + actions.add(enqueue); | |
| 422 | + | |
| 423 | + OFmessage.setActions(actions); | |
| 424 | + OFmessage.setLength((short)(OFFlowMod.MINIMUM_LENGTH +OFActionEnqueue.MINIMUM_LENGTH)); | |
| 425 | + //System.out.println("@PELStats,sendOFFlowMod: trying to send message"); | |
| 426 | + try { | |
| 427 | + sw.write(OFmessage, null); | |
| 428 | + sw.flush(); | |
| 429 | + //System.out.println("@PELStats,sendOFFlowMod: message sent: "+OFmessage); | |
| 430 | + } catch (IOException e) { | |
| 431 | + e.printStackTrace(); | |
| 432 | + } | |
| 340 | 433 | } |
| 341 | 434 | private void sendThreshold(IOFSwitch sw, double mos, FloodlightContext cntx) { |
| 342 | 435 | ... | ... |