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.hamcrest.MatcherAssert.assertThat;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertNull;
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.AbstractBaseSchemasTest;
59 import org.opendaylight.netconf.sal.connect.netconf.schema.NetconfRemoteSchemaYangSourceProvider;
60 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
61 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil;
62 import org.opendaylight.netconf.util.NetconfUtil;
63 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.IetfNetconfService;
64 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState;
65 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities;
66 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Schemas;
67 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.schemas.Schema;
68 import org.opendaylight.yangtools.rcf8528.data.util.EmptyMountPointContext;
69 import org.opendaylight.yangtools.yang.common.QName;
70 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
71 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
72 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
73 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
74 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
75 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
76 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
77 import org.opendaylight.yangtools.yang.data.api.schema.DOMSourceAnyxmlNode;
78 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
79 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
80 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
81 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
82 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
83 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
84 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
85 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
86 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
87 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
88 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
89 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
90 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
91 import org.w3c.dom.Node;
92 import org.xml.sax.SAXException;
94 public class NetconfMessageTransformerTest extends AbstractBaseSchemasTest {
96 private static final String REVISION_EXAMPLE_SERVER_FARM = "2018-08-07";
97 private static final String URN_EXAMPLE_SERVER_FARM = "urn:example:server-farm";
99 private static final String REVISION_EXAMPLE_SERVER_FARM_2 = "2019-05-20";
100 private static final String URN_EXAMPLE_SERVER_FARM_2 = "urn:example:server-farm-2";
102 private static final String URN_EXAMPLE_CONFLICT = "urn:example:conflict";
104 private static final String URN_EXAMPLE_AUGMENTED_ACTION = "urn:example:augmented-action";
106 private static final String URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS = "urn:example:rpcs-actions-outputs";
108 private static final QName SERVER_QNAME =
109 QName.create(URN_EXAMPLE_SERVER_FARM, REVISION_EXAMPLE_SERVER_FARM, "server");
110 private static final QName RESET_QNAME = QName.create(SERVER_QNAME, "reset");
111 private static final SchemaPath RESET_SERVER_PATH = SchemaPath.create(true, SERVER_QNAME, RESET_QNAME);
112 private static final QName APPLICATIONS_QNAME = QName.create(URN_EXAMPLE_SERVER_FARM_2,
113 REVISION_EXAMPLE_SERVER_FARM_2, "applications");
114 private static final QName APPLICATION_QNAME = QName.create(APPLICATIONS_QNAME, "application");
115 private static final QName KILL_QNAME = QName.create(APPLICATION_QNAME, "kill");
116 private static final SchemaPath KILL_SERVER_APP_PATH =
117 SchemaPath.create(true, SERVER_QNAME, APPLICATIONS_QNAME, APPLICATION_QNAME, KILL_QNAME);
119 private static final QName DEVICE_QNAME =
120 QName.create(URN_EXAMPLE_SERVER_FARM, REVISION_EXAMPLE_SERVER_FARM, "device");
121 private static final QName START_QNAME = QName.create(DEVICE_QNAME, "start");
122 private static final SchemaPath START_DEVICE_PATH = SchemaPath.create(true, DEVICE_QNAME, START_QNAME);
123 private static final QName INTERFACE_QNAME = QName.create(DEVICE_QNAME, "interface");
124 private static final QName ENABLE_QNAME = QName.create(INTERFACE_QNAME, "enable");
125 private static final SchemaPath ENABLE_INTERFACE_PATH =
126 SchemaPath.create(true, DEVICE_QNAME, INTERFACE_QNAME, ENABLE_QNAME);
128 private static final QName DISABLE_QNAME = QName.create(URN_EXAMPLE_AUGMENTED_ACTION, "disable");
129 private static final SchemaPath DISABLE_INTERFACE_PATH =
130 SchemaPath.create(true, DEVICE_QNAME, INTERFACE_QNAME, DISABLE_QNAME);
132 private static final QName CHECK_WITH_OUTPUT_QNAME =
133 QName.create(URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS, "check-with-output");
134 private static final SchemaPath CHECK_WITH_OUTPUT_INTERFACE_PATH =
135 SchemaPath.create(true, DEVICE_QNAME, INTERFACE_QNAME, CHECK_WITH_OUTPUT_QNAME);
136 private static final QName CHECK_WITHOUT_OUTPUT_QNAME =
137 QName.create(URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS, "check-without-output");
138 private static final SchemaPath CHECK_WITHOUT_OUTPUT_INTERFACE_PATH =
139 SchemaPath.create(true, DEVICE_QNAME, INTERFACE_QNAME, CHECK_WITHOUT_OUTPUT_QNAME);
140 private static final QName RPC_WITH_OUTPUT_QNAME =
141 QName.create(URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS, "rpc-with-output");
142 private static final QName RPC_WITHOUT_OUTPUT_QNAME =
143 QName.create(URN_EXAMPLE_RPCS_ACTIONS_OUTPUTS, "rpc-without-output");
145 private static final QName BOX_OUT_QNAME =
146 QName.create(URN_EXAMPLE_SERVER_FARM, REVISION_EXAMPLE_SERVER_FARM, "box-out");
147 private static final QName BOX_IN_QNAME = QName.create(BOX_OUT_QNAME, "box-in");
148 private static final QName OPEN_QNAME = QName.create(BOX_IN_QNAME, "open");
149 private static final SchemaPath OPEN_BOXES_PATH =
150 SchemaPath.create(true, BOX_OUT_QNAME, BOX_IN_QNAME, OPEN_QNAME);
152 private static final QName FOO_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "foo");
153 private static final QName BAR_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "bar");
154 private static final QName XYZZY_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "xyzzy");
155 private static final SchemaPath XYZZY_FOO_PATH = SchemaPath.create(true, FOO_QNAME, XYZZY_QNAME);
156 private static final SchemaPath XYZZY_BAR_PATH = SchemaPath.create(true, BAR_QNAME, XYZZY_QNAME);
158 private static final QName CONFLICT_CHOICE_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "conflict-choice");
159 private static final QName CHOICE_CONT_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "choice-cont");
160 private static final QName CHOICE_ACTION_QNAME = QName.create(URN_EXAMPLE_CONFLICT, "choice-action");
161 private static final SchemaPath CHOICE_ACTION_PATH =
162 SchemaPath.create(true, CONFLICT_CHOICE_QNAME, CHOICE_CONT_QNAME, CHOICE_CONT_QNAME, CHOICE_ACTION_QNAME);
164 private static EffectiveModelContext PARTIAL_SCHEMA;
165 private static EffectiveModelContext SCHEMA;
166 private static EffectiveModelContext ACTION_SCHEMA;
168 private NetconfMessageTransformer actionNetconfMessageTransformer;
169 private NetconfMessageTransformer netconfMessageTransformer;
172 public static void beforeClass() {
173 PARTIAL_SCHEMA = BindingRuntimeHelpers.createEffectiveModel(NetconfState.class);
174 SCHEMA = BindingRuntimeHelpers.createEffectiveModel(IetfNetconfService.class, NetconfState.class);
175 ACTION_SCHEMA = YangParserTestUtils.parseYangResources(NetconfMessageTransformerTest.class,
176 "/schemas/example-server-farm.yang","/schemas/example-server-farm-2.yang",
177 "/schemas/conflicting-actions.yang", "/schemas/augmented-action.yang",
178 "/schemas/rpcs-actions-outputs.yang");
182 public static void afterClass() {
183 PARTIAL_SCHEMA = null;
185 ACTION_SCHEMA = null;
189 public void setUp() throws Exception {
190 XMLUnit.setIgnoreWhitespace(true);
191 XMLUnit.setIgnoreAttributeOrder(true);
192 XMLUnit.setIgnoreComments(true);
194 netconfMessageTransformer = getTransformer(SCHEMA);
195 actionNetconfMessageTransformer = new NetconfMessageTransformer(new EmptyMountPointContext(ACTION_SCHEMA),
196 true, BASE_SCHEMAS.getBaseSchema());
200 public void testLockRequestBaseSchemaNotPresent() throws Exception {
201 final NetconfMessageTransformer transformer = getTransformer(PARTIAL_SCHEMA);
202 final NetconfMessage netconfMessage = transformer.toRpcRequest(toPath(NETCONF_LOCK_QNAME),
203 NetconfBaseOps.getLockContent(NETCONF_CANDIDATE_QNAME));
205 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<lock"));
206 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<rpc"));
210 public void testCreateSubscriberNotificationSchemaNotPresent() throws Exception {
211 final NetconfMessageTransformer transformer = new NetconfMessageTransformer(new EmptyMountPointContext(SCHEMA),
212 true, BASE_SCHEMAS.getBaseSchemaWithNotifications());
213 NetconfMessage netconfMessage = transformer.toRpcRequest(
214 toPath(CREATE_SUBSCRIPTION_RPC_QNAME),
215 CREATE_SUBSCRIPTION_RPC_CONTENT
217 String documentString = XmlUtil.toString(netconfMessage.getDocument());
218 assertThat(documentString, CoreMatchers.containsString("<create-subscription"));
219 assertThat(documentString, CoreMatchers.containsString("<rpc"));
223 public void tesLockSchemaRequest() throws Exception {
224 final NetconfMessageTransformer transformer = getTransformer(PARTIAL_SCHEMA);
225 final String result = "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><ok/></rpc-reply>";
227 transformer.toRpcResult(new NetconfMessage(XmlUtil.readXmlToDocument(result)), toPath(NETCONF_LOCK_QNAME));
231 public void testRpcEmptyBodyWithOutputDefinedSchemaResult() throws Exception {
232 final String result = "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><ok/></rpc-reply>";
234 DOMRpcResult domRpcResult = actionNetconfMessageTransformer
235 .toRpcResult(new NetconfMessage(XmlUtil.readXmlToDocument(result)),
236 toPath(RPC_WITH_OUTPUT_QNAME));
237 assertNotNull(domRpcResult);
241 public void testRpcEmptyBodyWithoutOutputDefinedSchemaResult() throws Exception {
242 final String result = "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><ok/></rpc-reply>";
244 DOMRpcResult domRpcResult = actionNetconfMessageTransformer
245 .toRpcResult(new NetconfMessage(XmlUtil.readXmlToDocument(result)),
246 toPath(RPC_WITHOUT_OUTPUT_QNAME));
247 assertNotNull(domRpcResult);
251 public void testDiscardChangesRequest() throws Exception {
252 final NetconfMessage netconfMessage =
253 netconfMessageTransformer.toRpcRequest(toPath(NETCONF_DISCARD_CHANGES_QNAME), null);
254 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<discard"));
255 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<rpc"));
256 assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("message-id"));
260 public void testGetSchemaRequest() throws Exception {
261 final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(GET_SCHEMA_QNAME),
262 NetconfRemoteSchemaYangSourceProvider.createGetSchemaRequest("module", Optional.of("2012-12-12")));
263 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
264 + "<get-schema xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
265 + "<format>yang</format>\n"
266 + "<identifier>module</identifier>\n"
267 + "<version>2012-12-12</version>\n"
273 public void testGetSchemaResponse() throws Exception {
274 final NetconfMessageTransformer transformer = getTransformer(SCHEMA);
275 final NetconfMessage response = new NetconfMessage(XmlUtil.readXmlToDocument(
276 "<rpc-reply message-id=\"101\"\n"
277 + "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
279 + "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
280 + "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n"
281 + "Random YANG SCHEMA\n"
286 final DOMRpcResult compositeNodeRpcResult = transformer.toRpcResult(response, toPath(GET_SCHEMA_QNAME));
287 assertTrue(compositeNodeRpcResult.getErrors().isEmpty());
288 assertNotNull(compositeNodeRpcResult.getResult());
289 final DOMSource schemaContent = ((DOMSourceAnyxmlNode) ((ContainerNode) compositeNodeRpcResult.getResult())
290 .getValue().iterator().next()).getValue();
291 assertThat(schemaContent.getNode().getTextContent(),
292 CoreMatchers.containsString("Random YANG SCHEMA"));
296 public void testGetConfigResponse() throws Exception {
297 final NetconfMessage response = new NetconfMessage(XmlUtil.readXmlToDocument("<rpc-reply message-id=\"101\"\n"
298 + "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
300 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
303 + "<identifier>module</identifier>\n"
304 + "<version>2012-12-12</version>\n"
305 + "<format xmlns:x=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">x:yang</format>\n"
308 + "</netconf-state>\n"
312 final NetconfMessageTransformer transformer = getTransformer(SCHEMA);
313 final DOMRpcResult compositeNodeRpcResult =
314 transformer.toRpcResult(response, toPath(NETCONF_GET_CONFIG_QNAME));
315 assertTrue(compositeNodeRpcResult.getErrors().isEmpty());
316 assertNotNull(compositeNodeRpcResult.getResult());
318 final List<DataContainerChild<?, ?>> values = Lists.newArrayList(
319 NetconfRemoteSchemaYangSourceProvider
320 .createGetSchemaRequest("module", Optional.of("2012-12-12")).getValue());
322 final Map<QName, Object> keys = new HashMap<>();
323 for (final DataContainerChild<?, ?> value : values) {
324 keys.put(value.getNodeType(), value.getValue());
327 final NodeIdentifierWithPredicates identifierWithPredicates =
328 NodeIdentifierWithPredicates.of(Schema.QNAME, keys);
329 final MapEntryNode schemaNode =
330 Builders.mapEntryBuilder().withNodeIdentifier(identifierWithPredicates).withValue(values).build();
332 final DOMSourceAnyxmlNode data = (DOMSourceAnyxmlNode) ((ContainerNode) compositeNodeRpcResult.getResult())
333 .getChild(toId(NETCONF_DATA_QNAME)).get();
335 NormalizedNodeResult nodeResult =
336 NetconfUtil.transformDOMSourceToNormalizedNode(SCHEMA, data.getValue());
337 ContainerNode result = (ContainerNode) nodeResult.getResult();
338 final ContainerNode state = (ContainerNode) result.getChild(toId(NetconfState.QNAME)).get();
339 final ContainerNode schemas = (ContainerNode) state.getChild(toId(Schemas.QNAME)).get();
340 final MapNode schemaParent = (MapNode) schemas.getChild(toId(Schema.QNAME)).get();
341 assertEquals(1, Iterables.size(schemaParent.getValue()));
343 assertEquals(schemaNode, schemaParent.getValue().iterator().next());
347 public void testGetConfigLeafRequest() throws Exception {
348 final DataContainerChild<?, ?> filter = toFilterStructure(
349 YangInstanceIdentifier.create(toId(NetconfState.QNAME), toId(Schemas.QNAME), toId(Schema.QNAME),
350 NodeIdentifierWithPredicates.of(Schema.QNAME),
351 toId(QName.create(Schemas.QNAME, "version"))), SCHEMA);
353 final DataContainerChild<?, ?> source = NetconfBaseOps.getSourceNode(NETCONF_RUNNING_QNAME);
355 final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(NETCONF_GET_CONFIG_QNAME),
356 NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, source, filter));
358 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
359 + "<get-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
360 + "<filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\">\n"
361 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
367 + "</netconf-state>\n"
377 public void testGetConfigRequest() throws Exception {
378 final DataContainerChild<?, ?> filter = toFilterStructure(
379 YangInstanceIdentifier.create(toId(NetconfState.QNAME), toId(Schemas.QNAME)), SCHEMA);
381 final DataContainerChild<?, ?> source = NetconfBaseOps.getSourceNode(NETCONF_RUNNING_QNAME);
383 final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(NETCONF_GET_CONFIG_QNAME),
384 NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, source, filter));
386 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
387 + "<get-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
388 + "<filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\">\n"
389 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
401 public void testEditConfigRequest() throws Exception {
402 final List<DataContainerChild<?, ?>> values = Lists.newArrayList(
403 NetconfRemoteSchemaYangSourceProvider
404 .createGetSchemaRequest("module", Optional.of("2012-12-12")).getValue());
406 final Map<QName, Object> keys = new HashMap<>();
407 for (final DataContainerChild<?, ?> value : values) {
408 keys.put(value.getNodeType(), value.getValue());
411 final NodeIdentifierWithPredicates identifierWithPredicates =
412 NodeIdentifierWithPredicates.of(Schema.QNAME, keys);
413 final MapEntryNode schemaNode =
414 Builders.mapEntryBuilder().withNodeIdentifier(identifierWithPredicates).withValue(values).build();
416 final YangInstanceIdentifier id = YangInstanceIdentifier.builder()
417 .node(NetconfState.QNAME).node(Schemas.QNAME).node(Schema.QNAME)
418 .nodeWithKey(Schema.QNAME, keys).build();
419 final DataContainerChild<?, ?> editConfigStructure =
420 createEditConfigStructure(BASE_SCHEMAS.getBaseSchemaWithNotifications().getEffectiveModelContext(), id,
421 Optional.empty(), Optional.ofNullable(schemaNode));
423 final DataContainerChild<?, ?> target = NetconfBaseOps.getTargetNode(NETCONF_CANDIDATE_QNAME);
425 final ContainerNode wrap =
426 NetconfMessageTransformUtil.wrap(NETCONF_EDIT_CONFIG_QNAME, editConfigStructure, target);
427 final NetconfMessage netconfMessage =
428 netconfMessageTransformer.toRpcRequest(toPath(NETCONF_EDIT_CONFIG_QNAME), wrap);
430 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
436 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
439 + "<identifier>module</identifier>\n"
440 + "<version>2012-12-12</version>\n"
441 + "<format>yang</format>\n"
444 + "</netconf-state>\n"
450 private static void assertSimilarXml(final NetconfMessage netconfMessage, final String xmlContent)
451 throws SAXException, IOException {
452 final Diff diff = XMLUnit.compareXML(netconfMessage.getDocument(), XmlUtil.readXmlToDocument(xmlContent));
453 diff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
454 assertTrue(diff.toString(), diff.similar());
458 public void testGetRequest() throws Exception {
460 final QName capability = QName.create(Capabilities.QNAME, "capability");
461 final DataContainerChild<?, ?> filter = toFilterStructure(
462 YangInstanceIdentifier.create(toId(NetconfState.QNAME), toId(Capabilities.QNAME), toId(capability),
463 new NodeWithValue<>(capability, "a:b:c")), SCHEMA);
465 final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(toPath(NETCONF_GET_QNAME),
466 NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, filter));
468 assertSimilarXml(netconfMessage, "<rpc message-id=\"m-0\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
469 + "<get xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
470 + "<filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\">\n"
471 + "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">\n"
473 + "<capability>a:b:c</capability>\n"
474 + "</capabilities>\n"
481 private static NetconfMessageTransformer getTransformer(final EffectiveModelContext schema) {
482 return new NetconfMessageTransformer(new EmptyMountPointContext(schema), true, BASE_SCHEMAS.getBaseSchema());
486 public void testCommitResponse() throws Exception {
487 final NetconfMessage response = new NetconfMessage(XmlUtil.readXmlToDocument(
488 "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><ok/></rpc-reply>"
490 final DOMRpcResult compositeNodeRpcResult =
491 netconfMessageTransformer.toRpcResult(response, toPath(NETCONF_COMMIT_QNAME));
492 assertTrue(compositeNodeRpcResult.getErrors().isEmpty());
493 assertNull(compositeNodeRpcResult.getResult());
497 public void getActionsTest() {
498 Set<SchemaPath> schemaPaths = new HashSet<>();
499 schemaPaths.add(RESET_SERVER_PATH);
500 schemaPaths.add(START_DEVICE_PATH);
501 schemaPaths.add(ENABLE_INTERFACE_PATH);
502 schemaPaths.add(OPEN_BOXES_PATH);
503 schemaPaths.add(KILL_SERVER_APP_PATH);
504 schemaPaths.add(XYZZY_FOO_PATH);
505 schemaPaths.add(XYZZY_BAR_PATH);
506 schemaPaths.add(CHOICE_ACTION_PATH);
507 schemaPaths.add(DISABLE_INTERFACE_PATH);
508 schemaPaths.add(CHECK_WITH_OUTPUT_INTERFACE_PATH);
509 schemaPaths.add(CHECK_WITHOUT_OUTPUT_INTERFACE_PATH);
511 List<ActionDefinition> actions = NetconfMessageTransformer.getActions(ACTION_SCHEMA);
512 assertEquals(schemaPaths.size(), actions.size());
513 for (ActionDefinition actionDefinition : actions) {
514 SchemaPath path = actionDefinition.getPath();
515 assertTrue(schemaPaths.remove(path));
520 public void toActionRequestListTopLevelTest() {
521 QName nameQname = QName.create(SERVER_QNAME, "name");
522 List<PathArgument> nodeIdentifiers = new ArrayList<>();
523 nodeIdentifiers.add(new NodeIdentifier(SERVER_QNAME));
524 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(SERVER_QNAME, nameQname, "test"));
525 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
527 ContainerNode data = initInputAction(QName.create(SERVER_QNAME, "reset-at"), "now");
529 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
530 RESET_SERVER_PATH, domDataTreeIdentifier, data);
532 Node childAction = checkBasePartOfActionRequest(actionRequest);
534 Node childServer = childAction.getFirstChild();
535 checkNode(childServer, "server", "server", URN_EXAMPLE_SERVER_FARM);
537 Node childName = childServer.getFirstChild();
538 checkNode(childName, "name", "name", URN_EXAMPLE_SERVER_FARM);
540 Node childTest = childName.getFirstChild();
541 assertEquals(childTest.getNodeValue(), "test");
543 checkAction(RESET_QNAME, childName.getNextSibling(), "reset-at", "reset-at", "now");
547 public void toActionRequestContainerTopLevelTest() {
548 List<PathArgument> nodeIdentifiers = Collections.singletonList(NodeIdentifier.create(DEVICE_QNAME));
549 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
551 NormalizedNode<?, ?> payload = initInputAction(QName.create(DEVICE_QNAME, "start-at"), "now");
552 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
553 START_DEVICE_PATH, domDataTreeIdentifier, payload);
555 Node childAction = checkBasePartOfActionRequest(actionRequest);
557 Node childDevice = childAction.getFirstChild();
558 checkNode(childDevice, "device", "device", URN_EXAMPLE_SERVER_FARM);
560 checkAction(START_QNAME, childDevice.getFirstChild(), "start-at", "start-at", "now");
564 public void toActionRequestContainerInContainerTest() {
565 List<PathArgument> nodeIdentifiers = new ArrayList<>();
566 nodeIdentifiers.add(NodeIdentifier.create(BOX_OUT_QNAME));
567 nodeIdentifiers.add(NodeIdentifier.create(BOX_IN_QNAME));
569 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
571 NormalizedNode<?, ?> payload = initInputAction(QName.create(BOX_OUT_QNAME, "start-at"), "now");
572 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
573 OPEN_BOXES_PATH, domDataTreeIdentifier, payload);
575 Node childAction = checkBasePartOfActionRequest(actionRequest);
577 Node childBoxOut = childAction.getFirstChild();
578 checkNode(childBoxOut, "box-out", "box-out", URN_EXAMPLE_SERVER_FARM);
580 Node childBoxIn = childBoxOut.getFirstChild();
581 checkNode(childBoxIn, "box-in", "box-in", URN_EXAMPLE_SERVER_FARM);
583 Node action = childBoxIn.getFirstChild();
584 checkNode(action, OPEN_QNAME.getLocalName(), OPEN_QNAME.getLocalName(), OPEN_QNAME.getNamespace().toString());
588 public void toActionRequestListInContainerTest() {
589 QName nameQname = QName.create(INTERFACE_QNAME, "name");
591 List<PathArgument> nodeIdentifiers = new ArrayList<>();
592 nodeIdentifiers.add(NodeIdentifier.create(DEVICE_QNAME));
593 nodeIdentifiers.add(NodeIdentifier.create(INTERFACE_QNAME));
594 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(INTERFACE_QNAME, nameQname, "test"));
596 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
598 NormalizedNode<?, ?> payload = initEmptyInputAction(INTERFACE_QNAME);
599 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
600 ENABLE_INTERFACE_PATH, domDataTreeIdentifier, payload);
602 Node childAction = checkBasePartOfActionRequest(actionRequest);
604 Node childDevice = childAction.getFirstChild();
605 checkNode(childDevice, "device", "device", URN_EXAMPLE_SERVER_FARM);
607 Node childInterface = childDevice.getFirstChild();
608 checkNode(childInterface, "interface", "interface", URN_EXAMPLE_SERVER_FARM);
610 Node childName = childInterface.getFirstChild();
611 checkNode(childName, "name", "name", nameQname.getNamespace().toString());
613 Node childTest = childName.getFirstChild();
614 assertEquals(childTest.getNodeValue(), "test");
616 Node action = childInterface.getLastChild();
617 checkNode(action, ENABLE_QNAME.getLocalName(), ENABLE_QNAME.getLocalName(),
618 ENABLE_QNAME.getNamespace().toString());
622 public void toActionRequestListInContainerAugmentedIntoListTest() {
623 QName serverNameQname = QName.create(SERVER_QNAME, "name");
624 QName applicationNameQname = QName.create(APPLICATION_QNAME, "name");
626 List<PathArgument> nodeIdentifiers = new ArrayList<>();
627 nodeIdentifiers.add(NodeIdentifier.create(SERVER_QNAME));
628 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(SERVER_QNAME, serverNameQname, "testServer"));
629 nodeIdentifiers.add(new AugmentationIdentifier(Collections.singleton(APPLICATIONS_QNAME)));
630 nodeIdentifiers.add(NodeIdentifier.create(APPLICATIONS_QNAME));
631 nodeIdentifiers.add(NodeIdentifier.create(APPLICATION_QNAME));
632 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(APPLICATION_QNAME,
633 applicationNameQname, "testApplication"));
635 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
637 NormalizedNode<?, ?> payload = initEmptyInputAction(APPLICATION_QNAME);
638 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
639 KILL_SERVER_APP_PATH, domDataTreeIdentifier, payload);
641 Node childAction = checkBasePartOfActionRequest(actionRequest);
643 Node childServer = childAction.getFirstChild();
644 checkNode(childServer, "server", "server", URN_EXAMPLE_SERVER_FARM);
646 Node childServerName = childServer.getFirstChild();
647 checkNode(childServerName, "name", "name", URN_EXAMPLE_SERVER_FARM);
649 Node childServerNameTest = childServerName.getFirstChild();
650 assertEquals(childServerNameTest.getNodeValue(), "testServer");
652 Node childApplications = childServer.getLastChild();
653 checkNode(childApplications, "applications", "applications", URN_EXAMPLE_SERVER_FARM_2);
655 Node childApplication = childApplications.getFirstChild();
656 checkNode(childApplication, "application", "application", URN_EXAMPLE_SERVER_FARM_2);
658 Node childApplicationName = childApplication.getFirstChild();
659 checkNode(childApplicationName, "name", "name", URN_EXAMPLE_SERVER_FARM_2);
661 Node childApplicationNameTest = childApplicationName.getFirstChild();
662 assertEquals(childApplicationNameTest.getNodeValue(), "testApplication");
664 Node childKillAction = childApplication.getLastChild();
665 checkNode(childApplication, "application", "application", URN_EXAMPLE_SERVER_FARM_2);
666 checkNode(childKillAction, KILL_QNAME.getLocalName(), KILL_QNAME.getLocalName(),
667 KILL_QNAME.getNamespace().toString());
671 public void toActionRequestConflictingInListTest() {
672 QName barInputQname = QName.create(BAR_QNAME, "bar");
673 QName barIdQname = QName.create(BAR_QNAME, "bar-id");
674 Byte barInput = new Byte("1");
676 List<PathArgument> nodeIdentifiers = new ArrayList<>();
677 nodeIdentifiers.add(NodeIdentifier.create(BAR_QNAME));
678 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(BAR_QNAME, barIdQname, "test"));
680 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
682 ImmutableLeafNodeBuilder<Byte> immutableLeafNodeBuilder = new ImmutableLeafNodeBuilder<>();
683 DataContainerChild<NodeIdentifier, Byte> build = immutableLeafNodeBuilder.withNodeIdentifier(
684 NodeIdentifier.create(barInputQname)).withValue(barInput).build();
685 NormalizedNode<?, ?> payload = ImmutableContainerNodeBuilder.create().withNodeIdentifier(NodeIdentifier.create(
686 QName.create(barInputQname, "input"))).withChild(build).build();
688 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
689 XYZZY_BAR_PATH, domDataTreeIdentifier, payload);
691 Node childAction = checkBasePartOfActionRequest(actionRequest);
693 Node childBar = childAction.getFirstChild();
694 checkNode(childBar, "bar", "bar", URN_EXAMPLE_CONFLICT);
696 Node childBarId = childBar.getFirstChild();
697 checkNode(childBarId, "bar-id", "bar-id", URN_EXAMPLE_CONFLICT);
699 Node childTest = childBarId.getFirstChild();
700 assertEquals(childTest.getNodeValue(), "test");
702 Node action = childBar.getLastChild();
703 checkNode(action, XYZZY_QNAME.getLocalName(), XYZZY_QNAME.getLocalName(),
704 XYZZY_QNAME.getNamespace().toString());
708 public void toActionRequestConflictingInContainerTest() {
709 QName fooInputQname = QName.create(FOO_QNAME, "foo");
711 List<PathArgument> nodeIdentifiers = new ArrayList<>();
712 nodeIdentifiers.add(NodeIdentifier.create(FOO_QNAME));
713 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
714 NormalizedNode<?, ?> payload = initInputAction(fooInputQname, "test");
716 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
717 XYZZY_FOO_PATH, domDataTreeIdentifier, payload);
719 Node childAction = checkBasePartOfActionRequest(actionRequest);
721 Node childBar = childAction.getFirstChild();
722 checkNode(childBar, "foo", "foo", URN_EXAMPLE_CONFLICT);
724 Node action = childBar.getLastChild();
725 checkNode(action, XYZZY_QNAME.getLocalName(), XYZZY_QNAME.getLocalName(),
726 XYZZY_QNAME.getNamespace().toString());
730 public void toActionRequestChoiceTest() {
731 List<PathArgument> nodeIdentifiers = new ArrayList<>();
732 nodeIdentifiers.add(NodeIdentifier.create(CONFLICT_CHOICE_QNAME));
733 nodeIdentifiers.add(NodeIdentifier.create(CHOICE_CONT_QNAME));
734 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
735 NormalizedNode<?, ?> payload = initEmptyInputAction(CHOICE_ACTION_QNAME);
737 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
738 CHOICE_ACTION_PATH, domDataTreeIdentifier, payload);
740 Node childAction = checkBasePartOfActionRequest(actionRequest);
742 Node childChoiceCont = childAction.getFirstChild();
743 checkNode(childChoiceCont, "choice-cont", "choice-cont", URN_EXAMPLE_CONFLICT);
745 Node action = childChoiceCont.getLastChild();
746 checkNode(action, CHOICE_ACTION_QNAME.getLocalName(), CHOICE_ACTION_QNAME.getLocalName(),
747 CHOICE_ACTION_QNAME.getNamespace().toString());
751 public void toAugmentedActionRequestListInContainerTest() {
752 QName nameQname = QName.create(INTERFACE_QNAME, "name");
754 List<PathArgument> nodeIdentifiers = new ArrayList<>();
755 nodeIdentifiers.add(NodeIdentifier.create(DEVICE_QNAME));
756 nodeIdentifiers.add(NodeIdentifier.create(INTERFACE_QNAME));
757 nodeIdentifiers.add(NodeIdentifierWithPredicates.of(INTERFACE_QNAME, nameQname, "test"));
759 DOMDataTreeIdentifier domDataTreeIdentifier = prepareDataTreeId(nodeIdentifiers);
761 NormalizedNode<?, ?> payload = initEmptyInputAction(INTERFACE_QNAME);
762 NetconfMessage actionRequest = actionNetconfMessageTransformer.toActionRequest(
763 DISABLE_INTERFACE_PATH, domDataTreeIdentifier, payload);
765 Node childAction = checkBasePartOfActionRequest(actionRequest);
767 Node childDevice = childAction.getFirstChild();
768 checkNode(childDevice, "device", "device", URN_EXAMPLE_SERVER_FARM);
770 Node childInterface = childDevice.getFirstChild();
771 checkNode(childInterface, "interface", "interface", URN_EXAMPLE_SERVER_FARM);
773 Node childName = childInterface.getFirstChild();
774 checkNode(childName, "name", "name", nameQname.getNamespace().toString());
776 Node childTest = childName.getFirstChild();
777 assertEquals(childTest.getNodeValue(), "test");
779 Node action = childInterface.getLastChild();
780 checkNode(action, DISABLE_QNAME.getLocalName(), DISABLE_QNAME.getLocalName(),
781 DISABLE_QNAME.getNamespace().toString());
784 @SuppressWarnings({ "rawtypes", "unchecked" })
786 public void toActionResultTest() throws Exception {
787 NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument(
788 "<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
789 + "<reset-finished-at xmlns=\"urn:example:server-farm\">"
791 + "</reset-finished-at>"
793 DOMActionResult actionResult = actionNetconfMessageTransformer.toActionResult(RESET_SERVER_PATH, message);
794 assertNotNull(actionResult);
795 ContainerNode containerNode = actionResult.getOutput().get();
796 assertNotNull(containerNode);
797 LeafNode<String> leaf = (LeafNode) containerNode.getValue().iterator().next();
798 assertEquals("now", leaf.getValue());
802 public void toActionEmptyBodyWithOutputDefinedResultTest() throws Exception {
803 NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument(
804 "<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
807 DOMActionResult actionResult =
808 actionNetconfMessageTransformer.toActionResult(CHECK_WITH_OUTPUT_INTERFACE_PATH, message);
809 assertNotNull(actionResult);
810 assertTrue(actionResult.getOutput().isEmpty());
814 public void toActionEmptyBodyWithoutOutputDefinedResultTest() throws Exception {
815 NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument(
816 "<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
819 DOMActionResult actionResult =
820 actionNetconfMessageTransformer.toActionResult(CHECK_WITHOUT_OUTPUT_INTERFACE_PATH, message);
821 assertNotNull(actionResult);
822 assertTrue(actionResult.getOutput().isEmpty());
825 private static void checkAction(final QName actionQname, final Node action , final String inputLocalName,
826 final String inputNodeName, final String inputValue) {
827 checkNode(action, actionQname.getLocalName(), actionQname.getLocalName(),
828 actionQname.getNamespace().toString());
830 Node childResetAt = action.getFirstChild();
831 checkNode(childResetAt, inputLocalName, inputNodeName, actionQname.getNamespace().toString());
833 Node firstChild = childResetAt.getFirstChild();
834 assertEquals(firstChild.getNodeValue(), inputValue);
837 private static Node checkBasePartOfActionRequest(final NetconfMessage actionRequest) {
838 Node baseRpc = actionRequest.getDocument().getFirstChild();
839 checkNode(baseRpc, "rpc", "rpc", NetconfUtil.NETCONF_QNAME.getNamespace().toString());
840 assertTrue(baseRpc.getLocalName().equals("rpc"));
841 assertTrue(baseRpc.getNodeName().equals("rpc"));
843 Node messageId = baseRpc.getAttributes().getNamedItem("message-id");
844 assertNotNull(messageId);
845 assertTrue(messageId.getNodeValue().contains("m-"));
847 Node childAction = baseRpc.getFirstChild();
848 checkNode(childAction, "action", "action", NetconfMessageTransformUtil.NETCONF_ACTION_NAMESPACE.toString());
852 private static DOMDataTreeIdentifier prepareDataTreeId(final List<PathArgument> nodeIdentifiers) {
853 YangInstanceIdentifier yangInstanceIdentifier =
854 YangInstanceIdentifier.builder().append(nodeIdentifiers).build();
855 DOMDataTreeIdentifier domDataTreeIdentifier =
856 new DOMDataTreeIdentifier(org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION,
857 yangInstanceIdentifier);
858 return domDataTreeIdentifier;
861 private static ContainerNode initInputAction(final QName qname, final String value) {
862 ImmutableLeafNodeBuilder<String> immutableLeafNodeBuilder = new ImmutableLeafNodeBuilder<>();
863 DataContainerChild<NodeIdentifier, String> build = immutableLeafNodeBuilder.withNodeIdentifier(
864 NodeIdentifier.create(qname)).withValue(value).build();
865 ContainerNode data = ImmutableContainerNodeBuilder.create().withNodeIdentifier(NodeIdentifier.create(
866 QName.create(qname, "input"))).withChild(build).build();
870 private static ContainerNode initEmptyInputAction(final QName qname) {
871 return ImmutableContainerNodeBuilder.create().withNodeIdentifier(NodeIdentifier.create(
872 QName.create(qname, "input"))).build();
875 private static void checkNode(final Node childServer, final String expectedLocalName, final String expectedNodeName,
876 final String expectedNamespace) {
877 assertNotNull(childServer);
878 assertEquals(childServer.getLocalName(), expectedLocalName);
879 assertEquals(childServer.getNodeName(), expectedNodeName);
880 assertEquals(childServer.getNamespaceURI(), expectedNamespace);