Stats Improvement
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index 637116d..675a8c5 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -42,7 +42,33 @@
onos=1
#
# ACTION PROCS
-#
+#Format actions for stats per table
+def format_actions(actions):
+ if actions == '':
+ newActions = '*'
+ else:
+ #TODO: Check:- Why I have to remove last two character from string
+ #instead of 1 character to get rid of comma from last aciton
+ actions = actions[:-2]
+ a=''
+ b=''
+ newActions=''
+ isRemoved_u = False
+ for ch in actions:
+ if ch =='u':
+ a= 'u'
+ if ch =='\'':
+ b= '\''
+ if isRemoved_u:
+ isRemoved_u=False
+ continue
+ if (a+b) == 'u\'':
+ newActions = newActions[:-1]
+ a= ''
+ isRemoved_u = True
+ else:
+ newActions += ch
+ return newActions
def check_rest_result(result, message=None):
if isinstance(result, collections.Mapping):
@@ -1982,36 +2008,47 @@
match = ipTableEntry['match']
if match :
networkDestination = match[0].get('networkDestination') if match[0].get('networkDestination') else '*'
- #raise error.ArgumentValidationError('\n\n\n %s' %match)
- #else:
- # networkSource = None
- # networkDestination = None
+ #raise error.ArgumentValidationError('\n\n\n %s' % json.tool(entries))
+ instructions = ipTableEntry['instructions']
+ actions = ''
+ for instruction in instructions:
+ actions += str(instruction)
+ actions += ", "
+ actions = format_actions(actions)
combResult.append({
'switch' : ipTableEntry['switch'],
'byteCount' : ipTableEntry['byteCount'],
'packetCount' : ipTableEntry['packetCount'],
+ 'priority' : ipTableEntry['priority'],
'cookie' : ipTableEntry['cookie'],
'durationSeconds' : ipTableEntry['durationSec'],
'networkDestination' : networkDestination,
+ 'actions' : actions,
})
elif data['tabletype'] == 'mpls':
+ import unicodedata
for ipTableEntry in entries:
match = ipTableEntry['match']
if match :
- mplsTc = match[0].get('mplsTc')
- mplsLabel = match[0].get('mplsLabel')
- #raise error.ArgumentValidationError('\n\n\n %s' %match)
- #else:
- # networkSource = None
- # networkDestination = None
+ mplsTc = match[0].get('mplsTc') if match[0].get('mplsTc') else '*'
+ mplsLabel = match[0].get('mplsLabel') if match[0].get('mplsLabel') else '*'
+ instructions = ipTableEntry['instructions']
+ actions = ''
+ #raise error.ArgumentValidationError('\n\n\n %s' %len(actions))
+ for instruction in instructions:
+ actions += str(instruction).encode('ascii', 'ignore')
+ actions += ", "
+ actions = format_actions(actions)
combResult.append({
'switch' : ipTableEntry['switch'],
'byteCount' : ipTableEntry['byteCount'],
'packetCount' : ipTableEntry['packetCount'],
'cookie' : ipTableEntry['cookie'],
+ 'priority' : ipTableEntry['priority'],
'mplsTc' : mplsTc,
'mplsLabel' : mplsLabel,
- 'durationSeconds' : ipTableEntry['durationSec']
+ 'durationSeconds' : ipTableEntry['durationSec'],
+ 'actions' : actions
})
elif data['tabletype'] == 'acl':
for ipTableEntry in entries:
@@ -2029,11 +2066,19 @@
dataLayerSource = match[0].get('dataLayerSource') if match[0].get('dataLayerSource') else '*'
dataLayerDestination = match[0].get('dataLayerDestination') if match[0].get('dataLayerDestination') else '*'
dataLayerType= match[0].get('dataLayerType') if match[0].get('dataLayerType') else '*'
+ instructions = ipTableEntry['instructions']
+ actions = ''
+ #raise error.ArgumentValidationError('\n\n\n %s' %len(actions))
+ for instruction in instructions:
+ actions += str(instruction).encode('ascii', 'ignore')
+ actions += ", "
+ actions = format_actions(actions)
combResult.append({
'switch' : ipTableEntry['switch'],
'byteCount' : ipTableEntry['byteCount'],
'packetCount' : ipTableEntry['packetCount'],
'cookie' : ipTableEntry['cookie'],
+ 'priority' : ipTableEntry['priority'],
'inputPort' : inputPort,
'durationSeconds' : ipTableEntry['durationSec'],
'networkSource' : networkSource,
@@ -2045,7 +2090,8 @@
'mplsTc' : mplsTc,
'mplsLabel' : mplsLabel,
'transportDestination' : transportDestination,
- 'transportSource' : transportSource
+ 'transportSource' : transportSource,
+ 'actions' : actions
})
entries = combResult
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index 8c56945..695d692 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -1821,31 +1821,31 @@
'realtime_table_ip_flow' : {
'field-orderings' : {
'default' : [
- 'Idx', 'switch', 'cookie',
- 'byteCount', 'packetCount',
- 'actions', 'networkDestination',
- 'flow-brief',
+ 'Idx', 'cookie',
+ 'byteCount', 'packetCount','priority',
+ 'networkDestination',
+ 'flow-brief','actions'
],
'scoped' : [
- 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'networkDestination',
+ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority',
+ 'networkDestination', 'actions'
],
- 'brief' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'networkDestination'
+ 'brief' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority',
+ 'networkDestination', 'actions'
],
- 'default' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'networkDestination'
+ 'default' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority',
+ 'networkDestination', 'actions'
],
- 'scoped' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'networkDestination'
+ 'scoped' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority',
+ 'networkDestination', 'actions'
],
- 'details' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'networkDestination'
+ 'details' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority'
+ 'networkDestination', 'actions'
],
#'vns_flow': [ 'Idx', 'dataLayerSource', 'dataLayerDestination', 'dataLayerVirtualLan', 'dataLayerType'],
#'summary' : [ 'Idx', 'vnsName', 'vnsFlowCnt', 'flowEntryCnt'],
@@ -1926,7 +1926,6 @@
'formatter' : fmtcnv.decode_dst_port
},
'actions' : { 'verbose-name' : 'Actions',
- 'formatter' : fmtcnv.decode_actions
},
'vnsName' : { 'verbose-name' : 'VNS'
},
@@ -1944,31 +1943,31 @@
'realtime_table_mpls_flow' : {
'field-orderings' : {
'default' : [
- 'Idx', 'switch', 'cookie',
+ 'Idx', 'cookie', 'priority',
'byteCount', 'packetCount',
- 'actions', 'mplsTc', 'mplsLabel',
- 'flow-brief',
+ 'mplsTc', 'mplsLabel',
+ 'flow-brief', 'actions'
],
'scoped' : [
- 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'mplsTc', 'mplsLabel'
+ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie', 'priority',
+ 'mplsTc', 'mplsLabel','actions'
],
- 'brief' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'mplsTc', 'mplsLabel'
+ 'brief' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority',
+ 'mplsTc', 'mplsLabel','actions'
],
- 'default' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'mplsTc', 'mplsLabel'
+ 'default' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority',
+ 'mplsTc', 'mplsLabel','actions'
],
- 'scoped' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'mplsTc', 'mplsLabel'
+ 'scoped' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority',
+ 'mplsTc', 'mplsLabel','actions'
],
- 'details' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie',
- 'mplsTc', 'mplsLabel'
+ 'details' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority',
+ 'mplsTc', 'mplsLabel','actions'
],
#'vns_flow': [ 'Idx', 'dataLayerSource', 'dataLayerDestination', 'dataLayerVirtualLan', 'dataLayerType'],
#'summary' : [ 'Idx', 'vnsName', 'vnsFlowCnt', 'flowEntryCnt'],
@@ -2048,8 +2047,7 @@
'transportDestination' : { 'verbose-name' : 'Dst Port',
'formatter' : fmtcnv.decode_dst_port
},
- 'actions' : { 'verbose-name' : 'Actions',
- 'formatter' : fmtcnv.decode_actions
+ 'actions' : { 'verbose-name' : 'Actions'
},
'vnsName' : { 'verbose-name' : 'VNS'
},
@@ -2073,35 +2071,35 @@
'realtime_table_acl_flow' : {
'field-orderings' : {
'default' : [
- 'Idx', 'switch', 'cookie',
+ 'Idx', 'cookie', 'priority'
'byteCount', 'packetCount',
- 'actions', 'dataLayerSource', 'dataLayerDestination',
- 'flow-brief','mplsTc','mplsLabel'
+ 'dataLayerSource', 'dataLayerDestination',
+ 'flow-brief','mplsTc','mplsLabel','actions'
],
'scoped' : [
- 'Idx', 'cookie',
+ 'Idx', 'cookie', 'priority',
'byteCount', 'packetCount',
- 'actions', 'dataLayerSource', 'dataLayerDestination','mplsTc','mplsLabel',
- 'flow-brief',
+ 'dataLayerSource', 'dataLayerDestination','mplsTc','mplsLabel',
+ 'flow-brief','actions'
],
- 'brief' : [ 'Idx', 'switch', 'cookie', 'dataLayerSource', 'dataLayerDestination',
+ 'brief' : [ 'Idx', 'cookie','priority', 'dataLayerSource', 'dataLayerDestination',
'networkSource', 'networkDestination', 'networkProtocol',
- 'transportSource', 'transportDestination','mplsTc','mplsLabel'],
- 'default' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
+ 'transportSource', 'transportDestination','mplsTc','mplsLabel','actions'],
+ 'default' : [ 'Idx','byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
'dataLayerType', 'networkSource', 'networkDestination', 'networkProtocol',
- 'transportSource', 'transportDestination','mplsTc','mplsLabel'],
- 'scoped' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
+ 'transportSource', 'transportDestination','mplsTc','mplsLabel', 'actions'],
+ 'scoped' : [ 'Idx','byteCount', 'packetCount', 'durationSeconds',
+ 'cookie','priority', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
'dataLayerType', 'networkSource', 'networkDestination', 'networkProtocol',
- 'transportSource', 'transportDestination','mplsTc','mplsLabel'],
- 'details' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
- 'cookie', 'hardTimeout', 'idleTimeout', 'priority', 'tableId', 'inputPort',
+ 'transportSource', 'transportDestination','mplsTc','mplsLabel','actions'],
+ 'details' : [ 'Idx','byteCount', 'packetCount', 'durationSeconds',
+ 'cookie', 'priority','hardTimeout', 'idleTimeout', 'priority', 'tableId', 'inputPort',
'dataLayerSource', 'dataLayerDestination', 'dataLayerType', 'dataLayerVirtualLan',
'dataLayerVirtualLanPriorityCodePoint', 'networkSource', 'networkDestination',
'networkProtocol', 'transportSource', 'transportDestination',
- 'networkTypeOfService', 'actions','mplsTc','mplsLabel'],
+ 'networkTypeOfService','mplsTc','mplsLabel', 'actions'],
#'vns_flow': [ 'Idx', 'dataLayerSource', 'dataLayerDestination', 'dataLayerVirtualLan', 'dataLayerType'],
#'summary' : [ 'Idx', 'vnsName', 'vnsFlowCnt', 'flowEntryCnt'],
},
@@ -2180,8 +2178,7 @@
'transportDestination' : { 'verbose-name' : 'Dst Port',
'formatter' : fmtcnv.decode_dst_port
},
- 'actions' : { 'verbose-name' : 'Actions',
- 'formatter' : fmtcnv.decode_actions
+ 'actions' : { 'verbose-name' : 'Actions'
},
'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 4f71dc9..4a83230 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
@@ -6,9 +6,9 @@
import java.util.Set;
import net.floodlightcontroller.core.web.OFFlowStatsEntryMod;
+import net.onrc.onos.core.packet.IPv4;
import org.projectfloodlight.openflow.protocol.action.*;
-import org.apache.commons.codec.binary.Hex;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.map.SerializerProvider;
@@ -23,7 +23,6 @@
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.ver13.OFInstructionTypeSerializerVer13;
public class OFFlowStatsEntryModSerializer extends SerializerBase<OFFlowStatsEntryMod> {
@@ -41,18 +40,14 @@
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());
jGen.writeNumberField("packetCount", flowStatsEntry.getPacketCount().getValue());
jGen.writeNumberField("priority", flowStatsEntry.getPriority());
jGen.writeNumberField("cookie", flowStatsEntry.getCookie().getValue());
jGen.writeNumberField("durationNsec", flowStatsEntry.getDurationNsec());
jGen.writeNumberField("durationSec", flowStatsEntry.getDurationSec());
- jGen.writeArrayFieldStart("flags");
- for (OFFlowModFlags flag: flags){
- jGen.writeNullField(flag.name());;
- }
- jGen.writeEndArray();
+ jGen.writeObjectField("flags", flowStatsEntry.getFlags());
jGen.writeNumberField("hardTimeout", flowStatsEntry.getHardTimeout());
jGen.writeNumberField("idleTimeout", flowStatsEntry.getIdleTimeout());
jGen.writeArrayFieldStart("match");
@@ -60,12 +55,21 @@
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.writeStringField("networkDestination", matchGeneric.getValue().toString());
+ jGen.writeStringField("networkDestination", matchGeneric.getValue().toString()
+ +"/"
+ +(matchGeneric.isMasked() ?
+ OFFlowStatsEntryModSerializer.covertToMask(
+ IPv4.toIPv4Address(
+ matchGeneric.getMask().toString())):"0"));
}
else if (matchGeneric.getMatchField().id == MatchFields.IPV4_SRC){
- jGen.writeStringField("networkSource", matchGeneric.getValue().toString());
+ jGen.writeStringField("networkSource", matchGeneric.getValue().toString()
+ +"/"
+ +(matchGeneric.isMasked() ?
+ OFFlowStatsEntryModSerializer.covertToMask(
+ IPv4.toIPv4Address(
+ matchGeneric.getMask().toString())):"0"));
}
else if (matchGeneric.getMatchField().id == MatchFields.ETH_DST){
jGen.writeStringField("dataLayerDestination", matchGeneric.getValue().toString());
@@ -74,80 +78,99 @@
jGen.writeStringField("dataLayerSource", matchGeneric.getValue().toString());
}
else if (matchGeneric.getMatchField().id == MatchFields.ETH_TYPE){
- jGen.writeNumberField("dataLayerType", Integer.decode("0x"+matchGeneric.getValue().toString()));
+ jGen.writeNumberField("dataLayerType", Integer.decode(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()));
+ jGen.writeNumberField("mplsTc", Integer.decode(matchGeneric.getValue().toString()));
}
else if (matchGeneric.getMatchField().id == MatchFields.MPLS_LABEL){
- jGen.writeNumberField("mplsLabel", Integer.parseInt(matchGeneric.getValue().toString()));
+ jGen.writeNumberField("mplsLabel", Integer.decode(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){
+ 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){
+ 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();
+ jGen.writeFieldName("instructions");
+ jGen.writeStartArray();
+ List<OFAction> actions = null;
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
- }
+ if(instruction.getType().equals(OFInstructionType.APPLY_ACTIONS)){
+ actions = ((OFInstructionApplyActions)instruction).getActions();
}
- else if (instruction.getType().equals(OFInstructionType.APPLY_ACTIONS)){
- List<OFAction> actions = ((OFInstructionApplyActions) instruction).getActions();
+ else if(instruction.getType().equals(OFInstructionType.WRITE_ACTIONS)){
+ actions = ((OFInstructionWriteActions)instruction).getActions();
+ }
+ else{
+ continue;
+ }
+ jGen.writeStartObject();
+ jGen.writeFieldName(instruction.getType().name());
+ jGen.writeStartObject();
+ for (OFAction action : actions){
+ if (action.getType().equals(OFActionType.GROUP)){
+ jGen.writeNumberField("group", ((OFActionGroup)action).getGroup().getGroupNumber());
+ }
+ else if (action.getType().equals(OFActionType.OUTPUT)){
+ jGen.writeNumberField("group", ((OFActionOutput)action).getPort().getPortNumber());
+ }
+ else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0
+ || action.getType().compareTo(OFActionType.COPY_TTL_IN) == 0
+ || action.getType().compareTo(OFActionType.COPY_TTL_OUT) == 0
+ || action.getType().compareTo(OFActionType.DEC_MPLS_TTL) == 0
+ || action.getType().compareTo(OFActionType.DEC_NW_TTL) == 0
+ || action.getType().compareTo(OFActionType.POP_PBB) == 0
+ || action.getType().compareTo(OFActionType.POP_VLAN) == 0){
+ jGen.writeStringField(action.getType().name(), "True");
+ }
+ else if(action.getType().compareTo(OFActionType.COPY_TTL_IN) == 0){
+ jGen.writeStringField("POP_MPLS", "True");
+ }
+ else if (action.getType().equals(OFActionType.SET_FIELD)){
+ //TODO Support for more setFields
+ 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());
+ }
+ else if (((OFActionSetField)action).getField().toString().contains("OFOxmNwDstVer13")){
+ jGen.writeStringField("SET_NW_SRC", ((OFActionSetField)action).getField().getValue().toString());
+ }
+ else if (((OFActionSetField)action).getField().toString().contains("OFOxmNwDstVer13")){
+ jGen.writeStringField("SET_NW_DST", ((OFActionSetField)action).getField().getValue().toString());
+ }
+ else if (((OFActionSetField)action).getField().toString().contains("OFOxmMplsLabelVer13")){
+ jGen.writeStringField("PUSH_MPLS", ((OFActionSetField)action).getField().getValue().toString());
+ }
+ }
}
jGen.writeEndObject();
- jGen.writeEndArray();
}
jGen.writeEndObject();
- jGen.writeEndArray();*/
+ 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();
-
}
-
+ 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;
+ }
}
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 405679d..4033bc8 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
@@ -36,8 +36,6 @@
jGen.writeStartObject();
List<OFAction> actions = bucket.getActions();
for (OFAction action : actions ){
- System.out.println("OFMessage: " + groupDescStatsEntryMod);
- System.out.println("\naction.getType()\n"+ action.getType()+"\n"+ action.getClass());
if(action.getType().compareTo(OFActionType.SET_FIELD) == 0){
/*
* TODO: 1-Need better if condition.
@@ -63,7 +61,6 @@
//}
else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0){
jGen.writeStringField("POP_MPLS", "True");
- System.out.println("\n\n\nPOP:" + Integer.decode("0x"+((OFActionPopMpls)action).getEthertype().toString()));
}
}