Stats Improvement
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index 695d692..15ab705 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -1925,7 +1925,7 @@
'transportDestination' : { 'verbose-name' : 'Dst Port',
'formatter' : fmtcnv.decode_dst_port
},
- 'actions' : { 'verbose-name' : 'Actions',
+ 'actions' : { 'verbose-name' : 'Instructions',
},
'vnsName' : { 'verbose-name' : 'VNS'
},
@@ -1945,29 +1945,29 @@
'default' : [
'Idx', 'cookie', 'priority',
'byteCount', 'packetCount',
- 'mplsTc', 'mplsLabel',
+ 'mplsLabel','mplsBoS','mplsTc',
'flow-brief', 'actions'
],
'scoped' : [
'Idx', 'byteCount', 'packetCount', 'durationSeconds',
'cookie', 'priority',
- 'mplsTc', 'mplsLabel','actions'
+ 'mplsLabel','mplsBoS','mplsTc','actions'
],
'brief' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
'cookie','priority',
- 'mplsTc', 'mplsLabel','actions'
+ 'mplsLabel','mplsBoS','mplsTc','actions'
],
'default' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
'cookie','priority',
- 'mplsTc', 'mplsLabel','actions'
+ 'mplsLabel','mplsBoS','mplsTc','actions'
],
'scoped' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
'cookie','priority',
- 'mplsTc', 'mplsLabel','actions'
+ 'mplsLabel','mplsBoS','mplsTc','actions'
],
'details' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
'cookie','priority',
- 'mplsTc', 'mplsLabel','actions'
+ 'mplsLabel','mplsBoS','mplsTc','actions'
],
#'vns_flow': [ 'Idx', 'dataLayerSource', 'dataLayerDestination', 'dataLayerVirtualLan', 'dataLayerType'],
#'summary' : [ 'Idx', 'vnsName', 'vnsFlowCnt', 'flowEntryCnt'],
@@ -2047,7 +2047,7 @@
'transportDestination' : { 'verbose-name' : 'Dst Port',
'formatter' : fmtcnv.decode_dst_port
},
- 'actions' : { 'verbose-name' : 'Actions'
+ 'actions' : { 'verbose-name' : 'Instructions'
},
'vnsName' : { 'verbose-name' : 'VNS'
},
@@ -2074,32 +2074,32 @@
'Idx', 'cookie', 'priority'
'byteCount', 'packetCount',
'dataLayerSource', 'dataLayerDestination',
- 'flow-brief','mplsTc','mplsLabel','actions'
+ 'flow-brief','mplsLabel','mplsBoS','mplsTc','actions'
],
'scoped' : [
'Idx', 'cookie', 'priority',
'byteCount', 'packetCount',
- 'dataLayerSource', 'dataLayerDestination','mplsTc','mplsLabel',
+ 'dataLayerSource', 'dataLayerDestination','mplsLabel','mplsBoS','mplsTc'
'flow-brief','actions'
],
'brief' : [ 'Idx', 'cookie','priority', 'dataLayerSource', 'dataLayerDestination',
'networkSource', 'networkDestination', 'networkProtocol',
- 'transportSource', 'transportDestination','mplsTc','mplsLabel','actions'],
+ 'transportSource', 'transportDestination','mplsLabel','mplsBoS','mplsTc','actions'],
'default' : [ 'Idx','byteCount', 'packetCount', 'durationSeconds',
'cookie','priority', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
'dataLayerType', 'networkSource', 'networkDestination', 'networkProtocol',
- 'transportSource', 'transportDestination','mplsTc','mplsLabel', 'actions'],
+ 'transportSource', 'transportDestination''mplsLabel','mplsBoS','mplsTc', 'actions'],
'scoped' : [ 'Idx','byteCount', 'packetCount', 'durationSeconds',
'cookie','priority', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
'dataLayerType', 'networkSource', 'networkDestination', 'networkProtocol',
- 'transportSource', 'transportDestination','mplsTc','mplsLabel','actions'],
+ 'transportSource', 'transportDestination','mplsLabel','mplsBoS','mplsTc','actions'],
'details' : [ 'Idx','byteCount', 'packetCount', 'durationSeconds',
'cookie', 'priority','hardTimeout', 'idleTimeout', 'priority', 'tableId', 'inputPort',
'dataLayerSource', 'dataLayerDestination', 'dataLayerType', 'dataLayerVirtualLan',
'dataLayerVirtualLanPriorityCodePoint', 'networkSource', 'networkDestination',
'networkProtocol', 'transportSource', 'transportDestination',
- 'networkTypeOfService','mplsTc','mplsLabel', 'actions'],
+ 'networkTypeOfService','mplsLabel','mplsBoS','mplsTc', 'actions'],
#'vns_flow': [ 'Idx', 'dataLayerSource', 'dataLayerDestination', 'dataLayerVirtualLan', 'dataLayerType'],
#'summary' : [ 'Idx', 'vnsName', 'vnsFlowCnt', 'flowEntryCnt'],
},
@@ -2178,7 +2178,7 @@
'transportDestination' : { 'verbose-name' : 'Dst Port',
'formatter' : fmtcnv.decode_dst_port
},
- 'actions' : { 'verbose-name' : 'Actions'
+ 'actions' : { 'verbose-name' : 'Instructions'
},
'vnsName' : { 'verbose-name' : 'VNS'
},
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 4a83230..f780fd7 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
@@ -38,7 +38,6 @@
OFOxmList matches = ((OFMatchV3)flowStatsEntry.getMatch()).getOxmList();
List<OFInstruction> instructions = flowStatsEntry.getInstructions();
- Set<OFFlowModFlags> flags = flowStatsEntry.getFlags();
jGen.writeStartObject();
//System.out.println("flowstats:\n\n\n"+ flowStatsEntry);
jGen.writeNumberField("byteCount", flowStatsEntry.getByteCount().getValue());
@@ -61,7 +60,7 @@
+(matchGeneric.isMasked() ?
OFFlowStatsEntryModSerializer.covertToMask(
IPv4.toIPv4Address(
- matchGeneric.getMask().toString())):"0"));
+ matchGeneric.getMask().toString())):"32"));
}
else if (matchGeneric.getMatchField().id == MatchFields.IPV4_SRC){
jGen.writeStringField("networkSource", matchGeneric.getValue().toString()
@@ -69,7 +68,7 @@
+(matchGeneric.isMasked() ?
OFFlowStatsEntryModSerializer.covertToMask(
IPv4.toIPv4Address(
- matchGeneric.getMask().toString())):"0"));
+ matchGeneric.getMask().toString())):"32"));
}
else if (matchGeneric.getMatchField().id == MatchFields.ETH_DST){
jGen.writeStringField("dataLayerDestination", matchGeneric.getValue().toString());
@@ -108,12 +107,21 @@
jGen.writeStartArray();
List<OFAction> actions = null;
for (OFInstruction instruction: instructions){
+
if(instruction.getType().equals(OFInstructionType.APPLY_ACTIONS)){
actions = ((OFInstructionApplyActions)instruction).getActions();
}
else if(instruction.getType().equals(OFInstructionType.WRITE_ACTIONS)){
actions = ((OFInstructionWriteActions)instruction).getActions();
}
+ else if(instruction.getType().equals(OFInstructionType.GOTO_TABLE)){
+ jGen.writeFieldName(instruction.getType().name());
+ jGen.writeStartObject();
+ jGen.writeNumberField("tableId"
+ , ((OFInstructionGotoTable)instruction).getTableId().getValue());
+ jGen.writeEndObject();
+ continue;
+ }
else{
continue;
}
@@ -125,7 +133,13 @@
jGen.writeNumberField("group", ((OFActionGroup)action).getGroup().getGroupNumber());
}
else if (action.getType().equals(OFActionType.OUTPUT)){
- jGen.writeNumberField("group", ((OFActionOutput)action).getPort().getPortNumber());
+ if (((OFActionOutput)action).getPort().getPortNumber() == -3){
+ //Controller port
+ jGen.writeStringField("output", "CONTROLLER");
+ }
+ else{
+ jGen.writeNumberField("output", ((OFActionOutput)action).getPort().getPortNumber());
+ }
}
else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0
|| action.getType().compareTo(OFActionType.COPY_TTL_IN) == 0
@@ -164,13 +178,23 @@
jGen.writeEndArray();
jGen.writeEndObject();
}
+ /**
+ * Get the number of 1's in the 32bit integer
+ * Use full to convert wildcard mask(x.x.x.x) to \x notation
+ * for example
+ * ("0.0.0.255") to int to "/8" or
+ * ("0.0.255.255") to int to "/16"
+ * @param x
+ * @return
+ */
+
public static int covertToMask(int x) {
- x = x - ((x >>> 1) & 0x55555555);
- x = (x & 0x33333333) + ((x >>> 2) & 0x33333333);
- x = (x + (x >>> 4)) & 0x0F0F0F0F;
- x = x + (x >>> 8);
- x = x + (x >>> 16);
- return x & 0x0000003F;
+ x = x - ((x >>> 1) & 0x55555555);
+ x = (x & 0x33333333) + ((x >>> 2) & 0x33333333);
+ x = (x + (x >>> 4)) & 0x0F0F0F0F;
+ x = x + (x >>> 8);
+ x = x + (x >>> 16);
+ return 32 - (x & 0x0000003F);
}
}
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 4033bc8..d4f214a 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
@@ -49,16 +49,13 @@
jGen.writeStringField("SET_DL_DST", ((OFActionSetField)action).getField().getValue().toString());
}
else if (((OFActionSetField)action).getField().toString().contains("OFOxmMplsLabelVer13")){
- jGen.writeStringField("PUSH_MPLS", ((OFActionSetField)action).getField().getValue().toString());
+ jGen.writeNumberField("PUSH_MPLS",
+ Integer.decode(((OFActionSetField)action).getField().getValue().toString()));
}
}
else if(action.getType().compareTo(OFActionType.OUTPUT) == 0){
jGen.writeNumberField("OUTPPUT", ((OFActionOutput)action).getPort().getPortNumber());
}
- //else if(action.getType().compareTo(OFActionType.PUSH_MPLS) == 0){
- // jGen.writeNumberField("POP_MPLS", Integer.parseInt(((OFActionSetField)action).getField().getValue().toString()));
- // System.out.println("\n\n\nPOP:" + Integer.decode("0x"+((OFActionPopMpls)action).getEthertype().toString()));
- //}
else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0){
jGen.writeStringField("POP_MPLS", "True");
}