06f7c6efad6c1c53b147071786a2c2bcf97b8c28
[csit.git] / tests / func / 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 | ${tg_ip6}= | 2001:0::2
45 | ${ipv4_prefix_len}= | 24
46 | ${ipv6_prefix_len}= | 64
47
48 | ${lw_ipv4_pfx}= | 20.0.0.1/32
49 | ${lw_ipv6_pfx}= | 2001:1::/64
50 | ${lw_ipv6_src}= | 2001:1::1
51 | ${lw_psid_length}= | ${8}
52 | ${lw_psid_offset}= | ${6}
53 | ${lw_rule_psid}= | ${52}
54 | ${lw_rule_ipv6_dst}= | 2001:1::2
55 | ${lw_rule_2_psid}= | ${22}
56 | ${lw_rule_2_ipv6_dst}= | 2001:1::3
57 | ${test_ipv4_inside}= | 20.0.0.1
58 | ${test_ipv4_outside}= | 10.0.0.100
59 # test_port depends on psid, length, offset
60 | ${test_port}= | ${1232}
61 | ${test_icmp_id}= | ${1232}
62 | ${test_2_port}= | ${6232}
63
64 *** Test Cases ***
65 | TC01: Encapsulate IPv4 into IPv6. IPv6 dst depends on IPv4 and UDP destination
66 | | [Documentation]
67 | | ... | [Top] TG=DUT1.
68 | | ... | [Enc] Eth-IPv4-UDP on TG_if1-DUT, Eth-IPv6-IPv4-UDP on TG_if2_DUT.
69 | | ... | [Cfg] On DUT1 configure Map domain and Map rule.
70 | | ... | [Ver] Make TG send non-encapsulated UDP to DUT; verify TG received
71 | | ... |       IPv4oIPv6 encapsulated packet is correct.
72 | | ... | [Ref] RFC7596 RFC7597
73 | | ...
74 | | Given Path for 2-node testing is set
75 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
76 | | And   Interfaces in 2-node path are up
77 | | And   IP addresses are set on interfaces
78 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
79 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
80 | | And   Add IP Neighbor
81 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${tg_ip6}
82 | |       ... | ${tg_to_dut_if2_mac}
83 | | And Vpp Route Add
84 | |       ... | ${dut_node} | ${lw_rule_ipv6_dst} | 128
85 | |       ... | ${tg_ip6} | ${dut_to_tg_if2} | resolve_attempts=${NONE}
86 | | ${domain_index}=
87 | | ... | When Map Add Domain
88 | |            ... | ${dut_node} | ${lw_ipv4_pfx} | ${lw_ipv6_pfx}
89 | |            ... | ${lw_ipv6_src} | 0 | ${lw_psid_offset}
90 | |            ... | ${lw_psid_length}
91 | |       And  Map Add Rule
92 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_psid}
93 | |            ... | ${lw_rule_ipv6_dst}
94 | | Then Send IPv4 UDP and check headers for lightweight 4over6
95 | |      ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
96 | |      ... | ${dut_to_tg_if1_mac} | ${test_ipv4_inside} | ${test_ipv4_outside}
97 | |      ... | ${test_port} | ${tg_to_dut_if2_mac} | ${dut_to_tg_if2_mac}
98 | |      ... | ${lw_rule_ipv6_dst} | ${lw_ipv6_src}
99
100 TC02: Encapsulate IPv4 ICMP into IPv6. IPv6 dst depends on IPv4 addr and ICMP ID
101 | | [Documentation]
102 | | ... | [Top] TG=DUT1.
103 | | ... | [Enc] Eth-IPv4-ICMP(type 0 and 8) on TG_if1-DUT, Eth-IPv6-IPv4-ICMP
104 | | ... |       on TG_if2_DUT.
105 | | ... | [Cfg] On DUT1 configure Map domain and Map rule.
106 | | ... | [Ver] Make TG send non-encapsulated ICMP to DUT; verify TG received
107 | | ... |       IPv4oIPv6 encapsulated packet is correct. Checks IPv6
108 | | ... |       destination based on ICMP Identifier field.
109 | | ... | [Ref] RFC7596 section 8.1
110 | | ...
111 | | Given Path for 2-node testing is set
112 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
113 | | And   Interfaces in 2-node path are up
114 | | And   IP addresses are set on interfaces
115 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
116 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
117 | | And   Add IP Neighbor
118 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${tg_ip6}
119 | |       ... | ${tg_to_dut_if2_mac}
120 | | And Vpp Route Add
121 | |       ... | ${dut_node} | ${lw_rule_ipv6_dst} | 128
122 | |       ... | ${tg_ip6} | ${dut_to_tg_if2} | resolve_attempts=${NONE}
123 | | ${domain_index}=
124 | | ... | When Map Add Domain
125 | |            ... | ${dut_node} | ${lw_ipv4_pfx} | ${lw_ipv6_pfx}
126 | |            ... | ${lw_ipv6_src} | 0 | ${lw_psid_offset}
127 | |            ... | ${lw_psid_length}
128 | |       And  Map Add Rule
129 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_psid}
130 | |            ... | ${lw_rule_ipv6_dst}
131 | | Then Send IPv4 ICMP and check headers for lightweight 4over6
132 | |      ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
133 | |      ... | ${dut_to_tg_if1_mac} | ${test_ipv4_inside} | ${test_ipv4_outside}
134 | |      ... | ${test_icmp_id} | ${tg_to_dut_if2_mac} | ${dut_to_tg_if2_mac}
135 | |      ... | ${lw_rule_ipv6_dst} | ${lw_ipv6_src}
136
137 TC03: Decapsulate IPv4 UDP from IPv6.
138 | | [Documentation]
139 | | ... | [Top] TG=DUT1.
140 | | ... | [Enc] Eth-IPv6-IPv4-UDP on TG_if2_DUT, Eth-IPv4-UDP on TG_if1-DUT.
141 | | ... | [Cfg] On DUT1 configure Map domain and Map rule.
142 | | ... | [Ver] Make TG send encapsulated UDP to DUT; verify TG received
143 | | ... |       IPv4 non-encapsulated packet is correct.
144 | | ... | [Ref] RFC7596 RFC7597
145 | | ...
146 | | Given Path for 2-node testing is set
147 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
148 | | And   Interfaces in 2-node path are up
149 | | And   IP addresses are set on interfaces
150 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
151 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
152 | | And   Add Arp on DUT
153 | |       ... | ${dut_node} | ${dut_to_tg_if1}
154 | |       ... | ${test_ipv4_outside}
155 | |       ... | ${tg_to_dut_if1_mac}
156 | | ${domain_index}=
157 | | ... | When Map Add Domain
158 | |            ... | ${dut_node} | ${lw_ipv4_pfx} | ${lw_ipv6_pfx}
159 | |            ... | ${lw_ipv6_src} | 0 | ${lw_psid_offset}
160 | |            ... | ${lw_psid_length}
161 | |       And  Map Add Rule
162 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_psid}
163 | |            ... | ${lw_rule_ipv6_dst}
164 | | Then Send IPv4 UDP in IPv6 and check headers for lightweight 4over6
165 | |      ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if1}
166 | |      ... | ${dut_to_tg_if2_mac} | ${tg_to_dut_if2_mac}
167 | |      ... | ${lw_ipv6_src} | ${lw_rule_ipv6_dst}
168 | |      ... | ${test_ipv4_outside} | ${test_ipv4_inside} | ${test_port}
169 | |      ... | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
170
171 TC04: Hairpinning of traffic between two lwB4
172 | | [Documentation]
173 | | ... | [Top] DUT1-TG.
174 | | ... | [Enc] Eth-IPv6-IPv4-UDP on TG_if2_DUT, Eth-IPv6-IPv4-UDP on TG_if2_DUT.
175 | | ... | [Cfg] On DUT1 configure Map domain and two Map rules.
176 | | ... | [Ver] Make TG send encapsulated UDP to DUT; verify TG received
177 | | ... |       encapsulated packet is correct.
178 | | ... | [Ref] RFC7596 RFC7597
179 | | ...
180 | | Given Path for 2-node testing is set
181 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
182 | | And   Interfaces in 2-node path are up
183 | | And   IP addresses are set on interfaces
184 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
185 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
186 | | And   Add IP Neighbor
187 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${tg_ip6}
188 | |       ... | ${tg_to_dut_if2_mac}
189 | | And Vpp Route Add
190 | |       ... | ${dut_node} | ${lw_rule_2_ipv6_dst} | 128
191 | |       ... | ${tg_ip6} | ${dut_to_tg_if2} | resolve_attempts=${NONE}
192 | | ${domain_index}=
193 | | ... | When Map Add Domain
194 | |            ... | ${dut_node} | ${lw_ipv4_pfx} | ${lw_ipv6_pfx}
195 | |            ... | ${lw_ipv6_src} | 0 | ${lw_psid_offset}
196 | |            ... | ${lw_psid_length}
197 | |       And  Map Add Rule
198 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_psid}
199 | |            ... | ${lw_rule_ipv6_dst}
200 | |       And  Map Add Rule
201 | |            ... | ${dut_node} | ${domain_index} | ${lw_rule_2_psid}
202 | |            ... | ${lw_rule_2_ipv6_dst}
203 | | Then Send IPv4 UDP in IPv6 and check headers for lightweight hairpinning
204 | |      ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if2}
205 | |      ... | ${dut_to_tg_if2_mac}
206 | |      ... | ${lw_ipv6_src} | ${lw_rule_ipv6_dst}
207 | |      ... | ${test_ipv4_inside} | ${test_ipv4_inside}
208 | |      ... | ${test_2_port} | ${test_port}
209 | |      ... | ${tg_to_dut_if2_mac} | ${dut_to_tg_if2_mac}
210 | |      ... | ${lw_rule_2_ipv6_dst} | ${lw_ipv6_src}