Bug fix to add anyxml node.
[ccsdk/sli/plugins.git] / restconf-client / provider / src / test / java / org / onap / ccsdk / sli / plugins / yangserializers / dfserializer / DataFormatUtilsTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - CCSDK
4  * ================================================================================
5  * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.ccsdk.sli.plugins.yangserializers.dfserializer;
22
23 /**
24  * Unit test case utilities for data format serializer and restconf api call
25  * node.
26  */
27 public final class DataFormatUtilsTest {
28
29     static final String ENCODE_TO_JSON_ID_COMMON = "\n        \"interfaces\"" +
30             ": " +
31             "{\n" +
32             "            \"int-list\": [\n" +
33             "                {\n" +
34             "                    \"iden\": \"optical\",\n" +
35             "                    \"available\": {\n" +
36             "                        \"ll\": [\n" +
37             "                            \"Giga\",\n" +
38             "                            \"identity-types:Loopback\",\n" +
39             "                            \"identity-types-second:Ethernet" +
40             "\"\n" +
41             "                        ],\n" +
42             "                        \"leaf1\": \"58\",\n" +
43             "                        \"leaf2\": \"identity-types-second:iden" +
44             "2\"\n" +
45             "                    }\n" +
46             "                },\n" +
47             "                {\n" +
48             "                    \"iden\": \"214748364\",\n" +
49             "                    \"available\": {\n" +
50             "                        \"ll\": [\n" +
51             "                            \"Giga\",\n" +
52             "                            \"identity-types:Loopback\",\n" +
53             "                            \"identity-types-second:Ethernet" +
54             "\"\n" +
55             "                        ],\n" +
56             "                        \"leaf1\": \"8888\",\n" +
57             "                        \"leaf2\": \"identity-types-second:ide" +
58             "n2\"\n" +
59             "                    }\n" +
60             "                }\n" +
61             "            ]\n" +
62             "        },\n" +
63             "        \"interface\": \"identity-types:physical\"\n" +
64             "    }";
65
66     static final String ENCODE_TO_JSON_ID = "{\n" +
67             "    \"identity-test:con1\": {" + ENCODE_TO_JSON_ID_COMMON +
68             ",\n" +
69             "    \"identity-test:l\": \"abc\"\n" +
70             "}";
71
72     static final String ENCODE_TO_ANYXML = "{\n" +
73             "    \"actionIdentifiers\": {\n" +
74             "        \"mode\": \"sync\",\n" +
75             "        \"blueprintName\": \"baseconfiguration\",\n" +
76             "        \"blueprintVersion\": \"1.0.0\",\n" +
77             "        \"actionName\": \"assign-activate\"\n" +
78             "    },\n" +
79             "    \"payload\": {\n" +
80             "        \"template-prefix\": \"vDNS-test\",\n" +
81             "        \"resource-assignment-request\": {\n" +
82             "            \"resource-assignment-properties\": {\n" +
83             "                \"service-instance-id\": \"1234\",\n" +
84             "                \"vnf-id\": \"3526\",\n" +
85             "                \"customer-name\": \"htipl\",\n" +
86             "                \"subscriber-name\": \"huawei\"\n" +
87             "            }\n" +
88             "        }\n" +
89             "    },\n" +
90             "    \"commonHeader\": {\n" +
91             "        \"subRequestId\": \"sub-123456-1000\",\n" +
92             "        \"requestId\": \"123456-1000\",\n" +
93             "        \"originatorId\": \"SDNC_DG\"\n" +
94             "    }\n" +
95             "}";
96
97     static final String ENCODE_TO_JSON_ID_PUT = "{\n" +
98             "    \"identity-test:test\": {\n" +
99             "        \"con1\": {" + addSpace(ENCODE_TO_JSON_ID_COMMON, 4) +
100             ",\n" +
101             "        \"l\": \"abc\"\n" +
102             "    }\n" +
103             "}";
104
105     static final String ENCODE_TO_XML_ID_COMMON = "\n    <interfaces>\n" +
106             "        <int-list>\n" +
107             "            <iden>optical</iden>\n" +
108             "            <available>\n" +
109             "                <ll>Giga</ll>\n" +
110             "                <ll xmlns:yangid=\"identity:list:ns:test:json:se" +
111             "r\">yangid:Loopback</ll>\n" +
112             "                <ll xmlns:yangid=\"identity:list:second:ns:test" +
113             ":json:ser\">yangid:Ethernet</ll>\n" +
114             "                <leaf1>58</leaf1>\n" +
115             "                <leaf2 xmlns:yangid=\"identity:list:second:ns:t" +
116             "est:json:ser\">yangid:iden2</leaf2>\n" +
117             "            </available>\n" +
118             "        </int-list>\n" +
119             "        <int-list>\n" +
120             "            <iden>214748364</iden>\n" +
121             "            <available>\n" +
122             "                <ll>Giga</ll>\n" +
123             "                <ll xmlns:yangid=\"identity:list:ns:test:json:s" +
124             "er\">yangid:Loopback</ll>\n" +
125             "                <ll xmlns:yangid=\"identity:list:second:ns:test" +
126             ":json:ser\">yangid:Ethernet</ll>\n" +
127             "                <leaf1>8888</leaf1>\n" +
128             "                <leaf2 xmlns:yangid=\"identity:list:second:ns:t" +
129             "est:json:ser\">yangid:iden2</leaf2>\n" +
130             "            </available>\n" +
131             "        </int-list>\n" +
132             "    </interfaces>\n" +
133             "    <interface xmlns:yangid=\"identity:list:ns:test:json:ser\">" +
134             "yangid:physical</interface>";
135
136     static final String ENCODE_TO_XML_ID = "<?xml version=\"1.0\" encoding=" +
137             "\"UTF-8\" standalone=\"no\"?>\n" +
138             "<con1 xmlns=\"identity:ns:test:json:ser\">" +
139             ENCODE_TO_XML_ID_COMMON + "\n</con1>\n";
140
141     static final String ENCODE_TO_XML_ID_PUT = "<?xml version=\"1.0\" enco" +
142             "ding=\"UTF-8\" standalone=\"no\"?>\n" +
143             "<test xmlns=\"identity:ns:test:json:ser\">\n" +
144             "    <con1>" + addSpace(ENCODE_TO_XML_ID_COMMON, 4)
145             + "\n    </con1>\n" +
146             "</test>\n";
147
148     static final String ENCODE_TO_JSON_YANG_COMMON = "\n    " +
149             "\"test-augment:ll6\": [\n" +
150             "        \"unbounded\",\n" +
151             "        \"8\"\n" +
152             "    ],\n" +
153             "    \"test-augment:cont13\": {\n" +
154             "        \"ll9\": [\n" +
155             "            \"abc\",\n" +
156             "            \"abc\"\n" +
157             "        ],\n" +
158             "        \"list9\": [\n" +
159             "            {\n" +
160             "                \"leaf27\": \"abc\"\n" +
161             "            },\n" +
162             "            {\n" +
163             "                \"leaf27\": \"abc\"\n" +
164             "            }\n" +
165             "        ],\n" +
166             "        \"leaf28\": \"abc\",\n" +
167             "        \"cont12\": {\n" +
168             "            \"leaf26\": \"abc\"\n" +
169             "        }\n" +
170             "    },\n" +
171             "    \"test-augment:list7\": [\n" +
172             "        {\n" +
173             "            \"leaf14\": \"test\"\n" +
174             "        },\n" +
175             "        {\n" +
176             "            \"leaf14\": \"create\"\n" +
177             "        }\n" +
178             "    ],\n" +
179             "    \"test-augment:leaf15\": \"abc\",\n" +
180             "    \"test-augment:cont5\": {\n" +
181             "        \"leaf13\": \"true\"\n" +
182             "    }";
183
184     static final String ENCODE_TO_JSON_YANG_AUG_POST = "{\n" +
185             "    \"test-yang:leaf10\": \"abc\"," +
186             ENCODE_TO_JSON_YANG_COMMON + "\n}";
187
188     static final String ENCODE_TO_JSON_YANG = "{\n" +
189             "    \"test-yang:cont2\": {\n" +
190             "        \"list1\": [\n" +
191             "            {\n" +
192             "                \"ll1\": [\n" +
193             "                    \"abc\",\n" +
194             "                    \"abc\"\n" +
195             "                ],\n" +
196             "                \"leaf1\": \"true\",\n" +
197             "                \"ll2\": [\n" +
198             "                    \"abc\",\n" +
199             "                    \"abc\"\n" +
200             "                ],\n" +
201             "                \"list5\": [\n" +
202             "                    {\n" +
203             "                        \"leaf9\": \"abc\"\n" +
204             "                    },\n" +
205             "                    {\n" +
206             "                        \"leaf9\": \"abc\"\n" +
207             "                    }\n" +
208             "                ],\n" +
209             "                \"leaf3\": \"abc\",\n" +
210             "                \"leaf2\": \"abc\",\n" +
211             "                \"list4\": [\n" +
212             "                    {\n" +
213             "                        \"leaf8\": \"abc\"\n" +
214             "                    },\n" +
215             "                    {\n" +
216             "                        \"leaf8\": \"abc\"\n" +
217             "                    }\n" +
218             "                ],\n" +
219             "                \"cont4\": {\n" +
220             "                    \"leaf11\": \"abc\"\n" +
221             "                }\n" +
222             "            },\n" +
223             "            {\n" +
224             "                \"ll1\": [\n" +
225             "                    \"abc\",\n" +
226             "                    \"abc\"\n" +
227             "                ],\n" +
228             "                \"leaf1\": \"true\",\n" +
229             "                \"ll2\": [\n" +
230             "                    \"abc\",\n" +
231             "                    \"abc\"\n" +
232             "                ],\n" +
233             "                \"leaf3\": \"abc\",\n" +
234             "                \"list5\": [\n" +
235             "                    {\n" +
236             "                        \"leaf9\": \"abc\"\n" +
237             "                    },\n" +
238             "                    {\n" +
239             "                        \"leaf9\": \"abc\"\n" +
240             "                    }\n" +
241             "                ],\n" +
242             "                \"list4\": [\n" +
243             "                    {\n" +
244             "                        \"leaf8\": \"abc\"\n" +
245             "                    },\n" +
246             "                    {\n" +
247             "                        \"leaf8\": \"abc\"\n" +
248             "                    }\n" +
249             "                ],\n" +
250             "                \"leaf2\": \"abc\",\n" +
251             "                \"cont4\": {\n" +
252             "                    \"leaf11\": \"abc\"\n" +
253             "                }\n" +
254             "            }\n" +
255             "        ],\n" +
256             "        \"ll3\": [\n" +
257             "            \"abc\",\n" +
258             "            \"abc\"\n" +
259             "        ],\n" +
260             "        \"ll5\": [\n" +
261             "            \"abc\",\n" +
262             "            \"abc\"\n" +
263             "        ],\n" +
264             "        \"cont4\": {\n" +
265             "            \"leaf10\": \"abc\"," +
266             addSpace(ENCODE_TO_JSON_YANG_COMMON, 8) + "\n" +
267             "        },\n" +
268             "        \"ll4\": [\n" +
269             "            \"abc\",\n" +
270             "            \"abc\"\n" +
271             "        ],\n" +
272             "        \"cont3\": {\n" +
273             "            \"leaf10\": \"abc\"\n" +
274             "        },\n" +
275             "        \"leaf5\": \"abc\",\n" +
276             "        \"list2\": [\n" +
277             "            {\n" +
278             "                \"leaf4\": \"abc\"\n" +
279             "            },\n" +
280             "            {\n" +
281             "                \"leaf4\": \"abc\"\n" +
282             "            }\n" +
283             "        ],\n" +
284             "        \"leaf12\": \"abc\",\n" +
285             "        \"leaf6\": \"abc\",\n" +
286             "        \"list6\": [\n" +
287             "            {\n" +
288             "                \"leaf11\": \"abc\"\n" +
289             "            },\n" +
290             "            {\n" +
291             "                \"leaf11\": \"abc\"\n" +
292             "            }\n" +
293             "        ]\n" +
294             "    }\n" +
295             "}";
296
297     static final String ENCODE_TO_JSON_YANG_PUT = "{\n" +
298             "    \"test-yang:cont4\": {" + addSpace(
299             ENCODE_TO_JSON_YANG_COMMON, 4) + ",\n" +
300             "        \"leaf10\": \"abc\"\n" +
301             "    }\n" +
302             "}";
303
304     static final String ENCODE_TO_XML_YANG_COMMON = "\n" +
305             "<ll6 xmlns=\"urn:opendaylight:params:xml:ns:yang:aug" +
306             "ment\">unbounded</ll6>\n" +
307             "<ll6 xmlns=\"urn:opendaylight:params:xml:ns:yang:aug" +
308             "ment\">8</ll6>\n" +
309             "<cont13 xmlns=\"urn:opendaylight:params:xml:ns:yang:" +
310             "augment\">\n" +
311             "    <ll9>abc</ll9>\n" +
312             "    <ll9>abc</ll9>\n" +
313             "    <list9>\n" +
314             "        <leaf27>abc</leaf27>\n" +
315             "    </list9>\n" +
316             "    <list9>\n" +
317             "        <leaf27>abc</leaf27>\n" +
318             "    </list9>\n" +
319             "    <leaf28>abc</leaf28>\n" +
320             "    <cont12>\n" +
321             "        <leaf26>abc</leaf26>\n" +
322             "    </cont12>\n" +
323             "</cont13>\n" +
324             "<list7 xmlns=\"urn:opendaylight:params:xml:ns:yang:a" +
325             "ugment\">\n" +
326             "    <leaf14>test</leaf14>\n" +
327             "</list7>\n" +
328             "<list7 xmlns=\"urn:opendaylight:params:xml:ns:yang:a" +
329             "ugment\">\n" +
330             "    <leaf14>create</leaf14>\n" +
331             "</list7>\n" +
332             "<leaf15 xmlns=\"urn:opendaylight:params:xml:ns:yang:" +
333             "augment\">abc</leaf15>\n" +
334             "<cont5 xmlns=\"urn:opendaylight:params:xml:ns:yang:a" +
335             "ugment\">\n" +
336             "    <leaf13>true</leaf13>\n" +
337             "</cont5>";
338
339     static final String ENCODE_TO_XML_YANG_AUG_POST = "<?xml version=\"1.0\"" +
340             " encoding=\"UTF-8\" standalone=\"no\"?>\n" +
341             "<leaf10 xmlns=\"urn:opendaylight:params:xml:ns:yang:test\">abc" +
342             "</leaf10>" +
343             ENCODE_TO_XML_YANG_COMMON + "\n";
344
345     static final String ENCODE_TO_XML_YANG_PUT = "<?xml version=\"1.0\" enc" +
346             "oding=\"UTF-8\" standalone=\"no\"?>\n" +
347             "<cont4 xmlns=\"urn:opendaylight:params:xml:ns:yang:test\">\n" +
348             "    <leaf10>abc</leaf10>" +
349             addSpace(ENCODE_TO_XML_YANG_COMMON, 4) + "\n</cont4>\n";
350
351     static final String ENCODE_TO_XML_YANG = "<?xml version=\"1.0\" encoding" +
352             "=\"UTF-8\" standalone=\"no\"?>\n" +
353             "<cont2 xmlns=\"urn:opendaylight:params:xml:ns:yang:test\">\n" +
354             "    <list1>\n" +
355             "        <ll1>abc</ll1>\n" +
356             "        <ll1>abc</ll1>\n" +
357             "        <leaf1>true</leaf1>\n" +
358             "        <ll2>abc</ll2>\n" +
359             "        <ll2>abc</ll2>\n" +
360             "        <list5>\n" +
361             "            <leaf9>abc</leaf9>\n" +
362             "        </list5>\n" +
363             "        <list5>\n" +
364             "            <leaf9>abc</leaf9>\n" +
365             "        </list5>\n" +
366             "        <leaf3>abc</leaf3>\n" +
367             "        <leaf2>abc</leaf2>\n" +
368             "        <list4>\n" +
369             "            <leaf8>abc</leaf8>\n" +
370             "        </list4>\n" +
371             "        <list4>\n" +
372             "            <leaf8>abc</leaf8>\n" +
373             "        </list4>\n" +
374             "        <cont4>\n" +
375             "            <leaf11>abc</leaf11>\n" +
376             "        </cont4>\n" +
377             "    </list1>\n" +
378             "    <list1>\n" +
379             "        <ll1>abc</ll1>\n" +
380             "        <ll1>abc</ll1>\n" +
381             "        <leaf1>true</leaf1>\n" +
382             "        <ll2>abc</ll2>\n" +
383             "        <ll2>abc</ll2>\n" +
384             "        <leaf3>abc</leaf3>\n" +
385             "        <list5>\n" +
386             "            <leaf9>abc</leaf9>\n" +
387             "        </list5>\n" +
388             "        <list5>\n" +
389             "            <leaf9>abc</leaf9>\n" +
390             "        </list5>\n" +
391             "        <list4>\n" +
392             "            <leaf8>abc</leaf8>\n" +
393             "        </list4>\n" +
394             "        <list4>\n" +
395             "            <leaf8>abc</leaf8>\n" +
396             "        </list4>\n" +
397             "        <leaf2>abc</leaf2>\n" +
398             "        <cont4>\n" +
399             "            <leaf11>abc</leaf11>\n" +
400             "        </cont4>\n" +
401             "    </list1>\n" +
402             "    <ll3>abc</ll3>\n" +
403             "    <ll3>abc</ll3>\n" +
404             "    <ll5>abc</ll5>\n" +
405             "    <ll5>abc</ll5>\n" +
406             "    <cont4>\n" +
407             "        <leaf10>abc</leaf10>"+
408             addSpace(ENCODE_TO_XML_YANG_COMMON, 8) + "\n" +
409             "    </cont4>\n" +
410             "    <ll4>abc</ll4>\n" +
411             "    <ll4>abc</ll4>\n" +
412             "    <cont3>\n" +
413             "        <leaf10>abc</leaf10>\n" +
414             "    </cont3>\n" +
415             "    <leaf5>abc</leaf5>\n" +
416             "    <list2>\n" +
417             "        <leaf4>abc</leaf4>\n" +
418             "    </list2>\n" +
419             "    <list2>\n" +
420             "        <leaf4>abc</leaf4>\n" +
421             "    </list2>\n" +
422             "    <leaf12>abc</leaf12>\n" +
423             "    <leaf6>abc</leaf6>\n" +
424             "    <list6>\n" +
425             "        <leaf11>abc</leaf11>\n" +
426             "    </list6>\n" +
427             "    <list6>\n" +
428             "        <leaf11>abc</leaf11>\n" +
429             "    </list6>\n" +
430             "</cont2>\n";
431
432     static final String ENCODE_TO_JSON_RPC = "{\n" +
433             "    \"test-yang:input\": {\n" +
434             "        \"leaf30\": \"abc\",\n" +
435             "        \"list10\": [\n" +
436             "            {\n" +
437             "                \"leaf29\": \"abc\"\n" +
438             "            },\n" +
439             "            {\n" +
440             "                \"leaf29\": \"abc\"\n" +
441             "            }\n" +
442             "        ],\n" +
443             "        \"cont15\": {\n" +
444             "            \"leaf31\": \"abc\"\n" +
445             "        },\n" +
446             "        \"cont14\": {\n" +
447             "            \"leaf28\": \"abc\"\n" +
448             "        },\n" +
449             "        \"cont13\": {\n" +
450             "            \"list9\": [\n" +
451             "                {\n" +
452             "                    \"leaf27\": \"abc\"\n" +
453             "                },\n" +
454             "                {\n" +
455             "                    \"leaf27\": \"abc\"\n" +
456             "                }\n" +
457             "            ],\n" +
458             "            \"ll9\": [\n" +
459             "                \"abc\",\n" +
460             "                \"abc\"\n" +
461             "            ],\n" +
462             "            \"leaf28\": \"abc\"\n" +
463             "        },\n" +
464             "        \"ll10\": [\n" +
465             "            \"abc\",\n" +
466             "            \"abc\"\n" +
467             "        ]\n" +
468             "    }\n" +
469             "}";
470
471     static final String DECODE_FROM_JSON_RPC = "{\n" +
472             "    \"test-yang:output\": {\n" +
473             "        \"cont16\": {\n" +
474             "            \"leaf32\": \"abc\"\n" +
475             "        },\n" +
476             "        \"list11\": [\n" +
477             "            {\n" +
478             "                \"leaf33\": \"abc\"\n" +
479             "            },\n" +
480             "            {\n" +
481             "                \"leaf33\": \"abc\"\n" +
482             "            }\n" +
483             "        ],\n" +
484             "        \"leaf34\": \"abc\",\n" +
485             "        \"ll11\": [\n" +
486             "            \"abc\",\n" +
487             "            \"abc\"\n" +
488             "        ],\n" +
489             "        \"cont17\": {\n" +
490             "            \"leaf35\": \"abc\"\n" +
491             "        },\n" +
492             "        \"cont13\": {\n" +
493             "            \"cont12\": {\n" +
494             "                \"leaf26\": \"abc\"\n" +
495             "            },\n" +
496             "            \"list9\": [\n" +
497             "                {\n" +
498             "                    \"leaf27\": \"abc\"\n" +
499             "                },\n" +
500             "                {\n" +
501             "                    \"leaf27\": \"abc\"\n" +
502             "                }\n" +
503             "            ],\n" +
504             "            \"ll9\": [\n" +
505             "                \"abc\",\n" +
506             "                \"abc\"\n" +
507             "            ],\n" +
508             "            \"leaf28\": \"abc\"\n" +
509             "        }\n" +
510             "    }\n" +
511             "}";
512
513     static final String DECODE_ANYXML_RESPONSE = "{\n" +
514             "    \"commonHeader\": {\n" +
515             "        \"timestamp\": \"2019-05-18T23:42:41.658Z\",\n" +
516             "        \"originatorId\": \"System\",\n" +
517             "        \"requestId\": \"1234\",\n" +
518             "        \"subRequestId\": \"1234-12234\",\n" +
519             "        \"flags\": null\n" +
520             "    },\n" +
521             "    \"actionIdentifiers\": {\n" +
522             "        \"blueprintName\": \"golden\",\n" +
523             "        \"blueprintVersion\": \"1.0.0\",\n" +
524             "        \"actionName\": \"resource-assignment\",\n" +
525             "        \"mode\": \"sync\"\n" +
526             "    },\n" +
527             "    \"status\": {\n" +
528             "        \"code\": 200,\n" +
529             "        \"eventType\": \"EVENT_COMPONENT_EXECUTED\",\n" +
530             "        \"timestamp\": \"2019-05-18T23:42:41.950Z\",\n" +
531             "        \"errorMessage\": null,\n" +
532             "        \"message\": \"success\"\n" +
533             "    },\n" +
534             "    \"payload\": {\n" +
535             "        \"resource-assignment-response\": {\n" +
536             "            \"meshed-template\": {\n" +
537             "                \"vf-module-1\": \"<interface>\\n   " +
538             " <description>This is the Virtual Firewall entity</" +
539             "description>\\n    <vfw>10.0.101.20/24</vfw>\\n</interface>\"\n" +
540             "            }\n" +
541             "        }\n" +
542             "    },\n" +
543             "    \"stepData\": {\n" +
544             "        \"name\": \"resource-assignment\",\n" +
545             "        \"properties\": {\n" +
546             "            \"resource-assignment-params\": null,\n" +
547             "            \"status\": null\n" +
548             "        }\n" +
549             "    }\n" +
550             "}";
551
552     static final String ENCODE_TO_XML_RPC = "<?xml version=\"1.0\" encoding" +
553             "=\"UTF-8\" standalone=\"no\"?>\n" +
554             "<input xmlns=\"urn:opendaylight:params:xml:ns:yang:test\">\n" +
555             "    <leaf30>abc</leaf30>\n" +
556             "    <list10>\n" +
557             "        <leaf29>abc</leaf29>\n" +
558             "    </list10>\n" +
559             "    <list10>\n" +
560             "        <leaf29>abc</leaf29>\n" +
561             "    </list10>\n" +
562             "    <cont15>\n" +
563             "        <leaf31>abc</leaf31>\n" +
564             "    </cont15>\n" +
565             "    <cont14>\n" +
566             "        <leaf28>abc</leaf28>\n" +
567             "    </cont14>\n" +
568             "    <cont13>\n" +
569             "        <list9>\n" +
570             "            <leaf27>abc</leaf27>\n" +
571             "        </list9>\n" +
572             "        <list9>\n" +
573             "            <leaf27>abc</leaf27>\n" +
574             "        </list9>\n" +
575             "        <ll9>abc</ll9>\n" +
576             "        <ll9>abc</ll9>\n" +
577             "        <leaf28>abc</leaf28>\n" +
578             "    </cont13>\n" +
579             "    <ll10>abc</ll10>\n" +
580             "    <ll10>abc</ll10>\n" +
581             "</input>\n";
582
583     static final String DECODE_FROM_XML_RPC = "<?xml version=\"1.0\" encodi" +
584             "ng=\"UTF-8\" standalone=\"no\"?>\n" +
585             "<output xmlns=\"urn:opendaylight:params:xml:ns:yang:test\">\n" +
586             "    <cont16>\n" +
587             "        <leaf32>abc</leaf32>\n" +
588             "    </cont16>\n" +
589             "    <list11>\n" +
590             "        <leaf33>abc</leaf33>\n" +
591             "    </list11>\n" +
592             "    <list11>\n" +
593             "        <leaf33>abc</leaf33>\n" +
594             "    </list11>\n" +
595             "    <leaf34>abc</leaf34>\n" +
596             "    <ll11>abc</ll11>\n" +
597             "    <ll11>abc</ll11>\n" +
598             "    <cont17>\n" +
599             "        <leaf35>abc</leaf35>\n" +
600             "    </cont17>\n" +
601             "    <cont13>\n" +
602             "        <cont12>\n" +
603             "            <leaf26>abc</leaf26>\n" +
604             "        </cont12>\n" +
605             "        <list9>\n" +
606             "            <leaf27>abc</leaf27>\n" +
607             "        </list9>\n" +
608             "        <list9>\n" +
609             "            <leaf27>abc</leaf27>\n" +
610             "        </list9>\n" +
611             "        <ll9>abc</ll9>\n" +
612             "        <ll9>abc</ll9>\n" +
613             "        <leaf28>abc</leaf28>\n" +
614             "    </cont13>\n" +
615             "</output>";
616
617     /**
618      * Adds the specified number of space required for a req in each line.
619      *
620      * @param req request message
621      * @param i   number of space
622      * @return space appended string
623      */
624     public static String addSpace(String req, int i) {
625         StringBuilder space = new StringBuilder();
626         for (int sp = 0; sp < i; sp++) {
627             space = space.append(" ");
628         }
629         return req.replaceAll("\n", "\n" + space.toString());
630     }
631 }