aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 1 | source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}] |
| 2 | |
aPiecek | 768ee47 | 2023-03-30 11:19:42 +0200 | [diff] [blame] | 3 | set ipv6_path "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address" |
| 4 | |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 5 | test print_yang {} { |
| 6 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 7 | ly_cmd "load modleaf" |
| 8 | ly_cmd "print -f yang modleaf" "leaf lfl" |
| 9 | }} |
| 10 | |
aPiecek | 60a517a | 2023-03-31 11:06:42 +0200 | [diff] [blame] | 11 | test print_yang_submodule {Print submodule in yang format} { |
| 12 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 13 | ly_cmd "load modinclude" |
| 14 | ly_cmd "print -f yang modsub" "submodule modsub" |
| 15 | }} |
| 16 | |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 17 | test print_yin {} { |
| 18 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 19 | ly_cmd "load modleaf" |
| 20 | ly_cmd "print -f yin modleaf" "<leaf name=\"lfl\">" |
| 21 | }} |
| 22 | |
aPiecek | 60a517a | 2023-03-31 11:06:42 +0200 | [diff] [blame] | 23 | test print_yin_submodule {Print submodule in yin format} { |
| 24 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 25 | ly_cmd "load modinclude" |
| 26 | ly_cmd "print -f yin modsub" "<submodule name=\"modsub\"" |
| 27 | }} |
| 28 | |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 29 | test print_info {} { |
| 30 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 31 | ly_cmd "load modleaf" |
| 32 | ly_cmd "print -f info modleaf" "status current" |
| 33 | }} |
| 34 | |
aPiecek | 768ee47 | 2023-03-30 11:19:42 +0200 | [diff] [blame] | 35 | test print_info_path {Print subtree in info format} { |
| 36 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 37 | ly_cmd "load ietf-ip" |
| 38 | ly_cmd "print -f info -P $ipv6_path" "^list address .* leaf prefix-length" |
| 39 | }} |
| 40 | |
| 41 | test print_info_path_single_node {Print node in info format} { |
| 42 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 43 | ly_cmd "load ietf-ip" |
| 44 | ly_cmd "print -f info -q -P $ipv6_path" "^list address .* IPv6 addresses on the interface.\";\r\n\}$" |
| 45 | }} |
| 46 | |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 47 | test print_tree {} { |
| 48 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 49 | ly_cmd "load modleaf" |
| 50 | ly_cmd "print -f tree modleaf" "\\+--rw lfl" |
| 51 | }} |
| 52 | |
aPiecek | 60a517a | 2023-03-31 11:06:42 +0200 | [diff] [blame] | 53 | test print_tree_submodule {Print submodule in tree format} { |
| 54 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 55 | ly_cmd "load modinclude" |
| 56 | ly_cmd "print -f tree modsub" "submodule: modsub" |
| 57 | }} |
| 58 | |
aPiecek | 768ee47 | 2023-03-30 11:19:42 +0200 | [diff] [blame] | 59 | test print_tree_path {Print subtree in tree format} { |
| 60 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 61 | ly_cmd "load ietf-ip" |
| 62 | ly_cmd "print -f tree -P $ipv6_path" "\\+--rw address.*\\+--rw prefix-length" |
| 63 | }} |
| 64 | |
| 65 | test print_tree_path_single_node {Print node in tree format} { |
| 66 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 67 | ly_cmd "load ietf-ip" |
| 68 | ly_cmd "print -f tree -q -P $ipv6_path" "\\+--rw address\\* \\\[ip\\\]$" |
| 69 | }} |
| 70 | |
aPiecek | 146fd19 | 2023-03-30 11:22:16 +0200 | [diff] [blame] | 71 | test print_tree_path_single_node_line_length {Print node in the tree format and limit row size} { |
| 72 | -setup $ly_setup -cleanup $ly_cleanup -body { |
| 73 | ly_cmd "load ietf-ip" |
| 74 | ly_cmd "print -f tree -L 20 -q -P $ipv6_path" "\\+--rw address\\*\r\n *\\\[ip\\\]$" |
| 75 | }} |
| 76 | |
aPiecek | 05c7595 | 2023-03-29 09:09:44 +0200 | [diff] [blame] | 77 | cleanupTests |