7777import org .openflow .protocol .OFMessage ;
7878import org .openflow .protocol .OFPhysicalPort ;
7979import org .openflow .protocol .OFPort ;
80+ import org .openflow .protocol .OFStatisticsReply .OFStatisticsReplyFlags ;
8081import org .openflow .protocol .OFType ;
8182import org .openflow .protocol .OFError .OFHelloFailedCode ;
8283import org .openflow .protocol .action .*;
@@ -133,6 +134,8 @@ public class FVClassifier implements FVEventHandler, FVSendMsg, FlowMapChangedLi
133134 private boolean statsWindowOpen = true ;
134135 private HashMap <String , ArrayList <FVFlowStatisticsReply >> flowStats =
135136 new HashMap <String , ArrayList <FVFlowStatisticsReply >>();
137+ private HashMap <String , ArrayList <FVFlowStatisticsReply >> actualStats =
138+ new HashMap <String , ArrayList <FVFlowStatisticsReply >>();
136139 private ConcurrentLinkedQueue <String > toDeleteSlices = new ConcurrentLinkedQueue <String >();
137140
138141 // OFPP_FLOOD
@@ -1008,8 +1011,9 @@ public boolean isRateLimited(String sliceName) {
10081011
10091012 private synchronized ArrayList <FVFlowStatisticsReply > getFlowStats (String sliceName ) {
10101013 ArrayList <FVFlowStatisticsReply > stats = new ArrayList <FVFlowStatisticsReply >();
1011- if (flowStats .get (sliceName ) != null )
1012- stats .addAll (flowStats .get (sliceName ));
1014+ if (actualStats .get (sliceName ) != null )
1015+ stats .addAll (actualStats .get (sliceName ));
1016+ FVLog .log (LogLevel .DEBUG , null , actualStats .toString ());
10131017 return stats ;
10141018 }
10151019
@@ -1069,7 +1073,7 @@ private boolean matchContainsPort(FVFlowStatisticsReply reply, short outPort) {
10691073 return false ;
10701074 }
10711075
1072- public void sendFlowStatsResp (FVSlicer fvSlicer , FVStatisticsRequest original ) {
1076+ public void sendFlowStatsResp (FVSlicer fvSlicer , FVStatisticsRequest original , short flag ) {
10731077 FVFlowStatisticsRequest orig = (FVFlowStatisticsRequest ) original .getStatistics ().get (0 );
10741078
10751079
@@ -1093,7 +1097,7 @@ public void sendFlowStatsResp(FVSlicer fvSlicer, FVStatisticsRequest original) {
10931097
10941098 }
10951099 statsReply .setStatistics (stats );
1096-
1100+ statsReply . setFlags ( flag );
10971101 statsReply .setXid (original .getXid ());
10981102
10991103 statsReply .setVersion (original .getVersion ());
@@ -1109,7 +1113,8 @@ public void sendFlowStatsResp(FVSlicer fvSlicer, FVStatisticsRequest original) {
11091113
11101114 //public synchronized void classifyFlowStats(FVStatisticsReply fvStatisticsReply, HashMap<String,Object> cache) {
11111115 public synchronized void classifyFlowStats (FVStatisticsReply fvStatisticsReply ) {
1112- flowStats .clear ();
1116+ actualStats .clear ();
1117+
11131118 List <OFStatistics > stats = fvStatisticsReply .getStatistics ();
11141119
11151120 //Adding for registering a FlowTable
@@ -1138,6 +1143,11 @@ public synchronized void classifyFlowStats(FVStatisticsReply fvStatisticsReply)
11381143 stat .setCookie (pair .getCookie ());
11391144 addToFlowStats (stat , pair .getSliceName ());
11401145 }
1146+ actualStats .putAll (flowStats );
1147+ FVLog .log (LogLevel .DEBUG , this , " actualStats: " ,actualStats .toString (), "flowStats: " , flowStats .toString ());
1148+ if ((fvStatisticsReply .getFlags () != OFStatisticsReplyFlags .REPLY_MORE .getTypeValue ()) ){
1149+ flowStats .clear ();
1150+ }
11411151 for (String slice : toDeleteSlices ) {
11421152 cleanUpFlowMods (slice );
11431153 }
0 commit comments