Commit bbd10c4762bcf7f89bc73c9325ac0125596af37a
1 parent
45f930d8
CAC message when nbCalls>100
Showing
2 changed files
with
39 additions
and
1 deletions
src/main/java/net/floodlightcontroller/pelstats/PELStats.java
| ... | ... | @@ -71,6 +71,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 71 | 71 | public static ConcurrentHashMap<IOFSwitch,List<double[][]>> voipStatsMap; |
| 72 | 72 | |
| 73 | 73 | public static ConcurrentHashMap<IOFSwitch,List<double[]>> cacStatsMap; |
| 74 | + public static ConcurrentHashMap<IOFSwitch,Boolean> cacEnabledMap; | |
| 74 | 75 | |
| 75 | 76 | public static ConcurrentHashMap<IOFSwitch, List<Integer>> queueInfos; |
| 76 | 77 | public static ConcurrentHashMap<IOFSwitch, List<Integer>> portsCallsMap; |
| ... | ... | @@ -217,6 +218,42 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 217 | 218 | //System.out.println("@PELStats \tOK"); |
| 218 | 219 | |
| 219 | 220 | |
| 221 | + if (cacEnabledMap.get(sw)==null){ | |
| 222 | + cacEnabledMap.put(sw,false); | |
| 223 | + } | |
| 224 | + if (((StatisticVoIP_CAC)srb.getStatistic()).getStats()[1]>100 ){//nbCalls>100 | |
| 225 | + if (cacEnabledMap.get(sw)==false){ | |
| 226 | + int nb= 2*16777216+7*65536+1*4096+1; | |
| 227 | + PelVendorHeader message= new PelVendorHeader(nb); | |
| 228 | + try { | |
| 229 | + sw.write(message, null); | |
| 230 | + cacEnabledMap.put(sw,true); | |
| 231 | + System.out.println("Enabling CAC"); | |
| 232 | + | |
| 233 | + } catch (IOException e) { | |
| 234 | + e.printStackTrace(); | |
| 235 | + } | |
| 236 | + } | |
| 237 | + } | |
| 238 | + else | |
| 239 | + { | |
| 240 | + if(cacEnabledMap.get(sw)==true){ | |
| 241 | + int nb= 2*16777216+7*65536+1*4096+0; | |
| 242 | + PelVendorHeader message= new PelVendorHeader(nb); | |
| 243 | + try { | |
| 244 | + sw.write(message, null); | |
| 245 | + cacEnabledMap.put(sw,false); | |
| 246 | + System.out.println("Disabling CAC"); | |
| 247 | + | |
| 248 | + } catch (IOException e) { | |
| 249 | + e.printStackTrace(); | |
| 250 | + } | |
| 251 | + | |
| 252 | + } | |
| 253 | + } | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 220 | 257 | } |
| 221 | 258 | |
| 222 | 259 | if(enabledStatistics.containsKey(sw)){ |
| ... | ... | @@ -657,6 +694,7 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 657 | 694 | PELStats.callStatsMap=new ConcurrentHashMap<Integer, List<double[]>>() ; |
| 658 | 695 | PELStats.voipStatsMap=new ConcurrentHashMap<IOFSwitch, List<double[][]>>() ; |
| 659 | 696 | PELStats.cacStatsMap=new ConcurrentHashMap<IOFSwitch, List<double[]>>() ; |
| 697 | + PELStats.cacEnabledMap=new ConcurrentHashMap<IOFSwitch, Boolean>() ; | |
| 660 | 698 | requestThread.start(); |
| 661 | 699 | } |
| 662 | 700 | ... | ... |
src/main/java/org/openflow/protocol/Pel/statistics/StatisticVoIP_CAC.java