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