When using the OVSDB Northbound v3 APIs the below error is returned when GET'ting tables that contain boolean columns.
http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v3/node/OVS|192.168.120.31:48161/database/Open_vSwitch/table/Bridge
No serializer found for class org.opendaylight.ovsdb.lib.schema.BaseType$BooleanBaseType and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: org.opendaylight.ovsdb.lib.schema.GenericTableSchema["columnSchemas"]->java.util.HashMap["stp_enable"]->org.opendaylight.ovsdb.lib.schema.ColumnSchema["type"]->org.opendaylight.ovsdb.lib.schema.AtomicColumnType["baseType"])
The boolean type does not have a public getter/setter since it doesn't need one but this error comes from that.
Configure the object mapper to safely ignore the error.
Change-Id: I1fc0cca6b48a698f711dc61b4a33763ff2fa521d
Signed-off-by: Sam Hague <shague@redhat.com>
package org.opendaylight.ovsdb.northbound;
+import com.fasterxml.jackson.databind.SerializationFeature;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.core.Response;
import org.opendaylight.controller.northbound.commons.exception.InternalServerErrorException;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.opendaylight.ovsdb.lib.OvsdbClient;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
this.nodeId = id;
objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
}
private DatabaseSchema getDatabaseSchema (String databaseName) {
package org.opendaylight.ovsdb.northbound;
+import com.fasterxml.jackson.databind.SerializationFeature;
import java.io.InputStream;
import java.util.List;
public NodeResource () {
objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
}
public static Node getOvsdbNode(String nodeId, Object bundleClassRef) {
package org.opendaylight.ovsdb.northbound;
+import com.fasterxml.jackson.databind.SerializationFeature;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
this.tableName = tableName;
objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
+ objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
}
private OvsdbRow getOvsdbRow (InputStream stream) throws IOException {
package org.opendaylight.ovsdb.northbound;
+import com.fasterxml.jackson.databind.SerializationFeature;
import java.util.Set;
import javax.ws.rs.GET;
this.databaseName = databaseName;
objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
+ objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
}
private DatabaseSchema getDatabaseSchema (String databaseName) {