Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/playbooks/common_examples/sonic_command.yaml

raw symbols SCIP
1 ---
2 - name: "Test SONiC CLI"
3 hosts: datacenter
4 gather_facts: false
5 connection: network_cli
6 collections:
7 - dellemc.enterprise_sonic
8 tasks:
9 - name: Test SONiC single command
10 sonic_command:
11 commands: 'show interface status'
12 register: cmd_op
13 - name: Test SONiC single command with wait_for
14 sonic_command:
15 commands: 'show version'
16 wait_for:
17 - result[0] contains Del
18 register: cmd_op
19 - name: Test SONiC multiple command with wait_for
20 sonic_command:
21 commands:
22 - 'show version'
23 - 'show system'
24 wait_for:
25 - result[0] contains Dell
26 - result[1] contains Hostname
27 register: cmd_op
28 - name: Test SONiC commands with wait_for negative case
29 sonic_command:
30 commands:
31 - 'show version'
32 - 'show system'
33 wait_for:
34 - result[0] contains Fel
35 - result[1] contains Hostname
36 register: cmd_op
37 ignore_errors: true
38 - name: Test SONiC commands with wait_for and match=any
39 sonic_command:
40 commands:
41 - 'show version'
42 - 'show system'
43 wait_for:
44 - result[0] contains Fel
45 - result[1] contains Hostname
46 match: any
47 retries: 3
48 interval: 2
49 register: cmd_op
50 - name: Test SONiC command with prompt handling
51 sonic_command:
52 commands:
53 - command: 'image remove all'
54 prompt: '\[y/N\]:$'
55 answer: 'N'
56 register: cmd_op