X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=hwvtepsouthbound%2Fhwvtepsouthbound-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fovsdb%2Fhwvtepsouthbound%2Ftransact%2FMcastMacsRemoteRemoveCommand.java;h=65dc3ee5fc00538e1d41cf780c0f5d4a0e21b45e;hb=2fa79e365aeb7d18f7aa021e196f1599b7258cc8;hp=2c0e8d55de7f23a589ba3a1e0bbc5426be20796b;hpb=7fa749f5040b3bbc16bdd20ec002338c6f920466;p=ovsdb.git diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java index 2c0e8d55d..65dc3ee5f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 China Telecom Beijing Research Institute and others. All rights reserved. + * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -20,6 +20,7 @@ import java.util.Map.Entry; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants; +import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils; import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsRemote; @@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory; import com.google.common.base.Optional; public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand { - private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class); + private static final Logger LOG = LoggerFactory.getLogger(McastMacsRemoteRemoveCommand.class); public McastMacsRemoteRemoveCommand(HwvtepOperationalState state, Collection> changes) { @@ -60,18 +61,13 @@ public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand { getOperationalState().getRemoteMcastMacs(instanceIdentifier, mac.getKey()); McastMacsRemote mcastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), McastMacsRemote.class, null); - if (operationalMacOptional.isPresent()) { + if (operationalMacOptional.isPresent() && operationalMacOptional.get().getMacEntryUuid() != null) { //when mac entry is deleted, its referenced locator set and locators are deleted automatically. //TODO: locator in config DS is not deleted - String macString = null; - if (mac.getMacEntryKey().equals(HwvtepSouthboundConstants.UNKNOWN_DST_MAC)) { - macString = HwvtepSouthboundConstants.UNKNOWN_DST_STRING; - } else { - macString = mac.getMacEntryKey().getValue(); - } - transaction.add(op.delete(mcastMacsRemote.getSchema()) - .where(mcastMacsRemote.getMacColumn().getSchema().opEqual(macString)).build()); - transaction.add(op.comment("Remote McastMacRemote: Deleting " + mac.getMacEntryKey().getValue())); + UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue()); + transaction.add(op.delete(mcastMacsRemote.getSchema()). + where(mcastMacsRemote.getUuidColumn().getSchema().opEqual(macEntryUUID)).build()); + transaction.add(op.comment("McastMacRemote: Deleting " + mac.getMacEntryKey().getValue())); } else { LOG.warn("Unable to delete remoteMcastMacs {} because it was not found in the operational store", mac.getMacEntryKey().getValue());