A minor change from Mac to MAC in nodes learnt popout.
Change-Id: I600a8437d757b72bdaf8f0e5d8ffa624a08c4d2b
Signed-off-by: lakshya <lakshya@cisco.com>
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
State portState = ((State) switchManager
.getNodeConnectorProp(nodeConnector,
State.StatePropName));
-
String nodeConnectorName = (ncName != null) ? ncName
.getValue() : "";
nodeConnectorName += " (" + nodeConnector.getID() + ")";
Map<String, String> subnet = new HashMap<String, String>();
subnet.put("name", conf.getName());
subnet.put("subnet", conf.getSubnet());
- subnet.put("json", gson.toJson(conf));
+ List<SubnetGatewayPortBean> portsList = new ArrayList<SubnetGatewayPortBean>();
+ Iterator<NodeConnector> itor = conf.getSubnetNodeConnectors().iterator();
+ while(itor.hasNext()) {
+ SubnetGatewayPortBean bean = new SubnetGatewayPortBean();
+ NodeConnector nodeConnector = itor.next();
+ String nodeName = getNodeDesc(nodeConnector.getNode().toString(), containerName);
+ Name ncName = ((Name) switchManager.getNodeConnectorProp(nodeConnector, Name.NamePropName));
+ String nodeConnectorName = (ncName != null) ? ncName.getValue() : "";
+ nodeConnectorName += " (" + nodeConnector.getID() + ")";
+ bean.setNodeName(nodeName);
+ bean.setNodePortName(nodeConnectorName);
+ bean.setNodeId(nodeConnector.getNode().toString());
+ bean.setNodePortId(nodeConnector.getID().toString());
+ portsList.add(bean);
+ }
+ subnet.put("nodePorts", gson.toJson(portsList));
subnets.add(subnet);
}
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.devices.web;
+
+public class SubnetGatewayPortBean {
+ private String nodeName;
+ private String nodeId;
+ private String nodePortId;
+ private String nodePortName;
+
+ public String getNodeName() {
+ return nodeName;
+ }
+ public void setNodeName(String nodeName) {
+ this.nodeName = nodeName;
+ }
+ public String getNodeId() {
+ return nodeId;
+ }
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+ public String getNodePortId() {
+ return nodePortId;
+ }
+ public void setNodePortId(String nodePortId) {
+ this.nodePortId = nodePortId;
+ }
+ public String getNodePortName() {
+ return nodePortName;
+ }
+ public void setNodePortName(String nodePortName) {
+ this.nodePortName = nodePortName;
+ }
+}
},
{
property: 'mac',
- label: 'Mac',
+ label: 'MAC',
sortable: true
},
{
sortable: true
},
{
- property: 'json',
+ property: 'nodePorts',
label: 'Node/Ports',
sortable: false
}
formatter: function(items) {
$.each(items, function(index, tableRow) {
tableRow["selector"] = '<input type="checkbox" id=' + tableRow["name"] + '></input>';
- var json = tableRow["json"];
- var subnetConfigObject = JSON.parse(json);
+ var json = tableRow["nodePorts"];
+ var nodePorts = JSON.parse(json);
var nodePortHtml = "<div>";
- $.each(subnetConfigObject.nodePorts, function(index, nodePort) {
- nodePortHtml += nodePort;
+ $.each(nodePorts, function(index, nodePort) {
+ var nodePortID = nodePort["nodeId"] + "/" + nodePort["nodePortId"];
+ nodePortHtml += nodePort["nodeName"] + " / " + nodePort["nodePortName"];
nodePortHtml += " ";
- nodePortHtml += '<a href="#" id=' + encodeURIComponent(nodePort) +
+ nodePortHtml += '<a href="#" id=' + encodeURIComponent(nodePortID) +
' gatewayName=' + tableRow["name"] +
' onclick="javascript:one.f.switchmanager.subnetGatewayConfig.actions.deleteNodePort(this);">Delete</a>';
nodePortHtml += "<br/>";
});
nodePortHtml += "</div>";
- tableRow["json"] = nodePortHtml;
+ tableRow["nodePorts"] = nodePortHtml;
});
},