return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0)); return (Element) transformNormalizedNode(document, result.getResult(), rpcDefinition.getOutput().getPath()); } catch (DOMRpcException e) { throw DocumentedException.wrap(e);
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0)); return (Element) transformNormalizedNode(document, result.getResult(), rpcDefinition.getOutput().getPath()); } catch (DOMRpcException e) { throw NetconfDocumentedException.wrap(e);
path = ((RpcDefinition) context.getSchemaNode()).getOutput().getPath(); nnWriter = createNormalizedNodeWriter(context,path,jsonWriter, depth); jsonWriter.name("output");
if (action.isAddedByUses()) { final ActionDefinition orig = findOrigAction(parentSchema, action).get(); input = context.getChildNode(orig.getInput().getPath()).build(); output = context.getChildNode(orig.getOutput().getPath()).build(); } else { input = actionContainer(context, RPC_INPUT, action.getInput());
private void writeNormalizedNode(XMLStreamWriter xmlWriter, SchemaPath schemaPath, InstanceIdentifierContext<?> pathContext, NormalizedNode<?, ?> data, Optional<Integer> depth) throws IOException { final RestconfNormalizedNodeWriter nnWriter; final SchemaContext schemaCtx = pathContext.getSchemaContext(); if (SchemaPath.ROOT.equals(schemaPath)) { nnWriter = createNormalizedNodeWriter(xmlWriter, schemaCtx, schemaPath, depth); writeElements(xmlWriter, nnWriter, (ContainerNode) data); } else if (pathContext.getSchemaNode() instanceof RpcDefinition) { nnWriter = createNormalizedNodeWriter(xmlWriter, schemaCtx, ((RpcDefinition) pathContext.getSchemaNode()).getOutput().getPath(), depth); writeElements(xmlWriter, nnWriter, (ContainerNode) data); } else { nnWriter = createNormalizedNodeWriter(xmlWriter, schemaCtx, schemaPath.getParent(), depth); if (data instanceof MapEntryNode) { // Restconf allows returning one list item. We need to wrap it // in map node in order to serialize it properly data = ImmutableNodes.mapNodeBuilder(data.getNodeType()).addChild((MapEntryNode) data).build(); } nnWriter.write(data); } nnWriter.flush(); }