blob: eb368352cf7d79d5825df08f3a2966a690d96579 [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
11test print_yin {} {
12-setup $ly_setup -cleanup $ly_cleanup -body {
13 ly_cmd "load modleaf"
14 ly_cmd "print -f yin modleaf" "<leaf name=\"lfl\">"
15}}
16
17test print_info {} {
18-setup $ly_setup -cleanup $ly_cleanup -body {
19 ly_cmd "load modleaf"
20 ly_cmd "print -f info modleaf" "status current"
21}}
22
aPiecek768ee472023-03-30 11:19:42 +020023test print_info_path {Print subtree in info format} {
24-setup $ly_setup -cleanup $ly_cleanup -body {
25 ly_cmd "load ietf-ip"
26 ly_cmd "print -f info -P $ipv6_path" "^list address .* leaf prefix-length"
27}}
28
29test print_info_path_single_node {Print node in info format} {
30-setup $ly_setup -cleanup $ly_cleanup -body {
31 ly_cmd "load ietf-ip"
32 ly_cmd "print -f info -q -P $ipv6_path" "^list address .* IPv6 addresses on the interface.\";\r\n\}$"
33}}
34
aPiecek05c75952023-03-29 09:09:44 +020035test print_tree {} {
36-setup $ly_setup -cleanup $ly_cleanup -body {
37 ly_cmd "load modleaf"
38 ly_cmd "print -f tree modleaf" "\\+--rw lfl"
39}}
40
aPiecek768ee472023-03-30 11:19:42 +020041test print_tree_path {Print subtree in tree format} {
42-setup $ly_setup -cleanup $ly_cleanup -body {
43 ly_cmd "load ietf-ip"
44 ly_cmd "print -f tree -P $ipv6_path" "\\+--rw address.*\\+--rw prefix-length"
45}}
46
47test print_tree_path_single_node {Print node in tree format} {
48-setup $ly_setup -cleanup $ly_cleanup -body {
49 ly_cmd "load ietf-ip"
50 ly_cmd "print -f tree -q -P $ipv6_path" "\\+--rw address\\* \\\[ip\\\]$"
51}}
52
aPiecek146fd192023-03-30 11:22:16 +020053test print_tree_path_single_node_line_length {Print node in the tree format and limit row size} {
54-setup $ly_setup -cleanup $ly_cleanup -body {
55 ly_cmd "load ietf-ip"
56 ly_cmd "print -f tree -L 20 -q -P $ipv6_path" "\\+--rw address\\*\r\n *\\\[ip\\\]$"
57}}
58
aPiecek05c75952023-03-29 09:09:44 +020059cleanupTests