Added support for bridge other-config. 47/18047/2
authorSharad Mishra <sharad.d.mishra@intel.com>
Thu, 9 Apr 2015 07:37:23 +0000 (00:37 -0700)
committerSharad Mishra <sharad.d.mishra@intel.com>
Thu, 9 Apr 2015 09:37:26 +0000 (02:37 -0700)
This patch will Create/update other-config to bridges.
To add other-config in bridge, run the following commands -

sudo ovs-vsctl -- set Bridge br0 other_config:enable-input=false

This assumes a bridge exists with name br0
other-config is a key/value pair, and AFAIK, it can be any random key/value.
To update/modify other config, just supply a new value like -

sudo ovs-vsctl -- set Bridge br0 other_config:enable-input=yes

Change-Id: I4cafe9b8c74f752d951ea073b0a9766721452b6d
Signed-off-by: Sharad Mishra <sharad.d.mishra@intel.com>
southbound/southbound-api/src/main/yang/ovsdb.yang
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommand.java

index 07e368efbf8fdb9d99a716153f2df7c2b96599a5..08241f4702f4ce5828f7560a6a0d01384c8d2c33 100755 (executable)
@@ -190,7 +190,21 @@ module ovsdb {
                 type string;
                 mandatory true;
             }
-         }
+        }
+
+        list bridge-other-configs {
+            description "Other config attributes for Bridges";
+            key "bridge-other-config-key";
+            leaf bridge-other-config-key {
+                description "bridge-other-config name/key";
+                type string;
+            }
+            leaf bridge-other-config-value {
+                description "bridge-other-config value";
+                type string;
+            }
+        }
+
     }
 
     grouping ovsdb-node-attributes {
index 1e51f816c2db822b975363a0c2bd71699d993eea..c1fd97e151241b83b49d58af64d8a8b99280c918 100644 (file)
@@ -29,6 +29,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeExternalIds;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeExternalIdsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
@@ -100,6 +102,24 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand {
                     ovsdbManagedNodeBuilder.setBridgeExternalIds(externalIdsList);
                 }
 
+                Map<String, String> otherConfigs = bridge
+                        .getOtherConfigColumn().getData();
+                if (otherConfigs != null && !otherConfigs.isEmpty()) {
+                    Set<String> otherConfigKeys = otherConfigs.keySet();
+                    List<BridgeOtherConfigs> otherConfigList = new ArrayList<BridgeOtherConfigs>();
+                    String otherConfigValue;
+                    for (String otherConfigKey : otherConfigKeys) {
+                        otherConfigValue = otherConfigs.get(otherConfigKey);
+                        if (otherConfigKey != null && otherConfigValue != null) {
+                            otherConfigList.add(new BridgeOtherConfigsBuilder()
+                                    .setBridgeOtherConfigKey(otherConfigKey)
+                                    .setBridgeOtherConfigValue(otherConfigValue)
+                                    .build());
+                        }
+                    }
+                    ovsdbManagedNodeBuilder.setBridgeOtherConfigs(otherConfigList);
+                }
+
                 if (!SouthboundMapper.createControllerEntries(bridge, updatedControllerRows).isEmpty()) {
                     ovsdbManagedNodeBuilder.setControllerEntry(
                             SouthboundMapper.createControllerEntries(bridge, updatedControllerRows));