1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
19 package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl;
21 import org.eclipse.jdt.annotation.NonNull;
22 import org.eclipse.jdt.annotation.Nullable;
23 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeConnectListener;
24 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService;
25 import org.opendaylight.mdsal.binding.api.DataBroker;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
27 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
28 import org.opendaylight.yangtools.concepts.ListenerRegistration;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
32 public class DeviceManagerNetconfConnectHandler implements NetconfNodeConnectListener {
34 private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerNetconfConnectHandler.class);
36 private ListenerRegistration<DeviceManagerNetconfConnectHandler> registerNetconfNodeConnectListener;
38 public DeviceManagerNetconfConnectHandler(@Nullable NetconfNodeStateService netconfNodeStateService) {
39 if (netconfNodeStateService == null) {
40 registerNetconfNodeConnectListener = new ListenerRegistration<DeviceManagerNetconfConnectHandler>() {
45 public @NonNull DeviceManagerNetconfConnectHandler getInstance() {
46 return DeviceManagerNetconfConnectHandler.this;
50 this.registerNetconfNodeConnectListener = netconfNodeStateService.registerNetconfNodeConnectListener(this);
55 public void onEnterConnected(NodeId nNodeId, NetconfNode netconfNode, DataBroker netconfNodeDataBroker) {
56 LOG.info("onEnterConnected {}", nNodeId);
57 //o-ran-interfaces .. spec for RAN Devices to be used as fingerprint
61 public void onLeaveConnected(NodeId nNodeId) {
62 LOG.info("onLeaveConnected {}", nNodeId);
66 public void close() throws Exception {
67 registerNetconfNodeConnectListener.close();