blob: 8b9d7404f13df076012a8f5de84a193747f0a1f7 [file] [log] [blame]
aPiecek05c75952023-03-29 09:09:44 +02001source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
2
aPiecek768ee472023-03-30 11:19:42 +02003set ipv6_path "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address"
4
aPiecek05c75952023-03-29 09:09:44 +02005test 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
aPiecek60a517a2023-03-31 11:06:42 +020011test 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
aPiecek05c75952023-03-29 09:09:44 +020017test 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
aPiecek60a517a2023-03-31 11:06:42 +020023test 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
aPiecek05c75952023-03-29 09:09:44 +020029test 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
aPiecek768ee472023-03-30 11:19:42 +020035test 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
41test 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
aPiecek05c75952023-03-29 09:09:44 +020047test 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
aPiecek60a517a2023-03-31 11:06:42 +020053test 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
aPiecek768ee472023-03-30 11:19:42 +020059test 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
65test 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
aPiecek146fd192023-03-30 11:22:16 +020071test 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
aPiecek05c75952023-03-29 09:09:44 +020077cleanupTests