/usr/share/yuma/modules/yuma123/yangcli.yang is in libyuma-base 2.10-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | module yangcli {
namespace "http://yuma123.org/ns/yangcli";
prefix yc;
import ietf-yang-types { prefix yang; }
import yuma-ncx { prefix ncx; }
import yuma-app-common { prefix ncxapp; }
import yuma-types { prefix nt; }
import ietf-netconf { prefix nc; }
import yuma123-netconf-types { prefix nct; }
organization "yuma123";
contact "Vladimir Vassilev <vladimir@transpacket.com>.";
description
"
Command Line Interface for the NETCONF protocol: Client side
Usage:
yangcli [parameters]
yangcli --help
yangcli --version
Normal Mode:
An interactive CLI shell with command line history.
Autostart-mode:
If the 'server' parameter is present, then yangcli will
attempt to connect to that server upon startup. If the
'user' and 'password' parameters are also present, then
the user will not be prompted before the connection
is attempted. This parameter will be processed first,
if script-mode or batch-mode is used.
Script-mode:
If the 'run-script' or 'run-command' parameter is present,
then the specified script or command will be run
automatically upon startup.
Batch-mode:
If the 'batch-mode' parameter is present, then either the
'run-script' or 'run-command' parameter will be invoked, if
present, and then the program will exit. Any interactive
input breaks in the script or command will be skipped.
";
revision 2017-03-26 {
description
"Changed namespace in order to edit the original
netconfcentral model. Splitted yuma-netconf
into yuma123-netconf and yuma123-netconf-types";
}
typedef LogCount {
description
"Number of log entries. -1 means all entries";
type int32 {
range "-1 | 1 .. max";
}
}
typedef LogIndex {
description
"Index into a log buffer.";
type uint32;
}
typedef TimerId {
description
"Identifier for a local timer to use with
the start-timer and stop-timer commands.";
type uint8 {
range "0 .. 15";
}
}
typedef NameMatchMode {
description
"Defines the search mode that should be used
when resolving YANG node names in leafs and
leaf-lists using the UrlPath data type.";
type enumeration {
enum exact {
description
"The name must exactly match the node name
for all characters in both name strings.";
}
enum exact-nocase {
description
"The name must match the node name
for all characters in both name strings.
Strings are not case-sensitive.";
}
enum one {
description
"The name must exactly match the first N
characters of just one node name, which
must be the only partial name match found.";
}
enum one-nocase {
description
"The name must exactly match the first N
characters of just one node name, which
must be the only partial name match found.
Strings are not case-sensitive.";
}
enum first {
description
"The name must exactly match the first N
characters of any node name. The first one
found will be used.";
}
enum first-nocase {
description
"The name must exactly match the first N
characters of any node name. The first one
found will be used. Strings are not
case-sensitive.";
}
}
}
typedef AltNameMode {
description
"Defines the alternate name search mode that
should be used when resolving YANG node names
in leafs or leaflists using the UrlPath data type.
If 'true' then nodes with an 'alt-name' defined
will be considered a match if the YANG name or the
alternative name matches the search string.
If 'false' then only the YANG node name will
be used in node name searches.";
type boolean;
}
typedef UrlPath {
description
"Special URL encoded path expression.
Normal Encoding Rules:
- Normal content is encoded as an absolute path.
- Keys are encoded as a path step within the URL,
instead of a predicate expression like XPath.
- The first character must be a forward slash '/'.
- Each identifier or key encoded in the URL string
is separated by a single forward slash '/' character.
- Escaped character sequences are allowed, such
as '%20' for the space ' ' character.
- If any descendant nodes of a list are included,
then all key leafs for that list must be encoded
in the URL (or escaped with the dash '-' character
to skip that key).
- Only key leafs can be encoded within the URL string,
similar to a YANG instance-identifier or
schema-instance-identifier string. Other leafs
are not allowed.
Example URL and XPath strings:
XPath: /foo/bar[id='fred'][id2='barney]/baz
UrlPath: /foo/bar/fred/barney/baz
Example showing the 'id2' key leaf escaped:
XPath: /foo/bar[id='fred']/baz
UrlPath: /foo/bar/fred/-/baz
Special Encoding Rules
Since these escaped characters are usually decoded
by the time an HTTP gateway program will get them,
the forward slash '/' character needs to be treated
differently. To use this character within key leaf
content, it must be escaped with another forward
slash character.
Example showing escaped forward slash in content:
XPath: /interfaces/interface[name='1/0/22']/mtu
URLPath: /interfaces/interface/1//0//22/mtu
Name Matching
A parameter using the 'NameMatchMode' data type
can be used to control how name node searches
are done for nodes using this data type.
Alternate Naming
A parameter using the 'AltNameMode' data type
can be used to control whether alternative
node names can be used when name searches
are done for nodes using this data type.
Exceptions:
XML namespaces are not ignored, but if multiple
sibling nodes have the same local-name, then
the first node found will be used.
";
type string {
length "1..max";
}
}
typedef YangcliVariableType {
description
"yangcli user and system variable types";
type enumeration {
enum session {
description "Session variable (for future use)";
}
enum local {
description "Local user variable";
}
enum config {
description "User configuration variable";
}
enum global {
description "Global user variable";
}
enum system {
description "System variable";
}
enum queue {
description "System internal Queue variable";
}
}
}
/*************************************************************
*
* Groupings for parameters used in multiple commands
*
*************************************************************/
grouping MatchParms {
leaf match-names {
description
"Match mode to use for UrlPath name searches.";
type NameMatchMode;
}
leaf alt-names {
description
"Match mode to use for UrlPath name searches.";
type AltNameMode;
}
}
grouping FillParms {
choice target-parm {
leaf target {
description
"XPath target object to fill. If prefixes are missing
then the first match in any namespace will be used.
Any prefix used must be the default prefix
assigned to the desired YANG module. Prefix usage is
optional.";
// type schema-instance-identifier; TBD
type string {
length "1..max";
}
mandatory true;
ncx:schema-instance;
}
leaf urltarget {
description
"URL encoded target object to fill.
Encoding Rules: TBD.";
// type URL: TBD
type UrlPath;
mandatory true;
}
}
leaf optional {
description
"If present, then prompt for leafs that are optional.
If not, skip these objects.";
type empty;
}
anyxml value {
description
"Contains a string representing the content
to use for the filled variable.
If a string is entered, then the target value being
filled must be a leaf or leaf-list.
If a variable is referenced, then it will
be used as the content, if the target value being
filled is a leaf or a leaf-list.
If the target value is a complex object,
then the referenced variable must also be
a complex object of the same type. E.g.,
The global variable 'foo' would be specified as:
value=$$foo
The local variable 'bar' would be specified as:
value=$bar
An error will be reported if the global or local
variable does not reference the same object type
as the target parameter.";
}
uses MatchParms {
description
"These parameters are ignored unless the
'urltarget' parameter is also present.";
}
}
grouping CommonPduParms {
description
"Common parms for some local commands that
generate NETCONF PDUs";
choice from {
mandatory true;
leaf varref {
description
"Use the contents of the specified variable
as the content";
type string;
}
case from-cli {
uses FillParms;
}
}
}
grouping EditParms {
description
"Common parms for create, merge, replace commands";
uses CommonPduParms;
leaf timeout {
description "Timeout to use";
type nt:Timeout;
}
}
grouping SGetParms {
description
"Common parms for sget and sget-config operations.";
leaf nofill {
description
"If present, and the 'from-cli' option is used
for input, then filling of mandatory nodes
and key leafs will be skipped. Instead, the target
object will be treated as a terminating select node
in the filter element.";
type empty;
}
uses ncxapp:CliWithDefaultsParm;
}
grouping XGetParms {
description
"Common parms for xget and xget-config operations.";
choice from {
mandatory true;
leaf varref {
description
"Use the contents of the specified variable
as the content";
type string;
}
leaf select {
description
"The XPath expression to use in the retrieval
operation. The string may only contain
single quotes, which are required for
string literals. The entire string
will be inserted into a double-quoted
string, within the get-config PDU.
Character entities will be inserted as
needed to maintain well-formed XML.";
type string { length "1..max"; }
ncx:xpath;
}
leaf urltarget {
description
"The URL path expression to use in the retrieval
operation.";
type UrlPath;
}
}
leaf timeout {
description "Timeout to use";
type nt:Timeout;
}
uses ncxapp:CliWithDefaultsParm;
uses MatchParms {
description
"These parameters are ignored unless the
'urltarget' parameter is also present.";
}
}
grouping ConnectParms {
description
"Common parms for connecting to a NETCONF server.
Used by the connect operation and if present at
the command line invocation, then the connect
operation will be invoked automatically.";
leaf user {
description
"User name to use for NETCONF sessions.";
type nt:NcxUserName;
}
leaf server {
description
"IP address or DNS name of the NETCONF server target.";
type string;
}
leaf password {
description
"User password to use for NETCONF sessions.
If none, then user will be prompted before connecting.";
type string;
ncx:password;
}
leaf ncport {
description
"NETCONF port number to use. If not present, then
port 830, followed by port 22, will be tried.";
type uint16 {
range "1..max";
}
default 830;
}
leaf timeout {
description
"Number of seconds to wait for a response
from the server before declaring a timeout.
Zero means do not timeout at all.";
type nt:Timeout;
}
leaf public-key {
type string {
length "1 .. max";
}
description
"Contains the file path specification
for the file containing the client-side public key.
If both 'public-key' and 'private-key' files are
present, the client will attempt to connect
to the server using these keys. If this fails,
or not done, then password authentication will
be attempted.";
default "$HOME/.ssh/id_rsa.pub";
}
leaf private-key {
type string {
length "1 .. max";
}
description
"Contains the file path specification
for the file containing the client-side private key.
If both 'public-key' and 'private-key' files are
present, the client will attempt to connect
to the server using these keys. If this fails,
or not done, then password authentication will
be attempted.";
default "$HOME/.ssh/id_rsa";
}
uses ncxapp:ProtocolsParm;
leaf transport {
description
"Identifies the transport protocol that should be used.";
type enumeration {
enum ssh {
description
"NETCONF over SSH.";
reference
"RFC 4742; RFC 6242";
}
enum tcp {
description
"NETCONF over TCP.
If this enum is selected, then the default --ncport
value is set to 2023, and the --protocols value
is set to netconf1.0. The --password value will
be ignored.";
reference
"tail-f confd";
}
}
default ssh;
}
leaf tcp-direct-enable {
description
"When --transport=tcp enables use of ncx-connect message
instead of the default tail-f custom message.
Set this parameter to true to establish direct
connection to netconfd.";
type boolean;
default false;
}
}
grouping XPathParms {
description
"Common parameters used for XPath script constructs";
leaf expr {
description
"XPath expression string to evaluate.
Use quotes if there are any whitespace or
special characters in the expression.";
type yang:xpath1.0 {
length "1..max";
}
mandatory true;
}
anyxml docroot {
description
"Use the contents of the specified variable or
external XML file as the conceptual document to
apply the expression specified in the 'expr' parameter.
If this parameter is missing then a dummy document
will be used. This is only allowed if the
expression only contains variable references
or numeric/string constants.";
}
}
/*************************************************************
*
* CLI parameter set for yangcli program
*
*************************************************************/
container yangcli {
ncx:cli;
description
"CLI Parameter Set for the NETCONF Client Application.";
uses ncxapp:NcxAppCommon;
uses ncxapp:ConfigParm;
uses ncxapp:YumaHomeParm;
uses ncxapp:CommonFeatureParms;
uses ncxapp:SubdirsParm;
uses ncxapp:HomeParm;
uses ConnectParms;
uses MatchParms {
refine match-names {
default one-nocase;
}
refine alt-names {
default true;
}
}
leaf aliases-file {
description
"Specifies the yangcli command aliases file to use.";
type string;
default "~/.yuma/.yangcli_aliases";
}
leaf autocomp {
description
"Controls whether partial keywords will be
checked for interactive or script commands.
By default, the first match for a partial keyword
will be used if no definition is found for
a command name or parameter name.";
type boolean;
default true;
}
leaf autoaliases {
description
"Controls whether the yangcli command aliases will
be saved at exit and loaded at startup.
If true, the 'aliases-file' parameter will be used if it is set,
or else the default aliases file will be used
(~/.yuma/.yangcli_aliases), for loading
and saving the yangcli command aliases.
If false, the yangcli command aliases will only be stored
and loaded manually with the aliases command.";
type boolean;
default true;
}
leaf autoload {
description
"Controls whether any modules (except this one)
will be automatically loaded upon startup or
upon session startup with a server. If false,
the 'mgrload' command must be used to
explicitly load all the desired YANG modules.";
type boolean;
default true;
}
leaf autohistory {
description
"Controls whether the command line history buffer will
be saved at exit and loaded at startup.
If true, the default history file will be used
(~/.yuma/.yangcli_history) for loading
and saving the history buffer.
If false, the history buffer will only be stored
and loaded manually with the history command.";
type boolean;
default true;
}
leaf autouservars {
description
"Controls whether the yangcli user variables will
be saved at exit and loaded at startup.
If true, the 'uservars-file' parameter will be used if set,
or else the default user variables file will be used
(~/.yuma/yangcli_uservars.xml), for loading
and saving the yangcli user variables.
If false, the yangcli user variables will only be stored
and loaded manually with the uservars command.";
type boolean;
default true;
}
leaf bad-data {
description
"Specifies how invalid user input from the CLI
will be handled when filling PDUs for remote
operations.";
type enumeration {
enum ignore {
description
"Silently accept invalid PDU and data model
parameters. Intended for advanced server
testing mode only.";
}
enum warn {
description
"Warn, but accept invalid PDU and data model
parameters.";
}
enum check {
description
"Prompt the user to keep the invalid value
or re-enter the value.";
}
enum error {
description
"Prompt the user to re-enter the invalid value.";
}
}
default "check";
}
leaf batch-mode {
description
"If present, the interactive CLI will not be used.
A script should be provided with the 'run-script'
parameter, or a command provided with the 'run-command'
parameter, or else the program will simply exit.
If the auto-connect mode is enabled, then this will mode
simply test if a NETCONF session can be established,
then exit.";
type empty;
}
leaf default-module {
description
"Default module name string to use before 'netconf'
and 'yangcli' are tried. The module prefix may need to be
used for other modules.";
type nt:NcxName;
}
leaf display-mode {
description
"Controls how values are displayed during output
to STDOUT or a log file.";
type enumeration {
enum plain {
description
"Plain identifier without any prefix format.";
}
enum prefix {
description
"Plain text with XML prefix added format.";
}
enum module {
description
"Plain text with module name as prefix added format.";
}
enum xml {
description
"XML format.";
}
enum xml-nons {
description
"XML format, but no namespace (xmlns) attributes
will be generated.";
}
enum json {
description
"JSON format.";
}
}
default plain;
}
leaf echo-replies {
description
"Allow RPC replies to be echoes to the log or STDOUT
If 'true', <rpc-reply> messages containing data
will be output to the log, if log-level is
'info' or higher.
If 'false', <rpc-reply> messages containing data
will not be output to the log, regardless of
the value of log-level.
The $$echo-replies system variable is derived from
this parameter.";
type boolean;
default true;
}
leaf fixorder {
description
"Controls whether PDU parameters will be
automatically sent to the server in the
correct order. If false, the specified order
will be used. If true, then canonical order will
be used";
type boolean;
default true;
}
leaf force-target {
description
"Controls whether the candidate or running
configuration datastore will be used as
the default edit target, when both are supported
by the server.";
type enumeration {
enum candidate {
description
"Force default edit target to be candidate.";
}
enum running {
description
"Force default edit target to be running.";
}
}
default candidate;
}
uses ncxapp:ModuleParm;
uses ncxapp:DeviationParm;
uses ncxapp:DatapathParm;
uses ncxapp:RunpathParm;
choice run-startup-mode {
leaf run-script {
description
"The specified script will be invoked upon startup.
If the auto-connect parameters are provided, then
a session will be established before running the
script. If a quoted string is used, then any parameters
after the script name will be passed to the script.";
type string {
length "1 .. 4095";
}
}
leaf run-command {
description
"The specified command will be invoked upon startup.
If the auto-connect parameters are provided, then
a session will be established before running the
command.";
type string {
length "1 .. 4095";
}
}
}
leaf time-rpcs {
description
"Measure the round-trip time of each <rpc> request and
<rpc-reply> at the session level.
Echo the elapsed time value to screen if in
interactive mode, as well as the log if the
log is a file instead of stdout.
The $$time-rpcs system variable is derived from this
parameter.";
type boolean;
default false;
}
leaf uservars-file {
description
"Specifies the yangcli user variables file to use.";
type string;
default "~/.yuma/yangcli_uservars.xml";
}
leaf use-xmlheader {
description
"Specifies how file result variables will be written
for XML files. Controls whether the XML preamble
header will be written or not.";
type boolean;
default true;
}
}
/*************************************************************
*
* RPC methods for local commands within yangcli
*
*************************************************************/
rpc alias {
description
"Show or set a specific yangcli command alias.
* Show all aliases in memory (same as aliases):
yangcli> alias
* Show one alias 'foo':
yangcli> alias foo
* Set one alias; make sure there is no whitespace
between the '=' char and either string. If the value
has whitespace, it must be quoted. If the equals sign
is present, then a valid value string must be present.
Quotes will be preserved if used:
* Single quotes can appear within doubled-quoted
strings but not any double quotes.
* Double quotes can appear within single-quoted strings
but not any single quotes.
The first token in a plain command or the first token
in the right-hand-side expression in an assignment
statement can be an alias.
The alias name must exact match the token.
A new command line will be constructed replacing
the alias name with its value. The new command
line will then be parsed as usual.
yangcli> alias s=show
yangcli> alias getfoo='sget-config source=running /top/foo'
* Aliases can override real commands, so be careful
not to unintentionally alter real commands.
yangcli> alias get-config='get-config source=running'
";
input {
ncx:default-parm var;
ncx:default-parm-equals-ok;
leaf var {
description "The alias command string.";
type string { length "1 .. max"; }
}
}
}
rpc aliases {
description "Manage the yangcli command aliases";
input {
choice alias-action {
default show;
leaf show {
description
"Show all the yangcli command aliases.";
type empty;
}
leaf clear {
description
"Delete all the yangcli aliases from memory.";
type empty;
}
leaf load {
description
"Load the yangcli command aliases from the
specified file spec. The default aliases
file will be loaded automatically at startup
if the '--autoaliases' parameter is present.";
type string;
default "~/.yuma/.yangcli_aliases";
}
leaf save {
description
"Save the yangcli command aliases to the
specified filespec. The default aliases
file will be saved automatically at shutdown
if the '--autoaliases' parameter is present.";
type string;
default "~/.yuma/.yangcli_aliases";
}
}
}
}
rpc cd {
description "Change the current working directory.";
input {
ncx:default-parm dir;
leaf dir {
description "Directory path to use.";
type string;
mandatory true;
}
}
}
rpc connect {
description "Connect to a NETCONF server.";
input {
ncx:default-parm server;
uses ConnectParms {
refine user {
mandatory true;
}
refine server {
mandatory true;
}
refine password {
mandatory true;
}
}
}
}
rpc create {
description
"Create some NETCONF config data with the edit-config operation";
input {
ncx:default-parm target;
uses EditParms;
}
}
rpc delete {
description
"Delete some NETCONF config data with the edit-config operation";
input {
ncx:default-parm target;
choice delete-target {
mandatory true;
leaf target {
description
"Xpath expression indicating the node which is going
to be deleted.";
type string;
}
leaf urltarget {
description
"The URL path expression to use in the delete
operation.";
type UrlPath;
}
}
}
}
rpc elif {
description
"Evaluate an XPath expression locally on the manager.
and execute the block of commands that follow
if the expression is true. The block ends
when a matching 'elif', 'else', or 'end' command is reached.
This may only be used after an 'if' or 'elif' command
or an error (no matching if command) will occur.
";
input {
ncx:default-parm expr;
uses XPathParms;
}
}
rpc else {
description
"End an 'if' or 'elif' command block, and start a new
command block that must end with an 'end' command.
If no 'if' or 'elif' block is in progress then an error
will occur.
";
}
rpc end {
description
"End an 'if' command block or a 'while' command block.
If no block is in progress then an error will occur.
";
}
rpc eval {
description
"Evaluate an XPath expression locally on the manager.
All local variables will be available to the session
context, in the following precedence:
1) current script run level
2) global variable
When the result of an eval command is saved
to a user variable, it may be altered as follows:
Convert to string:
- <data> is a simple type
- <data> contains 1 node that is a simple type
Remove the <data> container:
- <data> contains a single complex element
Retain the <data> container:
- <data> contains multiple elements
Usage Examples:
> $x = 5
x = '5'
> $x = eval '$x + 10'
x = '15'
> $y = xget /system
y = data {
system { ... }
}
> $z = eval '//sysname' docroot=$y
z = 'Linux'
> $w = eval '/system/uname' docroot=$y
w = uname {
sysname 'Linux'
...
}
";
input {
ncx:default-parm expr;
uses XPathParms;
}
output {
anyxml data {
description
"The XPath result, returned in a data element.
The content will be a simple string for boolean, string,
and number result types.
The content will be zero or more child elements,
in their proper namespaces, if the result is a node-set.
Only the requested node(s) will be returned,
not their entire path to the document root,
like the get and get-config operations.
An empty 'data' element will be returned if the result
is an empty node-set.";
mandatory true;
}
}
}
rpc eventlog {
description "Access the notification event log";
input {
ncx:default-parm show;
choice eventlog-action {
default show-case;
case show-case {
leaf show {
description
"Show the specified number of event log
buffer entries. -1 means show all entries.
If the --full or --brief help-mode parameters
are entered, then the output will be altered.";
type LogCount;
default -1;
}
leaf start {
description
"Start at the specified event index number instead of
the beginning of the event log.";
type LogIndex;
}
uses ncxapp:HelpMode;
}
leaf clear {
description
"Clear the specified number of notification
event log entries. The value zero means
clear all the entries.";
type LogCount;
default 25;
}
}
}
}
rpc fill {
description
"Fill a value for reuse in a NETCONF PDU or other operation.
Used in an assignment statement to create a variable
for later use:
$foo = fill --target=/t:foo-con/bar-list \
--optional \
--current-value=$bar ";
input {
ncx:default-parm target;
uses FillParms;
}
output {
anyxml data {
description
"The result of the fill operation.
The name of the value node may not really
be 'data'. If the 'target' or 'current-value'
input parameters are used, then the name
of the result node will be copied instead.
The data type will be inherited from the 'target'
or 'current_value' parameters, and not really be
an 'anyxml' structure. YANG does have a data
type that supports this feature.";
}
}
}
rpc get-locks {
description
"Get a lock for the running configuration
and the candidate and startup configurations,
if needed. If all the locks cannot be obtained,
then release all of them (all-or-nothing).
The entire operation must be completed within
the lock timeout interval, if it is set.";
input {
leaf lock-timeout {
description
"Total time to wait to retrieve all the locks needed
to complete the get-locks command. A value of zero
means to wait forever and not use a timeout value.";
type nt:Timeout;
default 120;
}
leaf retry-interval {
description
"Retry interval to use if a lock is temporarily
unavailable. The client will wait this number of
seconds before attempting to get the current lock.";
units seconds;
type uint32 { range "1 .. 300"; }
default 2;
}
leaf cleanup {
description
"Indicates whether the locks obtained should be
automatically released if an RPC operation
fails (after the get-locks succeeds).";
type boolean;
default true;
}
}
}
rpc help {
description "Print the yangcli help text";
input {
ncx:default-parm command;
choice helptype {
leaf command {
description "Show help for the specified command,
also called an RPC method";
type nt:NcxIdentifier;
}
leaf commands {
description "Show info for all local commands";
type empty;
}
leaf notification {
description "Show help for the specified notification";
type nt:NcxIdentifier;
}
leaf object {
description "Show help for the specified object";
type union {
type nt:NcxIdentifier;
type UrlPath;
}
}
leaf type {
description "Show help for the specified type";
type nt:NcxIdentifier;
}
}
uses ncxapp:HelpMode;
}
}
rpc history {
description "Access the command line history buffer";
input {
ncx:default-parm show;
choice history-action {
default show-case;
case show-case {
leaf show {
description
"Show the specified number of history
buffer entries. -1 means show all entries.";
type LogCount;
default 25;
}
uses ncxapp:HelpMode;
}
leaf clear {
description
"Clear all the history buffer entries.";
type empty;
}
leaf load {
description
"Load the command history buffer from the
specified file spec.";
type string;
default "~/.yuma/.yangcli_history";
}
leaf save {
description
"Save the command history buffer in the
specified filespec.";
type string;
default "~/.yuma/.yangcli_history";
}
}
}
}
rpc if {
description
"Evaluate an XPath expression locally on the manager.
and execute the block of commands that follow
if the expression is true. The block ends
when a matching 'elif', 'else', or 'end' command is reached.
";
input {
ncx:default-parm expr;
uses XPathParms;
}
}
rpc insert {
description
"Insert some NETCONF config data with the edit-config operation";
input {
ncx:default-parm target;
uses EditParms;
leaf order {
description
"The insert order that should be used.
If the values 'before' or 'after' are selected,
then the edit-target parameter must also be present.";
type enumeration {
enum first;
enum last;
enum before;
enum after;
}
default last;
}
leaf operation {
description "The edit-config operation that should be used.";
type enumeration {
enum create;
enum merge;
enum replace;
}
default merge;
}
leaf edit-target {
description
"The value or key clause that should be used.
This parameter should only be present if the
order selected is 'before' or 'after'.
For a leaf-list, the edit-target contains the
value of the target leaf-list node within the
configuration being edited. The new config
will be inserted before or after this leaf-list
node, depending on the order selected.
E.g., edit-target='some leaf content'.
For a list, the edit-target contains the
key values of the target list node within the
configuration being edited. The new config
will be inserted before or after this list
node, depending on the order selected.
E.g., edit-target=[name='fred'][zipcode=90210].";
type string;
}
}
}
rpc list {
description "List some NETCONF info.";
input {
choice listtype {
mandatory true;
leaf commands {
description "List all local and remote commands";
type empty;
}
leaf files {
description
"List all available data files.";
type empty;
}
leaf objects {
description "List all available top-level object names.";
type empty;
}
leaf oids {
description "List all available object identifiers.";
type empty;
}
leaf modules {
description
"List all available local YANG files.";
type empty;
}
leaf scripts {
description
"List all available script files.";
type empty;
}
}
leaf module {
description "List only from this module, if specified.";
type nt:NcxIdentifier;
}
uses ncxapp:HelpMode;
}
}
rpc log-error {
description
"Write a message to the output log if the log-level
is greater or equal to 'error'.";
input {
ncx:default-parm msg;
leaf msg {
description
"The formatted text string to write to the log.";
type string;
mandatory true;
}
}
}
rpc log-warn {
description
"Write a message to the output log if the log-level
is greater or equal to 'warn'.";
input {
ncx:default-parm msg;
leaf msg {
description
"The formatted text string to write to the log.";
type string;
mandatory true;
}
}
}
rpc log-info {
description
"Write a message to the output log if the log-level
is greater or equal to 'info'.";
input {
ncx:default-parm msg;
leaf msg {
description
"The formatted text string to write to the log.";
type string;
mandatory true;
}
}
}
rpc log-debug {
description
"Write a message to the output log if the log-level
is greater or equal to 'debug'.";
input {
ncx:default-parm msg;
leaf msg {
description
"The formatted text string to write to the log.";
type string;
mandatory true;
}
}
}
rpc merge {
description
"Merge some NETCONF config data with the edit-config operation";
input {
ncx:default-parm target;
uses EditParms;
}
}
rpc mgrload {
description
"Load a module or other file into the client.
Use the 'load' command to load a module into
the server.";
input {
ncx:default-parm module;
leaf module {
description
"Module name to load";
type nt:NcxName;
mandatory true;
}
leaf revision {
description
"Module revision to load.";
type nt:Date;
}
uses ncxapp:DeviationParm;
}
}
rpc pwd {
description "Print the current working directory.";
}
rpc replace {
description
"Create some NETCONF config data with the edit-config operation";
input {
ncx:default-parm target;
uses EditParms;
}
}
rpc quit {
description "Quit the yangcli application";
}
rpc recall {
description
"Recall the specified command line history
buffer entry into the current command line.";
input {
ncx:default-parm index;
leaf index {
description
"Index [0..N] of the command line
history entry to recall.";
type LogIndex;
mandatory true;
}
}
}
rpc release-locks {
description
"Unlock all the server databases that were
previously locked with the get-locks command.";
}
rpc remove {
description
"Remove some NETCONF config data with the edit-config operation";
input {
ncx:default-parm target;
leaf target {
description
"Xpath expression indicating the node which is going
to be deleted.";
type string;
mandatory true;
}
}
}
rpc run {
description "Internal command to run a script.";
input {
ncx:default-parm script;
leaf script {
description "script filespec to run";
type string;
mandatory true;
}
// hardwired parameter names required at this time
// just allow 9 parameter/value pairs
// P0 is reserved for the name of the called script
leaf P1 {
description "script parameter $1";
type string;
}
leaf P2 {
description "script parameter $2";
type string;
}
leaf P3 {
description "script parameter $3";
type string;
}
leaf P4 {
description "script parameter $4";
type string;
}
leaf P5 {
description "script parameter $5";
type string;
}
leaf P6 {
description "script parameter $6";
type string;
}
leaf P7 {
description "script parameter $7";
type string;
}
leaf P8 {
description "script parameter $8";
type string;
}
leaf P9 {
description "script parameter $9";
type string;
}
}
}
rpc save {
description "Meta command to save configuration edits.";
}
rpc sget {
description
"Get some NETCONF running config or state data with the get
operation, using an optional subtree filter.";
input {
ncx:default-parm target;
uses CommonPduParms;
uses SGetParms;
}
output {
anyxml data {
description
"The data resulting from the retrieval operation.";
}
}
}
rpc sget-config {
description
"Get some NETCONF config data with the get-config
operation, using an optional subtree filter.";
input {
ncx:default-parm target;
uses CommonPduParms;
uses SGetParms;
container source {
description "Particular configuration to retrieve.";
choice config-source {
mandatory true;
leaf candidate {
if-feature nc:candidate;
description
"Only available if 'candidate' capability supported.";
type empty;
}
leaf running {
type empty;
}
leaf startup {
if-feature nc:startup;
description
"Only available if 'startup' capability supported.";
type empty;
}
leaf url {
if-feature nc:url;
description
"URL pointing to config data. Only available
if 'url' capability supported.";
type nct:ConfigURIType;
}
}
}
}
output {
anyxml data {
description
"The data resulting from the retrieval operation.";
}
}
}
rpc show {
description
"Local show command for yangcli session info.";
input {
choice showtype {
mandatory true;
leaf cli {
description
"Show the yangcli CLI parameters.";
type empty;
}
leaf module {
description
"Show full info for one module loaded
within the current session.";
type nt:NcxIdentifier;
}
leaf modules {
description
"Show info for all modules loaded within the
current session.";
type empty;
}
leaf local {
description
"Show info for one local user variable.";
type nt:NcxName;
}
leaf locals {
description
"Show info for all local user variables.";
type empty;
}
leaf global {
description
"Show full info for one global user variable.";
type nt:NcxName;
}
leaf globals {
description
"Show info for all global user variables.";
type empty;
}
leaf objects {
description
"Show config database objects loaded within the
current session.";
type empty;
}
leaf session {
description
"Show the current session info, including the initial
server capabilities for the session.";
type empty;
}
leaf system {
description
"Show the read-only system environment variables
and the read-write yangcli program variables.";
type empty;
}
leaf var {
description
"Show info for one local or global variable.";
type nt:NcxName;
}
leaf vars {
description
"Show truncated info for all program variables";
type empty;
}
leaf version {
description
"Show yangcli version info.";
type empty;
}
}
uses ncxapp:HelpMode;
}
}
rpc start-timer {
description
"Start a timer to do simple performance measurements.";
input {
ncx:default-parm id;
leaf id {
description
"The timer ID to use.";
type TimerId;
default 0;
}
leaf restart-ok {
description
"Indicates whether the timer will be used if
it is already running. If 'true', the timer
will be restarted if it is already running.
If 'false', an error will occur if the timer
is already running.";
type boolean;
default true;
}
}
}
rpc stop-timer {
description
"Stop a timer and output the delta value.";
input {
ncx:default-parm id;
leaf id {
description
"The timer ID to use.";
type TimerId;
default 0;
}
leaf echo {
description
"Echo the elapsed time value to screen if in
interactive mode, as well as the log if the
log is a file instead of stdout.";
type boolean;
default true;
}
}
output {
// yangcli local RPC commands can return 1 value of any type
// as an output parameter. No extra parameters will be
// processed in assignment statements
leaf delta {
description
"The elapsed time since the timer started.";
type decimal64 {
fraction-digits 6; // microseconds
}
units seconds;
}
}
}
rpc while {
description
"Evaluate an XPath expression locally on the manager.
and execute the block of commands that follow
while the expression is true. The block ends
when a matching 'end' command is reached.
";
input {
ncx:default-parm expr;
uses XPathParms;
leaf maxloops {
description
"Set a maximum number of loops that can be
iterated for this while command.
The value zero means that no maximum will be
enforced. Use this mode with caution.";
type uint32;
default 65535;
}
}
}
rpc xget {
description
"Get some NETCONF running config or state data with the get
operation, using an optional XPath filter.";
input {
ncx:default-parm select;
uses XGetParms;
}
output {
anyxml data {
description
"The data resulting from the retrieval operation.";
}
}
}
rpc xget-config {
description
"Get some NETCONF config data with the get-config
operation, using an optional XPath filter.";
input {
ncx:default-parm select;
uses XGetParms;
container source {
description "Particular configuration to retrieve.";
choice config-source {
mandatory true;
leaf candidate {
if-feature nc:candidate;
description
"Only available if 'candidate' capability supported.";
type empty;
}
leaf running {
type empty;
}
leaf startup {
if-feature nc:startup;
description
"Only available if 'startup' capability supported.";
type empty;
}
leaf url {
if-feature nc:url;
description
"URL pointing to config data. Only available
if 'url' capability supported.";
type nct:ConfigURIType;
}
}
}
}
output {
anyxml data {
description
"The data resulting from the retrieval operation.";
}
}
}
rpc unset {
description
"Delete a specific yangcli command alias.
* Delete one alias 'foo':
yangcli> unset foo
";
input {
leaf name {
description
"Name of the yangcli command alias to delete.";
type nt:NcxName;
mandatory true;
}
}
}
rpc uservars {
description "Manage the yangcli user variables";
input {
choice uservars-action {
mandatory true;
leaf clear {
description
"Delete all the yangcli user variables from memory.";
type empty;
}
leaf load {
description
"Load the yangcli user variables from the
specified XML file spec. The default user variables
file will be loaded automatically at startup
if the '--autouservars' parameter is present.
The container 'vars' data structure represents
the format of the XML file expected.";
type string;
default "~/.yuma/yangcli_uservars.xml";
}
leaf save {
description
"Save the yangcli user variables to the
specified filespec. The default user variables
file will be saved automatically at shutdown
if the '--autouservars' parameter is present.
The container 'vars' data structure represents
the format of the XML file that will be written.";
type string;
default "~/.yuma/yangcli_uservars.xml";
}
}
}
}
container vars {
description
"Represents all saved yangcli user variables";
list var {
description
"Data structure to save one yangcli user variable";
key name;
leaf name {
type nt:NcxName;
description "Name of the user variable";
}
leaf target {
//need to treat as string in case referenced modules
//are not loaded when yangcli starts
//ncx:schema-instance;
type string;
description
"Target variable if variable represents a node
from a datastore.";
}
leaf vartype {
type YangcliVariableType;
description
"User variable type; only 'global' variables can
be saved in the yangcli uservars file.";
default global;
}
anyxml value {
description
"Node value renamed to 'value' since YANG requires
each node to have a consistent name.";
}
}
}
}
|