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 java.util.concurrent.ExecutionException;
12 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
13 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
14 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
15 import org.opendaylight.netvirt.elan.l2gw.ha.merge.GlobalAugmentationMerger;
16 import org.opendaylight.netvirt.elan.l2gw.ha.merge.GlobalNodeMerger;
17 import org.opendaylight.netvirt.elan.l2gw.ha.merge.PSAugmentationMerger;
18 import org.opendaylight.netvirt.elan.l2gw.ha.merge.PSNodeMerger;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
21 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
22 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
24 public class ConfigNodeUpdatedHandler {
25 GlobalAugmentationMerger globalAugmentationMerger = GlobalAugmentationMerger.getInstance();
26 PSAugmentationMerger psAugmentationMerger = PSAugmentationMerger.getInstance();
27 GlobalNodeMerger globalNodeMerger = GlobalNodeMerger.getInstance();
28 PSNodeMerger psNodeMerger = PSNodeMerger.getInstance();
31 * Copy updated data from HA node to child node of config data tree.
33 * @param haUpdated HA node updated
34 * @param haOriginal HA node original
35 * @param haChildNodeId HA child node which needs to be updated
36 * @param mod the data object modification
37 * @param tx Transaction
38 * @throws ReadFailedException Exception thrown if read fails
39 * @throws ExecutionException Exception thrown if Execution fail
40 * @throws InterruptedException Thread interrupted Exception
42 public void copyHAGlobalUpdateToChild(Node haUpdated,
44 InstanceIdentifier<Node> haChildNodeId,
45 DataObjectModification<Node> mod,
46 ReadWriteTransaction tx)
47 throws InterruptedException, ExecutionException, ReadFailedException {
48 globalAugmentationMerger.mergeConfigUpdate(haChildNodeId,
49 mod.getModifiedAugmentation(HwvtepGlobalAugmentation.class), tx);
50 globalNodeMerger.mergeConfigUpdate(haChildNodeId, mod, tx);
54 * Copy HA ps node update to HA child ps node of config data tree.
56 * @param haUpdated HA node updated
57 * @param haOriginal HA node original
58 * @param haChildNodeId HA child node which needs to be updated
59 * @param mod the data object modification
60 * @param tx Transaction
61 * @throws ReadFailedException Exception thrown if read fails
62 * @throws ExecutionException Exception thrown if Execution fail
63 * @throws InterruptedException Thread interrupted Exception
65 public void copyHAPSUpdateToChild(Node haUpdated,
67 InstanceIdentifier<Node> haChildNodeId,
68 DataObjectModification<Node> mod,
69 ReadWriteTransaction tx)
70 throws InterruptedException, ExecutionException, ReadFailedException {
72 psAugmentationMerger.mergeConfigUpdate(haChildNodeId,
73 mod.getModifiedAugmentation(PhysicalSwitchAugmentation.class), tx);
74 psNodeMerger.mergeConfigUpdate(haChildNodeId, mod, tx);