import org.opendaylight.controller.sal.match.MatchType;
import org.opendaylight.controller.sal.reader.FlowOnNode;
import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
+import org.opendaylight.controller.sal.reader.NodeDescription;
import org.opendaylight.controller.sal.utils.EtherTypes;
import org.opendaylight.controller.sal.utils.GlobalConstants;
import org.opendaylight.controller.sal.utils.HexEncode;
public class Troubleshoot implements IDaylightWeb {
private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER;
private static final List<String> flowStatsColumnNames = Arrays.asList("Node", "In Port",
- "DL Src", "DL Dst", "DL Type", "DL Vlan", "NW Src", "NW Dst","ToS Bits",
+ "DL Src", "DL Dst", "DL Type", "DL Vlan","Vlan Priority", "NW Src", "NW Dst","ToS Bits",
"NW Proto", "TP Src", "TP Dst", "Actions", "Bytes", "Packets",
"Time (s)", "Timeout (s)",
"Priority");
return userLevel.ordinal() <= AUTH_LEVEL.ordinal();
}
+ @RequestMapping(value = "/nodeInfo", method = RequestMethod.GET)
+ @ResponseBody
+ public NodeDescription getNodeInfo(HttpServletRequest request, @RequestParam(required = false) String container,
+ @RequestParam(required = true) String nodeId) {
+ List<Map<String, String>> lines = new ArrayList<Map<String, String>>();
+ String containerName = (container == null) ? GlobalConstants.DEFAULT.toString() : container;
+
+ // Derive the privilege this user has on the current container
+ String userName = request.getUserPrincipal().getName();
+ Privilege privilege = DaylightWebUtil.getContainerPrivilege(userName, containerName, this);
+
+ if (privilege != Privilege.NONE) {
+ IStatisticsManager statisticsManager = (IStatisticsManager) ServiceHelper
+ .getInstance(IStatisticsManager.class, containerName, this);
+ if(statisticsManager != null){
+ Node node = Node.fromString(nodeId);
+ NodeDescription nodeDesc = statisticsManager.getNodeDescription(node);
+ return nodeDesc;
+ }
+ }
+
+ return new NodeDescription();
+ }
+
@RequestMapping(value = "/existingNodes", method = RequestMethod.GET)
@ResponseBody
public TroubleshootingJsonBean getExistingNodes(HttpServletRequest request, @RequestParam(required = false) String container) {
} else {
row.put(MatchType.DL_VLAN.id(), "*");
}
+ //Vlan Priority
+ if (match.isPresent(MatchType.DL_VLAN_PR)) {
+ if (((Byte) flow.getMatch().getField(MatchType.DL_VLAN_PR).getValue())
+ .shortValue() < 0) {
+ row.put(MatchType.DL_VLAN_PR.id(), "0");
+ } else {
+ row.put(MatchType.DL_VLAN_PR.id(), ((Byte) flow.getMatch()
+ .getField(MatchType.DL_VLAN_PR).getValue()).toString());
+ }
+ } else {
+ row.put(MatchType.DL_VLAN_PR.id(), "*");
+ }
+
if (match.isPresent(MatchType.NW_SRC)) {
row.put(MatchType.NW_SRC.id(), ((InetAddress) flow.getMatch()
.getField(MatchType.NW_SRC).getValue()).getHostAddress());
row.put("durationSeconds",
((Integer) flowOnNode.getDurationSeconds()).toString());
row.put("idleTimeout", ((Short) flow.getIdleTimeout()).toString());
- row.put("priority", String.valueOf(flow.getPriority()));
+ row.put("priority", String.valueOf(NetUtils.getUnsignedShort(flow.getPriority())));
return row;
}