blob: 943d11e8680e45a7b6f0f6250aa6c21c06e3921d [file] [log] [blame]
Michal Vasko60ea6352020-06-29 13:39:39 +02001/**
2 * @file test_lyb.c
3 * @author Michal Vasko <mvasko@cesnet.cz>
4 * @brief Cmocka tests for LYB binary data format.
5 *
6 * Copyright (c) 2020 CESNET, z.s.p.o.
7 *
8 * This source code is licensed under BSD 3-Clause License (the "License").
9 * You may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * https://opensource.org/licenses/BSD-3-Clause
13 */
Radek Iša56ca9e42020-09-08 18:42:00 +020014#define _UTEST_MAIN_
15#include "utests.h"
Michal Vasko60ea6352020-06-29 13:39:39 +020016
Michal Vasko60ea6352020-06-29 13:39:39 +020017#include "hash_table.h"
18#include "libyang.h"
Michal Vasko60ea6352020-06-29 13:39:39 +020019
aPiecekfbfcba42021-09-13 13:53:44 +020020#define CHECK_PARSE_LYD(INPUT, OUT_NODE) \
21 CHECK_PARSE_LYD_PARAM(INPUT, LYD_XML, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, LY_SUCCESS, OUT_NODE)
Michal Vasko60ea6352020-06-29 13:39:39 +020022
Radek Iša56ca9e42020-09-08 18:42:00 +020023#define CHECK_LYD_STRING(MODEL, TEXT) \
24 CHECK_LYD_STRING_PARAM(MODEL, TEXT, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)
Michal Vasko60ea6352020-06-29 13:39:39 +020025
aPiecekfbfcba42021-09-13 13:53:44 +020026#define CHECK_PRINT_THEN_PARSE(DATA_XML) \
27 { \
28 struct lyd_node *tree_1; \
29 struct lyd_node *tree_2; \
30 char *xml_out; \
31 CHECK_PARSE_LYD(DATA_XML, tree_1); \
32 assert_int_equal(lyd_print_mem(&xml_out, tree_1, LYD_LYB, LYD_PRINT_WITHSIBLINGS), 0); \
33 assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, xml_out, LYD_LYB, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, &tree_2)); \
34 assert_non_null(tree_2); \
35 CHECK_LYD(tree_1, tree_2); \
36 free(xml_out); \
37 lyd_free_all(tree_1); \
38 lyd_free_all(tree_2); \
39 }
40
Michal Vasko60ea6352020-06-29 13:39:39 +020041static int
Radek Iša56ca9e42020-09-08 18:42:00 +020042setup(void **state)
Michal Vasko60ea6352020-06-29 13:39:39 +020043{
Radek Iša56ca9e42020-09-08 18:42:00 +020044 UTEST_SETUP;
45 assert_int_equal(LY_SUCCESS, ly_ctx_set_searchdir(UTEST_LYCTX, TESTS_DIR_MODULES_YANG));
Michal Vasko60ea6352020-06-29 13:39:39 +020046
47 return 0;
48}
49
50static void
aPiecek3c6cf2f2021-09-21 14:15:50 +020051tests_leaflist(void **state)
52{
53 const char *mod;
54 const char *data_xml;
55
56 mod =
57 "module mod { namespace \"urn:test-leaflist\"; prefix m;"
58 " container cont {"
59 " presence \"\";"
60 " leaf-list ll {"
61 " type uint8;"
62 " }"
63 " }"
64 "}";
65 UTEST_ADD_MODULE(mod, LYS_IN_YANG, NULL, NULL);
66
67 data_xml =
68 "<cont xmlns=\"urn:test-leaflist\">\n"
69 "</cont>\n";
70 CHECK_PRINT_THEN_PARSE(data_xml);
71
72 data_xml =
73 "<cont xmlns=\"urn:test-leaflist\">\n"
74 " <ll>1</ll>\n"
75 "</cont>\n";
76 CHECK_PRINT_THEN_PARSE(data_xml);
77
78 data_xml =
79 "<cont xmlns=\"urn:test-leaflist\">\n"
80 " <ll>1</ll>\n"
81 " <ll>2</ll>\n"
82 "</cont>\n";
83 CHECK_PRINT_THEN_PARSE(data_xml);
84}
85
86static void
87tests_list(void **state)
88{
89 const char *mod;
90 const char *data_xml;
91
92 mod =
93 "module mod { namespace \"urn:test-list\"; prefix m;"
94 " container cont {"
95 " presence \"\";"
96 " list lst {"
97 " key \"lf\";"
98 " leaf lf {"
99 " type uint8;"
100 " }"
101 " }"
102 " }"
103 "}";
104 UTEST_ADD_MODULE(mod, LYS_IN_YANG, NULL, NULL);
105
106 data_xml =
107 "<cont xmlns=\"urn:test-list\">\n"
108 " <lst>"
109 " <lf>1</lf>"
110 " </lst>"
111 "</cont>\n";
112 CHECK_PRINT_THEN_PARSE(data_xml);
113
114 data_xml =
115 "<cont xmlns=\"urn:test-list\">\n"
116 " <lst>"
117 " <lf>1</lf>"
118 " <lf>2</lf>"
119 " </lst>"
120 "</cont>\n";
121 CHECK_PRINT_THEN_PARSE(data_xml);
122}
123
124static void
125tests_any(void **state)
126{
127 const char *mod;
128 const char *data_xml;
129
130 mod =
131 "module mod { namespace \"urn:test-any\"; prefix m;"
132 " container cont {"
133 " presence \"\";"
134 " anyxml anxml;\n"
135 " }"
136 "}";
137 UTEST_ADD_MODULE(mod, LYS_IN_YANG, NULL, NULL);
138
139 data_xml =
140 "<cont xmlns=\"urn:test-any\">\n"
141 "</cont>\n";
142 CHECK_PRINT_THEN_PARSE(data_xml);
143
144 data_xml =
145 "<cont xmlns=\"urn:test-any\">\n"
146 " <anxml><node>value</node></anxml>\n"
147 "</cont>\n";
148 CHECK_PRINT_THEN_PARSE(data_xml);
149
150 data_xml =
151 "<cont xmlns=\"urn:test-any\">\n"
152 " <anxml><node1>value</node1></anxml>\n"
153 " <anxml><node2>value</node2></anxml>\n"
154 "</cont>\n";
155 CHECK_PRINT_THEN_PARSE(data_xml);
156}
157
158static void
Michal Vasko60ea6352020-06-29 13:39:39 +0200159test_ietf_interfaces(void **state)
160{
Michal Vasko60ea6352020-06-29 13:39:39 +0200161 const char *data_xml =
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100162 "<interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
163 " <interface>\n"
164 " <name>eth0</name>\n"
165 " <description>Ethernet 0</description>\n"
166 " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
167 " <enabled>true</enabled>\n"
168 " <ipv4 xmlns=\"urn:ietf:params:xml:ns:yang:ietf-ip\">\n"
169 " <enabled>true</enabled>\n"
170 " <mtu>1500</mtu>\n"
171 " <address>\n"
172 " <ip>192.168.2.100</ip>\n"
173 " <prefix-length>24</prefix-length>\n"
174 " </address>\n"
175 " </ipv4>\n"
176 " </interface>\n"
177 " <interface>\n"
178 " <name>eth1</name>\n"
179 " <description>Ethernet 1</description>\n"
180 " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
181 " <enabled>true</enabled>\n"
182 " <ipv4 xmlns=\"urn:ietf:params:xml:ns:yang:ietf-ip\">\n"
183 " <enabled>true</enabled>\n"
184 " <mtu>1500</mtu>\n"
185 " <address>\n"
186 " <ip>10.10.1.5</ip>\n"
187 " <prefix-length>16</prefix-length>\n"
188 " </address>\n"
189 " </ipv4>\n"
190 " </interface>\n"
191 " <interface>\n"
192 " <name>gigaeth0</name>\n"
193 " <description>GigabitEthernet 0</description>\n"
194 " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
195 " <enabled>false</enabled>\n"
196 " </interface>\n"
197 "</interfaces>\n";
Michal Vasko60ea6352020-06-29 13:39:39 +0200198
Radek Iša56ca9e42020-09-08 18:42:00 +0200199 assert_non_null(ly_ctx_load_module(UTEST_LYCTX, "ietf-ip", NULL, NULL));
200 assert_non_null(ly_ctx_load_module(UTEST_LYCTX, "iana-if-type", NULL, NULL));
Michal Vasko60ea6352020-06-29 13:39:39 +0200201
aPiecekfbfcba42021-09-13 13:53:44 +0200202 CHECK_PRINT_THEN_PARSE(data_xml);
Michal Vasko60ea6352020-06-29 13:39:39 +0200203}
204
205static void
206test_origin(void **state)
207{
Michal Vasko60ea6352020-06-29 13:39:39 +0200208 const char *origin_yang =
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100209 "module test-origin {"
210 " namespace \"urn:test-origin\";"
211 " prefix to;"
212 " import ietf-origin {"
213 " prefix or;"
214 " }"
215 ""
216 " container cont {"
217 " leaf leaf1 {"
218 " type string;"
219 " }"
220 " leaf leaf2 {"
221 " type string;"
222 " }"
223 " leaf leaf3 {"
224 " type uint8;"
225 " }"
226 " }"
227 "}";
Michal Vasko60ea6352020-06-29 13:39:39 +0200228 const char *data_xml =
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100229 "<cont xmlns=\"urn:test-origin\">\n"
230 " <leaf1 xmlns:or=\"urn:ietf:params:xml:ns:yang:ietf-origin\" or:origin=\"or:default\">value1</leaf1>\n"
231 " <leaf2>value2</leaf2>\n"
232 " <leaf3 xmlns:or=\"urn:ietf:params:xml:ns:yang:ietf-origin\" or:origin=\"or:system\">125</leaf3>\n"
233 "</cont>\n";
Michal Vasko60ea6352020-06-29 13:39:39 +0200234
Radek Iša56ca9e42020-09-08 18:42:00 +0200235 UTEST_ADD_MODULE(origin_yang, LYS_IN_YANG, NULL, NULL);
236 assert_int_equal(LY_SUCCESS, lys_set_implemented(ly_ctx_get_module_latest(UTEST_LYCTX, "ietf-origin"), NULL));
Michal Vasko60ea6352020-06-29 13:39:39 +0200237
aPiecekfbfcba42021-09-13 13:53:44 +0200238 CHECK_PRINT_THEN_PARSE(data_xml);
Michal Vasko60ea6352020-06-29 13:39:39 +0200239}
240
241static void
242test_statements(void **state)
243{
Michal Vasko60ea6352020-06-29 13:39:39 +0200244 const char *links_yang =
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100245 "module links {\n"
246 " yang-version 1.1;\n"
247 " namespace \"urn:module2\";\n"
248 " prefix mod2;\n"
249 "\n"
250 " identity just-another-identity;\n"
251 "\n"
252 " leaf one-leaf {\n"
253 " type string;\n"
254 " }\n"
255 "\n"
256 " list list-for-augment {\n"
257 " key keyleaf;\n"
258 "\n"
259 " leaf keyleaf {\n"
260 " type string;\n"
261 " }\n"
262 "\n"
263 " leaf just-leaf {\n"
264 " type int32;\n"
265 " }\n"
266 " }\n"
267 "\n"
268 " leaf rleaf {\n"
269 " type string;\n"
270 " }\n"
271 "\n"
272 " leaf-list llist {\n"
273 " type string;\n"
274 " min-elements 0;\n"
275 " max-elements 100;\n"
276 " ordered-by user;\n"
277 " }\n"
278 "\n"
279 " grouping rgroup {\n"
280 " leaf rg1 {\n"
281 " type string;\n"
282 " }\n"
283 "\n"
284 " leaf rg2 {\n"
285 " type string;\n"
286 " }\n"
287 " }\n"
288 "}\n";
Michal Vasko60ea6352020-06-29 13:39:39 +0200289
290 const char *statements_yang =
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100291 "module statements {\n"
292 " namespace \"urn:module\";\n"
293 " prefix mod;\n"
294 " yang-version 1.1;\n"
295 "\n"
296 " import links {\n"
297 " prefix mod2;\n"
298 " }\n"
299 "\n"
300 " identity random-identity {\n"
301 " base \"mod2:just-another-identity\";\n"
302 " base \"another-identity\";\n"
303 " }\n"
304 "\n"
305 " identity another-identity {\n"
306 " base \"mod2:just-another-identity\";\n"
307 " }\n"
308 "\n"
309 " typedef percent {\n"
310 " type uint8 {\n"
311 " range \"0 .. 100\";\n"
312 " }\n"
313 " units percent;\n"
314 " }\n"
315 "\n"
316 " container ice-cream-shop {\n"
317 " container employees {\n"
318 " list employee {\n"
319 " config true;\n"
320 " key id;\n"
321 " unique name;\n"
322 " min-elements 0;\n"
323 " max-elements 100;\n"
324 "\n"
325 " leaf id {\n"
326 " type uint64;\n"
327 " mandatory true;\n"
328 " }\n"
329 "\n"
330 " leaf name {\n"
331 " type string;\n"
332 " }\n"
333 "\n"
334 " leaf age {\n"
335 " type uint32;\n"
336 " }\n"
337 " }\n"
338 " }\n"
339 " }\n"
340 "\n"
341 " container random {\n"
342 " choice switch {\n"
343 " case a {\n"
344 " leaf aleaf {\n"
345 " type string;\n"
346 " default aaa;\n"
347 " }\n"
348 " }\n"
349 "\n"
350 " case c {\n"
351 " leaf cleaf {\n"
352 " type string;\n"
353 " }\n"
354 " }\n"
355 " }\n"
356 "\n"
357 " anyxml xml-data;\n"
358 " anydata any-data;\n"
359 " leaf-list leaflist {\n"
360 " type string;\n"
361 " min-elements 0;\n"
362 " max-elements 20;\n"
363 " ordered-by system;\n"
364 " }\n"
365 "\n"
366 " grouping group {\n"
367 " leaf g1 {\n"
368 " mandatory false;\n"
369 " type percent;\n"
370 " }\n"
371 "\n"
372 " leaf g2 {\n"
373 " type string;\n"
374 " }\n"
375 " }\n"
376 "\n"
377 " uses group;\n"
378 " uses mod2:rgroup;\n"
379 "\n"
380 " leaf lref {\n"
381 " type leafref {\n"
382 " path \"/mod2:one-leaf\";\n"
383 " }\n"
384 " }\n"
385 "\n"
386 " leaf iref {\n"
387 " type identityref {\n"
388 " base \"mod2:just-another-identity\";\n"
389 " }\n"
390 " }\n"
391 " }\n"
392 "\n"
Michal Vasko02ed9d82021-07-15 14:58:04 +0200393 " notification notif;\n"
394 "\n"
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100395 " augment \"/random\" {\n"
396 " leaf aug-leaf {\n"
397 " type string;\n"
398 " }\n"
399 " }\n"
400 "}\n";
Michal Vasko60ea6352020-06-29 13:39:39 +0200401
402 const char *data_xml =
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100403 "<ice-cream-shop xmlns=\"urn:module\">\n"
404 " <employees>\n"
405 " <employee>\n"
406 " <id>0</id>\n"
407 " <name>John Doe</name>\n"
408 " <age>28</age>\n"
409 " </employee>\n"
410 " <employee>\n"
411 " <id>1</id>\n"
412 " <name>Dohn Joe</name>\n"
413 " <age>20</age>\n"
414 " </employee>\n"
415 " </employees>\n"
416 "</ice-cream-shop>\n"
417 "<one-leaf xmlns=\"urn:module2\">reference leaf</one-leaf>\n"
418 "<random xmlns=\"urn:module\">\n"
419 " <aleaf>string</aleaf>\n"
420 " <xml-data><anyxml>data</anyxml></xml-data>\n"
Michal Vasko02ed9d82021-07-15 14:58:04 +0200421 " <any-data><notif/></any-data>\n"
Radek Krejcib4ac5a92020-11-23 17:54:33 +0100422 " <leaflist>l0</leaflist>\n"
423 " <leaflist>l1</leaflist>\n"
424 " <leaflist>l2</leaflist>\n"
425 " <g1>40</g1>\n"
426 " <g2>string</g2>\n"
427 " <aug-leaf>string</aug-leaf>\n"
428 " <rg1>string</rg1>\n"
429 " <rg2>string</rg2>\n"
430 " <lref>reference leaf</lref>\n"
431 " <iref>random-identity</iref>\n"
432 "</random>\n";
Michal Vasko60ea6352020-06-29 13:39:39 +0200433
Radek Iša56ca9e42020-09-08 18:42:00 +0200434 UTEST_ADD_MODULE(links_yang, LYS_IN_YANG, NULL, NULL);
435 UTEST_ADD_MODULE(statements_yang, LYS_IN_YANG, NULL, NULL);
Michal Vasko60ea6352020-06-29 13:39:39 +0200436
aPiecekfbfcba42021-09-13 13:53:44 +0200437 CHECK_PRINT_THEN_PARSE(data_xml);
Radek Iša56ca9e42020-09-08 18:42:00 +0200438}
439
Michal Vaskoffc92bf2021-06-21 08:15:14 +0200440static void
441test_opaq(void **state)
442{
443 const char *nc_feats[] = {"writable-running", NULL};
444 const char *data_xml =
445 "<edit-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
446 " <target>\n"
447 " <running/>\n"
448 " </target>\n"
449 " <config>\n"
450 " <top xmlns=\"urn:ed\">\n"
451 " <first>TestFirst</first>\n"
452 " </top>\n"
453 " </config>\n"
454 "</edit-config>\n";
455 struct ly_in *in;
456 struct lyd_node *tree_1;
457 struct lyd_node *tree_2;
458 char *xml_out; /* tree_2 */
459 LY_ERR rc;
460
461 assert_non_null(ly_ctx_load_module(UTEST_LYCTX, "ietf-netconf", NULL, nc_feats));
462
463 ly_in_new_memory(data_xml, &in);
464 rc = lyd_parse_op(UTEST_LYCTX, NULL, in, LYD_XML, LYD_TYPE_RPC_YANG, &tree_1, NULL);
465 ly_in_free(in, 0);
466 assert_int_equal(rc, LY_SUCCESS);
467
468 assert_int_equal(lyd_print_mem(&xml_out, tree_1, LYD_LYB, LYD_PRINT_WITHSIBLINGS), 0);
469
470 ly_in_new_memory(xml_out, &in);
471 rc = lyd_parse_op(UTEST_LYCTX, NULL, in, LYD_LYB, LYD_TYPE_RPC_YANG, &tree_2, NULL);
472 ly_in_free(in, 0);
473 assert_int_equal(rc, LY_SUCCESS);
474
475 /* compare models */
476 CHECK_LYD(tree_1, tree_2);
477
478 /* clean */
479 free(xml_out);
480 lyd_free_all(tree_1);
481 lyd_free_all(tree_2);
482}
483
Michal Vasko6374de22022-09-05 15:48:48 +0200484static void
485test_collisions(void **state)
486{
487 char *counters_yang, *data_xml;
488
489 counters_yang = malloc(32768);
490 strcpy(counters_yang,
491 "module counters {\n"
492 " namespace \"urn:counters\";\n"
493 " prefix c;\n"
494 "\n"
495 " container stats {\n");
496 strcat(counters_yang,
497 " leaf counter1 {\n"
498 " type uint64;\n"
499 " }\n"
500 " leaf counter2 {\n"
501 " type uint64;\n"
502 " }\n"
503 " leaf counter3 {\n"
504 " type uint64;\n"
505 " }\n"
506 " leaf counter4 {\n"
507 " type uint64;\n"
508 " }\n"
509 " leaf counter5 {\n"
510 " type uint64;\n"
511 " }\n"
512 " leaf counter6 {\n"
513 " type uint64;\n"
514 " }\n"
515 " leaf counter7 {\n"
516 " type uint64;\n"
517 " }\n"
518 " leaf counter8 {\n"
519 " type uint64;\n"
520 " }\n"
521 " leaf counter9 {\n"
522 " type uint64;\n"
523 " }\n"
524 " leaf counter10 {\n"
525 " type uint64;\n"
526 " }\n"
527 " leaf counter11 {\n"
528 " type uint64;\n"
529 " }\n"
530 " leaf counter12 {\n"
531 " type uint64;\n"
532 " }\n"
533 " leaf counter13 {\n"
534 " type uint64;\n"
535 " }\n"
536 " leaf counter14 {\n"
537 " type uint64;\n"
538 " }\n"
539 " leaf counter15 {\n"
540 " type uint64;\n"
541 " }\n"
542 " leaf counter16 {\n"
543 " type uint64;\n"
544 " }\n"
545 " leaf counter17 {\n"
546 " type uint64;\n"
547 " }\n"
548 " leaf counter18 {\n"
549 " type uint64;\n"
550 " }\n"
551 " leaf counter19 {\n"
552 " type uint64;\n"
553 " }\n"
554 " leaf counter20 {\n"
555 " type uint64;\n"
556 " }\n"
557 " leaf counter21 {\n"
558 " type uint64;\n"
559 " }\n"
560 " leaf counter22 {\n"
561 " type uint64;\n"
562 " }\n"
563 " leaf counter23 {\n"
564 " type uint64;\n"
565 " }\n"
566 " leaf counter24 {\n"
567 " type uint64;\n"
568 " }\n"
569 " leaf counter25 {\n"
570 " type uint64;\n"
571 " }\n"
572 " leaf counter26 {\n"
573 " type uint64;\n"
574 " }\n"
575 " leaf counter27 {\n"
576 " type uint64;\n"
577 " }\n"
578 " leaf counter28 {\n"
579 " type uint64;\n"
580 " }\n"
581 " leaf counter29 {\n"
582 " type uint64;\n"
583 " }\n"
584 " leaf counter30 {\n"
585 " type uint64;\n"
586 " }\n"
587 " leaf counter31 {\n"
588 " type uint64;\n"
589 " }\n"
590 " leaf counter32 {\n"
591 " type uint64;\n"
592 " }\n"
593 " leaf counter33 {\n"
594 " type uint64;\n"
595 " }\n"
596 " leaf counter34 {\n"
597 " type uint64;\n"
598 " }\n"
599 " leaf counter35 {\n"
600 " type uint64;\n"
601 " }\n"
602 " leaf counter36 {\n"
603 " type uint64;\n"
604 " }\n"
605 " leaf counter37 {\n"
606 " type uint64;\n"
607 " }\n"
608 " leaf counter38 {\n"
609 " type uint64;\n"
610 " }\n"
611 " leaf counter39 {\n"
612 " type uint64;\n"
613 " }\n"
614 " leaf counter40 {\n"
615 " type uint64;\n"
616 " }\n"
617 " leaf counter41 {\n"
618 " type uint64;\n"
619 " }\n"
620 " leaf counter42 {\n"
621 " type uint64;\n"
622 " }\n"
623 " leaf counter43 {\n"
624 " type uint64;\n"
625 " }\n"
626 " leaf counter44 {\n"
627 " type uint64;\n"
628 " }\n"
629 " leaf counter45 {\n"
630 " type uint64;\n"
631 " }\n"
632 " leaf counter46 {\n"
633 " type uint64;\n"
634 " }\n"
635 " leaf counter47 {\n"
636 " type uint64;\n"
637 " }\n"
638 " leaf counter48 {\n"
639 " type uint64;\n"
640 " }\n"
641 " leaf counter49 {\n"
642 " type uint64;\n"
643 " }\n");
644 strcat(counters_yang,
645 " leaf counter50 {\n"
646 " type uint64;\n"
647 " }\n"
648 " leaf counter51 {\n"
649 " type uint64;\n"
650 " }\n"
651 " leaf counter52 {\n"
652 " type uint64;\n"
653 " }\n"
654 " leaf counter53 {\n"
655 " type uint64;\n"
656 " }\n"
657 " leaf counter54 {\n"
658 " type uint64;\n"
659 " }\n"
660 " leaf counter55 {\n"
661 " type uint64;\n"
662 " }\n"
663 " leaf counter56 {\n"
664 " type uint64;\n"
665 " }\n"
666 " leaf counter57 {\n"
667 " type uint64;\n"
668 " }\n"
669 " leaf counter58 {\n"
670 " type uint64;\n"
671 " }\n"
672 " leaf counter59 {\n"
673 " type uint64;\n"
674 " }\n"
675 " leaf counter60 {\n"
676 " type uint64;\n"
677 " }\n"
678 " leaf counter61 {\n"
679 " type uint64;\n"
680 " }\n"
681 " leaf counter62 {\n"
682 " type uint64;\n"
683 " }\n"
684 " leaf counter63 {\n"
685 " type uint64;\n"
686 " }\n"
687 " leaf counter64 {\n"
688 " type uint64;\n"
689 " }\n"
690 " leaf counter65 {\n"
691 " type uint64;\n"
692 " }\n"
693 " leaf counter66 {\n"
694 " type uint64;\n"
695 " }\n"
696 " leaf counter67 {\n"
697 " type uint64;\n"
698 " }\n"
699 " leaf counter68 {\n"
700 " type uint64;\n"
701 " }\n"
702 " leaf counter69 {\n"
703 " type uint64;\n"
704 " }\n"
705 " leaf counter70 {\n"
706 " type uint64;\n"
707 " }\n"
708 " leaf counter71 {\n"
709 " type uint64;\n"
710 " }\n"
711 " leaf counter72 {\n"
712 " type uint64;\n"
713 " }\n"
714 " leaf counter73 {\n"
715 " type uint64;\n"
716 " }\n"
717 " leaf counter74 {\n"
718 " type uint64;\n"
719 " }\n"
720 " leaf counter75 {\n"
721 " type uint64;\n"
722 " }\n"
723 " leaf counter76 {\n"
724 " type uint64;\n"
725 " }\n"
726 " leaf counter77 {\n"
727 " type uint64;\n"
728 " }\n"
729 " leaf counter78 {\n"
730 " type uint64;\n"
731 " }\n"
732 " leaf counter79 {\n"
733 " type uint64;\n"
734 " }\n"
735 " leaf counter80 {\n"
736 " type uint64;\n"
737 " }\n"
738 " leaf counter81 {\n"
739 " type uint64;\n"
740 " }\n"
741 " leaf counter82 {\n"
742 " type uint64;\n"
743 " }\n"
744 " leaf counter83 {\n"
745 " type uint64;\n"
746 " }\n"
747 " leaf counter84 {\n"
748 " type uint64;\n"
749 " }\n"
750 " leaf counter85 {\n"
751 " type uint64;\n"
752 " }\n"
753 " leaf counter86 {\n"
754 " type uint64;\n"
755 " }\n"
756 " leaf counter87 {\n"
757 " type uint64;\n"
758 " }\n"
759 " leaf counter88 {\n"
760 " type uint64;\n"
761 " }\n"
762 " leaf counter89 {\n"
763 " type uint64;\n"
764 " }\n"
765 " leaf counter90 {\n"
766 " type uint64;\n"
767 " }\n"
768 " leaf counter91 {\n"
769 " type uint64;\n"
770 " }\n"
771 " leaf counter92 {\n"
772 " type uint64;\n"
773 " }\n"
774 " leaf counter93 {\n"
775 " type uint64;\n"
776 " }\n"
777 " leaf counter94 {\n"
778 " type uint64;\n"
779 " }\n"
780 " leaf counter95 {\n"
781 " type uint64;\n"
782 " }\n"
783 " leaf counter96 {\n"
784 " type uint64;\n"
785 " }\n"
786 " leaf counter97 {\n"
787 " type uint64;\n"
788 " }\n"
789 " leaf counter98 {\n"
790 " type uint64;\n"
791 " }\n"
792 " leaf counter99 {\n"
793 " type uint64;\n"
794 " }\n");
795 strcat(counters_yang,
796 " leaf counter100 {\n"
797 " type uint64;\n"
798 " }\n"
799 " leaf counter101 {\n"
800 " type uint64;\n"
801 " }\n"
802 " leaf counter102 {\n"
803 " type uint64;\n"
804 " }\n"
805 " leaf counter103 {\n"
806 " type uint64;\n"
807 " }\n"
808 " leaf counter104 {\n"
809 " type uint64;\n"
810 " }\n"
811 " leaf counter105 {\n"
812 " type uint64;\n"
813 " }\n"
814 " leaf counter106 {\n"
815 " type uint64;\n"
816 " }\n"
817 " leaf counter107 {\n"
818 " type uint64;\n"
819 " }\n"
820 " leaf counter108 {\n"
821 " type uint64;\n"
822 " }\n"
823 " leaf counter109 {\n"
824 " type uint64;\n"
825 " }\n"
826 " leaf counter110 {\n"
827 " type uint64;\n"
828 " }\n"
829 " leaf counter111 {\n"
830 " type uint64;\n"
831 " }\n"
832 " leaf counter112 {\n"
833 " type uint64;\n"
834 " }\n"
835 " leaf counter113 {\n"
836 " type uint64;\n"
837 " }\n"
838 " leaf counter114 {\n"
839 " type uint64;\n"
840 " }\n"
841 " leaf counter115 {\n"
842 " type uint64;\n"
843 " }\n"
844 " leaf counter116 {\n"
845 " type uint64;\n"
846 " }\n"
847 " leaf counter117 {\n"
848 " type uint64;\n"
849 " }\n"
850 " leaf counter118 {\n"
851 " type uint64;\n"
852 " }\n"
853 " leaf counter119 {\n"
854 " type uint64;\n"
855 " }\n"
856 " leaf counter120 {\n"
857 " type uint64;\n"
858 " }\n"
859 " leaf counter121 {\n"
860 " type uint64;\n"
861 " }\n"
862 " leaf counter122 {\n"
863 " type uint64;\n"
864 " }\n"
865 " leaf counter123 {\n"
866 " type uint64;\n"
867 " }\n"
868 " leaf counter124 {\n"
869 " type uint64;\n"
870 " }\n"
871 " leaf counter125 {\n"
872 " type uint64;\n"
873 " }\n"
874 " leaf counter126 {\n"
875 " type uint64;\n"
876 " }\n"
877 " leaf counter127 {\n"
878 " type uint64;\n"
879 " }\n"
880 " leaf counter128 {\n"
881 " type uint64;\n"
882 " }\n"
883 " leaf counter129 {\n"
884 " type uint64;\n"
885 " }\n"
886 " leaf counter130 {\n"
887 " type uint64;\n"
888 " }\n"
889 " leaf counter131 {\n"
890 " type uint64;\n"
891 " }\n"
892 " leaf counter132 {\n"
893 " type uint64;\n"
894 " }\n"
895 " leaf counter133 {\n"
896 " type uint64;\n"
897 " }\n"
898 " leaf counter134 {\n"
899 " type uint64;\n"
900 " }\n"
901 " leaf counter135 {\n"
902 " type uint64;\n"
903 " }\n"
904 " leaf counter136 {\n"
905 " type uint64;\n"
906 " }\n"
907 " leaf counter137 {\n"
908 " type uint64;\n"
909 " }\n"
910 " leaf counter138 {\n"
911 " type uint64;\n"
912 " }\n"
913 " leaf counter139 {\n"
914 " type uint64;\n"
915 " }\n"
916 " leaf counter140 {\n"
917 " type uint64;\n"
918 " }\n"
919 " leaf counter141 {\n"
920 " type uint64;\n"
921 " }\n"
922 " leaf counter142 {\n"
923 " type uint64;\n"
924 " }\n"
925 " leaf counter143 {\n"
926 " type uint64;\n"
927 " }\n"
928 " leaf counter144 {\n"
929 " type uint64;\n"
930 " }\n"
931 " leaf counter145 {\n"
932 " type uint64;\n"
933 " }\n"
934 " leaf counter146 {\n"
935 " type uint64;\n"
936 " }\n"
937 " leaf counter147 {\n"
938 " type uint64;\n"
939 " }\n"
940 " leaf counter148 {\n"
941 " type uint64;\n"
942 " }\n"
943 " leaf counter149 {\n"
944 " type uint64;\n"
945 " }\n");
946 strcat(counters_yang,
947 " leaf counter150 {\n"
948 " type uint64;\n"
949 " }\n"
950 " leaf counter151 {\n"
951 " type uint64;\n"
952 " }\n"
953 " leaf counter152 {\n"
954 " type uint64;\n"
955 " }\n"
956 " leaf counter153 {\n"
957 " type uint64;\n"
958 " }\n"
959 " leaf counter154 {\n"
960 " type uint64;\n"
961 " }\n"
962 " leaf counter155 {\n"
963 " type uint64;\n"
964 " }\n"
965 " leaf counter156 {\n"
966 " type uint64;\n"
967 " }\n"
968 " leaf counter157 {\n"
969 " type uint64;\n"
970 " }\n"
971 " leaf counter158 {\n"
972 " type uint64;\n"
973 " }\n"
974 " leaf counter159 {\n"
975 " type uint64;\n"
976 " }\n"
977 " leaf counter160 {\n"
978 " type uint64;\n"
979 " }\n"
980 " leaf counter161 {\n"
981 " type uint64;\n"
982 " }\n"
983 " leaf counter162 {\n"
984 " type uint64;\n"
985 " }\n"
986 " leaf counter163 {\n"
987 " type uint64;\n"
988 " }\n"
989 " leaf counter164 {\n"
990 " type uint64;\n"
991 " }\n"
992 " leaf counter165 {\n"
993 " type uint64;\n"
994 " }\n"
995 " leaf counter166 {\n"
996 " type uint64;\n"
997 " }\n"
998 " leaf counter167 {\n"
999 " type uint64;\n"
1000 " }\n"
1001 " leaf counter168 {\n"
1002 " type uint64;\n"
1003 " }\n"
1004 " leaf counter169 {\n"
1005 " type uint64;\n"
1006 " }\n"
1007 " leaf counter170 {\n"
1008 " type uint64;\n"
1009 " }\n"
1010 " leaf counter171 {\n"
1011 " type uint64;\n"
1012 " }\n"
1013 " leaf counter172 {\n"
1014 " type uint64;\n"
1015 " }\n"
1016 " leaf counter173 {\n"
1017 " type uint64;\n"
1018 " }\n"
1019 " leaf counter174 {\n"
1020 " type uint64;\n"
1021 " }\n"
1022 " leaf counter175 {\n"
1023 " type uint64;\n"
1024 " }\n"
1025 " leaf counter176 {\n"
1026 " type uint64;\n"
1027 " }\n"
1028 " leaf counter177 {\n"
1029 " type uint64;\n"
1030 " }\n"
1031 " leaf counter178 {\n"
1032 " type uint64;\n"
1033 " }\n"
1034 " leaf counter179 {\n"
1035 " type uint64;\n"
1036 " }\n"
1037 " leaf counter180 {\n"
1038 " type uint64;\n"
1039 " }\n"
1040 " leaf counter181 {\n"
1041 " type uint64;\n"
1042 " }\n"
1043 " leaf counter182 {\n"
1044 " type uint64;\n"
1045 " }\n"
1046 " leaf counter183 {\n"
1047 " type uint64;\n"
1048 " }\n"
1049 " leaf counter184 {\n"
1050 " type uint64;\n"
1051 " }\n"
1052 " leaf counter185 {\n"
1053 " type uint64;\n"
1054 " }\n"
1055 " leaf counter186 {\n"
1056 " type uint64;\n"
1057 " }\n"
1058 " leaf counter187 {\n"
1059 " type uint64;\n"
1060 " }\n"
1061 " leaf counter188 {\n"
1062 " type uint64;\n"
1063 " }\n"
1064 " leaf counter189 {\n"
1065 " type uint64;\n"
1066 " }\n"
1067 " leaf counter190 {\n"
1068 " type uint64;\n"
1069 " }\n"
1070 " leaf counter191 {\n"
1071 " type uint64;\n"
1072 " }\n"
1073 " leaf counter192 {\n"
1074 " type uint64;\n"
1075 " }\n"
1076 " leaf counter193 {\n"
1077 " type uint64;\n"
1078 " }\n"
1079 " leaf counter194 {\n"
1080 " type uint64;\n"
1081 " }\n"
1082 " leaf counter195 {\n"
1083 " type uint64;\n"
1084 " }\n"
1085 " leaf counter196 {\n"
1086 " type uint64;\n"
1087 " }\n"
1088 " leaf counter197 {\n"
1089 " type uint64;\n"
1090 " }\n"
1091 " leaf counter198 {\n"
1092 " type uint64;\n"
1093 " }\n"
1094 " leaf counter199 {\n"
1095 " type uint64;\n"
1096 " }\n");
1097 strcat(counters_yang,
1098 " leaf counter200 {\n"
1099 " type uint64;\n"
1100 " }\n"
1101 " leaf counter201 {\n"
1102 " type uint64;\n"
1103 " }\n"
1104 " leaf counter202 {\n"
1105 " type uint64;\n"
1106 " }\n"
1107 " leaf counter203 {\n"
1108 " type uint64;\n"
1109 " }\n"
1110 " leaf counter204 {\n"
1111 " type uint64;\n"
1112 " }\n"
1113 " leaf counter205 {\n"
1114 " type uint64;\n"
1115 " }\n"
1116 " leaf counter206 {\n"
1117 " type uint64;\n"
1118 " }\n"
1119 " leaf counter207 {\n"
1120 " type uint64;\n"
1121 " }\n"
1122 " leaf counter208 {\n"
1123 " type uint64;\n"
1124 " }\n"
1125 " leaf counter209 {\n"
1126 " type uint64;\n"
1127 " }\n"
1128 " leaf counter210 {\n"
1129 " type uint64;\n"
1130 " }\n"
1131 " leaf counter211 {\n"
1132 " type uint64;\n"
1133 " }\n"
1134 " leaf counter212 {\n"
1135 " type uint64;\n"
1136 " }\n"
1137 " leaf counter213 {\n"
1138 " type uint64;\n"
1139 " }\n"
1140 " leaf counter214 {\n"
1141 " type uint64;\n"
1142 " }\n"
1143 " leaf counter215 {\n"
1144 " type uint64;\n"
1145 " }\n"
1146 " leaf counter216 {\n"
1147 " type uint64;\n"
1148 " }\n"
1149 " leaf counter217 {\n"
1150 " type uint64;\n"
1151 " }\n"
1152 " leaf counter218 {\n"
1153 " type uint64;\n"
1154 " }\n"
1155 " leaf counter219 {\n"
1156 " type uint64;\n"
1157 " }\n"
1158 " leaf counter220 {\n"
1159 " type uint64;\n"
1160 " }\n"
1161 " leaf counter221 {\n"
1162 " type uint64;\n"
1163 " }\n"
1164 " leaf counter222 {\n"
1165 " type uint64;\n"
1166 " }\n"
1167 " leaf counter223 {\n"
1168 " type uint64;\n"
1169 " }\n"
1170 " leaf counter224 {\n"
1171 " type uint64;\n"
1172 " }\n"
1173 " leaf counter225 {\n"
1174 " type uint64;\n"
1175 " }\n"
1176 " leaf counter226 {\n"
1177 " type uint64;\n"
1178 " }\n"
1179 " leaf counter227 {\n"
1180 " type uint64;\n"
1181 " }\n"
1182 " leaf counter228 {\n"
1183 " type uint64;\n"
1184 " }\n"
1185 " leaf counter229 {\n"
1186 " type uint64;\n"
1187 " }\n"
1188 " leaf counter230 {\n"
1189 " type uint64;\n"
1190 " }\n"
1191 " leaf counter231 {\n"
1192 " type uint64;\n"
1193 " }\n"
1194 " leaf counter232 {\n"
1195 " type uint64;\n"
1196 " }\n"
1197 " leaf counter233 {\n"
1198 " type uint64;\n"
1199 " }\n"
1200 " leaf counter234 {\n"
1201 " type uint64;\n"
1202 " }\n"
1203 " leaf counter235 {\n"
1204 " type uint64;\n"
1205 " }\n"
1206 " leaf counter236 {\n"
1207 " type uint64;\n"
1208 " }\n"
1209 " leaf counter237 {\n"
1210 " type uint64;\n"
1211 " }\n"
1212 " leaf counter238 {\n"
1213 " type uint64;\n"
1214 " }\n"
1215 " leaf counter239 {\n"
1216 " type uint64;\n"
1217 " }\n"
1218 " leaf counter240 {\n"
1219 " type uint64;\n"
1220 " }\n"
1221 " leaf counter241 {\n"
1222 " type uint64;\n"
1223 " }\n"
1224 " leaf counter242 {\n"
1225 " type uint64;\n"
1226 " }\n"
1227 " leaf counter243 {\n"
1228 " type uint64;\n"
1229 " }\n"
1230 " leaf counter244 {\n"
1231 " type uint64;\n"
1232 " }\n"
1233 " leaf counter245 {\n"
1234 " type uint64;\n"
1235 " }\n"
1236 " leaf counter246 {\n"
1237 " type uint64;\n"
1238 " }\n"
1239 " leaf counter247 {\n"
1240 " type uint64;\n"
1241 " }\n"
1242 " leaf counter248 {\n"
1243 " type uint64;\n"
1244 " }\n"
1245 " leaf counter249 {\n"
1246 " type uint64;\n"
1247 " }\n");
1248 strcat(counters_yang,
1249 " leaf counter250 {\n"
1250 " type uint64;\n"
1251 " }\n"
1252 " leaf counter251 {\n"
1253 " type uint64;\n"
1254 " }\n"
1255 " leaf counter252 {\n"
1256 " type uint64;\n"
1257 " }\n"
1258 " leaf counter253 {\n"
1259 " type uint64;\n"
1260 " }\n"
1261 " leaf counter254 {\n"
1262 " type uint64;\n"
1263 " }\n"
1264 " leaf counter255 {\n"
1265 " type uint64;\n"
1266 " }\n"
1267 " leaf counter256 {\n"
1268 " type uint64;\n"
1269 " }\n"
1270 " leaf counter257 {\n"
1271 " type uint64;\n"
1272 " }\n"
1273 " leaf counter258 {\n"
1274 " type uint64;\n"
1275 " }\n"
1276 " leaf counter259 {\n"
1277 " type uint64;\n"
1278 " }\n"
1279 " leaf counter260 {\n"
1280 " type uint64;\n"
1281 " }\n"
1282 " leaf counter261 {\n"
1283 " type uint64;\n"
1284 " }\n"
1285 " leaf counter262 {\n"
1286 " type uint64;\n"
1287 " }\n"
1288 " leaf counter263 {\n"
1289 " type uint64;\n"
1290 " }\n"
1291 " leaf counter264 {\n"
1292 " type uint64;\n"
1293 " }\n"
1294 " leaf counter265 {\n"
1295 " type uint64;\n"
1296 " }\n"
1297 " leaf counter266 {\n"
1298 " type uint64;\n"
1299 " }\n"
1300 " leaf counter267 {\n"
1301 " type uint64;\n"
1302 " }\n"
1303 " leaf counter268 {\n"
1304 " type uint64;\n"
1305 " }\n"
1306 " leaf counter269 {\n"
1307 " type uint64;\n"
1308 " }\n"
1309 " leaf counter270 {\n"
1310 " type uint64;\n"
1311 " }\n"
1312 " leaf counter271 {\n"
1313 " type uint64;\n"
1314 " }\n"
1315 " leaf counter272 {\n"
1316 " type uint64;\n"
1317 " }\n"
1318 " leaf counter273 {\n"
1319 " type uint64;\n"
1320 " }\n"
1321 " leaf counter274 {\n"
1322 " type uint64;\n"
1323 " }\n"
1324 " leaf counter275 {\n"
1325 " type uint64;\n"
1326 " }\n"
1327 " leaf counter276 {\n"
1328 " type uint64;\n"
1329 " }\n"
1330 " leaf counter277 {\n"
1331 " type uint64;\n"
1332 " }\n"
1333 " leaf counter278 {\n"
1334 " type uint64;\n"
1335 " }\n"
1336 " leaf counter279 {\n"
1337 " type uint64;\n"
1338 " }\n"
1339 " leaf counter280 {\n"
1340 " type uint64;\n"
1341 " }\n"
1342 " leaf counter281 {\n"
1343 " type uint64;\n"
1344 " }\n"
1345 " leaf counter282 {\n"
1346 " type uint64;\n"
1347 " }\n"
1348 " leaf counter283 {\n"
1349 " type uint64;\n"
1350 " }\n"
1351 " leaf counter284 {\n"
1352 " type uint64;\n"
1353 " }\n"
1354 " leaf counter285 {\n"
1355 " type uint64;\n"
1356 " }\n"
1357 " leaf counter286 {\n"
1358 " type uint64;\n"
1359 " }\n"
1360 " leaf counter287 {\n"
1361 " type uint64;\n"
1362 " }\n"
1363 " leaf counter288 {\n"
1364 " type uint64;\n"
1365 " }\n"
1366 " leaf counter289 {\n"
1367 " type uint64;\n"
1368 " }\n"
1369 " leaf counter290 {\n"
1370 " type uint64;\n"
1371 " }\n"
1372 " leaf counter291 {\n"
1373 " type uint64;\n"
1374 " }\n"
1375 " leaf counter292 {\n"
1376 " type uint64;\n"
1377 " }\n"
1378 " leaf counter293 {\n"
1379 " type uint64;\n"
1380 " }\n"
1381 " leaf counter294 {\n"
1382 " type uint64;\n"
1383 " }\n"
1384 " leaf counter295 {\n"
1385 " type uint64;\n"
1386 " }\n"
1387 " leaf counter296 {\n"
1388 " type uint64;\n"
1389 " }\n"
1390 " leaf counter297 {\n"
1391 " type uint64;\n"
1392 " }\n"
1393 " leaf counter298 {\n"
1394 " type uint64;\n"
1395 " }\n"
1396 " leaf counter299 {\n"
1397 " type uint64;\n"
1398 " }\n");
1399 strcat(counters_yang,
1400 " leaf counter300 {\n"
1401 " type uint64;\n"
1402 " }\n"
1403 " leaf counter301 {\n"
1404 " type uint64;\n"
1405 " }\n"
1406 " leaf counter302 {\n"
1407 " type uint64;\n"
1408 " }\n"
1409 " leaf counter303 {\n"
1410 " type uint64;\n"
1411 " }\n"
1412 " leaf counter304 {\n"
1413 " type uint64;\n"
1414 " }\n"
1415 " leaf counter305 {\n"
1416 " type uint64;\n"
1417 " }\n"
1418 " leaf counter306 {\n"
1419 " type uint64;\n"
1420 " }\n"
1421 " leaf counter307 {\n"
1422 " type uint64;\n"
1423 " }\n"
1424 " leaf counter308 {\n"
1425 " type uint64;\n"
1426 " }\n"
1427 " leaf counter309 {\n"
1428 " type uint64;\n"
1429 " }\n"
1430 " leaf counter310 {\n"
1431 " type uint64;\n"
1432 " }\n"
1433 " leaf counter311 {\n"
1434 " type uint64;\n"
1435 " }\n"
1436 " leaf counter312 {\n"
1437 " type uint64;\n"
1438 " }\n"
1439 " leaf counter313 {\n"
1440 " type uint64;\n"
1441 " }\n"
1442 " leaf counter314 {\n"
1443 " type uint64;\n"
1444 " }\n"
1445 " leaf counter315 {\n"
1446 " type uint64;\n"
1447 " }\n"
1448 " leaf counter316 {\n"
1449 " type uint64;\n"
1450 " }\n"
1451 " leaf counter317 {\n"
1452 " type uint64;\n"
1453 " }\n"
1454 " leaf counter318 {\n"
1455 " type uint64;\n"
1456 " }\n"
1457 " leaf counter319 {\n"
1458 " type uint64;\n"
1459 " }\n"
1460 " leaf counter320 {\n"
1461 " type uint64;\n"
1462 " }\n"
1463 " leaf counter321 {\n"
1464 " type uint64;\n"
1465 " }\n"
1466 " leaf counter322 {\n"
1467 " type uint64;\n"
1468 " }\n"
1469 " leaf counter323 {\n"
1470 " type uint64;\n"
1471 " }\n"
1472 " leaf counter324 {\n"
1473 " type uint64;\n"
1474 " }\n"
1475 " leaf counter325 {\n"
1476 " type uint64;\n"
1477 " }\n"
1478 " leaf counter326 {\n"
1479 " type uint64;\n"
1480 " }\n"
1481 " leaf counter327 {\n"
1482 " type uint64;\n"
1483 " }\n"
1484 " leaf counter328 {\n"
1485 " type uint64;\n"
1486 " }\n"
1487 " leaf counter329 {\n"
1488 " type uint64;\n"
1489 " }\n"
1490 " leaf counter330 {\n"
1491 " type uint64;\n"
1492 " }\n"
1493 " leaf counter331 {\n"
1494 " type uint64;\n"
1495 " }\n"
1496 " leaf counter332 {\n"
1497 " type uint64;\n"
1498 " }\n"
1499 " leaf counter333 {\n"
1500 " type uint64;\n"
1501 " }\n"
1502 " leaf counter334 {\n"
1503 " type uint64;\n"
1504 " }\n"
1505 " leaf counter335 {\n"
1506 " type uint64;\n"
1507 " }\n"
1508 " leaf counter336 {\n"
1509 " type uint64;\n"
1510 " }\n"
1511 " leaf counter337 {\n"
1512 " type uint64;\n"
1513 " }\n"
1514 " leaf counter338 {\n"
1515 " type uint64;\n"
1516 " }\n"
1517 " leaf counter339 {\n"
1518 " type uint64;\n"
1519 " }\n"
1520 " leaf counter340 {\n"
1521 " type uint64;\n"
1522 " }\n"
1523 " leaf counter341 {\n"
1524 " type uint64;\n"
1525 " }\n"
1526 " leaf counter342 {\n"
1527 " type uint64;\n"
1528 " }\n"
1529 " leaf counter343 {\n"
1530 " type uint64;\n"
1531 " }\n"
1532 " leaf counter344 {\n"
1533 " type uint64;\n"
1534 " }\n"
1535 " leaf counter345 {\n"
1536 " type uint64;\n"
1537 " }\n"
1538 " leaf counter346 {\n"
1539 " type uint64;\n"
1540 " }\n"
1541 " leaf counter347 {\n"
1542 " type uint64;\n"
1543 " }\n"
1544 " leaf counter348 {\n"
1545 " type uint64;\n"
1546 " }\n"
1547 " leaf counter349 {\n"
1548 " type uint64;\n"
1549 " }\n");
1550 strcat(counters_yang,
1551 " leaf counter350 {\n"
1552 " type uint64;\n"
1553 " }\n"
1554 " leaf counter351 {\n"
1555 " type uint64;\n"
1556 " }\n"
1557 " leaf counter352 {\n"
1558 " type uint64;\n"
1559 " }\n"
1560 " leaf counter353 {\n"
1561 " type uint64;\n"
1562 " }\n"
1563 " leaf counter354 {\n"
1564 " type uint64;\n"
1565 " }\n"
1566 " leaf counter355 {\n"
1567 " type uint64;\n"
1568 " }\n"
1569 " leaf counter356 {\n"
1570 " type uint64;\n"
1571 " }\n"
1572 " leaf counter357 {\n"
1573 " type uint64;\n"
1574 " }\n"
1575 " leaf counter358 {\n"
1576 " type uint64;\n"
1577 " }\n"
1578 " leaf counter359 {\n"
1579 " type uint64;\n"
1580 " }\n"
1581 " leaf counter360 {\n"
1582 " type uint64;\n"
1583 " }\n"
1584 " leaf counter361 {\n"
1585 " type uint64;\n"
1586 " }\n"
1587 " leaf counter362 {\n"
1588 " type uint64;\n"
1589 " }\n"
1590 " leaf counter363 {\n"
1591 " type uint64;\n"
1592 " }\n"
1593 " leaf counter364 {\n"
1594 " type uint64;\n"
1595 " }\n"
1596 " leaf counter365 {\n"
1597 " type uint64;\n"
1598 " }\n"
1599 " leaf counter366 {\n"
1600 " type uint64;\n"
1601 " }\n"
1602 " leaf counter367 {\n"
1603 " type uint64;\n"
1604 " }\n"
1605 " leaf counter368 {\n"
1606 " type uint64;\n"
1607 " }\n"
1608 " leaf counter369 {\n"
1609 " type uint64;\n"
1610 " }\n"
1611 " leaf counter370 {\n"
1612 " type uint64;\n"
1613 " }\n"
1614 " leaf counter371 {\n"
1615 " type uint64;\n"
1616 " }\n"
1617 " leaf counter372 {\n"
1618 " type uint64;\n"
1619 " }\n"
1620 " leaf counter373 {\n"
1621 " type uint64;\n"
1622 " }\n"
1623 " leaf counter374 {\n"
1624 " type uint64;\n"
1625 " }\n"
1626 " leaf counter375 {\n"
1627 " type uint64;\n"
1628 " }\n"
1629 " leaf counter376 {\n"
1630 " type uint64;\n"
1631 " }\n"
1632 " leaf counter377 {\n"
1633 " type uint64;\n"
1634 " }\n"
1635 " leaf counter378 {\n"
1636 " type uint64;\n"
1637 " }\n"
1638 " leaf counter379 {\n"
1639 " type uint64;\n"
1640 " }\n"
1641 " leaf counter380 {\n"
1642 " type uint64;\n"
1643 " }\n"
1644 " leaf counter381 {\n"
1645 " type uint64;\n"
1646 " }\n"
1647 " leaf counter382 {\n"
1648 " type uint64;\n"
1649 " }\n"
1650 " leaf counter383 {\n"
1651 " type uint64;\n"
1652 " }\n"
1653 " leaf counter384 {\n"
1654 " type uint64;\n"
1655 " }\n"
1656 " leaf counter385 {\n"
1657 " type uint64;\n"
1658 " }\n"
1659 " leaf counter386 {\n"
1660 " type uint64;\n"
1661 " }\n"
1662 " leaf counter387 {\n"
1663 " type uint64;\n"
1664 " }\n"
1665 " leaf counter388 {\n"
1666 " type uint64;\n"
1667 " }\n"
1668 " leaf counter389 {\n"
1669 " type uint64;\n"
1670 " }\n"
1671 " leaf counter390 {\n"
1672 " type uint64;\n"
1673 " }\n"
1674 " leaf counter391 {\n"
1675 " type uint64;\n"
1676 " }\n"
1677 " leaf counter392 {\n"
1678 " type uint64;\n"
1679 " }\n"
1680 " leaf counter393 {\n"
1681 " type uint64;\n"
1682 " }\n"
1683 " leaf counter394 {\n"
1684 " type uint64;\n"
1685 " }\n"
1686 " leaf counter395 {\n"
1687 " type uint64;\n"
1688 " }\n"
1689 " leaf counter396 {\n"
1690 " type uint64;\n"
1691 " }\n"
1692 " leaf counter397 {\n"
1693 " type uint64;\n"
1694 " }\n"
1695 " leaf counter398 {\n"
1696 " type uint64;\n"
1697 " }\n"
1698 " leaf counter399 {\n"
1699 " type uint64;\n"
1700 " }\n");
1701 strcat(counters_yang,
1702 " leaf counter400 {\n"
1703 " type uint64;\n"
1704 " }\n"
1705 " leaf counter401 {\n"
1706 " type uint64;\n"
1707 " }\n"
1708 " leaf counter402 {\n"
1709 " type uint64;\n"
1710 " }\n"
1711 " leaf counter403 {\n"
1712 " type uint64;\n"
1713 " }\n"
1714 " leaf counter404 {\n"
1715 " type uint64;\n"
1716 " }\n"
1717 " leaf counter405 {\n"
1718 " type uint64;\n"
1719 " }\n"
1720 " leaf counter406 {\n"
1721 " type uint64;\n"
1722 " }\n"
1723 " leaf counter407 {\n"
1724 " type uint64;\n"
1725 " }\n"
1726 " leaf counter408 {\n"
1727 " type uint64;\n"
1728 " }\n"
1729 " leaf counter409 {\n"
1730 " type uint64;\n"
1731 " }\n"
1732 " leaf counter410 {\n"
1733 " type uint64;\n"
1734 " }\n"
1735 " leaf counter411 {\n"
1736 " type uint64;\n"
1737 " }\n"
1738 " leaf counter412 {\n"
1739 " type uint64;\n"
1740 " }\n"
1741 " leaf counter413 {\n"
1742 " type uint64;\n"
1743 " }\n"
1744 " leaf counter414 {\n"
1745 " type uint64;\n"
1746 " }\n"
1747 " leaf counter415 {\n"
1748 " type uint64;\n"
1749 " }\n"
1750 " leaf counter416 {\n"
1751 " type uint64;\n"
1752 " }\n"
1753 " leaf counter417 {\n"
1754 " type uint64;\n"
1755 " }\n"
1756 " leaf counter418 {\n"
1757 " type uint64;\n"
1758 " }\n"
1759 " leaf counter419 {\n"
1760 " type uint64;\n"
1761 " }\n"
1762 " leaf counter420 {\n"
1763 " type uint64;\n"
1764 " }\n"
1765 " leaf counter421 {\n"
1766 " type uint64;\n"
1767 " }\n"
1768 " leaf counter422 {\n"
1769 " type uint64;\n"
1770 " }\n"
1771 " leaf counter423 {\n"
1772 " type uint64;\n"
1773 " }\n"
1774 " leaf counter424 {\n"
1775 " type uint64;\n"
1776 " }\n"
1777 " leaf counter425 {\n"
1778 " type uint64;\n"
1779 " }\n"
1780 " leaf counter426 {\n"
1781 " type uint64;\n"
1782 " }\n"
1783 " leaf counter427 {\n"
1784 " type uint64;\n"
1785 " }\n"
1786 " leaf counter428 {\n"
1787 " type uint64;\n"
1788 " }\n"
1789 " leaf counter429 {\n"
1790 " type uint64;\n"
1791 " }\n"
1792 " leaf counter430 {\n"
1793 " type uint64;\n"
1794 " }\n"
1795 " leaf counter431 {\n"
1796 " type uint64;\n"
1797 " }\n"
1798 " leaf counter432 {\n"
1799 " type uint64;\n"
1800 " }\n"
1801 " leaf counter433 {\n"
1802 " type uint64;\n"
1803 " }\n"
1804 " leaf counter434 {\n"
1805 " type uint64;\n"
1806 " }\n"
1807 " leaf counter435 {\n"
1808 " type uint64;\n"
1809 " }\n"
1810 " leaf counter436 {\n"
1811 " type uint64;\n"
1812 " }\n"
1813 " leaf counter437 {\n"
1814 " type uint64;\n"
1815 " }\n"
1816 " leaf counter438 {\n"
1817 " type uint64;\n"
1818 " }\n"
1819 " leaf counter439 {\n"
1820 " type uint64;\n"
1821 " }\n"
1822 " leaf counter440 {\n"
1823 " type uint64;\n"
1824 " }\n"
1825 " leaf counter441 {\n"
1826 " type uint64;\n"
1827 " }\n"
1828 " leaf counter442 {\n"
1829 " type uint64;\n"
1830 " }\n"
1831 " leaf counter443 {\n"
1832 " type uint64;\n"
1833 " }\n"
1834 " leaf counter444 {\n"
1835 " type uint64;\n"
1836 " }\n"
1837 " leaf counter445 {\n"
1838 " type uint64;\n"
1839 " }\n"
1840 " leaf counter446 {\n"
1841 " type uint64;\n"
1842 " }\n"
1843 " leaf counter447 {\n"
1844 " type uint64;\n"
1845 " }\n"
1846 " leaf counter448 {\n"
1847 " type uint64;\n"
1848 " }\n"
1849 " leaf counter449 {\n"
1850 " type uint64;\n"
1851 " }\n");
1852 strcat(counters_yang,
1853 " leaf counter450 {\n"
1854 " type uint64;\n"
1855 " }\n"
1856 " leaf counter451 {\n"
1857 " type uint64;\n"
1858 " }\n"
1859 " leaf counter452 {\n"
1860 " type uint64;\n"
1861 " }\n"
1862 " leaf counter453 {\n"
1863 " type uint64;\n"
1864 " }\n"
1865 " leaf counter454 {\n"
1866 " type uint64;\n"
1867 " }\n"
1868 " leaf counter455 {\n"
1869 " type uint64;\n"
1870 " }\n"
1871 " leaf counter456 {\n"
1872 " type uint64;\n"
1873 " }\n"
1874 " leaf counter457 {\n"
1875 " type uint64;\n"
1876 " }\n"
1877 " leaf counter458 {\n"
1878 " type uint64;\n"
1879 " }\n"
1880 " leaf counter459 {\n"
1881 " type uint64;\n"
1882 " }\n"
1883 " leaf counter460 {\n"
1884 " type uint64;\n"
1885 " }\n"
1886 " leaf counter461 {\n"
1887 " type uint64;\n"
1888 " }\n"
1889 " leaf counter462 {\n"
1890 " type uint64;\n"
1891 " }\n"
1892 " leaf counter463 {\n"
1893 " type uint64;\n"
1894 " }\n"
1895 " leaf counter464 {\n"
1896 " type uint64;\n"
1897 " }\n"
1898 " leaf counter465 {\n"
1899 " type uint64;\n"
1900 " }\n"
1901 " leaf counter466 {\n"
1902 " type uint64;\n"
1903 " }\n"
1904 " leaf counter467 {\n"
1905 " type uint64;\n"
1906 " }\n"
1907 " leaf counter468 {\n"
1908 " type uint64;\n"
1909 " }\n"
1910 " leaf counter469 {\n"
1911 " type uint64;\n"
1912 " }\n"
1913 " leaf counter470 {\n"
1914 " type uint64;\n"
1915 " }\n"
1916 " leaf counter471 {\n"
1917 " type uint64;\n"
1918 " }\n"
1919 " leaf counter472 {\n"
1920 " type uint64;\n"
1921 " }\n"
1922 " leaf counter473 {\n"
1923 " type uint64;\n"
1924 " }\n"
1925 " leaf counter474 {\n"
1926 " type uint64;\n"
1927 " }\n"
1928 " leaf counter475 {\n"
1929 " type uint64;\n"
1930 " }\n"
1931 " leaf counter476 {\n"
1932 " type uint64;\n"
1933 " }\n"
1934 " leaf counter477 {\n"
1935 " type uint64;\n"
1936 " }\n"
1937 " leaf counter478 {\n"
1938 " type uint64;\n"
1939 " }\n"
1940 " leaf counter479 {\n"
1941 " type uint64;\n"
1942 " }\n"
1943 " leaf counter480 {\n"
1944 " type uint64;\n"
1945 " }\n"
1946 " leaf counter481 {\n"
1947 " type uint64;\n"
1948 " }\n"
1949 " leaf counter482 {\n"
1950 " type uint64;\n"
1951 " }\n"
1952 " leaf counter483 {\n"
1953 " type uint64;\n"
1954 " }\n"
1955 " leaf counter484 {\n"
1956 " type uint64;\n"
1957 " }\n"
1958 " leaf counter485 {\n"
1959 " type uint64;\n"
1960 " }\n"
1961 " leaf counter486 {\n"
1962 " type uint64;\n"
1963 " }\n"
1964 " leaf counter487 {\n"
1965 " type uint64;\n"
1966 " }\n"
1967 " leaf counter488 {\n"
1968 " type uint64;\n"
1969 " }\n"
1970 " leaf counter489 {\n"
1971 " type uint64;\n"
1972 " }\n"
1973 " leaf counter490 {\n"
1974 " type uint64;\n"
1975 " }\n"
1976 " leaf counter491 {\n"
1977 " type uint64;\n"
1978 " }\n"
1979 " leaf counter492 {\n"
1980 " type uint64;\n"
1981 " }\n"
1982 " leaf counter493 {\n"
1983 " type uint64;\n"
1984 " }\n"
1985 " leaf counter494 {\n"
1986 " type uint64;\n"
1987 " }\n"
1988 " leaf counter495 {\n"
1989 " type uint64;\n"
1990 " }\n"
1991 " leaf counter496 {\n"
1992 " type uint64;\n"
1993 " }\n"
1994 " leaf counter497 {\n"
1995 " type uint64;\n"
1996 " }\n"
1997 " leaf counter498 {\n"
1998 " type uint64;\n"
1999 " }\n"
2000 " leaf counter499 {\n"
2001 " type uint64;\n"
2002 " }\n"
2003 " }\n"
2004 "}\n");
2005
2006 data_xml = malloc(16384);
2007 strcpy(data_xml,
2008 "<stats xmlns=\"urn:counters\">\n");
2009 strcat(data_xml,
2010 " <counter1>1</counter1>\n"
2011 " <counter2>2</counter2>\n"
2012 " <counter3>3</counter3>\n"
2013 " <counter4>4</counter4>\n"
2014 " <counter5>5</counter5>\n"
2015 " <counter6>6</counter6>\n"
2016 " <counter7>7</counter7>\n"
2017 " <counter8>8</counter8>\n"
2018 " <counter9>9</counter9>\n"
2019 " <counter10>10</counter10>\n"
2020 " <counter11>11</counter11>\n"
2021 " <counter12>12</counter12>\n"
2022 " <counter13>13</counter13>\n"
2023 " <counter14>14</counter14>\n"
2024 " <counter15>15</counter15>\n"
2025 " <counter16>16</counter16>\n"
2026 " <counter17>17</counter17>\n"
2027 " <counter18>18</counter18>\n"
2028 " <counter19>19</counter19>\n"
2029 " <counter20>20</counter20>\n"
2030 " <counter21>21</counter21>\n"
2031 " <counter22>22</counter22>\n"
2032 " <counter23>23</counter23>\n"
2033 " <counter24>24</counter24>\n"
2034 " <counter25>25</counter25>\n"
2035 " <counter26>26</counter26>\n"
2036 " <counter27>27</counter27>\n"
2037 " <counter28>28</counter28>\n"
2038 " <counter29>29</counter29>\n"
2039 " <counter30>30</counter30>\n"
2040 " <counter31>31</counter31>\n"
2041 " <counter32>32</counter32>\n"
2042 " <counter33>33</counter33>\n"
2043 " <counter34>34</counter34>\n"
2044 " <counter35>35</counter35>\n"
2045 " <counter36>36</counter36>\n"
2046 " <counter37>37</counter37>\n"
2047 " <counter38>38</counter38>\n"
2048 " <counter39>39</counter39>\n"
2049 " <counter40>40</counter40>\n"
2050 " <counter41>41</counter41>\n"
2051 " <counter42>42</counter42>\n"
2052 " <counter43>43</counter43>\n"
2053 " <counter44>44</counter44>\n"
2054 " <counter45>45</counter45>\n"
2055 " <counter46>46</counter46>\n"
2056 " <counter47>47</counter47>\n"
2057 " <counter48>48</counter48>\n"
2058 " <counter49>49</counter49>\n"
2059 " <counter50>50</counter50>\n"
2060 " <counter51>51</counter51>\n"
2061 " <counter52>52</counter52>\n"
2062 " <counter53>53</counter53>\n"
2063 " <counter54>54</counter54>\n"
2064 " <counter55>55</counter55>\n"
2065 " <counter56>56</counter56>\n"
2066 " <counter57>57</counter57>\n"
2067 " <counter58>58</counter58>\n"
2068 " <counter59>59</counter59>\n"
2069 " <counter60>60</counter60>\n"
2070 " <counter61>61</counter61>\n"
2071 " <counter62>62</counter62>\n"
2072 " <counter63>63</counter63>\n"
2073 " <counter64>64</counter64>\n"
2074 " <counter65>65</counter65>\n"
2075 " <counter66>66</counter66>\n"
2076 " <counter67>67</counter67>\n"
2077 " <counter68>68</counter68>\n"
2078 " <counter69>69</counter69>\n"
2079 " <counter70>70</counter70>\n"
2080 " <counter71>71</counter71>\n"
2081 " <counter72>72</counter72>\n"
2082 " <counter73>73</counter73>\n"
2083 " <counter74>74</counter74>\n"
2084 " <counter75>75</counter75>\n"
2085 " <counter76>76</counter76>\n"
2086 " <counter77>77</counter77>\n"
2087 " <counter78>78</counter78>\n"
2088 " <counter79>79</counter79>\n"
2089 " <counter80>80</counter80>\n"
2090 " <counter81>81</counter81>\n"
2091 " <counter82>82</counter82>\n"
2092 " <counter83>83</counter83>\n"
2093 " <counter84>84</counter84>\n"
2094 " <counter85>85</counter85>\n"
2095 " <counter86>86</counter86>\n"
2096 " <counter87>87</counter87>\n"
2097 " <counter88>88</counter88>\n"
2098 " <counter89>89</counter89>\n"
2099 " <counter90>90</counter90>\n"
2100 " <counter91>91</counter91>\n"
2101 " <counter92>92</counter92>\n"
2102 " <counter93>93</counter93>\n"
2103 " <counter94>94</counter94>\n"
2104 " <counter95>95</counter95>\n"
2105 " <counter96>96</counter96>\n"
2106 " <counter97>97</counter97>\n"
2107 " <counter98>98</counter98>\n"
2108 " <counter99>99</counter99>\n");
2109 strcat(data_xml,
2110 " <counter100>100</counter100>\n"
2111 " <counter101>101</counter101>\n"
2112 " <counter102>102</counter102>\n"
2113 " <counter103>103</counter103>\n"
2114 " <counter104>104</counter104>\n"
2115 " <counter105>105</counter105>\n"
2116 " <counter106>106</counter106>\n"
2117 " <counter107>107</counter107>\n"
2118 " <counter108>108</counter108>\n"
2119 " <counter109>109</counter109>\n"
2120 " <counter110>110</counter110>\n"
2121 " <counter111>111</counter111>\n"
2122 " <counter112>112</counter112>\n"
2123 " <counter113>113</counter113>\n"
2124 " <counter114>114</counter114>\n"
2125 " <counter115>115</counter115>\n"
2126 " <counter116>116</counter116>\n"
2127 " <counter117>117</counter117>\n"
2128 " <counter118>118</counter118>\n"
2129 " <counter119>119</counter119>\n"
2130 " <counter120>120</counter120>\n"
2131 " <counter121>121</counter121>\n"
2132 " <counter122>122</counter122>\n"
2133 " <counter123>123</counter123>\n"
2134 " <counter124>124</counter124>\n"
2135 " <counter125>125</counter125>\n"
2136 " <counter126>126</counter126>\n"
2137 " <counter127>127</counter127>\n"
2138 " <counter128>128</counter128>\n"
2139 " <counter129>129</counter129>\n"
2140 " <counter130>130</counter130>\n"
2141 " <counter131>131</counter131>\n"
2142 " <counter132>132</counter132>\n"
2143 " <counter133>133</counter133>\n"
2144 " <counter134>134</counter134>\n"
2145 " <counter135>135</counter135>\n"
2146 " <counter136>136</counter136>\n"
2147 " <counter137>137</counter137>\n"
2148 " <counter138>138</counter138>\n"
2149 " <counter139>139</counter139>\n"
2150 " <counter140>140</counter140>\n"
2151 " <counter141>141</counter141>\n"
2152 " <counter142>142</counter142>\n"
2153 " <counter143>143</counter143>\n"
2154 " <counter144>144</counter144>\n"
2155 " <counter145>145</counter145>\n"
2156 " <counter146>146</counter146>\n"
2157 " <counter147>147</counter147>\n"
2158 " <counter148>148</counter148>\n"
2159 " <counter149>149</counter149>\n"
2160 " <counter150>150</counter150>\n"
2161 " <counter151>151</counter151>\n"
2162 " <counter152>152</counter152>\n"
2163 " <counter153>153</counter153>\n"
2164 " <counter154>154</counter154>\n"
2165 " <counter155>155</counter155>\n"
2166 " <counter156>156</counter156>\n"
2167 " <counter157>157</counter157>\n"
2168 " <counter158>158</counter158>\n"
2169 " <counter159>159</counter159>\n"
2170 " <counter160>160</counter160>\n"
2171 " <counter161>161</counter161>\n"
2172 " <counter162>162</counter162>\n"
2173 " <counter163>163</counter163>\n"
2174 " <counter164>164</counter164>\n"
2175 " <counter165>165</counter165>\n"
2176 " <counter166>166</counter166>\n"
2177 " <counter167>167</counter167>\n"
2178 " <counter168>168</counter168>\n"
2179 " <counter169>169</counter169>\n"
2180 " <counter170>170</counter170>\n"
2181 " <counter171>171</counter171>\n"
2182 " <counter172>172</counter172>\n"
2183 " <counter173>173</counter173>\n"
2184 " <counter174>174</counter174>\n"
2185 " <counter175>175</counter175>\n"
2186 " <counter176>176</counter176>\n"
2187 " <counter177>177</counter177>\n"
2188 " <counter178>178</counter178>\n"
2189 " <counter179>179</counter179>\n"
2190 " <counter180>180</counter180>\n"
2191 " <counter181>181</counter181>\n"
2192 " <counter182>182</counter182>\n"
2193 " <counter183>183</counter183>\n"
2194 " <counter184>184</counter184>\n"
2195 " <counter185>185</counter185>\n"
2196 " <counter186>186</counter186>\n"
2197 " <counter187>187</counter187>\n"
2198 " <counter188>188</counter188>\n"
2199 " <counter189>189</counter189>\n"
2200 " <counter190>190</counter190>\n"
2201 " <counter191>191</counter191>\n"
2202 " <counter192>192</counter192>\n"
2203 " <counter193>193</counter193>\n"
2204 " <counter194>194</counter194>\n"
2205 " <counter195>195</counter195>\n"
2206 " <counter196>196</counter196>\n"
2207 " <counter197>197</counter197>\n"
2208 " <counter198>198</counter198>\n"
2209 " <counter199>199</counter199>\n");
2210 strcat(data_xml,
2211 " <counter200>200</counter200>\n"
2212 " <counter201>201</counter201>\n"
2213 " <counter202>202</counter202>\n"
2214 " <counter203>203</counter203>\n"
2215 " <counter204>204</counter204>\n"
2216 " <counter205>205</counter205>\n"
2217 " <counter206>206</counter206>\n"
2218 " <counter207>207</counter207>\n"
2219 " <counter208>208</counter208>\n"
2220 " <counter209>209</counter209>\n"
2221 " <counter210>210</counter210>\n"
2222 " <counter211>211</counter211>\n"
2223 " <counter212>212</counter212>\n"
2224 " <counter213>213</counter213>\n"
2225 " <counter214>214</counter214>\n"
2226 " <counter215>215</counter215>\n"
2227 " <counter216>216</counter216>\n"
2228 " <counter217>217</counter217>\n"
2229 " <counter218>218</counter218>\n"
2230 " <counter219>219</counter219>\n"
2231 " <counter220>220</counter220>\n"
2232 " <counter221>221</counter221>\n"
2233 " <counter222>222</counter222>\n"
2234 " <counter223>223</counter223>\n"
2235 " <counter224>224</counter224>\n"
2236 " <counter225>225</counter225>\n"
2237 " <counter226>226</counter226>\n"
2238 " <counter227>227</counter227>\n"
2239 " <counter228>228</counter228>\n"
2240 " <counter229>229</counter229>\n"
2241 " <counter230>230</counter230>\n"
2242 " <counter231>231</counter231>\n"
2243 " <counter232>232</counter232>\n"
2244 " <counter233>233</counter233>\n"
2245 " <counter234>234</counter234>\n"
2246 " <counter235>235</counter235>\n"
2247 " <counter236>236</counter236>\n"
2248 " <counter237>237</counter237>\n"
2249 " <counter238>238</counter238>\n"
2250 " <counter239>239</counter239>\n"
2251 " <counter240>240</counter240>\n"
2252 " <counter241>241</counter241>\n"
2253 " <counter242>242</counter242>\n"
2254 " <counter243>243</counter243>\n"
2255 " <counter244>244</counter244>\n"
2256 " <counter245>245</counter245>\n"
2257 " <counter246>246</counter246>\n"
2258 " <counter247>247</counter247>\n"
2259 " <counter248>248</counter248>\n"
2260 " <counter249>249</counter249>\n"
2261 " <counter250>250</counter250>\n"
2262 " <counter251>251</counter251>\n"
2263 " <counter252>252</counter252>\n"
2264 " <counter253>253</counter253>\n"
2265 " <counter254>254</counter254>\n"
2266 " <counter255>255</counter255>\n"
2267 " <counter256>256</counter256>\n"
2268 " <counter257>257</counter257>\n"
2269 " <counter258>258</counter258>\n"
2270 " <counter259>259</counter259>\n"
2271 " <counter260>260</counter260>\n"
2272 " <counter261>261</counter261>\n"
2273 " <counter262>262</counter262>\n"
2274 " <counter263>263</counter263>\n"
2275 " <counter264>264</counter264>\n"
2276 " <counter265>265</counter265>\n"
2277 " <counter266>266</counter266>\n"
2278 " <counter267>267</counter267>\n"
2279 " <counter268>268</counter268>\n"
2280 " <counter269>269</counter269>\n"
2281 " <counter270>270</counter270>\n"
2282 " <counter271>271</counter271>\n"
2283 " <counter272>272</counter272>\n"
2284 " <counter273>273</counter273>\n"
2285 " <counter274>274</counter274>\n"
2286 " <counter275>275</counter275>\n"
2287 " <counter276>276</counter276>\n"
2288 " <counter277>277</counter277>\n"
2289 " <counter278>278</counter278>\n"
2290 " <counter279>279</counter279>\n"
2291 " <counter280>280</counter280>\n"
2292 " <counter281>281</counter281>\n"
2293 " <counter282>282</counter282>\n"
2294 " <counter283>283</counter283>\n"
2295 " <counter284>284</counter284>\n"
2296 " <counter285>285</counter285>\n"
2297 " <counter286>286</counter286>\n"
2298 " <counter287>287</counter287>\n"
2299 " <counter288>288</counter288>\n"
2300 " <counter289>289</counter289>\n"
2301 " <counter290>290</counter290>\n"
2302 " <counter291>291</counter291>\n"
2303 " <counter292>292</counter292>\n"
2304 " <counter293>293</counter293>\n"
2305 " <counter294>294</counter294>\n"
2306 " <counter295>295</counter295>\n"
2307 " <counter296>296</counter296>\n"
2308 " <counter297>297</counter297>\n"
2309 " <counter298>298</counter298>\n"
2310 " <counter299>299</counter299>\n");
2311 strcat(data_xml,
2312 " <counter300>300</counter300>\n"
2313 " <counter301>301</counter301>\n"
2314 " <counter302>302</counter302>\n"
2315 " <counter303>303</counter303>\n"
2316 " <counter304>304</counter304>\n"
2317 " <counter305>305</counter305>\n"
2318 " <counter306>306</counter306>\n"
2319 " <counter307>307</counter307>\n"
2320 " <counter308>308</counter308>\n"
2321 " <counter309>309</counter309>\n"
2322 " <counter310>310</counter310>\n"
2323 " <counter311>311</counter311>\n"
2324 " <counter312>312</counter312>\n"
2325 " <counter313>313</counter313>\n"
2326 " <counter314>314</counter314>\n"
2327 " <counter315>315</counter315>\n"
2328 " <counter316>316</counter316>\n"
2329 " <counter317>317</counter317>\n"
2330 " <counter318>318</counter318>\n"
2331 " <counter319>319</counter319>\n"
2332 " <counter320>320</counter320>\n"
2333 " <counter321>321</counter321>\n"
2334 " <counter322>322</counter322>\n"
2335 " <counter323>323</counter323>\n"
2336 " <counter324>324</counter324>\n"
2337 " <counter325>325</counter325>\n"
2338 " <counter326>326</counter326>\n"
2339 " <counter327>327</counter327>\n"
2340 " <counter328>328</counter328>\n"
2341 " <counter329>329</counter329>\n"
2342 " <counter330>330</counter330>\n"
2343 " <counter331>331</counter331>\n"
2344 " <counter332>332</counter332>\n"
2345 " <counter333>333</counter333>\n"
2346 " <counter334>334</counter334>\n"
2347 " <counter335>335</counter335>\n"
2348 " <counter336>336</counter336>\n"
2349 " <counter337>337</counter337>\n"
2350 " <counter338>338</counter338>\n"
2351 " <counter339>339</counter339>\n"
2352 " <counter340>340</counter340>\n"
2353 " <counter341>341</counter341>\n"
2354 " <counter342>342</counter342>\n"
2355 " <counter343>343</counter343>\n"
2356 " <counter344>344</counter344>\n"
2357 " <counter345>345</counter345>\n"
2358 " <counter346>346</counter346>\n"
2359 " <counter347>347</counter347>\n"
2360 " <counter348>348</counter348>\n"
2361 " <counter349>349</counter349>\n"
2362 " <counter350>350</counter350>\n"
2363 " <counter351>351</counter351>\n"
2364 " <counter352>352</counter352>\n"
2365 " <counter353>353</counter353>\n"
2366 " <counter354>354</counter354>\n"
2367 " <counter355>355</counter355>\n"
2368 " <counter356>356</counter356>\n"
2369 " <counter357>357</counter357>\n"
2370 " <counter358>358</counter358>\n"
2371 " <counter359>359</counter359>\n"
2372 " <counter360>360</counter360>\n"
2373 " <counter361>361</counter361>\n"
2374 " <counter362>362</counter362>\n"
2375 " <counter363>363</counter363>\n"
2376 " <counter364>364</counter364>\n"
2377 " <counter365>365</counter365>\n"
2378 " <counter366>366</counter366>\n"
2379 " <counter367>367</counter367>\n"
2380 " <counter368>368</counter368>\n"
2381 " <counter369>369</counter369>\n"
2382 " <counter370>370</counter370>\n"
2383 " <counter371>371</counter371>\n"
2384 " <counter372>372</counter372>\n"
2385 " <counter373>373</counter373>\n"
2386 " <counter374>374</counter374>\n"
2387 " <counter375>375</counter375>\n"
2388 " <counter376>376</counter376>\n"
2389 " <counter377>377</counter377>\n"
2390 " <counter378>378</counter378>\n"
2391 " <counter379>379</counter379>\n"
2392 " <counter380>380</counter380>\n"
2393 " <counter381>381</counter381>\n"
2394 " <counter382>382</counter382>\n"
2395 " <counter383>383</counter383>\n"
2396 " <counter384>384</counter384>\n"
2397 " <counter385>385</counter385>\n"
2398 " <counter386>386</counter386>\n"
2399 " <counter387>387</counter387>\n"
2400 " <counter388>388</counter388>\n"
2401 " <counter389>389</counter389>\n"
2402 " <counter390>390</counter390>\n"
2403 " <counter391>391</counter391>\n"
2404 " <counter392>392</counter392>\n"
2405 " <counter393>393</counter393>\n"
2406 " <counter394>394</counter394>\n"
2407 " <counter395>395</counter395>\n"
2408 " <counter396>396</counter396>\n"
2409 " <counter397>397</counter397>\n"
2410 " <counter398>398</counter398>\n"
2411 " <counter399>399</counter399>\n");
2412 strcat(data_xml,
2413 " <counter400>400</counter400>\n"
2414 " <counter401>401</counter401>\n"
2415 " <counter402>402</counter402>\n"
2416 " <counter403>403</counter403>\n"
2417 " <counter404>404</counter404>\n"
2418 " <counter405>405</counter405>\n"
2419 " <counter406>406</counter406>\n"
2420 " <counter407>407</counter407>\n"
2421 " <counter408>408</counter408>\n"
2422 " <counter409>409</counter409>\n"
2423 " <counter410>410</counter410>\n"
2424 " <counter411>411</counter411>\n"
2425 " <counter412>412</counter412>\n"
2426 " <counter413>413</counter413>\n"
2427 " <counter414>414</counter414>\n"
2428 " <counter415>415</counter415>\n"
2429 " <counter416>416</counter416>\n"
2430 " <counter417>417</counter417>\n"
2431 " <counter418>418</counter418>\n"
2432 " <counter419>419</counter419>\n"
2433 " <counter420>420</counter420>\n"
2434 " <counter421>421</counter421>\n"
2435 " <counter422>422</counter422>\n"
2436 " <counter423>423</counter423>\n"
2437 " <counter424>424</counter424>\n"
2438 " <counter425>425</counter425>\n"
2439 " <counter426>426</counter426>\n"
2440 " <counter427>427</counter427>\n"
2441 " <counter428>428</counter428>\n"
2442 " <counter429>429</counter429>\n"
2443 " <counter430>430</counter430>\n"
2444 " <counter431>431</counter431>\n"
2445 " <counter432>432</counter432>\n"
2446 " <counter433>433</counter433>\n"
2447 " <counter434>434</counter434>\n"
2448 " <counter435>435</counter435>\n"
2449 " <counter436>436</counter436>\n"
2450 " <counter437>437</counter437>\n"
2451 " <counter438>438</counter438>\n"
2452 " <counter439>439</counter439>\n"
2453 " <counter440>440</counter440>\n"
2454 " <counter441>441</counter441>\n"
2455 " <counter442>442</counter442>\n"
2456 " <counter443>443</counter443>\n"
2457 " <counter444>444</counter444>\n"
2458 " <counter445>445</counter445>\n"
2459 " <counter446>446</counter446>\n"
2460 " <counter447>447</counter447>\n"
2461 " <counter448>448</counter448>\n"
2462 " <counter449>449</counter449>\n"
2463 " <counter450>450</counter450>\n"
2464 " <counter451>451</counter451>\n"
2465 " <counter452>452</counter452>\n"
2466 " <counter453>453</counter453>\n"
2467 " <counter454>454</counter454>\n"
2468 " <counter455>455</counter455>\n"
2469 " <counter456>456</counter456>\n"
2470 " <counter457>457</counter457>\n"
2471 " <counter458>458</counter458>\n"
2472 " <counter459>459</counter459>\n"
2473 " <counter460>460</counter460>\n"
2474 " <counter461>461</counter461>\n"
2475 " <counter462>462</counter462>\n"
2476 " <counter463>463</counter463>\n"
2477 " <counter464>464</counter464>\n"
2478 " <counter465>465</counter465>\n"
2479 " <counter466>466</counter466>\n"
2480 " <counter467>467</counter467>\n"
2481 " <counter468>468</counter468>\n"
2482 " <counter469>469</counter469>\n"
2483 " <counter470>470</counter470>\n"
2484 " <counter471>471</counter471>\n"
2485 " <counter472>472</counter472>\n"
2486 " <counter473>473</counter473>\n"
2487 " <counter474>474</counter474>\n"
2488 " <counter475>475</counter475>\n"
2489 " <counter476>476</counter476>\n"
2490 " <counter477>477</counter477>\n"
2491 " <counter478>478</counter478>\n"
2492 " <counter479>479</counter479>\n"
2493 " <counter480>480</counter480>\n"
2494 " <counter481>481</counter481>\n"
2495 " <counter482>482</counter482>\n"
2496 " <counter483>483</counter483>\n"
2497 " <counter484>484</counter484>\n"
2498 " <counter485>485</counter485>\n"
2499 " <counter486>486</counter486>\n"
2500 " <counter487>487</counter487>\n"
2501 " <counter488>488</counter488>\n"
2502 " <counter489>489</counter489>\n"
2503 " <counter490>490</counter490>\n"
2504 " <counter491>491</counter491>\n"
2505 " <counter492>492</counter492>\n"
2506 " <counter493>493</counter493>\n"
2507 " <counter494>494</counter494>\n"
2508 " <counter495>495</counter495>\n"
2509 " <counter496>496</counter496>\n"
2510 " <counter497>497</counter497>\n"
2511 " <counter498>498</counter498>\n"
2512 " <counter499>499</counter499>\n"
2513 "</stats>\n");
2514
2515 UTEST_ADD_MODULE(counters_yang, LYS_IN_YANG, NULL, NULL);
2516
2517 CHECK_PRINT_THEN_PARSE(data_xml);
2518
2519 free(counters_yang);
2520 free(data_xml);
2521}
2522
Radek Iša56ca9e42020-09-08 18:42:00 +02002523#if 0
2524
2525static void
2526test_types(void **state)
2527{
2528 struct state *st = (*state);
2529 int ret;
2530
2531 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2532 assert_non_null(ly_ctx_load_module(st->ctx, "types", NULL));
2533
2534 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/types.xml", LYD_XML, LYD_OPT_CONFIG);
Michal Vasko60ea6352020-06-29 13:39:39 +02002535 assert_ptr_not_equal(st->dt1, NULL);
2536
Radek Iša56ca9e42020-09-08 18:42:00 +02002537 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
Michal Vasko60ea6352020-06-29 13:39:39 +02002538 assert_int_equal(ret, 0);
2539
Radek Iša56ca9e42020-09-08 18:42:00 +02002540 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
Michal Vasko60ea6352020-06-29 13:39:39 +02002541 assert_ptr_not_equal(st->dt2, NULL);
2542
2543 check_data_tree(st->dt1, st->dt2);
2544}
2545
Radek Iša56ca9e42020-09-08 18:42:00 +02002546static void
2547test_annotations(void **state)
2548{
2549 struct state *st = (*state);
2550 int ret;
2551
2552 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2553 assert_non_null(ly_ctx_load_module(st->ctx, "annotations", NULL));
2554
2555 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/annotations.xml", LYD_XML, LYD_OPT_CONFIG);
2556 assert_ptr_not_equal(st->dt1, NULL);
2557
2558 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2559 assert_int_equal(ret, 0);
2560
2561 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2562 assert_ptr_not_equal(st->dt2, NULL);
2563
2564 check_data_tree(st->dt1, st->dt2);
2565}
2566
2567static void
2568test_similar_annot_names(void **state)
2569{
2570 struct state *st = (*state);
2571 int ret;
2572
2573 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2574 assert_non_null(ly_ctx_load_module(st->ctx, "annotations", NULL));
2575
2576 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/similar-annot-names.xml", LYD_XML, LYD_OPT_CONFIG);
2577 assert_ptr_not_equal(st->dt1, NULL);
2578
2579 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2580 assert_int_equal(ret, 0);
2581
2582 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2583 assert_ptr_not_equal(st->dt2, NULL);
2584
2585 check_data_tree(st->dt1, st->dt2);
2586}
2587
2588static void
2589test_many_child_annot(void **state)
2590{
2591 struct state *st = (*state);
2592 int ret;
2593
2594 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2595 assert_non_null(ly_ctx_load_module(st->ctx, "annotations", NULL));
2596
2597 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/many-childs-annot.xml", LYD_XML, LYD_OPT_CONFIG);
2598 assert_ptr_not_equal(st->dt1, NULL);
2599
2600 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2601 assert_int_equal(ret, 0);
2602
2603 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2604 assert_ptr_not_equal(st->dt2, NULL);
2605
2606 check_data_tree(st->dt1, st->dt2);
2607}
2608
2609static void
2610test_union(void **state)
2611{
2612 struct state *st = (*state);
2613 int ret;
2614
2615 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2616 assert_non_null(ly_ctx_load_module(st->ctx, "union", NULL));
2617
2618 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/union.xml", LYD_XML, LYD_OPT_CONFIG);
2619 assert_ptr_not_equal(st->dt1, NULL);
2620
2621 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2622 assert_int_equal(ret, 0);
2623
2624 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2625 assert_ptr_not_equal(st->dt2, NULL);
2626
2627 check_data_tree(st->dt1, st->dt2);
2628}
2629
2630static void
2631test_union2(void **state)
2632{
2633 struct state *st = (*state);
2634 int ret;
2635
2636 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2637 assert_non_null(ly_ctx_load_module(st->ctx, "statements", NULL));
2638
2639 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/union2.xml", LYD_XML, LYD_OPT_CONFIG);
2640 assert_ptr_not_equal(st->dt1, NULL);
2641
2642 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2643 assert_int_equal(ret, 0);
2644
2645 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2646 assert_ptr_not_equal(st->dt2, NULL);
2647
2648 check_data_tree(st->dt1, st->dt2);
2649}
2650
2651static void
2652test_collisions(void **state)
2653{
2654 struct state *st = (*state);
2655 int ret;
2656
2657 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2658 assert_non_null(ly_ctx_load_module(st->ctx, "annotations", NULL));
2659
2660 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/collisions.xml", LYD_XML, LYD_OPT_CONFIG);
2661 assert_ptr_not_equal(st->dt1, NULL);
2662
2663 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2664 assert_int_equal(ret, 0);
2665
2666 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2667 assert_ptr_not_equal(st->dt2, NULL);
2668
2669 check_data_tree(st->dt1, st->dt2);
2670}
2671
2672static void
2673test_anydata(void **state)
2674{
2675 struct state *st = (*state);
2676 const struct lys_module *mod;
2677 int ret;
2678 const char *test_anydata =
2679 "module test-anydata {"
2680 " namespace \"urn:test-anydata\";"
2681 " prefix ya;"
2682 ""
2683 " container cont {"
2684 " anydata ntf;"
2685 " }"
2686 "}";
2687
2688 assert_non_null(ly_ctx_load_module(st->ctx, "ietf-netconf-notifications", NULL));
2689
2690 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/ietf-netconf-notifications.json", LYD_JSON, LYD_OPT_NOTIF | LYD_OPT_TRUSTED, NULL);
2691 assert_ptr_not_equal(st->dt1, NULL);
2692
2693 / *get notification in LYB format to set as anydata content * /
2694 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2695 assert_int_equal(ret, 0);
2696
2697 lyd_free_withsiblings(st->dt1);
2698 st->dt1 = NULL;
2699
2700 / *now comes the real test, test anydata * /
2701 mod = lys_parse_mem(st->ctx, test_anydata, LYS_YANG);
2702 assert_non_null(mod);
2703
2704 st->dt1 = lyd_new(NULL, mod, "cont");
2705 assert_non_null(st->dt1);
2706
2707 assert_non_null(lyd_new_anydata(st->dt1, NULL, "ntf", st->mem, LYD_ANYDATA_LYBD));
2708 st->mem = NULL;
2709
2710 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2711 assert_int_equal(ret, 0);
2712
2713 ret = lyd_validate(&st->dt1, LYD_OPT_CONFIG, NULL);
2714 assert_int_equal(ret, 0);
2715
2716 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2717 assert_ptr_not_equal(st->dt2, NULL);
2718
2719 check_data_tree(st->dt1, st->dt2);
2720
2721 /* and also test the embedded notification itself */
2722 free(st->mem);
2723 ret = lyd_lyb_data_length(((struct lyd_node_anydata *)st->dt1->child)->value.mem);
2724 st->mem = malloc(ret);
2725 memcpy(st->mem, ((struct lyd_node_anydata *)st->dt1->child)->value.mem, ret);
2726
2727 lyd_free_withsiblings(st->dt2);
2728 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_NOTIF | LYD_OPT_STRICT | LYD_OPT_NOEXTDEPS, NULL);
2729 assert_ptr_not_equal(st->dt2, NULL);
2730
2731 /* parse the JSON again for this comparison */
2732 lyd_free_withsiblings(st->dt1);
2733 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/ietf-netconf-notifications.json", LYD_JSON, LYD_OPT_NOTIF | LYD_OPT_TRUSTED, NULL);
2734 assert_ptr_not_equal(st->dt1, NULL);
2735
2736 check_data_tree(st->dt1, st->dt2);
2737}
2738
2739static void
2740test_submodule_feature(void **state)
2741{
2742 struct state *st = (*state);
2743 const struct lys_module *mod;
2744 int ret;
2745
2746 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2747 mod = ly_ctx_load_module(st->ctx, "feature-submodule-main", NULL);
2748 assert_non_null(mod);
2749 assert_int_equal(lys_features_enable(mod, "test-submodule-feature"), 0);
2750
2751 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/test-submodule-feature.json", LYD_JSON, LYD_OPT_CONFIG);
2752 assert_ptr_not_equal(st->dt1, NULL);
2753
2754 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2755 assert_int_equal(ret, 0);
2756
2757 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2758 assert_ptr_not_equal(st->dt2, NULL);
2759
2760 check_data_tree(st->dt1, st->dt2);
2761}
2762
2763static void
2764test_coliding_augments(void **state)
2765{
2766 struct state *st = (*state);
2767 int ret;
2768
2769 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2770 assert_non_null(ly_ctx_load_module(st->ctx, "augment-target", NULL));
2771 assert_non_null(ly_ctx_load_module(st->ctx, "augment0", NULL));
2772 assert_non_null(ly_ctx_load_module(st->ctx, "augment1", NULL));
2773
2774 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/augment.xml", LYD_XML, LYD_OPT_CONFIG);
2775 assert_ptr_not_equal(st->dt1, NULL);
2776
2777 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2778 assert_int_equal(ret, 0);
2779
2780 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2781 assert_ptr_not_equal(st->dt2, NULL);
2782
2783 check_data_tree(st->dt1, st->dt2);
2784}
2785
2786static void
2787test_leafrefs(void **state)
2788{
2789 struct state *st = (*state);
2790 int ret;
2791
2792 ly_ctx_set_searchdir(st->ctx, TESTS_DIR "/data/files");
2793 assert_non_null(ly_ctx_load_module(st->ctx, "leafrefs2", NULL));
2794
2795 st->dt1 = lyd_parse_path(st->ctx, TESTS_DIR "/data/files/leafrefs2.json", LYD_JSON, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2796 assert_ptr_not_equal(st->dt1, NULL);
2797
2798 ret = lyd_print_mem(&st->mem, st->dt1, LYD_LYB, LYP_WITHSIBLINGS);
2799 assert_int_equal(ret, 0);
2800
2801 st->dt2 = lyd_parse_mem(st->ctx, st->mem, LYD_LYB, LYD_OPT_CONFIG | LYD_OPT_STRICT);
2802 assert_ptr_not_equal(st->dt2, NULL);
2803
2804 check_data_tree(st->dt1, st->dt2);
2805}
2806
2807#endif
Michal Vasko60ea6352020-06-29 13:39:39 +02002808
2809int
2810main(void)
2811{
2812 const struct CMUnitTest tests[] = {
aPiecek3c6cf2f2021-09-21 14:15:50 +02002813 UTEST(tests_leaflist),
2814 UTEST(tests_list),
2815 UTEST(tests_any),
Radek Iša56ca9e42020-09-08 18:42:00 +02002816 UTEST(test_ietf_interfaces, setup),
2817 UTEST(test_origin, setup),
2818 UTEST(test_statements, setup),
Michal Vaskoffc92bf2021-06-21 08:15:14 +02002819 UTEST(test_opaq, setup),
Michal Vasko6374de22022-09-05 15:48:48 +02002820 UTEST(test_collisions, setup),
Radek Iša56ca9e42020-09-08 18:42:00 +02002821#if 0
2822 cmocka_unit_test_setup_teardown(test_types, setup_f, teardown_f),
Michal Vasko60ea6352020-06-29 13:39:39 +02002823 cmocka_unit_test_setup_teardown(test_annotations, setup_f, teardown_f),
2824 cmocka_unit_test_setup_teardown(test_similar_annot_names, setup_f, teardown_f),
2825 cmocka_unit_test_setup_teardown(test_many_child_annot, setup_f, teardown_f),
2826 cmocka_unit_test_setup_teardown(test_union, setup_f, teardown_f),
2827 cmocka_unit_test_setup_teardown(test_union2, setup_f, teardown_f),
2828 cmocka_unit_test_setup_teardown(test_collisions, setup_f, teardown_f),
2829 cmocka_unit_test_setup_teardown(test_anydata, setup_f, teardown_f),
2830 cmocka_unit_test_setup_teardown(test_submodule_feature, setup_f, teardown_f),
2831 cmocka_unit_test_setup_teardown(test_coliding_augments, setup_f, teardown_f),
Radek Iša56ca9e42020-09-08 18:42:00 +02002832 cmocka_unit_test_setup_teardown(test_leafrefs, setup_f, teardown_f),
2833#endif
Michal Vasko60ea6352020-06-29 13:39:39 +02002834 };
2835
2836 return cmocka_run_group_tests(tests, NULL, NULL);
2837}