roman | e84f7dc | 2022-10-21 10:25:38 +0200 | [diff] [blame] | 1 | #!/usr/bin/expect -f |
| 2 | |
| 3 | if { [info exists ::env(CURRENT_SOURCE_DIR)] } { |
| 4 | source "$env(CURRENT_SOURCE_DIR)/tests/expect/common.exp" |
Michal Vasko | 832a6fa | 2022-10-24 08:31:17 +0200 | [diff] [blame] | 5 | set yang_dir "$env(CURRENT_SOURCE_DIR)/examples" |
roman | e84f7dc | 2022-10-21 10:25:38 +0200 | [diff] [blame] | 6 | } else { |
| 7 | source "common.exp" |
Michal Vasko | 832a6fa | 2022-10-24 08:31:17 +0200 | [diff] [blame] | 8 | set yang_dir "../../examples" |
roman | e84f7dc | 2022-10-21 10:25:38 +0200 | [diff] [blame] | 9 | } |
| 10 | |
Michal Vasko | 832a6fa | 2022-10-24 08:31:17 +0200 | [diff] [blame] | 11 | spawn $yanglint |
roman | e84f7dc | 2022-10-21 10:25:38 +0200 | [diff] [blame] | 12 | |
| 13 | expect_output "> " |
| 14 | |
| 15 | expect_command "clear -ii" 0 "" |
| 16 | |
Michal Vasko | 832a6fa | 2022-10-24 08:31:17 +0200 | [diff] [blame] | 17 | expect_command "add ${yang_dir}/ietf-ip.yang" 0 "" |
roman | e84f7dc | 2022-10-21 10:25:38 +0200 | [diff] [blame] | 18 | |
| 19 | expect_completion "print -f info -P " "print -f info -P /ietf-" |
| 20 | |
| 21 | set hints {"/ietf-yang-schema-mount:schema-mounts" "/ietf-interfaces:interfaces" "/ietf-interfaces:interfaces-state"} |
| 22 | |
| 23 | expect_hint "" "print -f info -P /ietf-" $hints |
| 24 | |
| 25 | expect_completion "i" "print -f info -P /ietf-interfaces:interfaces" |
| 26 | |
| 27 | expect_completion "/" "print -f info -P /ietf-interfaces:interfaces/interface" |
| 28 | |
| 29 | set hints {"/ietf-interfaces:interfaces/interface" |
| 30 | "/ietf-interfaces:interfaces/interface/name" "/ietf-interfaces:interfaces/interface/description" |
| 31 | "/ietf-interfaces:interfaces/interface/type" "/ietf-interfaces:interfaces/interface/enabled" |
| 32 | "/ietf-interfaces:interfaces/interface/link-up-down-trap-enable" |
| 33 | "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4" "/ietf-interfaces:interfaces/interface/ietf-ip:ipv6"} |
| 34 | |
| 35 | expect_hint "" "print -f info -P /ietf-interfaces:interfaces/interface" $hints |
| 36 | |
| 37 | expect_completion "/i" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv" |
| 38 | |
| 39 | expect_completion "4" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv4" |
| 40 | |
| 41 | set hints { "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4" "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/enabled" |
| 42 | "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/forwarding" "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/mtu" |
| 43 | "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address" "/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/neighbor" |
| 44 | } |
| 45 | |
| 46 | expect_hint "\t" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv" $hints |
| 47 | |
| 48 | expect_completion "/e" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv4/enabled " |
| 49 | |
| 50 | send -- "\r" |
| 51 | |
| 52 | expect { |
| 53 | -re ".*\r\n> " {} |
| 54 | timeout {exit 1} |
| 55 | } |
| 56 | |
| 57 | send -- "exit\r" |
| 58 | |
| 59 | expect eof |