+ OpenVSwitch oldEntry = deletedOpenVSwitchRows.get(entry.getKey());
+ final InstanceIdentifier<Node> nodePath = getInstanceIdentifier(openVSwitch);
+
+ OvsdbNodeAugmentationBuilder ovsdbNodeBuilder = new OvsdbNodeAugmentationBuilder();
+
+ setVersion(ovsdbNodeBuilder, openVSwitch);
+ setDataPathTypes(ovsdbNodeBuilder, openVSwitch);
+ setInterfaceTypes(ovsdbNodeBuilder, openVSwitch);
+ setExternalIds(transaction, ovsdbNodeBuilder, oldEntry, openVSwitch);
+ setOtherConfig(transaction, ovsdbNodeBuilder, oldEntry, openVSwitch);
+ ovsdbNodeBuilder.setConnectionInfo(getConnectionInfo());
+
+ NodeBuilder nodeBuilder = new NodeBuilder();
+ nodeBuilder.setNodeId(getNodeId(openVSwitch));
+ nodeBuilder.addAugmentation(OvsdbNodeAugmentation.class,
+ ovsdbNodeBuilder.build());
+ transaction.merge(LogicalDatastoreType.OPERATIONAL, nodePath,
+ nodeBuilder.build());
+ }
+ }
+
+ private void setOtherConfig(ReadWriteTransaction transaction,
+ OvsdbNodeAugmentationBuilder ovsdbNodeBuilder, OpenVSwitch oldEntry, OpenVSwitch openVSwitch) {
+ Map<String, String> oldOtherConfigs = null;
+ Map<String, String> otherConfigs = null;
+
+ if (openVSwitch.getOtherConfigColumn() != null) {
+ otherConfigs = openVSwitch.getOtherConfigColumn().getData();
+ }
+ if (oldEntry != null && oldEntry.getOtherConfigColumn() != null) {
+ oldOtherConfigs = oldEntry.getOtherConfigColumn().getData();
+ }
+ if ((oldOtherConfigs == null) || oldOtherConfigs.isEmpty()) {
+ setNewOtherConfigs(ovsdbNodeBuilder, otherConfigs);
+ } else if (otherConfigs != null && !otherConfigs.isEmpty()) {
+ removeOldConfigs(transaction, oldOtherConfigs, openVSwitch);
+ setNewOtherConfigs(ovsdbNodeBuilder, otherConfigs);
+ }
+ }
+
+ private void removeOldConfigs(ReadWriteTransaction transaction, Map<String, String> oldOtherConfigs,
+ OpenVSwitch ovs) {
+ InstanceIdentifier<OvsdbNodeAugmentation> nodeAugmentataionIid = InstanceIdentifier
+ .create(NetworkTopology.class)
+ .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
+ .child(Node.class, new NodeKey(getNodeId(ovs))).augmentation(OvsdbNodeAugmentation.class);
+ Set<String> otherConfigKeys = oldOtherConfigs.keySet();
+ for (String otherConfigKey : otherConfigKeys) {
+ KeyedInstanceIdentifier<OpenvswitchOtherConfigs, OpenvswitchOtherConfigsKey> externalIid =
+ nodeAugmentataionIid
+ .child(OpenvswitchOtherConfigs.class, new OpenvswitchOtherConfigsKey(otherConfigKey));
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIid);
+ }
+ }
+
+ private void setNewOtherConfigs(OvsdbNodeAugmentationBuilder ovsdbNodeBuilder,
+ Map<String, String> otherConfigs) {
+ Set<String> otherConfigKeys = otherConfigs.keySet();
+ List<OpenvswitchOtherConfigs> otherConfigsList = new ArrayList<>();
+ String otherConfigValue;
+ for (String otherConfigKey : otherConfigKeys) {
+ otherConfigValue = otherConfigs.get(otherConfigKey);
+ if (otherConfigKey != null && otherConfigValue != null) {
+ otherConfigsList.add(new OpenvswitchOtherConfigsBuilder().setOtherConfigKey(otherConfigKey)
+ .setOtherConfigValue(otherConfigValue).build());