When deserialized, OvsdbBridgeAugmentation's datapathType is now
initialized as DatapathTypeBase instead of null. This is now handled
as an absent value in SouthboundMapper instead of producing an
IllegalArgumentException.
The exception's message is clarified to trace the unknown datapath
type class, instead of the value retrieved from the map (which is
always null in this case).
Change-Id: Ie10ff09878bf182d4747d63f1580a37dfd71ac88
Signed-off-by: Stephen Kitt <skitt@redhat.com>
public static String createDatapathType(OvsdbBridgeAugmentation mdsalbridge) {
String datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(DatapathTypeSystem.class);
- if (mdsalbridge.getDatapathType() != null) {
- if (SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType()) != null) {
- datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType());
- } else {
- throw new IllegalArgumentException("Unknown datapath type "
- + SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType()));
+ if (mdsalbridge.getDatapathType() != null && !mdsalbridge.getDatapathType().equals(DatapathTypeBase.class)) {
+ datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType());
+ if (datapathtype == null) {
+ throw new IllegalArgumentException("Unknown datapath type " + mdsalbridge.getDatapathType().getName());
}
}
return datapathtype;