Thomas Vachuska

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

Change-Id: I0c48e3d9b41fd60f0429d6a2c989a9f5e6e12f40
......@@ -321,7 +321,12 @@ public abstract class Config<S> {
* @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());
}
/**
......
......@@ -45,7 +45,7 @@ public final class BasicDeviceConfig extends BasicElementConfig<DeviceId> {
* @return device type override
*/
public Device.Type type() {
return get(TYPE, Device.Type.SWITCH, Device.Type.class);
return get(TYPE, null, Device.Type.class);
}
/**
......