* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.ovsdb.southbound.ovsdb.transact;
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-
-import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
+import org.opendaylight.mdsal.binding.api.DataTreeModification;
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.openvswitch.Queue;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.Queues;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(QueueRemovedCommand.class);
@Override
- public void execute(TransactionBuilder transaction, BridgeOperationalState state,
- AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> events) {
+ public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+ final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
execute(transaction, state, TransactUtils.extractOriginal(events, OvsdbNodeAugmentation.class),
TransactUtils.extractUpdated(events, OvsdbNodeAugmentation.class));
}
@Override
- public void execute(TransactionBuilder transaction, BridgeOperationalState state,
- Collection<DataTreeModification<Node>> modifications) {
+ public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+ final Collection<DataTreeModification<Node>> modifications,
+ final InstanceIdentifierCodec instanceIdentifierCodec) {
execute(transaction, state, TransactUtils.extractOriginal(modifications, OvsdbNodeAugmentation.class),
TransactUtils.extractUpdated(modifications, OvsdbNodeAugmentation.class));
}
- private void execute(TransactionBuilder transaction, BridgeOperationalState state,
- Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originals,
- Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated) {
+ private void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+ final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originals,
+ final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated) {
for (Map.Entry<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originalEntry : originals
.entrySet()) {
InstanceIdentifier<OvsdbNodeAugmentation> ovsdbNodeIid = originalEntry.getKey();
if (origQueues != null && !origQueues.isEmpty()) {
for (Queues origQueue : origQueues) {
OvsdbNodeAugmentation operNode =
- state.getBridgeNode(ovsdbNodeIid).get().getAugmentation(
+ state.getBridgeNode(ovsdbNodeIid).get().augmentation(
OvsdbNodeAugmentation.class);
List<Queues> operQueues = operNode.getQueues();
LOG.debug("Received request to delete Queue entry {}", origQueue.getQueueId());
Uuid queueUuid = getQueueUuid(operQueues, origQueue.getQueueId());
if (queueUuid != null) {
- Queue queue =
- TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Queue.class,
- null);
+ Queue queue = transaction.getTypedRowSchema(Queue.class);
transaction.add(op.delete(queue.getSchema())
.where(queue.getUuidColumn().getSchema().opEqual(
new UUID(queueUuid.getValue())))
.build());
+ LOG.info("Deleted queue Uuid : {} for the Ovsdb Node : {}", queueUuid, operNode);
} else {
LOG.warn("Unable to delete Queue{} for node {} because it was not found in the "
+ "operational store, and thus we cannot retrieve its UUID",
}
}
- private Uuid getQueueUuid(List<Queues> operQueues, Uri queueId) {
+ private Uuid getQueueUuid(final List<Queues> operQueues, final Uri queueId) {
if (operQueues != null && !operQueues.isEmpty()) {
for (Queues queueEntry : operQueues) {
if (queueEntry.getQueueId().equals(queueId)) {