2 * Copyright (c) 2014, 2016 Cisco Systems, Inc. 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
8 package org.opendaylight.ovsdb.southbound.ovsdb.transact;
10 import java.util.Collection;
11 import java.util.function.Supplier;
12 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
13 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
14 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
18 * This transactional command aggregates all the Southbound commands.
20 public class TransactCommandAggregator implements TransactCommand {
21 // Type capture to allow using an array
22 private interface CommandSupplier extends Supplier<TransactCommand> {
26 private static final CommandSupplier[] COMMAND_SUPPLIERS = new CommandSupplier[] {
27 BridgeUpdateCommand::new,
28 OpenVSwitchBridgeAddCommand::new,
29 ControllerUpdateCommand::new,
30 ControllerRemovedCommand::new,
31 ProtocolUpdateCommand::new,
32 ProtocolRemovedCommand::new,
33 BridgeRemovedCommand::new,
34 TerminationPointCreateCommand::new,
35 TerminationPointDeleteCommand::new,
36 OvsdbNodeUpdateCommand::new,
37 AutoAttachUpdateCommand::new,
38 AutoAttachRemovedCommand::new,
39 QosUpdateCommand::new,
40 QosRemovedCommand::new,
41 QueueUpdateCommand::new,
42 QueueRemovedCommand::new,
43 TerminationPointUpdateCommand::new
47 public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
48 final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
49 for (CommandSupplier supplier : COMMAND_SUPPLIERS) {
50 supplier.get().execute(transaction, state, events, instanceIdentifierCodec);
55 public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
56 final Collection<DataTreeModification<Node>> modifications,
57 final InstanceIdentifierCodec instanceIdentifierCodec) {
58 for (CommandSupplier supplier : COMMAND_SUPPLIERS) {
59 supplier.get().execute(transaction, state, modifications, instanceIdentifierCodec);