2 * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.sal.connect.netconf.schema.mapping;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertNull;
13 import static org.junit.Assert.assertThat;
14 import static org.junit.Assert.assertTrue;
15 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.CREATE_SUBSCRIPTION_RPC_CONTENT;
16 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.CREATE_SUBSCRIPTION_RPC_QNAME;
17 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.GET_SCHEMA_QNAME;
18 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_CANDIDATE_QNAME;
19 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME;
20 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_DISCARD_CHANGES_QNAME;
21 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME;
22 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME;
23 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_QNAME;
24 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_LOCK_QNAME;
25 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_RUNNING_QNAME;
26 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.createEditConfigStructure;
27 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.toFilterStructure;
28 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.toId;
29 import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.toPath;
30 import static org.opendaylight.netconf.util.NetconfUtil.NETCONF_DATA_QNAME;
32 import com.google.common.collect.Iterables;
33 import com.google.common.collect.Lists;
34 import java.io.IOException;
35 import java.util.ArrayList;
36 import java.util.Collections;
37 import java.util.HashMap;
38 import java.util.HashSet;
39 import java.util.List;
41 import java.util.Optional;
43 import javax.xml.transform.dom.DOMSource;
44 import org.custommonkey.xmlunit.Diff;
45 import org.custommonkey.xmlunit.ElementNameAndAttributeQualifier;
46 import org.custommonkey.xmlunit.XMLUnit;
47 import org.hamcrest.CoreMatchers;
48 import org.junit.AfterClass;
49 import org.junit.Before;
50 import org.junit.BeforeClass;
51 import org.junit.Test;
52 import org.opendaylight.binding.runtime.spi.BindingRuntimeHelpers;
53 import org.opendaylight.mdsal.dom.api.DOMActionResult;
54 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
55 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
56 import org.opendaylight.netconf.api.NetconfMessage;
57 import org.opendaylight.netconf.api.xml.XmlUtil;
58 import org.opendaylight.netconf.sal.connect.netconf.schema.NetconfRemoteSchemaYangSourceProvider;
59 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
60 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil;
61 import org.opendaylight.netconf.util.NetconfUtil;
62 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.IetfNetconfService;
63 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState;
64 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities;
65 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Schemas;
66 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.schemas.Schema;
67 import org.opendaylight.yangtools.rcf8528.data.util.EmptyMountPointContext;
68 import org.opendaylight.yangtools.yang.common.QName;
69 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
70 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
71 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
72 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
73 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
74 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
75 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
76 import org.opendaylight.yangtools.yang.data.api.schema.DOMSourceAnyxmlNode;
77 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
78 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
79 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
80 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
81 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
82 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
83 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
84 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
85 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
86 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
87 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
88 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
89 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
90 import org.w3c.dom.Node;
91 import org.xml.sax.SAXException;
93 public class NetconfMessageTransformerTest {
95 private static final String REVISION_EXAMPLE_SERVER_FARM = "2018-08-07";
96 private static final String URN_EXAMPLE_SERVER_FARM = "urn:example:server-farm";
98 private static final String REVISION_EXAMPLE_SERVER_FARM_2 = "2019-05-20";
99 private static final String URN_EXAMPLE_SERVER_FARM_2 = "urn:example:server-farm-2";
101 private static final String URN_EXAMPLE_CONFLICT = "urn:example:conflict";
103 private static final String URN_EXAMPLE_AUGMENTED_ACTION = "urn:example:augmented-action";
105 private static final String URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS = "urn:example:rpcs-actions-outputs";
107 private static final QName SERVER_QNAME =
108 QName.create(URN_EXAMPLE_SERVER_FARM, REVISION_EXAMPLE_SERVER_FARM, "server");
109 private static final QName RESET_QNAME = QName.create(SERVER_QNAME, "reset");
110 private static final SchemaPath RESET_SERVER_PATH = SchemaPath.create(true, SERVER_QNAME, RESET_QNAME);
111 private static final QName APPLICATIONS_QNAME = QName.create(URN_EXAMPLE_SERVER_FARM_2,
112 REVISION_EXAMPLE_SERVER_FARM_2, "applications");
113 private static final QName APPLICATION_QNAME = QName.create(APPLICATIONS_QNAME, "application");
114 private static final QName KILL_QNAME = QName.create(APPLICATION_QNAME, "kill");
115 private static final SchemaPath KILL_SERVER_APP_PATH =
116 SchemaPath.create(true, SERVER_QNAME, APPLICATIONS_QNAME, APPLICATION_QNAME, KILL_QNAME);
118 private static final QName DEVICE_QNAME =
119 QName.create(URN_EXAMPLE_SERVER_FARM, REVISION_EXAMPLE_SERVER_FARM, "device");
120 private static final QName START_QNAME = QName.create(DEVICE_QNAME, "start");
121 private static final SchemaPath START_DEVICE_PATH = SchemaPath.create(true, DEVICE_QNAME, START_QNAME);
122 private static final QName INTERFACE_QNAME = QName.create(DEVICE_QNAME, "interface");
123 private static final QName ENABLE_QNAME = QName.create(INTERFACE_QNAME, "enable");
124 private static final SchemaPath ENABLE_INTERFACE_PATH =
125 SchemaPath.create(true, DEVICE_QNAME, INTERFACE_QNAME, ENABLE_QNAME);
127 private static final QName DISABLE_QNAME = QName.create(URN_EXAMPLE_AUGMENTED_ACTION, "disable");
128 private static final SchemaPath DISABLE_INTERFACE_PATH =
129 SchemaPath.create(true, DEVICE_QNAME, INTERFACE_QNAME, DISABLE_QNAME);
131 private static final QName CHECK_WITH_OUTPUT_QNAME =
132 QName.create(URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS, "check-with-output");
133 private static final SchemaPath CHECK_WITH_OUTPUT_INTERFACE_PATH =
134 SchemaPath.create(true, DEVICE_QNAME, INTERFACE_QNAME, CHECK_WITH_OUTPUT_QNAME);
135 private static final QName CHECK_WITHOUT_OUTPUT_QNAME =
136 QName.create(URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS, "check-without-output");
137 private static final SchemaPath CHECK_WITHOUT_OUTPUT_INTERFACE_PATH =
138 SchemaPath.create(true, DEVICE_QNAME, INTERFACE_QNAME, CHECK_WITHOUT_OUTPUT_QNAME);
139 private static final QName RPC_WITH_OUTPUT_QNAME =
140 QName.create(URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS, "rpc-with-output");
141 private static final QName RPC_WITHOUT_OUTPUT_QNAME =
142 QName.create(URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS, "rpc-without-output");
144 private static final QName BOX_OUT_QNAME =
145 QName.create(URN_EXAMPLE_SERVER_FARM, REVISION_EXAMPLE_SERVER_FARM, "box-out");
146 private static final QName BOX_IN_QNAME = QName.create(BOX_OUT_QNAME, "box-in");
147 private static final QName OPEN_QNAME = QName.create(BOX_IN_QNAME, "open");
148 private static final SchemaPath OPEN_BOXES_PATH =
149 SchemaPath.create(true, BOX_OUT_QNAME, BOX_IN_QNAME, OPEN_QNAME);
151 private static final QName FOO_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "foo");
152 private static final QName BAR_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "bar");
153 private static final QName XYZZY_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "xyzzy");
154 private static final SchemaPath XYZZY_FOO_PATH = SchemaPath.create(true, FOO_QNAME, XYZZY_QNAME);
155 private static final SchemaPath XYZZY_BAR_PATH = SchemaPath.create(true, BAR_QNAME, XYZZY_QNAME);
157 private static final QName CONFLICT_CHOICE_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "conflict-choice");
158 private static final QName CHOICE_CONT_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "choice-cont");
159 private static final QName CHOICE_ACTION_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "choice-action");
160 private static final SchemaPath CHOICE_ACTION_PATH =
161 SchemaPath.create(true, CONFLICT_CHOICE_QNAME, CHOICE_CONT_QNAME, CHOICE_CONT_QNAME, CHOICE_ACTION_QNAME);
163 private static EffectiveModelContext PARTIAL_SCHEMA;
164 private static EffectiveModelContext SCHEMA;
165 private static EffectiveModelContext ACTION_SCHEMA;
167 private NetconfMessageTransformer actionNetconfMessageTransformer;
168 private NetconfMessageTransformer netconfMessageTransformer;
171 public static void beforeClass() {
172 PARTIAL_SCHEMA = BindingRuntimeHelpers.createEffectiveModel(NetconfState.class);
173 SCHEMA = BindingRuntimeHelpers.createEffectiveModel(IetfNetconfService.class, NetconfState.class);
174 ACTION_SCHEMA = YangParserTestUtils.parseYangResources(NetconfMessageTransformerTest.class,
175 "/schemas/example-server-farm.yang","/schemas/example-server-farm-2.yang",
176 "/schemas/conflicting-actions.yang", "/schemas/augmented-action.yang",
177 "/schemas/rpcs-actions-outputs.yang");
181 public static void afterClass() {
182 PARTIAL_SCHEMA = null;
184 ACTION_SCHEMA = null;
188 public void setUp() throws Exception {
189 XMLUnit.setIgnoreWhitespace(true);
190 XMLUnit.setIgnoreAttributeOrder(true);
191 XMLUnit.setIgnoreComments(true);
193 netconfMessageTransformer = getTransformer(SCHEMA);
194 actionNetconfMessageTransformer = new NetconfMessageTransformer(new EmptyMountPointContext(ACTION_SCHEMA),
199 public void testLockRequestBaseSchemaNotPresent() throws Exception {
200 final NetconfMessageTransformer transformer = getTransformer(PARTIAL_SCHEMA);
201 final NetconfMessage netconfMessage = transformer.toRpcRequest(toPath(NETCONF_LOCK_QNAME),
202 NetconfBaseOps.getLockContent(NETCONF_CANDIDATE_QNAME));
204 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<lock"));
205 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<rpc"));
209 public void testCreateSubscriberNotificationSchemaNotPresent() throws Exception {
210 final NetconfMessageTransformer transformer = new NetconfMessageTransformer(new EmptyMountPointContext(SCHEMA),
211 true, BaseSchema.BASE_NETCONF_CTX_WITH_NOTIFICATIONS);
212 NetconfMessage netconfMessage = transformer.toRpcRequest(
213 toPath(CREATE_SUBSCRIPTION_RPC_QNAME),
214 CREATE_SUBSCRIPTION_RPC_CONTENT
216 String documentString = XmlUtil.toString(netconfMessage.getDocument());
217 assertThat(documentString, CoreMatchers.containsString("<create-subscription"));
218 assertThat(documentString, CoreMatchers.containsString("<rpc"));
222 public void tesLockSchemaRequest() throws Exception {
223 final NetconfMessageTransformer transformer = getTransformer(PARTIAL_SCHEMA);
224 final String result = "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><ok/></rpc-reply>";
226 transformer.toRpcResult(new NetconfMessage(XmlUtil.readXmlToDocument(result)), toPath(NETCONF_LOCK_QNAME));
230 public void testRpcEmptyBodyWithOutputDefinedSchemaResult() throws Exception {
231 final String result = "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><ok/></rpc-reply>";
233 DOMRpcResult domRpcResult = actionNetconfMessageTransformer
234 .toRpcResult(new NetconfMessage(XmlUtil.readXmlToDocument(result)),
235 toPath(RPC_WITH_OUTPUT_QNAME));
236 assertNotNull(domRpcResult);
240 public void testRpcEmptyBodyWithoutOutputDefinedSchemaResult() throws Exception {
241 final String result = "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><ok/></rpc-reply>";
243 DOMRpcResult domRpcResult = actionNetconfMessageTransformer
244 .toRpcResult(new NetconfMessage(XmlUtil.readXmlToDocument(result)),
245 toPath(RPC_WITHOUT_OUTPUT_QNAME));
246 assertNotNull(domRpcResult);
250 public void testDiscardChangesRequest() throws Exception {
251 final NetconfMessage netconfMessage =
252 netconfMessageTransformer.toRpcRequest(toPath(NETCONF_DISCARD_CHANGES_QNAME), null);
253 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<discard"));
254 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<rpc"));
255 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("message-id"));
259 public void testGetSchemaRequest() throws Exception {
260 final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(GET_SCHEMA_QNAME),
261 NetconfRemoteSchemaYangSourceProvider.createGetSchemaRequest("module", Optional.of("2012-12-12")));
262 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
263 + "<get-schema xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
264 + "<format>yang</format>\n"
265 + "<identifier>module</identifier>\n"
266 + "<version>2012-12-12</version>\n"
272 public void testGetSchemaResponse() throws Exception {
273 final NetconfMessageTransformer transformer = getTransformer(SCHEMA);
274 final NetconfMessage response = new NetconfMessage(XmlUtil.readXmlToDocument(
275 "<rpc-reply message-id=\"101\"\n"
276 + "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
278 + "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
279 + "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n"
280 + "Random YANG SCHEMA\n"
285 final DOMRpcResult compositeNodeRpcResult = transformer.toRpcResult(response, toPath(GET_SCHEMA_QNAME));
286 assertTrue(compositeNodeRpcResult.getErrors().isEmpty());
287 assertNotNull(compositeNodeRpcResult.getResult());
288 final DOMSource schemaContent = ((DOMSourceAnyxmlNode) ((ContainerNode) compositeNodeRpcResult.getResult())
289 .getValue().iterator().next()).getValue();
290 assertThat(schemaContent.getNode().getTextContent(),
291 CoreMatchers.containsString("Random YANG SCHEMA"));
295 public void testGetConfigResponse() throws Exception {
296 final NetconfMessage response = new NetconfMessage(XmlUtil.readXmlToDocument("<rpc-reply message-id=\"101\"\n"
297 + "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
299 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
302 + "<identifier>module</identifier>\n"
303 + "<version>2012-12-12</version>\n"
304 + "<format xmlns:x=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">x:yang</format>\n"
307 + "</netconf-state>\n"
311 final NetconfMessageTransformer transformer = getTransformer(SCHEMA);
312 final DOMRpcResult compositeNodeRpcResult =
313 transformer.toRpcResult(response, toPath(NETCONF_GET_CONFIG_QNAME));
314 assertTrue(compositeNodeRpcResult.getErrors().isEmpty());
315 assertNotNull(compositeNodeRpcResult.getResult());
317 final List<DataContainerChild<?, ?>> values = Lists.newArrayList(
318 NetconfRemoteSchemaYangSourceProvider
319 .createGetSchemaRequest("module", Optional.of("2012-12-12")).getValue());
321 final Map<QName, Object> keys = new HashMap<>();
322 for (final DataContainerChild<?, ?> value : values) {
323 keys.put(value.getNodeType(), value.getValue());
326 final NodeIdentifierWithPredicates identifierWithPredicates =
327 NodeIdentifierWithPredicates.of(Schema.QNAME, keys);
328 final MapEntryNode schemaNode =
329 Builders.mapEntryBuilder().withNodeIdentifier(identifierWithPredicates).withValue(values).build();
331 final DOMSourceAnyxmlNode data = (DOMSourceAnyxmlNode) ((ContainerNode) compositeNodeRpcResult.getResult())
332 .getChild(toId(NETCONF_DATA_QNAME)).get();
334 NormalizedNodeResult nodeResult =
335 NetconfUtil.transformDOMSourceToNormalizedNode(SCHEMA, data.getValue());
336 ContainerNode result = (ContainerNode) nodeResult.getResult();
337 final ContainerNode state = (ContainerNode) result.getChild(toId(NetconfState.QNAME)).get();
338 final ContainerNode schemas = (ContainerNode) state.getChild(toId(Schemas.QNAME)).get();
339 final MapNode schemaParent = (MapNode) schemas.getChild(toId(Schema.QNAME)).get();
340 assertEquals(1, Iterables.size(schemaParent.getValue()));
342 assertEquals(schemaNode, schemaParent.getValue().iterator().next());
346 public void testGetConfigLeafRequest() throws Exception {
347 final DataContainerChild<?, ?> filter = toFilterStructure(
348 YangInstanceIdentifier.create(toId(NetconfState.QNAME), toId(Schemas.QNAME), toId(Schema.QNAME),
349 NodeIdentifierWithPredicates.of(Schema.QNAME),
350 toId(QName.create(Schemas.QNAME, "version"))), SCHEMA);
352 final DataContainerChild<?, ?> source = NetconfBaseOps.getSourceNode(NETCONF_RUNNING_QNAME);
354 final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(NETCONF_GET_CONFIG_QNAME),
355 NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, source, filter));
357 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
358 + "<get-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
359 + "<filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\">\n"
360 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
366 + "</netconf-state>\n"
376 public void testGetConfigRequest() throws Exception {
377 final DataContainerChild<?, ?> filter = toFilterStructure(
378 YangInstanceIdentifier.create(toId(NetconfState.QNAME), toId(Schemas.QNAME)), SCHEMA);
380 final DataContainerChild<?, ?> source = NetconfBaseOps.getSourceNode(NETCONF_RUNNING_QNAME);
382 final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(NETCONF_GET_CONFIG_QNAME),
383 NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, source, filter));
385 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
386 + "<get-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
387 + "<filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\">\n"
388 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
400 public void testEditConfigRequest() throws Exception {
401 final List<DataContainerChild<?, ?>> values = Lists.newArrayList(
402 NetconfRemoteSchemaYangSourceProvider
403 .createGetSchemaRequest("module", Optional.of("2012-12-12")).getValue());
405 final Map<QName, Object> keys = new HashMap<>();
406 for (final DataContainerChild<?, ?> value : values) {
407 keys.put(value.getNodeType(), value.getValue());
410 final NodeIdentifierWithPredicates identifierWithPredicates =
411 NodeIdentifierWithPredicates.of(Schema.QNAME, keys);
412 final MapEntryNode schemaNode =
413 Builders.mapEntryBuilder().withNodeIdentifier(identifierWithPredicates).withValue(values).build();
415 final YangInstanceIdentifier id = YangInstanceIdentifier.builder()
416 .node(NetconfState.QNAME).node(Schemas.QNAME).node(Schema.QNAME)
417 .nodeWithKey(Schema.QNAME, keys).build();
418 final DataContainerChild<?, ?> editConfigStructure =
419 createEditConfigStructure(BaseSchema.BASE_NETCONF_CTX_WITH_NOTIFICATIONS.getSchemaContext(), id,
420 Optional.empty(), Optional.ofNullable(schemaNode));
422 final DataContainerChild<?, ?> target = NetconfBaseOps.getTargetNode(NETCONF_CANDIDATE_QNAME);
424 final ContainerNode wrap =
425 NetconfMessageTransformUtil.wrap(NETCONF_EDIT_CONFIG_QNAME, editConfigStructure, target);
426 final NetconfMessage netconfMessage =
427 netconfMessageTransformer.toRpcRequest(toPath(NETCONF_EDIT_CONFIG_QNAME), wrap);
429 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
435 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
438 + "<identifier>module</identifier>\n"
439 + "<version>2012-12-12</version>\n"
440 + "<format>yang</format>\n"
443 + "</netconf-state>\n"
449 private static void assertSimilarXml(final NetconfMessage netconfMessage, final String xmlContent)
450 throws SAXException, IOException {
451 final Diff diff = XMLUnit.compareXML(netconfMessage.getDocument(), XmlUtil.readXmlToDocument(xmlContent));
452 diff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
453 assertTrue(diff.toString(), diff.similar());
457 public void testGetRequest() throws Exception {
459 final QName capability = QName.create(Capabilities.QNAME, "capability");
460 final DataContainerChild<?, ?> filter = toFilterStructure(
461 YangInstanceIdentifier.create(toId(NetconfState.QNAME), toId(Capabilities.QNAME), toId(capability),
462 new NodeWithValue<>(capability, "a:b:c")), SCHEMA);
464 final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(NETCONF_GET_QNAME),
465 NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, filter));
467 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
468 + "<get xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
469 + "<filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\">\n"
470 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
472 + "<capability>a:b:c</capability>\n"
473 + "</capabilities>\n"
480 private static NetconfMessageTransformer getTransformer(final EffectiveModelContext schema) {
481 return new NetconfMessageTransformer(new EmptyMountPointContext(schema), true);
485 public void testCommitResponse() throws Exception {
486 final NetconfMessage response = new NetconfMessage(XmlUtil.readXmlToDocument(
487 "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><ok/></rpc-reply>"
489 final DOMRpcResult compositeNodeRpcResult =
490 netconfMessageTransformer.toRpcResult(response, toPath(NETCONF_COMMIT_QNAME));
491 assertTrue(compositeNodeRpcResult.getErrors().isEmpty());
492 assertNull(compositeNodeRpcResult.getResult());
496 public void getActionsTest() {
497 Set<SchemaPath> schemaPaths = new HashSet<>();
498 schemaPaths.add(RESET_SERVER_PATH);
499 schemaPaths.add(START_DEVICE_PATH);
500 schemaPaths.add(ENABLE_INTERFACE_PATH);
501 schemaPaths.add(OPEN_BOXES_PATH);
502 schemaPaths.add(KILL_SERVER_APP_PATH);
503 schemaPaths.add(XYZZY_FOO_PATH);
504 schemaPaths.add(XYZZY_BAR_PATH);
505 schemaPaths.add(CHOICE_ACTION_PATH);
506 schemaPaths.add(DISABLE_INTERFACE_PATH);
507 schemaPaths.add(CHECK_WITH_OUTPUT_INTERFACE_PATH);
508 schemaPaths.add(CHECK_WITHOUT_OUTPUT_INTERFACE_PATH);
510 List<ActionDefinition> actions = NetconfMessageTransformer.getActions(ACTION_SCHEMA);
511 assertEquals(schemaPaths.size(), actions.size());
512 for (ActionDefinition actionDefinition : actions) {
513 SchemaPath path = actionDefinition.getPath();
514 assertTrue(schemaPaths.remove(path));
519 public void toActionRequestListTopLevelTest() {
520 QName nameQname = QName.create(SERVER_QNAME, "name");
521 List<PathArgument> nodeIdentifiers = new ArrayList<>();
522 nodeIdentifiers.add(new NodeIdentifier(SERVER_QNAME));
523 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(SERVER_QNAME, nameQname, "test"));
524 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
526 ContainerNode data = initInputAction(QName.create(SERVER_QNAME, "reset-at"), "now");
528 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
529 RESET_SERVER_PATH, domDataTreeIdentifier, data);
531 Node childAction = checkBasePartOfActionRequest(actionRequest);
533 Node childServer = childAction.getFirstChild();
534 checkNode(childServer, "server", "server", URN_EXAMPLE_SERVER_FARM);
536 Node childName = childServer.getFirstChild();
537 checkNode(childName, "name", "name", URN_EXAMPLE_SERVER_FARM);
539 Node childTest = childName.getFirstChild();
540 assertEquals(childTest.getNodeValue(), "test");
542 checkAction(RESET_QNAME, childName.getNextSibling(), "reset-at", "reset-at", "now");
546 public void toActionRequestContainerTopLevelTest() {
547 List<PathArgument> nodeIdentifiers = Collections.singletonList(NodeIdentifier.create(DEVICE_QNAME));
548 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
550 NormalizedNode<?, ?> payload = initInputAction(QName.create(DEVICE_QNAME, "start-at"), "now");
551 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
552 START_DEVICE_PATH, domDataTreeIdentifier, payload);
554 Node childAction = checkBasePartOfActionRequest(actionRequest);
556 Node childDevice = childAction.getFirstChild();
557 checkNode(childDevice, "device", "device", URN_EXAMPLE_SERVER_FARM);
559 checkAction(START_QNAME, childDevice.getFirstChild(), "start-at", "start-at", "now");
563 public void toActionRequestContainerInContainerTest() {
564 List<PathArgument> nodeIdentifiers = new ArrayList<>();
565 nodeIdentifiers.add(NodeIdentifier.create(BOX_OUT_QNAME));
566 nodeIdentifiers.add(NodeIdentifier.create(BOX_IN_QNAME));
568 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
570 NormalizedNode<?, ?> payload = initInputAction(QName.create(BOX_OUT_QNAME, "start-at"), "now");
571 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
572 OPEN_BOXES_PATH, domDataTreeIdentifier, payload);
574 Node childAction = checkBasePartOfActionRequest(actionRequest);
576 Node childBoxOut = childAction.getFirstChild();
577 checkNode(childBoxOut, "box-out", "box-out", URN_EXAMPLE_SERVER_FARM);
579 Node childBoxIn = childBoxOut.getFirstChild();
580 checkNode(childBoxIn, "box-in", "box-in", URN_EXAMPLE_SERVER_FARM);
582 Node action = childBoxIn.getFirstChild();
583 checkNode(action, OPEN_QNAME.getLocalName(), OPEN_QNAME.getLocalName(), OPEN_QNAME.getNamespace().toString());
587 public void toActionRequestListInContainerTest() {
588 QName nameQname = QName.create(INTERFACE_QNAME, "name");
590 List<PathArgument> nodeIdentifiers = new ArrayList<>();
591 nodeIdentifiers.add(NodeIdentifier.create(DEVICE_QNAME));
592 nodeIdentifiers.add(NodeIdentifier.create(INTERFACE_QNAME));
593 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(INTERFACE_QNAME, nameQname, "test"));
595 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
597 NormalizedNode<?, ?> payload = initEmptyInputAction(INTERFACE_QNAME);
598 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
599 ENABLE_INTERFACE_PATH, domDataTreeIdentifier, payload);
601 Node childAction = checkBasePartOfActionRequest(actionRequest);
603 Node childDevice = childAction.getFirstChild();
604 checkNode(childDevice, "device", "device", URN_EXAMPLE_SERVER_FARM);
606 Node childInterface = childDevice.getFirstChild();
607 checkNode(childInterface, "interface", "interface", URN_EXAMPLE_SERVER_FARM);
609 Node childName = childInterface.getFirstChild();
610 checkNode(childName, "name", "name", nameQname.getNamespace().toString());
612 Node childTest = childName.getFirstChild();
613 assertEquals(childTest.getNodeValue(), "test");
615 Node action = childInterface.getLastChild();
616 checkNode(action, ENABLE_QNAME.getLocalName(), ENABLE_QNAME.getLocalName(),
617 ENABLE_QNAME.getNamespace().toString());
621 public void toActionRequestListInContainerAugmentedIntoListTest() {
622 QName serverNameQname = QName.create(SERVER_QNAME, "name");
623 QName applicationNameQname = QName.create(APPLICATION_QNAME, "name");
625 List<PathArgument> nodeIdentifiers = new ArrayList<>();
626 nodeIdentifiers.add(NodeIdentifier.create(SERVER_QNAME));
627 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(SERVER_QNAME, serverNameQname, "testServer"));
628 nodeIdentifiers.add(new AugmentationIdentifier(Collections.singleton(APPLICATIONS_QNAME)));
629 nodeIdentifiers.add(NodeIdentifier.create(APPLICATIONS_QNAME));
630 nodeIdentifiers.add(NodeIdentifier.create(APPLICATION_QNAME));
631 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(APPLICATION_QNAME,
632 applicationNameQname, "testApplication"));
634 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
636 NormalizedNode<?, ?> payload = initEmptyInputAction(APPLICATION_QNAME);
637 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
638 KILL_SERVER_APP_PATH, domDataTreeIdentifier, payload);
640 Node childAction = checkBasePartOfActionRequest(actionRequest);
642 Node childServer = childAction.getFirstChild();
643 checkNode(childServer, "server", "server", URN_EXAMPLE_SERVER_FARM);
645 Node childServerName = childServer.getFirstChild();
646 checkNode(childServerName, "name", "name", URN_EXAMPLE_SERVER_FARM);
648 Node childServerNameTest = childServerName.getFirstChild();
649 assertEquals(childServerNameTest.getNodeValue(), "testServer");
651 Node childApplications = childServer.getLastChild();
652 checkNode(childApplications, "applications", "applications", URN_EXAMPLE_SERVER_FARM_2);
654 Node childApplication = childApplications.getFirstChild();
655 checkNode(childApplication, "application", "application", URN_EXAMPLE_SERVER_FARM_2);
657 Node childApplicationName = childApplication.getFirstChild();
658 checkNode(childApplicationName, "name", "name", URN_EXAMPLE_SERVER_FARM_2);
660 Node childApplicationNameTest = childApplicationName.getFirstChild();
661 assertEquals(childApplicationNameTest.getNodeValue(), "testApplication");
663 Node childKillAction = childApplication.getLastChild();
664 checkNode(childApplication, "application", "application", URN_EXAMPLE_SERVER_FARM_2);
665 checkNode(childKillAction, KILL_QNAME.getLocalName(), KILL_QNAME.getLocalName(),
666 KILL_QNAME.getNamespace().toString());
670 public void toActionRequestConflictingInListTest() {
671 QName barInputQname = QName.create(BAR_QNAME, "bar");
672 QName barIdQname = QName.create(BAR_QNAME, "bar-id");
673 Byte barInput = new Byte("1");
675 List<PathArgument> nodeIdentifiers = new ArrayList<>();
676 nodeIdentifiers.add(NodeIdentifier.create(BAR_QNAME));
677 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(BAR_QNAME, barIdQname, "test"));
679 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
681 ImmutableLeafNodeBuilder<Byte> immutableLeafNodeBuilder = new ImmutableLeafNodeBuilder<>();
682 DataContainerChild<NodeIdentifier, Byte> build = immutableLeafNodeBuilder.withNodeIdentifier(
683 NodeIdentifier.create(barInputQname)).withValue(barInput).build();
684 NormalizedNode<?, ?> payload = ImmutableContainerNodeBuilder.create().withNodeIdentifier(NodeIdentifier.create(
685 QName.create(barInputQname, "input"))).withChild(build).build();
687 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
688 XYZZY_BAR_PATH, domDataTreeIdentifier, payload);
690 Node childAction = checkBasePartOfActionRequest(actionRequest);
692 Node childBar = childAction.getFirstChild();
693 checkNode(childBar, "bar", "bar", URN_EXAMPLE_CONFLICT);
695 Node childBarId = childBar.getFirstChild();
696 checkNode(childBarId, "bar-id", "bar-id", URN_EXAMPLE_CONFLICT);
698 Node childTest = childBarId.getFirstChild();
699 assertEquals(childTest.getNodeValue(), "test");
701 Node action = childBar.getLastChild();
702 checkNode(action, XYZZY_QNAME.getLocalName(), XYZZY_QNAME.getLocalName(),
703 XYZZY_QNAME.getNamespace().toString());
707 public void toActionRequestConflictingInContainerTest() {
708 QName fooInputQname = QName.create(FOO_QNAME, "foo");
710 List<PathArgument> nodeIdentifiers = new ArrayList<>();
711 nodeIdentifiers.add(NodeIdentifier.create(FOO_QNAME));
712 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
713 NormalizedNode<?, ?> payload = initInputAction(fooInputQname, "test");
715 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
716 XYZZY_FOO_PATH, domDataTreeIdentifier, payload);
718 Node childAction = checkBasePartOfActionRequest(actionRequest);
720 Node childBar = childAction.getFirstChild();
721 checkNode(childBar, "foo", "foo", URN_EXAMPLE_CONFLICT);
723 Node action = childBar.getLastChild();
724 checkNode(action, XYZZY_QNAME.getLocalName(), XYZZY_QNAME.getLocalName(),
725 XYZZY_QNAME.getNamespace().toString());
729 public void toActionRequestChoiceTest() {
730 List<PathArgument> nodeIdentifiers = new ArrayList<>();
731 nodeIdentifiers.add(NodeIdentifier.create(CONFLICT_CHOICE_QNAME));
732 nodeIdentifiers.add(NodeIdentifier.create(CHOICE_CONT_QNAME));
733 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
734 NormalizedNode<?, ?> payload = initEmptyInputAction(CHOICE_ACTION_QNAME);
736 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
737 CHOICE_ACTION_PATH, domDataTreeIdentifier, payload);
739 Node childAction = checkBasePartOfActionRequest(actionRequest);
741 Node childChoiceCont = childAction.getFirstChild();
742 checkNode(childChoiceCont, "choice-cont", "choice-cont", URN_EXAMPLE_CONFLICT);
744 Node action = childChoiceCont.getLastChild();
745 checkNode(action, CHOICE_ACTION_QNAME.getLocalName(), CHOICE_ACTION_QNAME.getLocalName(),
746 CHOICE_ACTION_QNAME.getNamespace().toString());
750 public void toAugmentedActionRequestListInContainerTest() {
751 QName nameQname = QName.create(INTERFACE_QNAME, "name");
753 List<PathArgument> nodeIdentifiers = new ArrayList<>();
754 nodeIdentifiers.add(NodeIdentifier.create(DEVICE_QNAME));
755 nodeIdentifiers.add(NodeIdentifier.create(INTERFACE_QNAME));
756 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(INTERFACE_QNAME, nameQname, "test"));
758 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
760 NormalizedNode<?, ?> payload = initEmptyInputAction(INTERFACE_QNAME);
761 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
762 DISABLE_INTERFACE_PATH, domDataTreeIdentifier, payload);
764 Node childAction = checkBasePartOfActionRequest(actionRequest);
766 Node childDevice = childAction.getFirstChild();
767 checkNode(childDevice, "device", "device", URN_EXAMPLE_SERVER_FARM);
769 Node childInterface = childDevice.getFirstChild();
770 checkNode(childInterface, "interface", "interface", URN_EXAMPLE_SERVER_FARM);
772 Node childName = childInterface.getFirstChild();
773 checkNode(childName, "name", "name", nameQname.getNamespace().toString());
775 Node childTest = childName.getFirstChild();
776 assertEquals(childTest.getNodeValue(), "test");
778 Node action = childInterface.getLastChild();
779 checkNode(action, DISABLE_QNAME.getLocalName(), DISABLE_QNAME.getLocalName(),
780 DISABLE_QNAME.getNamespace().toString());
783 @SuppressWarnings({ "rawtypes", "unchecked" })
785 public void toActionResultTest() throws Exception {
786 NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument(
787 "<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
788 + "<reset-finished-at xmlns=\"urn:example:server-farm\">"
790 + "</reset-finished-at>"
792 DOMActionResult actionResult = actionNetconfMessageTransformer.toActionResult(RESET_SERVER_PATH, message);
793 assertNotNull(actionResult);
794 ContainerNode containerNode = actionResult.getOutput().get();
795 assertNotNull(containerNode);
796 LeafNode<String> leaf = (LeafNode) containerNode.getValue().iterator().next();
797 assertEquals("now", leaf.getValue());
801 public void toActionEmptyBodyWithOutputDefinedResultTest() throws Exception {
802 NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument(
803 "<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
806 DOMActionResult actionResult =
807 actionNetconfMessageTransformer.toActionResult(CHECK_WITH_OUTPUT_INTERFACE_PATH, message);
808 assertNotNull(actionResult);
809 assertTrue(actionResult.getOutput().isEmpty());
813 public void toActionEmptyBodyWithoutOutputDefinedResultTest() throws Exception {
814 NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument(
815 "<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
818 DOMActionResult actionResult =
819 actionNetconfMessageTransformer.toActionResult(CHECK_WITHOUT_OUTPUT_INTERFACE_PATH, message);
820 assertNotNull(actionResult);
821 assertTrue(actionResult.getOutput().isEmpty());
824 private static void checkAction(final QName actionQname, final Node action , final String inputLocalName,
825 final String inputNodeName, final String inputValue) {
826 checkNode(action, actionQname.getLocalName(), actionQname.getLocalName(),
827 actionQname.getNamespace().toString());
829 Node childResetAt = action.getFirstChild();
830 checkNode(childResetAt, inputLocalName, inputNodeName, actionQname.getNamespace().toString());
832 Node firstChild = childResetAt.getFirstChild();
833 assertEquals(firstChild.getNodeValue(), inputValue);
836 private static Node checkBasePartOfActionRequest(final NetconfMessage actionRequest) {
837 Node baseRpc = actionRequest.getDocument().getFirstChild();
838 checkNode(baseRpc, "rpc", "rpc", NetconfUtil.NETCONF_QNAME.getNamespace().toString());
839 assertTrue(baseRpc.getLocalName().equals("rpc"));
840 assertTrue(baseRpc.getNodeName().equals("rpc"));
842 Node messageId = baseRpc.getAttributes().getNamedItem("message-id");
843 assertNotNull(messageId);
844 assertTrue(messageId.getNodeValue().contains("m-"));
846 Node childAction = baseRpc.getFirstChild();
847 checkNode(childAction, "action", "action", NetconfMessageTransformUtil.NETCONF_ACTION_NAMESPACE.toString());
851 private static DOMDataTreeIdentifier prepareDataTreeId(final List<PathArgument> nodeIdentifiers) {
852 YangInstanceIdentifier yangInstanceIdentifier =
853 YangInstanceIdentifier.builder().append(nodeIdentifiers).build();
854 DOMDataTreeIdentifier domDataTreeIdentifier =
855 new DOMDataTreeIdentifier(org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION,
856 yangInstanceIdentifier);
857 return domDataTreeIdentifier;
860 private static ContainerNode initInputAction(final QName qname, final String value) {
861 ImmutableLeafNodeBuilder<String> immutableLeafNodeBuilder = new ImmutableLeafNodeBuilder<>();
862 DataContainerChild<NodeIdentifier, String> build = immutableLeafNodeBuilder.withNodeIdentifier(
863 NodeIdentifier.create(qname)).withValue(value).build();
864 ContainerNode data = ImmutableContainerNodeBuilder.create().withNodeIdentifier(NodeIdentifier.create(
865 QName.create(qname, "input"))).withChild(build).build();
869 private static ContainerNode initEmptyInputAction(final QName qname) {
870 return ImmutableContainerNodeBuilder.create().withNodeIdentifier(NodeIdentifier.create(
871 QName.create(qname, "input"))).build();
874 private static void checkNode(final Node childServer, final String expectedLocalName, final String expectedNodeName,
875 final String expectedNamespace) {
876 assertNotNull(childServer);
877 assertEquals(childServer.getLocalName(), expectedLocalName);
878 assertEquals(childServer.getNodeName(), expectedNodeName);
879 assertEquals(childServer.getNamespaceURI(), expectedNamespace);