*/
package org.opendaylight.netconf.console.impl;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.FutureCallback;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint16;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
+@Component(immediate = true)
public class NetconfCommandsImpl implements NetconfCommands {
-
private static final Logger LOG = LoggerFactory.getLogger(NetconfCommandsImpl.class);
private final DataBroker dataBroker;
- public NetconfCommandsImpl(final DataBroker db) {
+ @Inject
+ @Activate
+ public NetconfCommandsImpl(@Reference final DataBroker db) {
+ this.dataBroker = requireNonNull(db);
LOG.debug("NetconfConsoleProviderImpl initialized");
- this.dataBroker = db;
}
@Override
@Override
public boolean disconnectDevice(final String deviceIp, final String devicePort) {
- final String netconfNodeId = NetconfConsoleUtils
- .getNetconfNodeFromIpAndPort(deviceIp, devicePort, dataBroker).getNodeId().getValue();
+ final String netconfNodeId = NetconfConsoleUtils.getNetconfNodeFromIpAndPort(deviceIp, devicePort, dataBroker)
+ .getNodeId().getValue();
return disconnectDevice(netconfNodeId);
}
@Override
public String updateDevice(final String netconfNodeId, final String username, final String password,
final Map<String, String> updated) {
- final Node node = NetconfConsoleUtils
- .read(LogicalDatastoreType.OPERATIONAL, NetconfIidFactory.netconfNodeIid(netconfNodeId), dataBroker);
+ final Node node = NetconfConsoleUtils.read(LogicalDatastoreType.OPERATIONAL,
+ NetconfIidFactory.netconfNodeIid(netconfNodeId), dataBroker);
if (node != null && node.augmentation(NetconfNode.class) != null) {
final NetconfNode netconfNode = node.augmentation(NetconfNode.class);
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2016 Inocybe Technologies Inc. and others. All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="dataBroker"
- interface="org.opendaylight.mdsal.binding.api.DataBroker"
- odl:type="default"/>
-
- <bean id="netconfCommandsImpl" class="org.opendaylight.netconf.console.impl.NetconfCommandsImpl">
- <argument ref="dataBroker"/>
- </bean>
- <service ref="netconfCommandsImpl" interface="org.opendaylight.netconf.console.api.NetconfCommands" />
-
-</blueprint>