public static DeviceOracle createDeviceOracle(
      String macStr,
      Long vlan,
      String entityClassName,
      String ipStr,
      String dpidStr,
      Short switchPortNumber)
      throws BigDBException {
    if (macStr == null) {
      throw new BigDBException("Mac Address cannot be null.");
    }
    Short vlanShort = vlan == null ? null : Short.valueOf(vlan.shortValue());
    Integer port = switchPortNumber == null ? null : Integer.valueOf(switchPortNumber);
    Integer ipv4 = ipStr == null ? null : IPv4.toIPv4Address(ipStr);
    Long dpid = dpidStr == null ? null : HexString.toLong(dpidStr);
    IEntityClass entityClass =
        getDeviceService().getEntityClassifier().getEntityClassByName(entityClassName);
    if (entityClass == null) {
      throw new BigDBException(
          "Invalid entity class name, config the " + "entity class first: " + entityClassName);
    }
    Entity en = new Entity(HexString.toLong(macStr), vlanShort, ipv4, dpid, port, null);

    String deviceId = IndexedEntity.getKeyString(entityClassName, en, entityClass.getKeyFields());
    return new DeviceOracle(deviceId, macStr, vlanShort, entityClassName, ipStr, dpidStr, port);
  }