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