Support existing test types with ASTF
[csit.git] / resources / libraries / robot / shared / test_teardown.robot
1 # Copyright (c) 2020 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 Action For performance
65 | | [Documentation]
66 | | ... | Additional teardown for tests which uses performance measurement.
67 | | ... | Optionally, call \${resetter} (if defined) to reset DUT state.
68 | |
69 | | ... | TODO: Document what test variables are required or optional.
70 | |
71 | | Run Keyword If Test Passed | Return From Keyword
72 | | ${use_latency} = | Get Use Latency
73 | | ${rate_for_teardown} = | Get Rate For Teardown
74 | | Call Resetter
75 | | Set Test Variable | \${extended_debug} | ${True}
76 | | Send traffic at specified rate
77 | | ... | trial_duration=${1.0}
78 | | ... | rate=${rate_for_teardown}
79 | | ... | trial_multiplicity=${1}
80 | | ... | use_latency=${use_latency}
81 | | ... | duration_limit=${1.0}
82
83 | Additional Test Tear Down Action For packet_trace
84 | | [Documentation]
85 | | ... | Additional teardown for tests which uses packet trace.
86 | |
87 | | Show Packet Trace on All DUTs | ${nodes}
88
89 | Additional Test Tear Down Action For container
90 | | [Documentation]
91 | | ... | Additional teardown for tests which uses containers.
92 | |
93 | | FOR | ${container_group} | IN | @{container_groups}
94 | | | Destroy all '${container_group}' containers
95 | | END
96
97 | Additional Test Tear Down Action For vhost
98 | | [Documentation]
99 | | ... | Additional teardown for tests which uses vhost(s) and VM(s).
100 | |
101 | | Show VPP vhost on all DUTs | ${nodes}
102 | | ${vnf_status} | ${value}= | Run Keyword And Ignore Error
103 | | ... | Keyword Should Exist | vnf_manager.Kill All VMs
104 | | Run Keyword If | '${vnf_status}' == 'PASS' | vnf_manager.Kill All VMs
105
106 | Additional Test Tear Down Action For vhost-pt
107 | | [Documentation]
108 | | ... | Additional teardown for tests which uses pci-passtrough and VM(s).
109 | |
110 | | ${vnf_status} | ${value}= | Run Keyword And Ignore Error
111 | | ... | Keyword Should Exist | vnf_manager.Kill All VMs
112 | | Run Keyword If | '${vnf_status}' == 'PASS' | vnf_manager.Kill All VMs
113
114 | Additional Test Tear Down Action For det44
115 | | [Documentation]
116 | | ... | Additional teardown for tests which uses DET44 feature.
117 | |
118 | | FOR | ${dut} | IN | @{duts}
119 #| | | Run Keyword If Test Failed
120 #| | | ... | Show DET44 verbose | ${nodes['${dut}']}
121 | | | Show DET44 verbose | ${nodes['${dut}']}
122 | | END
123
124 | Additional Test Tear Down Action For nat-ed
125 | | [Documentation]
126 | | ... | Additional teardown for tests which uses NAT feature.
127 | |
128 | | FOR | ${dut} | IN | @{duts}
129 | | | Show NAT Config | ${nodes['${dut}']}
130 | | | Show NAT44 Summary | ${nodes['${dut}']}
131 | | | Show NAT Base Data | ${nodes['${dut}']}
132 | | | Vpp Get Ip Table Summary | ${nodes['${dut}']}
133 | | END
134
135 | Additional Test Tear Down Action For namespace
136 | | [Documentation]
137 | | ... | Additional teardown for tests which uses namespace.
138 | |
139 | | FOR | ${dut} | IN | @{duts}
140 | | | Clean Up Namespaces | ${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 acl
152 | | [Documentation]
153 | | ... | Additional teardown for tests which uses ACL feature.
154 | |
155 | | Run Keyword If Test Failed
156 | | ... | Vpp Log Plugin Acl Settings | ${dut1}
157 | | Run Keyword If Test Failed
158 | | ... | Vpp Log Plugin Acl Interface Assignment | ${dut1}
159
160 | Additional Test Tear Down Action For macipacl
161 | | [Documentation]
162 | | ... | Additional teardown for tests which uses MACIP ACL feature.
163 | |
164 | | Run Keyword If Test Failed
165 | | ... | Vpp Log Macip Acl Settings | ${dut1}
166 | | Run Keyword If Test Failed
167 | | ... | Vpp Log Macip Acl Interface Assignment | ${dut1}
168
169 | Additional Test Tear Down Action For classify
170 | | [Documentation]
171 | | ... | Additional teardown for tests which uses classify tables.
172 | |
173 | | Run Keyword If Test Failed
174 | | ... | Show Classify Tables Verbose on all DUTs | ${nodes}
175
176 | Additional Test Tear Down Action For srv6
177 | | [Documentation]
178 | | ... | Additional teardown for tests which uses SRv6.
179 | |
180 | | Run Keyword If Test Failed
181 | | ... | Show SR Policies on all DUTs | ${nodes}
182 | | Run Keyword If Test Failed
183 | | ... | Show SR Steering Policies on all DUTs | ${nodes}
184 | | Run Keyword If Test Failed
185 | | ... | Show SR LocalSIDs on all DUTs | ${nodes}