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