Merge "BUG 5746 - Ovsdb QoS and Queue model enhancements"
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / transactions / md / OvsdbBridgeUpdateCommand.java
index 9ab33b7681d3f715d2ec2b2cdb40b3007b75db47..a86638ffed20e1e8843932631957a854e4b5029d 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.ovsdb.southbound.transactions.md;
 
+import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog;
+
 import java.net.InetAddress;
 import java.net.NetworkInterface;
 import java.util.ArrayList;
@@ -185,8 +187,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
                 }
             }
         } catch (SchemaVersionMismatchException e) {
-            // We don't care about the exception stack trace here
-            LOG.warn("protocol not supported by this version of ovsdb: {}", e.getMessage());
+            schemaMismatchLog("protocols", "Bridge", e);
         }
         return result;
     }
@@ -228,6 +229,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
         setFailMode(ovsdbBridgeAugmentationBuilder, bridge);
         setOpenFlowNodeRef(ovsdbBridgeAugmentationBuilder, bridge);
         setManagedBy(ovsdbBridgeAugmentationBuilder);
+        setAutoAttach(ovsdbBridgeAugmentationBuilder, bridge);
         bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build());
 
         LOG.debug("Built with the intent to store bridge data {}",
@@ -235,6 +237,22 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
         return bridgeNodeBuilder.build();
     }
 
+    private void setAutoAttach(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
+            Bridge bridge) {
+        try {
+            if (bridge.getAutoAttachColumn() != null
+                    && bridge.getAutoAttachColumn().getData() != null
+                    && !bridge.getAutoAttachColumn().getData().isEmpty()) {
+                Set<UUID> uuids = bridge.getAutoAttachColumn().getData();
+                for (UUID uuid : uuids) {
+                    ovsdbBridgeAugmentationBuilder.setAutoAttach(new Uuid(uuid.toString()));
+                }
+            }
+        } catch (SchemaVersionMismatchException e) {
+            schemaMismatchLog("auto_attach", "Bridge", e);
+        }
+    }
+
     private void setManagedBy(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder) {
         InstanceIdentifier<Node> connectionNodePath = getOvsdbConnectionInstance().getInstanceIdentifier();
         ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath));