Bug 6506: Add bridge stp_enble to ovsdb.yang 25/44225/3
authorPeng Zhang <pzhang@ctbri.com.cn>
Thu, 18 Aug 2016 03:10:55 +0000 (11:10 +0800)
committerPeng Zhang <pzhang@ctbri.com.cn>
Tue, 23 Aug 2016 03:06:04 +0000 (11:06 +0800)
We can use command "ovs-vsctl" to enbale spanning tree protocol on a bridge,
e.g., "ovs-vsctl set Bridge br0 stp_enable=true". But there is missing the
stp_enble in ovsdb.yang.

Change-Id: Ied5c093fb739f220fe673c80cd74cf84be7e0c0b
Signed-off-by: Peng Zhang <pzhang@ctbri.com.cn>
southbound/southbound-api/src/main/yang/ovsdb.yang
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommand.java

index f7258456108c79f04dd28156480c17505501927e..2e1694c94810e1f83b389c9ca7fe87726e7bd4cc 100755 (executable)
@@ -199,6 +199,13 @@ module ovsdb {
             type ovsdb-node-ref;
         }
 
+        leaf stp_enable {
+            description
+                "Enable spanning tree on the bridge. By default, STP is
+                 disabled on bridges";
+            type boolean;
+        }
+
         list bridge-external-ids {
             description
                "Key-value pairs for use by external frameworks that integrate
index 63104189c2c8d4f05ea5bde2d0bb9f763605b2b1..c78a04b8750f0036b9112c86d71441adfb708a91 100644 (file)
@@ -76,6 +76,7 @@ public class BridgeUpdateCommand implements TransactCommand {
         Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
         setFailMode(bridge, ovsdbManagedNode);
         setDataPathType(bridge, ovsdbManagedNode);
+        setStpEnalbe(bridge, ovsdbManagedNode);
         setOpenDaylightExternalIds(bridge, iid, ovsdbManagedNode);
         setOpenDaylightOtherConfig(bridge, ovsdbManagedNode);
         Optional<OvsdbBridgeAugmentation> operationalBridgeOptional =
@@ -105,6 +106,12 @@ public class BridgeUpdateCommand implements TransactCommand {
         }
     }
 
+    private void setStpEnalbe(Bridge bridge, OvsdbBridgeAugmentation ovsdbManageNode) {
+        if (ovsdbManageNode.isStpEnable() != null) {
+            bridge.setStpEnable(ovsdbManageNode.isStpEnable());
+        }
+    }
+
     private void setName(Bridge bridge, OvsdbBridgeAugmentation ovsdbManagedNode,
             Optional<OvsdbBridgeAugmentation> operationalBridgeOptional) {
         if (ovsdbManagedNode.getBridgeName() != null) {
index 01abf5cd325e336da71a635e3896eee120c7132f..346d443165962da91e0509a30cd0185b4f16ee41 100644 (file)
@@ -229,6 +229,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
         setOpenFlowNodeRef(ovsdbBridgeAugmentationBuilder, bridge);
         setManagedBy(ovsdbBridgeAugmentationBuilder);
         setAutoAttach(ovsdbBridgeAugmentationBuilder, bridge);
+        setStpEnalbe(ovsdbBridgeAugmentationBuilder,bridge);
         bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build());
 
         LOG.debug("Built with the intent to store bridge data {}",
@@ -333,6 +334,16 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
         }
     }
 
+    private void setStpEnalbe(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
+                              Bridge bridge) {
+        if (bridge.getStpEnableColumn() != null) {
+            Boolean stpEnable = bridge.getStpEnableColumn().getData();
+            if (stpEnable != null) {
+                ovsdbBridgeAugmentationBuilder.setStpEnable(stpEnable);
+            }
+        }
+    }
+
     private void setOpenFlowNodeRef(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
             Bridge bridge) {
         Map<UUID, Controller> updatedControllerRows =