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 javax.inject.Inject;
11 import javax.inject.Singleton;
12 import org.opendaylight.mdsal.binding.api.DataBroker;
13 import org.opendaylight.mdsal.binding.api.DataObjectModification;
14 import org.opendaylight.mdsal.binding.util.Datastore.Configuration;
15 import org.opendaylight.mdsal.binding.util.Datastore.Operational;
16 import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner;
17 import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl;
18 import org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction;
19 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
20 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
23 public class HAEventHandler implements IHAEventHandler {
25 private final ConfigNodeUpdatedHandler configNodeUpdatedHandler = new ConfigNodeUpdatedHandler();
26 private final OpNodeUpdatedHandler opNodeUpdatedHandler = new OpNodeUpdatedHandler();
27 private final ManagedNewTransactionRunner txRunner;
30 public HAEventHandler(DataBroker db) {
31 this.txRunner = new ManagedNewTransactionRunnerImpl(db);
35 public void copyChildGlobalOpUpdateToHAParent(InstanceIdentifier<Node> haPath,
36 DataObjectModification<Node> mod,
37 TypedReadWriteTransaction<Operational> tx) {
41 opNodeUpdatedHandler.copyChildGlobalOpUpdateToHAParent(haPath, mod, tx, txRunner);
45 public void copyChildPsOpUpdateToHAParent(Node updatedSrcPSNode,
46 InstanceIdentifier<Node> haPath,
47 DataObjectModification<Node> mod,
48 TypedReadWriteTransaction<Operational> tx) {
52 opNodeUpdatedHandler.copyChildPsOpUpdateToHAParent(updatedSrcPSNode, haPath, mod, tx, txRunner);
56 public void copyHAPSUpdateToChild(InstanceIdentifier<Node> haChildNodeId,
57 DataObjectModification<Node> mod,
58 TypedReadWriteTransaction<Configuration> tx) {
59 if (haChildNodeId == null) {
62 configNodeUpdatedHandler.copyHAPSUpdateToChild(haChildNodeId, mod, tx, txRunner);
66 public void copyHAGlobalUpdateToChild(InstanceIdentifier<Node> haChildNodeId,
67 DataObjectModification<Node> mod,
68 TypedReadWriteTransaction<Configuration> tx) {
69 if (haChildNodeId == null) {
72 configNodeUpdatedHandler.copyHAGlobalUpdateToChild(haChildNodeId, mod, tx, txRunner);