CSIT-158: Tap interface tests
[csit.git] / tests / suites / softwire / lightweight_4over6.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 | Resource | resources/libraries/robot/default.robot
16 | Resource | resources/libraries/robot/testing_path.robot
17 | Resource | resources/libraries/robot/ipv4.robot
18 | Resource | resources/libraries/robot/ipv6.robot
19 | Resource | resources/libraries/robot/map.robot
20 | Library  | resources.libraries.python.Trace
21 | Force Tags | HW_ENV | VM_ENV | 3_NODE_DOUBLE_LINK_TOPO
22 | Test Setup | Run Keywords | Setup all DUTs before test
23 | ...        | AND          | Setup all TGs before traffic script
24 | Test Teardown | Show Packet Trace on All DUTs | ${nodes}
25 | Documentation | *Lightweight 4 over 6 test cases*
26 | ...
27 | ... | LW4o6 is a subset of MAP-E, with per-subscriber rules. It uses the
28 | ... | same tunneling mechanism and configuration as MAP-E. It does not use
29 | ... | embedded address bits.
30 | ...
31 | ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
32 | ... | between nodes.
33 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-UDP on TG_if1-DUT,
34 | ... | Eth-IPv6-IPv4-UDP on TG_if2_DUT.
35 | ... | *[Cfg] DUT configuration:* DUT1 is configured as lwAFTR.
36 | ... | *[Ver] TG verification:* Test UDP ICMP Echo Request in IPv4 are
37 | ... | sent to lwAFTR and are verified by TG for correctness their
38 | ... | encapsulation in IPv6 src-addr, dst-addr and MAC addresses.
39 | ... | *[Ref] Applicable standard specifications:* RFC7596 RFC7597.
40
41 *** Variables ***
42 | ${dut_ip4}= | 10.0.0.1
43 | ${dut_ip6}= | 2001:0::1
44 | ${ipv4_prefix_len}= | 24
45 | ${ipv6_prefix_len}= | 64
46
47 | ${lw_ipv4_pfx}= | 20.0.0.1/32
48 | ${lw_ipv6_pfx}= | 2001:1::/64
49 | ${lw_ipv6_src}= | 2001:1::1
50 | ${lw_psid_length}= | ${8}
51 | ${lw_psid_offset}= | ${6}
52 | ${lw_rule_psid}= | ${52}
53 | ${lw_rule_ipv6_dst}= | 2001:1::2
54 | ${lw_rule_2_psid}= | ${22}
55 | ${lw_rule_2_ipv6_dst}= | 2001:1::3
56 | ${test_ipv4_inside}= | 20.0.0.1
57 | ${test_ipv4_outside}= | 10.0.0.100
58 # test_port depends on psid, length, offset
59 | ${test_port}= | ${1232}
60 | ${test_icmp_id}= | ${1232}
61 | ${test_2_port}= | ${6232}
62
63 *** Test Cases ***
64 | TC01: Encapsulate IPv4 into IPv6. IPv6 dst depends on IPv4 and UDP destination
65 | | [Documentation]
66 | | ... | [Top] TG=DUT1.
67 | | ... | [Enc] Eth-IPv4-UDP on TG_if1-DUT, Eth-IPv6-IPv4-UDP on TG_if2_DUT.
68 | | ... | [Cfg] On DUT1 configure Map domain and Map rule.
69 | | ... | [Ver] Make TG send non-encapsulated UDP to DUT; verify TG received
70 | | ... |       IPv4oIPv6 encapsulated packet is correct.
71 | | ... | [Ref] RFC7596 RFC7597
72 | | ...
73 | | Given Path for 2-node testing is set
74 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
75 | | And   Interfaces in 2-node path are up
76 | | And   IP addresses are set on interfaces
77 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
78 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
79 | | And   Add IP Neighbor
80 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${lw_rule_ipv6_dst}
81 | |       ... | ${tg_to_dut_if2_mac}
82 | | ${domain_index}=
83 | | ... | When Map Add Domain
84 | |            ... | ${dut_node} | ${lw_ipv4_pfx} | ${lw_ipv6_pfx}
85 | |            ... | ${lw_ipv6_src} | 0 | ${lw_psid_offset}
86 | |            ... | ${lw_psid_length}
87 | |       And  Map Add Rule
88 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_psid}
89 | |            ... | ${lw_rule_ipv6_dst}
90 | | Then Send IPv4 UDP and check headers for lightweight 4over6
91 | |      ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
92 | |      ... | ${dut_to_tg_if1_mac} | ${test_ipv4_inside} | ${test_ipv4_outside}
93 | |      ... | ${test_port} | ${tg_to_dut_if2_mac} | ${dut_to_tg_if2_mac}
94 | |      ... | ${lw_rule_ipv6_dst} | ${lw_ipv6_src}
95
96 TC02: Encapsulate IPv4 ICMP into IPv6. IPv6 dst depends on IPv4 addr and ICMP ID
97 | | [Documentation]
98 | | ... | [Top] TG=DUT1.
99 | | ... | [Enc] Eth-IPv4-ICMP(type 0 and 8) on TG_if1-DUT, Eth-IPv6-IPv4-ICMP
100 | | ... |       on TG_if2_DUT.
101 | | ... | [Cfg] On DUT1 configure Map domain and Map rule.
102 | | ... | [Ver] Make TG send non-encapsulated ICMP to DUT; verify TG received
103 | | ... |       IPv4oIPv6 encapsulated packet is correct. Checks IPv6
104 | | ... |       destination based on ICMP Identifier field.
105 | | ... | [Ref] RFC7596 section 8.1
106 | | ...
107 | | Given Path for 2-node testing is set
108 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
109 | | And   Interfaces in 2-node path are up
110 | | And   IP addresses are set on interfaces
111 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
112 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
113 | | And   Add IP Neighbor
114 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${lw_rule_ipv6_dst}
115 | |       ... | ${tg_to_dut_if2_mac}
116 | | ${domain_index}=
117 | | ... | When Map Add Domain
118 | |            ... | ${dut_node} | ${lw_ipv4_pfx} | ${lw_ipv6_pfx}
119 | |            ... | ${lw_ipv6_src} | 0 | ${lw_psid_offset}
120 | |            ... | ${lw_psid_length}
121 | |       And  Map Add Rule
122 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_psid}
123 | |            ... | ${lw_rule_ipv6_dst}
124 | | Then Send IPv4 ICMP and check headers for lightweight 4over6
125 | |      ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
126 | |      ... | ${dut_to_tg_if1_mac} | ${test_ipv4_inside} | ${test_ipv4_outside}
127 | |      ... | ${test_icmp_id} | ${tg_to_dut_if2_mac} | ${dut_to_tg_if2_mac}
128 | |      ... | ${lw_rule_ipv6_dst} | ${lw_ipv6_src}
129
130 TC03: Decapsulate IPv4 UDP from IPv6.
131 | | [Documentation]
132 | | ... | [Top] TG=DUT1.
133 | | ... | [Enc] Eth-IPv6-IPv4-UDP on TG_if2_DUT, Eth-IPv4-UDP on TG_if1-DUT.
134 | | ... | [Cfg] On DUT1 configure Map domain and Map rule.
135 | | ... | [Ver] Make TG send encapsulated UDP to DUT; verify TG received
136 | | ... |       IPv4 non-encapsulated packet is correct.
137 | | ... | [Ref] RFC7596 RFC7597
138 | | ...
139 | | Given Path for 2-node testing is set
140 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
141 | | And   Interfaces in 2-node path are up
142 | | And   IP addresses are set on interfaces
143 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
144 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
145 | | And   Add Arp on DUT
146 | |       ... | ${dut_node} | ${dut_to_tg_if1}
147 | |       ... | ${test_ipv4_outside}
148 | |       ... | ${tg_to_dut_if1_mac}
149 | | ${domain_index}=
150 | | ... | When Map Add Domain
151 | |            ... | ${dut_node} | ${lw_ipv4_pfx} | ${lw_ipv6_pfx}
152 | |            ... | ${lw_ipv6_src} | 0 | ${lw_psid_offset}
153 | |            ... | ${lw_psid_length}
154 | |       And  Map Add Rule
155 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_psid}
156 | |            ... | ${lw_rule_ipv6_dst}
157 | | Then Send IPv4 UDP in IPv6 and check headers for lightweight 4over6
158 | |      ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if1}
159 | |      ... | ${dut_to_tg_if2_mac} | ${tg_to_dut_if2_mac}
160 | |      ... | ${lw_ipv6_src} | ${lw_rule_ipv6_dst}
161 | |      ... | ${test_ipv4_outside} | ${test_ipv4_inside} | ${test_port}
162 | |      ... | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
163
164 TC04: Hairpinning of traffic between two lwB4
165 | | [Documentation]
166 | | ... | [Top] DUT1-TG.
167 | | ... | [Enc] Eth-IPv6-IPv4-UDP on TG_if2_DUT, Eth-IPv6-IPv4-UDP on TG_if2_DUT.
168 | | ... | [Cfg] On DUT1 configure Map domain and two Map rules.
169 | | ... | [Ver] Make TG send encapsulated UDP to DUT; verify TG received
170 | | ... |       encapsulated packet is correct.
171 | | ... | [Ref] RFC7596 RFC7597
172 | | ...
173 | | Given Path for 2-node testing is set
174 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
175 | | And   Interfaces in 2-node path are up
176 | | And   IP addresses are set on interfaces
177 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
178 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
179 | | And   Add IP Neighbor
180 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${lw_rule_2_ipv6_dst}
181 | |       ... | ${tg_to_dut_if2_mac}
182 | | ${domain_index}=
183 | | ... | When Map Add Domain
184 | |            ... | ${dut_node} | ${lw_ipv4_pfx} | ${lw_ipv6_pfx}
185 | |            ... | ${lw_ipv6_src} | 0 | ${lw_psid_offset}
186 | |            ... | ${lw_psid_length}
187 | |       And  Map Add Rule
188 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_psid}
189 | |            ... | ${lw_rule_ipv6_dst}
190 | |       And  Map Add Rule
191 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_2_psid}
192 | |            ... | ${lw_rule_2_ipv6_dst}
193 | | Then Send IPv4 UDP in IPv6 and check headers for lightweight hairpinning
194 | |      ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if2}
195 | |      ... | ${dut_to_tg_if2_mac}
196 | |      ... | ${lw_ipv6_src} | ${lw_rule_ipv6_dst}
197 | |      ... | ${test_ipv4_inside} | ${test_ipv4_inside}
198 | |      ... | ${test_2_port} | ${test_port}
199 | |      ... | ${tg_to_dut_if2_mac} | ${dut_to_tg_if2_mac}
200 | |      ... | ${lw_rule_2_ipv6_dst} | ${lw_ipv6_src}