Merge "Description: - Made changes in devices.web bundle and sal.core.Config - files...
authorGiovanni Meo <gmeo@cisco.com>
Wed, 1 May 2013 20:06:39 +0000 (20:06 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 1 May 2013 20:06:39 +0000 (20:06 +0000)
opendaylight/web/root/src/main/java/org/opendaylight/controller/web/IDaylightWeb.java
opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java

index 84bbd94bae12b41654de7c906387a005db83896e..55e3ee51103ffd8d88a7d1a1dc8969af270eba00 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
  *
@@ -11,16 +10,36 @@ package org.opendaylight.controller.web;
 
 import org.opendaylight.controller.sal.authorization.UserLevel;
 
-/**
- *
- *
- */
 public interface IDaylightWeb {
+    /**
+     * Returns the name of the bundle. In the GUI, this name will be displayed
+     * on the tab.
+     * 
+     * @return Name assigned to the bundle.
+     */
     public String getWebName();
 
+    /**
+     * Returns the Id assigned to the web bundle.
+     * 
+     * @return Id assigned to the web bundle.
+     */
     public String getWebId();
 
+    /**
+     * Returns the position where the bundle tab will be placed in the GUI.
+     * 
+     * @return Position number for the bundle tab.
+     */
     public short getWebOrder();
-    
+
+    /**
+     * This method checks if the user is authorized to access the bundle.
+     * 
+     * @param userLevel
+     *            user role level in the controller space.
+     * 
+     * @return true, if user is authorized to access the bundle, else false.
+     */
     public boolean isAuthorized(UserLevel userLevel);
 }
index 285e33f53b91690ef7711bd1352b8956da90a63c..af25abded0ca51c8d6812345a4f6b7f3549da289 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.controller.sal.core.Host;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.core.Node.NodeIDType;
 import org.opendaylight.controller.sal.packet.address.EthernetAddress;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.controller.switchmanager.ISwitchManager;
@@ -131,12 +132,21 @@ public class Topology {
         
         for (Map.Entry<Node, Set<Edge>> e : nodeEdges.entrySet()) {
             Node n = e.getKey();
+            
+            // skip production node
+            if (nodeIgnore(n)) {
+                continue;
+            }
+            
             String description = switchManager.getNodeDescription(n);
             NodeBean node = createNodeBean(description, n);
             
             List<Map<String, Object>> adjacencies = new LinkedList<Map<String, Object>>();
             Set<Edge> links = e.getValue();
             for (Edge link : links) {
+                if (edgeIgnore(link)) {
+                    continue;
+                }
                 for (Property p : properties.get(link)) {
                     if (p instanceof Bandwidth) {
                        bandwidth = (Bandwidth) p;
@@ -166,6 +176,45 @@ public class Topology {
         }
     }
     
+    /**
+     * Check if this node shouldn't appear in the visual topology
+     * 
+     * @param node
+     * @return
+     */
+    private boolean nodeIgnore(Node node) {
+        String nodeType = node.getType();
+        
+        // add other node types to ignore later
+        if (nodeType.equals(NodeIDType.PRODUCTION)) {
+            return true;
+        }
+        
+        return false;
+    }
+    
+    /**
+     * Check if this edge shouldn't appear in the visual topology
+     * 
+     * @param edge
+     * @return
+     */
+    private boolean edgeIgnore(Edge edge) {
+        NodeConnector headNodeConnector = edge.getHeadNodeConnector();
+        Node headNode = headNodeConnector.getNode();
+        if (nodeIgnore(headNode)) {
+            return true;
+        }
+        
+        NodeConnector tailNodeConnector = edge.getTailNodeConnector();
+        Node tailNode = tailNodeConnector.getNode();
+        if (nodeIgnore(tailNode)) {
+            return true;
+        }
+        
+        return false;
+    }
+    
     protected NodeBean createNodeBean(String description, Node node) {
        String name = (description == null || 
                        description.trim().isEmpty() ||
@@ -179,6 +228,11 @@ public class Topology {
        if (nodes == null) return;
        for (Switch sw : nodes) {
                Node n = sw.getNode();
+               
+               // skip production node
+                if (nodeIgnore(n)) {
+                    continue;
+                }
 
                String description = switchManager.getNodeDescription(n);