Commit 4df235e664bc0381af4c4fcab949c99170f11d28
1 parent
f2eabdbd
debug
Showing
3 changed files
with
22 additions
and
19 deletions
src/main/java/net/floodlightcontroller/pelstats/PELStats.java
| ... | ... | @@ -74,7 +74,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 74 | 74 | public static ConcurrentHashMap<IOFSwitch,List<double[]>> cacStatsMap; |
| 75 | 75 | public static ConcurrentHashMap<IOFSwitch,Boolean> cacEnabledMap; |
| 76 | 76 | |
| 77 | - public static ConcurrentHashMap<IOFSwitch, List<Integer>> queueInfos; | |
| 77 | + public static ConcurrentHashMap<IOFSwitch, int[]> queueInfos; | |
| 78 | 78 | public static ConcurrentHashMap<IOFSwitch, List<Integer>> portsCallsMap; |
| 79 | 79 | |
| 80 | 80 | private double previousMos=-1; |
| ... | ... | @@ -143,21 +143,21 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 143 | 143 | int[] SwitchRTPPorts = ((StatisticVoIP_SIP)srb.getStatistic()).getRTPPorts(); |
| 144 | 144 | |
| 145 | 145 | //System.out.println("@PELStats: \tqueueInfos:"+queueInfos.get(sw).get(0)+" "+queueInfos.get(sw).get(1)+" "+queueInfos.get(sw).get(2)+" "); |
| 146 | - if(queueInfos.get(sw).get(2)==1 || queueInfos.get(sw).get(2)==3){ //if we want to delete or modify existing queue | |
| 146 | + if(queueInfos.get(sw)[2]==1 || queueInfos.get(sw)[2]==3){ //if we want to delete or modify existing queue | |
| 147 | 147 | //System.out.println("@PELStats: \tModification or deletion"); |
| 148 | 148 | for (int port : portsCallsMap.get(sw)) |
| 149 | 149 | { |
| 150 | 150 | //System.out.println("@PELStats: \tport modification or deletion: "+port); |
| 151 | 151 | sendOFFlowMod(sw,port); |
| 152 | 152 | } |
| 153 | - if(queueInfos.get(sw).get(2)==3){ //If we deleted the queue | |
| 153 | + if(queueInfos.get(sw)[2]==3){ //If we deleted the queue | |
| 154 | 154 | portsCallsMap.put(sw, new ArrayList<Integer>()); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | } |
| 159 | 159 | //System.out.println("@PELStats: \tintermission"); |
| 160 | - if (queueInfos.get(sw).get(2)!=3 && SwitchRTPPorts!=null) { | |
| 160 | + if (queueInfos.get(sw)[2]!=3 && SwitchRTPPorts!=null) { | |
| 161 | 161 | //System.out.println("@PELStats: \tModification or addition"); |
| 162 | 162 | for (int port:SwitchRTPPorts){ //For each calls of the switch |
| 163 | 163 | //System.out.println("@PELStats: \tModification or addition for port: "+port); |
| ... | ... | @@ -314,7 +314,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 314 | 314 | OFmatch= new OFMatch(); |
| 315 | 315 | enqueue= new OFActionEnqueue(); |
| 316 | 316 | |
| 317 | - OFmessage.setCommand((short)queueInfos.get(sw).get(2).intValue()); | |
| 317 | + OFmessage.setCommand((short)queueInfos.get(sw)[2]); | |
| 318 | 318 | OFmessage.setCookie(0); |
| 319 | 319 | OFmessage.setIdleTimeout((short) 0); |
| 320 | 320 | OFmessage.setHardTimeout((short)0); |
| ... | ... | @@ -339,7 +339,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 339 | 339 | OFmessage.setMatch(OFmatch); |
| 340 | 340 | |
| 341 | 341 | List<OFAction> actions= new ArrayList<OFAction>(1); |
| 342 | - enqueue=new OFActionEnqueue((short)2,queueInfos.get(sw).get(0)); | |
| 342 | + enqueue=new OFActionEnqueue((short)2,queueInfos.get(sw)[0]); | |
| 343 | 343 | actions.add(enqueue); |
| 344 | 344 | |
| 345 | 345 | OFmessage.setActions(actions); |
| ... | ... | @@ -361,7 +361,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 361 | 361 | OFmatch= new OFMatch(); |
| 362 | 362 | enqueue= new OFActionEnqueue(); |
| 363 | 363 | |
| 364 | - OFmessage.setCommand((short)queueInfos.get(sw).get(2).intValue()); | |
| 364 | + OFmessage.setCommand((short)queueInfos.get(sw)[2]); | |
| 365 | 365 | OFmessage.setCookie(0); |
| 366 | 366 | OFmessage.setIdleTimeout((short) 0); |
| 367 | 367 | OFmessage.setHardTimeout((short)0); |
| ... | ... | @@ -386,7 +386,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 386 | 386 | OFmessage.setMatch(OFmatch); |
| 387 | 387 | |
| 388 | 388 | actions= new ArrayList<OFAction>(1); |
| 389 | - enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw).get(0)); | |
| 389 | + enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw)[0]); | |
| 390 | 390 | actions.add(enqueue); |
| 391 | 391 | |
| 392 | 392 | OFmessage.setActions(actions); |
| ... | ... | @@ -410,7 +410,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 410 | 410 | OFmatch= new OFMatch(); |
| 411 | 411 | enqueue= new OFActionEnqueue(); |
| 412 | 412 | |
| 413 | - OFmessage.setCommand((short)queueInfos.get(sw).get(2).intValue()); | |
| 413 | + OFmessage.setCommand((short)queueInfos.get(sw)[2]); | |
| 414 | 414 | OFmessage.setCookie(0); |
| 415 | 415 | OFmessage.setIdleTimeout((short) 0); |
| 416 | 416 | OFmessage.setHardTimeout((short)0); |
| ... | ... | @@ -432,7 +432,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 432 | 432 | OFmessage.setMatch(OFmatch); |
| 433 | 433 | |
| 434 | 434 | actions= new ArrayList<OFAction>(1); |
| 435 | - enqueue=new OFActionEnqueue((short)2,queueInfos.get(sw).get(0)); | |
| 435 | + enqueue=new OFActionEnqueue((short)2,queueInfos.get(sw)[0]); | |
| 436 | 436 | actions.add(enqueue); |
| 437 | 437 | |
| 438 | 438 | OFmessage.setActions(actions); |
| ... | ... | @@ -453,7 +453,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 453 | 453 | OFmatch= new OFMatch(); |
| 454 | 454 | enqueue= new OFActionEnqueue(); |
| 455 | 455 | |
| 456 | - OFmessage.setCommand((short)queueInfos.get(sw).get(2).intValue()); | |
| 456 | + OFmessage.setCommand((short)queueInfos.get(sw)[2]); | |
| 457 | 457 | OFmessage.setCookie(0); |
| 458 | 458 | OFmessage.setIdleTimeout((short) 0); |
| 459 | 459 | OFmessage.setHardTimeout((short)0); |
| ... | ... | @@ -475,7 +475,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 475 | 475 | OFmessage.setMatch(OFmatch); |
| 476 | 476 | |
| 477 | 477 | actions= new ArrayList<OFAction>(1); |
| 478 | - enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw).get(0)); | |
| 478 | + enqueue=new OFActionEnqueue((short)1,queueInfos.get(sw)[0]); | |
| 479 | 479 | actions.add(enqueue); |
| 480 | 480 | |
| 481 | 481 | OFmessage.setActions(actions); |
| ... | ... | @@ -706,7 +706,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 706 | 706 | PelVendorExtension.initialize(); |
| 707 | 707 | PELStats.enabledStatistics = new ConcurrentHashMap<IOFSwitch, List<Integer>>(); |
| 708 | 708 | PELStats.portsCallsMap=new ConcurrentHashMap<IOFSwitch, List<Integer>>(); |
| 709 | - PELStats.queueInfos=new ConcurrentHashMap<IOFSwitch, List<Integer>>(); | |
| 709 | + PELStats.queueInfos=new ConcurrentHashMap<IOFSwitch, int[]>(); | |
| 710 | 710 | PELStats.callStatsMap=new ConcurrentHashMap<Integer, List<double[]>>() ; |
| 711 | 711 | PELStats.voipStatsMap=new ConcurrentHashMap<IOFSwitch, List<double[][]>>() ; |
| 712 | 712 | PELStats.cacStatsMap=new ConcurrentHashMap<IOFSwitch, List<double[]>>() ; | ... | ... |
src/main/java/net/floodlightcontroller/pelstats/rest/RESTQueue.java
| ... | ... | @@ -217,12 +217,15 @@ public class RESTQueue extends ServerResource{ |
| 217 | 217 | |
| 218 | 218 | |
| 219 | 219 | |
| 220 | - List<Integer> queueInfos =new ArrayList<Integer>(); | |
| 221 | - queueInfos.add(new Integer(idQueue)); | |
| 222 | - queueInfos.add(new Integer(priority)); | |
| 223 | - queueInfos.add(new Integer(action)); | |
| 220 | + int[] queuesInfos =new int[9]; | |
| 221 | + if(PELStats.queueInfos.get(mySwitch)!=null){ | |
| 222 | + queuesInfos=PELStats.queueInfos.get(mySwitch); | |
| 223 | + } | |
| 224 | + queuesInfos[0+3*(protocol-1)]=idQueue; | |
| 225 | + queuesInfos[0+3*(protocol-1)]=priority; | |
| 226 | + queuesInfos[0+3*(protocol-1)]=action; | |
| 224 | 227 | |
| 225 | - PELStats.queueInfos.put(mySwitch, queueInfos); | |
| 228 | + PELStats.queueInfos.put(mySwitch, queuesInfos); | |
| 226 | 229 | |
| 227 | 230 | if (action==3 && protocol==1){ |
| 228 | 231 | for (int port : PELStats.portsCallsMap.get(mySwitch)) | ... | ... |
src/main/java/org/openflow/protocol/Pel/statistics/StatisticVoIP_CPU.java
| ... | ... | @@ -68,7 +68,7 @@ public class StatisticVoIP_CPU extends Statistic{ |
| 68 | 68 | |
| 69 | 69 | @Override |
| 70 | 70 | public String toJSON() { |
| 71 | - System.out.println("VoIP CPU Json : "+cpu+" : "+memory); | |
| 71 | + //System.out.println("VoIP CPU Json : "+cpu+" : "+memory); | |
| 72 | 72 | return "[{\"cpu\":\""+cpu+"\",\"memory\":\""+memory+"\"}]"; |
| 73 | 73 | } |
| 74 | 74 | ... | ... |