2 * Copyright (c) 2014 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.ArrayList;
11 import java.util.List;
13 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
14 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
18 public class TransactCommandAggregator implements TransactCommand {
20 private List<TransactCommand> commands = new ArrayList<>();
21 private AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changes;
22 private BridgeOperationalState operationalState;
24 public TransactCommandAggregator(BridgeOperationalState state,AsyncDataChangeEvent<InstanceIdentifier<?>,
25 DataObject> changes) {
26 this.operationalState = state;
27 this.changes = changes;
28 commands.add(new BridgeUpdateCommand(state,changes));
29 commands.add(new OpenVSwitchBridgeAddCommand());
30 commands.add(new ControllerUpdateCommand(state,changes));
31 commands.add(new ControllerRemovedCommand(state,changes));
32 commands.add(new ProtocolUpdateCommand(state,changes));
33 commands.add(new ProtocolRemovedCommand(state,changes));
34 commands.add(new BridgeRemovedCommand(state,changes));
35 commands.add(new TerminationPointCreateCommand(state,changes));
36 commands.add(new TerminationPointDeleteCommand(state, changes));
37 commands.add(new OvsdbNodeUpdateCommand(changes));
38 commands.add(new TerminationPointUpdateCommand(state, changes));
42 public void execute(TransactionBuilder transaction) {
43 for (TransactCommand command:commands) {
44 command.execute(transaction);