RemoteDeviceDataBroker proxy
[netconf.git] / opendaylight / netconf / abstract-topology / src / main / java / org / opendaylight / netconf / topology / example / ExampleNodeManagerCallback.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.netconf.topology.example;
10
11 import akka.actor.ActorRef;
12 import com.google.common.util.concurrent.Futures;
13 import com.google.common.util.concurrent.ListenableFuture;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
16 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
17 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
18 import org.opendaylight.netconf.topology.NodeManagerCallback;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeFields;
22 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
23 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
24 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
25 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
26
27 public class ExampleNodeManagerCallback implements NodeManagerCallback {
28
29     public ExampleNodeManagerCallback() {
30     }
31
32     @Nonnull
33     @Override public Node getInitialState(@Nonnull final NodeId nodeId,
34                                           @Nonnull final Node configNode) {
35         return new NodeBuilder().addAugmentation(NetconfNode.class,
36                 new NetconfNodeBuilder().setConnectionStatus(NetconfNodeFields.ConnectionStatus.Connecting).build()).build();
37     }
38
39     @Nonnull @Override public Node getFailedState(@Nonnull final NodeId nodeId,
40                                                   @Nonnull final Node configNode) {
41         return new NodeBuilder().addAugmentation(NetconfNode.class,
42                 new NetconfNodeBuilder().setConnectionStatus(NetconfNodeFields.ConnectionStatus.UnableToConnect).build()).build();
43     }
44
45     @Nonnull @Override public ListenableFuture<Node> onNodeCreated(@Nonnull final NodeId nodeId,
46                                                                    @Nonnull final Node configNode) {
47         return Futures.immediateFuture(new NodeBuilder().addAugmentation(NetconfNode.class,
48                 new NetconfNodeBuilder().setConnectionStatus(NetconfNodeFields.ConnectionStatus.Connected).build()).build());
49     }
50
51     @Nonnull @Override public ListenableFuture<Node> onNodeUpdated(@Nonnull final NodeId nodeId,
52                                                                    @Nonnull final Node configNode) {
53         // update magic
54         return Futures.immediateFuture(new NodeBuilder().addAugmentation(NetconfNode.class,
55                 new NetconfNodeBuilder().setConnectionStatus(NetconfNodeFields.ConnectionStatus.Connected).build()).build());
56     }
57
58     @Nonnull @Override public ListenableFuture<Void> onNodeDeleted(@Nonnull final NodeId nodeId) {
59         return Futures.immediateFuture(null);
60     }
61
62     @Nonnull
63     @Override
64     public ListenableFuture<Node> getCurrentStatusForNode(@Nonnull NodeId nodeId) {
65         return null;
66     }
67
68     @Override
69     public void onReceive(Object message, ActorRef sender) {
70
71     }
72
73     @Override
74     public void onRoleChanged(RoleChangeDTO roleChangeDTO) {
75
76     }
77
78     @Override
79     public void onDeviceConnected(SchemaContext remoteSchemaContext, NetconfSessionPreferences netconfSessionPreferences, DOMRpcService deviceRpc) {
80
81     }
82
83     @Override
84     public void onDeviceDisconnected() {
85
86     }
87
88     @Override
89     public void onDeviceFailed(Throwable throwable) {
90
91     }
92
93     @Override
94     public void onNotification(DOMNotification domNotification) {
95
96     }
97
98     @Override
99     public void close() {
100
101     }
102 }