- ISwitchManager switchManager = (ISwitchManager) ServiceHelper
- .getInstance(ISwitchManager.class, containerName, this);
- SwitchConfig cfg = new SwitchConfig(nodeId, nodeName, tier,
- operationMode);
- switchManager.updateSwitchConfig(cfg);
- resultBean.setStatus(true);
- resultBean.setMessage("Updated node information successfully");
+ ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class,
+ containerName, this);
+ Map<String, Property> nodeProperties = new HashMap<String, Property>();
+ Property desc = new Description(nodeName);
+ nodeProperties.put(desc.getName(), desc);
+ Property nodeTier = new Tier(Integer.parseInt(tier));
+ nodeProperties.put(nodeTier.getName(), nodeTier);
+ 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()) {
+ resultBean.setStatus(false);
+ resultBean.setMessage(result.getDescription());
+ } else {
+ resultBean.setStatus(true);
+ resultBean.setMessage("Updated node information successfully");
+ DaylightWebUtil.auditlog("Property", userName, "updated",
+ "of Node " + DaylightWebUtil.getNodeDesc(Node.fromString(nodeId), switchManager));
+ }