blob: 8b9d7404f13df076012a8f5de84a193747f0a1f7 [file] [log] [blame]
source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/interactive/ly.tcl" : "ly.tcl"}]
set ipv6_path "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address"
test print_yang {} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load modleaf"
ly_cmd "print -f yang modleaf" "leaf lfl"
}}
test print_yang_submodule {Print submodule in yang format} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load modinclude"
ly_cmd "print -f yang modsub" "submodule modsub"
}}
test print_yin {} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load modleaf"
ly_cmd "print -f yin modleaf" "<leaf name=\"lfl\">"
}}
test print_yin_submodule {Print submodule in yin format} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load modinclude"
ly_cmd "print -f yin modsub" "<submodule name=\"modsub\""
}}
test print_info {} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load modleaf"
ly_cmd "print -f info modleaf" "status current"
}}
test print_info_path {Print subtree in info format} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load ietf-ip"
ly_cmd "print -f info -P $ipv6_path" "^list address .* leaf prefix-length"
}}
test print_info_path_single_node {Print node in info format} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load ietf-ip"
ly_cmd "print -f info -q -P $ipv6_path" "^list address .* IPv6 addresses on the interface.\";\r\n\}$"
}}
test print_tree {} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load modleaf"
ly_cmd "print -f tree modleaf" "\\+--rw lfl"
}}
test print_tree_submodule {Print submodule in tree format} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load modinclude"
ly_cmd "print -f tree modsub" "submodule: modsub"
}}
test print_tree_path {Print subtree in tree format} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load ietf-ip"
ly_cmd "print -f tree -P $ipv6_path" "\\+--rw address.*\\+--rw prefix-length"
}}
test print_tree_path_single_node {Print node in tree format} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load ietf-ip"
ly_cmd "print -f tree -q -P $ipv6_path" "\\+--rw address\\* \\\[ip\\\]$"
}}
test print_tree_path_single_node_line_length {Print node in the tree format and limit row size} {
-setup $ly_setup -cleanup $ly_cleanup -body {
ly_cmd "load ietf-ip"
ly_cmd "print -f tree -L 20 -q -P $ipv6_path" "\\+--rw address\\*\r\n *\\\[ip\\\]$"
}}
cleanupTests