2 * Copyright (c) 2015 - 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
11 import java.util.Collection;
12 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
13 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
14 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundMapper;
15 import org.opendaylight.ovsdb.lib.message.TableUpdates;
16 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
17 import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
18 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
19 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
20 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
21 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
23 public class HwvtepPhysicalLocatorRemoveCommand extends AbstractTransactionCommand {
25 public HwvtepPhysicalLocatorRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates,
26 DatabaseSchema dbSchema) {
27 super(key, updates, dbSchema);
31 public void execute(ReadWriteTransaction transaction) {
32 Collection<PhysicalLocator> deletedPLRows =
33 TyperUtils.extractRowsRemoved(PhysicalLocator.class, getUpdates(), getDbSchema()).values();
34 for (PhysicalLocator locator : deletedPLRows) {
35 final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
36 final InstanceIdentifier<TerminationPoint> nodePath = HwvtepSouthboundMapper
37 .createInstanceIdentifier(connectionIId, locator);
38 addToDeleteTx(transaction, TerminationPoint.class, nodePath, locator.getUuid());
39 //TODO: Check if any cleanup is required