CSIT-662: KWI - KW renaming
[csit.git] / resources / libraries / robot / gre.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/interfaces.robot
16
17 *** Keywords ***
18 | Create GRE tunnel interface and set it up
19 | | [Documentation] | Create GRE tunnel interface and set it up on defined VPP node and put \
20 | | ... | the interface to UP state.
21 | | ...
22 | | ... | *Arguments:*
23 | | ... | - dut_node - DUT node where to create GRE tunnel. Type: dictionary
24 | | ... | - source_ip_address - GRE tunnel source IP address. Type: string
25 | | ... | - destination_ip_address - GRE tunnel destination IP address.
26 | | ... |   Type: string
27 | | ...
28 | | ... | *Return:*
29 | | ... | - name - Name of created GRE tunnel interface. Type: string
30 | | ... | - index - SW interface index of created GRE tunnel interface.
31 | | ... |   Type: integer
32 | | ...
33 | | ... | *Example:*
34 | | ...
35 | | ... | \| ${gre_name} \| ${gre_index}= \
36 | | ... | \| Create GRE tunnel interface and set it up \| ${dut} \
37 | | ... | \| 192.0.1.1 \| 192.0.1.2 \|
38 | | ...
39 | | [Arguments] | ${dut_node} | ${source_ip_address} | ${destination_ip_address}
40 | | ${name} | ${index}= | Create GRE tunnel interface
41 | | ... | ${dut_node} | ${source_ip_address} | ${destination_ip_address}
42 | | Set Interface State | ${dut_node} | ${index} | up
43 | | [Return] | ${name} | ${index}
44
45
46 | Send ICMPv4 and check received GRE header
47 | | [Documentation] | Send ICMPv4 packet and check if received packed contains \
48 | | ... | correct GRE, IP, MAC headers.
49 | | ...
50 | | ... | *Arguments:*
51 | | ... | - tg_node - Node where to run traffic script. Type: dictionary
52 | | ... | - tx_if - Interface from where send ICPMv4 packet. Type: string
53 | | ... | - rx_if - Interface where to receive GRE packet. Type: string
54 | | ... | - tx_dst_mac - Destination MAC address of ICMP packet. Type: string
55 | | ... | - rx_dst_mac - Expected destination MAC address of GRE packet.
56 | | ... |   Type: string
57 | | ... | - inner_src_ip - Source IP address of ICMP packet. Type: string
58 | | ... | - inner_dst_ip - Destination IP address of ICMP packet.
59 | | ... |   Type: string
60 | | ... | - outer_src_ip - Source IP address of GRE packet. Type: string
61 | | ... | - outer_dst_ip - Destination IP address of GRE packet.
62 | | ... |   Type: string
63 | | ...
64 | | ... | *Return:*
65 | | ... | - No value returned
66 | | ...
67 | | ... | *Example:*
68 | | ...
69 | | ... | \| Send ICMPv4 and check received GRE header \
70 | | ... | \| ${tg_node} \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \
71 | | ... | \| ${tx_dst_mac} \| ${rx_dst_mac} \| ${net1_host_address} \
72 | | ... | \| ${net2_host_address} \| ${dut1_ip_address} \| ${dut2_ip_address} \|
73 | | ...
74 | | [Arguments] | ${tg_node} | ${tx_if} | ${rx_if}
75 | | ... | ${tx_dst_mac} | ${rx_dst_mac}
76 | | ... | ${inner_src_ip} | ${inner_dst_ip}
77 | | ... | ${outer_src_ip} | ${outer_dst_ip}
78 | | ${tx_if_name}= | Get interface name | ${tg_node} | ${tx_if}
79 | | ${rx_if_name}= | Get interface name | ${tg_node} | ${rx_if}
80 | | ${args}= | Catenate | --tx_if | ${tx_if_name} | --rx_if | ${rx_if_name}
81 | | ... | --tx_dst_mac | ${tx_dst_mac} | --rx_dst_mac | ${rx_dst_mac}
82 | | ... | --inner_src_ip | ${inner_src_ip} | --inner_dst_ip | ${inner_dst_ip}
83 | | ... | --outer_src_ip | ${outer_src_ip} | --outer_dst_ip | ${outer_dst_ip}
84 | | Run Traffic Script On Node
85 | | ... | send_icmp_check_gre_headers.py | ${tg_node} | ${args}
86
87
88 | Send GRE and check received ICMPv4 header
89 | | [Documentation] | Send IPv4 ICMPv4 packet encapsulated into GRE and \
90 | | ... | check IP, MAC headers on received packed.
91 | | ...
92 | | ... | *Arguments:*
93 | | ... | - tg_node - Node where to run traffic script. Type: dictionary
94 | | ... | - tx_if - Interface from where send ICPMv4 packet. Type: string
95 | | ... | - rx_if - Interface where receive GRE packet. Type: string
96 | | ... | - tx_dst_mac - Destination MAC address of GRE packet. Type: string
97 | | ... | - rx_dst_mac - Expected destination MAC address of ICMP packet.
98 | | ... |   Type: string
99 | | ... | - inner_src_ip - Source IP address of ICMP packet. Type: string
100 | | ... | - inner_dst_ip - Destination IP address of ICMP packet.
101 | | ... |   Type: string
102 | | ... | - outer_src_ip - Source IP address of GRE packet. Type: string
103 | | ... | - outer_dst_ip - Destination IP address of  GRE packet.
104 | | ... |   Type: string
105 | | ...
106 | | ... | *Return:*
107 | | ... | - No value returned
108 | | ...
109 | | ... | *Example:*
110 | | ...
111 | | ... | \| Send GRE and check received ICMPv4 header \| ${tg_node} \
112 | | ... | \| ${tg_to_dut_if2} \| ${tg_to_dut_if1} \| ${tx_dst_mac} \
113 | | ... | \| ${rx_dst_mac} \| ${net2_host_address} \| ${net1_host_address} \
114 | | ... | \| ${dut2_ip_address} \| ${dut1_ip_address} \|
115 | | ...
116 | | [Arguments] | ${tg_node} | ${tx_if} | ${rx_if}
117 | | ... | ${tx_dst_mac} | ${rx_dst_mac}
118 | | ... | ${inner_src_ip} | ${inner_dst_ip}
119 | | ... | ${outer_src_ip} | ${outer_dst_ip}
120 | | ${tx_if_name}= | Get interface name | ${tg_node} | ${tx_if}
121 | | ${rx_if_name}= | Get interface name | ${tg_node} | ${rx_if}
122 | | ${args}= | Catenate | --tx_if | ${tx_if_name} | --rx_if | ${rx_if_name}
123 | | ... | --tx_dst_mac | ${tx_dst_mac} | --rx_dst_mac | ${rx_dst_mac}
124 | | ... | --inner_src_ip | ${inner_src_ip} | --inner_dst_ip | ${inner_dst_ip}
125 | | ... | --outer_src_ip | ${outer_src_ip} | --outer_dst_ip | ${outer_dst_ip}
126 | | Run Traffic Script On Node
127 | | ... | send_gre_check_icmp_headers.py | ${tg_node} | ${args}
128
129 | Send GRE and check received GRE header
130 | | [Documentation] | Send IPv4 UDP packet encapsulated into GRE and \
131 | | ... | check if received packed contains correct MAC GRE, IP, UDP headers.
132 | | ...
133 | | ... | *Arguments:*
134 | | ... | - tg_node - Node where to run traffic script. Type: dictionary
135 | | ... | - tx_if - Interface from where send GRE packet. Type: string
136 | | ... | - rx_if - Interface where to receive GRE packet. Type: string
137 | | ... | - tx_dst_mac - Destination MAC address of transferred packet.
138 | | ... |   Type: string
139 | | ... | - tx_src_mac - Source MAC address of transferred packet. Type: string
140 | | ... | - tx_outer_dst_ip - Destination IP address of GRE packet. Type: string
141 | | ... | - tx_outer_src_ip - Source IP address of GRE packet. Type: string
142 | | ... | - tx_inner_dst_ip - Destination IP address of UDP packet. Type: string
143 | | ... | - tx_inner_src_ip - Source IP address of UDP packet. Type: string
144 | | ... | - rx_dst_mac - Expected destination MAC address. Type: string
145 | | ... | - rx_src_mac - Expected source MAC address. Type: string
146 | | ... | - rx_outer_dst_ip - Expected destination IP address of received GRE
147 | | ... |   packet. Type: string
148 | | ... | - rx_outer_src_ip - Expected source IP address of received GRE
149 | | ... |   packet. Type: string
150 | | ...
151 | | ... | __Note:__
152 | | ... | rx_inner_dst_ip and rx_inner_src_ip should be same as transferred
153 | | ...
154 | | ... | *Return:*
155 | | ... | - No value returned
156 | | ...
157 | | ... | *Example:*
158 | | ... | \| Send GRE and check received GRE header \| ${tg_node} \
159 | | ... | \| port3 \| port3 \| 08:00:27:f3:be:f0 \| 08:00:27:46:2b:4c \
160 | | ... | \| 10.0.0.1 \| 10.0.0.2 \| 192.168.3.100 \| 192.168.2.100 \
161 | | ... | \| 08:00:27:46:2b:4c \| 08:00:27:f3:be:f0 \| 10.0.0.3 \| 10.0.0.1 \|
162 | | ...
163 | | [Arguments] | ${tg_node} | ${tx_if} | ${rx_if}
164 | | ... | ${tx_dst_mac} | ${tx_src_mac}
165 | | ... | ${tx_outer_dst_ip} | ${tx_outer_src_ip}
166 | | ... | ${tx_inner_dst_ip} | ${tx_inner_src_ip}
167 | | ... | ${rx_dst_mac} | ${rx_src_mac}
168 | | ... | ${rx_outer_dst_ip} | ${rx_outer_src_ip}
169 | | ${tx_if_name}= | Get interface name | ${tg_node} | ${tx_if}
170 | | ${rx_if_name}= | Get interface name | ${tg_node} | ${rx_if}
171 | | ${args}= | Catenate | --tx_if | ${tx_if_name} | --rx_if | ${rx_if_name}
172 | | ... | --tx_dst_mac | ${tx_dst_mac} | --tx_src_mac | ${tx_src_mac}
173 | | ... | --tx_outer_dst_ip | ${tx_outer_dst_ip}
174 | | ... | --tx_outer_src_ip | ${tx_outer_src_ip}
175 | | ... | --tx_inner_dst_ip | ${tx_inner_dst_ip}
176 | | ... | --tx_inner_src_ip | ${tx_inner_src_ip}
177 | | ... | --rx_dst_mac | ${rx_dst_mac}
178 | | ... | --rx_src_mac | ${rx_src_mac}
179 | | ... | --rx_outer_dst_ip | ${rx_outer_dst_ip}
180 | | ... | --rx_outer_src_ip | ${rx_outer_src_ip}
181 | | Run Traffic Script On Node
182 | | ... | send_gre_check_gre_headers.py | ${tg_node} | ${args}