fe008df20c1e03b0e847eeaf77e541e14a065ee2
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / reconciliation / configuration / DataTreeModificationImpl.java
1 /*
2  * Copyright © 2016, 2017 Ericsson India Global Services Pvt Ltd. 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 package org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.configuration;
9
10 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
11 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
12 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
13 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16
17 public class DataTreeModificationImpl<T extends DataObject> implements DataTreeModification {
18
19     InstanceIdentifier<T> nodeId;
20     T newNode;
21     T oldNode;
22
23     public DataTreeModificationImpl(InstanceIdentifier<T> nodeId, T newNode, T oldNode) {
24         this.nodeId = nodeId;
25         this.newNode = newNode;
26         this.oldNode = oldNode;
27     }
28
29     @Override
30     public DataTreeIdentifier<T> getRootPath() {
31         return new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, nodeId);
32     }
33
34     @Override
35     public DataObjectModification<T> getRootNode() {
36         return new DataObjectModificationImpl<>(nodeId, newNode, oldNode);
37     }
38 }