Align suite/test teardown/setup
[csit.git] / resources / libraries / robot / shared / test_teardown.robot
1 # Copyright (c) 2019 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 | Documentation | Test teardown keywords.
18
19 *** Keywords ***
20 | Tear down test
21 | | [Documentation]
22 | | ... | Common test teardown for tests.
23 | | ...
24 | | ... | *Arguments:*
25 | | ... | - ${actions} - Additional teardown action. Type: list
26 | | ...
27 | | [Arguments] | @{actions}
28 | | ...
29 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
30 | | Show PAPI History On All DUTs | ${nodes}
31 | | Get Core Files on All Nodes | ${nodes}
32 | | Verify VPP PID in Teardown
33 | | :FOR | ${action} | IN | @{actions}
34 | | | Run Keyword | Additional Test Tear Down Action For ${action}
35
36 | Additional Test Tear Down Action For performance
37 | | [Documentation]
38 | | ... | Additional teardown for tests which uses performance measurement.
39 | | ...
40 | | Set Test Variable | ${pkt_trace} | ${True}
41 | | Run Keyword If Test Failed
42 | | ... | Send traffic at specified rate | ${perf_trial_duration} | 10000pps
43 | | ... | ${frame_size} | ${traffic_profile}
44
45 | Additional Test Tear Down Action For packet_trace
46 | | [Documentation]
47 | | ... | Additional teardown for tests which uses packet trace.
48 | | ...
49 | | Show Packet Trace on All DUTs | ${nodes}
50
51 | Additional Test Tear Down Action For container
52 | | [Documentation]
53 | | ... | Additional teardown for tests which uses containers.
54 | | ...
55 | | :FOR | ${container_group} | IN | @{container_groups}
56 | | | Destroy all '${container_group}' containers
57
58 | Additional Test Tear Down Action For vhost
59 | | [Documentation]
60 | | ... | Additional teardown for tests which uses vhost(s) and VM(s).
61 | | ...
62 | | # TODO: Remove IF condition once devicetest is running KernelVM.
63 | | Show VPP vhost on all DUTs | ${nodes}
64 | | Run Keyword If | "PERFTEST" in @{TEST TAGS} | vnf_manager.Kill All VMs
65 | | Run Keyword If | "DEVICETEST" in @{TEST TAGS} | vm_node.Qemu Kill
66
67 | Additional Test Tear Down Action For nat
68 | | [Documentation]
69 | | ... | Additional teardown for tests which uses NAT feature.
70 | | ...
71 | | ${duts}= | Get Matches | ${nodes} | DUT*
72 | | :FOR | ${dut} | IN | @{duts}
73 | | | Show NAT verbose | ${nodes['${dut}']}
74
75 | Additional Test Tear Down Action For namespace
76 | | [Documentation]
77 | | ... | Additional teardown for tests which uses namespace.
78 | | ...
79 | | ${duts}= | Get Matches | ${nodes} | DUT*
80 | | :FOR | ${dut} | IN | @{duts}
81 | | | Clean Up Namespaces | ${nodes['${dut}']}
82
83 | Additional Test Tear Down Action For linux_bridge
84 | | [Documentation]
85 | | ... | Additional teardown for tests which uses linux_bridge.
86 | | ...
87 | | ${duts}= | Get Matches | ${nodes} | DUT*
88 | | :FOR | ${dut} | IN | @{duts}
89 | | | Linux Del Bridge | ${nodes['${dut}']} | ${bid_TAP}
90
91 | Additional Test Tear Down Action For acl
92 | | [Documentation]
93 | | ... | Additional teardown for tests which uses ACL feature.
94 | | ...
95 | | Run Keyword If Test Failed
96 | | ... | Vpp Log Plugin Acl Settings | ${dut1}
97 | | Run Keyword If Test Failed | Run Keyword And Ignore Error
98 | | ... | Vpp Log Plugin Acl Interface Assignment | ${dut1}
99
100 | Additional Test Tear Down Action For macipacl
101 | | [Documentation]
102 | | ... | Additional teardown for tests which uses MACIP ACL feature.
103 | | ...
104 | | Run Keyword If Test Failed | Run Keyword And Ignore Error
105 | | ... | Vpp Log Macip Acl Settings | ${dut1}
106 | | Run Keyword And Ignore Error
107 | | ... | Vpp Log Macip Acl Interface Assignment | ${dut1}
108
109 | Additional Test Tear Down Action For srv6
110 | | [Documentation]
111 | | ... | Additional teardown for tests which uses SRv6.
112 | | ...
113 | | Run Keyword If Test Failed
114 | | ... | Show SR Policies on all DUTs | ${nodes}
115 | | Run Keyword If Test Failed
116 | | ... | Show SR Steering Policies on all DUTs | ${nodes}
117 | | Run Keyword If Test Failed | Show SR LocalSIDs on all DUTs | ${nodes}
118
119 | Additional Test Tear Down Action For ligato
120 | | [Documentation]
121 | | ... | Additional teardown for performance tests with Ligato.
122 | | ...
123 | | Run Keyword If Test Failed
124 | | ... | Get Kubernetes logs on all DUTs | ${nodes} | csit
125 | | Run Keyword If Test Failed
126 | | ... | Describe Kubernetes resource on all DUTs | ${nodes} | csit
127 | | Delete Kubernetes resource on all DUTs | ${nodes} | csit