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