Stats Improvement
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index 3c9adb0..e06819b 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -2019,10 +2019,9 @@
if format:
#
detail = command_display_rest_join_entries(table_format, data, entries, detail)
-
- if 'realtimestats' in data and data['realtimestats'] == 'flow':
- entries = sdnsh.fix_realtime_flows(entries)
- check_single_entry = False
+ #if 'realtimestats' in data and data['realtimestats'] == 'flow':
+ # entries = sdnsh.fix_realtime_flows(entries)
+ # check_single_entry = False
if 'realtimestats' in data and data['realtimestats'] == 'features':
for entry in entries:
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index 5085216..cca3240 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -155,7 +155,7 @@
'tech-support',
),
}
-"""
+
SHOW_FLOW_ENTRY_COMMAND_DESCRIPTION = {
'name' : 'show',
'obj-type' : 'flow-entry',
@@ -186,7 +186,7 @@
)
}
-
+"""
SHOW_FIREWALL_COMMAND_DESCRIPTION = {
'name' : 'show',
'obj-type' : 'firewall-rule',
diff --git a/cli/cli/desc/version200/flow_entry.py b/cli/cli/desc/version200/flow_entry.py
index bbb49f9..dfe9449 100755
--- a/cli/cli/desc/version200/flow_entry.py
+++ b/cli/cli/desc/version200/flow_entry.py
@@ -15,7 +15,7 @@
#
import fmtcnv
-"""
+
FLOW_ENTRY_SUBMODE_COMMAND_DESCRIPTION = {
'name' : 'flow-entry',
'mode' : 'config-switch*',
@@ -489,4 +489,4 @@
},
},
}
-"""
+
diff --git a/cli/sdncon/controller/models.py b/cli/sdncon/controller/models.py
index e678aa2..1181f32 100755
--- a/cli/sdncon/controller/models.py
+++ b/cli/sdncon/controller/models.py
@@ -1027,7 +1027,7 @@
FIELD_INFO = (
{'name': 'switch_interface', 'rest_name': 'switch-interface'},
)
-"""
+
#
# ------------------------------------------------------------
@@ -1207,7 +1207,7 @@
{'name': 'tp_dst', 'rest_name': 'dst-port'},
{'name': 'actions', 'rest_name': 'actions'},
)
-"""
+
#
# ------------------------------------------------------------
diff --git a/cli/sdncon/rest/views.py b/cli/sdncon/rest/views.py
index 44af953..c8ff42e 100755
--- a/cli/sdncon/rest/views.py
+++ b/cli/sdncon/rest/views.py
@@ -404,6 +404,7 @@
This returns realtime statistics (flows, ports, table, aggregate,
desc, ...) for a dpid by calling the localhost sdnplatform
"""
+ #raise RestInvalidMethodException()
if request.method != 'GET':
raise RestInvalidMethodException()
#url = controller_url('core', 'switch', dpid, stattype, 'json')
@@ -412,6 +413,7 @@
if stattype == 'groupdesc':
stattype = 'groupDesc'
url = "http://localhost:8080/wm/floodlight/core/switch/%s/%s/json" % (dpid, stattype)
+ #url ="http://localhost:8080/wm/floodlight/core/switch/00:00:00:00:00:00:00:01/flow/json"
return get_sdnplatform_response(url)
@safe_rest_view
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
index f1936c2..b340ba9 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
@@ -2,21 +2,27 @@
import java.io.IOException;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import net.floodlightcontroller.core.web.OFFlowStatsEntryMod;
+import org.projectfloodlight.openflow.protocol.action.*;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.map.SerializerProvider;
import org.codehaus.jackson.map.ser.std.SerializerBase;
+import org.projectfloodlight.openflow.protocol.OFActionType;
import org.projectfloodlight.openflow.protocol.OFFlowModFlags;
import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry;
+import org.projectfloodlight.openflow.protocol.OFInstructionType;
import org.projectfloodlight.openflow.protocol.OFMatchV3;
import org.projectfloodlight.openflow.protocol.OFOxmList;
+import org.projectfloodlight.openflow.protocol.action.OFAction;
+import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.match.MatchFields;
import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
-import org.projectfloodlight.openflow.protocol.oxm.OFOxmIpv4DstMasked;
+import org.projectfloodlight.openflow.protocol.ver13.OFInstructionTypeSerializerVer13;
public class OFFlowStatsEntryModSerializer extends SerializerBase<OFFlowStatsEntryMod> {
@@ -30,10 +36,14 @@
JsonGenerationException {
OFFlowStatsEntry flowStatsEntry = FlowStatsEntryMod.getFlowStatsEntry();
OFOxmList matches = ((OFMatchV3)flowStatsEntry.getMatch()).getOxmList();
+
+ List<OFInstruction> instructions = flowStatsEntry.getInstructions();
Set<OFFlowModFlags> flags = flowStatsEntry.getFlags();
jGen.writeStartObject();
jGen.writeNumberField("byteCount", flowStatsEntry.getByteCount().getValue());
+ jGen.writeNumberField("pktCount", flowStatsEntry.getPacketCount().getValue());
+ jGen.writeNumberField("priority", flowStatsEntry.getPriority());
jGen.writeNumberField("cookie", flowStatsEntry.getCookie().getValue());
jGen.writeNumberField("durationNsec", flowStatsEntry.getDurationNsec());
jGen.writeNumberField("durationSec", flowStatsEntry.getDurationSec());
@@ -45,20 +55,97 @@
jGen.writeNumberField("hardTimeout", flowStatsEntry.getHardTimeout());
jGen.writeNumberField("idleTimeout", flowStatsEntry.getIdleTimeout());
jGen.writeArrayFieldStart("match");
- //jGen.writeStartObject();
+ jGen.writeStartObject();
Iterator<OFOxm<?>> match= matches.iterator();
while(match.hasNext()){
OFOxm<?> matchGeneric = match.next();
+ //jGen.writeObjectField(matchGeneric.getMatchField().id.toString(), matchGeneric.getValue().toString());
if (matchGeneric.getMatchField().id == MatchFields.IPV4_DST){
-
- //jGen.writeObjectField("networkDestination", ((OFOxmIpv4DstVer13) matchGeneric).getValue());
+ jGen.writeStringField("networkDestination", matchGeneric.getValue().toString());
}
-
-
+ else if (matchGeneric.getMatchField().id == MatchFields.IPV4_SRC){
+ jGen.writeStringField("networkSource", matchGeneric.getValue().toString());
+ }
+ else if (matchGeneric.getMatchField().id == MatchFields.ETH_DST){
+ jGen.writeStringField("dataLayerDestination", matchGeneric.getValue().toString());
+ }
+ else if (matchGeneric.getMatchField().id == MatchFields.ETH_SRC){
+ jGen.writeStringField("dataLayerSource", matchGeneric.getValue().toString());
+ }
+ else if (matchGeneric.getMatchField().id == MatchFields.ETH_TYPE){
+ jGen.writeStringField("dataLayerType", "0x"+matchGeneric.getValue().toString());
+ }
+ else if (matchGeneric.getMatchField().id == MatchFields.IN_PORT){
+ jGen.writeNumberField("inputPort", Integer.parseInt(matchGeneric.getValue().toString()));
+ }
+ else if (matchGeneric.getMatchField().id == MatchFields.MPLS_TC){
+ jGen.writeNumberField("mplsTc", Integer.parseInt(matchGeneric.getValue().toString()));
+ }
+ else if (matchGeneric.getMatchField().id == MatchFields.MPLS_LABEL){
+ jGen.writeNumberField("mplsLabel", Integer.parseInt(matchGeneric.getValue().toString()));
+ }
+ else if (matchGeneric.getMatchField().id == MatchFields.IP_PROTO){
+ jGen.writeNumberField("networkProtocol", Integer.parseInt(matchGeneric.getValue().toString()));
+ }
+ //TODO: Ask Saurav about the implementation of tcp and udp.
+ else if (matchGeneric.getMatchField().id == MatchFields.TCP_DST || matchGeneric.getMatchField().id == MatchFields.UDP_DST){
+ jGen.writeNumberField("transportDestination", Integer.parseInt(matchGeneric.getValue().toString()));
+ }
+ else if (matchGeneric.getMatchField().id == MatchFields.TCP_SRC || matchGeneric.getMatchField().id == MatchFields.UDP_SRC){
+ jGen.writeNumberField("transportSource", Integer.parseInt(matchGeneric.getValue().toString()));
+ }
}
+ jGen.writeEndObject();
jGen.writeEndArray();
+ /*\jGen.writeArrayFieldStart("instructions");
+ jGen.writeStartObject();
+ for (OFInstruction instruction: instructions){
+ jGen.writeObjectField("instructionType", instruction.getType().name());
+ jGen.writeArrayFieldStart("actions");
+ jGen.writeStartObject();
+ //OFInstructionApplyActions newInstruction = instruction.getClass().cast(instruction);
+ //instruction = ;
+ //instruction.g
+ if (instruction.getType().equals(OFInstructionType.APPLY_ACTIONS)){
+ //import org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions
+ List<OFAction> actions = ((OFInstructionApplyActions) instruction).getActions();
+ for (OFAction action : actions){
+ a
+ }
+ }
+ else if (instruction.getType().equals(OFInstructionType.APPLY_ACTIONS)){
+ List<OFAction> actions = ((OFInstructionApplyActions) instruction).getActions();
+ }
+ jGen.writeEndObject();
+ jGen.writeEndArray();
+ }
jGen.writeEndObject();
+ jGen.writeEndArray();*/
+ jGen.writeEndObject();
+
+
+ //for (OFAction action : actions){
+ /*if(action.getType().compareTo(OFActionType.SET_FIELD) == 0){
+ /*
+ * TODO: 1-Need better if condition.
+ * TODO: 2-Complete REST response. (Right now we are only sending what
+ * SegmentRouter CLI needs).
+ */
+ /*if (((OFActionSetField)action).getField().toString().contains("OFOxmEthSrcVer13")){
+ jGen.writeStringField("SET_DL_SRC", ((OFActionSetField)action).getField().getValue().toString());
+ }
+ else if (((OFActionSetField)action).getField().toString().contains("OFOxmEthDstVer13")){
+ jGen.writeStringField("SET_DL_DST", ((OFActionSetField)action).getField().getValue().toString());
+ }
+ System.out
+ }
+ else if(action.getType().compareTo(OFActionType.OUTPUT) == 0){
+ jGen.writeNumberField("OUTPPUT", ((OFActionOutput)action).getPort().getPortNumber());
+ }*/
+ //}
+ //jGen.writeEndObject();
+
}
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
index b4bddc7..c550674 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
@@ -20,6 +20,7 @@
protected OFGroupDescStatsEntryModSerializer(){
super(OFGroupDescStatsEntryMod.class);
}
+//TODO:- Java-doc
@Override
public void serialize(OFGroupDescStatsEntryMod groupDescStatsModEntry, JsonGenerator jGen,
@@ -36,7 +37,11 @@
List<OFAction> actions = bucket.getActions();
for (OFAction action : actions ){
if(action.getType().compareTo(OFActionType.SET_FIELD) == 0){
- //TODO: Need better if condition.
+ /*
+ * TODO: 1-Need better if condition.
+ * TODO: 2-Complete REST response. (Right now we are only sending what
+ * SegmentRouter CLI needs).
+ */
if (((OFActionSetField)action).getField().toString().contains("OFOxmEthSrcVer13")){
jGen.writeStringField("SET_DL_SRC", ((OFActionSetField)action).getField().getValue().toString());
}