Added sorting in table ip/acl by priority (descending), mpls by mpls label (ascending), many other fixes
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index 219b1d6..c953deb 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -2084,6 +2084,9 @@
When sort isn't None, it names a field whose's value are sorted on.
"""
+ #just a hack check to implement decending sorting
+ descending = False
+ #raise error.ArgumentValidationError('\n\n\n %s' % (descending))
if sdnsh.description: # description debugging
print "command_display_rest: ", data, url, rest_type, table_format, detail
@@ -2252,6 +2255,8 @@
if 'realtimestats' in data and 'tabletype' in data and data['realtimestats'] == 'table':
combResult = []
if data['tabletype'] == 'ip':
+ #for decending sorting
+ descending = True
for ipTableEntry in entries:
match = ipTableEntry['match']
networkDestination = '*'
@@ -2306,6 +2311,7 @@
'actions' : actions
})
elif data['tabletype'] == 'acl':
+ descending = True
for ipTableEntry in entries:
match = ipTableEntry['match']
networkDestination ='*'
@@ -2451,6 +2457,10 @@
detail,
sdnsh.debug)
if sort:
+ if descending:
+ reverse = True
+ else:
+ reverse = False
def sort_cmp(x,y):
for f in sort:
if f in x:
@@ -2458,7 +2468,7 @@
if c != 0:
return c
return 0
- entries = sorted(entries, cmp=sort_cmp)
+ entries = sorted(entries, cmp=sort_cmp, reverse=reverse )
display = sdnsh.pp.format_table(entries, table_format % data, detail)
else:
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index 0fe6c88..8d7fdd5 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -2312,14 +2312,14 @@
'bucketpktcnt', 'bucketbytecnt',
'setsrcmac', 'setdstmac',
'pushMplslabel', 'setBos',
- 'outport','goToGroup','COPY_TTL_IN','COPY_TTL_OUT','DEC_MPLS_TTL',
- 'DEC_NW_TTL'],
+ 'COPY_TTL_OUT','DEC_MPLS_TTL','outport','goToGroup',
+ ],
'scoped' : [ 'Idx', 'grouptype','groupid','totalpktcnt', 'totalbytecnt',
'bucketpktcnt', 'bucketbytecnt',
'setsrcmac', 'setdstmac',
'pushMplsLabel','setBos',
- 'outport','goToGroup','COPY_TTL_IN','COPY_TTL_OUT','DEC_MPLS_TTL',
- 'DEC_NW_TTL'],
+ 'COPY_TTL_OUT','DEC_MPLS_TTL','outport','goToGroup',
+ ],
},
'fields': {
'groupid' : { 'verbose-name' : 'Group Id',
@@ -2350,6 +2350,10 @@
},
'goToGroup' : { 'verbose-name' : 'Group',
},
+ 'COPY_TTL_OUT' : { 'verbose-name' : 'COPY TTL',
+ },
+ 'DEC_MPLS_TTL' : { 'verbose-name' : 'Dec Mpls TTL',
+ },
}
},
}
diff --git a/cli/cli/desc/version200/switch.py b/cli/cli/desc/version200/switch.py
index 190c538..7857329 100755
--- a/cli/cli/desc/version200/switch.py
+++ b/cli/cli/desc/version200/switch.py
@@ -254,6 +254,7 @@
'acl',
'mpls'
),
+ 'sort' : ['mplsLabel','priority',],
'action' : 'display-rest',
'url' : 'realtimestats/%(realtimestats)s/%(tabletype)s/flow/%(dpid)s/',
'rest-type' : 'dict-of-list-of-switch',
diff --git a/conf/onos.properties b/conf/onos.properties
index a3e1d19..89b4c80 100644
--- a/conf/onos.properties
+++ b/conf/onos.properties
@@ -23,4 +23,4 @@
# Uncomment and list all the ZooKeeper instances after localhost on multi-instance deployment.
#net.onrc.onos.core.registry.ZookeeperRegistry.connectionString = localhost:2181,otherhost:2181
# Specify a network configuration file to be used by the NetworkConfigManager
-net.onrc.onos.core.configmanager.NetworkConfigManager.networkConfigFile = conf/sr-ecmp.conf
+net.onrc.onos.core.configmanager.NetworkConfigManager.networkConfigFile = conf/sr-ecmp10.conf
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 02da751..1ce945b 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
@@ -76,7 +76,7 @@
jGen.writeStringField("dataLayerSource", matchGeneric.getValue().toString());
}
else if (matchGeneric.getMatchField().id == MatchFields.ETH_TYPE){
- jGen.writeNumberField("dataLayerType", Integer.decode(matchGeneric.getValue().toString()));
+ jGen.writeStringField("dataLayerType", "0x"+(matchGeneric.getValue().toString()));
}
else if (matchGeneric.getMatchField().id == MatchFields.IN_PORT){
jGen.writeNumberField("inputPort", Integer.parseInt(matchGeneric.getValue().toString()));
@@ -152,7 +152,7 @@
jGen.writeStringField(action.getType().name(), "True");
}
else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0){
- jGen.writeStringField("POP_MPLS", ((OFActionPopMpls)action).getEthertype().toString());
+ jGen.writeStringField("POP_MPLS", "0x"+((OFActionPopMpls)action).getEthertype().toString());
}
else if (action.getType().equals(OFActionType.SET_FIELD)){
//TODO Support for more setFields
@@ -188,7 +188,6 @@
* @param x
* @return
*/
-
public static int covertToMask(int x) {
x = x - ((x >>> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >>> 2) & 0x33333333);
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 46a01f7..3b1ca58 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
@@ -61,7 +61,7 @@
jGen.writeNumberField("OUTPPUT", ((OFActionOutput)action).getPort().getPortNumber());
}
else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0){
- jGen.writeStringField("POP_MPLS", ((OFActionPopMpls)action).getEthertype().toString());
+ jGen.writeStringField("POP_MPLS", "0x"+((OFActionPopMpls)action).getEthertype().toString());
}
else if(action.getType().compareTo(OFActionType.GROUP) == 0){
jGen.writeNumberField("goToGroup", ((OFActionGroup)action).getGroup().getGroupNumber());