GSO: TAP/VHOST use case
[csit.git] / resources / libraries / robot / shared / test_teardown.robot
1 # Copyright (c) 2021 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 """Keywords used in test teardowns."""
15
16 *** Settings ***
17 | Resource | resources/libraries/robot/shared/container.robot
18 | Library | resources.libraries.python.PapiHistory
19 | Library | resources.libraries.python.topology.Topology
20 | Variables | resources/libraries/python/Constants.py
21 |
22 | Documentation | Test teardown keywords.
23
24 *** Keywords ***
25 | Tear down test
26 | | [Documentation]
27 | | ... | Common test teardown for VPP tests.
28 | |
29 | | ... | *Arguments:*
30 | | ... | - ${actions} - Additional teardown action. Type: list
31 | |
32 | | [Arguments] | @{actions}
33 | |
34 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
35 | | Show PAPI History On All DUTs | ${nodes}
36 | | Run Keyword If Test Failed
37 | | ... | Show Log On All DUTs | ${nodes}
38 | | Run Keyword If Test Failed
39 | | ... | Get Core Files on All Nodes | ${nodes}
40 | | Run Keyword If Test Failed
41 | | ... | Verify VPP PID in Teardown
42 | | Run Keyword If Test Failed
43 | | ... | VPP Show Memory On All DUTs | ${nodes}
44 | | FOR | ${action} | IN | @{actions}
45 | | | Run Keyword | Additional Test Tear Down Action For ${action}
46 | | END
47 | | Clean Sockets On All Nodes | ${nodes}
48
49 | Tear down test raw
50 | | [Documentation]
51 | | ... | Common test teardown for raw tests.
52 | |
53 | | ... | *Arguments:*
54 | | ... | - ${actions} - Additional teardown action. Type: list
55 | |
56 | | [Arguments] | @{actions}
57 | |
58 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
59 | | FOR | ${action} | IN | @{actions}
60 | | | Run Keyword | Additional Test Tear Down Action For ${action}
61 | | END
62 | | Clean Sockets On All Nodes | ${nodes}
63
64 # Additional Test Tear Down Actions in alphabetical order
65 | Additional Test Tear Down Action For acl
66 | | [Documentation]
67 | | ... | Additional teardown for tests which uses ACL feature.
68 | |
69 | | Run Keyword If Test Failed
70 | | ... | Vpp Log Plugin Acl Settings | ${dut1}
71 | | Run Keyword If Test Failed
72 | | ... | Vpp Log Plugin Acl Interface Assignment | ${dut1}
73
74 | Additional Test Tear Down Action For classify
75 | | [Documentation]
76 | | ... | Additional teardown for tests which uses classify tables.
77 | |
78 | | Run Keyword If Test Failed
79 | | ... | Show Classify Tables Verbose on all DUTs | ${nodes}
80
81 | Additional Test Tear Down Action For container
82 | | [Documentation]
83 | | ... | Additional teardown for tests which uses containers.
84 | |
85 | | FOR | ${container_group} | IN | @{container_groups}
86 | | | Destroy all '${container_group}' containers
87 | | END
88
89 | Additional Test Tear Down Action For det44
90 | | [Documentation]
91 | | ... | Additional teardown for tests which uses DET44 feature.
92 | |
93 | | FOR | ${dut} | IN | @{duts}
94 | | | Run Keyword If Test Failed
95 | | | ... | Show DET44 verbose | ${nodes['${dut}']}
96 | | END
97
98 | Additional Test Tear Down Action For geneve4
99 | | [Documentation]
100 | | ... | Additional teardown for tests which uses GENEVE IPv4 tunnel.
101 | |
102 | | FOR | ${dut} | IN | @{duts}
103 | | | Run Keyword If Test Failed
104 | | | ... | Show Geneve Tunnel Data | ${nodes['${dut}']}
105 | | END
106
107 | Additional Test Tear Down Action For iPerf3
108 | | [Documentation]
109 | | ... | Additional teardown for test which uses iPerf3 server.
110 | |
111 | | Run Keyword And Ignore Error
112 | | ... | Teardown iPerf | ${nodes['${iperf_server_node}']}
113
114 | Additional Test Tear Down Action For ipsec_sa
115 | | [Documentation]
116 | | ... | Additional teardown for tests which uses IPSec security association.
117 | |
118 | | FOR | ${dut} | IN | @{duts}
119 | | | Run Keyword If Test Failed
120 | | | ... | Show Ipsec Security Association | ${nodes['${dut}']}
121 | | END
122
123 | Additional Test Tear Down Action For linux_bridge
124 | | [Documentation]
125 | | ... | Additional teardown for tests which uses linux_bridge.
126 | |
127 | | FOR | ${dut} | IN | @{duts}
128 | | | Linux Del Bridge | ${nodes['${dut}']} | ${bid_TAP}
129 | | END
130
131 | Additional Test Tear Down Action For macipacl
132 | | [Documentation]
133 | | ... | Additional teardown for tests which uses MACIP ACL feature.
134 | |
135 | | Run Keyword If Test Failed
136 | | ... | Vpp Log Macip Acl Settings | ${dut1}
137 | | Run Keyword If Test Failed
138 | | ... | Vpp Log Macip Acl Interface Assignment | ${dut1}
139
140 | Additional Test Tear Down Action For namespace
141 | | [Documentation]
142 | | ... | Additional teardown for tests which uses namespace.
143 | |
144 | | FOR | ${dut} | IN | @{duts}
145 | | | Clean Up Namespaces | ${nodes['${dut}']}
146 | | END
147
148 | Additional Test Tear Down Action For nat-ed
149 | | [Documentation]
150 | | ... | Additional teardown for tests which uses NAT feature.
151 | |
152 | | FOR | ${dut} | IN | @{duts}
153 | | | Show NAT44 Config | ${nodes['${dut}']}
154 | | | Show NAT44 Summary | ${nodes['${dut}']}
155 | | | Show NAT Base Data | ${nodes['${dut}']}
156 | | | Vpp Get Ip Table Summary | ${nodes['${dut}']}
157 | | END
158
159 | Additional Test Tear Down Action For packet_trace
160 | | [Documentation]
161 | | ... | Additional teardown for tests which uses packet trace.
162 | |
163 | | Show Packet Trace on All DUTs | ${nodes}
164
165 | Additional Test Tear Down Action For performance
166 | | [Documentation]
167 | | ... | Additional teardown for tests which uses performance measurement.
168 | | ... | Optionally, call \${resetter} (if defined) to reset DUT state.
169 | |
170 | | ... | TODO: Document what test variables are required or optional.
171 | |
172 | | Run Keyword If Test Passed | Return From Keyword
173 | | ${use_latency} = | Get Use Latency
174 | | ${rate_for_teardown} = | Get Rate For Teardown
175 | | Call Resetter
176 | | Set Test Variable | \${extended_debug} | ${True}
177 | | Send traffic at specified rate
178 | | ... | trial_duration=${1.0}
179 | | ... | rate=${rate_for_teardown}
180 | | ... | trial_multiplicity=${1}
181 | | ... | use_latency=${use_latency}
182 | | ... | duration_limit=${1.0}
183
184 | Additional Test Tear Down Action For srv6
185 | | [Documentation]
186 | | ... | Additional teardown for tests which uses SRv6.
187 | |
188 | | Run Keyword If Test Failed
189 | | ... | Show SR Policies on all DUTs | ${nodes}
190 | | Run Keyword If Test Failed
191 | | ... | Show SR Steering Policies on all DUTs | ${nodes}
192 | | Run Keyword If Test Failed
193 | | ... | Show SR LocalSIDs on all DUTs | ${nodes}
194
195 | Additional Test Tear Down Action For vhost
196 | | [Documentation]
197 | | ... | Additional teardown for tests which uses vhost(s) and VM(s).
198 | |
199 | | Show VPP vhost on all DUTs | ${nodes}
200 | | ${vnf_status} | ${value}= | Run Keyword And Ignore Error
201 | | ... | Keyword Should Exist | vnf_manager.Kill All VMs
202 | | Run Keyword If | '${vnf_status}' == 'PASS' | vnf_manager.Kill All VMs
203
204 | Additional Test Tear Down Action For vhost-pt
205 | | [Documentation]
206 | | ... | Additional teardown for tests which uses pci-passtrough and VM(s).
207 | |
208 | | ${vnf_status} | ${value}= | Run Keyword And Ignore Error
209 | | ... | Keyword Should Exist | vnf_manager.Kill All VMs
210 | | Run Keyword If | '${vnf_status}' == 'PASS' | vnf_manager.Kill All VMs