CSIT-353: Add basic map-t tests
[csit.git] / tests / func / softwire / map_t.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
15 *** Settings ***
16 | Resource | resources/libraries/robot/default.robot
17 | Resource | resources/libraries/robot/testing_path.robot
18 | Resource | resources/libraries/robot/ipv4.robot
19 | Resource | resources/libraries/robot/ipv6.robot
20 | Resource | resources/libraries/robot/map.robot
21 | Library  | resources.libraries.python.IPUtil
22 | Library  | resources.libraries.python.Trace
23 | Force Tags | HW_ENV | VM_ENV | 3_NODE_DOUBLE_LINK_TOPO
24 | Suite Setup | Run Keywords
25 | ... | Setup all DUTs before test | AND
26 | ... | Setup all TGs before traffic script
27 | Test Teardown | Run Keywords
28 | ... | Show packet trace on all DUTs | ${nodes} | AND
29 | ... | Show vpp trace dump on all DUTs
30 | Documentation | *Test for Basic mapping rule for MAP-T*\
31 | ... | *[Top] Network Topologies:* TG - DUT1 - TG with two links between the
32 | ... | nodes.
33 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-UDP on TG-to-DUT-if1.
34 | ... | Eth-IPv6-UDP on TG-to-DUT-if2.
35 | ... | *[Cfg] DUT configuration:* DUT is configured with IPv4 on one DUT-to-TG
36 | ... | interface and IPv6 address on second DUT-to-TG interface. MAP-T domain
37 | ... | is configured in test template based on test parameters.
38 | ... | *[Ver] TG verification:* UDP packets in IPv4 are sent by TG to
39 | ... | destination in MAP domain. IPv6 packets with translated IPv4 addresses
40 | ... | are received on TG interface.
41 | ... | *[Ref] Applicable standard specifications:* RFC7599
42
43
44 *** Variables ***
45 | ${dut_ip4}= | 10.0.0.1
46 | ${dut_ip6}= | 2001:0::1
47 | ${dut_ip4_gw}= | 10.0.0.2
48 | ${dut_ip6_gw}= | 2001:0::2
49 | ${ipv4_prefix_len}= | 24
50 | ${ipv6_prefix_len}= | 64
51 | ${ipv6_br_src}= | 2001:db8:ffff::/96
52
53
54 *** Test Cases ***
55 | TC01: MAP-T test
56 | | [Tags] | EXPECTED_FAILING
57 | | [Documentation] |
58 | | ... | Test to check map-t address translation.
59 | | [Setup] | Set interfaces IP addresses and routes
60 | | [Template] | Check MAP-T configuration with traffic script
61 # |===================|===============|================|============|=============|==========|===========|================|==========|
62 # | ipv4_pfx          | ipv6_dst_pfx  | ipv6_src_pfx   | ea_bit_len | psid_offset | psid_len | ipv4_src  | ipv4_dst       | dst_port |
63 # |===================|===============|================|============|=============|==========|===========|================|==========|
64 | | 20.169.0.0/16     | 2001:db8::/32 | ${ipv6_br_src} | ${12}      | ${6}        | ${8}     | 100.0.0.1 | 20.169.201.219 | ${1232}  |
65 | | 20.169.0.0/16     | 2001:db8::/16 | ${ipv6_br_src} | ${40}      | ${0}        | ${0}     | 100.0.0.1 | 20.169.201.219 | ${1232}  |
66 | | 20.169.201.219/32 | 2001:db8::/32 | ${ipv6_br_src} | ${0}       | ${0}        | ${0}     | 100.0.0.1 | 20.169.201.219 | ${1232}  |
67 | | 20.0.0.0/8        | 2001:db8::/40 | ${ipv6_br_src} | ${24}      | ${0}        | ${0}     | 100.0.0.1 | 20.169.201.219 | ${1232}  |
68
69
70 *** Keywords ***
71 | Set interfaces IP addresses and routes
72 | | Path for 2-node testing is set
73 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
74 | | Interfaces in 2-node path are up
75 | | IP addresses are set on interfaces
76 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4} | ${ipv4_prefix_len}
77 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6} | ${ipv6_prefix_len}
78 | | Vpp Route Add | ${dut_node} | :: | 0 | ${dut_ip6_gw} | ${dut_to_tg_if2}
79 | | ... | resolve_attempts=${NONE} | count=${NONE}
80 | | Add IP neighbor | ${dut_node} | ${dut_to_tg_if2} | ${dut_ip6_gw}
81 | | ... | ${tg_to_dut_if2_mac}
82 | | Vpp Route Add | ${dut_node} | 0.0.0.0 | 0 | ${dut_ip4_gw} | ${dut_to_tg_if1}
83 | | ... | resolve_attempts=${NONE} | count=${NONE}
84 | | Add IP neighbor | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip4_gw}
85 | | ... | ${tg_to_dut_if1_mac}
86
87 | Check MAP-T configuration with traffic script
88 | | [Documentation] |
89 | | ... | Used as a test case template.\
90 | | ... | Configure MAP-T domain with given parameters, with traffic script send
91 | | ... | UDP in IPv4 packet to given UDP destination port and IP destination
92 | | ... | address and check if correctly received IPv6 packet with translated
93 | | ... | source and destination addresses. Vice versa send IPv6 packet and
94 | | ... | check if received IPv4 packet with correct source and destination
95 | | ... | addresses.
96 | | ... | The MAP domain is deleted in teardown.
97 | | [Arguments] | ${ipv4_pfx} | ${ipv6_dst_pfx} | ${ipv6_src_pfx}
98 | | ... | ${ea_bit_len} | ${psid_offset} | ${psid_len}
99 | | ... | ${ipv4_outside} | ${ipv4_inside} | ${dst_port}
100 | | ${domain_index}= | Map Add Domain | ${dut_node} | ${ipv4_pfx}
101 | | ... | ${ipv6_dst_pfx} | ${ipv6_src_pfx} | ${ea_bit_len} | ${psid_offset}
102 | | ... | ${psid_len} | ${TRUE}
103 | | ${ipv6_ce_addr}= | Compute IPv6 map destination address
104 | | ... | ${ipv4_pfx} | ${ipv6_dst_pfx} | ${ea_bit_len} | ${psid_offset}
105 | | ... | ${psid_len} | ${ipv4_inside} | ${dst_port}
106 | | ${ipv6_br_addr}= | Compute IPv6 map source address
107 | | ... | ${ipv6_src_pfx} | ${ipv4_outside}
108 # Check translation from v4 to v6 with traffic script
109 | | Send IPv4 UDP and check IPv6 headers for MAP-T
110 | | ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
111 | | ... | ${dut_to_tg_if1_mac} | ${ipv4_inside} | ${ipv4_outside} | ${dst_port}
112 | | ... | ${tg_to_dut_if2_mac} | ${dut_to_tg_if2_mac}
113 | | ... | ${ipv6_ce_addr} | ${ipv6_br_addr}
114 # Check translation from v6 to v4 with traffic script
115 | | Send IPv6 UDP and check IPv4 headers for MAP-T
116 | | ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if1}
117 | | ... | ${dut_to_tg_if2_mac}
118 | | ... | ${ipv6_br_addr} | ${ipv6_ce_addr}
119 | | ... | ${dst_port}
120 | | ... | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
121 | | ... | ${ipv4_outside} | ${ipv4_inside}
122 | | [Teardown] | Run Keywords
123 | | ... | Map Del Domain | ${dut_node} | ${domain_index} | AND
124 | | ... | Show packet trace on all DUTs | ${nodes} | AND
125 | | ... | Clear packet trace on all DUTs | ${nodes}