CSIT-158: Tap interface tests
[csit.git] / tests / suites / gre / gre_encapsulation.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/gre.robot
19 | Resource | resources/libraries/robot/traffic.robot
20 | Library  | resources.libraries.python.IPUtil
21 | Library  | resources.libraries.python.Trace
22 | Force Tags | VM_ENV | HW_ENV
23 | Test Setup | Run Keywords | Setup all DUTs before test
24 | ...        | AND          | Setup all TGs before traffic script
25 | Test Teardown | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
26 | ...           | AND          | Show vpp trace dump on all DUTs
27 | Documentation | *GREoIPv4 test cases*
28 | ...
29 | ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
30 | ... | between nodes; TG-DUT1-DUT2-TG 3-node circular topology with single
31 | ... | links between nodes.
32 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-GRE-IPv4-ICMPv4 on DUT1-DUT2,
33 | ... | Eth-IPv4-ICMPv4 on TG-DUTn for routing over GRE tunnel; Eth-IPv4-ICMPv4
34 | ... | on TG_if1-DUT, Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT for GREoIPv4
35 | ... | encapsulation and decapsulation verification.
36 | ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with IPv4 routing
37 | ... | and static routes. GREoIPv4 tunnel is configured between DUT1 and DUT2.
38 | ... | *[Ver] TG verification:* Test ICMPv4 (or ICMPv6) Echo Request packets are
39 | ... | sent in both directions by TG on links to DUT1 and DUT2; GREoIPv4
40 | ... | encapsulation and decapsulation are verified separately by TG; on
41 | ... | receive TG verifies packets for correctness and their IPv4 (IPv6)
42 | ... | src-addr, dst-addr and MAC addresses.
43 | ... | *[Ref] Applicable standard specifications:* RFC2784.
44
45 *** Variables ***
46 | ${net1_address}= | 192.168.0.0
47 | ${net1_host_address}= | 192.168.0.100
48 | ${net1_gw_address}= | 192.168.0.1
49 | ${net2_address}= | 192.168.2.0
50 | ${net2_host_address}= | 192.168.2.100
51 | ${net2_gw_address}= | 192.168.2.1
52 | ${dut1_ip_address}= | 192.168.1.1
53 | ${dut2_ip_address}= | 192.168.1.2
54 | ${dut1_gre_ip}= | 172.16.0.1
55 | ${dut2_gre_ip}= | 172.16.0.2
56 | ${prefix}= | 24
57
58 *** Test Cases ***
59 | TC01: DUT1 and DUT2 route over GREoIPv4 tunnel between two TG links
60 | | [Documentation]
61 | | ... | [Top] TG-DUT1-DUT2-TG. [Enc] Eth-IPv4-GRE-IPv4-ICMPv4 on \
62 | | ... | DUT1-DUT2, Eth-IPv4-ICMPv4 on TG-DUTn. [Cfg] On DUT1 and DUT2
63 | | ... | configure GREoIPv4 tunnel with IPv4 routes towards each other.
64 | | ... | [Ver] Make TG send ICMPv4 Echo Req between its interfaces across
65 | | ... | both DUTs and GRE tunnel between them; verify IPv4 headers on
66 | | ... | received packets are correct. [Ref] RFC2784.
67 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | 3_NODE_DOUBLE_LINK_TOPO
68 | | Given Path for 3-node testing is set | ${nodes['TG']} | ${nodes['DUT1']}
69 | |       ... | ${nodes['DUT2']} | ${nodes['TG']}
70 | | And   Interfaces in 3-node path are up
71 | | And   IP addresses are set on interfaces
72 | |       ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_ip_address} | ${prefix}
73 | |       ... | ${dut1_node} | ${dut1_to_tg}   | ${net1_gw_address} | ${prefix}
74 | |       ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_ip_address} | ${prefix}
75 | |       ... | ${dut2_node} | ${dut2_to_tg}   | ${net2_gw_address} | ${prefix}
76 | | And   VPP IP Probe | ${dut1_node} | ${dut1_to_dut2} | ${dut2_ip_address}
77 | | And   VPP IP Probe | ${dut2_node} | ${dut2_to_dut1} | ${dut1_ip_address}
78 | | And   Add Arp On Dut | ${dut2_node} | ${dut2_to_tg} | ${net2_host_address}
79 | |       ... | ${tg_to_dut2_mac}
80 | | ${dut1_gre_interface} | ${dut1_gre_index}=
81 | | | ... | When GRE tunnel interface is created and up
82 | | |     |      ... | ${dut1_node} | ${dut1_ip_address} | ${dut2_ip_address}
83 | | ${dut2_gre_interface} | ${dut2_gre_index}=
84 | | | ... | And  GRE tunnel interface is created and up
85 | | |     |      ... | ${dut2_node} | ${dut2_ip_address} | ${dut1_ip_address}
86 | | And  IP addresses are set on interfaces
87 | |      ... | ${dut1_node} | ${dut1_gre_index} | ${dut1_gre_ip} | ${prefix}
88 | |      ... | ${dut2_node} | ${dut2_gre_index} | ${dut2_gre_ip} | ${prefix}
89 | | And  Vpp Route Add | ${dut1_node} | ${net2_address} | ${prefix}
90 | |      ... | ${dut2_gre_ip} | ${dut1_gre_index}
91 | | Then Send Packet And Check Headers | ${tg_node}
92 | |      ... | ${net1_host_address} | ${net2_host_address}
93 | |      ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
94 | |      ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
95
96 | TC02: DUT encapsulates IPv4 into GREoIPv4 tunnel - GRE header verification
97 | | [Documentation]
98 | | ... | [Top] TG=DUT1. [Enc] Eth-IPv4-ICMPv4 on TG_if1-DUT, \
99 | | ... | Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT. [Cfg] On DUT1 configure
100 | | ... | GREoIPv4 tunnel with IPv4 route towards TG. [Ver] Make TG send
101 | | ... | non-encapsulated ICMPv4 Echo Req to DUT; verify TG received
102 | | ... | GREoIPv4 encapsulated packet is correct. [Ref] RFC2784.
103 | | [Tags] | 3_NODE_DOUBLE_LINK_TOPO
104 | | Given Path for 2-node testing is set
105 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
106 | | And   Interfaces in 2-node path are up
107 | | And   IP addresses are set on interfaces
108 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut1_ip_address} | ${prefix}
109 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_gw_address} | ${prefix}
110 | | And  Add Arp On Dut | ${dut_node} | ${dut_to_tg_if2} | ${dut2_ip_address}
111 | |      ... | ${tg_to_dut_if2_mac}
112 | | ${dut1_gre_interface} | ${dut1_gre_index}=
113 | | | ... | When GRE tunnel interface is created and up
114 | | |     |      ... | ${dut_node} | ${dut1_ip_address} | ${dut2_ip_address}
115 | | And  IP addresses are set on interfaces
116 | |      ... | ${dut_node} | ${dut1_gre_index} | ${dut1_gre_ip} | ${prefix}
117 | | And  Vpp Route Add | ${dut_node} | ${net2_address} | ${prefix}
118 | |      ... | ${dut2_gre_ip} | ${dut1_gre_index}
119 | | Then Send ICMPv4 and check received GRE header
120 | |      ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
121 | |      ... | ${dut_to_tg_if1_mac} | ${tg_to_dut_if2_mac}
122 | |      ... | ${net1_host_address} | ${net2_host_address}
123 | |      ... | ${dut1_ip_address} | ${dut2_ip_address}
124
125 | TC03: DUT decapsulates IPv4 from GREoIPv4 tunnel - IPv4 header verification
126 | | [Documentation]
127 | | ... | [Top] TG=DUT1. [Enc] Eth-IPv4-ICMPv4 on TG_if1-DUT, \
128 | | ... | Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT. [Cfg] On DUT1 configure
129 | | ... | GREoIPv4 tunnel towards TG. [Ver] Make TG send ICMPv4 Echo Req
130 | | ... | encapsulated into GREoIPv4 towards VPP; verify TG received IPv4
131 | | ... | de-encapsulated packet is correct. [Ref] RFC2784.
132 | | [Tags] | 3_NODE_DOUBLE_LINK_TOPO
133 | | Given Path for 2-node testing is set
134 | |       ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
135 | | And   Interfaces in 2-node path are up
136 | | And   IP addresses are set on interfaces
137 | |       ... | ${dut_node} | ${dut_to_tg_if2} | ${dut1_ip_address} | ${prefix}
138 | |       ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_gw_address} | ${prefix}
139 | | And  Add Arp On Dut | ${dut_node} | ${dut_to_tg_if1} | ${net1_host_address}
140 | |      ... | ${tg_to_dut_if1_mac}
141 | | ${dut1_gre_interface} | ${dut1_gre_index}=
142 | | | ... | When GRE tunnel interface is created and up
143 | | |     |      ... | ${dut_node} | ${dut1_ip_address} | ${dut2_ip_address}
144 | | And  IP addresses are set on interfaces
145 | |      ... | ${dut_node} | ${dut1_gre_index} | ${dut1_gre_ip} | ${prefix}
146 | | Then Send GRE and check received ICMPv4 header
147 | |      ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if1}
148 | |      ... | ${dut_to_tg_if2_mac} | ${tg_to_dut_if1_mac}
149 | |      ... | ${net2_host_address} | ${net1_host_address}
150 | |      ... | ${dut2_ip_address} | ${dut1_ip_address}