show switch group stats CLI support
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index fb374c4..3c9adb0 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -1948,6 +1948,16 @@
entries = json.loads(result)
+ entries2 = None
+
+ if 'realtimestats' in data and data['realtimestats'] == 'group':
+ url2 = "http://%s/rest/v1/" % sdnsh.controller + ("realtimestats/groupdesc/%(dpid)s/" % data)
+ result2 = sdnsh.store.rest_simple_request(url2)
+ check_rest_result(result2)
+ if sdnsh.description: # description debugging
+ print "command_display_rest: groupdesc result ", result2
+ entries2 = json.loads(result2)
+
# It certainly seems possible to map from url's to the type associated,
# with the result, but it also makes sense to encode that type information
# into the description
@@ -1956,6 +1966,55 @@
rest_type,
data,
entries)
+ if 'realtimestats' in data and data['realtimestats'] == 'group':
+ if entries2 is not None:
+ entries2 = command_display_rest_type_converter(table_format,
+ rest_type,
+ data,
+ entries2)
+
+ if 'realtimestats' in data and data['realtimestats'] == 'group':
+ combResult = []
+ for groupStatEntry in entries:
+ groupId = groupStatEntry["groupId"]
+ groupDescEntry = None
+ for entry in entries2:
+ if groupId == entry["groupId"]:
+ groupDescEntry = entry
+ break
+ if groupDescEntry is None:
+ print "command_display_rest: missing group desc for group id %s" % (groupId)
+ continue
+ for bucketId in range(len(groupStatEntry['bucketStats'])):
+ setsrcmac = None
+ if 'SET_DL_SRC' in groupDescEntry['bucketsActions'][bucketId]:
+ setsrcmac = groupDescEntry['bucketsActions'][bucketId]['SET_DL_SRC']
+ setdstmac = None
+ if 'SET_DL_DST' in groupDescEntry['bucketsActions'][bucketId]:
+ setdstmac = groupDescEntry['bucketsActions'][bucketId]['SET_DL_DST']
+ pushmpls = None
+ if 'PUSH_MPLS' in groupDescEntry['bucketsActions'][bucketId]:
+ pushmpls = groupDescEntry['bucketsActions'][bucketId]['PUSH_MPLS']
+ popmpls = None
+ if 'POP_MPLS' in groupDescEntry['bucketsActions'][bucketId]:
+ popmpls = groupDescEntry['bucketsActions'][bucketId]['POP_MPLS']
+ outport = None
+ if 'OUTPPUT' in groupDescEntry['bucketsActions'][bucketId]:
+ outport = groupDescEntry['bucketsActions'][bucketId]['OUTPPUT']
+ combResult.append({
+ 'groupid' : groupId,
+ 'grouptype' : groupDescEntry['groupType'],
+ 'totalpktcnt' : groupStatEntry['packetCount'],
+ 'totalbytecnt' : groupStatEntry['byteCount'],
+ 'bucketpktcnt' : groupStatEntry['bucketStats'][bucketId]['pktCount'],
+ 'bucketbytecnt' : groupStatEntry['bucketStats'][bucketId]['byteCount'],
+ 'setsrcmac' : setsrcmac,
+ 'setdstmac' : setdstmac,
+ 'pushmpls' : pushmpls,
+ 'popmpls' : popmpls,
+ 'outport' : outport,
+ })
+ entries = combResult
#
if format:
#
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index 033ca11..5085216 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -1953,18 +1953,20 @@
REALTIME_GROUP_FORMAT = {
'realtime_group' : {
'field-orderings' : {
- 'default' : [ 'Idx', 'grouptype', 'totalpktcnt', 'totalbytecnt',
+ 'default' : [ 'Idx', 'groupid', 'grouptype', 'totalpktcnt', 'totalbytecnt',
'bucketpktcnt', 'bucketbytecnt',
'setsrcmac', 'setdstmac',
'pushmpls', 'popmpls',
'outport' ],
- 'scoped' : [ 'Idx', 'grouptype', 'totalpktcnt', 'totalbytecnt',
+ 'scoped' : [ 'Idx', 'groupid', 'grouptype', 'totalpktcnt', 'totalbytecnt',
'bucketpktcnt', 'bucketbytecnt',
'setsrcmac', 'setdstmac',
'pushmpls', 'popmpls',
'outport' ],
},
'fields': {
+ 'groupid' : { 'verbose-name' : 'Group Id',
+ },
'grouptype' : { 'verbose-name' : 'Group type',
},
'totalpktcnt' : { 'verbose-name' : 'Pkts',
diff --git a/cli/sdncon/rest/views.py b/cli/sdncon/rest/views.py
index 760f11f..44af953 100755
--- a/cli/sdncon/rest/views.py
+++ b/cli/sdncon/rest/views.py
@@ -409,6 +409,8 @@
#url = controller_url('core', 'switch', dpid, stattype, 'json')
if stattype == 'group':
stattype = 'groupStats'
+ if stattype == 'groupdesc':
+ stattype = 'groupDesc'
url = "http://localhost:8080/wm/floodlight/core/switch/%s/%s/json" % (dpid, stattype)
return get_sdnplatform_response(url)