Split out odl-netconf-device.yang
[netconf.git] / netconf / netconf-console / src / main / java / org / opendaylight / netconf / console / impl / NetconfCommandsImpl.java
index d51c803cdf15c8828e2f2ed605b1956d406e1ff6..d013b5da8c64a39c66a3248f2c6a0951e261901c 100644 (file)
@@ -33,11 +33,11 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPasswordBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev221225.ConnectionOper.ConnectionStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev221225.connection.oper.available.capabilities.AvailableCapability;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev221225.credentials.credentials.LoginPasswordBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.NetconfNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.NetconfNodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
@@ -61,7 +61,7 @@ public class NetconfCommandsImpl implements NetconfCommands {
     @Inject
     @Activate
     public NetconfCommandsImpl(@Reference final DataBroker db) {
-        this.dataBroker = requireNonNull(db);
+        dataBroker = requireNonNull(db);
         LOG.debug("NetconfConsoleProviderImpl initialized");
     }
 
@@ -105,7 +105,7 @@ public class NetconfCommandsImpl implements NetconfCommands {
             attributes.put(NetconfConsoleConstants.NETCONF_PORT, List.of(netconfNode.getPort().getValue().toString()));
             attributes.put(NetconfConsoleConstants.STATUS, List.of(netconfNode.getConnectionStatus().name()));
             if (netconfNode.getConnectionStatus().equals(
-                NetconfNodeConnectionStatus.ConnectionStatus.Connected)) {
+                ConnectionStatus.Connected)) {
                 attributes.put(NetconfConsoleConstants.AVAILABLE_CAPABILITIES, netconfNode.getAvailableCapabilities()
                     .getAvailableCapability().stream()
                         .map(AvailableCapability::getCapability)
@@ -130,7 +130,7 @@ public class NetconfCommandsImpl implements NetconfCommands {
                 List.of(netconfNode.getHost().getIpAddress().getIpv4Address().getValue()));
             attributes.put(NetconfConsoleConstants.NETCONF_PORT, List.of(netconfNode.getPort().getValue().toString()));
             attributes.put(NetconfConsoleConstants.STATUS, List.of(netconfNode.getConnectionStatus().name()));
-            if (netconfNode.getConnectionStatus().equals(NetconfNodeConnectionStatus.ConnectionStatus.Connected)) {
+            if (netconfNode.getConnectionStatus() == ConnectionStatus.Connected) {
                 attributes.put(NetconfConsoleConstants.AVAILABLE_CAPABILITIES, netconfNode.getAvailableCapabilities()
                     .getAvailableCapability().stream()
                         .map(AvailableCapability::getCapability).collect(Collectors.toList()));
@@ -227,8 +227,8 @@ public class NetconfCommandsImpl implements NetconfCommands {
                         .setTcpOnly(tcpOnly)
                         .setSchemaless(isSchemaless)
                         .setCredentials(new LoginPasswordBuilder()
-                            .setPassword(newPassword)
                             .setUsername(newUsername)
+                            .setPassword(newPassword)
                             .build())
                         .build())
                     .build();