- static Node<?> toNode(final YangInstanceIdentifier.NodeIdentifierWithPredicates argument, final Node<?> node) {
- final List<Node<?>> list = new ArrayList<>();
- for (final Map.Entry<QName, Object> arg : argument.getKeyValues().entrySet()) {
- list.add(new SimpleNodeTOImpl(arg.getKey(), null, arg.getValue()));
- }
- if (node != null) {
- list.add(node);
+ public static URI NETCONF_RUNNING_WRITABLE_URI = URI
+ .create("urn:ietf:params:netconf:capability:writable-running:1.0");
+
+ public static QName NETCONF_LOCK_QNAME = QName.create(NETCONF_QNAME, "lock");
+ public static QName NETCONF_UNLOCK_QNAME = QName.create(NETCONF_QNAME, "unlock");
+
+ // Discard changes message
+ public static final ContainerNode DISCARD_CHANGES_RPC_CONTENT =
+ Builders.containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(NETCONF_DISCARD_CHANGES_QNAME)).build();
+
+ // Commit changes message
+ public static final ContainerNode COMMIT_RPC_CONTENT =
+ Builders.containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(NETCONF_COMMIT_QNAME)).build();
+
+ // Get message
+ public static final ContainerNode GET_RPC_CONTENT =
+ Builders.containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(NETCONF_GET_QNAME)).build();
+
+ // Create-subscription changes message
+ public static final ContainerNode CREATE_SUBSCRIPTION_RPC_CONTENT =
+ Builders.containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CREATE_SUBSCRIPTION_RPC_QNAME)).build();
+
+ public static DataContainerChild<?, ?> toFilterStructure(final YangInstanceIdentifier identifier, final SchemaContext ctx) {
+ final NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, DOMSource, AnyXmlNode> anyXmlBuilder = Builders.anyXmlBuilder().withNodeIdentifier(toId(NETCONF_FILTER_QNAME));
+ anyXmlBuilder.withAttributes(Collections.singletonMap(NETCONF_TYPE_QNAME, SUBTREE));
+
+ final NormalizedNode<?, ?> filterContent = InstanceIdToNodes.serialize(ctx, identifier);
+
+ final Element element = XmlUtil.createElement(BLANK_DOCUMENT, NETCONF_FILTER_QNAME.getLocalName(), Optional.of(NETCONF_FILTER_QNAME.getNamespace().toString()));
+ element.setAttributeNS(NETCONF_FILTER_QNAME.getNamespace().toString(), NETCONF_TYPE_QNAME.getLocalName(), "subtree");
+
+ try {
+ writeNormalizedNode(filterContent, new DOMResult(element), SchemaPath.ROOT, ctx);
+ } catch (IOException | XMLStreamException e) {
+ throw new IllegalStateException("Unable to serialize filter element for path " + identifier, e);