Exemplo n.º 1
0
  private Output invoke(
      final NetconfClientConfigurationBuilder config,
      final String addressName,
      final Input inputArgs) {
    final Set<String> remoteCmds =
        connectManager.connectBlocking(addressName, getAdress(inputArgs), config);

    final ArrayList<DataContainerChild<?, ?>> output = Lists.newArrayList();
    output.add(
        ImmutableLeafNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(QName.create(getCommandId(), "status")))
            .withValue("Connection initiated")
            .build());

    final ArrayList<LeafSetEntryNode<Object>> leafListChildren = Lists.newArrayList();
    for (final String cmdId : remoteCmds) {
      leafListChildren.add(
          ImmutableLeafSetEntryNodeBuilder.create()
              .withNodeIdentifier(
                  new NodeWithValue(QName.create(getCommandId(), "remote-commands"), cmdId))
              .withValue(cmdId)
              .build());
    }

    return new Output(
        ImmutableLeafSetNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(QName.create(getCommandId(), "remote-commands")))
            .withValue(leafListChildren)
            .build());
  }
  static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final DataSchemaNode schema) {
    final LeafsetEntryInterner interner = getInterner(schema);
    if (interner != null) {
      return new InterningLeafSetNodeBuilder<>(interner);
    }

    return ImmutableLeafSetNodeBuilder.create();
  }