2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.netvirt.elan.l2gw.ha.handlers;
10 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
11 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
12 import org.opendaylight.netvirt.elan.l2gw.ha.merge.GlobalAugmentationMerger;
13 import org.opendaylight.netvirt.elan.l2gw.ha.merge.GlobalNodeMerger;
14 import org.opendaylight.netvirt.elan.l2gw.ha.merge.PSAugmentationMerger;
15 import org.opendaylight.netvirt.elan.l2gw.ha.merge.PSNodeMerger;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
18 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
19 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
21 public class ConfigNodeUpdatedHandler {
22 GlobalAugmentationMerger globalAugmentationMerger = GlobalAugmentationMerger.getInstance();
23 PSAugmentationMerger psAugmentationMerger = PSAugmentationMerger.getInstance();
24 GlobalNodeMerger globalNodeMerger = GlobalNodeMerger.getInstance();
25 PSNodeMerger psNodeMerger = PSNodeMerger.getInstance();
28 * Copy updated data from HA node to child node of config data tree.
30 * @param haUpdated HA node updated
31 * @param haOriginal HA node original
32 * @param haChildNodeId HA child node which needs to be updated
33 * @param mod the data object modification
34 * @param tx Transaction
36 public void copyHAGlobalUpdateToChild(Node haUpdated,
38 InstanceIdentifier<Node> haChildNodeId,
39 DataObjectModification<Node> mod,
40 ReadWriteTransaction tx) {
41 globalAugmentationMerger.mergeConfigUpdate(haChildNodeId,
42 mod.getModifiedAugmentation(HwvtepGlobalAugmentation.class), tx);
43 globalNodeMerger.mergeConfigUpdate(haChildNodeId, mod, tx);
47 * Copy HA ps node update to HA child ps node of config data tree.
49 * @param haUpdated HA node updated
50 * @param haOriginal HA node original
51 * @param haChildNodeId HA child node which needs to be updated
52 * @param mod the data object modification
53 * @param tx Transaction
55 public void copyHAPSUpdateToChild(Node haUpdated,
57 InstanceIdentifier<Node> haChildNodeId,
58 DataObjectModification<Node> mod,
59 ReadWriteTransaction tx) {
61 psAugmentationMerger.mergeConfigUpdate(haChildNodeId,
62 mod.getModifiedAugmentation(PhysicalSwitchAugmentation.class), tx);
63 psNodeMerger.mergeConfigUpdate(haChildNodeId, mod, tx);