Commit f2eabdbd4fe943053287e1912d7a6717d458c9cd
1 parent
cd8cfb96
new bw export
Showing
5 changed files
with
53 additions
and
9 deletions
src/main/java/net/floodlightcontroller/pelstats/PELStats.java
| ... | ... | @@ -262,7 +262,10 @@ public class PELStats implements IFloodlightModule, IOFMessageListener, RestAPIP |
| 262 | 262 | if(cacStatsMap.get(sw)!=null){ |
| 263 | 263 | ArrayList<double[]> cacStats = new ArrayList<double[]>(cacStatsMap.get(sw)); |
| 264 | 264 | double[] stats =cacStats.get(cacStats.size()-1); |
| 265 | - stats[4]=((StatisticVoIP_Queue)srb.getStatistic()).getVoipBandwidth(); | |
| 265 | + double[] bw=((StatisticVoIP_Queue)srb.getStatistic()).getBandwidth(); | |
| 266 | + stats[4]=bw[0]; | |
| 267 | + stats[5]=bw[1]; | |
| 268 | + stats[6]=bw[2]; | |
| 266 | 269 | cacStats.set(cacStats.size()-1, stats); |
| 267 | 270 | cacStatsMap.put(sw,cacStats); |
| 268 | 271 | } | ... | ... |
src/main/java/net/floodlightcontroller/pelstats/rest/RESTExportStats.java
| ... | ... | @@ -171,13 +171,15 @@ public class RESTExportStats extends ServerResource{ |
| 171 | 171 | //out.println("Switch:\t"+entry.getKey()); |
| 172 | 172 | //out.println("Number of calls\tBandwidth\tVoIP Bandwidth"); |
| 173 | 173 | for (double[] list:PELStats.cacStatsMap.get(entry.getKey())){ |
| 174 | - if(list[1]!=0)out.println(list[0]+"\t"+list[3]+"\t"+list[4]); | |
| 174 | + if(list[1]!=0)out.println(list[0]+"\t"+list[3]+"\t"+list[4]+"\t"+list[5]+"\t"+list[6]); | |
| 175 | + // date total bw voip bw web bw mail bw | |
| 175 | 176 | } |
| 176 | 177 | out.println("\n"); |
| 177 | 178 | } |
| 179 | + System.out.println("-> stats export successful"); | |
| 178 | 180 | } |
| 179 | 181 | |
| 180 | - System.out.println("-> stats export successful"); | |
| 182 | + //System.out.println("-> stats export successful"); | |
| 181 | 183 | } |
| 182 | 184 | |
| 183 | 185 | }catch (FileNotFoundException e) { | ... | ... |
src/main/java/net/floodlightcontroller/pelstats/rest/RESTQueue.java
| ... | ... | @@ -15,8 +15,10 @@ import net.floodlightcontroller.pelstats.rest.RESTCallAdmissionControl.StatEnabl |
| 15 | 15 | |
| 16 | 16 | import org.openflow.protocol.OFFlowMod; |
| 17 | 17 | import org.openflow.protocol.OFMatch; |
| 18 | +import org.openflow.protocol.OFPacketQueue; | |
| 18 | 19 | import org.openflow.protocol.OFPort; |
| 19 | 20 | import org.openflow.protocol.OFQueueGetConfigRequest; |
| 21 | +import org.openflow.protocol.OFQueueProp; | |
| 20 | 22 | import org.openflow.protocol.OFStatisticsRequest; |
| 21 | 23 | import org.openflow.protocol.OFType; |
| 22 | 24 | import org.openflow.protocol.Pel.IPAddress; |
| ... | ... | @@ -231,6 +233,32 @@ public class RESTQueue extends ServerResource{ |
| 231 | 233 | PELStats.portsCallsMap.put(mySwitch, new ArrayList<Integer>()); |
| 232 | 234 | |
| 233 | 235 | } |
| 236 | + /*if (action==0 && protocol==1){ | |
| 237 | + OFQueueGetConfigRequest ofmessage=new OFQueueGetConfigRequest(); | |
| 238 | + ofmessage.setPortNumber((short)1); | |
| 239 | + | |
| 240 | + /*OFPacketQueue ofmessage = new OFPacketQueue(); | |
| 241 | + OFQueueProp property = new OFQueueProp(); | |
| 242 | + List<OFQueueProp> lProperty= new ArrayList<OFQueueProp>(); | |
| 243 | + | |
| 244 | + property.setType(OFQueueProp.OFQueuePropType.OFPQT_MIN_RATE); | |
| 245 | + property.setRate((short)700); | |
| 246 | + lProperty.add(property); | |
| 247 | + | |
| 248 | + ofmessage.setProperties(lProperty); | |
| 249 | + ofmessage.setQueueId(idQueue);// | |
| 250 | + | |
| 251 | + try { | |
| 252 | + mySwitch.write(ofmessage, null); | |
| 253 | + mySwitch.flush(); | |
| 254 | + //System.out.println("@RESTQueue message sent: "+OFmessage); | |
| 255 | + } catch (IOException e) { | |
| 256 | + e.printStackTrace(); | |
| 257 | + } | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + }//*/ | |
| 234 | 262 | if (protocol!=1){ |
| 235 | 263 | //OpenFlow message for flow tables modifications |
| 236 | 264 | // | ... | ... |
src/main/java/org/openflow/protocol/Pel/statistics/StatisticVoIP_CAC.java
| ... | ... | @@ -42,11 +42,15 @@ public class StatisticVoIP_CAC extends Statistic{ |
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | public double[] getStats(){ |
| 45 | - double stats[]=new double[5];//the 5th value is the voipBandwidth, added in the PELStats class when a Queue packet is detected | |
| 46 | - stats[1]=nbCalls; | |
| 47 | - stats[2]=averageMos; | |
| 45 | + double stats[]=new double[7];//the 5th-7th values are the Bandwidths of protocols, added in the PELStats class when a Queue packet is detected | |
| 48 | 46 | stats[0]=date.getTime(); |
| 47 | + stats[1]=nbCalls; | |
| 48 | + stats[2]=averageMos; | |
| 49 | 49 | stats[3]=bandwidth; |
| 50 | + //stats[4]=VoIP bandwidth; | |
| 51 | + //stats[5]=WEB bandwidth; | |
| 52 | + //stats[6]=Mail bandwidth; | |
| 53 | + | |
| 50 | 54 | return stats; |
| 51 | 55 | } |
| 52 | 56 | ... | ... |
src/main/java/org/openflow/protocol/Pel/statistics/StatisticVoIP_Queue.java
| ... | ... | @@ -44,13 +44,20 @@ public class StatisticVoIP_Queue extends Statistic{ |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | } |
| 47 | - public double getVoipBandwidth(){ | |
| 48 | - double bw = 0; | |
| 47 | + public double[] getBandwidth(){ | |
| 48 | + double[] bw = new double[3]; | |
| 49 | 49 | |
| 50 | 50 | for (int i=0;i<nbQueues;i++){ |
| 51 | 51 | if (protocol[i]==1){ |
| 52 | - bw+=bandwidth[i]; | |
| 52 | + bw[0]+=bandwidth[i]; | |
| 53 | 53 | } |
| 54 | + else if (protocol[i]==2){ | |
| 55 | + bw[1]+=bandwidth[i]; | |
| 56 | + } | |
| 57 | + else if (protocol[i]==3){ | |
| 58 | + bw[2]+=bandwidth[i]; | |
| 59 | + } | |
| 60 | + | |
| 54 | 61 | } |
| 55 | 62 | |
| 56 | 63 | return bw; | ... | ... |