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;
12 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
13 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
14 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * This transactional command aggregates all the Southbound commands.
24 public class TransactCommandAggregator implements TransactCommand {
25 private static final Logger LOG = LoggerFactory.getLogger(TransactCommandAggregator.class);
27 private static final Class<? extends TransactCommand>[] COMMAND_CLASSES =
29 BridgeUpdateCommand.class,
30 OpenVSwitchBridgeAddCommand.class,
31 ControllerUpdateCommand.class,
32 ControllerRemovedCommand.class,
33 ProtocolUpdateCommand.class,
34 ProtocolRemovedCommand.class,
35 BridgeRemovedCommand.class,
36 TerminationPointCreateCommand.class,
37 TerminationPointDeleteCommand.class,
38 OvsdbNodeUpdateCommand.class,
39 AutoAttachUpdateCommand.class,
40 AutoAttachRemovedCommand.class,
41 QosUpdateCommand.class,
42 QosRemovedCommand.class,
43 QueueUpdateCommand.class,
44 QueueRemovedCommand.class,
45 TerminationPointUpdateCommand.class,
49 public void execute(TransactionBuilder transaction, BridgeOperationalState state,
50 AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> events) {
51 for (Class<? extends TransactCommand> commandClass : COMMAND_CLASSES) {
53 commandClass.newInstance().execute(transaction, state, events);
54 } catch (InstantiationException | IllegalAccessException e) {
55 LOG.error("Error instantiating {}", commandClass, e);
61 public void execute(TransactionBuilder transaction, BridgeOperationalState state,
62 Collection<DataTreeModification<Node>> modifications) {
63 for (Class<? extends TransactCommand> commandClass : COMMAND_CLASSES) {
65 commandClass.newInstance().execute(transaction, state, modifications);
66 } catch (InstantiationException | IllegalAccessException e) {
67 LOG.error("Error instantiating {}", commandClass, e);