import org.opendaylight.controller.sal.utils.StatusCode;
import org.opendaylight.controller.sal.utils.GlobalConstants;
import org.opendaylight.controller.sal.utils.IObjectReader;
-import org.opendaylight.controller.sal.utils.NodeCreator;
import org.opendaylight.controller.sal.utils.ObjectReader;
import org.opendaylight.controller.sal.utils.ObjectWriter;
import org.opendaylight.controller.sal.utils.ServiceHelper;
: null;
}
- /*
- * test utility function which assumes all nodes are OF nodes
- */
- private Node getNode(Long id) {
- Set<Node> nodes = getNodes();
- if (nodes != null) {
- for (Node node : nodes) {
- if (id.equals((Long) node.getID())) {
- return node;
- }
- }
- }
- return null;
- }
-
/*
* Returns a copy of a list of properties for a given node
- *
+ *
* (non-Javadoc)
- *
+ *
* @see
* org.opendaylight.controller.switchmanager.ISwitchManager#getNodeProps
* (org.opendaylight.controller.sal.core.Node)
Set<NodeConnector> nodeConnectorSet = new HashSet<NodeConnector>();
for (NodeConnector nodeConnector : nodeConnectorProps.keySet()) {
- if (((Long) nodeConnector.getNode().getID()).longValue() != (Long) node
- .getID())
+ if (!nodeConnector.getNode().equals(node)) {
continue;
+ }
if (isNodeConnectorEnabled(nodeConnector))
nodeConnectorSet.add(nodeConnector);
}
Set<NodeConnector> nodeConnectorSet = new HashSet<NodeConnector>();
for (NodeConnector nodeConnector : nodeConnectorProps.keySet()) {
- if (((Long) nodeConnector.getNode().getID()).longValue() != (Long) node
- .getID())
+ if (!nodeConnector.getNode().equals(node)) {
continue;
+ }
nodeConnectorSet.add(nodeConnector);
}
return nodeConnectorSet;
}
- /*
- * testing utility function which assumes we are dealing with OF Node
- * nodeconnectors only
- */
- @SuppressWarnings("unused")
- private Set<Long> getEnabledNodeConnectorIds(Node node) {
- Set<Long> ids = new HashSet<Long>();
- Set<NodeConnector> nodeConnectors = getUpNodeConnectors(node);
-
- if (nodeConnectors != null) {
- for (NodeConnector nodeConnector : nodeConnectors) {
- ids.add((Long) nodeConnector.getID());
- }
- }
-
- return ids;
- }
-
@Override
public Map<String, Property> getNodeConnectorProps(
NodeConnector nodeConnector) {
/**
* Adds a node connector and its property if any
- *
+ *
* @param nodeConnector
* {@link org.opendaylight.controller.sal.core.NodeConnector}
* @param propName
/**
* Removes one property of a node connector
- *
+ *
* @param nodeConnector
* {@link org.opendaylight.controller.sal.core.NodeConnector}
* @param propName
/**
* Removes all the properties of a node connector
- *
+ *
* @param nodeConnector
* {@link org.opendaylight.controller.sal.core.NodeConnector}
* @return success or failed reason
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
- *
+ *
*/
void init(Component c) {
Dictionary<?, ?> props = c.getServiceProperties();
* Function called by the dependency manager when at least one dependency
* become unsatisfied or when the component is shutting down because for
* example bundle is being stopped.
- *
+ *
*/
void destroy() {
shutDown();
/**
* Function called by dependency manager after "init ()" is called and after
* the services provided by the class are registered in the service registry
- *
+ *
*/
void start() {
// OSGI console
* Function called by the dependency manager before the services exported by
* the component are unregistered, this will be followed by a "destroy ()"
* calls
- *
+ *
*/
void stop() {
}
/**
* Creates a Name/Tier/Bandwidth Property object based on given property
* name and value. Other property types are not supported yet.
- *
+ *
* @param propName
* Name of the Property
* @param propValue
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.controller.sal.core.Tier;
-import org.opendaylight.controller.sal.utils.GlobalConstants;
import org.opendaylight.controller.sal.utils.HexEncode;
import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.opendaylight.controller.sal.utils.Status;
.getNodeConnectors();
if (nodeConnectorSet != null && nodeConnectorSet.size() > 0) {
Map<Short, String> portList = new HashMap<Short, String>();
+ List<String> intfList = new ArrayList<String>();
for (NodeConnector nodeConnector : nodeConnectorSet) {
String nodeConnectorNumberToStr = nodeConnector.getID()
.toString();
}
}
- portList.put(
- Short.parseShort(nodeConnectorNumberToStr),
- nodeConnectorName);
+ Class<?> idClass = nodeConnector.getID().getClass();
+ if (idClass.equals(Short.class)) {
+ portList.put(
+ Short.parseShort(nodeConnectorNumberToStr),
+ nodeConnectorName);
+ } else {
+ intfList.add(nodeConnectorName);
+ }
}
- Map<Short, String> sortedPortList = new TreeMap<Short, String>(
- portList);
+ if (portList.size() > 0) {
+ Map<Short, String> sortedPortList = new TreeMap<Short, String>(
+ portList);
- for (Entry<Short, String> e : sortedPortList.entrySet()) {
- sb1.append(e.getValue());
- sb1.append("<br>");
+ for (Entry<Short, String> e : sortedPortList.entrySet()) {
+ sb1.append(e.getValue());
+ sb1.append("<br>");
+ }
+ } else if (intfList.size() > 0) {
+ for (String intf : intfList) {
+ sb1.append(intf);
+ sb1.append("<br>");
+ }
}
}
nodeDatum.put("ports", sb1.toString());
/**
* Is the operation permitted for the given level
- *
+ *
* @param level
*/
private boolean authorize(UserLevel level, HttpServletRequest request) {
* IUserManager userManager = (IUserManager) ServiceHelper
* .getGlobalInstance(IUserManager.class, this); if (userManager ==
* null) { return "User Manager is not available"; }
- *
+ *
* String username = request.getUserPrincipal().getName();
- *
- *
+ *
+ *
* model.addAttribute("username", username); model.addAttribute("role",
* userManager.getUserLevel(username).toNumber());
*/