7676import org .openflow .protocol .OFMessage ;
7777import org .openflow .protocol .OFPhysicalPort ;
7878import org .openflow .protocol .OFPort ;
79+ import org .openflow .protocol .OFStatisticsReply .OFStatisticsReplyFlags ;
7980import org .openflow .protocol .OFType ;
8081import org .openflow .protocol .OFError .OFHelloFailedCode ;
8182import org .openflow .protocol .action .OFAction ;
@@ -127,6 +128,8 @@ public class FVClassifier implements FVEventHandler, FVSendMsg, FlowMapChangedLi
127128 private boolean statsWindowOpen = true ;
128129 private HashMap <String , ArrayList <FVFlowStatisticsReply >> flowStats =
129130 new HashMap <String , ArrayList <FVFlowStatisticsReply >>();
131+ private HashMap <String , ArrayList <FVFlowStatisticsReply >> actualStats =
132+ new HashMap <String , ArrayList <FVFlowStatisticsReply >>();
130133 private ConcurrentLinkedQueue <String > toDeleteSlices = new ConcurrentLinkedQueue <String >();
131134
132135 // OFPP_FLOOD
@@ -984,8 +987,9 @@ public boolean isRateLimited(String sliceName) {
984987
985988 private synchronized ArrayList <FVFlowStatisticsReply > getFlowStats (String sliceName ) {
986989 ArrayList <FVFlowStatisticsReply > stats = new ArrayList <FVFlowStatisticsReply >();
987- if (flowStats .get (sliceName ) != null )
988- stats .addAll (flowStats .get (sliceName ));
990+ if (actualStats .get (sliceName ) != null )
991+ stats .addAll (actualStats .get (sliceName ));
992+ FVLog .log (LogLevel .DEBUG , null , actualStats .toString ());
989993 return stats ;
990994 }
991995
@@ -1045,7 +1049,7 @@ private boolean matchContainsPort(FVFlowStatisticsReply reply, short outPort) {
10451049 return false ;
10461050 }
10471051
1048- public void sendFlowStatsResp (FVSlicer fvSlicer , FVStatisticsRequest original ) {
1052+ public void sendFlowStatsResp (FVSlicer fvSlicer , FVStatisticsRequest original , short flag ) {
10491053 FVFlowStatisticsRequest orig = (FVFlowStatisticsRequest ) original .getStatistics ().get (0 );
10501054
10511055
@@ -1069,7 +1073,7 @@ public void sendFlowStatsResp(FVSlicer fvSlicer, FVStatisticsRequest original) {
10691073
10701074 }
10711075 statsReply .setStatistics (stats );
1072-
1076+ statsReply . setFlags ( flag );
10731077 statsReply .setXid (original .getXid ());
10741078
10751079 statsReply .setVersion (original .getVersion ());
@@ -1084,8 +1088,7 @@ public void sendFlowStatsResp(FVSlicer fvSlicer, FVStatisticsRequest original) {
10841088
10851089
10861090 public synchronized void classifyFlowStats (FVStatisticsReply fvStatisticsReply ) {
1087-
1088- flowStats .clear ();
1091+ actualStats .clear ();
10891092 List <OFStatistics > stats = fvStatisticsReply .getStatistics ();
10901093 for (OFStatistics s : stats ) {
10911094 FVFlowStatisticsReply stat = (FVFlowStatisticsReply ) s ;
@@ -1098,6 +1101,11 @@ public synchronized void classifyFlowStats(FVStatisticsReply fvStatisticsReply)
10981101 stat .setCookie (pair .getCookie ());
10991102 addToFlowStats (stat , pair .getSliceName ());
11001103 }
1104+ actualStats .putAll (flowStats );
1105+ FVLog .log (LogLevel .DEBUG , this , " actualStats: " ,actualStats .toString (), "flowStats: " , flowStats .toString ());
1106+ if ((fvStatisticsReply .getFlags () != OFStatisticsReplyFlags .REPLY_MORE .getTypeValue ()) ){
1107+ flowStats .clear ();
1108+ }
11011109 for (String slice : toDeleteSlices ) {
11021110 cleanUpFlowMods (slice );
11031111 }
0 commit comments