Fixing an issue in basic device config where config always overrode the type to switch.

Change-Id: I0c48e3d9b41fd60f0429d6a2c989a9f5e6e12f40
diff --git a/core/api/src/main/java/org/onosproject/net/config/Config.java b/core/api/src/main/java/org/onosproject/net/config/Config.java
index 4aa3d8d..4dce014 100644
--- a/core/api/src/main/java/org/onosproject/net/config/Config.java
+++ b/core/api/src/main/java/org/onosproject/net/config/Config.java
@@ -321,7 +321,12 @@
      * @return property value or default value
      */
     protected <E extends Enum<E>> E get(String name, E defaultValue, Class<E> enumClass) {
-        return Enum.valueOf(enumClass, object.path(name).asText(defaultValue.toString()));
+        if (defaultValue != null) {
+            Enum.valueOf(enumClass, object.path(name).asText(defaultValue.toString()));
+        }
+
+        JsonNode node = object.get(name);
+        return node == null ? null : Enum.valueOf(enumClass, node.asText());
     }
 
     /**
diff --git a/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java b/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java
index 93ca16e..6401ab4 100644
--- a/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java
@@ -45,7 +45,7 @@
      * @return device type override
      */
     public Device.Type type() {
-        return get(TYPE, Device.Type.SWITCH, Device.Type.class);
+        return get(TYPE, null, Device.Type.class);
     }
 
     /**