import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
nodeDatum.put("tierName", TierHelper.getTierName(tierNumber) + " (Tier-" + tierNumber + ")");
nodeDatum.put("tier", tierNumber + "");
String modeStr = "0";
- ForwardingMode mode = (ForwardingMode) switchManager.getNodeProp(node, ForwardingMode.name);
+ ForwardingMode mode = null;
+ if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
+ ISwitchManager switchManagerDefault = (ISwitchManager) ServiceHelper.getInstance(
+ ISwitchManager.class, GlobalConstants.DEFAULT.toString(), this);
+ mode = (ForwardingMode) switchManagerDefault.getNodeProp(node, ForwardingMode.name);
+ } else {
+ mode = (ForwardingMode) switchManager.getNodeProp(node, ForwardingMode.name);
+ }
if (mode != null) {
modeStr = String.valueOf(mode.getValue());
}
nodeProperties.put(desc.getName(), desc);
Property nodeTier = new Tier(Integer.parseInt(tier));
nodeProperties.put(nodeTier.getName(), nodeTier);
- Property mode = new ForwardingMode(Integer.parseInt(operationMode));
- nodeProperties.put(mode.getName(), mode);
+ if (containerName.equals(GlobalConstants.DEFAULT.toString())) {
+ Property mode = new ForwardingMode(Integer.parseInt(operationMode));
+ nodeProperties.put(mode.getName(), mode);
+ }
SwitchConfig cfg = new SwitchConfig(nodeId, nodeProperties);
Status result = switchManager.updateNodeConfig(cfg);
if (!result.isSuccess()) {
} else {
resultBean.setStatus(true);
resultBean.setMessage("Updated node information successfully");
+ DaylightWebUtil.auditlog("Node", userName, "updated", nodeId + " to "+ nodeName, containerName);
}
} catch (Exception e) {
resultBean.setStatus(false);
if (addStaticRouteResult.isSuccess()) {
result.setStatus(true);
result.setMessage("Static Route saved successfully");
+ DaylightWebUtil.auditlog("Static Route", userName, "added", routeName, containerName);
} else {
result.setStatus(false);
result.setMessage(addStaticRouteResult.getDescription());
resultBean.setMessage(result.getDescription());
break;
}
+ DaylightWebUtil.auditlog("Static Route", userName, "removed", route, containerName);
}
} catch (Exception e) {
resultBean.setStatus(false);
ISwitchManager switchManager = (ISwitchManager) ServiceHelper
.getInstance(ISwitchManager.class, containerName, this);
SubnetConfig cfgObject = new SubnetConfig(gatewayName,
- gatewayIPAddress, new ArrayList<String>());
+ gatewayIPAddress, new HashSet<String>());
Status result = switchManager.addSubnet(cfgObject);
if (result.isSuccess()) {
resultBean.setStatus(true);
resultBean.setMessage("Added gateway address successfully");
+ DaylightWebUtil.auditlog("Subnet Gateway", userName, "added", gatewayName, containerName);
} else {
resultBean.setStatus(false);
resultBean.setMessage(result.getDescription());
resultBean.setMessage(result.getDescription());
break;
}
+ DaylightWebUtil.auditlog("Subnet Gateway", userName, "removed", subnet, containerName);
}
} catch (Exception e) {
resultBean.setStatus(false);
resultBean.setStatus(true);
resultBean
.setMessage("Added ports to subnet gateway address successfully");
+ DaylightWebUtil.auditlog("Ports to Subnet Gateway", userName, "added",nodeId+"/"+ ports, containerName);
} else {
resultBean.setStatus(false);
resultBean.setMessage(result.getDescription());
resultBean.setStatus(true);
resultBean
.setMessage("Deleted port from subnet gateway address successfully");
+ DaylightWebUtil.auditlog("Ports from Subnet Gateway", userName, "removed", nodePort, containerName);
} else {
resultBean.setStatus(false);
resultBean.setMessage(result.getDescription());
@RequestMapping(value = "/nodeports")
@ResponseBody
- public Map<String, Object> getNodePorts(HttpServletRequest request,
+ public List<NodeJsonBean> getNodePorts(HttpServletRequest request,
@RequestParam(required = false) String container) {
String containerName = (container == null) ? GlobalConstants.DEFAULT
.toString() : container;
return null;
}
-
ISwitchManager switchManager = (ISwitchManager) ServiceHelper
.getInstance(ISwitchManager.class, containerName, this);
if (switchManager == null) {
return null;
}
-
- Map<String, Object> nodes = new HashMap<String, Object>();
- Map<Short, String> port;
+ List<NodeJsonBean> nodeJsonBeans = new ArrayList<NodeJsonBean>();
for (Switch node : switchManager.getNetworkDevices()) {
- port = new HashMap<Short, String>(); // new port
+ NodeJsonBean nodeJsonBean = new NodeJsonBean();
+ List<String> port = new ArrayList<String>();
Set<NodeConnector> nodeConnectorSet = node.getNodeConnectors();
if (nodeConnectorSet != null) {
String nodeConnectorName = ((Name) switchManager
.getNodeConnectorProp(nodeConnector,
Name.NamePropName)).getValue();
- port.put((Short) nodeConnector.getID(), nodeConnectorName
+ port.add(nodeConnectorName
+ "(" + nodeConnector.getID() + ")");
}
}
-
- nodes.put(node.getNode().toString(), port);
+ nodeJsonBean.setNodeId(node.getNode().toString());
+ nodeJsonBean.setNodeName(getNodeDesc(node.getNode().toString(), containerName));
+ nodeJsonBean.setNodePorts(port);
+ nodeJsonBeans.add(nodeJsonBean);
}
- return nodes;
+ return nodeJsonBeans;
}
@RequestMapping(value = "/spanPorts/add", method = RequestMethod.GET)
if (result.isSuccess()) {
resultBean.setStatus(true);
resultBean.setMessage("SPAN Port added successfully");
+ DaylightWebUtil.auditlog("SPAN Port", userName, "added", cfgObject.getNodeId(), containerName);
} else {
resultBean.setStatus(false);
resultBean.setMessage(result.getDescription());
resultBean.setMessage(result.getDescription());
break;
}
+ DaylightWebUtil.auditlog("SPAN Port", userName, "removed", cfgObject.getNodeId(), containerName);
}
}
} catch (Exception e) {