Fix test teardown in IPv4 and IPv6 tests
[csit.git] / tests / func / ipv4 / ipv4_untagged.robot
1 # Copyright (c) 2016 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 *** Settings ***
15 | Library | resources.libraries.python.NodePath
16 | Library | resources.libraries.python.Trace
17 | Resource | resources/libraries/robot/default.robot
18 | Resource | resources/libraries/robot/interfaces.robot
19 | Resource | resources/libraries/robot/ipv4.robot
20 | Force Tags | HW_ENV
21 | Suite Setup | Run Keywords | Setup all DUTs before test
22 | ...         | AND          | Setup all TGs before traffic script
23 | ...         | AND          | Update All Interface Data On All Nodes | ${nodes}
24 | ...         | AND          | Setup DUT nodes for IPv4 testing
25 | Test Setup | Clear interface counters on all vpp nodes in topology | ${nodes}
26 | Test Teardown | Run Keywords
27 | ... | Show packet trace on all DUTs | ${nodes} | AND
28 | ... | Show vpp trace dump on all DUTs
29 | Documentation | *IPv4 routing test cases*
30 | ...
31 | ... | RFC791 IPv4, RFC826 ARP, RFC792 ICMPv4. Encapsulations: Eth-IPv4-ICMPv4
32 | ... | on links TG-DUT1, TG-DUT2, DUT1-DUT2. IPv4 routing tests use circular
33 | ... | 3-node topology TG - DUT1 - DUT2 - TG with one link between the nodes.
34 | ... | DUT1 and DUT2 are configured with IPv4 routing and static routes. Test
35 | ... | ICMPv4 Echo Request packets are sent in both directions by TG on links
36 | ... | to DUT1 and DUT2 and received on TG links on the other side of circular
37 | ... | topology. On receive TG verifies packets IPv4 src-addr, dst-addr and MAC
38 | ... | addresses.
39
40 *** Test Cases ***
41
42 | TC01: DUT replies to ICMPv4 Echo Req to its ingress interface
43 | | [Documentation]
44 | | ... | Make TG send ICMPv4 Echo Req to DUT ingress interface. Make TG\
45 | | ... | verify ICMP Echo Reply is correct.
46 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | VM_ENV
47 | | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']}
48 | | Compute Path
49 | | ${src_port} | ${src_node}= | First Interface
50 | | ${dst_port} | ${dst_node}= | Last Interface
51 | | ${hops}= | Set Variable | ${0}
52 | | Node "${src_node}" interface "${src_port}" can route to node "${dst_node}" interface "${dst_port}" ${hops} hops away using IPv4
53
54 | TC02: DUT routes IPv4 to its egress interface
55 | | [Documentation]
56 | | ... | Make TG send ICMPv4 Echo Req towards DUT1 egress interface\
57 | | ... | connected to DUT2. Make TG verify ICMPv4 Echo Reply is correct.
58 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | VM_ENV
59 | | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']}
60 | | Compute Path
61 | | ${src_port} | ${src_node}= | First Interface
62 | | ${dst_port} | ${dst_node}= | Last Egress Interface
63 | | ${hops}= | Set Variable | ${0}
64 | | Node "${src_node}" interface "${src_port}" can route to node "${dst_node}" interface "${dst_port}" ${hops} hops away using IPv4
65
66 | TC03: DUT1 routes IPv4 to DUT2 ingress interface
67 | | [Documentation]
68 | | ... | Make TG send ICMPv4 Echo Req towards DUT2 ingress interface\
69 | | ... | connected to DUT1. Make TG verify ICMPv4 Echo Reply is correct.
70 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | VM_ENV
71 | | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']}
72 | | Compute Path
73 | | ${src_port} | ${src_node}= | First Interface
74 | | ${dst_port} | ${dst_node}= | Last Interface
75 | | ${hops}= | Set Variable | ${1}
76 | | Node "${src_node}" interface "${src_port}" can route to node "${dst_node}" interface "${dst_port}" ${hops} hops away using IPv4
77
78 | TC04: DUT1 routes IPv4 to DUT2 egress interface
79 | | [Documentation]
80 | | ... | Make TG send ICMPv4 Echo Req towards DUT2 egress interface\
81 | | ... | connected to TG. Make TG verify ICMPv4 Echo Reply is correct.
82 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | VM_ENV
83 | | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
84 | | Compute Path
85 | | ${src_port} | ${src_node}= | First Interface
86 | | ${dst_port} | ${dst_node}= | Last Egress Interface
87 | | ${hops}= | Set Variable | ${1}
88 | | Node "${src_node}" interface "${src_port}" can route to node "${dst_node}" interface "${dst_port}" ${hops} hops away using IPv4
89
90 | TC05: DUT1 and DUT2 route IPv4 between TG interfaces
91 | | [Documentation]
92 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across DUT1\
93 | | ... | and DUT2. Make TG verify ICMPv4 Echo Replies are correct.
94 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | VM_ENV
95 | | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
96 | | Compute Path
97 | | ${src_port} | ${src_node}= | First Interface
98 | | ${dst_port} | ${dst_node}= | Last Interface
99 | | ${hops}= | Set Variable | ${2}
100 | | Node "${src_node}" interface "${src_port}" can route to node "${dst_node}" interface "${dst_port}" ${hops} hops away using IPv4
101 | | ${port} | ${node}= | Next Interface
102 | | ${port} | ${node}= | Next Interface
103 | | ${exp_counter_val}= | Set Variable | ${1}
104 | | Vpp dump stats table | ${node}
105 | | Check ipv4 interface counter | ${node} | ${port} | ${exp_counter_val}
106 | | ${port} | ${node}= | Next Interface
107 | | Check ipv4 interface counter | ${node} | ${port} | ${exp_counter_val}
108 | | ${port} | ${node}= | Next Interface
109 | | Vpp dump stats table | ${node}
110 | | Check ipv4 interface counter | ${node} | ${port} | ${exp_counter_val}
111 | | ${port} | ${node}= | Next Interface
112 | | Check ipv4 interface counter | ${node} | ${port} | ${exp_counter_val}
113
114 | TC06: DUT replies to ICMPv4 Echo Reqs with size 64B-to-1500B-incr-1B
115 | | [Documentation]
116 | | ... | Make TG send ICMPv4 Echo Reqs to DUT ingress interface,\
117 | | ... | incrementating frame size from 64B to 1500B with increment step
118 | | ... | of 1Byte. Make TG verify ICMP Echo Replies are correct.
119 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | VM_ENV
120 | | Ipv4 icmp echo sweep | ${nodes['TG']} | ${nodes['DUT1']} | 0 | 1452 | 1
121
122 | TC07: DUT replies to ICMPv4 Echo Reqs with size 1500B-to-9000B-incr-10B
123 | | [Documentation]
124 | | ... | Make TG send ICMPv4 Echo Reqs to DUT ingress interface,\
125 | | ... | incrementating frame size from 1500B to 9000B with increment
126 | | ... | step of 10Bytes. Make TG verify ICMPv4 Echo Replies are correct.
127 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO
128 | | [Setup] | Setup MTU on TG based on MTU on DUT | ${nodes['TG']} | ${nodes['DUT1']}
129 | | [Teardown] | Set default Ethernet MTU on all interfaces on node | ${nodes['TG']}
130 | | Append Nodes | ${nodes['TG']} | ${nodes['DUT1']}
131 | | Compute Path
132 | | ${dut_port} | ${dut_node}= | Last Interface
133 | | ${mtu}= | Get Interface MTU | ${dut_node} | ${dut_port}
134 | | # ICMP payload size is frame size minus size of Ehternet header, FCS,
135 | | # IPv4 header and ICMP header
136 | | ${end_size}= | Evaluate | ${mtu} - 14 - 4 - 20 - 8
137 | | Run Keyword If | ${mtu} > 1518
138 | | ... | Ipv4 icmp echo sweep | ${nodes['TG']} | ${nodes['DUT1']}
139 | | ... | 1452 | ${end_size} | 10
140
141 | TC08: DUT replies to ARP request
142 | | [Documentation]
143 | | ... | Make TG send ARP Request to DUT and verify ARP Reply is correct.\
144 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | VM_ENV
145 | | Send ARP request and validate response | ${nodes['TG']} | ${nodes['DUT1']}