aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}] |
| 2 | |
| 3 | set mdir $::env(YANG_MODULES_DIR) |
aPiecek | 768ee47 | 2023-03-30 11:19:42 +0200 | [diff] [blame] | 4 | set ipv6_path "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address" |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 5 | |
| 6 | test format_yang {} { |
| 7 | ly_cmd "-f yang $mdir/modleaf.yang" "leaf lfl" |
| 8 | } {} |
| 9 | |
aPiecek | 60a517a | 2023-03-31 11:06:42 +0200 | [diff] [blame] | 10 | test format_yang_submodule {Print submodule in yang format} { |
| 11 | ly_cmd "-s modsub -f yang $mdir/modinclude.yang" "submodule modsub" |
| 12 | } {} |
| 13 | |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 14 | test format_yin {} { |
| 15 | ly_cmd "-f yin $mdir/modleaf.yang" "<leaf name=\"lfl\">" |
| 16 | } {} |
| 17 | |
aPiecek | 60a517a | 2023-03-31 11:06:42 +0200 | [diff] [blame] | 18 | test format_yin_submodule {Print submodule in yin format} { |
| 19 | ly_cmd "-s modsub -f yin $mdir/modinclude.yang" "<submodule name=\"modsub\"" |
| 20 | } {} |
| 21 | |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 22 | test format_info {} { |
| 23 | ly_cmd "-f info $mdir/modleaf.yang" "status current" |
| 24 | } {} |
| 25 | |
| 26 | test format_tree {} { |
| 27 | ly_cmd "-f tree $mdir/modleaf.yang" "\\+--rw lfl" |
| 28 | } {} |
| 29 | |
aPiecek | 60a517a | 2023-03-31 11:06:42 +0200 | [diff] [blame] | 30 | test format_tree_submodule {Print submodule in tree format} { |
| 31 | ly_cmd "-s modsub -f tree $mdir/modinclude.yang" "submodule: modsub" |
| 32 | } {} |
| 33 | |
aPiecek | 768ee47 | 2023-03-30 11:19:42 +0200 | [diff] [blame] | 34 | test format_tree_path {Print subtree in tree format} { |
| 35 | ly_cmd "-f tree -P $ipv6_path $mdir/ietf-ip.yang" "\\+--rw address.*\\+--rw prefix-length" |
| 36 | } {} |
| 37 | |
| 38 | test format_tree_path_single_node {Print node in tree format} { |
| 39 | ly_cmd "-f tree -q -P $ipv6_path $mdir/ietf-ip.yang" "\\+--rw address\\* \\\[ip\\\]$" |
| 40 | } {} |
| 41 | |
aPiecek | 146fd19 | 2023-03-30 11:22:16 +0200 | [diff] [blame] | 42 | test format_tree_path_single_node_line_length {Print node in the tree format and limit row size} { |
| 43 | ly_cmd "-f tree -L 20 -q -P $ipv6_path $mdir/ietf-ip.yang" "\\+--rw address\\*\n *\\\[ip\\\]$" |
| 44 | } {} |
| 45 | |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 46 | test format_feature_param_one_module {Show features for one module} { |
| 47 | ly_cmd "-f feature-param $mdir/ietf-ip.yang" " -F ietf-ip:ipv4-non-contiguous-netmasks,ipv6-privacy-autoconf" -ex |
| 48 | } {} |
| 49 | |
| 50 | test format_feature_param_more_modules {Show a mix of modules with and without features} { |
| 51 | |
| 52 | set features " -F modfeature:ftr1,ftr2\ |
| 53 | -F modleaf:\ |
| 54 | -F ietf-ip:ipv4-non-contiguous-netmasks,ipv6-privacy-autoconf" |
| 55 | |
| 56 | ly_cmd "-f feature-param $mdir/modfeature.yang $mdir/modleaf.yang $mdir/ietf-ip.yang" $features -ex |
| 57 | } {} |
| 58 | |
| 59 | cleanupTests |