Change-Id: If1f45a46aead6f2369873bdea1ece6ff287a0686
Signed-off-by: Faseela K <faseela.k@ericsson.com>
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.AllocateIdInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.AllocateIdInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.AllocateIdOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.AllocateIdInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.AllocateIdInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.idmanager.rev150403.AllocateIdOutput;
LOG.warn("Exception when releasing Id for key {}", idKey, e);
}
}
LOG.warn("Exception when releasing Id for key {}", idKey, e);
}
}
+
+ public static BigInteger getDpnId(DatapathId datapathId){
+ if (datapathId != null) {
+ String dpIdStr = datapathId.getValue().replace(":", "");
+ return new BigInteger(dpIdStr, 16);
+ }
+ return null;
+ }
/* Remove entry from if-index-interface-name map and deallocate Id from Idmanager. */
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState =
InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(portName, dataBroker);
/* Remove entry from if-index-interface-name map and deallocate Id from Idmanager. */
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState =
InterfaceManagerCommonUtils.getInterfaceStateFromOperDS(portName, dataBroker);
- InterfaceMetaUtils.removeLportTagInterfaceMap(transaction, idManager, dataBroker, interfaceState.getName(), interfaceState.getIfIndex());
+ if(interfaceState != null) {
+ InterfaceMetaUtils.removeLportTagInterfaceMap(transaction, idManager, dataBroker, interfaceState.getName(), interfaceState.getIfIndex());
+ }
transaction.delete(LogicalDatastoreType.OPERATIONAL, ifStateId);
transaction.delete(LogicalDatastoreType.OPERATIONAL, ifStateId);
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.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;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
- String dpId = bridgeNew.getDatapathId().getValue();
String bridgeName = bridgeNew.getBridgeName().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);
- String datapathId = dpId.replaceAll("[^\\d.]", "");
- BigInteger ovsdbDpId = new BigInteger(datapathId, 16);
-
- LOG.info("adding dpId {} to bridge reference {}", datapathId, bridgeName);
- BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(ovsdbDpId);
+ BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpnId);
InstanceIdentifier<BridgeRefEntry> bridgeEntryId =
InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
BridgeRefEntryBuilder tunnelDpnBridgeEntryBuilder =
InstanceIdentifier<BridgeRefEntry> bridgeEntryId =
InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
BridgeRefEntryBuilder tunnelDpnBridgeEntryBuilder =
- new BridgeRefEntryBuilder().setKey(bridgeRefEntryKey).setDpid(ovsdbDpId)
+ new BridgeRefEntryBuilder().setKey(bridgeRefEntryKey).setDpid(dpnId)
.setBridgeReference(new OvsdbBridgeRef(bridgeIid));
t.put(LogicalDatastoreType.OPERATIONAL, bridgeEntryId, tunnelDpnBridgeEntryBuilder.build(), true);
.setBridgeReference(new OvsdbBridgeRef(bridgeIid));
t.put(LogicalDatastoreType.OPERATIONAL, bridgeEntryId, tunnelDpnBridgeEntryBuilder.build(), true);
- BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(ovsdbDpId);
+ BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(dpnId);
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier =
InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
BridgeEntry bridgeEntry =
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier =
InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
BridgeEntry bridgeEntry =
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.vpnservice.interfacemgr.IfmUtil;
import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceMetaUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.meta.rev151007.bridge.ref.info.BridgeRefEntry;
import org.opendaylight.vpnservice.interfacemgr.commons.InterfaceMetaUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.interfacemgr.meta.rev151007.bridge.ref.info.BridgeRefEntry;
OvsdbBridgeAugmentation bridgeOld, DataBroker dataBroker) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
WriteTransaction t = dataBroker.newWriteOnlyTransaction();;
OvsdbBridgeAugmentation bridgeOld, DataBroker dataBroker) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
WriteTransaction t = dataBroker.newWriteOnlyTransaction();;
+ BigInteger dpnId = IfmUtil.getDpnId(bridgeOld.getDatapathId());
- String dpId = bridgeOld.getDatapathId().getValue().replaceAll("[^\\d.]", "");
- if (dpId == null) {
LOG.warn("Got Null DPID for Bridge: {}", bridgeOld);
return futures;
}
LOG.warn("Got Null DPID for Bridge: {}", bridgeOld);
return futures;
}
-
- dpId = dpId.replaceAll("[^\\d.]", "");
- BigInteger ovsdbDpId = new BigInteger(dpId,16);
- BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(ovsdbDpId);
+ BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpnId);
InstanceIdentifier<BridgeRefEntry> bridgeEntryId =
InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
t.delete(LogicalDatastoreType.OPERATIONAL, bridgeEntryId);
InstanceIdentifier<BridgeRefEntry> bridgeEntryId =
InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
t.delete(LogicalDatastoreType.OPERATIONAL, bridgeEntryId);