import java.util.List;
import java.util.Map;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
Long getOFPort(OvsdbTerminationPointAugmentation port);
Long getOFPort(Node bridgeNode, String portName);
DataBroker getDatabroker();
+ OvsdbBridgeAugmentation getBridgeFromConfig(Node ovsdbNode, String bridgeName);
}
import org.opendaylight.neutron.spi.NeutronNetwork;
import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface;
+import org.opendaylight.ovsdb.openstack.netvirt.MdsalHelper;
import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
*/
private boolean addBridge(Node ovsdbNode, String bridgeName) throws Exception {
boolean rv = true;
- if (!southbound.isBridgeOnOvsdbNode(ovsdbNode, bridgeName)) {
+ if ((!southbound.isBridgeOnOvsdbNode(ovsdbNode, bridgeName)) ||
+ (southbound.getBridgeFromConfig(ovsdbNode, bridgeName) == null)) {
rv = southbound.addBridge(ovsdbNode, bridgeName, getControllerTarget(ovsdbNode));
}
return rv;
}
return ofPort;
}
+ public OvsdbBridgeAugmentation getBridgeFromConfig(Node node, String bridge) {
+ OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null;
+ InstanceIdentifier<Node> bridgeIid =
+ MdsalHelper.createInstanceIdentifier(node.getKey(), bridge);
+ Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeIid);
+ if (bridgeNode != null) {
+ ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class);
+ }
+ return ovsdbBridgeAugmentation;
+ }
}