fix(IPsec): fix policy tests
[csit.git] / resources / libraries / robot / shared / test_teardown.robot
1 # Copyright (c) 2022 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/default.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 | | Finalize Test Export
49
50 | Tear down test raw
51 | | [Documentation]
52 | | ... | Common test teardown for raw tests.
53 | |
54 | | ... | *Arguments:*
55 | | ... | - ${actions} - Additional teardown action. Type: list
56 | |
57 | | [Arguments] | @{actions}
58 | |
59 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
60 | | FOR | ${action} | IN | @{actions}
61 | | | Run Keyword | Additional Test Tear Down Action For ${action}
62 | | END
63 | | Clean Sockets On All Nodes | ${nodes}
64 | | Finalize Test Export
65
66 # Additional Test Tear Down Actions in alphabetical order
67 | Additional Test Tear Down Action For acl
68 | | [Documentation]
69 | | ... | Additional teardown for tests which uses ACL feature.
70 | |
71 | | Run Keyword If Test Failed
72 | | ... | Vpp Log Plugin Acl Settings | ${dut1}
73 | | Run Keyword If Test Failed
74 | | ... | Vpp Log Plugin Acl Interface Assignment | ${dut1}
75
76 | Additional Test Tear Down Action For classify
77 | | [Documentation]
78 | | ... | Additional teardown for tests which uses classify tables.
79 | |
80 | | Run Keyword If Test Failed
81 | | ... | Show Classify Tables Verbose on all DUTs | ${nodes}
82
83 | Additional Test Tear Down Action For container
84 | | [Documentation]
85 | | ... | Additional teardown for tests which uses containers.
86 | |
87 | | FOR | ${container_group} | IN | @{container_groups}
88 | | | Destroy all '${container_group}' containers
89 | | END
90
91 | Additional Test Tear Down Action For nginx
92 | | [Documentation]
93 | | ... | Additional teardown for tests which uses nginx.
94 | |
95 | | FOR | ${dut} | IN | @{duts}
96 | | | Kill Program | ${nodes['${dut}']} | nginx
97 | | END
98
99 | Additional Test Tear Down Action For det44
100 | | [Documentation]
101 | | ... | Additional teardown for tests which uses DET44 feature.
102 | |
103 | | FOR | ${dut} | IN | @{duts}
104 | | | Run Keyword If Test Failed
105 | | | ... | Show DET44 verbose | ${nodes['${dut}']}
106 | | END
107
108 | Additional Test Tear Down Action For geneve4
109 | | [Documentation]
110 | | ... | Additional teardown for tests which uses GENEVE IPv4 tunnel.
111 | |
112 | | FOR | ${dut} | IN | @{duts}
113 | | | Run Keyword If Test Failed
114 | | | ... | Show Geneve Tunnel Data | ${nodes['${dut}']}
115 | | END
116
117 | Additional Test Tear Down Action For iPerf3
118 | | [Documentation]
119 | | ... | Additional teardown for test which uses iPerf3 server.
120 | |
121 | | Run Keyword And Ignore Error
122 | | ... | Teardown iPerf | ${nodes['${iperf_server_node}']}
123
124 | Additional Test Tear Down Action For ipsec_sa
125 | | [Documentation]
126 | | ... | Additional teardown for tests which uses IPSec security association.
127 | |
128 | | FOR | ${dut} | IN | @{duts}
129 | | | Run Keyword If Test Failed
130 | | | ... | Show Ipsec Security Association | ${nodes['${dut}']}
131 | | END
132
133 | Additional Test Tear Down Action For ipsec_all
134 | | [Documentation]
135 | | ... | Additional teardown for tests which use varied IPSec configuration.
136 | | ... | Databases.
137 | |
138 | | FOR | ${dut} | IN | @{duts}
139 | | | Run Keyword If Test Failed
140 | | | ... | Vpp Ipsec Show All | ${nodes['${dut}']}
141 | | END
142
143 | Additional Test Tear Down Action For linux_bridge
144 | | [Documentation]
145 | | ... | Additional teardown for tests which uses linux_bridge.
146 | |
147 | | FOR | ${dut} | IN | @{duts}
148 | | | Linux Del Bridge | ${nodes['${dut}']} | ${bid_TAP}
149 | | END
150
151 | Additional Test Tear Down Action For macipacl
152 | | [Documentation]
153 | | ... | Additional teardown for tests which uses MACIP ACL feature.
154 | |
155 | | Run Keyword If Test Failed
156 | | ... | Vpp Log Macip Acl Settings | ${dut1}
157 | | Run Keyword If Test Failed
158 | | ... | Vpp Log Macip Acl Interface Assignment | ${dut1}
159
160 | Additional Test Tear Down Action For namespace
161 | | [Documentation]
162 | | ... | Additional teardown for tests which uses namespace.
163 | |
164 | | FOR | ${dut} | IN | @{duts}
165 | | | Clean Up Namespaces | ${nodes['${dut}']}
166 | | END
167
168 | Additional Test Tear Down Action For nat-ed
169 | | [Documentation]
170 | | ... | Additional teardown for tests which uses NAT feature.
171 | |
172 | | FOR | ${dut} | IN | @{duts}
173 | | | Show NAT44 Config | ${nodes['${dut}']}
174 | | | Show NAT44 Summary | ${nodes['${dut}']}
175 | | | Show NAT Base Data | ${nodes['${dut}']}
176 | | | Vpp Get Ip Table Summary | ${nodes['${dut}']}
177 | | END
178
179 | Additional Test Tear Down Action For packet_trace
180 | | [Documentation]
181 | | ... | Additional teardown for tests which uses packet trace.
182 | |
183 | | Show Packet Trace on All DUTs | ${nodes}
184
185 | Additional Test Tear Down Action For telemetry
186 | | [Documentation]
187 | | ... | Additional teardown for tests which uses telemetry reads.
188 | |
189 | | Run Telemetry On All DUTs
190 | | ... | ${nodes} | profile=${telemetry_profile}.yaml
191
192 | Additional Test Tear Down Action For performance
193 | | [Documentation]
194 | | ... | Additional teardown for tests which uses performance measurement.
195 | | ... | Optionally, call \${resetter} (if defined) to reset DUT state.
196 | |
197 | | Run Keyword If Test Passed | Return From Keyword
198 | | ${use_latency} = | Get Use Latency
199 | | ${rate_for_teardown} = | Get Rate For Teardown
200 | | Call Resetter
201 | | Set Test Variable | \${extended_debug} | ${True}
202 | | Send traffic at specified rate
203 | | ... | trial_duration=${1.0}
204 | | ... | rate=${rate_for_teardown}
205 | | ... | trial_multiplicity=${1}
206 | | ... | use_latency=${use_latency}
207 | | ... | duration_limit=${1.0}
208
209 | Additional Test Tear Down Action For srv6
210 | | [Documentation]
211 | | ... | Additional teardown for tests which uses SRv6.
212 | |
213 | | Run Keyword If Test Failed
214 | | ... | Show SR Policies on all DUTs | ${nodes}
215 | | Run Keyword If Test Failed
216 | | ... | Show SR Steering Policies on all DUTs | ${nodes}
217 | | Run Keyword If Test Failed
218 | | ... | Show SR LocalSIDs on all DUTs | ${nodes}
219
220 | Additional Test Tear Down Action For vhost
221 | | [Documentation]
222 | | ... | Additional teardown for tests which uses vhost(s) and VM(s).
223 | |
224 | | Show VPP vhost on all DUTs | ${nodes}
225 | | ${vnf_status} | ${value}= | Run Keyword And Ignore Error
226 | | ... | Keyword Should Exist | vnf_manager.Kill All VMs
227 | | Run Keyword If | '${vnf_status}' == 'PASS' | vnf_manager.Kill All VMs
228
229 | Additional Test Tear Down Action For vhost-pt
230 | | [Documentation]
231 | | ... | Additional teardown for tests which uses pci-passtrough and VM(s).
232 | |
233 | | ${vnf_status} | ${value}= | Run Keyword And Ignore Error
234 | | ... | Keyword Should Exist | vnf_manager.Kill All VMs
235 | | Run Keyword If | '${vnf_status}' == 'PASS' | vnf_manager.Kill All VMs