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