Added TTL actions in group, etherType with '0x', Added tunnelInfo in 'show policy', removed |breif, details| from groups
diff --git a/cli/cli/c_actions.py b/cli/cli/c_actions.py
index 0ccdc9c..9c4176f 100755
--- a/cli/cli/c_actions.py
+++ b/cli/cli/c_actions.py
@@ -2226,11 +2226,12 @@
policyId = policy.get("policyId")
policyType = policy.get("policyType")
priority = policy.get("priority")
+ tunnelId = policy.get('tunnelId')
match = policy.get("match")
dstIpAddress = match.get('dstIpAddress')['value'] if match.get('dstIpAddress') else '*'
dstMacAddress = match.get('dstMacAddress')['value'] if match.get('dstMacAddress') else '*'
dstTcpPortNumber = match.get('dstTcpPortNumber') if match.get('dstTcpPortNumber') else '*'
- etherType = match.get('etherType') if match.get('etherType') else '*'
+ etherType = ('0x'+ str(match.get('etherType'))) if match.get('etherType') else '*'
ipProtocolNumber = match.get('ipProtocolNumber') if match.get('ipProtocolNumber') else '*'
srcIpAddress = match.get('srcIpAddress')['value'] if match.get('srcIpAddress') else '*'
srcMacAddress = match.get('srcMacAddress')['value'] if match.get('srcMacAddress') else '*'
@@ -2238,6 +2239,7 @@
combResult.append({
'policyId' : policyId,
'policyType' : policyType,
+ 'tunnelId' : tunnelId,
'priority' : priority,
'dstIpAddress' : dstIpAddress,
'dstMacAddress' : dstMacAddress,
@@ -2262,7 +2264,6 @@
#raise error.ArgumentValidationError('\n\n\n %s' % json.tool(entries))
instructions = ipTableEntry['instructions']
actions = str(instructions[0]) if instructions[0] else None
- print "actions: ", actions
if actions != None:
actions = remove_unicodes(actions)
actions = renameActions(actions)
@@ -2370,31 +2371,44 @@
if groupId == entry["groupId"]:
groupDescEntry = entry
break
- if groupDescEntry is None:
+ if groupDescEntry is '':
print "command_display_rest: missing group desc for group id %s" % (groupId)
continue
for bucketId in range(len(groupStatEntry['bucketStats'])):
- setsrcmac = '*'
+ setsrcmac = ''
if 'SET_DL_SRC' in groupDescEntry['bucketsActions'][bucketId]:
setsrcmac = groupDescEntry['bucketsActions'][bucketId]['SET_DL_SRC']
- setdstmac = '*'
+ setdstmac = ''
if 'SET_DL_DST' in groupDescEntry['bucketsActions'][bucketId]:
setdstmac = groupDescEntry['bucketsActions'][bucketId]['SET_DL_DST']
- pushmpls = '*'
+ pushmpls = ''
if 'PUSH_MPLS_LABEL' in groupDescEntry['bucketsActions'][bucketId]:
pushmpls = groupDescEntry['bucketsActions'][bucketId]['PUSH_MPLS_LABEL']
- popmpls = '*'
+ popmpls = ''
if 'POP_MPLS' in groupDescEntry['bucketsActions'][bucketId]:
popmpls = groupDescEntry['bucketsActions'][bucketId]['POP_MPLS']
- outport = '*'
+ outport = ''
if 'OUTPPUT' in groupDescEntry['bucketsActions'][bucketId]:
outport = groupDescEntry['bucketsActions'][bucketId]['OUTPPUT']
- goToGroup = '*'
+ goToGroup = ''
if 'goToGroup' in groupDescEntry['bucketsActions'][bucketId]:
goToGroup = groupDescEntry['bucketsActions'][bucketId]['goToGroup']
- setBos= None
+ setBos= ''
if 'PUSH_MPLS_BOS' in groupDescEntry['bucketsActions'][bucketId]:
setBos = groupDescEntry['bucketsActions'][bucketId]['PUSH_MPLS_BOS']
+ COPY_TTL_IN= ''
+ if 'COPY_TTL_IN' in groupDescEntry['bucketsActions'][bucketId]:
+ COPY_TTL_IN = groupDescEntry['bucketsActions'][bucketId]['COPY_TTL_IN']
+ COPY_TTL_OUT= ''
+ if 'COPY_TTL_OUT' in groupDescEntry['bucketsActions'][bucketId]:
+ COPY_TTL_OUT = groupDescEntry['bucketsActions'][bucketId]['COPY_TTL_OUT']
+ DEC_MPLS_TTL= ''
+ if 'DEC_MPLS_TTL' in groupDescEntry['bucketsActions'][bucketId]:
+ DEC_MPLS_TTL = groupDescEntry['bucketsActions'][bucketId]['DEC_MPLS_TTL']
+ DEC_NW_TTL= ''
+ if 'DEC_NW_TTL' in groupDescEntry['bucketsActions'][bucketId]:
+ DEC_NW_TTL = groupDescEntry['bucketsActions'][bucketId]['DEC_NW_TTL']
+
combResult.append({
'groupid' : groupId,
'grouptype' : groupDescEntry['groupType'],
@@ -2404,11 +2418,15 @@
'bucketbytecnt' : groupStatEntry['bucketStats'][bucketId]['byteCount'],
'setsrcmac' : setsrcmac,
'setdstmac' : setdstmac,
- 'pushMplsLabel' : pushmpls,
- 'popmpls' : popmpls,
- 'outport' : outport,
+ 'pushMplsLabel' : pushmpls,
+ 'popmpls' : popmpls,
+ 'outport' : outport,
'goToGroup' : goToGroup,
- 'setBos' : setBos,
+ 'setBos' : setBos,
+ 'COPY_TTL_IN' : COPY_TTL_IN,
+ 'COPY_TTL_OUT' : COPY_TTL_OUT,
+ 'DEC_MPLS_TTL' : DEC_MPLS_TTL,
+ 'DEC_NW_TTL' : DEC_NW_TTL,
})
entries = combResult
#
diff --git a/cli/cli/desc/version200/core.py b/cli/cli/desc/version200/core.py
index f84d114..d9b949f 100755
--- a/cli/cli/desc/version200/core.py
+++ b/cli/cli/desc/version200/core.py
@@ -596,7 +596,7 @@
}
}
-
+"""
CLEAR_COMMAND_DESCRIPTION = {
'name' : 'clearterm',
'no-supported' : False,
@@ -607,7 +607,7 @@
'action' : 'clearterm',
'args' : {}
}
-
+"""
COPY_COMMAND_DESCRIPTION = {
'name' : 'copy',
@@ -2332,21 +2332,23 @@
REALTIME_GROUP_FORMAT = {
'realtime_group' : {
'field-orderings' : {
- 'default' : [ 'Idx', 'groupid', 'grouptype', 'totalpktcnt', 'totalbytecnt',
+ 'default' : [ 'Idx', 'grouptype','groupid' , 'totalpktcnt', 'totalbytecnt',
'bucketpktcnt', 'bucketbytecnt',
'setsrcmac', 'setdstmac',
'pushMplslabel', 'setBos',
- 'outport','goToGroup'],
- 'scoped' : [ 'Idx', 'groupid', 'grouptype', 'totalpktcnt', 'totalbytecnt',
+ 'outport','goToGroup','COPY_TTL_IN','COPY_TTL_OUT','DEC_MPLS_TTL',
+ 'DEC_NW_TTL'],
+ 'scoped' : [ 'Idx', 'grouptype','groupid','totalpktcnt', 'totalbytecnt',
'bucketpktcnt', 'bucketbytecnt',
'setsrcmac', 'setdstmac',
'pushMplsLabel','setBos',
- 'outport','goToGroup' ],
+ 'outport','goToGroup','COPY_TTL_IN','COPY_TTL_OUT','DEC_MPLS_TTL',
+ 'DEC_NW_TTL'],
},
'fields': {
'groupid' : { 'verbose-name' : 'Group Id',
},
- 'grouptype' : { 'verbose-name' : 'Group type',
+ 'grouptype' : { 'verbose-name' : 'Group Type',
},
'totalpktcnt' : { 'verbose-name' : 'Pkts',
'formatter' : fmtcnv.decode_port_counter
@@ -2370,7 +2372,7 @@
},
'outport' : { 'verbose-name' : 'Outport',
},
- 'goToGroup' : { 'verbose-name' : 'Go To Group',
+ 'goToGroup' : { 'verbose-name' : 'Group',
},
}
},
@@ -2431,7 +2433,7 @@
SHOW_POLICY_FORMAT = {
'show_policy' : {
'field-orderings' : {
- 'default' : [ 'Idx', 'policyId', 'policyType','priority','dstMacAddress','srcMacAddress',
+ 'default' : [ 'Idx', 'policyId', 'policyType','tunnelId','priority','dstMacAddress','srcMacAddress',
'dstIpAddress' ,'srcIpAddress', 'dstTcpPortNumber','srcTcpPortNumber',
'etherType', 'ipProtocolNumber',
]
@@ -2458,6 +2460,9 @@
'ipProtocolNumber' : { 'verbose-name': 'IP Protocol',
},
+ 'tunnelId' : { 'verbose-name': 'Tunnel Used',
+ },
+
}
},
}
diff --git a/cli/cli/desc/version200/switch.py b/cli/cli/desc/version200/switch.py
index fa0be6f..13f3a69 100755
--- a/cli/cli/desc/version200/switch.py
+++ b/cli/cli/desc/version200/switch.py
@@ -211,13 +211,13 @@
'short-help' : 'Show requested item by querying switch',
'doc' : 'switch|realtime-+',
},
- {
- 'field' : 'detail',
- 'optional' : True,
- 'type' : 'enum',
- 'values' : ('details','brief'),
- 'doc' : 'format|+',
- },
+ #{
+ # 'field' : 'detail',
+ # 'optional' : True,
+ # 'type' : 'enum',
+ # 'values' : ('details','brief'),
+ # 'doc' : 'format|+',
+ #},
),
(
{
@@ -254,20 +254,24 @@
'acl',
'mpls'
),
- 'doc' : 'format|+',
- },
- {
- 'field' : 'tableflow',
- 'type' : 'enum',
- 'values' : ('flow',
- ),
'action' : 'display-rest',
- 'url' : 'realtimestats/%(realtimestats)s/%(tabletype)s/%(tableflow)s/%(dpid)s/',
+ 'url' : 'realtimestats/%(realtimestats)s/%(tabletype)s/flow/%(dpid)s/',
'rest-type' : 'dict-of-list-of-switch',
'format' : 'realtime_%(realtimestats)s_%(tabletype)s_flow',
- 'short-help' : 'Show requested item by querying switch',
- 'doc' : 'switch|realtime-+',
+ 'doc' : 'format|+',
},
+ #{
+ # 'field' : 'tableflow',
+ # 'type' : 'enum',
+ # 'values' : ('flow',
+ # ),
+ # 'action' : 'display-rest',
+ # 'url' : 'realtimestats/%(realtimestats)s/%(tabletype)s/%(tableflow)s/%(dpid)s/',
+ # 'rest-type' : 'dict-of-list-of-switch',
+ # 'format' : 'realtime_%(realtimestats)s_%(tabletype)s_flow',
+ # 'short-help' : 'Show requested item by querying switch',
+ # 'doc' : 'switch|realtime-+',
+ # },
),
)
}
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 8756c05..02da751 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFFlowStatsEntryModSerializer.java
@@ -143,8 +143,7 @@
jGen.writeNumberField("output", ((OFActionOutput)action).getPort().getPortNumber());
}
}
- else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0
- || action.getType().compareTo(OFActionType.COPY_TTL_IN) == 0
+ else if(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
@@ -152,9 +151,9 @@
|| action.getType().compareTo(OFActionType.POP_VLAN) == 0){
jGen.writeStringField(action.getType().name(), "True");
}
- /*else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0){
+ else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0){
jGen.writeStringField("POP_MPLS", ((OFActionPopMpls)action).getEthertype().toString());
- }*/
+ }
else if (action.getType().equals(OFActionType.SET_FIELD)){
//TODO Support for more setFields
if (((OFActionSetField)action).getField().toString().contains("OFOxmEthSrcVer13")){
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 ade65fa..46a01f7 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/OFGroupDescStatsEntryModSerializer.java
@@ -66,6 +66,14 @@
else if(action.getType().compareTo(OFActionType.GROUP) == 0){
jGen.writeNumberField("goToGroup", ((OFActionGroup)action).getGroup().getGroupNumber());
}
+ else if(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");
+ }
}
jGen.writeEndObject();
}
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
index 4d95d24..90f7a8f 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
@@ -226,7 +226,7 @@
});
testMode = POLICY_ADD1;
- //testTask.reschedule(20, TimeUnit.SECONDS);
+ testTask.reschedule(20, TimeUnit.SECONDS);
}
@Override
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyInfo.java b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyInfo.java
index 6b98dcd..3a27267 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyInfo.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyInfo.java
@@ -12,11 +12,13 @@
private String policyId;
private int policyType;
private int priority;
+ private String tunnelId = null;
private PacketMatch match;
- public SegmentRouterPolicyInfo(String Id,int type, int ppriority,PacketMatch flowEntries){
+ public SegmentRouterPolicyInfo(String Id,int type,String tunnelUsed, int ppriority,PacketMatch flowEntries){
this.policyId = Id;
this.policyType = type;
+ this.tunnelId =tunnelUsed;
this.priority = ppriority;
this.match = flowEntries;
}
@@ -26,6 +28,9 @@
public int getPolicyType(){
return this.policyType;
}
+ public String getTunnelId(){
+ return this.tunnelId;
+ }
public int getPriority(){
return this.priority;
}
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyResource.java b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyResource.java
index fc38eaa..8106173 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyResource.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/web/SegmentRouterPolicyResource.java
@@ -116,10 +116,12 @@
while(piI.hasNext()){
PolicyInfo policy = piI.next();
String policyId = policy.getPolicyId();
+ String tunnelId = policy.getTunnelId();
int priority = policy.getPriority();
int policyType = policy.getType();
PacketMatch flowEntries = policy.getMatch();
- SegmentRouterPolicyInfo pInfo = new SegmentRouterPolicyInfo(policyId, policyType, priority, flowEntries);
+ SegmentRouterPolicyInfo pInfo = new SegmentRouterPolicyInfo(policyId, policyType, tunnelId,
+ priority, flowEntries);
policyList.add(pInfo);
}
log.debug("getPolicy with params");