Bug 7999 Adding Logical_Router table support
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / transact / HwvtepOperationalState.java
1 /*
2  * Copyright (c) 2015, 2017 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 com.google.common.base.Optional;
12 import com.google.common.base.Preconditions;
13 import org.apache.commons.lang3.tuple.Pair;
14 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
15 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
16 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
17 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
18 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
19 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
20 import org.opendaylight.ovsdb.lib.notation.UUID;
21 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.EncapsulationTypeBase;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Acls;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.AclsKey;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacsKey;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacsKey;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRouters;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRoutersKey;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsKey;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacsKey;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Switches;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey;
45 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
46 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
47 import org.opendaylight.yangtools.yang.binding.Identifiable;
48 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
49 import org.slf4j.Logger;
50 import org.slf4j.LoggerFactory;
51
52 import java.util.Collection;
53 import java.util.Collections;
54 import java.util.HashMap;
55 import java.util.List;
56 import java.util.Map;
57 import java.util.Map.Entry;
58 import java.util.Set;
59 import java.util.concurrent.ConcurrentHashMap;
60
61 //TODO: need to be optimized, get entry by iid not name
62 public class HwvtepOperationalState {
63
64     private static final Logger LOG = LoggerFactory.getLogger(HwvtepOperationalState.class);
65
66     private Map<InstanceIdentifier<Node>, Node> operationalNodes = new HashMap<>();
67     private ReadWriteTransaction transaction;
68     HashMap<InstanceIdentifier<TerminationPoint>, UUID> inflightLocators = new HashMap<>();
69     private HwvtepDeviceInfo deviceInfo;
70     private HwvtepConnectionInstance connectionInstance;
71     private Map<Class<? extends Identifiable>, Map<InstanceIdentifier, UUID>> currentTxUUIDs = new ConcurrentHashMap<>();
72     private Map<Class<? extends Identifiable>, Map<InstanceIdentifier, Boolean>> currentTxDeletedKeys = new ConcurrentHashMap<>();
73
74     /* stores the modified and deleted data for each child type of each node id
75        Map<nodeid , Pair < updated, deleted >
76        each updated/ deleted contains Map < child type, List<ChildData>>
77        child type is the child of hwvtep Global augmentation
78      */
79     private Map<InstanceIdentifier<Node>,
80             Pair<Map<Class<? extends Identifiable>, List<Identifiable>>,
81                     Map<Class<? extends Identifiable>, List<Identifiable>>>> modifiedData = new HashMap<>();
82     private boolean inReconciliation = false;
83     private final DataBroker db;
84     private final Collection<DataTreeModification<Node>> changes;
85
86     public HwvtepOperationalState(DataBroker db, HwvtepConnectionInstance connectionInstance,
87                                   Collection<DataTreeModification<Node>> changes) {
88         this.connectionInstance = connectionInstance;
89         this.deviceInfo = connectionInstance.getDeviceInfo();
90         this.db = db;
91         this.changes = changes;
92         this.transaction = db.newReadWriteTransaction();
93     }
94
95     public HwvtepOperationalState(HwvtepConnectionInstance connectionInstance) {
96         this.connectionInstance = connectionInstance;
97         this.deviceInfo = connectionInstance.getDeviceInfo();
98         this.db = connectionInstance.getDataBroker();
99         this.changes = null;
100         transaction = connectionInstance.getDataBroker().newReadWriteTransaction();
101         Optional<Node> readNode = HwvtepSouthboundUtil.readNode(transaction,
102                 connectionInstance.getInstanceIdentifier());
103         if (readNode.isPresent()) {
104             operationalNodes.put(connectionInstance.getInstanceIdentifier(), readNode.get());
105         }
106     }
107
108     public void readOperationalNodes() {
109         if (inReconciliation) {
110             return;
111         }
112         if (changes == null) {
113             LOG.warn("Could not read operational nodes for {} as changes is",
114                     connectionInstance.getNodeId().getValue());
115             return;
116         }
117         Map<InstanceIdentifier<Node>, Node> nodeCreateOrUpdate =
118                 TransactUtils.extractCreatedOrUpdatedOrRemoved(changes, Node.class);
119         if (nodeCreateOrUpdate != null) {
120             transaction = db.newReadWriteTransaction();
121             for (Entry<InstanceIdentifier<Node>, Node> entry: nodeCreateOrUpdate.entrySet()) {
122                 Optional<Node> readNode = HwvtepSouthboundUtil.readNode(transaction, entry.getKey());
123                 //add related globalNode or physicalSwitchNode to operationalNodes map
124                 //for example, when creating physical port, logical switch is needed
125                 //but logical switch is in HwvtepGlobalAugmentation rather than PhysicalSwitchAugmentation
126                 if (readNode.isPresent()) {
127                     operationalNodes.put(entry.getKey(), readNode.get());
128                     HwvtepGlobalAugmentation hgAugmentation = readNode.get().getAugmentation(HwvtepGlobalAugmentation.class);
129                     PhysicalSwitchAugmentation psAugmentation = readNode.get().getAugmentation(PhysicalSwitchAugmentation.class);
130                     if (hgAugmentation != null && hgAugmentation.getSwitches() != null) {
131                         for (Switches pswitch : hgAugmentation.getSwitches()) {
132                             @SuppressWarnings("unchecked")
133                             InstanceIdentifier<Node> psNodeIid = (InstanceIdentifier<Node>) pswitch.getSwitchRef().getValue();
134                             Optional<Node> psNode = HwvtepSouthboundUtil.readNode(transaction, psNodeIid);
135                             if (psNode.isPresent()) {
136                                 operationalNodes.put(psNodeIid, psNode.get());
137                             }
138                         }
139                     }
140                     if (psAugmentation != null) {
141                         @SuppressWarnings("unchecked")
142                         InstanceIdentifier<Node> hgNodeIid = (InstanceIdentifier<Node>) psAugmentation.getManagedBy().getValue();
143                         Optional<Node> hgNode = HwvtepSouthboundUtil.readNode(transaction, hgNodeIid);
144                         if (hgNode.isPresent()) {
145                             operationalNodes.put(hgNodeIid, hgNode.get());
146                         }
147                     }
148                 }
149             }
150         }
151     }
152
153     public Optional<Node> getGlobalNode(InstanceIdentifier<?> iid) {
154         InstanceIdentifier<Node> nodeIid = iid.firstIdentifierOf(Node.class);
155         return Optional.fromNullable(operationalNodes.get(nodeIid));
156     }
157
158     public Optional<HwvtepGlobalAugmentation> getHwvtepGlobalAugmentation(InstanceIdentifier<?> iid) {
159         Preconditions.checkNotNull(iid);
160         Optional<Node> nodeOptional = getGlobalNode(iid);
161         if (nodeOptional.isPresent()) {
162             return Optional.fromNullable(nodeOptional.get().getAugmentation(HwvtepGlobalAugmentation.class));
163         }
164         return Optional.absent();
165     }
166
167     public Optional<PhysicalSwitchAugmentation> getPhysicalSwitchAugmentation(InstanceIdentifier<?> iid) {
168         Preconditions.checkNotNull(iid);
169         Optional<Node> nodeOptional = getGlobalNode(iid);
170         if (nodeOptional.isPresent()) {
171             return Optional.fromNullable(nodeOptional.get().getAugmentation(PhysicalSwitchAugmentation.class));
172         }
173         return Optional.absent();
174     }
175
176     public Optional<List<TerminationPoint>> getTerminationPointList(InstanceIdentifier<?> iid) {
177         Preconditions.checkNotNull(iid);
178         Optional<Node> nodeOptional = getGlobalNode(iid);
179         if (nodeOptional.isPresent() && nodeOptional.get().getTerminationPoint() != null) {
180             return Optional.fromNullable(nodeOptional.get().getTerminationPoint());
181         }
182         return Optional.absent();
183     }
184
185     public Optional<LogicalSwitches> getLogicalSwitches(InstanceIdentifier<?> iid, LogicalSwitchesKey logicalSwitchesKey) {
186         Preconditions.checkNotNull(iid);
187         Optional<HwvtepGlobalAugmentation> nodeOptional = getHwvtepGlobalAugmentation(iid);
188         if (nodeOptional.isPresent()) {
189             HwvtepGlobalAugmentation hgAugmentation = nodeOptional.get();
190             List<LogicalSwitches> lswitchList = null;
191             if (hgAugmentation != null) {
192                 lswitchList = hgAugmentation.getLogicalSwitches();
193             }
194             if (lswitchList != null) {
195                 for (LogicalSwitches lswitch: lswitchList) {
196                     if (lswitch.getKey().equals(logicalSwitchesKey)) {
197                         return Optional.fromNullable(lswitch);
198                     }
199                 }
200             }
201         }
202         return Optional.absent();
203     }
204
205     public Optional<Tunnels> getTunnels(InstanceIdentifier<?> iid, TunnelsKey tunnelsKey) {
206         Preconditions.checkNotNull(iid);
207         Optional<PhysicalSwitchAugmentation> psOptional = getPhysicalSwitchAugmentation(iid);
208         if (psOptional.isPresent()) {
209             PhysicalSwitchAugmentation psAugmentation = psOptional.get();
210             List<Tunnels> tunnelList = null;
211             if (psAugmentation != null) {
212                 tunnelList = psAugmentation.getTunnels();
213             }
214             if (tunnelList != null) {
215                 for (Tunnels tunnel: tunnelList) {
216                     if (tunnel.getKey().equals(tunnelsKey)) {
217                         return Optional.fromNullable(tunnel);
218                     }
219                 }
220             }
221         }
222         return Optional.absent();
223     }
224
225     public Optional<HwvtepPhysicalPortAugmentation> getPhysicalPortAugmentation(InstanceIdentifier<?> iid,
226             HwvtepNodeName hwvtepNodeName) {
227         Preconditions.checkNotNull(iid);
228         Optional<List<TerminationPoint>> nodeOptional = getTerminationPointList(iid);
229         if (nodeOptional.isPresent()) {
230             List<TerminationPoint> tpList = nodeOptional.get();
231             for (TerminationPoint tp : tpList) {
232                 HwvtepPhysicalPortAugmentation hppAugmentation = tp.getAugmentation(HwvtepPhysicalPortAugmentation.class);
233                 if (hppAugmentation != null && hppAugmentation.getHwvtepNodeName().equals(hwvtepNodeName)) {
234                     return Optional.fromNullable(hppAugmentation);
235                 }
236             }
237         }
238         return Optional.absent();
239     }
240
241     public Optional<HwvtepPhysicalLocatorAugmentation> getPhysicalLocatorAugmentation(InstanceIdentifier<?> iid,
242             IpAddress dstIp, Class<? extends EncapsulationTypeBase> encapType) {
243         Preconditions.checkNotNull(iid);
244         Optional<List<TerminationPoint>> nodeOptional = getTerminationPointList(iid);
245         if (nodeOptional.isPresent()) {
246             List<TerminationPoint> tpList = nodeOptional.get();
247             for (TerminationPoint tp : tpList) {
248                 HwvtepPhysicalLocatorAugmentation hppAugmentation = tp.getAugmentation(HwvtepPhysicalLocatorAugmentation.class);
249                 if (hppAugmentation != null && hppAugmentation.getDstIp().equals(dstIp)
250                         && hppAugmentation.getEncapsulationType().equals(encapType)) {
251                     return Optional.fromNullable(hppAugmentation);
252                 }
253             }
254         }
255         return Optional.absent();
256     }
257
258     public Optional<LocalMcastMacs> getLocalMcastMacs(InstanceIdentifier<?> iid, LocalMcastMacsKey key) {
259         Preconditions.checkNotNull(iid);
260         Optional<HwvtepGlobalAugmentation> nodeOptional = getHwvtepGlobalAugmentation(iid);
261         if (nodeOptional.isPresent()) {
262             HwvtepGlobalAugmentation hgAugmentation = nodeOptional.get();
263             List<LocalMcastMacs> macList = null;
264             if (hgAugmentation != null) {
265                 macList = hgAugmentation.getLocalMcastMacs();
266             }
267             if (macList != null) {
268                 for (LocalMcastMacs mac: macList) {
269                     if (mac.getKey().equals(key)) {
270                         return Optional.fromNullable(mac);
271                     }
272                 }
273             }
274         }
275         return Optional.absent();
276     }
277
278     public Optional<RemoteMcastMacs> getRemoteMcastMacs(InstanceIdentifier<?> iid, RemoteMcastMacsKey key) {
279         Preconditions.checkNotNull(iid);
280         Optional<HwvtepGlobalAugmentation> nodeOptional = getHwvtepGlobalAugmentation(iid);
281         if (nodeOptional.isPresent()) {
282             HwvtepGlobalAugmentation hgAugmentation = nodeOptional.get();
283             List<RemoteMcastMacs> macList = null;
284             if (hgAugmentation != null) {
285                 macList = hgAugmentation.getRemoteMcastMacs();
286             }
287             if (macList != null) {
288                 for (RemoteMcastMacs mac: macList) {
289                     if (mac.getKey().equals(key)) {
290                         return Optional.fromNullable(mac);
291                     }
292                 }
293             }
294         }
295         return Optional.absent();
296     }
297
298     public Optional<LocalUcastMacs> getLocalUcastMacs(InstanceIdentifier<?> iid, LocalUcastMacsKey key) {
299         Preconditions.checkNotNull(iid);
300         Optional<HwvtepGlobalAugmentation> nodeOptional = getHwvtepGlobalAugmentation(iid);
301         if (nodeOptional.isPresent()) {
302             HwvtepGlobalAugmentation hgAugmentation = nodeOptional.get();
303             List<LocalUcastMacs> macList = null;
304             if (hgAugmentation != null) {
305                 macList = hgAugmentation.getLocalUcastMacs();
306             }
307             if (macList != null) {
308                 for (LocalUcastMacs mac: macList) {
309                     if (mac.getKey().equals(key)) {
310                         return Optional.fromNullable(mac);
311                     }
312                 }
313             }
314         }
315         return Optional.absent();
316     }
317
318     public Optional<RemoteUcastMacs> getRemoteUcastMacs(InstanceIdentifier<?> iid, RemoteUcastMacsKey key) {
319         Preconditions.checkNotNull(iid);
320         Optional<HwvtepGlobalAugmentation> nodeOptional = getHwvtepGlobalAugmentation(iid);
321         if (nodeOptional.isPresent()) {
322             HwvtepGlobalAugmentation hgAugmentation = nodeOptional.get();
323             List<RemoteUcastMacs> macList = null;
324             if (hgAugmentation != null) {
325                 macList = hgAugmentation.getRemoteUcastMacs();
326             }
327             if (macList != null) {
328                 for (RemoteUcastMacs mac: macList) {
329                     if (mac.getKey().equals(key)) {
330                         return Optional.fromNullable(mac);
331                     }
332                 }
333             }
334         }
335         return Optional.absent();
336     }
337
338     public Optional<LogicalRouters> getLogicalRouters(final InstanceIdentifier<?> iid,
339             final LogicalRoutersKey logicalRoutersKey) {
340         Preconditions.checkNotNull(iid);
341         Optional<HwvtepGlobalAugmentation> nodeOptional = getHwvtepGlobalAugmentation(iid);
342         if (nodeOptional.isPresent()) {
343             HwvtepGlobalAugmentation hgAugmentation = nodeOptional.get();
344             if (hgAugmentation != null && hgAugmentation.getLogicalRouters() != null) {
345                 for (LogicalRouters lrouter: hgAugmentation.getLogicalRouters()) {
346                     if (lrouter.getKey().equals(logicalRoutersKey)) {
347                         return Optional.fromNullable(lrouter);
348                     }
349                 }
350             }
351         }
352         return Optional.absent();
353     }
354
355     public Optional<HwvtepPhysicalLocatorAugmentation> getPhysicalLocatorAugmentation(InstanceIdentifier<TerminationPoint> iid) {
356         Optional<TerminationPoint> tp = HwvtepSouthboundUtil.readNode(transaction, iid);
357         if (tp.isPresent()) {
358             return Optional.fromNullable(tp.get().getAugmentation(HwvtepPhysicalLocatorAugmentation.class));
359         }
360         return Optional.absent();
361     }
362
363     public Optional<LogicalSwitches> getLogicalSwitches(InstanceIdentifier<LogicalSwitches> iid) {
364         Optional<LogicalSwitches> lswitch = HwvtepSouthboundUtil.readNode(transaction, iid);
365         return lswitch;
366     }
367
368     public Optional<Tunnels> getTunnels(InstanceIdentifier<Tunnels> iid) {
369         Optional<Tunnels> tunnels = HwvtepSouthboundUtil.readNode(transaction, iid);
370         return tunnels;
371     }
372
373     public Optional<Acls> getAcls(InstanceIdentifier<Acls> iid) {
374         Optional<Acls> acl = HwvtepSouthboundUtil.readNode(transaction, iid);
375         return acl;
376     }
377
378     public ReadWriteTransaction getReadWriteTransaction() {
379         return transaction;
380     }
381
382     public void setPhysicalLocatorInFlight(InstanceIdentifier<TerminationPoint> iid,
383                                            UUID uuid) {
384         inflightLocators.put(iid, uuid);
385     }
386
387     public UUID getPhysicalLocatorInFlight(InstanceIdentifier<TerminationPoint> iid) {
388         return inflightLocators.get(iid);
389     }
390
391     public HwvtepConnectionInstance getConnectionInstance() {
392         return connectionInstance;
393     }
394
395     public HwvtepDeviceInfo getDeviceInfo() {
396         return deviceInfo;
397     }
398
399     public void updateCurrentTxData(Class<? extends Identifiable> cls, InstanceIdentifier key, UUID uuid) {
400         HwvtepSouthboundUtil.updateData(currentTxUUIDs, cls, key, uuid);
401     }
402
403     public void updateCurrentTxDeleteData(Class<? extends Identifiable> cls, InstanceIdentifier key) {
404         HwvtepSouthboundUtil.updateData(currentTxDeletedKeys, cls, key, Boolean.TRUE);
405     }
406
407     public UUID getUUIDFromCurrentTx(Class<? extends Identifiable> cls, InstanceIdentifier key) {
408         return HwvtepSouthboundUtil.getData(currentTxUUIDs, cls, key);
409     }
410
411     public boolean isKeyPartOfCurrentTx(Class<? extends Identifiable> cls, InstanceIdentifier key) {
412         return HwvtepSouthboundUtil.containsKey(currentTxUUIDs, cls, key);
413     }
414
415     public Set<InstanceIdentifier> getDeletedKeysInCurrentTx(Class<? extends Identifiable> cls) {
416         if (currentTxDeletedKeys.containsKey(cls)) {
417             return currentTxDeletedKeys.get(cls).keySet();
418         }
419         return Collections.EMPTY_SET;
420     }
421
422     public List<? extends Identifiable> getUpdatedData(final InstanceIdentifier<Node> key,
423                                                        final Class<? extends Identifiable> cls) {
424         List<Identifiable> result = null;
425         if (modifiedData.get(key) != null && modifiedData.get(key).getLeft() != null) {
426             result = modifiedData.get(key).getLeft().get(cls);
427         }
428         if (result == null) {
429             result = Collections.EMPTY_LIST;
430         }
431         return result;
432     }
433
434     public List<? extends Identifiable> getDeletedData(final InstanceIdentifier<Node> key,
435                                                        final Class<? extends Identifiable> cls) {
436         List<Identifiable> result = null;
437         if (modifiedData.get(key) != null && modifiedData.get(key).getRight() != null) {
438             result = modifiedData.get(key).getRight().get(cls);
439         }
440         if (result == null) {
441             result = Collections.EMPTY_LIST;
442         }
443         return result;
444     }
445
446     public void setModifiedData(final Map<InstanceIdentifier<Node>,
447             Pair<Map<Class<? extends Identifiable>, List<Identifiable>>,
448                     Map<Class<? extends Identifiable>, List<Identifiable>>>> modifiedData) {
449         this.modifiedData = modifiedData;
450     }
451
452     public boolean isInReconciliation() {
453         return inReconciliation;
454     }
455
456     public void setInReconciliation(boolean inReconciliation) {
457         this.inReconciliation = inReconciliation;
458     }
459 }