description = "IP address of the netconf device",
required = true,
multiValued = false)
- private String deviceIp = "";
+ private String deviceIp;
@Option(name = "-p",
aliases = { "--port" },
@Option(name = "-t",
aliases = { "--tcp-only" },
- description = "Type of connection, true for tcp only, false by default",
+ description = "Type of connection, true for tcp only",
required = false,
multiValued = false)
private String connectionType = "false";
description = "Node Identifier of the netconf device",
required = false,
multiValued = false)
- private String deviceId = "";
+ private String deviceId;
@Override
protected Object doExecute() throws Exception {
description = "IP address of the netconf device",
required = false,
multiValued = false)
- private String deviceIp = "";
+ private String deviceIp;
@Option(name = "-p",
aliases = { "--port" },
description = "Node Identifier of the netconf device",
required = false,
multiValued = false)
- private String deviceId = "";
+ private String deviceId;
@Override
protected Object doExecute() throws Exception {
description = "Node Identifier of the netconf device",
required = false,
multiValued = false)
- private String deviceId = "";
+ private String deviceId;
@Option(name = "-i",
aliases = { "--ipaddress" },
description = "IP address of the netconf device",
required = false,
multiValued = false)
- private String deviceIp = "";
+ private String deviceIp;
@Option(name = "-p",
aliases = { "--port" },
@Override
protected Object doExecute() throws Exception {
- if (Strings.isNullOrEmpty(deviceIp) || Strings.isNullOrEmpty(devicePort) && Strings.isNullOrEmpty(deviceId)) {
+ if ((Strings.isNullOrEmpty(deviceIp) || Strings.isNullOrEmpty(devicePort)) && Strings.isNullOrEmpty(deviceId)) {
return "You must provide either the device Ip and the device Port or the device Id";
}
@Option(name = "-t",
aliases = { "--tcp-only" },
- description = "Type of connection, true for tcp only, false by default",
+ description = "Type of connection, true for tcp only",
required = false,
multiValued = false)
private String newConnectionType = "false";
}
if (nodeList != null) {
for (final Node node : nodeList) {
- final NetconfNode netconfNode = node.getAugmentation(NetconfNode.class);
- final Map<String, List<String>> attributes = new HashMap<>();
- attributes.put(NetconfConsoleConstants.NETCONF_ID, ImmutableList.of(node.getNodeId().getValue()));
- attributes.put(NetconfConsoleConstants.NETCONF_IP, ImmutableList.of(netconfNode.getHost().getIpAddress().getIpv4Address().getValue()));
- attributes.put(NetconfConsoleConstants.NETCONF_PORT, ImmutableList.of(netconfNode.getPort().getValue().toString()));
- attributes.put(NetconfConsoleConstants.STATUS, ImmutableList.of(netconfNode.getConnectionStatus().name()));
- attributes.put(NetconfConsoleConstants.AVAILABLE_CAPABILITIES, netconfNode.getAvailableCapabilities().getAvailableCapability());
- device.put(node.getNodeId().getValue(), attributes);
+ if (node != null) {
+ final NetconfNode netconfNode = node.getAugmentation(NetconfNode.class);
+ final Map<String, List<String>> attributes = new HashMap<>();
+ attributes.put(NetconfConsoleConstants.NETCONF_ID, ImmutableList.of(node.getNodeId().getValue()));
+ attributes.put(NetconfConsoleConstants.NETCONF_IP, ImmutableList.of(netconfNode.getHost().getIpAddress().getIpv4Address().getValue()));
+ attributes.put(NetconfConsoleConstants.NETCONF_PORT, ImmutableList.of(netconfNode.getPort().getValue().toString()));
+ attributes.put(NetconfConsoleConstants.STATUS, ImmutableList.of(netconfNode.getConnectionStatus().name()));
+ attributes.put(NetconfConsoleConstants.AVAILABLE_CAPABILITIES, netconfNode.getAvailableCapabilities().getAvailableCapability());
+ device.put(node.getNodeId().getValue(), attributes);
+ }
}
}
return device;