Create UcastMacs by Listening DS Changes
[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 java.util.ArrayList;
12 import java.util.Collection;
13 import java.util.List;
14
15 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
16 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
17 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
18
19 public class TransactCommandAggregator implements TransactCommand {
20
21     private List<TransactCommand> commands = new ArrayList<TransactCommand>();
22
23     public TransactCommandAggregator(HwvtepOperationalState state, Collection<DataTreeModification<Node>> changes) {
24         commands.add(new PhysicalSwitchUpdateCommand(state,changes));
25         commands.add(new PhysicalSwitchRemoveCommand(state,changes));
26         commands.add(new LogicalSwitchUpdateCommand(state,changes));
27         commands.add(new LogicalSwitchRemoveCommand(state,changes));
28         commands.add(new PhysicalPortUpdateCommand(state,changes));
29         commands.add(new PhysicalPortRemoveCommand(state,changes));
30         commands.add(new McastMacsRemoteUpdateCommand(state,changes));
31         commands.add(new McastMacsRemoteRemoveCommand(state,changes));
32         commands.add(new McastMacsLocalUpdateCommand(state,changes));
33         commands.add(new McastMacsLocalRemoveCommand(state,changes));
34         commands.add(new UcastMacsRemoteUpdateCommand(state,changes));
35         commands.add(new UcastMacsRemoteRemoveCommand(state,changes));
36         commands.add(new UcastMacsLocalUpdateCommand(state,changes));
37         commands.add(new UcastMacsLocalRemoveCommand(state,changes));
38         commands.add(new TunnelUpdateCommand(state,changes));
39         commands.add(new TunnelRemoveCommand(state,changes));
40     }
41
42     @Override
43     public void execute(TransactionBuilder transaction) {
44         for (TransactCommand command:commands) {
45             command.execute(transaction);
46         }
47     }
48 }