import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.meta.rev151007.bridge.ref.info.BridgeRefEntryBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.meta.rev151007.bridge.ref.info.BridgeRefEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.rev150331.IfTunnel;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public static List<ListenableFuture<Void>> addPortToBridge(InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid,
OvsdbBridgeAugmentation bridgeNew, DataBroker dataBroker) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
- WriteTransaction t = dataBroker.newWriteOnlyTransaction();
+ WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
if (bridgeNew.getDatapathId() == null) {
LOG.warn("DataPathId found as null for Bridge Augmentation: {}... retrying...", bridgeNew);
return futures;
}
}
-
- String dpId = bridgeNew.getDatapathId().getValue();
String bridgeName = bridgeNew.getBridgeName().getValue();
- LOG.info("adding dpId {} to bridge reference {}", dpId, bridgeNew);
+ BigInteger dpnId = IfmUtil.getDpnId(bridgeNew.getDatapathId());
- if (dpId == null) {
- LOG.error("Optained null dpid for bridge: {}", bridgeNew);
+ if (dpnId == null) {
+ LOG.warn("Got Null DPID for Bridge: {}", bridgeNew);
return futures;
}
- String datapathId = dpId.replaceAll("[^\\d.]", "");
- BigInteger ovsdbDpId = new BigInteger(datapathId, 16);
+ // create bridge reference entry in interface meta operational DS
+ InterfaceMetaUtils.createBridgeRefEntry(dpnId, bridgeIid, writeTransaction);
- LOG.info("adding dpId {} to bridge reference {}", datapathId, bridgeName);
- BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(ovsdbDpId);
- InstanceIdentifier<BridgeRefEntry> bridgeEntryId =
- InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
- BridgeRefEntryBuilder tunnelDpnBridgeEntryBuilder =
- new BridgeRefEntryBuilder().setKey(bridgeRefEntryKey).setDpid(ovsdbDpId)
- .setBridgeReference(new OvsdbBridgeRef(bridgeIid));
- t.put(LogicalDatastoreType.OPERATIONAL, bridgeEntryId, tunnelDpnBridgeEntryBuilder.build(), true);
+ // FIX for OVSDB Bug - manually copying the bridge info from topology operational DS to config DS
+ SouthboundUtils.addBridge(bridgeIid, bridgeNew, dataBroker, futures);
- BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(ovsdbDpId);
+ BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(dpnId);
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier =
InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
BridgeEntry bridgeEntry =
InterfaceMetaUtils.getBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier,
dataBroker);
if (bridgeEntry == null) {
- futures.add(t.submit());
+ futures.add(writeTransaction.submit());
return futures;
}
Interface iface = InterfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey, dataBroker);
if (iface.getAugmentation(IfTunnel.class) != null) {
SouthboundUtils.addPortToBridge(bridgeIid, iface, bridgeNew, bridgeName, portName, dataBroker, futures);
- InterfaceMetaUtils.createBridgeInterfaceEntryInConfigDS(bridgeEntryKey,
- new BridgeInterfaceEntryKey(portName), portName, t);
}
}
- futures.add(t.submit());
+ futures.add(writeTransaction.submit());
return futures;
}
}
\ No newline at end of file