blob: 971e105df1bf429f43c4bcf0d3677433d0849350 [file] [log] [blame]
romane84f7dc2022-10-21 10:25:38 +02001#!/usr/bin/expect -f
2
3if { [info exists ::env(CURRENT_SOURCE_DIR)] } {
4 source "$env(CURRENT_SOURCE_DIR)/tests/expect/common.exp"
Michal Vasko832a6fa2022-10-24 08:31:17 +02005 set yang_dir "$env(CURRENT_SOURCE_DIR)/examples"
romane84f7dc2022-10-21 10:25:38 +02006} else {
7 source "common.exp"
Michal Vasko832a6fa2022-10-24 08:31:17 +02008 set yang_dir "../../examples"
romane84f7dc2022-10-21 10:25:38 +02009}
10
Michal Vasko832a6fa2022-10-24 08:31:17 +020011spawn $yanglint
romane84f7dc2022-10-21 10:25:38 +020012
13expect_output "> "
14
15expect_command "clear -ii" 0 ""
16
Michal Vasko832a6fa2022-10-24 08:31:17 +020017expect_command "add ${yang_dir}/ietf-ip.yang" 0 ""
romane84f7dc2022-10-21 10:25:38 +020018
19expect_completion "print -f info -P " "print -f info -P /ietf-"
20
21set hints {"/ietf-yang-schema-mount:schema-mounts" "/ietf-interfaces:interfaces" "/ietf-interfaces:interfaces-state"}
22
23expect_hint "" "print -f info -P /ietf-" $hints
24
25expect_completion "i" "print -f info -P /ietf-interfaces:interfaces"
26
27expect_completion "/" "print -f info -P /ietf-interfaces:interfaces/interface"
28
29set 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
35expect_hint "" "print -f info -P /ietf-interfaces:interfaces/interface" $hints
36
37expect_completion "/i" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv"
38
39expect_completion "4" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv4"
40
41set 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
46expect_hint "\t" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv" $hints
47
48expect_completion "/e" "print -f info -P /ietf-interfaces:interfaces/interface/ietf-ip:ipv4/enabled "
49
50send -- "\r"
51
52expect {
53 -re ".*\r\n> " {}
54 timeout {exit 1}
55}
56
57send -- "exit\r"
58
59expect eof