Merge "BUG 408"
authorEd Warnicke <eaw@cisco.com>
Mon, 10 Feb 2014 11:53:48 +0000 (11:53 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 10 Feb 2014 11:53:48 +0000 (11:53 +0000)
opendaylight/configuration/api/src/main/java/org/opendaylight/controller/configuration/ConfigurationObject.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java

index 720dc7b2344133420a0acb8fedd0e1841c9cd07c..7151e561b1d1845faedefb5a3db3da54d2ca25cd 100644 (file)
@@ -12,7 +12,7 @@ import java.io.Serializable;
 
 public abstract class ConfigurationObject implements Serializable {
     private static final long serialVersionUID = 1L;
-    private static final String DEFAULT_REGEX = "^[\\w-=\\+\\*\\/\\.\\(\\)\\[\\]\\@\\|\\:]{1,256}$";
+    private static final String DEFAULT_REGEX = "^[\\w-=\\+\\*\\.\\(\\)\\[\\]\\@\\|\\:]{1,256}$";
     private static final String REGEX_PROP_NAME = "resourceNameRegularExpression";
     private static String regex;
 
index 394be07dee2968b838377d8424ad8c70d49f4bce..b29ce15f5621aa0c09b29bafdf080448b973b628 100644 (file)
@@ -391,7 +391,12 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
 
             updateProdEdge(edge, props);
         } catch (Exception e) {
-            logger.warn("Caught exception ", e);
+            if (logger.isDebugEnabled()) {
+                logger.debug(
+                        "Caught exception while attempting to snoop non controller generated or malformed LLDP frame sent by {} and received on {}: {}",
+                        HexEncode.bytesToHexStringFormat(ethPkt.getSourceMACAddress()), dstNodeConnector,
+                        e.getMessage());
+            }
         }
     }
 
index de18b021ffa0b52919544efbb0e50c655aea56b3..b8d022f30e76eae6df2b81021eb779e14704bf20 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.sal.utils.StatusCode;
 
 /**
- * The class describes a switch configuration
+ * The class describes a switch configuration as a collection of properties
  */
 public class SwitchConfig extends ConfigurationObject implements Cloneable, Serializable {
     private static final long serialVersionUID = 1L;
@@ -123,15 +123,20 @@ public class SwitchConfig extends ConfigurationObject implements Cloneable, Seri
     }
 
     private Status validateNodeId() {
-        if (!isValidResourceName(nodeId)) {
-            return new Status(StatusCode.BADREQUEST, "Invalid NodeId");
+        if (nodeId == null || nodeId.trim().isEmpty()) {
+            return new Status(StatusCode.BADREQUEST, "Invalid node id");
         }
         return new Status(StatusCode.SUCCESS);
     }
 
     private Status validateNodeProperties() {
         if (nodeProperties == null) {
-            return new Status(StatusCode.BADREQUEST, "nodeProperties cannot be null");
+            return new Status(StatusCode.BADREQUEST, "Node properties must be specified");
+        }
+        if (nodeProperties.containsKey(Description.propertyName)) {
+            if (!isValidResourceName(((Description)nodeProperties.get(Description.propertyName)).getValue())) {
+                return new Status(StatusCode.BADREQUEST, "Invalid node description");
+            }
         }
         return new Status(StatusCode.SUCCESS);
     }