Merge "Patch to bring us into alignment with skip.karaf.featureTest from odlparent"
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / transactions / md / OvsdbPortRemoveCommand.java
1 /*
2 * Copyright (c) 2015 Intel Corp. and others.  All rights reserved.
3 *
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
7 */
8
9 package org.opendaylight.ovsdb.southbound.transactions.md;
10
11 import java.util.Collection;
12
13 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
14 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
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.openvswitch.Port;
19 import org.opendaylight.ovsdb.southbound.OvsdbClientKey;
20 import org.opendaylight.ovsdb.southbound.SouthboundMapper;
21 //import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
22 //import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntry;
23 //import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntryKey;
24 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
25 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29 public class OvsdbPortRemoveCommand extends AbstractTransactionCommand {
30     private static final Logger LOG = LoggerFactory.getLogger(OvsdbPortRemoveCommand.class);
31
32     public OvsdbPortRemoveCommand(OvsdbClientKey key, TableUpdates updates,
33             DatabaseSchema dbSchema) {
34         super(key,updates,dbSchema);
35     }
36
37     @Override
38     public void execute(ReadWriteTransaction transaction) {
39         Collection<Port> removedRows = TyperUtils.extractRowsRemoved(Port.class, getUpdates(), getDbSchema()).values();
40         for(Port port : removedRows) {
41             //InstanceIdentifier<Node> portIid = SouthboundMapper.createInstanceIdentifier(getKey(), port.getUuid());
42     //       InstanceIdentifier<ManagedNodeEntry> mnIid = SouthboundMapper.createInstanceIndentifier(getKey())
43     //                .augmentation(OvsdbTerminationPointAugmentation.class)
44     //                .child(ManagedNodeEntry.class, new ManagedNodeEntryKey(new OvsdbBridgeRef(bridgeIid)));
45             // TODO handle removal of reference to managed node from model
46            // transaction.delete(LogicalDatastoreType.OPERATIONAL, portIid);
47      //       transaction.delete(LogicalDatastoreType.OPERATIONAL, mnIid);
48         }
49     }
50
51 }