1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849
|
<!DOCTYPE html>
<html lang="en" class="RFC">
<head>
<meta charset="utf-8">
<meta content="Common,Latin" name="scripts">
<meta content="initial-scale=1.0" name="viewport">
<title>RFC 9254: Encoding of Data Modeled with YANG in the Concise Binary Object Representation (CBOR)</title>
<meta content="Michel Veillette" name="author">
<meta content="Ivaylo Petrov" name="author">
<meta content="Alexander Pelov" name="author">
<meta content="Carsten Bormann" name="author">
<meta content="Michael Richardson" name="author">
<meta content="
YANG (RFC 7950) is a data modeling language used to model configuration data,
state data, parameters and results of Remote Procedure Call (RPC) operations or actions, and notifications.
This document defines encoding rules for YANG in the Concise Binary Object
Representation (CBOR) (RFC 8949).
" name="description">
<meta content="xml2rfc 3.12.10" name="generator">
<meta content="CBOR" name="keyword">
<meta content="9254" name="rfc.number">
<!-- Generator version information:
xml2rfc 3.12.10
Python 3.6.15
appdirs 1.4.4
ConfigArgParse 1.4.1
google-i18n-address 2.4.0
html5lib 1.0.1
intervaltree 3.0.2
Jinja2 2.11.3
kitchen 1.2.6
lxml 4.7.1
MarkupSafe 2.0.1
pycairo 1.15.1
pycountry 19.8.18
pyflakes 2.1.1
PyYAML 5.4.1
requests 2.24.0
setuptools 40.5.0
six 1.14.0
WeasyPrint 52.5
-->
<link href="rfc9254.xml" rel="alternate" type="application/rfc+xml">
<link href="#copyright" rel="license">
<style type="text/css">/*
NOTE: Changes at the bottom of this file overrides some earlier settings.
Once the style has stabilized and has been adopted as an official RFC style,
this can be consolidated so that style settings occur only in one place, but
for now the contents of this file consists first of the initial CSS work as
provided to the RFC Formatter (xml2rfc) work, followed by itemized and
commented changes found necssary during the development of the v3
formatters.
*/
/* fonts */
@import url('https://fonts.googleapis.com/css?family=Noto+Sans'); /* Sans-serif */
@import url('https://fonts.googleapis.com/css?family=Noto+Serif'); /* Serif (print) */
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono'); /* Monospace */
@viewport {
zoom: 1.0;
width: extend-to-zoom;
}
@-ms-viewport {
width: extend-to-zoom;
zoom: 1.0;
}
/* general and mobile first */
html {
}
body {
max-width: 90%;
margin: 1.5em auto;
color: #222;
background-color: #fff;
font-size: 14px;
font-family: 'Noto Sans', Arial, Helvetica, sans-serif;
line-height: 1.6;
scroll-behavior: smooth;
}
.ears {
display: none;
}
/* headings */
#title, h1, h2, h3, h4, h5, h6 {
margin: 1em 0 0.5em;
font-weight: bold;
line-height: 1.3;
}
#title {
clear: both;
border-bottom: 1px solid #ddd;
margin: 0 0 0.5em 0;
padding: 1em 0 0.5em;
}
.author {
padding-bottom: 4px;
}
h1 {
font-size: 26px;
margin: 1em 0;
}
h2 {
font-size: 22px;
margin-top: -20px; /* provide offset for in-page anchors */
padding-top: 33px;
}
h3 {
font-size: 18px;
margin-top: -36px; /* provide offset for in-page anchors */
padding-top: 42px;
}
h4 {
font-size: 16px;
margin-top: -36px; /* provide offset for in-page anchors */
padding-top: 42px;
}
h5, h6 {
font-size: 14px;
}
#n-copyright-notice {
border-bottom: 1px solid #ddd;
padding-bottom: 1em;
margin-bottom: 1em;
}
/* general structure */
p {
padding: 0;
margin: 0 0 1em 0;
text-align: left;
}
div, span {
position: relative;
}
div {
margin: 0;
}
.alignRight.art-text {
background-color: #f9f9f9;
border: 1px solid #eee;
border-radius: 3px;
padding: 1em 1em 0;
margin-bottom: 1.5em;
}
.alignRight.art-text pre {
padding: 0;
}
.alignRight {
margin: 1em 0;
}
.alignRight > *:first-child {
border: none;
margin: 0;
float: right;
clear: both;
}
.alignRight > *:nth-child(2) {
clear: both;
display: block;
border: none;
}
svg {
display: block;
}
.alignCenter.art-text {
background-color: #f9f9f9;
border: 1px solid #eee;
border-radius: 3px;
padding: 1em 1em 0;
margin-bottom: 1.5em;
}
.alignCenter.art-text pre {
padding: 0;
}
.alignCenter {
margin: 1em 0;
}
.alignCenter > *:first-child {
border: none;
margin: 0 auto;
}
/* lists */
ol, ul {
padding: 0;
margin: 0 0 1em 2em;
}
ol ol, ul ul, ol ul, ul ol {
margin-left: 1em;
}
li {
margin: 0 0 0.25em 0;
}
.ulCompact li {
margin: 0;
}
ul.empty, .ulEmpty {
list-style-type: none;
}
ul.empty li, .ulEmpty li {
margin-top: 0.5em;
}
ul.ulBare, li.ulBare {
margin-left: 0em !important;
}
ul.compact, .ulCompact,
ol.compact, .olCompact {
line-height: 100%;
margin: 0 0 0 2em;
}
/* definition lists */
dl {
}
dl > dt {
float: left;
margin-right: 1em;
}
/*
dl.nohang > dt {
float: none;
}
*/
dl > dd {
margin-bottom: .8em;
min-height: 1.3em;
}
dl.compact > dd, .dlCompact > dd {
margin-bottom: 0em;
}
dl > dd > dl {
margin-top: 0.5em;
margin-bottom: 0em;
}
/* links */
a {
text-decoration: none;
}
a[href] {
color: #22e; /* Arlen: WCAG 2019 */
}
a[href]:hover {
background-color: #f2f2f2;
}
figcaption a[href],
a[href].selfRef {
color: #222;
}
/* XXX probably not this:
a.selfRef:hover {
background-color: transparent;
cursor: default;
} */
/* Figures */
tt, code, pre, code {
background-color: #f9f9f9;
font-family: 'Roboto Mono', monospace;
}
pre {
border: 1px solid #eee;
margin: 0;
padding: 1em;
}
img {
max-width: 100%;
}
figure {
margin: 0;
}
figure blockquote {
margin: 0.8em 0.4em 0.4em;
}
figcaption {
font-style: italic;
margin: 0 0 1em 0;
}
@media screen {
pre {
overflow-x: auto;
max-width: 100%;
max-width: calc(100% - 22px);
}
}
/* aside, blockquote */
aside, blockquote {
margin-left: 0;
padding: 1.2em 2em;
}
blockquote {
background-color: #f9f9f9;
color: #111; /* Arlen: WCAG 2019 */
border: 1px solid #ddd;
border-radius: 3px;
margin: 1em 0;
}
cite {
display: block;
text-align: right;
font-style: italic;
}
/* tables */
table {
width: 100%;
margin: 0 0 1em;
border-collapse: collapse;
border: 1px solid #eee;
}
th, td {
text-align: left;
vertical-align: top;
padding: 0.5em 0.75em;
}
th {
text-align: left;
background-color: #e9e9e9;
}
tr:nth-child(2n+1) > td {
background-color: #f5f5f5;
}
table caption {
font-style: italic;
margin: 0;
padding: 0;
text-align: left;
}
table p {
/* XXX to avoid bottom margin on table row signifiers. If paragraphs should
be allowed within tables more generally, it would be far better to select on a class. */
margin: 0;
}
/* pilcrow */
a.pilcrow {
color: #666; /* Arlen: AHDJ 2019 */
text-decoration: none;
visibility: hidden;
user-select: none;
-ms-user-select: none;
-o-user-select:none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
@media screen {
aside:hover > a.pilcrow,
p:hover > a.pilcrow,
blockquote:hover > a.pilcrow,
div:hover > a.pilcrow,
li:hover > a.pilcrow,
pre:hover > a.pilcrow {
visibility: visible;
}
a.pilcrow:hover {
background-color: transparent;
}
}
/* misc */
hr {
border: 0;
border-top: 1px solid #eee;
}
.bcp14 {
font-variant: small-caps;
}
.role {
font-variant: all-small-caps;
}
/* info block */
#identifiers {
margin: 0;
font-size: 0.9em;
}
#identifiers dt {
width: 3em;
clear: left;
}
#identifiers dd {
float: left;
margin-bottom: 0;
}
/* Fix PDF info block run off issue */
@media print {
#identifiers dd {
float: none;
}
}
#identifiers .authors .author {
display: inline-block;
margin-right: 1.5em;
}
#identifiers .authors .org {
font-style: italic;
}
/* The prepared/rendered info at the very bottom of the page */
.docInfo {
color: #666; /* Arlen: WCAG 2019 */
font-size: 0.9em;
font-style: italic;
margin-top: 2em;
}
.docInfo .prepared {
float: left;
}
.docInfo .prepared {
float: right;
}
/* table of contents */
#toc {
padding: 0.75em 0 2em 0;
margin-bottom: 1em;
}
nav.toc ul {
margin: 0 0.5em 0 0;
padding: 0;
list-style: none;
}
nav.toc li {
line-height: 1.3em;
margin: 0.75em 0;
padding-left: 1.2em;
text-indent: -1.2em;
}
/* references */
.references dt {
text-align: right;
font-weight: bold;
min-width: 7em;
}
.references dd {
margin-left: 8em;
overflow: auto;
}
.refInstance {
margin-bottom: 1.25em;
}
.references .ascii {
margin-bottom: 0.25em;
}
/* index */
.index ul {
margin: 0 0 0 1em;
padding: 0;
list-style: none;
}
.index ul ul {
margin: 0;
}
.index li {
margin: 0;
text-indent: -2em;
padding-left: 2em;
padding-bottom: 5px;
}
.indexIndex {
margin: 0.5em 0 1em;
}
.index a {
font-weight: 700;
}
/* make the index two-column on all but the smallest screens */
@media (min-width: 600px) {
.index ul {
-moz-column-count: 2;
-moz-column-gap: 20px;
}
.index ul ul {
-moz-column-count: 1;
-moz-column-gap: 0;
}
}
/* authors */
address.vcard {
font-style: normal;
margin: 1em 0;
}
address.vcard .nameRole {
font-weight: 700;
margin-left: 0;
}
address.vcard .label {
font-family: "Noto Sans",Arial,Helvetica,sans-serif;
margin: 0.5em 0;
}
address.vcard .type {
display: none;
}
.alternative-contact {
margin: 1.5em 0 1em;
}
hr.addr {
border-top: 1px dashed;
margin: 0;
color: #ddd;
max-width: calc(100% - 16px);
}
/* temporary notes */
.rfcEditorRemove::before {
position: absolute;
top: 0.2em;
right: 0.2em;
padding: 0.2em;
content: "The RFC Editor will remove this note";
color: #9e2a00; /* Arlen: WCAG 2019 */
background-color: #ffd; /* Arlen: WCAG 2019 */
}
.rfcEditorRemove {
position: relative;
padding-top: 1.8em;
background-color: #ffd; /* Arlen: WCAG 2019 */
border-radius: 3px;
}
.cref {
background-color: #ffd; /* Arlen: WCAG 2019 */
padding: 2px 4px;
}
.crefSource {
font-style: italic;
}
/* alternative layout for smaller screens */
@media screen and (max-width: 1023px) {
body {
padding-top: 2em;
}
#title {
padding: 1em 0;
}
h1 {
font-size: 24px;
}
h2 {
font-size: 20px;
margin-top: -18px; /* provide offset for in-page anchors */
padding-top: 38px;
}
#identifiers dd {
max-width: 60%;
}
#toc {
position: fixed;
z-index: 2;
top: 0;
right: 0;
padding: 0;
margin: 0;
background-color: inherit;
border-bottom: 1px solid #ccc;
}
#toc h2 {
margin: -1px 0 0 0;
padding: 4px 0 4px 6px;
padding-right: 1em;
min-width: 190px;
font-size: 1.1em;
text-align: right;
background-color: #444;
color: white;
cursor: pointer;
}
#toc h2::before { /* css hamburger */
float: right;
position: relative;
width: 1em;
height: 1px;
left: -164px;
margin: 6px 0 0 0;
background: white none repeat scroll 0 0;
box-shadow: 0 4px 0 0 white, 0 8px 0 0 white;
content: "";
}
#toc nav {
display: none;
padding: 0.5em 1em 1em;
overflow: auto;
height: calc(100vh - 48px);
border-left: 1px solid #ddd;
}
}
/* alternative layout for wide screens */
@media screen and (min-width: 1024px) {
body {
max-width: 724px;
margin: 42px auto;
padding-left: 1.5em;
padding-right: 29em;
}
#toc {
position: fixed;
top: 42px;
right: 42px;
width: 25%;
margin: 0;
padding: 0 1em;
z-index: 1;
}
#toc h2 {
border-top: none;
border-bottom: 1px solid #ddd;
font-size: 1em;
font-weight: normal;
margin: 0;
padding: 0.25em 1em 1em 0;
}
#toc nav {
display: block;
height: calc(90vh - 84px);
bottom: 0;
padding: 0.5em 0 0;
overflow: auto;
}
img { /* future proofing */
max-width: 100%;
height: auto;
}
}
/* pagination */
@media print {
body {
width: 100%;
}
p {
orphans: 3;
widows: 3;
}
#n-copyright-notice {
border-bottom: none;
}
#toc, #n-introduction {
page-break-before: always;
}
#toc {
border-top: none;
padding-top: 0;
}
figure, pre {
page-break-inside: avoid;
}
figure {
overflow: scroll;
}
pre.breakable {
break-inside: auto;
}
h1, h2, h3, h4, h5, h6 {
page-break-after: avoid;
}
h2+*, h3+*, h4+*, h5+*, h6+* {
page-break-before: avoid;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
font-size: 10pt;
}
table {
border: 1px solid #ddd;
}
td {
border-top: 1px solid #ddd;
}
}
/* This is commented out here, as the string-set: doesn't
pass W3C validation currently */
/*
.ears thead .left {
string-set: ears-top-left content();
}
.ears thead .center {
string-set: ears-top-center content();
}
.ears thead .right {
string-set: ears-top-right content();
}
.ears tfoot .left {
string-set: ears-bottom-left content();
}
.ears tfoot .center {
string-set: ears-bottom-center content();
}
.ears tfoot .right {
string-set: ears-bottom-right content();
}
*/
@page :first {
padding-top: 0;
@top-left {
content: normal;
border: none;
}
@top-center {
content: normal;
border: none;
}
@top-right {
content: normal;
border: none;
}
}
@page {
size: A4;
margin-bottom: 45mm;
padding-top: 20px;
/* The follwing is commented out here, but set appropriately by in code, as
the content depends on the document */
/*
@top-left {
content: 'Internet-Draft';
vertical-align: bottom;
border-bottom: solid 1px #ccc;
}
@top-left {
content: string(ears-top-left);
vertical-align: bottom;
border-bottom: solid 1px #ccc;
}
@top-center {
content: string(ears-top-center);
vertical-align: bottom;
border-bottom: solid 1px #ccc;
}
@top-right {
content: string(ears-top-right);
vertical-align: bottom;
border-bottom: solid 1px #ccc;
}
@bottom-left {
content: string(ears-bottom-left);
vertical-align: top;
border-top: solid 1px #ccc;
}
@bottom-center {
content: string(ears-bottom-center);
vertical-align: top;
border-top: solid 1px #ccc;
}
@bottom-right {
content: '[Page ' counter(page) ']';
vertical-align: top;
border-top: solid 1px #ccc;
}
*/
}
/* Changes introduced to fix issues found during implementation */
/* Make sure links are clickable even if overlapped by following H* */
a {
z-index: 2;
}
/* Separate body from document info even without intervening H1 */
section {
clear: both;
}
/* Top align author divs, to avoid names without organization dropping level with org names */
.author {
vertical-align: top;
}
/* Leave room in document info to show Internet-Draft on one line */
#identifiers dt {
width: 8em;
}
/* Don't waste quite as much whitespace between label and value in doc info */
#identifiers dd {
margin-left: 1em;
}
/* Give floating toc a background color (needed when it's a div inside section */
#toc {
background-color: white;
}
/* Make the collapsed ToC header render white on gray also when it's a link */
@media screen and (max-width: 1023px) {
#toc h2 a,
#toc h2 a:link,
#toc h2 a:focus,
#toc h2 a:hover,
#toc a.toplink,
#toc a.toplink:hover {
color: white;
background-color: #444;
text-decoration: none;
}
}
/* Give the bottom of the ToC some whitespace */
@media screen and (min-width: 1024px) {
#toc {
padding: 0 0 1em 1em;
}
}
/* Style section numbers with more space between number and title */
.section-number {
padding-right: 0.5em;
}
/* prevent monospace from becoming overly large */
tt, code, pre, code {
font-size: 95%;
}
/* Fix the height/width aspect for ascii art*/
pre.sourcecode,
.art-text pre {
line-height: 1.12;
}
/* Add styling for a link in the ToC that points to the top of the document */
a.toplink {
float: right;
margin-right: 0.5em;
}
/* Fix the dl styling to match the RFC 7992 attributes */
dl > dt,
dl.dlParallel > dt {
float: left;
margin-right: 1em;
}
dl.dlNewline > dt {
float: none;
}
/* Provide styling for table cell text alignment */
table td.text-left,
table th.text-left {
text-align: left;
}
table td.text-center,
table th.text-center {
text-align: center;
}
table td.text-right,
table th.text-right {
text-align: right;
}
/* Make the alternative author contact informatio look less like just another
author, and group it closer with the primary author contact information */
.alternative-contact {
margin: 0.5em 0 0.25em 0;
}
address .non-ascii {
margin: 0 0 0 2em;
}
/* With it being possible to set tables with alignment
left, center, and right, { width: 100%; } does not make sense */
table {
width: auto;
}
/* Avoid reference text that sits in a block with very wide left margin,
because of a long floating dt label.*/
.references dd {
overflow: visible;
}
/* Control caption placement */
caption {
caption-side: bottom;
}
/* Limit the width of the author address vcard, so names in right-to-left
script don't end up on the other side of the page. */
address.vcard {
max-width: 30em;
margin-right: auto;
}
/* For address alignment dependent on LTR or RTL scripts */
address div.left {
text-align: left;
}
address div.right {
text-align: right;
}
/* Provide table alignment support. We can't use the alignX classes above
since they do unwanted things with caption and other styling. */
table.right {
margin-left: auto;
margin-right: 0;
}
table.center {
margin-left: auto;
margin-right: auto;
}
table.left {
margin-left: 0;
margin-right: auto;
}
/* Give the table caption label the same styling as the figcaption */
caption a[href] {
color: #222;
}
@media print {
.toplink {
display: none;
}
/* avoid overwriting the top border line with the ToC header */
#toc {
padding-top: 1px;
}
/* Avoid page breaks inside dl and author address entries */
.vcard {
page-break-inside: avoid;
}
}
/* Tweak the bcp14 keyword presentation */
.bcp14 {
font-variant: small-caps;
font-weight: bold;
font-size: 0.9em;
}
/* Tweak the invisible space above H* in order not to overlay links in text above */
h2 {
margin-top: -18px; /* provide offset for in-page anchors */
padding-top: 31px;
}
h3 {
margin-top: -18px; /* provide offset for in-page anchors */
padding-top: 24px;
}
h4 {
margin-top: -18px; /* provide offset for in-page anchors */
padding-top: 24px;
}
/* Float artwork pilcrow to the right */
@media screen {
.artwork a.pilcrow {
display: block;
line-height: 0.7;
margin-top: 0.15em;
}
}
/* Make pilcrows on dd visible */
@media screen {
dd:hover > a.pilcrow {
visibility: visible;
}
}
/* Make the placement of figcaption match that of a table's caption
by removing the figure's added bottom margin */
.alignLeft.art-text,
.alignCenter.art-text,
.alignRight.art-text {
margin-bottom: 0;
}
.alignLeft,
.alignCenter,
.alignRight {
margin: 1em 0 0 0;
}
/* In print, the pilcrow won't show on hover, so prevent it from taking up space,
possibly even requiring a new line */
@media print {
a.pilcrow {
display: none;
}
}
/* Styling for the external metadata */
div#external-metadata {
background-color: #eee;
padding: 0.5em;
margin-bottom: 0.5em;
display: none;
}
div#internal-metadata {
padding: 0.5em; /* to match the external-metadata padding */
}
/* Styling for title RFC Number */
h1#rfcnum {
clear: both;
margin: 0 0 -1em;
padding: 1em 0 0 0;
}
/* Make .olPercent look the same as <ol><li> */
dl.olPercent > dd {
margin-bottom: 0.25em;
min-height: initial;
}
/* Give aside some styling to set it apart */
aside {
border-left: 1px solid #ddd;
margin: 1em 0 1em 2em;
padding: 0.2em 2em;
}
aside > dl,
aside > ol,
aside > ul,
aside > table,
aside > p {
margin-bottom: 0.5em;
}
/* Additional page break settings */
@media print {
figcaption, table caption {
page-break-before: avoid;
}
}
/* Font size adjustments for print */
@media print {
body { font-size: 10pt; line-height: normal; max-width: 96%; }
h1 { font-size: 1.72em; padding-top: 1.5em; } /* 1*1.2*1.2*1.2 */
h2 { font-size: 1.44em; padding-top: 1.5em; } /* 1*1.2*1.2 */
h3 { font-size: 1.2em; padding-top: 1.5em; } /* 1*1.2 */
h4 { font-size: 1em; padding-top: 1.5em; }
h5, h6 { font-size: 1em; margin: initial; padding: 0.5em 0 0.3em; }
}
/* Sourcecode margin in print, when there's no pilcrow */
@media print {
.artwork,
.sourcecode {
margin-bottom: 1em;
}
}
/* Avoid narrow tables forcing too narrow table captions, which may render badly */
table {
min-width: 20em;
}
/* ol type a */
ol.type-a { list-style-type: lower-alpha; }
ol.type-A { list-style-type: upper-alpha; }
ol.type-i { list-style-type: lower-roman; }
ol.type-I { list-style-type: lower-roman; }
/* Apply the print table and row borders in general, on request from the RPC,
and increase the contrast between border and odd row background sligthtly */
table {
border: 1px solid #ddd;
}
td {
border-top: 1px solid #ddd;
}
tr:nth-child(2n+1) > td {
background-color: #f8f8f8;
}
/* Use style rules to govern display of the TOC. */
@media screen and (max-width: 1023px) {
#toc nav { display: none; }
#toc.active nav { display: block; }
}
/* Add support for keepWithNext */
.keepWithNext {
break-after: avoid-page;
break-after: avoid-page;
}
/* Add support for keepWithPrevious */
.keepWithPrevious {
break-before: avoid-page;
}
/* Change the approach to avoiding breaks inside artwork etc. */
figure, pre, table, .artwork, .sourcecode {
break-before: auto;
break-after: auto;
}
/* Avoid breaks between <dt> and <dd> */
dl {
break-before: auto;
break-inside: auto;
}
dt {
break-before: auto;
break-after: avoid-page;
}
dd {
break-before: avoid-page;
break-after: auto;
orphans: 3;
widows: 3
}
span.break, dd.break {
margin-bottom: 0;
min-height: 0;
break-before: auto;
break-inside: auto;
break-after: auto;
}
/* Undo break-before ToC */
@media print {
#toc {
break-before: auto;
}
}
/* Text in compact lists should not get extra bottim margin space,
since that would makes the list not compact */
ul.compact p, .ulCompact p,
ol.compact p, .olCompact p {
margin: 0;
}
/* But the list as a whole needs the extra space at the end */
section ul.compact,
section .ulCompact,
section ol.compact,
section .olCompact {
margin-bottom: 1em; /* same as p not within ul.compact etc. */
}
/* The tt and code background above interferes with for instance table cell
backgrounds. Changed to something a bit more selective. */
tt, code {
background-color: transparent;
}
p tt, p code, li tt, li code {
background-color: #f8f8f8;
}
/* Tweak the pre margin -- 0px doesn't come out well */
pre {
margin-top: 0.5px;
}
/* Tweak the comact list text */
ul.compact, .ulCompact,
ol.compact, .olCompact,
dl.compact, .dlCompact {
line-height: normal;
}
/* Don't add top margin for nested lists */
li > ul, li > ol, li > dl,
dd > ul, dd > ol, dd > dl,
dl > dd > dl {
margin-top: initial;
}
/* Elements that should not be rendered on the same line as a <dt> */
/* This should match the element list in writer.text.TextWriter.render_dl() */
dd > div.artwork:first-child,
dd > aside:first-child,
dd > figure:first-child,
dd > ol:first-child,
dd > div:first-child > pre.sourcecode,
dd > table:first-child,
dd > ul:first-child {
clear: left;
}
/* fix for weird browser behaviour when <dd/> is empty */
dt+dd:empty::before{
content: "\00a0";
}
/* Make paragraph spacing inside <li> smaller than in body text, to fit better within the list */
li > p {
margin-bottom: 0.5em
}
/* Don't let p margin spill out from inside list items */
li > p:last-of-type {
margin-bottom: 0;
}
</style>
<link href="rfc-local.css" rel="stylesheet" type="text/css">
<link href="https://dx.doi.org/10.17487/rfc9254" rel="alternate">
<link href="urn:issn:2070-1721" rel="alternate">
<link href="https://datatracker.ietf.org/doc/draft-ietf-core-yang-cbor-20" rel="prev">
</head>
<body>
<script src="https://www.rfc-editor.org/js/metadata.min.js"></script>
<table class="ears">
<thead><tr>
<td class="left">RFC 9254</td>
<td class="center">CBOR Encoding of Data Modeled with YANG</td>
<td class="right">July 2022</td>
</tr></thead>
<tfoot><tr>
<td class="left">Veillette, et al.</td>
<td class="center">Standards Track</td>
<td class="right">[Page]</td>
</tr></tfoot>
</table>
<div id="external-metadata" class="document-information"></div>
<div id="internal-metadata" class="document-information">
<dl id="identifiers">
<dt class="label-stream">Stream:</dt>
<dd class="stream">Internet Engineering Task Force (IETF)</dd>
<dt class="label-rfc">RFC:</dt>
<dd class="rfc"><a href="https://www.rfc-editor.org/rfc/rfc9254" class="eref">9254</a></dd>
<dt class="label-category">Category:</dt>
<dd class="category">Standards Track</dd>
<dt class="label-published">Published:</dt>
<dd class="published">
<time datetime="2022-07" class="published">July 2022</time>
</dd>
<dt class="label-issn">ISSN:</dt>
<dd class="issn">2070-1721</dd>
<dt class="label-authors">Authors:</dt>
<dd class="authors">
<div class="author">
<div class="author-name">M. Veillette, <span class="editor">Ed.</span>
</div>
<div class="org">Trilliant Networks Inc.</div>
</div>
<div class="author">
<div class="author-name">I. Petrov, <span class="editor">Ed.</span>
</div>
<div class="org">Google Switzerland GmbH</div>
</div>
<div class="author">
<div class="author-name">A. Pelov</div>
<div class="org">Acklio</div>
</div>
<div class="author">
<div class="author-name">C. Bormann</div>
<div class="org">Universität Bremen TZI</div>
</div>
<div class="author">
<div class="author-name">M. Richardson</div>
<div class="org">Sandelman Software Works</div>
</div>
</dd>
</dl>
</div>
<h1 id="rfcnum">RFC 9254</h1>
<h1 id="title">Encoding of Data Modeled with YANG in the Concise Binary Object Representation (CBOR)</h1>
<section id="section-abstract">
<h2 id="abstract"><a href="#abstract" class="selfRef">Abstract</a></h2>
<p id="section-abstract-1">YANG (RFC 7950) is a data modeling language used to model configuration data,
state data, parameters and results of Remote Procedure Call (RPC) operations or actions, and notifications.<a href="#section-abstract-1" class="pilcrow">¶</a></p>
<p id="section-abstract-2">This document defines encoding rules for YANG in the Concise Binary Object
Representation (CBOR) (RFC 8949).<a href="#section-abstract-2" class="pilcrow">¶</a></p>
</section>
<div id="status-of-memo">
<section id="section-boilerplate.1">
<h2 id="name-status-of-this-memo">
<a href="#name-status-of-this-memo" class="section-name selfRef">Status of This Memo</a>
</h2>
<p id="section-boilerplate.1-1">
This is an Internet Standards Track document.<a href="#section-boilerplate.1-1" class="pilcrow">¶</a></p>
<p id="section-boilerplate.1-2">
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by
the Internet Engineering Steering Group (IESG). Further
information on Internet Standards is available in Section 2 of
RFC 7841.<a href="#section-boilerplate.1-2" class="pilcrow">¶</a></p>
<p id="section-boilerplate.1-3">
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
<span><a href="https://www.rfc-editor.org/info/rfc9254">https://www.rfc-editor.org/info/rfc9254</a></span>.<a href="#section-boilerplate.1-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="copyright">
<section id="section-boilerplate.2">
<h2 id="name-copyright-notice">
<a href="#name-copyright-notice" class="section-name selfRef">Copyright Notice</a>
</h2>
<p id="section-boilerplate.2-1">
Copyright (c) 2022 IETF Trust and the persons identified as the
document authors. All rights reserved.<a href="#section-boilerplate.2-1" class="pilcrow">¶</a></p>
<p id="section-boilerplate.2-2">
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<span><a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a></span>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with
respect to this document. Code Components extracted from this
document must include Revised BSD License text as described in
Section 4.e of the Trust Legal Provisions and are provided without
warranty as described in the Revised BSD License.<a href="#section-boilerplate.2-2" class="pilcrow">¶</a></p>
</section>
</div>
<div id="toc">
<section id="section-toc.1">
<a href="#" onclick="scroll(0,0)" class="toplink">▲</a><h2 id="name-table-of-contents">
<a href="#name-table-of-contents" class="section-name selfRef">Table of Contents</a>
</h2>
<nav class="toc"><ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1">
<p id="section-toc.1-1.1.1" class="keepWithNext"><a href="#section-1" class="xref">1</a>. <a href="#name-introduction" class="xref">Introduction</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2">
<p id="section-toc.1-1.2.1" class="keepWithNext"><a href="#section-2" class="xref">2</a>. <a href="#name-terminology-and-notation" class="xref">Terminology and Notation</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3">
<p id="section-toc.1-1.3.1"><a href="#section-3" class="xref">3</a>. <a href="#name-properties-of-the-cbor-enco" class="xref">Properties of the CBOR Encoding</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.1">
<p id="section-toc.1-1.3.2.1.1" class="keepWithNext"><a href="#section-3.1" class="xref">3.1</a>. <a href="#name-cbor-diagnostic-notation" class="xref">CBOR Diagnostic Notation</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2">
<p id="section-toc.1-1.3.2.2.1"><a href="#section-3.2" class="xref">3.2</a>. <a href="#name-yang-schema-item-identifier" class="xref">YANG Schema Item iDentifier</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.3">
<p id="section-toc.1-1.3.2.3.1"><a href="#section-3.3" class="xref">3.3</a>. <a href="#name-name" class="xref">Name</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4">
<p id="section-toc.1-1.4.1"><a href="#section-4" class="xref">4</a>. <a href="#name-encoding-of-representation-" class="xref">Encoding of Representation Nodes</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.1">
<p id="section-toc.1-1.4.2.1.1"><a href="#section-4.1" class="xref">4.1</a>. <a href="#name-the-leaf" class="xref">The 'leaf'</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.1.2.1">
<p id="section-toc.1-1.4.2.1.2.1.1"><a href="#section-4.1.1" class="xref">4.1.1</a>. <a href="#name-using-sids-in-keys" class="xref">Using SIDs in Keys</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.1.2.2">
<p id="section-toc.1-1.4.2.1.2.2.1"><a href="#section-4.1.2" class="xref">4.1.2</a>. <a href="#name-using-names-in-keys" class="xref">Using Names in Keys</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2">
<p id="section-toc.1-1.4.2.2.1"><a href="#section-4.2" class="xref">4.2</a>. <a href="#name-the-container-and-other-nod" class="xref">The 'container' and Other Nodes from the Data Tree</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2.2.1">
<p id="section-toc.1-1.4.2.2.2.1.1"><a href="#section-4.2.1" class="xref">4.2.1</a>. <a href="#name-using-sids-in-keys-2" class="xref">Using SIDs in Keys</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2.2.2">
<p id="section-toc.1-1.4.2.2.2.2.1"><a href="#section-4.2.2" class="xref">4.2.2</a>. <a href="#name-using-names-in-keys-2" class="xref">Using Names in Keys</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3">
<p id="section-toc.1-1.4.2.3.1"><a href="#section-4.3" class="xref">4.3</a>. <a href="#name-the-leaf-list" class="xref">The 'leaf-list'</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.1">
<p id="section-toc.1-1.4.2.3.2.1.1"><a href="#section-4.3.1" class="xref">4.3.1</a>. <a href="#name-using-sids-in-keys-3" class="xref">Using SIDs in Keys</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.2">
<p id="section-toc.1-1.4.2.3.2.2.1"><a href="#section-4.3.2" class="xref">4.3.2</a>. <a href="#name-using-names-in-keys-3" class="xref">Using Names in Keys</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.4">
<p id="section-toc.1-1.4.2.4.1"><a href="#section-4.4" class="xref">4.4</a>. <a href="#name-the-list-and-the-list-entri" class="xref">The 'list' and the 'list' Entries</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.4.2.1">
<p id="section-toc.1-1.4.2.4.2.1.1"><a href="#section-4.4.1" class="xref">4.4.1</a>. <a href="#name-using-sids-in-keys-4" class="xref">Using SIDs in Keys</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.4.2.2">
<p id="section-toc.1-1.4.2.4.2.2.1"><a href="#section-4.4.2" class="xref">4.4.2</a>. <a href="#name-using-names-in-keys-4" class="xref">Using Names in Keys</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5">
<p id="section-toc.1-1.4.2.5.1"><a href="#section-4.5" class="xref">4.5</a>. <a href="#name-the-anydata" class="xref">The 'anydata'</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5.2.1">
<p id="section-toc.1-1.4.2.5.2.1.1"><a href="#section-4.5.1" class="xref">4.5.1</a>. <a href="#name-using-sids-in-keys-5" class="xref">Using SIDs in Keys</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5.2.2">
<p id="section-toc.1-1.4.2.5.2.2.1"><a href="#section-4.5.2" class="xref">4.5.2</a>. <a href="#name-using-names-in-keys-5" class="xref">Using Names in Keys</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.6">
<p id="section-toc.1-1.4.2.6.1"><a href="#section-4.6" class="xref">4.6</a>. <a href="#name-the-anyxml" class="xref">The 'anyxml'</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.6.2.1">
<p id="section-toc.1-1.4.2.6.2.1.1"><a href="#section-4.6.1" class="xref">4.6.1</a>. <a href="#name-using-sids-in-keys-6" class="xref">Using SIDs in Keys</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.6.2.2">
<p id="section-toc.1-1.4.2.6.2.2.1"><a href="#section-4.6.2" class="xref">4.6.2</a>. <a href="#name-using-names-in-keys-6" class="xref">Using Names in Keys</a></p>
</li>
</ul>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5">
<p id="section-toc.1-1.5.1"><a href="#section-5" class="xref">5</a>. <a href="#name-encoding-of-the-yang-data-e" class="xref">Encoding of the 'yang-data' Extension</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.1">
<p id="section-toc.1-1.5.2.1.1"><a href="#section-5.1" class="xref">5.1</a>. <a href="#name-using-sids-in-keys-7" class="xref">Using SIDs in Keys</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5.2.2">
<p id="section-toc.1-1.5.2.2.1"><a href="#section-5.2" class="xref">5.2</a>. <a href="#name-using-names-in-keys-7" class="xref">Using Names in Keys</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6">
<p id="section-toc.1-1.6.1"><a href="#section-6" class="xref">6</a>. <a href="#name-representing-yang-data-type" class="xref">Representing YANG Data Types in CBOR</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.1">
<p id="section-toc.1-1.6.2.1.1"><a href="#section-6.1" class="xref">6.1</a>. <a href="#name-the-unsigned-integer-types" class="xref">The Unsigned Integer Types</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.2">
<p id="section-toc.1-1.6.2.2.1"><a href="#section-6.2" class="xref">6.2</a>. <a href="#name-the-integer-types" class="xref">The Integer Types</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.3">
<p id="section-toc.1-1.6.2.3.1"><a href="#section-6.3" class="xref">6.3</a>. <a href="#name-the-decimal64-type" class="xref">The 'decimal64' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.4">
<p id="section-toc.1-1.6.2.4.1"><a href="#section-6.4" class="xref">6.4</a>. <a href="#name-the-string-type" class="xref">The 'string' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.5">
<p id="section-toc.1-1.6.2.5.1"><a href="#section-6.5" class="xref">6.5</a>. <a href="#name-the-boolean-type" class="xref">The 'boolean' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.6">
<p id="section-toc.1-1.6.2.6.1"><a href="#section-6.6" class="xref">6.6</a>. <a href="#name-the-enumeration-type" class="xref">The 'enumeration' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.7">
<p id="section-toc.1-1.6.2.7.1"><a href="#section-6.7" class="xref">6.7</a>. <a href="#name-the-bits-type" class="xref">The 'bits' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.8">
<p id="section-toc.1-1.6.2.8.1"><a href="#section-6.8" class="xref">6.8</a>. <a href="#name-the-binary-type" class="xref">The 'binary' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.9">
<p id="section-toc.1-1.6.2.9.1"><a href="#section-6.9" class="xref">6.9</a>. <a href="#name-the-leafref-type" class="xref">The 'leafref' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.10">
<p id="section-toc.1-1.6.2.10.1"><a href="#section-6.10" class="xref">6.10</a>. <a href="#name-the-identityref-type" class="xref">The 'identityref' Type</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.10.2.1">
<p id="section-toc.1-1.6.2.10.2.1.1"><a href="#section-6.10.1" class="xref">6.10.1</a>. <a href="#name-sids-as-identityref" class="xref">SIDs as 'identityref'</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.10.2.2">
<p id="section-toc.1-1.6.2.10.2.2.1"><a href="#section-6.10.2" class="xref">6.10.2</a>. <a href="#name-name-as-identityref" class="xref">Name as 'identityref'</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.11">
<p id="section-toc.1-1.6.2.11.1"><a href="#section-6.11" class="xref">6.11</a>. <a href="#name-the-empty-type" class="xref">The 'empty' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.12">
<p id="section-toc.1-1.6.2.12.1"><a href="#section-6.12" class="xref">6.12</a>. <a href="#name-the-union-type" class="xref">The 'union' Type</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.13">
<p id="section-toc.1-1.6.2.13.1"><a href="#section-6.13" class="xref">6.13</a>. <a href="#name-the-instance-identifier-typ" class="xref">The 'instance-identifier' Type</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.13.2.1">
<p id="section-toc.1-1.6.2.13.2.1.1"><a href="#section-6.13.1" class="xref">6.13.1</a>. <a href="#name-sids-as-instance-identifier" class="xref">SIDs as 'instance-identifier'</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6.2.13.2.2">
<p id="section-toc.1-1.6.2.13.2.2.1"><a href="#section-6.13.2" class="xref">6.13.2</a>. <a href="#name-names-as-instance-identifie" class="xref">Names as 'instance-identifier'</a></p>
</li>
</ul>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7">
<p id="section-toc.1-1.7.1"><a href="#section-7" class="xref">7</a>. <a href="#name-content-types" class="xref">Content-Types</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8">
<p id="section-toc.1-1.8.1"><a href="#section-8" class="xref">8</a>. <a href="#name-security-considerations" class="xref">Security Considerations</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9">
<p id="section-toc.1-1.9.1"><a href="#section-9" class="xref">9</a>. <a href="#name-iana-considerations" class="xref">IANA Considerations</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9.2.1">
<p id="section-toc.1-1.9.2.1.1"><a href="#section-9.1" class="xref">9.1</a>. <a href="#name-media-types-registry" class="xref">Media Types Registry</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9.2.2">
<p id="section-toc.1-1.9.2.2.1"><a href="#section-9.2" class="xref">9.2</a>. <a href="#name-coap-content-formats-regist" class="xref">CoAP Content-Formats Registry</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9.2.3">
<p id="section-toc.1-1.9.2.3.1"><a href="#section-9.3" class="xref">9.3</a>. <a href="#name-cbor-tags-registry" class="xref">CBOR Tags Registry</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.10">
<p id="section-toc.1-1.10.1"><a href="#section-10" class="xref">10</a>. <a href="#name-references" class="xref">References</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.10.2.1">
<p id="section-toc.1-1.10.2.1.1"><a href="#section-10.1" class="xref">10.1</a>. <a href="#name-normative-references" class="xref">Normative References</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.10.2.2">
<p id="section-toc.1-1.10.2.2.1"><a href="#section-10.2" class="xref">10.2</a>. <a href="#name-informative-references" class="xref">Informative References</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.11">
<p id="section-toc.1-1.11.1"><a href="#appendix-A" class="xref"></a><a href="#name-acknowledgments" class="xref">Acknowledgments</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.12">
<p id="section-toc.1-1.12.1"><a href="#appendix-B" class="xref"></a><a href="#name-authors-addresses" class="xref">Authors' Addresses</a></p>
</li>
</ul>
</nav>
</section>
</div>
<div id="introduction">
<section id="section-1">
<h2 id="name-introduction">
<a href="#section-1" class="section-number selfRef">1. </a><a href="#name-introduction" class="section-name selfRef">Introduction</a>
</h2>
<p id="section-1-1">The specification of the YANG 1.1 data modeling language <span>[<a href="#RFC7950" class="xref">RFC7950</a>]</span> defines an XML encoding for data instances, i.e., contents of configuration datastores, state data, RPC inputs and outputs, action inputs and outputs, and event notifications.<a href="#section-1-1" class="pilcrow">¶</a></p>
<p id="section-1-2">An additional set of encoding rules has been defined in <span>[<a href="#RFC7951" class="xref">RFC7951</a>]</span> based on
"The JavaScript Object Notation (JSON) Data Interchange Format" <span>[<a href="#RFC8259" class="xref">RFC8259</a>]</span>.<a href="#section-1-2" class="pilcrow">¶</a></p>
<p id="section-1-3">The aim of this document is to define a set of encoding rules for the Concise Binary Object Representation (CBOR) <span>[<a href="#RFC8949" class="xref">RFC8949</a>]</span>, collectively called "YANG-CBOR". The resulting encoding is more compact compared to XML and JSON and more suitable for constrained nodes and/or constrained networks, as defined by <span>[<a href="#RFC7228" class="xref">RFC7228</a>]</span>.<a href="#section-1-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="terminology-and-notation">
<section id="section-2">
<h2 id="name-terminology-and-notation">
<a href="#section-2" class="section-number selfRef">2. </a><a href="#name-terminology-and-notation" class="section-name selfRef">Terminology and Notation</a>
</h2>
<p id="section-2-1">
The key words "<span class="bcp14">MUST</span>", "<span class="bcp14">MUST NOT</span>", "<span class="bcp14">REQUIRED</span>", "<span class="bcp14">SHALL</span>", "<span class="bcp14">SHALL NOT</span>", "<span class="bcp14">SHOULD</span>", "<span class="bcp14">SHOULD NOT</span>", "<span class="bcp14">RECOMMENDED</span>", "<span class="bcp14">NOT RECOMMENDED</span>",
"<span class="bcp14">MAY</span>", and "<span class="bcp14">OPTIONAL</span>" in this document are to be interpreted as
described in BCP 14 <span>[<a href="#RFC2119" class="xref">RFC2119</a>]</span> <span>[<a href="#RFC8174" class="xref">RFC8174</a>]</span>
when, and only when, they appear in all capitals, as shown here.<a href="#section-2-1" class="pilcrow">¶</a></p>
<p id="section-2-2">SID values (and the SID deltas computed from them) shown in the examples are example values; these examples do not allocate the SIDs shown for specific items in the modules.<a href="#section-2-2" class="pilcrow">¶</a></p>
<p id="section-2-3">The following terms are defined in <span>[<a href="#RFC7950" class="xref">RFC7950</a>]</span>:<a href="#section-2-3" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-2-4.1">action<a href="#section-2-4.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.2">anydata<a href="#section-2-4.2" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.3">anyxml<a href="#section-2-4.3" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.4">data node<a href="#section-2-4.4" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.5">data tree<a href="#section-2-4.5" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.6">datastore<a href="#section-2-4.6" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.7">feature<a href="#section-2-4.7" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.8">identity<a href="#section-2-4.8" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.9">module<a href="#section-2-4.9" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.10">notification<a href="#section-2-4.10" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.11">RPC<a href="#section-2-4.11" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.12">schema node<a href="#section-2-4.12" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-2-4.13">submodule<a href="#section-2-4.13" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-2-5">The following term is defined in <span>[<a href="#RFC8040" class="xref">RFC8040</a>]</span>:<a href="#section-2-5" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-2-6.1">yang-data extension<a href="#section-2-6.1" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-2-7">The following term is defined in <span>[<a href="#RFC8791" class="xref">RFC8791</a>]</span>:<a href="#section-2-7" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-2-8.1">YANG data structure<a href="#section-2-8.1" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-2-9">This specification also makes use of the following terminology:<a href="#section-2-9" class="pilcrow">¶</a></p>
<span class="break"></span><dl class="dlNewline" id="section-2-10">
<dt id="section-2-10.1">YANG Schema Item iDentifier (or "YANG SID" or simply "SID"):</dt>
<dd style="margin-left: 1.5em" id="section-2-10.2"> 63-bit unsigned integer used to identify different YANG items.<a href="#section-2-10.2" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-2-10.3">delta:</dt>
<dd style="margin-left: 1.5em" id="section-2-10.4"> Difference between the current YANG SID and a reference YANG SID. A reference YANG SID is defined for each context for which deltas are used.<a href="#section-2-10.4" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-2-10.5">absolute SID:</dt>
<dd style="margin-left: 1.5em" id="section-2-10.6">A YANG SID that is not encoded as a delta. This is usually
called out explicitly only in positions where normally a delta would
be found.<a href="#section-2-10.6" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-2-10.7">representation tree:</dt>
<dd style="margin-left: 1.5em" id="section-2-10.8"> A YANG data tree, possibly enclosed by a
representation of a schema node, such as a YANG data structure, a notification, an RPC, or
an action.<a href="#section-2-10.8" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-2-10.9">representation node:</dt>
<dd style="margin-left: 1.5em" id="section-2-10.10"> A node in a representation tree, i.e., a data
tree node, or a representation of a schema node, such as a YANG data structure, a
notification, an RPC, or an action.<a href="#section-2-10.10" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-2-10.11">item:</dt>
<dd style="margin-left: 1.5em" id="section-2-10.12"> A schema node, an identity, a module, or a feature defined using the YANG modeling language.<a href="#section-2-10.12" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-2-10.13">list entry:</dt>
<dd style="margin-left: 1.5em" id="section-2-10.14"> The data associated with a single entry of a list (see
<span><a href="https://www.rfc-editor.org/rfc/rfc7950#section-7.8" class="relref">Section 7.8</a> of [<a href="#RFC7950" class="xref">RFC7950</a>]</span>).<a href="#section-2-10.14" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-2-10.15">container-like instance:</dt>
<dd style="margin-left: 1.5em" id="section-2-10.16"> An instance of a container,
a YANG data structure, notification contents, RPC input, RPC output,
action input, or action output (<a href="#container" class="xref">Section 4.2</a>); a list entry in a list (<a href="#list" class="xref">Section 4.4</a>); or an anydata node (<a href="#the-anydata" class="xref">Section 4.5</a>).<a href="#section-2-10.16" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-2-10.17">parent (of a representation node):</dt>
<dd style="margin-left: 1.5em" id="section-2-10.18"> The schema node of the closest
enclosing representation node in which a given representation node
is defined.<a href="#section-2-10.18" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
</dl>
</section>
</div>
<div id="properties-of-cbor-encoding">
<section id="section-3">
<h2 id="name-properties-of-the-cbor-enco">
<a href="#section-3" class="section-number selfRef">3. </a><a href="#name-properties-of-the-cbor-enco" class="section-name selfRef">Properties of the CBOR Encoding</a>
</h2>
<p id="section-3-1">This document defines CBOR encoding rules for YANG data trees and their subtrees.<a href="#section-3-1" class="pilcrow">¶</a></p>
<p id="section-3-2">A YANG data tree can be enclosed by a representation of a schema node, such as a YANG data structure, a notification, an RPC, or an action; this is called a representation tree. The data tree nodes and the enclosing schema node representation, if any, are collectively called the representation nodes.<a href="#section-3-2" class="pilcrow">¶</a></p>
<p id="section-3-3">A representation node, such as a container, list entry, YANG data structure, notification, RPC input, RPC output, action input, action output, or anydata node, is serialized using a CBOR map in which each schema node defined within is encoded using a key and a value.
This specification supports two types of CBOR keys: YANG Schema Item iDentifier (YANG SID), as defined in <a href="#sid" class="xref">Section 3.2</a>, and names, as defined in <a href="#name" class="xref">Section 3.3</a>. Each of these key types is encoded using a specific CBOR type that allows their interpretation during the deserialization process. Protocols or mechanisms implementing this specification can mandate the use of a specific key type or allow the generator to choose freely per key.<a href="#section-3-3" class="pilcrow">¶</a></p>
<p id="section-3-4">In order to minimize the size of the encoded data, the
mapping avoids any unnecessary meta-information beyond that directly
provided by the CBOR basic generic data model (<span><a href="https://www.rfc-editor.org/rfc/rfc8949#section-2" class="relref">Section 2</a> of [<a href="#RFC8949" class="xref">RFC8949</a>]</span>). For instance, CBOR tags are used solely in the case of an absolute SID, anyxml data nodes, or the union datatype to explicitly distinguish the use of different YANG datatypes encoded using the same CBOR major type.<a href="#section-3-4" class="pilcrow">¶</a></p>
<p id="section-3-5">Unless specified otherwise by the protocol or mechanism implementing this specification, the indefinite length encoding, as defined in <span><a href="https://www.rfc-editor.org/rfc/rfc8949#section-3.2" class="relref">Section 3.2</a> of [<a href="#RFC8949" class="xref">RFC8949</a>]</span>, <span class="bcp14">SHALL</span> be supported by the CBOR decoders employed with YANG-CBOR.
(This enables an implementation to begin emitting an array or map
before the number of entries in that structure is known, possibly also
avoiding excessive locking or race conditions.
On the other hand, it deprives the receiver of the encoded data from
advance announcement about some size information, so a generator
should choose indefinite length encoding only when these benefits do
accrue.)<a href="#section-3-5" class="pilcrow">¶</a></p>
<p id="section-3-6">Data nodes implemented using a CBOR array, map, byte string, or text string can be instantiated but empty. In this case, they are encoded with a length of zero.<a href="#section-3-6" class="pilcrow">¶</a></p>
<p id="section-3-7">When representation nodes are serialized using the rules defined by this specification as part of an application payload, the payload <span class="bcp14">SHOULD</span> include information that would allow each node to be identified in a stateless way, for instance, the SID number associated with the node, the SID delta from another SID in the application payload, the namespace-qualified name, or the instance-identifier.<a href="#section-3-7" class="pilcrow">¶</a></p>
<p id="section-3-8">Examples in <a href="#instance-encoding" class="xref">Section 4</a> include a root CBOR map with a single entry having a key set to either a namespace-qualified name or a SID. This root CBOR map is provided only as a typical usage example and is not part of the present encoding rules. Only the value within this CBOR map is compulsory.<a href="#section-3-8" class="pilcrow">¶</a></p>
<div id="cbor-diagnostic-notation">
<section id="section-3.1">
<h3 id="name-cbor-diagnostic-notation">
<a href="#section-3.1" class="section-number selfRef">3.1. </a><a href="#name-cbor-diagnostic-notation" class="section-name selfRef">CBOR Diagnostic Notation</a>
</h3>
<p id="section-3.1-1">Within this document, CBOR binary contents are represented using an equivalent textual form called CBOR diagnostic notation, as defined in <span><a href="https://www.rfc-editor.org/rfc/rfc8949#section-8" class="relref">Section 8</a> of [<a href="#RFC8949" class="xref">RFC8949</a>]</span>. This notation is used strictly for documentation purposes and is never used in the data serialization. <a href="#diagnostic-notation-summary" class="xref">Table 1</a> below provides a summary of this notation.<a href="#section-3.1-1" class="pilcrow">¶</a></p>
<span id="name-cbor-diagnostic-notation-su"></span><div id="diagnostic-notation-summary">
<table class="center" id="table-1">
<caption>
<a href="#table-1" class="selfRef">Table 1</a>:
<a href="#name-cbor-diagnostic-notation-su" class="selfRef">CBOR Diagnostic Notation Summary</a>
</caption>
<thead>
<tr>
<th class="text-left" rowspan="1" colspan="1">CBOR Content</th>
<th class="text-left" rowspan="1" colspan="1">CBOR Type</th>
<th class="text-left" rowspan="1" colspan="1">Diagnostic Notation</th>
<th class="text-left" rowspan="1" colspan="1">Example</th>
<th class="text-left" rowspan="1" colspan="1">CBOR Encoding</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left" rowspan="1" colspan="1">Unsigned integer</td>
<td class="text-left" rowspan="1" colspan="1">0</td>
<td class="text-left" rowspan="1" colspan="1">Decimal digits</td>
<td class="text-left" rowspan="1" colspan="1">123</td>
<td class="text-left" rowspan="1" colspan="1">18 7B</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">Negative integer</td>
<td class="text-left" rowspan="1" colspan="1">1</td>
<td class="text-left" rowspan="1" colspan="1">Decimal digits prefixed by a minus sign</td>
<td class="text-left" rowspan="1" colspan="1">-123</td>
<td class="text-left" rowspan="1" colspan="1">38 7A</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">Byte string</td>
<td class="text-left" rowspan="1" colspan="1">2</td>
<td class="text-left" rowspan="1" colspan="1">Hexadecimal value enclosed between single quotes and prefixed by an 'h'</td>
<td class="text-left" rowspan="1" colspan="1">h'F15C'</td>
<td class="text-left" rowspan="1" colspan="1">42 F15C</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">Text string</td>
<td class="text-left" rowspan="1" colspan="1">3</td>
<td class="text-left" rowspan="1" colspan="1">String of Unicode characters enclosed between double quotes</td>
<td class="text-left" rowspan="1" colspan="1">"txt"</td>
<td class="text-left" rowspan="1" colspan="1">63 747874</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">Array</td>
<td class="text-left" rowspan="1" colspan="1">4</td>
<td class="text-left" rowspan="1" colspan="1">Comma-separated list of values within square brackets</td>
<td class="text-left" rowspan="1" colspan="1">[ 1, 2 ]</td>
<td class="text-left" rowspan="1" colspan="1">82 01 02</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">Map</td>
<td class="text-left" rowspan="1" colspan="1">5</td>
<td class="text-left" rowspan="1" colspan="1">Comma-separated list of key : value pairs within curly braces</td>
<td class="text-left" rowspan="1" colspan="1">{ 1: 123, 2: 456 }</td>
<td class="text-left" rowspan="1" colspan="1">A2 01187B 021901C8</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">Boolean</td>
<td class="text-left" rowspan="1" colspan="1">7/20</td>
<td class="text-left" rowspan="1" colspan="1">false</td>
<td class="text-left" rowspan="1" colspan="1">false</td>
<td class="text-left" rowspan="1" colspan="1">F4</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1"> </td>
<td class="text-left" rowspan="1" colspan="1">7/21</td>
<td class="text-left" rowspan="1" colspan="1">true</td>
<td class="text-left" rowspan="1" colspan="1">true</td>
<td class="text-left" rowspan="1" colspan="1">F5</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">Null</td>
<td class="text-left" rowspan="1" colspan="1">7/22</td>
<td class="text-left" rowspan="1" colspan="1">null</td>
<td class="text-left" rowspan="1" colspan="1">null</td>
<td class="text-left" rowspan="1" colspan="1">F6</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">Not assigned</td>
<td class="text-left" rowspan="1" colspan="1">7/23</td>
<td class="text-left" rowspan="1" colspan="1">undefined</td>
<td class="text-left" rowspan="1" colspan="1">undefined</td>
<td class="text-left" rowspan="1" colspan="1">F7</td>
</tr>
</tbody>
</table>
</div>
<p id="section-3.1-3">Note: CBOR binary contents shown in this specification are annotated with comments. These comments are delimited by slashes ("/"), as defined in <span><a href="https://www.rfc-editor.org/rfc/rfc8610#appendix-G.6" class="relref">Appendix G.6</a> of [<a href="#RFC8610" class="xref">RFC8610</a>]</span>.<a href="#section-3.1-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="sid">
<section id="section-3.2">
<h3 id="name-yang-schema-item-identifier">
<a href="#section-3.2" class="section-number selfRef">3.2. </a><a href="#name-yang-schema-item-identifier" class="section-name selfRef">YANG Schema Item iDentifier</a>
</h3>
<p id="section-3.2-1">Some of the items defined in YANG <span>[<a href="#RFC7950" class="xref">RFC7950</a>]</span> require the use of a unique identifier. In both the Network Configuration Protocol (NETCONF) <span>[<a href="#RFC6241" class="xref">RFC6241</a>]</span> and RESTCONF <span>[<a href="#RFC8040" class="xref">RFC8040</a>]</span>, these identifiers are implemented using text strings. To allow the implementation of data models defined in YANG in constrained devices and constrained networks, a more compact method to identify YANG items is required. This compact identifier, called "YANG Schema Item iDentifier", is an unsigned integer limited to 63 bits of range (i.e., 0..9223372036854775807 or 0..0x7fffffffffffffff). The following items are identified using YANG SIDs (often shortened to SIDs):<a href="#section-3.2-1" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-3.2-2.1">identities<a href="#section-3.2-2.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-3.2-2.2">data nodes<a href="#section-3.2-2.2" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-3.2-2.3">RPCs and associated input(s) and output(s)<a href="#section-3.2-2.3" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-3.2-2.4">actions and associated input(s) and output(s)<a href="#section-3.2-2.4" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-3.2-2.5">YANG data structures<a href="#section-3.2-2.5" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-3.2-2.6">notifications and associated information<a href="#section-3.2-2.6" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-3.2-2.7">YANG modules and features<a href="#section-3.2-2.7" class="pilcrow">¶</a>
</li>
</ul>
<aside id="section-3.2-3">
<p id="section-3.2-3.1">Note that any structuring of modules into submodules is transparent to YANG-CBOR:
SIDs are not allocated for the names of submodules, and any
items within a submodule are effectively allocated SIDs as part of
processing the module that includes them.<a href="#section-3.2-3.1" class="pilcrow">¶</a></p>
</aside>
<p id="section-3.2-4">To minimize their size, SIDs used as keys in CBOR maps are encoded
using deltas, i.e., signed (negative or unsigned) integers that are
added to the reference SID applying to the map.
The reference SID of an outermost map is zero, unless a different
reference SID is unambiguously conferred from the environment in which
the outermost map is used.
The reference SID of a map that is most directly embedded in a map entry
with a name-based key is zero.
For all other maps, the reference SID is the SID computed for the map
entry it is most directly embedded in.
(The embedding may be indirect if an array intervenes, e.g., in a YANG list.)
Where absolute SIDs are desired in map key positions (where a bare
integer implies a delta), they need to be identified as absolute SID values by using CBOR tag number 47 (as defined in <a href="#container-with-sid" class="xref">Section 4.2.1</a>).<a href="#section-3.2-4" class="pilcrow">¶</a></p>
<p id="section-3.2-5">Thus, conversion from SIDs to deltas and back to SIDs is a stateless
process solely based on the data serialized or deserialized combined
with, potentially, an outermost reference SID unambiguously conferred
by the environment.<a href="#section-3.2-5" class="pilcrow">¶</a></p>
<p id="section-3.2-6">Mechanisms and processes used to assign SIDs to YANG items and to guarantee their uniqueness are outside the scope of the present specification.
If SIDs are to be used, the present specification is used in conjunction with a specification defining this management.
A related document, i.e., <span>[<a href="#I-D.ietf-core-sid" class="xref">CORE-SID</a>]</span>, is intended to serve as the definitive way to assign SID values for YANG modules managed by the IETF and recommends itself for YANG modules managed by non-IETF entities, as well.
The present specification has been designed to allow different methods of assignment to be used within separate domains.<a href="#section-3.2-6" class="pilcrow">¶</a></p>
<p id="section-3.2-7">To provide implementations with a way to internally indicate the
absence of a SID, the SID value 0 is reserved and will not be
allocated; it is not used in interchange.<a href="#section-3.2-7" class="pilcrow">¶</a></p>
</section>
</div>
<div id="name">
<section id="section-3.3">
<h3 id="name-name">
<a href="#section-3.3" class="section-number selfRef">3.3. </a><a href="#name-name" class="section-name selfRef">Name</a>
</h3>
<p id="section-3.3-1">This specification also supports the encoding of YANG item identifiers as text strings, similar to those used by the JSON encoding of data modeled with YANG <span>[<a href="#RFC7951" class="xref">RFC7951</a>]</span>. This approach can be used to avoid the management overhead associated with SID allocation. The main drawback is the significant increase in size of the encoded data.<a href="#section-3.3-1" class="pilcrow">¶</a></p>
<p id="section-3.3-2">YANG item identifiers implemented using names <span class="bcp14">MUST</span> be in one of the following forms:<a href="#section-3.3-2" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-3.3-3.1">simple -- the identifier of the YANG item (i.e., schema node or identity).<a href="#section-3.3-3.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-3.3-3.2">namespace-qualified -- the identifier of the YANG item is prefixed with the name of the module in which this item is defined, separated by the colon character (":").<a href="#section-3.3-3.2" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-3.3-4">The name of a module determines the namespace of all YANG items defined in that module. If an item is defined in a submodule, then the namespace-qualified name uses the name of the main module to which the submodule belongs.<a href="#section-3.3-4" class="pilcrow">¶</a></p>
<p id="section-3.3-5">ABNF syntax <span>[<a href="#RFC5234" class="xref">RFC5234</a>]</span> of a name is shown in <a href="#namesyntax" class="xref">Figure 1</a>, where the production for "identifier" is defined in <span><a href="https://www.rfc-editor.org/rfc/rfc7950#section-14" class="relref">Section 14</a> of [<a href="#RFC7950" class="xref">RFC7950</a>]</span>.<a href="#section-3.3-5" class="pilcrow">¶</a></p>
<span id="name-abnf-production-for-a-simpl"></span><div id="namesyntax">
<figure id="figure-1">
<div id="section-3.3-6.1">
<pre class="lang-abnf sourcecode">
name = [identifier ":"] identifier
</pre>
</div>
<figcaption><a href="#figure-1" class="selfRef">Figure 1</a>:
<a href="#name-abnf-production-for-a-simpl" class="selfRef">ABNF Production for a Simple or Namespace-Qualified Name</a>
</figcaption></figure>
</div>
<p id="section-3.3-7">A namespace-qualified name <span class="bcp14">MUST</span> be used for all members of a top-level CBOR map and then also whenever the namespaces of the representation node and its parent node are different. In all other cases, the simple form of the name <span class="bcp14">MUST</span> be used.<a href="#section-3.3-7" class="pilcrow">¶</a></p>
<p id="section-3.3-8">Definition example:<a href="#section-3.3-8" class="pilcrow">¶</a></p>
<div id="section-3.3-9">
<pre class="lang-yang sourcecode">
module example-foomod {
container top {
leaf foo {
type uint8;
}
}
}
module example-barmod {
import example-foomod {
prefix "foomod";
}
augment "/foomod:top" {
leaf bar {
type boolean;
}
}
}
</pre><a href="#section-3.3-9" class="pilcrow">¶</a>
</div>
<p id="section-3.3-10">A valid CBOR encoding of the 'top' container is as follows.<a href="#section-3.3-10" class="pilcrow">¶</a></p>
<p id="section-3.3-11">CBOR diagnostic notation:<a href="#section-3.3-11" class="pilcrow">¶</a></p>
<div id="section-3.3-12">
<pre class="lang-cbor-diag sourcecode">
{
"example-foomod:top": {
"foo": 54,
"example-barmod:bar": true
}
}
</pre><a href="#section-3.3-12" class="pilcrow">¶</a>
</div>
<p id="section-3.3-13">Both the 'top' container and the 'bar' leaf defined in a different YANG module as its parent container are encoded as namespace-qualified names. The 'foo' leaf defined in the same YANG module as its parent container is encoded as a simple name.<a href="#section-3.3-13" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="instance-encoding">
<section id="section-4">
<h2 id="name-encoding-of-representation-">
<a href="#section-4" class="section-number selfRef">4. </a><a href="#name-encoding-of-representation-" class="section-name selfRef">Encoding of Representation Nodes</a>
</h2>
<p id="section-4-1">Representation nodes defined using the YANG modeling language are encoded using CBOR <span>[<a href="#RFC8949" class="xref">RFC8949</a>]</span>, based on the rules defined in this section. We assume that the reader is
already familiar with both YANG <span>[<a href="#RFC7950" class="xref">RFC7950</a>]</span> and CBOR <span>[<a href="#RFC8949" class="xref">RFC8949</a>]</span>.<a href="#section-4-1" class="pilcrow">¶</a></p>
<div id="the-leaf">
<section id="section-4.1">
<h3 id="name-the-leaf">
<a href="#section-4.1" class="section-number selfRef">4.1. </a><a href="#name-the-leaf" class="section-name selfRef">The 'leaf'</a>
</h3>
<p id="section-4.1-1">A 'leaf' <span class="bcp14">MUST</span> be encoded accordingly to its datatype using one of the encoding rules specified in <a href="#data-types-mapping" class="xref">Section 6</a>.<a href="#section-4.1-1" class="pilcrow">¶</a></p>
<p id="section-4.1-2">The following examples show the encoding of a 'hostname' leaf using a SID or a name.<a href="#section-4.1-2" class="pilcrow">¶</a></p>
<p id="section-4.1-3">Definition example adapted from <span>[<a href="#RFC6991" class="xref">RFC6991</a>]</span> and <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-4.1-3" class="pilcrow">¶</a></p>
<div id="section-4.1-4">
<pre class="lang-yang sourcecode">
typedef domain-name {
type string {
pattern
'((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
+ '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
+ '|\.';
length "1..253";
}
}
leaf hostname {
type inet:domain-name;
}
</pre><a href="#section-4.1-4" class="pilcrow">¶</a>
</div>
<div id="using-sids-in-keys">
<section id="section-4.1.1">
<h4 id="name-using-sids-in-keys">
<a href="#section-4.1.1" class="section-number selfRef">4.1.1. </a><a href="#name-using-sids-in-keys" class="section-name selfRef">Using SIDs in Keys</a>
</h4>
<p id="section-4.1.1-1">As with all examples below, the delta in the outermost map assumes a reference YANG SID (current schema node) of 0.<a href="#section-4.1.1-1" class="pilcrow">¶</a></p>
<p id="section-4.1.1-2">CBOR diagnostic notation:<a href="#section-4.1.1-2" class="pilcrow">¶</a></p>
<div id="section-4.1.1-3">
<pre class="lang-cbor-diag sourcecode">
{
1752 : "myhost.example.com" / hostname (SID 1752) /
}
</pre><a href="#section-4.1.1-3" class="pilcrow">¶</a>
</div>
<p id="section-4.1.1-4" class="keepWithNext">CBOR encoding:<a href="#section-4.1.1-4" class="pilcrow">¶</a></p>
<div id="section-4.1.1-5">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
19 06D8 # unsigned(1752)
72 # text(18)
6D79686F73742E6578616D706C652E636F6D # "myhost.example.com"
</pre><a href="#section-4.1.1-5" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="using-names-in-keys">
<section id="section-4.1.2">
<h4 id="name-using-names-in-keys">
<a href="#section-4.1.2" class="section-number selfRef">4.1.2. </a><a href="#name-using-names-in-keys" class="section-name selfRef">Using Names in Keys</a>
</h4>
<p id="section-4.1.2-1">CBOR diagnostic notation:<a href="#section-4.1.2-1" class="pilcrow">¶</a></p>
<div id="section-4.1.2-2">
<pre class="lang-cbor-diag sourcecode">
{
"ietf-system:hostname" : "myhost.example.com"
}
</pre><a href="#section-4.1.2-2" class="pilcrow">¶</a>
</div>
<p id="section-4.1.2-3" class="keepWithNext">CBOR encoding:<a href="#section-4.1.2-3" class="pilcrow">¶</a></p>
<div id="section-4.1.2-4">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
74 # text(20)
696574662D73797374656D3A686F73746E616D65
72 # text(18)
6D79686F73742E6578616D706C652E636F6D
</pre><a href="#section-4.1.2-4" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
<div id="container">
<section id="section-4.2">
<h3 id="name-the-container-and-other-nod">
<a href="#section-4.2" class="section-number selfRef">4.2. </a><a href="#name-the-container-and-other-nod" class="section-name selfRef">The 'container' and Other Nodes from the Data Tree</a>
</h3>
<p id="section-4.2-1">Instances of containers, YANG data structures, notification contents, RPC inputs, RPC outputs, action inputs, and action outputs <span class="bcp14">MUST</span> be encoded using a CBOR map data item (major type 5).
The same encoding is also used for the list entries in a list (<a href="#list" class="xref">Section 4.4</a>) and for anydata nodes (<a href="#the-anydata" class="xref">Section 4.5</a>).
Collectively, we speak of these instances as "container-like instances".<a href="#section-4.2-1" class="pilcrow">¶</a></p>
<p id="section-4.2-2">A map consists of pairs of data items, with each pair consisting of a key and a value. Each key within the CBOR map is set to a schema node identifier, and each value is set to the value of this representation node according to the instance datatype.<a href="#section-4.2-2" class="pilcrow">¶</a></p>
<p id="section-4.2-3">This specification supports two types of CBOR map keys: SID, as defined in <a href="#sid" class="xref">Section 3.2</a>, and names, as defined in <a href="#name" class="xref">Section 3.3</a>.<a href="#section-4.2-3" class="pilcrow">¶</a></p>
<p id="section-4.2-4">The following examples show the encoding of a 'system-state' container representation instance using SIDs or names.<a href="#section-4.2-4" class="pilcrow">¶</a></p>
<p id="section-4.2-5">Definition example adapted from <span>[<a href="#RFC6991" class="xref">RFC6991</a>]</span> and <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-4.2-5" class="pilcrow">¶</a></p>
<div id="section-4.2-6">
<pre class="lang-yang sourcecode">
typedef date-and-time {
type string {
pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
+ '(Z|[\+\-]\d{2}:\d{2})';
}
}
container system-state {
container clock {
leaf current-datetime {
type date-and-time;
}
leaf boot-datetime {
type date-and-time;
}
}
}
</pre><a href="#section-4.2-6" class="pilcrow">¶</a>
</div>
<div id="container-with-sid">
<section id="section-4.2.1">
<h4 id="name-using-sids-in-keys-2">
<a href="#section-4.2.1" class="section-number selfRef">4.2.1. </a><a href="#name-using-sids-in-keys-2" class="section-name selfRef">Using SIDs in Keys</a>
</h4>
<p id="section-4.2.1-1">In the context of containers and other nodes from the data tree, CBOR map keys within inner CBOR maps can be encoded using deltas (bare integers) or absolute SIDs (tagged with tag number 47).<a href="#section-4.2.1-1" class="pilcrow">¶</a></p>
<p id="section-4.2.1-2">Delta values are computed as follows:<a href="#section-4.2.1-2" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-4.2.1-3.1">In the case of a 'container', deltas are equal to the SID of the current representation node minus the SID of the parent 'container'.<a href="#section-4.2.1-3.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-4.2.1-3.2">In the case of a 'list', deltas are equal to the SID of the current representation node minus the SID of the parent 'list'.<a href="#section-4.2.1-3.2" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-4.2.1-3.3">In the case of an 'RPC input' or 'RPC output', deltas are equal to the SID of the current representation node minus the SID of the 'RPC'.<a href="#section-4.2.1-3.3" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-4.2.1-3.4">In the case of an 'action input' or 'action output', deltas are equal to the SID of the current representation node minus the SID of the 'action'.<a href="#section-4.2.1-3.4" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-4.2.1-3.5">In the case of a 'notification content', deltas are equal to the SID of the current representation node minus the SID of the 'notification'.<a href="#section-4.2.1-3.5" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-4.2.1-4">CBOR diagnostic notation:<a href="#section-4.2.1-4" class="pilcrow">¶</a></p>
<div id="section-4.2.1-5">
<pre class="lang-cbor-diag sourcecode">
{
1720 : { / system-state (SID 1720) /
1 : { / clock (SID 1721) /
2 : "2015-10-02T14:47:24Z-05:00", / current-datetime(SID 1723)/
1 : "2015-09-15T09:12:58Z-05:00" / boot-datetime (SID 1722) /
}
}
}
</pre><a href="#section-4.2.1-5" class="pilcrow">¶</a>
</div>
<p id="section-4.2.1-6">CBOR encoding:<a href="#section-4.2.1-6" class="pilcrow">¶</a></p>
<span id="name-system-state-clock-encoding"></span><div id="Fig-system-clock">
<figure id="figure-2">
<div id="section-4.2.1-7.1">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
19 06B8 # unsigned(1720)
A1 # map(1)
01 # unsigned(1)
A2 # map(2)
02 # unsigned(2)
78 1A # text(26)
323031352D31302D30325431343A34373A32345A2D30353A3030
01 # unsigned(1)
78 1A # text(26)
323031352D30392D31355430393A31323A35385A2D30353A3030
</pre>
</div>
<figcaption><a href="#figure-2" class="selfRef">Figure 2</a>:
<a href="#name-system-state-clock-encoding" class="selfRef">System State Clock Encoding</a>
</figcaption></figure>
</div>
</section>
</div>
<div id="container-with-name">
<section id="section-4.2.2">
<h4 id="name-using-names-in-keys-2">
<a href="#section-4.2.2" class="section-number selfRef">4.2.2. </a><a href="#name-using-names-in-keys-2" class="section-name selfRef">Using Names in Keys</a>
</h4>
<p id="section-4.2.2-1">CBOR map keys implemented using names <span class="bcp14">MUST</span> be encoded using a CBOR
text string data item (major type 3). A namespace-qualified name <span class="bcp14">MUST</span>
be used each time the namespace of a representation node and its parent
differ. In all other cases, the simple form of the name <span class="bcp14">MUST</span> be
used. Names and namespaces are defined in <span><a href="https://www.rfc-editor.org/rfc/rfc7951#section-4" class="relref">Section 4</a> of [<a href="#RFC7951" class="xref">RFC7951</a>]</span>.<a href="#section-4.2.2-1" class="pilcrow">¶</a></p>
<p id="section-4.2.2-2">The following example shows the encoding of a 'system' container representation node instance using names.<a href="#section-4.2.2-2" class="pilcrow">¶</a></p>
<p id="section-4.2.2-3">CBOR diagnostic notation:<a href="#section-4.2.2-3" class="pilcrow">¶</a></p>
<div id="section-4.2.2-4">
<pre class="lang-cbor-diag sourcecode">
{
"ietf-system:system-state" : {
"clock" : {
"current-datetime" : "2015-10-02T14:47:24Z-05:00",
"boot-datetime" : "2015-09-15T09:12:58Z-05:00"
}
}
}
</pre><a href="#section-4.2.2-4" class="pilcrow">¶</a>
</div>
<p id="section-4.2.2-5" class="keepWithNext">CBOR encoding:<a href="#section-4.2.2-5" class="pilcrow">¶</a></p>
<div id="section-4.2.2-6">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
78 18 # text(24)
696574662D73797374656D3A73797374656D2D7374617465
A1 # map(1)
65 # text(5)
636C6F636B # "clock"
A2 # map(2)
70 # text(16)
63757272656E742D6461746574696D65
78 1A # text(26)
323031352D31302D30325431343A34373A32345A2D30353A3030
6D # text(13)
626F6F742D6461746574696D65
78 1A # text(26)
323031352D30392D31355430393A31323A35385A2D30353A3030
</pre><a href="#section-4.2.2-6" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
<div id="leaf-list">
<section id="section-4.3">
<h3 id="name-the-leaf-list">
<a href="#section-4.3" class="section-number selfRef">4.3. </a><a href="#name-the-leaf-list" class="section-name selfRef">The 'leaf-list'</a>
</h3>
<p id="section-4.3-1">A leaf-list <span class="bcp14">MUST</span> be encoded using a CBOR array data item (major type 4). Each entry of this array <span class="bcp14">MUST</span> be encoded accordingly to its datatype using one of the encoding rules specified in <a href="#data-types-mapping" class="xref">Section 6</a>.<a href="#section-4.3-1" class="pilcrow">¶</a></p>
<p id="section-4.3-2">The following example shows the encoding of the 'search' leaf-list representation node instance containing two entries: "ietf.org" and "ieee.org".<a href="#section-4.3-2" class="pilcrow">¶</a></p>
<p id="section-4.3-3">Definition example adapted from <span>[<a href="#RFC6991" class="xref">RFC6991</a>]</span> and <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-4.3-3" class="pilcrow">¶</a></p>
<div id="section-4.3-4">
<pre class="lang-yang sourcecode">
typedef domain-name {
type string {
pattern
'((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
+ '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
+ '|\.';
length "1..253";
}
}
leaf-list search {
type domain-name;
ordered-by user;
}
</pre><a href="#section-4.3-4" class="pilcrow">¶</a>
</div>
<div id="using-sids-in-keys-1">
<section id="section-4.3.1">
<h4 id="name-using-sids-in-keys-3">
<a href="#section-4.3.1" class="section-number selfRef">4.3.1. </a><a href="#name-using-sids-in-keys-3" class="section-name selfRef">Using SIDs in Keys</a>
</h4>
<p id="section-4.3.1-1" class="keepWithNext">CBOR diagnostic notation:<a href="#section-4.3.1-1" class="pilcrow">¶</a></p>
<div id="section-4.3.1-2">
<pre class="lang-cbor-diag sourcecode">
{
1746 : [ "ietf.org", "ieee.org" ] / search (SID 1746) /
}
</pre><a href="#section-4.3.1-2" class="pilcrow">¶</a>
</div>
<p id="section-4.3.1-3">CBOR encoding:<a href="#section-4.3.1-3" class="pilcrow">¶</a></p>
<div id="section-4.3.1-4">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
19 06D2 # unsigned(1746)
82 # array(2)
68 # text(8)
696574662E6F7267 # "ietf.org"
68 # text(8)
696565652E6F7267 # "ieee.org"
</pre><a href="#section-4.3.1-4" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="using-names-in-keys-1">
<section id="section-4.3.2">
<h4 id="name-using-names-in-keys-3">
<a href="#section-4.3.2" class="section-number selfRef">4.3.2. </a><a href="#name-using-names-in-keys-3" class="section-name selfRef">Using Names in Keys</a>
</h4>
<p id="section-4.3.2-1">CBOR diagnostic notation:<a href="#section-4.3.2-1" class="pilcrow">¶</a></p>
<div id="section-4.3.2-2">
<pre class="lang-cbor-diag sourcecode">
{
"ietf-system:search" : [ "ietf.org", "ieee.org" ]
}
</pre><a href="#section-4.3.2-2" class="pilcrow">¶</a>
</div>
<p id="section-4.3.2-3">CBOR encoding:<a href="#section-4.3.2-3" class="pilcrow">¶</a></p>
<div id="section-4.3.2-4">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
72 # text(18)
696574662D73797374656D3A736561726368 # "ietf-system:search"
82 # array(2)
68 # text(8)
696574662E6F7267 # "ietf.org"
68 # text(8)
696565652E6F7267 # "ieee.org"
</pre><a href="#section-4.3.2-4" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
<div id="list">
<section id="section-4.4">
<h3 id="name-the-list-and-the-list-entri">
<a href="#section-4.4" class="section-number selfRef">4.4. </a><a href="#name-the-list-and-the-list-entri" class="section-name selfRef">The 'list' and the 'list' Entries</a>
</h3>
<p id="section-4.4-1">A list or a subset of a list <span class="bcp14">MUST</span> be encoded using a CBOR array data item (major type 4). Each list entry within this CBOR array is encoded using a CBOR map data item (major type 5) based on the encoding rules of a container-like instance, as defined in <a href="#container" class="xref">Section 4.2</a>.<a href="#section-4.4-1" class="pilcrow">¶</a></p>
<p id="section-4.4-2">It is important to note that this encoding rule also applies to a 'list' representation node instance that has a single entry.<a href="#section-4.4-2" class="pilcrow">¶</a></p>
<p id="section-4.4-3">The following examples show the encoding of a 'server' list using SIDs or names.<a href="#section-4.4-3" class="pilcrow">¶</a></p>
<p id="section-4.4-4">Definition example adapted from <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-4.4-4" class="pilcrow">¶</a></p>
<div id="section-4.4-5">
<pre class="lang-yang sourcecode">
list server {
key name;
leaf name {
type string;
}
choice transport {
case udp {
container udp {
leaf address {
type host;
mandatory true;
}
leaf port {
type port-number;
}
}
}
}
leaf association-type {
type enumeration {
enum server;
enum peer;
enum pool;
}
default server;
}
leaf iburst {
type boolean;
default false;
}
leaf prefer {
type boolean;
default false;
}
}
</pre><a href="#section-4.4-5" class="pilcrow">¶</a>
</div>
<div id="list-with-sid">
<section id="section-4.4.1">
<h4 id="name-using-sids-in-keys-4">
<a href="#section-4.4.1" class="section-number selfRef">4.4.1. </a><a href="#name-using-sids-in-keys-4" class="section-name selfRef">Using SIDs in Keys</a>
</h4>
<p id="section-4.4.1-1">The encoding rules of each 'list' entry are defined in <a href="#container-with-sid" class="xref">Section 4.2.1</a>.<a href="#section-4.4.1-1" class="pilcrow">¶</a></p>
<p id="section-4.4.1-2" class="keepWithNext">CBOR diagnostic notation:<a href="#section-4.4.1-2" class="pilcrow">¶</a></p>
<div id="section-4.4.1-3">
<pre class="lang-cbor-diag sourcecode">
{
1756 : [ / server (SID 1756) /
{
3 : "NRC TIC server", / name (SID 1759) /
5 : { / udp (SID 1761) /
1 : "tic.nrc.ca", / address (SID 1762) /
2 : 123 / port (SID 1763) /
},
1 : 0, / association-type (SID 1757) /
2 : false, / iburst (SID 1758) /
4 : true / prefer (SID 1760) /
},
{
3 : "NRC TAC server", / name (SID 1759) /
5 : { / udp (SID 1761) /
1 : "tac.nrc.ca" / address (SID 1762) /
}
}
]
}
</pre><a href="#section-4.4.1-3" class="pilcrow">¶</a>
</div>
<p id="section-4.4.1-4">CBOR encoding:<a href="#section-4.4.1-4" class="pilcrow">¶</a></p>
<div id="section-4.4.1-5">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
19 06DC # unsigned(1756)
82 # array(2)
A5 # map(5)
03 # unsigned(3)
6E # text(14)
4E52432054494320736572766572 # "NRC TIC server"
05 # unsigned(5)
A2 # map(2)
01 # unsigned(1)
6A # text(10)
7469632E6E72632E6361 # "tic.nrc.ca"
02 # unsigned(2)
18 7B # unsigned(123)
01 # unsigned(1)
00 # unsigned(0)
02 # unsigned(2)
F4 # primitive(20)
04 # unsigned(4)
F5 # primitive(21)
A2 # map(2)
03 # unsigned(3)
6E # text(14)
4E52432054414320736572766572 # "NRC TAC server"
05 # unsigned(5)
A1 # map(1)
01 # unsigned(1)
6A # text(10)
7461632E6E72632E6361 # "tac.nrc.ca"
</pre><a href="#section-4.4.1-5" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="using-names-in-keys-2">
<section id="section-4.4.2">
<h4 id="name-using-names-in-keys-4">
<a href="#section-4.4.2" class="section-number selfRef">4.4.2. </a><a href="#name-using-names-in-keys-4" class="section-name selfRef">Using Names in Keys</a>
</h4>
<p id="section-4.4.2-1">The encoding rules of each 'list' entry are defined in <a href="#container-with-name" class="xref">Section 4.2.2</a>.<a href="#section-4.4.2-1" class="pilcrow">¶</a></p>
<p id="section-4.4.2-2">CBOR diagnostic notation:<a href="#section-4.4.2-2" class="pilcrow">¶</a></p>
<div id="section-4.4.2-3">
<pre class="lang-cbor-diag sourcecode">
{
"ietf-system:server" : [
{
"name" : "NRC TIC server",
"udp" : {
"address" : "tic.nrc.ca",
"port" : 123
},
"association-type" : 0,
"iburst" : false,
"prefer" : true
},
{
"name" : "NRC TAC server",
"udp" : {
"address" : "tac.nrc.ca"
}
}
]
}
</pre><a href="#section-4.4.2-3" class="pilcrow">¶</a>
</div>
<p id="section-4.4.2-4" class="keepWithNext">CBOR encoding:<a href="#section-4.4.2-4" class="pilcrow">¶</a></p>
<div id="section-4.4.2-5">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
72 # text(18)
696574662D73797374656D3A736572766572
82 # array(2)
A5 # map(5)
64 # text(4)
6E616D65 # "name"
6E # text(14)
4E52432054494320736572766572
63 # text(3)
756470 # "udp"
A2 # map(2)
67 # text(7)
61646472657373 # "address"
6A # text(10)
7469632E6E72632E6361 # "tic.nrc.ca"
64 # text(4)
706F7274 # "port"
18 7B # unsigned(123)
70 # text(16)
6173736F63696174696F6E2D74797065
00 # unsigned(0)
66 # text(6)
696275727374 # "iburst"
F4 # primitive(20)
66 # text(6)
707265666572 # "prefer"
F5 # primitive(21)
A2 # map(2)
64 # text(4)
6E616D65 # "name"
6E # text(14)
4E52432054414320736572766572
63 # text(3)
756470 # "udp"
A1 # map(1)
67 # text(7)
61646472657373 # "address"
6A # text(10)
7461632E6E72632E6361 # "tac.nrc.ca"
</pre><a href="#section-4.4.2-5" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
<div id="the-anydata">
<section id="section-4.5">
<h3 id="name-the-anydata">
<a href="#section-4.5" class="section-number selfRef">4.5. </a><a href="#name-the-anydata" class="section-name selfRef">The 'anydata'</a>
</h3>
<p id="section-4.5-1">An anydata node serves as a container for an arbitrary set of representation nodes that otherwise appear as normal YANG-modeled data. An anydata representation node instance is encoded using the same rules as a container, i.e., using a CBOR map data item (major type 5) based on the encoding rules of a container-like instance, as defined in <a href="#container" class="xref">Section 4.2</a>.<a href="#section-4.5-1" class="pilcrow">¶</a></p>
<p id="section-4.5-2">The following example shows a possible use of an anydata node. In this example, an anydata node is used to define a representation node containing a notification event; this representation node can be part of a YANG list to create an event logger.<a href="#section-4.5-2" class="pilcrow">¶</a></p>
<p id="section-4.5-3">Definition example:<a href="#section-4.5-3" class="pilcrow">¶</a></p>
<div id="section-4.5-4">
<pre class="lang-yang sourcecode">
module event-log {
...
anydata last-event; // SID 60123
}
</pre><a href="#section-4.5-4" class="pilcrow">¶</a>
</div>
<p id="section-4.5-5">This example also assumes the assistance of the following notification.<a href="#section-4.5-5" class="pilcrow">¶</a></p>
<div id="section-4.5-6">
<pre class="lang-yang sourcecode">
module example-port {
...
notification example-port-fault { // SID 60200
leaf port-name { // SID 60201
type string;
}
leaf port-fault { // SID 60202
type string;
}
}
}
</pre><a href="#section-4.5-6" class="pilcrow">¶</a>
</div>
<div id="using-sids-in-keys-2">
<section id="section-4.5.1">
<h4 id="name-using-sids-in-keys-5">
<a href="#section-4.5.1" class="section-number selfRef">4.5.1. </a><a href="#name-using-sids-in-keys-5" class="section-name selfRef">Using SIDs in Keys</a>
</h4>
<p id="section-4.5.1-1">CBOR diagnostic notation:<a href="#section-4.5.1-1" class="pilcrow">¶</a></p>
<div id="section-4.5.1-2">
<pre class="lang-cbor-diag sourcecode">
{
60123 : { / last-event (SID 60123) /
77 : { / example-port-fault (SID 60200) /
1 : "0/4/21", / port-name (SID 60201) /
2 : "Open pin 2" / port-fault (SID 60202) /
}
}
}
</pre><a href="#section-4.5.1-2" class="pilcrow">¶</a>
</div>
<p id="section-4.5.1-3" class="keepWithNext">CBOR encoding:<a href="#section-4.5.1-3" class="pilcrow">¶</a></p>
<div id="section-4.5.1-4">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
19 EADB # unsigned(60123)
A1 # map(1)
18 4D # unsigned(77)
A2 # map(2)
01 # unsigned(1)
66 # text(6)
302F342F3231 # "0/4/21"
02 # unsigned(2)
6A # text(10)
4F70656E2070696E2032 # "Open pin 2"
</pre><a href="#section-4.5.1-4" class="pilcrow">¶</a>
</div>
<p id="section-4.5.1-5">In some implementations, it might be simpler to use the absolute SID encoding (tag number 47) for the anydata root element.
CBOR diagnostic notation:<a href="#section-4.5.1-5" class="pilcrow">¶</a></p>
<div id="section-4.5.1-6">
<pre class="lang-cbor-diag sourcecode">
{
60123 : { / last-event (SID 60123) /
47(60200) : { / event-port-fault (SID 60200) /
1 : "0/4/21", / port-name (SID 60201) /
2 : "Open pin 2" / port-fault (SID 60202) /
}
}
}
</pre><a href="#section-4.5.1-6" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="using-names-in-keys-3">
<section id="section-4.5.2">
<h4 id="name-using-names-in-keys-5">
<a href="#section-4.5.2" class="section-number selfRef">4.5.2. </a><a href="#name-using-names-in-keys-5" class="section-name selfRef">Using Names in Keys</a>
</h4>
<p id="section-4.5.2-1">CBOR diagnostic notation:<a href="#section-4.5.2-1" class="pilcrow">¶</a></p>
<div id="section-4.5.2-2">
<pre class="lang-cbor-diag sourcecode">
{
"event-log:last-event" : {
"example-port:example-port-fault" : {
"port-name" : "0/4/21",
"port-fault" : "Open pin 2"
}
}
}
</pre><a href="#section-4.5.2-2" class="pilcrow">¶</a>
</div>
<p id="section-4.5.2-3" class="keepWithNext">CBOR encoding:<a href="#section-4.5.2-3" class="pilcrow">¶</a></p>
<div id="section-4.5.2-4">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
74 # text(20)
6576656E742D6C6F673A6C6173742D6576656E74
A1 # map(1)
78 1F # text(31)
6578616D706C652D706F72743A
6578616D706C652D706F72742D6661756C74
A2 # map(2)
69 # text(9)
706F72742D6E616D65 # "port-name"
66 # text(6)
302F342F3231 # "0/4/21"
6A # text(10)
706F72742D6661756C74 # "port-fault"
6A # text(10)
4F70656E2070696E2032 # "Open pin 2"
</pre><a href="#section-4.5.2-4" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
<div id="the-anyxml">
<section id="section-4.6">
<h3 id="name-the-anyxml">
<a href="#section-4.6" class="section-number selfRef">4.6. </a><a href="#name-the-anyxml" class="section-name selfRef">The 'anyxml'</a>
</h3>
<p id="section-4.6-1">An anyxml representation node is used to serialize an arbitrary CBOR content, i.e., its value can be any CBOR binary object.
(The "xml" in the name is a misnomer that only applied to YANG-XML <span>[<a href="#RFC7950" class="xref">RFC7950</a>]</span>.)
An anyxml value <span class="bcp14">MAY</span> contain CBOR data items tagged with one of the tags listed in <a href="#tag-registry" class="xref">Section 9.3</a>. The tags listed in <a href="#tag-registry" class="xref">Section 9.3</a> <span class="bcp14">SHALL</span> be supported.<a href="#section-4.6-1" class="pilcrow">¶</a></p>
<p id="section-4.6-2">The following example shows a valid CBOR-encoded anyxml representation node instance consisting of a CBOR array containing the CBOR simple values 'true', 'null', and 'true'.<a href="#section-4.6-2" class="pilcrow">¶</a></p>
<p id="section-4.6-3">Definition example adapted from <span>[<a href="#RFC7951" class="xref">RFC7951</a>]</span>:<a href="#section-4.6-3" class="pilcrow">¶</a></p>
<div id="section-4.6-4">
<pre class="lang-yang sourcecode">
module bar-module {
...
anyxml bar; // SID 60000
}
</pre><a href="#section-4.6-4" class="pilcrow">¶</a>
</div>
<div id="using-sids-in-keys-3">
<section id="section-4.6.1">
<h4 id="name-using-sids-in-keys-6">
<a href="#section-4.6.1" class="section-number selfRef">4.6.1. </a><a href="#name-using-sids-in-keys-6" class="section-name selfRef">Using SIDs in Keys</a>
</h4>
<p id="section-4.6.1-1">CBOR diagnostic notation:<a href="#section-4.6.1-1" class="pilcrow">¶</a></p>
<div id="section-4.6.1-2">
<pre class="lang-cbor-diag sourcecode">
{
60000 : [true, null, true] / bar (SID 60000) /
}
</pre><a href="#section-4.6.1-2" class="pilcrow">¶</a>
</div>
<p id="section-4.6.1-3" class="keepWithNext">CBOR encoding:<a href="#section-4.6.1-3" class="pilcrow">¶</a></p>
<div id="section-4.6.1-4">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
19 EA60 # unsigned(60000)
83 # array(3)
F5 # primitive(21)
F6 # primitive(22)
F5 # primitive(21)
</pre><a href="#section-4.6.1-4" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="using-names-in-keys-4">
<section id="section-4.6.2">
<h4 id="name-using-names-in-keys-6">
<a href="#section-4.6.2" class="section-number selfRef">4.6.2. </a><a href="#name-using-names-in-keys-6" class="section-name selfRef">Using Names in Keys</a>
</h4>
<p id="section-4.6.2-1">CBOR diagnostic notation:<a href="#section-4.6.2-1" class="pilcrow">¶</a></p>
<div id="section-4.6.2-2">
<pre class="lang-cbor-diag sourcecode">
{
"bar-module:bar" : [true, null, true] / bar (SID 60000) /
}
</pre><a href="#section-4.6.2-2" class="pilcrow">¶</a>
</div>
<p id="section-4.6.2-3">CBOR encoding:<a href="#section-4.6.2-3" class="pilcrow">¶</a></p>
<div id="section-4.6.2-4">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
6E # text(14)
6261722D6D6F64756C653A626172 # "bar-module:bar"
83 # array(3)
F5 # primitive(21)
F6 # primitive(22)
F5 # primitive(21)
</pre><a href="#section-4.6.2-4" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
</section>
</div>
<div id="encoding-of-yang-data-extension">
<section id="section-5">
<h2 id="name-encoding-of-the-yang-data-e">
<a href="#section-5" class="section-number selfRef">5. </a><a href="#name-encoding-of-the-yang-data-e" class="section-name selfRef">Encoding of the 'yang-data' Extension</a>
</h2>
<p id="section-5-1">The yang-data extension <span>[<a href="#RFC8040" class="xref">RFC8040</a>]</span> is used to define data structures in YANG
that are not intended to be implemented as part of a datastore.<a href="#section-5-1" class="pilcrow">¶</a></p>
<p id="section-5-2">The yang-data extension will specify a container that <span class="bcp14">MUST</span> be encoded using the encoding rules of nodes of data trees, as defined in <a href="#container" class="xref">Section 4.2</a>.<a href="#section-5-2" class="pilcrow">¶</a></p>
<p id="section-5-3">Just like YANG containers, the yang-data extension can be encoded using either SIDs or names.<a href="#section-5-3" class="pilcrow">¶</a></p>
<p id="section-5-4">Definition example adapted from <span><a href="https://datatracker.ietf.org/doc/html/draft-ietf-core-comi-11#appendix-A" class="relref">Appendix A</a> of [<a href="#I-D.ietf-core-comi" class="xref">CORE-COMI</a>]</span>:<a href="#section-5-4" class="pilcrow">¶</a></p>
<div id="section-5-5">
<pre class="lang-yang sourcecode">
module ietf-coreconf {
...
import ietf-restconf {
prefix rc;
}
rc:yang-data yang-errors {
container error {
leaf error-tag {
type identityref {
base error-tag;
}
}
leaf error-app-tag {
type identityref {
base error-app-tag;
}
}
leaf error-data-node {
type instance-identifier;
}
leaf error-message {
type string;
}
}
}
}
</pre><a href="#section-5-5" class="pilcrow">¶</a>
</div>
<div id="using-sids-in-keys-4">
<section id="section-5.1">
<h3 id="name-using-sids-in-keys-7">
<a href="#section-5.1" class="section-number selfRef">5.1. </a><a href="#name-using-sids-in-keys-7" class="section-name selfRef">Using SIDs in Keys</a>
</h3>
<p id="section-5.1-1">The yang-data extensions encoded using SIDs are carried in a CBOR map containing a single item pair. The key of this item is set to the SID assigned to the yang-data extension container; the value is set to the CBOR encoding of this container, as defined in <a href="#container" class="xref">Section 4.2</a>.<a href="#section-5.1-1" class="pilcrow">¶</a></p>
<p id="section-5.1-2">This example shows a serialization example of the yang-errors yang-data extension, as defined in <span>[<a href="#I-D.ietf-core-comi" class="xref">CORE-COMI</a>]</span>, using SIDs, as defined in <a href="#sid" class="xref">Section 3.2</a>.<a href="#section-5.1-2" class="pilcrow">¶</a></p>
<p id="section-5.1-3">CBOR diagnostic notation:<a href="#section-5.1-3" class="pilcrow">¶</a></p>
<div id="section-5.1-4">
<pre class="lang-cbor-diag sourcecode">
{
1024 : { / error (SID 1024) /
4 : 1011, / error-tag (SID 1028) /
/ = invalid-value (SID 1011) /
1 : 1018, / error-app-tag (SID 1025) /
/ = not-in-range (SID 1018) /
2 : 1740, / error-data-node (SID 1026) /
/ = timezone-utc-offset (SID 1740) /
3 : "Maximum exceeded" / error-message (SID 1027) /
}
}
</pre><a href="#section-5.1-4" class="pilcrow">¶</a>
</div>
<p id="section-5.1-5">CBOR encoding:<a href="#section-5.1-5" class="pilcrow">¶</a></p>
<div id="section-5.1-6">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
19 0400 # unsigned(1024)
A4 # map(4)
04 # unsigned(4)
19 03F3 # unsigned(1011)
01 # unsigned(1)
19 03FA # unsigned(1018)
02 # unsigned(2)
19 06CC # unsigned(1740)
03 # unsigned(3)
70 # text(16)
4D6178696D756D206578636565646564 # "Maximum exceeded"
</pre><a href="#section-5.1-6" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="using-names-in-keys-5">
<section id="section-5.2">
<h3 id="name-using-names-in-keys-7">
<a href="#section-5.2" class="section-number selfRef">5.2. </a><a href="#name-using-names-in-keys-7" class="section-name selfRef">Using Names in Keys</a>
</h3>
<p id="section-5.2-1">The yang-data extensions encoded using names are carried in a CBOR map containing a single item pair. The key of this item is set to the namespace-qualified name of the yang-data extension container; the value is set to the CBOR encoding of this container, as defined in <a href="#container" class="xref">Section 4.2</a>.<a href="#section-5.2-1" class="pilcrow">¶</a></p>
<p id="section-5.2-2">This example shows a serialization example of the yang-errors yang-data extension, as defined in <span>[<a href="#I-D.ietf-core-comi" class="xref">CORE-COMI</a>]</span>, using names, as defined <a href="#name" class="xref">Section 3.3</a>.<a href="#section-5.2-2" class="pilcrow">¶</a></p>
<p id="section-5.2-3">CBOR diagnostic notation:<a href="#section-5.2-3" class="pilcrow">¶</a></p>
<div id="section-5.2-4">
<pre class="lang-cbor-diag sourcecode">
{
"ietf-coreconf:error" : {
"error-tag" : "invalid-value",
"error-app-tag" : "not-in-range",
"error-data-node" : "timezone-utc-offset",
"error-message" : "Maximum exceeded"
}
}
</pre><a href="#section-5.2-4" class="pilcrow">¶</a>
</div>
<p id="section-5.2-5" class="keepWithNext">CBOR encoding:<a href="#section-5.2-5" class="pilcrow">¶</a></p>
<div id="section-5.2-6">
<pre class="lang-cbor-pretty sourcecode">
A1 # map(1)
73 # text(19)
696574662D636F7265636F6E663A6572726F72 # "ietf-coreconf:error"
A4 # map(4)
69 # text(9)
6572726F722D746167 # "error-tag"
6D # text(13)
696E76616C69642D76616C7565 # "invalid-value"
6D # text(13)
6572726F722D6170702D746167 # "error-app-tag"
6C # text(12)
6E6F742D696E2D72616E6765 # "not-in-range"
6F # text(15)
6572726F722D646174612D6E6F6465 # "error-data-node"
73 # text(19)
74696D657A6F6E652D7574632D6F6666736574
# "timezone-utc-offset"
6D # text(13)
6572726F722D6D657373616765 # "error-message"
70 # text(16)
4D6178696D756D206578636565646564 # "Maximum exceeded"
</pre><a href="#section-5.2-6" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
<div id="data-types-mapping">
<section id="section-6">
<h2 id="name-representing-yang-data-type">
<a href="#section-6" class="section-number selfRef">6. </a><a href="#name-representing-yang-data-type" class="section-name selfRef">Representing YANG Data Types in CBOR</a>
</h2>
<p id="section-6-1">The CBOR encoding of an instance of a leaf or leaf-list representation node
depends on the built-in type of that representation node. The following
subsection defines the CBOR encoding of each built-in type supported
by YANG, as listed in <span><a href="https://www.rfc-editor.org/rfc/rfc7950#section-4.2.4" class="relref">Section 4.2.4</a> of [<a href="#RFC7950" class="xref">RFC7950</a>]</span>. Each subsection shows an example value assigned to a representation node instance of the discussed built-in type.<a href="#section-6-1" class="pilcrow">¶</a></p>
<div id="the-unsigned-integer-types">
<section id="section-6.1">
<h3 id="name-the-unsigned-integer-types">
<a href="#section-6.1" class="section-number selfRef">6.1. </a><a href="#name-the-unsigned-integer-types" class="section-name selfRef">The Unsigned Integer Types</a>
</h3>
<p id="section-6.1-1">Leafs of type uint8, uint16, uint32, and uint64 <span class="bcp14">MUST</span> be encoded using a CBOR
unsigned integer data item (major type 0).<a href="#section-6.1-1" class="pilcrow">¶</a></p>
<p id="section-6.1-2">The following example shows the encoding of an 'mtu' leaf representation node instance set to 1280 bytes.<a href="#section-6.1-2" class="pilcrow">¶</a></p>
<p id="section-6.1-3">Definition example adapted from <span>[<a href="#RFC8344" class="xref">RFC8344</a>]</span>:<a href="#section-6.1-3" class="pilcrow">¶</a></p>
<div id="section-6.1-4">
<pre class="lang-yang sourcecode">
leaf mtu {
type uint16 {
range "68..max";
}
}
</pre><a href="#section-6.1-4" class="pilcrow">¶</a>
</div>
<p id="section-6.1-5">CBOR diagnostic notation: 1280<a href="#section-6.1-5" class="pilcrow">¶</a></p>
<p id="section-6.1-6">CBOR encoding: 19 0500<a href="#section-6.1-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="the-integer-types">
<section id="section-6.2">
<h3 id="name-the-integer-types">
<a href="#section-6.2" class="section-number selfRef">6.2. </a><a href="#name-the-integer-types" class="section-name selfRef">The Integer Types</a>
</h3>
<p id="section-6.2-1">Leafs of type int8, int16, int32, and int64 <span class="bcp14">MUST</span> be encoded using either a CBOR
unsigned integer (major type 0) or a CBOR negative integer (major type 1), depending
on the actual value.<a href="#section-6.2-1" class="pilcrow">¶</a></p>
<p id="section-6.2-2">The following example shows the encoding of a 'timezone-utc-offset' leaf representation node instance set to -300 minutes.<a href="#section-6.2-2" class="pilcrow">¶</a></p>
<p id="section-6.2-3">Definition example adapted from <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-6.2-3" class="pilcrow">¶</a></p>
<div id="section-6.2-4">
<pre class="lang-yang sourcecode">
leaf timezone-utc-offset {
type int16 {
range "-1500 .. 1500";
}
}
</pre><a href="#section-6.2-4" class="pilcrow">¶</a>
</div>
<p id="section-6.2-5">CBOR diagnostic notation: -300<a href="#section-6.2-5" class="pilcrow">¶</a></p>
<p id="section-6.2-6">CBOR encoding: 39 012B<a href="#section-6.2-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="the-decimal64-type">
<section id="section-6.3">
<h3 id="name-the-decimal64-type">
<a href="#section-6.3" class="section-number selfRef">6.3. </a><a href="#name-the-decimal64-type" class="section-name selfRef">The 'decimal64' Type</a>
</h3>
<p id="section-6.3-1">Leafs of type decimal64 <span class="bcp14">MUST</span> be encoded using a decimal fraction, as defined in <span><a href="https://www.rfc-editor.org/rfc/rfc8949#section-3.4.4" class="relref">Section 3.4.4</a> of [<a href="#RFC8949" class="xref">RFC8949</a>]</span>.<a href="#section-6.3-1" class="pilcrow">¶</a></p>
<p id="section-6.3-2">The following example shows the encoding of a 'my-decimal' leaf representation node instance set to 2.57.<a href="#section-6.3-2" class="pilcrow">¶</a></p>
<p id="section-6.3-3">Definition example adapted from <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-6.3-3" class="pilcrow">¶</a></p>
<div id="section-6.3-4">
<pre class="lang-yang sourcecode">
leaf my-decimal {
type decimal64 {
fraction-digits 2;
range "1 .. 3.14 | 10 | 20..max";
}
}
</pre><a href="#section-6.3-4" class="pilcrow">¶</a>
</div>
<p id="section-6.3-5">CBOR diagnostic notation: 4([-2, 257])<a href="#section-6.3-5" class="pilcrow">¶</a></p>
<p id="section-6.3-6">CBOR encoding: C4 82 21 19 0101<a href="#section-6.3-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="the-string-type">
<section id="section-6.4">
<h3 id="name-the-string-type">
<a href="#section-6.4" class="section-number selfRef">6.4. </a><a href="#name-the-string-type" class="section-name selfRef">The 'string' Type</a>
</h3>
<p id="section-6.4-1">Leafs of type string <span class="bcp14">MUST</span> be encoded using a CBOR text string data item (major
type 3).<a href="#section-6.4-1" class="pilcrow">¶</a></p>
<p id="section-6.4-2">The following example shows the encoding of a 'name' leaf representation node instance set to "eth0".<a href="#section-6.4-2" class="pilcrow">¶</a></p>
<p id="section-6.4-3">Definition example adapted from <span>[<a href="#RFC8343" class="xref">RFC8343</a>]</span>:<a href="#section-6.4-3" class="pilcrow">¶</a></p>
<div id="section-6.4-4">
<pre class="lang-yang sourcecode">
leaf name {
type string;
}
</pre><a href="#section-6.4-4" class="pilcrow">¶</a>
</div>
<p id="section-6.4-5">CBOR diagnostic notation: "eth0"<a href="#section-6.4-5" class="pilcrow">¶</a></p>
<p id="section-6.4-6">CBOR encoding: 64 65746830<a href="#section-6.4-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="the-boolean-type">
<section id="section-6.5">
<h3 id="name-the-boolean-type">
<a href="#section-6.5" class="section-number selfRef">6.5. </a><a href="#name-the-boolean-type" class="section-name selfRef">The 'boolean' Type</a>
</h3>
<p id="section-6.5-1">Leafs of type boolean <span class="bcp14">MUST</span> be encoded using a CBOR simple value 'true' (major type 7, additional information 21) or 'false' (major type 7, additional information 20).<a href="#section-6.5-1" class="pilcrow">¶</a></p>
<p id="section-6.5-2">The following example shows the encoding of an 'enabled' leaf representation node instance set to 'true'.<a href="#section-6.5-2" class="pilcrow">¶</a></p>
<p id="section-6.5-3">Definition example adapted from <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-6.5-3" class="pilcrow">¶</a></p>
<div id="section-6.5-4">
<pre class="lang-yang sourcecode">
leaf enabled {
type boolean;
}
</pre><a href="#section-6.5-4" class="pilcrow">¶</a>
</div>
<p id="section-6.5-5">CBOR diagnostic notation: true<a href="#section-6.5-5" class="pilcrow">¶</a></p>
<p id="section-6.5-6">CBOR encoding: F5<a href="#section-6.5-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="enumeration">
<section id="section-6.6">
<h3 id="name-the-enumeration-type">
<a href="#section-6.6" class="section-number selfRef">6.6. </a><a href="#name-the-enumeration-type" class="section-name selfRef">The 'enumeration' Type</a>
</h3>
<p id="section-6.6-1">Leafs of type enumeration <span class="bcp14">MUST</span> be encoded using a CBOR unsigned
integer (major type 0) or CBOR negative integer (major type 1),
depending on the actual value, or exceptionally as a tagged text string (see below).
Enumeration values are either
explicitly assigned using the YANG statement 'value' or automatically
assigned based on the algorithm defined in <span><a href="https://www.rfc-editor.org/rfc/rfc7950#section-9.6.4.2" class="relref">Section 9.6.4.2</a> of [<a href="#RFC7950" class="xref">RFC7950</a>]</span>.<a href="#section-6.6-1" class="pilcrow">¶</a></p>
<p id="section-6.6-2">The following example shows the encoding of an 'oper-status' leaf representation node instance set to 'testing'.<a href="#section-6.6-2" class="pilcrow">¶</a></p>
<p id="section-6.6-3" class="keepWithNext">Definition example adapted from <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-6.6-3" class="pilcrow">¶</a></p>
<div id="section-6.6-4">
<pre class="lang-yang sourcecode">
leaf oper-status {
type enumeration {
enum up { value 1; }
enum down { value 2; }
enum testing { value 3; }
enum unknown { value 4; }
enum dormant { value 5; }
enum not-present { value 6; }
enum lower-layer-down { value 7; }
}
}
</pre><a href="#section-6.6-4" class="pilcrow">¶</a>
</div>
<p id="section-6.6-5">CBOR diagnostic notation: 3<a href="#section-6.6-5" class="pilcrow">¶</a></p>
<p id="section-6.6-6">CBOR encoding: 03<a href="#section-6.6-6" class="pilcrow">¶</a></p>
<p id="section-6.6-7">Values of 'enumeration' types defined in a 'union' type <span class="bcp14">MUST</span> be encoded using a
CBOR text string data item (major type 3) and <span class="bcp14">MUST</span> contain one of the names
assigned by 'enum' statements in YANG (see also <a href="#union" class="xref">Section 6.12</a>).
The encoding <span class="bcp14">MUST</span> be enclosed by the
enumeration CBOR tag, as specified in <a href="#tag-registry" class="xref">Section 9.3</a>.<a href="#section-6.6-7" class="pilcrow">¶</a></p>
<p id="section-6.6-8">Definition example adapted from <span>[<a href="#RFC7950" class="xref">RFC7950</a>]</span>:<a href="#section-6.6-8" class="pilcrow">¶</a></p>
<div id="section-6.6-9">
<pre class="lang-yang sourcecode">
type union {
type int32;
type enumeration {
enum unbounded;
}
}
</pre><a href="#section-6.6-9" class="pilcrow">¶</a>
</div>
<p id="section-6.6-10">CBOR diagnostic notation: 44("unbounded")<a href="#section-6.6-10" class="pilcrow">¶</a></p>
<p id="section-6.6-11">CBOR encoding: D8 2C 69 756E626F756E646564<a href="#section-6.6-11" class="pilcrow">¶</a></p>
</section>
</div>
<div id="bits">
<section id="section-6.7">
<h3 id="name-the-bits-type">
<a href="#section-6.7" class="section-number selfRef">6.7. </a><a href="#name-the-bits-type" class="section-name selfRef">The 'bits' Type</a>
</h3>
<p id="section-6.7-1">Keeping in mind that bit positions are either explicitly assigned using the
YANG statement 'position' or automatically assigned based on the algorithm
defined in <span><a href="https://www.rfc-editor.org/rfc/rfc7950#section-9.7.4.2" class="relref">Section 9.7.4.2</a> of [<a href="#RFC7950" class="xref">RFC7950</a>]</span>, each element of type bits could be seen
as a set of bit positions (or offsets from position 0) that have a value of
either 1, which represents the bit being set, or 0, which represents that the bit
is not set.<a href="#section-6.7-1" class="pilcrow">¶</a></p>
<p id="section-6.7-2">Leafs of type bits <span class="bcp14">MUST</span> be encoded either using a CBOR array (major type 4) or byte string
(major type 2) or exceptionally as a tagged text string (see below). In case CBOR array representation is used, each element is
either (1) a positive integer (major type 0 with value 0 being
disallowed) that can be used to calculate the offset of the next byte string or (2) a byte
string (major type 2) that carries the information regarding whether certain bits are set
or not. The initial offset value is 0, and each unsigned integer modifies the
offset value of the next byte string by the integer value multiplied by 8. For
example, if the bit offset is 0 and there is an integer with value 5, the first
byte of the byte string that follows will represent bit positions 40 to 47, with both
ends included. If the byte string has a second byte, it will carry information
about bits 48 to 55, and so on. Within each byte, bits are assigned from least
to most significant. After the byte string, the offset is modified by the number
of bytes in the byte string multiplied by 8.
Bytes with no bits set (zero bytes) at the end of the byte string are never generated.
If they occur at the end of the array, the zero bytes are simply omitted;
if they occur at the end of a byte string preceding an integer, the
zero bytes are removed and the integer is adjusted upwards by the number
of zero bytes that were removed.
An example follows.<a href="#section-6.7-2" class="pilcrow">¶</a></p>
<p id="section-6.7-3">The following example shows the encoding of an 'alarm-state' leaf representation node
instance with the 'critical' (position 2), 'warning' (position 8), and
'indeterminate' (position 128) flags set.<a href="#section-6.7-3" class="pilcrow">¶</a></p>
<div id="section-6.7-4">
<pre class="lang-yang sourcecode">
typedef alarm-state {
type bits {
bit unknown;
bit under-repair;
bit critical;
bit major;
bit minor;
bit warning {
position 8;
}
bit indeterminate {
position 128;
}
}
}
leaf alarm-state {
type alarm-state;
}
</pre><a href="#section-6.7-4" class="pilcrow">¶</a>
</div>
<p id="section-6.7-5">CBOR diagnostic notation: [h'0401', 14, h'01']<a href="#section-6.7-5" class="pilcrow">¶</a></p>
<p id="section-6.7-6">CBOR encoding: 83 42 0401 0E 41 01<a href="#section-6.7-6" class="pilcrow">¶</a></p>
<p id="section-6.7-7">In a number of cases, the array would only need to have one element -- a byte string with a few bytes inside.
For this case, it is <span class="bcp14">REQUIRED</span> to omit the array element and have only the byte array that would have been inside.
To illustrate this, let us consider the same example YANG definition but this time encoding only 'under-repair' and 'critical' flags.
The result would be<a href="#section-6.7-7" class="pilcrow">¶</a></p>
<p id="section-6.7-8">CBOR diagnostic notation: h'06'<a href="#section-6.7-8" class="pilcrow">¶</a></p>
<p id="section-6.7-9">CBOR encoding: 41 06<a href="#section-6.7-9" class="pilcrow">¶</a></p>
<p id="section-6.7-10">Elements in the array <span class="bcp14">MUST</span> be either byte strings that do not end in
a zero byte or positive unsigned
integers, where byte strings and integers <span class="bcp14">MUST</span> alternate, i.e., adjacent byte
strings or adjacent integers are an error. An array with a single byte string
<span class="bcp14">MUST</span> instead be encoded as just that byte string. An array with a single
positive integer is an error.
Note that a recipient can handle trailing zero bytes in the byte strings using the normal
rules without any issue, so an implementation <span class="bcp14">MAY</span> silently accept them.<a href="#section-6.7-10" class="pilcrow">¶</a></p>
<p id="section-6.7-11">Values of 'bits' types defined in a 'union' type <span class="bcp14">MUST</span> be encoded using a
CBOR text string data item (major type 3) and <span class="bcp14">MUST</span> contain a space-separated
sequence of names of 'bits' that are set (see also <a href="#union" class="xref">Section 6.12</a>).
The encoding <span class="bcp14">MUST</span> be enclosed by the
bits CBOR tag, as specified in <a href="#tag-registry" class="xref">Section 9.3</a>.<a href="#section-6.7-11" class="pilcrow">¶</a></p>
<p id="section-6.7-12">The following example shows the encoding of an 'alarm-state' leaf representation node
instance defined using a union type with the 'under-repair' and 'critical'
flags set.<a href="#section-6.7-12" class="pilcrow">¶</a></p>
<p id="section-6.7-13">Definition example:<a href="#section-6.7-13" class="pilcrow">¶</a></p>
<div id="section-6.7-14">
<pre class="lang-yang sourcecode">
leaf alarm-state-2 {
type union {
type alarm-state;
type bits {
bit extra-flag;
}
}
}
</pre><a href="#section-6.7-14" class="pilcrow">¶</a>
</div>
<p id="section-6.7-15">CBOR diagnostic notation: 43("under-repair critical")<a href="#section-6.7-15" class="pilcrow">¶</a></p>
<p id="section-6.7-16">CBOR encoding: D8 2B 75 756E6465722D72657061697220637269746963616C<a href="#section-6.7-16" class="pilcrow">¶</a></p>
</section>
</div>
<div id="the-binary-type">
<section id="section-6.8">
<h3 id="name-the-binary-type">
<a href="#section-6.8" class="section-number selfRef">6.8. </a><a href="#name-the-binary-type" class="section-name selfRef">The 'binary' Type</a>
</h3>
<p id="section-6.8-1">Leafs of type binary <span class="bcp14">MUST</span> be encoded using a CBOR byte string data item (major
type 2).<a href="#section-6.8-1" class="pilcrow">¶</a></p>
<p id="section-6.8-2">The following example shows the encoding of an 'aes128-key' leaf representation node
instance set to 0x1f1ce6a3f42660d888d92a4d8030476e.<a href="#section-6.8-2" class="pilcrow">¶</a></p>
<p id="section-6.8-3">Definition example:<a href="#section-6.8-3" class="pilcrow">¶</a></p>
<div id="section-6.8-4">
<pre class="lang-yang sourcecode">
leaf aes128-key {
type binary {
length 16;
}
}
</pre><a href="#section-6.8-4" class="pilcrow">¶</a>
</div>
<p id="section-6.8-5">CBOR diagnostic notation: h'1F1CE6A3F42660D888D92A4D8030476E'<a href="#section-6.8-5" class="pilcrow">¶</a></p>
<p id="section-6.8-6">CBOR encoding: 50 1F1CE6A3F42660D888D92A4D8030476E<a href="#section-6.8-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="the-leafref-type">
<section id="section-6.9">
<h3 id="name-the-leafref-type">
<a href="#section-6.9" class="section-number selfRef">6.9. </a><a href="#name-the-leafref-type" class="section-name selfRef">The 'leafref' Type</a>
</h3>
<p id="section-6.9-1">Leafs of type leafref <span class="bcp14">MUST</span> be encoded using the rules of the representation node referenced
by the 'path' YANG statement.<a href="#section-6.9-1" class="pilcrow">¶</a></p>
<p id="section-6.9-2">The following example shows the encoding of an 'interface-state-ref' leaf representation node instance set to "eth1".<a href="#section-6.9-2" class="pilcrow">¶</a></p>
<p id="section-6.9-3">Definition example adapted from <span>[<a href="#RFC8343" class="xref">RFC8343</a>]</span>:<a href="#section-6.9-3" class="pilcrow">¶</a></p>
<div id="section-6.9-4">
<pre class="lang-yang sourcecode">
typedef interface-state-ref {
type leafref {
path "/interfaces-state/interface/name";
}
}
container interfaces-state {
list interface {
key "name";
leaf name {
type string;
}
leaf-list higher-layer-if {
type interface-state-ref;
}
}
}
</pre><a href="#section-6.9-4" class="pilcrow">¶</a>
</div>
<p id="section-6.9-5">CBOR diagnostic notation: "eth1"<a href="#section-6.9-5" class="pilcrow">¶</a></p>
<p id="section-6.9-6">CBOR encoding: 64 65746831<a href="#section-6.9-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="identityref">
<section id="section-6.10">
<h3 id="name-the-identityref-type">
<a href="#section-6.10" class="section-number selfRef">6.10. </a><a href="#name-the-identityref-type" class="section-name selfRef">The 'identityref' Type</a>
</h3>
<p id="section-6.10-1">This specification supports two approaches for encoding identityref:
as a YANG Schema Item iDentifier, as defined in <a href="#sid" class="xref">Section 3.2</a>, or as a name,
as defined in <span><a href="https://www.rfc-editor.org/rfc/rfc7951#section-6.8" class="relref">Section 6.8</a> of [<a href="#RFC7951" class="xref">RFC7951</a>]</span>.
See <a href="#union" class="xref">Section 6.12</a> for an exceptional case when this representation needs to be tagged.<a href="#section-6.10-1" class="pilcrow">¶</a></p>
<div id="identityref-with-sid">
<section id="section-6.10.1">
<h4 id="name-sids-as-identityref">
<a href="#section-6.10.1" class="section-number selfRef">6.10.1. </a><a href="#name-sids-as-identityref" class="section-name selfRef">SIDs as 'identityref'</a>
</h4>
<p id="section-6.10.1-1">When representation nodes of type identityref are implemented using SIDs, they <span class="bcp14">MUST</span> be encoded using a CBOR unsigned integer data item (major type 0).
(Note that, as they are not used in the position of CBOR map keys, no delta mechanism is employed for SIDs used for identityref.)<a href="#section-6.10.1-1" class="pilcrow">¶</a></p>
<p id="section-6.10.1-2">The following example shows the encoding of a 'type' leaf representation node instance set to the value 'iana-if-type:ethernetCsmacd' (SID 1880).<a href="#section-6.10.1-2" class="pilcrow">¶</a></p>
<p id="section-6.10.1-3">Definition example adapted from <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-6.10.1-3" class="pilcrow">¶</a></p>
<div id="section-6.10.1-4">
<pre class="lang-yang sourcecode">
identity interface-type {
}
identity iana-interface-type {
base interface-type;
}
identity ethernetCsmacd {
base iana-interface-type;
}
leaf type {
type identityref {
base interface-type;
}
}
</pre><a href="#section-6.10.1-4" class="pilcrow">¶</a>
</div>
<p id="section-6.10.1-5">CBOR diagnostic notation: 1880<a href="#section-6.10.1-5" class="pilcrow">¶</a></p>
<p id="section-6.10.1-6">CBOR encoding: 19 0758<a href="#section-6.10.1-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="name-as-identityref">
<section id="section-6.10.2">
<h4 id="name-name-as-identityref">
<a href="#section-6.10.2" class="section-number selfRef">6.10.2. </a><a href="#name-name-as-identityref" class="section-name selfRef">Name as 'identityref'</a>
</h4>
<p id="section-6.10.2-1">Alternatively, an identityref <span class="bcp14">MAY</span> be encoded using a name, as defined in <a href="#name" class="xref">Section 3.3</a>. When names are used, identityref <span class="bcp14">MUST</span> be encoded using a CBOR text string data item (major type 3). If the identity is defined in a different module than the leaf node containing the identityref data node, the namespace-qualified form <span class="bcp14">MUST</span> be used. Otherwise, both the simple and namespace-qualified forms are permitted. Names and namespaces are defined in <a href="#name" class="xref">Section 3.3</a>.<a href="#section-6.10.2-1" class="pilcrow">¶</a></p>
<p id="section-6.10.2-2">The following example shows the encoding of the identity 'iana-if-type:ethernetCsmacd' using its namespace-qualified name. This example is described in <a href="#identityref-with-sid" class="xref">Section 6.10.1</a>.<a href="#section-6.10.2-2" class="pilcrow">¶</a></p>
<p id="section-6.10.2-3">CBOR diagnostic notation: "iana-if-type:ethernetCsmacd"<a href="#section-6.10.2-3" class="pilcrow">¶</a></p>
<p id="section-6.10.2-4">CBOR encoding: 78 1B 69616E612D69662D747970653A65746865726E657443736D616364<a href="#section-6.10.2-4" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="the-empty-type">
<section id="section-6.11">
<h3 id="name-the-empty-type">
<a href="#section-6.11" class="section-number selfRef">6.11. </a><a href="#name-the-empty-type" class="section-name selfRef">The 'empty' Type</a>
</h3>
<p id="section-6.11-1">Leafs of type empty <span class="bcp14">MUST</span> be encoded using the CBOR null value (major type
7, additional information 22).<a href="#section-6.11-1" class="pilcrow">¶</a></p>
<p id="section-6.11-2">The following example shows the encoding of an 'is-router' leaf representation node instance when present.<a href="#section-6.11-2" class="pilcrow">¶</a></p>
<p id="section-6.11-3">Definition example adapted from <span>[<a href="#RFC8344" class="xref">RFC8344</a>]</span>:<a href="#section-6.11-3" class="pilcrow">¶</a></p>
<div id="section-6.11-4">
<pre class="lang-yang sourcecode">
leaf is-router {
type empty;
}
</pre><a href="#section-6.11-4" class="pilcrow">¶</a>
</div>
<p id="section-6.11-5">CBOR diagnostic notation: null<a href="#section-6.11-5" class="pilcrow">¶</a></p>
<p id="section-6.11-6">CBOR encoding: F6<a href="#section-6.11-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="union">
<section id="section-6.12">
<h3 id="name-the-union-type">
<a href="#section-6.12" class="section-number selfRef">6.12. </a><a href="#name-the-union-type" class="section-name selfRef">The 'union' Type</a>
</h3>
<p id="section-6.12-1">Leafs of type union <span class="bcp14">MUST</span> be encoded using the rules associated with one of the types listed.
When used in a union, the following YANG datatypes are enclosed by a CBOR tag to avoid confusion
between different YANG datatypes encoded using the same CBOR major type.<a href="#section-6.12-1" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-6.12-2.1">bits<a href="#section-6.12-2.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-6.12-2.2">enumeration<a href="#section-6.12-2.2" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-6.12-2.3">identityref<a href="#section-6.12-2.3" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-6.12-2.4">instance-identifier<a href="#section-6.12-2.4" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-6.12-3">See <a href="#tag-registry" class="xref">Section 9.3</a> for the assigned value of these CBOR tags.<a href="#section-6.12-3" class="pilcrow">¶</a></p>
<p id="section-6.12-4">As mentioned in Sections <a href="#enumeration" class="xref">6.6</a> and in <a href="#bits" class="xref">6.7</a>, 'enumeration' and 'bits' are encoded as a CBOR text string data item (major type 3) when defined within a 'union' type.
(This adds considerable complexity but is necessary because of an
idiosyncrasy of the YANG data model for unions; the work-around allows
compatibility to be maintained with the encoding of overlapping unions
in XML and JSON.
See also <span><a href="https://www.rfc-editor.org/rfc/rfc7950#section-9.12" class="relref">Section 9.12</a> of [<a href="#RFC7950" class="xref">RFC7950</a>]</span>.)<a href="#section-6.12-4" class="pilcrow">¶</a></p>
<p id="section-6.12-5">The following example shows the encoding of an 'ip-address' leaf representation node instance when set to "2001:db8:a0b:12f0::1".<a href="#section-6.12-5" class="pilcrow">¶</a></p>
<p id="section-6.12-6" class="keepWithNext">Definition example adapted from <span>[<a href="#RFC6991" class="xref">RFC6991</a>]</span>:<a href="#section-6.12-6" class="pilcrow">¶</a></p>
<div id="section-6.12-7">
<pre class="lang-yang sourcecode">
typedef ipv4-address {
type string {
pattern
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+ '(%[\p{N}\p{L}]+)?';
}
}
typedef ipv6-address {
type string {
pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+ '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+ '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+ '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+ '(%[\p{N}\p{L}]+)?';
pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+ '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+ '(%.+)?';
}
}
typedef ip-address {
type union {
type ipv4-address;
type ipv6-address;
}
}
leaf address {
type ip-address;
}
</pre><a href="#section-6.12-7" class="pilcrow">¶</a>
</div>
<p id="section-6.12-8">CBOR diagnostic notation: "2001:db8:a0b:12f0::1"<a href="#section-6.12-8" class="pilcrow">¶</a></p>
<p id="section-6.12-9">CBOR encoding: 74 323030313A6462383A6130623A313266303A3A31<a href="#section-6.12-9" class="pilcrow">¶</a></p>
</section>
</div>
<div id="instance-id">
<section id="section-6.13">
<h3 id="name-the-instance-identifier-typ">
<a href="#section-6.13" class="section-number selfRef">6.13. </a><a href="#name-the-instance-identifier-typ" class="section-name selfRef">The 'instance-identifier' Type</a>
</h3>
<p id="section-6.13-1">This specification supports two approaches for encoding an instance-identifier: one based on YANG Schema Item iDentifier, as defined in <a href="#sid" class="xref">Section 3.2</a>, and one based on names, as defined in <a href="#name" class="xref">Section 3.3</a>.
See <a href="#union" class="xref">Section 6.12</a> for an exceptional case when this representation needs to be tagged.<a href="#section-6.13-1" class="pilcrow">¶</a></p>
<div id="instance-identifier-with-sid">
<section id="section-6.13.1">
<h4 id="name-sids-as-instance-identifier">
<a href="#section-6.13.1" class="section-number selfRef">6.13.1. </a><a href="#name-sids-as-instance-identifier" class="section-name selfRef">SIDs as 'instance-identifier'</a>
</h4>
<p id="section-6.13.1-1">SIDs uniquely identify a schema node. In the case of a single instance schema node, i.e., a schema node defined at the root of a YANG module or submodule or schema nodes defined within a container, the SID is sufficient to identify this instance (representation node).
(Note that no delta mechanism is employed for SIDs used for identityref, see <a href="#identityref-with-sid" class="xref">Section 6.10.1</a>.)<a href="#section-6.13.1-1" class="pilcrow">¶</a></p>
<p id="section-6.13.1-2">In the case of a representation node that is an entry of a YANG list, a SID is combined with the list key(s) to identify each instance within the YANG list(s).<a href="#section-6.13.1-2" class="pilcrow">¶</a></p>
<p id="section-6.13.1-3">Instance-identifiers of single instance schema nodes <span class="bcp14">MUST</span> be encoded using a CBOR unsigned integer data item (major type 0) and set to the targeted schema node SID.<a href="#section-6.13.1-3" class="pilcrow">¶</a></p>
<p id="section-6.13.1-4">Instance-identifiers of representation node entries of a YANG list <span class="bcp14">MUST</span> be encoded using a CBOR array data item (major type 4) containing the following entries:<a href="#section-6.13.1-4" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-6.13.1-5.1">The first entry <span class="bcp14">MUST</span> be encoded as a CBOR unsigned integer data item (major type 0) and set to the targeted schema node SID.<a href="#section-6.13.1-5.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-6.13.1-5.2">The following entries <span class="bcp14">MUST</span> contain the value of each key required to identify the instance of the targeted schema node. These keys <span class="bcp14">MUST</span> be ordered as defined in the 'key' YANG statement, starting from the top-level list, and followed by each subordinate list(s).<a href="#section-6.13.1-5.2" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-6.13.1-6">Examples within this section assume the definition of a schema node of type 'instance-identifier':<a href="#section-6.13.1-6" class="pilcrow">¶</a></p>
<p id="section-6.13.1-7">Definition example adapted from <span>[<a href="#RFC7950" class="xref">RFC7950</a>]</span>:<a href="#section-6.13.1-7" class="pilcrow">¶</a></p>
<div id="section-6.13.1-8">
<pre class="lang-yang sourcecode">
container system {
...
leaf reporting-entity {
type instance-identifier;
}
</pre><a href="#section-6.13.1-8" class="pilcrow">¶</a>
</div>
<p id="section-6.13.1-9"><strong>First example:</strong><a href="#section-6.13.1-9" class="pilcrow">¶</a></p>
<p id="section-6.13.1-10">The following example shows the encoding of the 'reporting-entity' value referencing data node instance "/system/contact" (SID 1741).<a href="#section-6.13.1-10" class="pilcrow">¶</a></p>
<p id="section-6.13.1-11">Definition example adapted from <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span>:<a href="#section-6.13.1-11" class="pilcrow">¶</a></p>
<div id="section-6.13.1-12">
<pre class="lang-yang sourcecode">
container system {
leaf contact {
type string;
}
leaf hostname {
type inet:domain-name;
}
}
</pre><a href="#section-6.13.1-12" class="pilcrow">¶</a>
</div>
<p id="section-6.13.1-13">CBOR diagnostic notation: 1741<a href="#section-6.13.1-13" class="pilcrow">¶</a></p>
<p id="section-6.13.1-14">CBOR encoding: 19 06CD<a href="#section-6.13.1-14" class="pilcrow">¶</a></p>
<p id="section-6.13.1-15" class="keepWithNext"><strong>Second example:</strong><a href="#section-6.13.1-15" class="pilcrow">¶</a></p>
<p id="section-6.13.1-16">This example aims to show how a representation node entry of a YANG list is identified.
It uses a somewhat arbitrarily modified YANG module version from <span>[<a href="#RFC7317" class="xref">RFC7317</a>]</span> by
adding <code>country</code> to the leafs and keys of <code>authorized-key</code>.<a href="#section-6.13.1-16" class="pilcrow">¶</a></p>
<p id="section-6.13.1-17">The following example shows the encoding of the 'reporting-entity' value referencing list instance "/system/authentication/user/authorized-key/key-data" (which is assumed to have SID 1734) for username "bob" and authorized-key with name "admin" and country "france".<a href="#section-6.13.1-17" class="pilcrow">¶</a></p>
<div id="section-6.13.1-18">
<pre class="lang-yang sourcecode">
list user {
key name;
leaf name {
type string;
}
leaf password {
type ianach:crypt-hash;
}
list authorized-key {
key "name country";
leaf country {
type string;
}
leaf name {
type string;
}
leaf algorithm {
type string;
}
leaf key-data {
type binary;
}
}
}
</pre><a href="#section-6.13.1-18" class="pilcrow">¶</a>
</div>
<p id="section-6.13.1-19">CBOR diagnostic notation: [1734, "bob", "admin", "france"]<a href="#section-6.13.1-19" class="pilcrow">¶</a></p>
<p id="section-6.13.1-20" class="keepWithNext">CBOR encoding:<a href="#section-6.13.1-20" class="pilcrow">¶</a></p>
<div id="section-6.13.1-21">
<pre class="lang-cbor-pretty sourcecode">
84 # array(4)
19 06C6 # unsigned(1734)
63 # text(3)
626F62 # "bob"
65 # text(5)
61646D696E # "admin"
66 # text(6)
6672616E6365 # "france"
</pre><a href="#section-6.13.1-21" class="pilcrow">¶</a>
</div>
<p id="section-6.13.1-22"><strong>Third example:</strong><a href="#section-6.13.1-22" class="pilcrow">¶</a></p>
<p id="section-6.13.1-23">The following example shows the encoding of the 'reporting-entity' value referencing the list instance "/system/authentication/user" (SID 1730), corresponding to username "jack".<a href="#section-6.13.1-23" class="pilcrow">¶</a></p>
<p id="section-6.13.1-24">CBOR diagnostic notation: [1730, "jack"]<a href="#section-6.13.1-24" class="pilcrow">¶</a></p>
<p id="section-6.13.1-25">CBOR encoding:<a href="#section-6.13.1-25" class="pilcrow">¶</a></p>
<div id="section-6.13.1-26">
<pre class="lang-cbor-pretty sourcecode">
82 # array(2)
19 06C2 # unsigned(1730)
64 # text(4)
6A61636B # "jack"
</pre><a href="#section-6.13.1-26" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="names-as-instance-identifier">
<section id="section-6.13.2">
<h4 id="name-names-as-instance-identifie">
<a href="#section-6.13.2" class="section-number selfRef">6.13.2. </a><a href="#name-names-as-instance-identifie" class="section-name selfRef">Names as 'instance-identifier'</a>
</h4>
<p id="section-6.13.2-1">An 'instance-identifier' value is encoded as a text string that is
analogous to the lexical representation in XML encoding; see <span><a href="https://www.rfc-editor.org/rfc/rfc7950#section-9.13.2" class="relref">Section 9.13.2</a> of [<a href="#RFC7950" class="xref">RFC7950</a>]</span>. However, the encoding of namespaces in instance-identifier values follows the rules stated in <a href="#name" class="xref">Section 3.3</a>, namely:<a href="#section-6.13.2-1" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-6.13.2-2.1">The leftmost (top-level) data node name is always in the namespace-qualified form.<a href="#section-6.13.2-2.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-6.13.2-2.2">Any subsequent data node name is in the namespace-qualified form if the node is defined in a module other than its parent node; otherwise, the simple form is used. This rule also holds for node names appearing in predicates.<a href="#section-6.13.2-2.2" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-6.13.2-3">For example,<a href="#section-6.13.2-3" class="pilcrow">¶</a></p>
<p id="section-6.13.2-4">/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ip<a href="#section-6.13.2-4" class="pilcrow">¶</a></p>
<p id="section-6.13.2-5">is a valid instance-identifier value because the data nodes "interfaces", "interface", and "name" are defined in the module "ietf-interfaces", whereas "ipv4" and "ip" are defined in "ietf-ip".<a href="#section-6.13.2-5" class="pilcrow">¶</a></p>
<p id="section-6.13.2-6">The resulting XML Path Language (XPath) <span class="bcp14">MUST</span> be encoded using a CBOR text string data item (major type 3).<a href="#section-6.13.2-6" class="pilcrow">¶</a></p>
<p id="section-6.13.2-7"><strong>First example:</strong><a href="#section-6.13.2-7" class="pilcrow">¶</a></p>
<p id="section-6.13.2-8">This example is described in <a href="#instance-identifier-with-sid" class="xref">Section 6.13.1</a>.<a href="#section-6.13.2-8" class="pilcrow">¶</a></p>
<p id="section-6.13.2-9">CBOR diagnostic notation: "/ietf-system:system/contact"<a href="#section-6.13.2-9" class="pilcrow">¶</a></p>
<p id="section-6.13.2-10">CBOR encoding:<a href="#section-6.13.2-10" class="pilcrow">¶</a></p>
<div id="section-6.13.2-11">
<pre class="lang-cbor-pretty sourcecode">
78 1B 2F696574662D73797374656D3A73797374656D2F636F6E74616374
</pre><a href="#section-6.13.2-11" class="pilcrow">¶</a>
</div>
<p id="section-6.13.2-12"><strong>Second example:</strong><a href="#section-6.13.2-12" class="pilcrow">¶</a></p>
<p id="section-6.13.2-13">This example is described in <a href="#instance-identifier-with-sid" class="xref">Section 6.13.1</a>.<a href="#section-6.13.2-13" class="pilcrow">¶</a></p>
<p id="section-6.13.2-14">CBOR diagnostic notation (the line break is inserted for exposition only):<a href="#section-6.13.2-14" class="pilcrow">¶</a></p>
<div id="section-6.13.2-15">
<pre class="lang-cbor-diag sourcecode">
"/ietf-system:system/authentication/user[name='bob']/
authorized-key[name='admin'][country='france']/key-data"
</pre><a href="#section-6.13.2-15" class="pilcrow">¶</a>
</div>
<p id="section-6.13.2-16">CBOR encoding:<a href="#section-6.13.2-16" class="pilcrow">¶</a></p>
<div id="section-6.13.2-17">
<pre class="lang-cbor-pretty sourcecode">
78 6B
2F696574662D73797374656D3A73797374656D2F61757468656E74696361
74696F6E2F757365725B6E616D653D27626F62275D2F617574686F72697A
65642D6B65795B6E616D653D2761646D696E275D5B636F756E7472793D27
6672616E6365275D2F6B65792D64617461
</pre><a href="#section-6.13.2-17" class="pilcrow">¶</a>
</div>
<p id="section-6.13.2-18"><strong>Third example:</strong><a href="#section-6.13.2-18" class="pilcrow">¶</a></p>
<p id="section-6.13.2-19">This example is described in <a href="#instance-identifier-with-sid" class="xref">Section 6.13.1</a>.<a href="#section-6.13.2-19" class="pilcrow">¶</a></p>
<p id="section-6.13.2-20">CBOR diagnostic notation:<a href="#section-6.13.2-20" class="pilcrow">¶</a></p>
<div id="section-6.13.2-21">
<pre class="lang-cbor-diag sourcecode">
"/ietf-system:system/authentication/user[name='jack']"
</pre><a href="#section-6.13.2-21" class="pilcrow">¶</a>
</div>
<p id="section-6.13.2-22">CBOR encoding:<a href="#section-6.13.2-22" class="pilcrow">¶</a></p>
<div id="section-6.13.2-23">
<pre class="lang-cbor-pretty sourcecode">
78 34 # text(52)
2F696574662D73797374656D3A73797374656D2F61757468656E74696361
74696F6E2F757365725B6E616D653D276A61636B275D
</pre><a href="#section-6.13.2-23" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
</section>
</div>
<div id="content-type">
<section id="section-7">
<h2 id="name-content-types">
<a href="#section-7" class="section-number selfRef">7. </a><a href="#name-content-types" class="section-name selfRef">Content-Types</a>
</h2>
<p id="section-7-1">This specification defines the media type
<code>application/yang-data+cbor</code>, which can be used without parameters or
with the <code>id</code> parameter set to either <code>name</code> or <code>sid</code>.<a href="#section-7-1" class="pilcrow">¶</a></p>
<p id="section-7-2">This media type represents a YANG-CBOR document containing a representation tree.
If the media type parameter <code>id</code> is present,
depending on its value,
each representation node is identified by its associated namespace-qualified
name, as defined in <a href="#name" class="xref">Section 3.3</a> (<code>id=name</code>), or by its associated YANG SID
(represented, e.g., in CBOR map keys as a SID delta or via tag number 47), as defined in <a href="#sid" class="xref">Section 3.2</a>
(<code>id=sid</code>), respectively.
If no <code>id</code> parameter is given, both forms may be present.<a href="#section-7-2" class="pilcrow">¶</a></p>
<p id="section-7-3">The format of an <code>application/yang-data+cbor</code> representation is that
of a CBOR map, mapping names, and/or SIDs (as defined above) into
instance values (using the rules defined in <a href="#instance-encoding" class="xref">Section 4</a>).<a href="#section-7-3" class="pilcrow">¶</a></p>
<p id="section-7-4">It is not foreseen at this point that the valid set of values for the
<code>id</code> parameter will extend beyond <code>name</code>, <code>sid</code>, or being unset; if
that does happen, any new value is foreseen to be of the form
<code>[a-z][a-z0-9]*(-[a-z0-9]+)*</code>.<a href="#section-7-4" class="pilcrow">¶</a></p>
<p id="section-7-5">In summary, this document defines three content-types, which are
intended for use by different classes of applications:<a href="#section-7-5" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-7-6.1">
<code>application/yang-data+cbor; id=sid</code> -- for use by applications that
need to be frugal with encoding space and text string processing
(e.g., applications running on constrained nodes <span>[<a href="#RFC7228" class="xref">RFC7228</a>]</span> or
applications with particular performance requirements);<a href="#section-7-6.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-7-6.2">
<code>application/yang-data+cbor; id=name</code> -- for use by applications that
do not want to engage in SID management and that have ample
resources to manage text-string-based item identifiers (e.g.,
applications that directly want to substitute
<code>application/yang.data+json</code> with a more efficient representation
without any other changes); and<a href="#section-7-6.2" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-7-6.3">
<code>application/yang-data+cbor</code> -- for use by more complex applications
that can benefit from the increased efficiency of SID identifiers
but also need to integrate databases of YANG modules before SID
mappings are defined for them.<a href="#section-7-6.3" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-7-7">All three content-types are based on the same representation
mechanisms, parts of which are simply not used in the first and second
cases.<a href="#section-7-7" class="pilcrow">¶</a></p>
<p id="section-7-8">How the use of one of these content-types is selected in a transfer
protocol is outside the scope of this specification.
The last paragraph of <span><a href="https://www.rfc-editor.org/rfc/rfc8040#section-5.2" class="relref">Section 5.2</a> of [<a href="#RFC8040" class="xref">RFC8040</a>]</span> discusses how to
indicate and request the usage of specific content-types in RESTCONF.
Similar mechanisms are available in the Constrained Application Protocol (CoAP) <span>[<a href="#RFC7252" class="xref">RFC7252</a>]</span> using the
Content-Format and Accept Options; <span>[<a href="#I-D.ietf-core-comi" class="xref">CORE-COMI</a>]</span> demonstrates specifics on
how Content-Format may be used to indicate the <code>id=sid</code> case.<a href="#section-7-8" class="pilcrow">¶</a></p>
</section>
</div>
<div id="security-considerations">
<section id="section-8">
<h2 id="name-security-considerations">
<a href="#section-8" class="section-number selfRef">8. </a><a href="#name-security-considerations" class="section-name selfRef">Security Considerations</a>
</h2>
<p id="section-8-1">The security considerations of <span>[<a href="#RFC8949" class="xref">RFC8949</a>]</span> and <span>[<a href="#RFC7950" class="xref">RFC7950</a>]</span> apply.<a href="#section-8-1" class="pilcrow">¶</a></p>
<p id="section-8-2">This document defines an alternative encoding for data modeled in the YANG data modeling language. As such, this encoding does not contribute any new security issues in addition to those identified for the specific protocol or context for which it is used.<a href="#section-8-2" class="pilcrow">¶</a></p>
<p id="section-8-3">To minimize security risks, software on the receiving side <span class="bcp14">SHOULD</span> reject all messages that do not comply to the rules of this document and reply with an appropriate error message to the sender.<a href="#section-8-3" class="pilcrow">¶</a></p>
<p id="section-8-4">For instance, when the <code>id</code> parameter to the media type is used, it is
important to properly reject identifiers of the other type to avoid
scenarios where different implementations interpret a given content in
different ways.<a href="#section-8-4" class="pilcrow">¶</a></p>
<p id="section-8-5">When SIDs are in use, the interpretation of encoded data not only
relies on having the right YANG modules but also on having the right
SID mapping information. Management and evolution of that mapping
information therefore requires the same care as the management and
evolution of the YANG modules themselves. The procedures in
<span>[<a href="#I-D.ietf-core-sid" class="xref">CORE-SID</a>]</span> are being defined with this in mind.<a href="#section-8-5" class="pilcrow">¶</a></p>
</section>
</div>
<div id="iana-considerations">
<section id="section-9">
<h2 id="name-iana-considerations">
<a href="#section-9" class="section-number selfRef">9. </a><a href="#name-iana-considerations" class="section-name selfRef">IANA Considerations</a>
</h2>
<div id="media-types-registry">
<section id="section-9.1">
<h3 id="name-media-types-registry">
<a href="#section-9.1" class="section-number selfRef">9.1. </a><a href="#name-media-types-registry" class="section-name selfRef">Media Types Registry</a>
</h3>
<p id="section-9.1-1">IANA has added the following media type to the "<a href="https://www.iana.org/assignments/media-types/#media-types" class="relref">Media Types</a>" registry <span>[<a href="#IANA.media-types" class="xref">IANA.media-types</a>]</span>.<a href="#section-9.1-1" class="pilcrow">¶</a></p>
<span id="name-media-types-registry-2"></span><table class="left" id="table-2">
<caption>
<a href="#table-2" class="selfRef">Table 2</a>:
<a href="#name-media-types-registry-2" class="selfRef">Media Types Registry</a>
</caption>
<thead>
<tr>
<th class="text-left" rowspan="1" colspan="1">Name</th>
<th class="text-left" rowspan="1" colspan="1">Template</th>
<th class="text-left" rowspan="1" colspan="1">Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left" rowspan="1" colspan="1">yang-data+cbor</td>
<td class="text-left" rowspan="1" colspan="1">application/yang-data+cbor</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
</tbody>
</table>
<span class="break"></span><dl class="dlParallel" id="section-9.1-3">
<dt id="section-9.1-3.1">Type name:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.2">application<a href="#section-9.1-3.2" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.3">Subtype name:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.4">yang-data+cbor<a href="#section-9.1-3.4" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.5">Required parameters:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.6">N/A<a href="#section-9.1-3.6" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.7">Optional parameters:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.8">id (see <a href="#content-type" class="xref">Section 7</a> of RFC 9254)<a href="#section-9.1-3.8" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.9">Encoding considerations:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.10">binary (CBOR)<a href="#section-9.1-3.10" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.11">Security considerations:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.12">see <a href="#security-considerations" class="xref">Section 8</a> of RFC 9254<a href="#section-9.1-3.12" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.13">Interoperability considerations:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.14">N/A<a href="#section-9.1-3.14" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.15">Published specification:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.16">RFC 9254<a href="#section-9.1-3.16" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.17">Applications that use this media type:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.18">applications that need a
concise and efficient representation of YANG-modeled data<a href="#section-9.1-3.18" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.19">Fragment identifier considerations:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.20">The syntax and semantics of
fragment identifiers specified for "application/yang-data+cbor" is
as specified for "application/cbor". (At publication of this
document, there is no fragment identification syntax defined for
"application/cbor".)<a href="#section-9.1-3.20" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.21">Additional information:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.22"></dd>
<dd class="break"></dd>
<dt id="section-9.1-3.23">Magic number(s):</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.24">N/A<a href="#section-9.1-3.24" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.25">File extension(s):</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.26">N/A<a href="#section-9.1-3.26" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.27">Macintosh file type code(s):</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.28">N/A<a href="#section-9.1-3.28" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.29">Person & email address to contact for further information:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.30">CORE WG mailing list (core@ietf.org)
or IETF Applications and Real-Time Area (art@ietf.org)<a href="#section-9.1-3.30" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.31">Intended usage:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.32">COMMON<a href="#section-9.1-3.32" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.33">Restrictions on usage:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.34">N/A<a href="#section-9.1-3.34" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.35">Author:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.36">CoRE WG<a href="#section-9.1-3.36" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
<dt id="section-9.1-3.37">Change controller:</dt>
<dd style="margin-left: 1.5em" id="section-9.1-3.38">IETF<a href="#section-9.1-3.38" class="pilcrow">¶</a>
</dd>
<dd class="break"></dd>
</dl>
</section>
</div>
<div id="coap-content-formats-registry">
<section id="section-9.2">
<h3 id="name-coap-content-formats-regist">
<a href="#section-9.2" class="section-number selfRef">9.2. </a><a href="#name-coap-content-formats-regist" class="section-name selfRef">CoAP Content-Formats Registry</a>
</h3>
<p id="section-9.2-1">IANA has added the following Content-Formats to the "<a href="https://www.iana.org/assignments/core-parameters/#content-formats" class="relref">CoAP Content-Formats</a>" subregistry,
within the "<a href="https://www.iana.org/assignments/core-parameters/#coap-content-format" class="relref">Constrained RESTful Environments (CoRE) Parameters</a>"
registry <span>[<a href="#IANA.core-parameters" class="xref">IANA.core-parameters</a>]</span>. The registration procedure is "Expert Review" for the 0-255 range and
"IETF Review" for the 256-9999 range.<a href="#section-9.2-1" class="pilcrow">¶</a></p>
<span id="name-coap-content-format-registr"></span><table class="left" id="table-3">
<caption>
<a href="#table-3" class="selfRef">Table 3</a>:
<a href="#name-coap-content-format-registr" class="selfRef">CoAP Content-Format Registry</a>
</caption>
<thead>
<tr>
<th class="text-left" rowspan="1" colspan="1">Media Type</th>
<th class="text-left" rowspan="1" colspan="1">Encoding</th>
<th class="text-left" rowspan="1" colspan="1">ID</th>
<th class="text-left" rowspan="1" colspan="1">Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left" rowspan="1" colspan="1">application/yang-data+cbor</td>
<td class="text-left" rowspan="1" colspan="1">-</td>
<td class="text-left" rowspan="1" colspan="1">340</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">application/yang-data+cbor; id=name</td>
<td class="text-left" rowspan="1" colspan="1">-</td>
<td class="text-left" rowspan="1" colspan="1">341</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">application/yang-data+cbor; id=sid</td>
<td class="text-left" rowspan="1" colspan="1">-</td>
<td class="text-left" rowspan="1" colspan="1">140</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
</tbody>
</table>
</section>
</div>
<div id="tag-registry">
<section id="section-9.3">
<h3 id="name-cbor-tags-registry">
<a href="#section-9.3" class="section-number selfRef">9.3. </a><a href="#name-cbor-tags-registry" class="section-name selfRef">CBOR Tags Registry</a>
</h3>
<p id="section-9.3-1">IANA has allocated the following CBOR tag numbers in the "<a href="https://www.iana.org/assignments/cbor-tags#tags" class="relref">CBOR Tags</a>" registry <span>[<a href="#IANA.cbor-tags" class="xref">IANA.cbor-tags</a>]</span> defined in <span><a href="https://www.rfc-editor.org/rfc/rfc8949#section-9.2" class="relref">Section 9.2</a> of [<a href="#RFC8949" class="xref">RFC8949</a>]</span>.<a href="#section-9.3-1" class="pilcrow">¶</a></p>
<span id="name-cbor-tags-registry-2"></span><div id="tab-tag-values">
<table class="center" id="table-4">
<caption>
<a href="#table-4" class="selfRef">Table 4</a>:
<a href="#name-cbor-tags-registry-2" class="selfRef">CBOR Tags Registry</a>
</caption>
<thead>
<tr>
<th class="text-left" rowspan="1" colspan="1">Tag</th>
<th class="text-left" rowspan="1" colspan="1">Data Item</th>
<th class="text-left" rowspan="1" colspan="1">Semantics</th>
<th class="text-left" rowspan="1" colspan="1">Reference</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left" rowspan="1" colspan="1">43</td>
<td class="text-left" rowspan="1" colspan="1">text string</td>
<td class="text-left" rowspan="1" colspan="1">YANG bits datatype; see <a href="#bits" class="xref">Section 6.7</a>.</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">44</td>
<td class="text-left" rowspan="1" colspan="1">text string</td>
<td class="text-left" rowspan="1" colspan="1">YANG enumeration datatype; see <a href="#enumeration" class="xref">Section 6.6</a>.</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">45</td>
<td class="text-left" rowspan="1" colspan="1">unsigned integer or text string</td>
<td class="text-left" rowspan="1" colspan="1">YANG identityref datatype; see <a href="#identityref" class="xref">Section 6.10</a>.</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">46</td>
<td class="text-left" rowspan="1" colspan="1">unsigned integer or text string or array</td>
<td class="text-left" rowspan="1" colspan="1">YANG instance-identifier datatype; see <a href="#instance-id" class="xref">Section 6.13</a>.</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">47</td>
<td class="text-left" rowspan="1" colspan="1">unsigned integer</td>
<td class="text-left" rowspan="1" colspan="1">YANG Schema Item iDentifier (SID); see <a href="#sid" class="xref">Section 3.2</a>.</td>
<td class="text-left" rowspan="1" colspan="1">RFC 9254</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</section>
</div>
<section id="section-10">
<h2 id="name-references">
<a href="#section-10" class="section-number selfRef">10. </a><a href="#name-references" class="section-name selfRef">References</a>
</h2>
<section id="section-10.1">
<h3 id="name-normative-references">
<a href="#section-10.1" class="section-number selfRef">10.1. </a><a href="#name-normative-references" class="section-name selfRef">Normative References</a>
</h3>
<dl class="references">
<dt id="IANA.cbor-tags">[IANA.cbor-tags]</dt>
<dd>
<span class="refAuthor">IANA</span>, <span class="refTitle">"Concise Binary Object Representation (CBOR) Tags"</span>, <span><<a href="https://www.iana.org/assignments/cbor-tags">https://www.iana.org/assignments/cbor-tags</a>></span>. </dd>
<dd class="break"></dd>
<dt id="IANA.core-parameters">[IANA.core-parameters]</dt>
<dd>
<span class="refAuthor">IANA</span>, <span class="refTitle">"Constrained RESTful Environments (CoRE) Parameters"</span>, <span><<a href="https://www.iana.org/assignments/core-parameters/">https://www.iana.org/assignments/core-parameters/</a>></span>. </dd>
<dd class="break"></dd>
<dt id="IANA.media-types">[IANA.media-types]</dt>
<dd>
<span class="refAuthor">IANA</span>, <span class="refTitle">"Media Types"</span>, <span><<a href="https://www.iana.org/assignments/media-types/">https://www.iana.org/assignments/media-types/</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC2119">[RFC2119]</dt>
<dd>
<span class="refAuthor">Bradner, S.</span>, <span class="refTitle">"Key words for use in RFCs to Indicate Requirement Levels"</span>, <span class="seriesInfo">BCP 14</span>, <span class="seriesInfo">RFC 2119</span>, <span class="seriesInfo">DOI 10.17487/RFC2119</span>, <time datetime="1997-03" class="refDate">March 1997</time>, <span><<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC5234">[RFC5234]</dt>
<dd>
<span class="refAuthor">Crocker, D., Ed.</span> and <span class="refAuthor">P. Overell</span>, <span class="refTitle">"Augmented BNF for Syntax Specifications: ABNF"</span>, <span class="seriesInfo">STD 68</span>, <span class="seriesInfo">RFC 5234</span>, <span class="seriesInfo">DOI 10.17487/RFC5234</span>, <time datetime="2008-01" class="refDate">January 2008</time>, <span><<a href="https://www.rfc-editor.org/info/rfc5234">https://www.rfc-editor.org/info/rfc5234</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC7950">[RFC7950]</dt>
<dd>
<span class="refAuthor">Bjorklund, M., Ed.</span>, <span class="refTitle">"The YANG 1.1 Data Modeling Language"</span>, <span class="seriesInfo">RFC 7950</span>, <span class="seriesInfo">DOI 10.17487/RFC7950</span>, <time datetime="2016-08" class="refDate">August 2016</time>, <span><<a href="https://www.rfc-editor.org/info/rfc7950">https://www.rfc-editor.org/info/rfc7950</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC7951">[RFC7951]</dt>
<dd>
<span class="refAuthor">Lhotka, L.</span>, <span class="refTitle">"JSON Encoding of Data Modeled with YANG"</span>, <span class="seriesInfo">RFC 7951</span>, <span class="seriesInfo">DOI 10.17487/RFC7951</span>, <time datetime="2016-08" class="refDate">August 2016</time>, <span><<a href="https://www.rfc-editor.org/info/rfc7951">https://www.rfc-editor.org/info/rfc7951</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8040">[RFC8040]</dt>
<dd>
<span class="refAuthor">Bierman, A.</span>, <span class="refAuthor">Bjorklund, M.</span>, and <span class="refAuthor">K. Watsen</span>, <span class="refTitle">"RESTCONF Protocol"</span>, <span class="seriesInfo">RFC 8040</span>, <span class="seriesInfo">DOI 10.17487/RFC8040</span>, <time datetime="2017-01" class="refDate">January 2017</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8040">https://www.rfc-editor.org/info/rfc8040</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8174">[RFC8174]</dt>
<dd>
<span class="refAuthor">Leiba, B.</span>, <span class="refTitle">"Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"</span>, <span class="seriesInfo">BCP 14</span>, <span class="seriesInfo">RFC 8174</span>, <span class="seriesInfo">DOI 10.17487/RFC8174</span>, <time datetime="2017-05" class="refDate">May 2017</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8259">[RFC8259]</dt>
<dd>
<span class="refAuthor">Bray, T., Ed.</span>, <span class="refTitle">"The JavaScript Object Notation (JSON) Data Interchange Format"</span>, <span class="seriesInfo">STD 90</span>, <span class="seriesInfo">RFC 8259</span>, <span class="seriesInfo">DOI 10.17487/RFC8259</span>, <time datetime="2017-12" class="refDate">December 2017</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8259">https://www.rfc-editor.org/info/rfc8259</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8610">[RFC8610]</dt>
<dd>
<span class="refAuthor">Birkholz, H.</span>, <span class="refAuthor">Vigano, C.</span>, and <span class="refAuthor">C. Bormann</span>, <span class="refTitle">"Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures"</span>, <span class="seriesInfo">RFC 8610</span>, <span class="seriesInfo">DOI 10.17487/RFC8610</span>, <time datetime="2019-06" class="refDate">June 2019</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8610">https://www.rfc-editor.org/info/rfc8610</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8791">[RFC8791]</dt>
<dd>
<span class="refAuthor">Bierman, A.</span>, <span class="refAuthor">Björklund, M.</span>, and <span class="refAuthor">K. Watsen</span>, <span class="refTitle">"YANG Data Structure Extensions"</span>, <span class="seriesInfo">RFC 8791</span>, <span class="seriesInfo">DOI 10.17487/RFC8791</span>, <time datetime="2020-06" class="refDate">June 2020</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8791">https://www.rfc-editor.org/info/rfc8791</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8949">[RFC8949]</dt>
<dd>
<span class="refAuthor">Bormann, C.</span> and <span class="refAuthor">P. Hoffman</span>, <span class="refTitle">"Concise Binary Object Representation (CBOR)"</span>, <span class="seriesInfo">STD 94</span>, <span class="seriesInfo">RFC 8949</span>, <span class="seriesInfo">DOI 10.17487/RFC8949</span>, <time datetime="2020-12" class="refDate">December 2020</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8949">https://www.rfc-editor.org/info/rfc8949</a>></span>. </dd>
<dd class="break"></dd>
</dl>
</section>
<section id="section-10.2">
<h3 id="name-informative-references">
<a href="#section-10.2" class="section-number selfRef">10.2. </a><a href="#name-informative-references" class="section-name selfRef">Informative References</a>
</h3>
<dl class="references">
<dt id="I-D.ietf-core-comi">[CORE-COMI]</dt>
<dd>
<span class="refAuthor">Veillette, M., Ed.</span>, <span class="refAuthor">van der Stok, P., Ed.</span>, <span class="refAuthor">Pelov, A.</span>, <span class="refAuthor">Bierman, A.</span>, and <span class="refAuthor">I. Petrov, Ed.</span>, <span class="refTitle">"CoAP Management Interface (CORECONF)"</span>, <span class="refContent">Work in Progress</span>, <span class="seriesInfo">Internet-Draft, draft-ietf-core-comi-11</span>, <time datetime="2021-01-17" class="refDate">17 January 2021</time>, <span><<a href="https://datatracker.ietf.org/doc/html/draft-ietf-core-comi-11">https://datatracker.ietf.org/doc/html/draft-ietf-core-comi-11</a>></span>. </dd>
<dd class="break"></dd>
<dt id="I-D.ietf-core-sid">[CORE-SID]</dt>
<dd>
<span class="refAuthor">Veillette, M., Ed.</span>, <span class="refAuthor">Pelov, A., Ed.</span>, <span class="refAuthor">Petrov, I., Ed.</span>, <span class="refAuthor">Bormann, C.</span>, and <span class="refAuthor">M. Richardson</span>, <span class="refTitle">"YANG Schema Item iDentifier (YANG SID)"</span>, <span class="refContent">Work in Progress</span>, <span class="seriesInfo">Internet-Draft, draft-ietf-core-sid-18</span>, <time datetime="2021-11-18" class="refDate">18 November 2021</time>, <span><<a href="https://datatracker.ietf.org/doc/html/draft-ietf-core-sid-18">https://datatracker.ietf.org/doc/html/draft-ietf-core-sid-18</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC6241">[RFC6241]</dt>
<dd>
<span class="refAuthor">Enns, R., Ed.</span>, <span class="refAuthor">Bjorklund, M., Ed.</span>, <span class="refAuthor">Schoenwaelder, J., Ed.</span>, and <span class="refAuthor">A. Bierman, Ed.</span>, <span class="refTitle">"Network Configuration Protocol (NETCONF)"</span>, <span class="seriesInfo">RFC 6241</span>, <span class="seriesInfo">DOI 10.17487/RFC6241</span>, <time datetime="2011-06" class="refDate">June 2011</time>, <span><<a href="https://www.rfc-editor.org/info/rfc6241">https://www.rfc-editor.org/info/rfc6241</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC6991">[RFC6991]</dt>
<dd>
<span class="refAuthor">Schoenwaelder, J., Ed.</span>, <span class="refTitle">"Common YANG Data Types"</span>, <span class="seriesInfo">RFC 6991</span>, <span class="seriesInfo">DOI 10.17487/RFC6991</span>, <time datetime="2013-07" class="refDate">July 2013</time>, <span><<a href="https://www.rfc-editor.org/info/rfc6991">https://www.rfc-editor.org/info/rfc6991</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC7228">[RFC7228]</dt>
<dd>
<span class="refAuthor">Bormann, C.</span>, <span class="refAuthor">Ersue, M.</span>, and <span class="refAuthor">A. Keranen</span>, <span class="refTitle">"Terminology for Constrained-Node Networks"</span>, <span class="seriesInfo">RFC 7228</span>, <span class="seriesInfo">DOI 10.17487/RFC7228</span>, <time datetime="2014-05" class="refDate">May 2014</time>, <span><<a href="https://www.rfc-editor.org/info/rfc7228">https://www.rfc-editor.org/info/rfc7228</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC7252">[RFC7252]</dt>
<dd>
<span class="refAuthor">Shelby, Z.</span>, <span class="refAuthor">Hartke, K.</span>, and <span class="refAuthor">C. Bormann</span>, <span class="refTitle">"The Constrained Application Protocol (CoAP)"</span>, <span class="seriesInfo">RFC 7252</span>, <span class="seriesInfo">DOI 10.17487/RFC7252</span>, <time datetime="2014-06" class="refDate">June 2014</time>, <span><<a href="https://www.rfc-editor.org/info/rfc7252">https://www.rfc-editor.org/info/rfc7252</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC7317">[RFC7317]</dt>
<dd>
<span class="refAuthor">Bierman, A.</span> and <span class="refAuthor">M. Bjorklund</span>, <span class="refTitle">"A YANG Data Model for System Management"</span>, <span class="seriesInfo">RFC 7317</span>, <span class="seriesInfo">DOI 10.17487/RFC7317</span>, <time datetime="2014-08" class="refDate">August 2014</time>, <span><<a href="https://www.rfc-editor.org/info/rfc7317">https://www.rfc-editor.org/info/rfc7317</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8343">[RFC8343]</dt>
<dd>
<span class="refAuthor">Bjorklund, M.</span>, <span class="refTitle">"A YANG Data Model for Interface Management"</span>, <span class="seriesInfo">RFC 8343</span>, <span class="seriesInfo">DOI 10.17487/RFC8343</span>, <time datetime="2018-03" class="refDate">March 2018</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8343">https://www.rfc-editor.org/info/rfc8343</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8344">[RFC8344]</dt>
<dd>
<span class="refAuthor">Bjorklund, M.</span>, <span class="refTitle">"A YANG Data Model for IP Management"</span>, <span class="seriesInfo">RFC 8344</span>, <span class="seriesInfo">DOI 10.17487/RFC8344</span>, <time datetime="2018-03" class="refDate">March 2018</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8344">https://www.rfc-editor.org/info/rfc8344</a>></span>. </dd>
<dd class="break"></dd>
</dl>
</section>
</section>
<div id="acknowledgments">
<section id="appendix-A">
<h2 id="name-acknowledgments">
<a href="#name-acknowledgments" class="section-name selfRef">Acknowledgments</a>
</h2>
<p id="appendix-A-1">This document has been largely inspired by the extensive work done by <span class="contact-name">Andy Bierman</span> and <span class="contact-name">Peter van der Stok</span> on <span>[<a href="#I-D.ietf-core-comi" class="xref">CORE-COMI</a>]</span>. <span>[<a href="#RFC7951" class="xref">RFC7951</a>]</span> has also been a critical input to this work. The authors would like to thank the authors and contributors of these two documents.<a href="#appendix-A-1" class="pilcrow">¶</a></p>
<p id="appendix-A-2">The authors would also like to acknowledge the review, feedback, and
comments from <span class="contact-name">Ladislav Lhotka</span> and <span class="contact-name">Jürgen Schönwälder</span> and from the
Document Shepherd <span class="contact-name">Marco Tiloca</span>.
Extensive comments helped us further improve the document in the IESG
review process; the authors would like to call out specifically the
feedback and guidance by the responsible AD <span class="contact-name">Francesca Palombini</span> and
the significant improvements suggested by IESG members <span class="contact-name">Benjamin Kaduk</span>
and <span class="contact-name">Rob Wilton</span>.<a href="#appendix-A-2" class="pilcrow">¶</a></p>
</section>
</div>
<div id="authors-addresses">
<section id="appendix-B">
<h2 id="name-authors-addresses">
<a href="#name-authors-addresses" class="section-name selfRef">Authors' Addresses</a>
</h2>
<address class="vcard">
<div dir="auto" class="left"><span class="fn nameRole">Michel Veillette (<span class="role">editor</span>)</span></div>
<div dir="auto" class="left"><span class="org">Trilliant Networks Inc.</span></div>
<div dir="auto" class="left"><span class="street-address">610 Rue du Luxembourg</span></div>
<div dir="auto" class="left">
<span class="locality">Granby</span> <span class="region">Quebec</span> <span class="postal-code">J2J 2V2</span>
</div>
<div dir="auto" class="left"><span class="country-name">Canada</span></div>
<div class="email">
<span>Email:</span>
<a href="mailto:michel.veillette@trilliantinc.com" class="email">michel.veillette@trilliantinc.com</a>
</div>
</address>
<address class="vcard">
<div dir="auto" class="left"><span class="fn nameRole">Ivaylo Petrov (<span class="role">editor</span>)</span></div>
<div dir="auto" class="left"><span class="org">Google Switzerland GmbH</span></div>
<div dir="auto" class="left"><span class="street-address">Brandschenkestrasse 110</span></div>
<div dir="auto" class="left">CH-<span class="postal-code">8002</span> <span class="locality">Zurich</span>
</div>
<div dir="auto" class="left"><span class="country-name">Switzerland</span></div>
<div class="email">
<span>Email:</span>
<a href="mailto:ivaylopetrov@google.com" class="email">ivaylopetrov@google.com</a>
</div>
</address>
<address class="vcard">
<div dir="auto" class="left"><span class="fn nameRole">Alexander Pelov</span></div>
<div dir="auto" class="left"><span class="org">Acklio</span></div>
<div dir="auto" class="left"><span class="street-address">1137A avenue des Champs Blancs</span></div>
<div dir="auto" class="left">
<span class="postal-code">35510</span> <span class="locality">Cesson-Sevigne Cedex</span>
</div>
<div dir="auto" class="left"><span class="country-name">France</span></div>
<div class="email">
<span>Email:</span>
<a href="mailto:a@ackl.io" class="email">a@ackl.io</a>
</div>
</address>
<address class="vcard">
<div dir="auto" class="left"><span class="fn nameRole">Carsten Bormann</span></div>
<div dir="auto" class="left"><span class="org">Universität Bremen TZI</span></div>
<div dir="auto" class="left"><span class="street-address">Postfach 330440</span></div>
<div dir="auto" class="left">
<span class="postal-code">D-28359</span> <span class="locality">Bremen</span>
</div>
<div dir="auto" class="left"><span class="country-name">Germany</span></div>
<div class="tel">
<span>Phone:</span>
<a href="tel:+49-421-218-63921" class="tel">+49-421-218-63921</a>
</div>
<div class="email">
<span>Email:</span>
<a href="mailto:cabo@tzi.org" class="email">cabo@tzi.org</a>
</div>
</address>
<address class="vcard">
<div dir="auto" class="left"><span class="fn nameRole">Michael Richardson</span></div>
<div dir="auto" class="left"><span class="org">Sandelman Software Works</span></div>
<div dir="auto" class="left"><span class="country-name">Canada</span></div>
<div class="email">
<span>Email:</span>
<a href="mailto:mcr+ietf@sandelman.ca" class="email">mcr+ietf@sandelman.ca</a>
</div>
</address>
</section>
</div>
<script>const toc = document.getElementById("toc");
toc.querySelector("h2").addEventListener("click", e => {
toc.classList.toggle("active");
});
toc.querySelector("nav").addEventListener("click", e => {
toc.classList.remove("active");
});
</script>
</body>
</html>
|