b9b6b012196e5dde482ba6960e74c13e0fd1dd3d
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / transact / TransactCommandAggregator.java
1 /*
2  * Copyright (c) 2015 China Telecom Beijing Research Institute 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.hwvtepsouthbound.transact;
10
11 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
12 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
13 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
14 import org.opendaylight.yangtools.yang.binding.Identifiable;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16
17 import java.util.ArrayList;
18 import java.util.Collection;
19 import java.util.List;
20
21 public class TransactCommandAggregator implements TransactCommand {
22
23     private List<TransactCommand> commands = new ArrayList<TransactCommand>();
24
25     public TransactCommandAggregator(HwvtepOperationalState state, Collection<DataTreeModification<Node>> changes) {
26         commands.add(new PhysicalSwitchUpdateCommand(state,changes));
27         commands.add(new PhysicalSwitchRemoveCommand(state,changes));
28         commands.add(new LogicalSwitchUpdateCommand(state,changes));
29         commands.add(new LogicalSwitchRemoveCommand(state,changes));
30         commands.add(new PhysicalPortUpdateCommand(state,changes));
31         commands.add(new PhysicalPortRemoveCommand(state,changes));
32         commands.add(new McastMacsRemoteUpdateCommand(state,changes));
33         commands.add(new McastMacsRemoteRemoveCommand(state,changes));
34         commands.add(new McastMacsLocalUpdateCommand(state,changes));
35         commands.add(new McastMacsLocalRemoveCommand(state,changes));
36         commands.add(new UcastMacsRemoteUpdateCommand(state,changes));
37         commands.add(new UcastMacsRemoteRemoveCommand(state,changes));
38         commands.add(new UcastMacsLocalUpdateCommand(state,changes));
39         commands.add(new UcastMacsLocalRemoveCommand(state,changes));
40         commands.add(new TunnelUpdateCommand(state,changes));
41         commands.add(new TunnelRemoveCommand(state,changes));
42     }
43
44     @Override
45     public void execute(TransactionBuilder transaction) {
46         for (TransactCommand command:commands) {
47             command.execute(transaction);
48         }
49     }
50
51     @Override
52     public void onConfigUpdate(TransactionBuilder transaction, InstanceIdentifier nodeIid, Identifiable data,
53                                InstanceIdentifier key,
54                                Object... extraData) {
55     }
56
57     @Override
58     public void doDeviceTransaction(TransactionBuilder transaction, InstanceIdentifier nodeIid, Identifiable data,
59                                     InstanceIdentifier key,
60                                     Object... extraData) {
61     }
62 }