4 Vhosts setup test
[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 | GRE tunnel interface is created and up
19 | | [Documentation] | Create GRE tunnel interface 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 | | ... | \| GRE tunnel interface is created and 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 | | ${args}= | Catenate | --tx_if | ${tx_if} | --rx_if | ${rx_if}
79 | | | ... | --tx_dst_mac | ${tx_dst_mac} | --rx_dst_mac | ${rx_dst_mac}
80 | | | ... | --inner_src_ip | ${inner_src_ip} | --inner_dst_ip | ${inner_dst_ip}
81 | | | ... | --outer_src_ip | ${outer_src_ip} | --outer_dst_ip | ${outer_dst_ip}
82 | | Run Traffic Script On Node
83 | | ... | send_icmp_check_gre_headers.py | ${tg_node} | ${args}
84
85
86 | Send GRE and check received ICMPv4 header
87 | | [Documentation] | Send ICMPv4 packet and check if received packed contains
88 | | ...             | correct GRE, IP, MAC headers.
89 | | ...
90 | | ... | *Arguments:*
91 | | ... | - ${tg_node} - Node where to run traffic script. Type: dictionary
92 | | ... | - ${tx_if} - Interface from where send ICPMv4 packet. Type: string
93 | | ... | - ${rx_if} - Interface where receive GRE packet. Type: string
94 | | ... | - ${tx_dst_mac} - Destination MAC address of GRE packet. Type: string
95 | | ... | - ${rx_dst_mac} - Expected destination MAC address of ICMP packet.
96 | | ... |   Type: string
97 | | ... | - ${inner_src_ip} - Source IP address of ICMP packet. Type: string
98 | | ... | - ${inner_dst_ip} - Destination IP address of ICMP packet.
99 | | ... |   Type: string
100 | | ... | - ${outer_src_ip} - Source IP address of GRE packet. Type: string
101 | | ... | - ${outer_dst_ip} - Destination IP address of  GRE packet.
102 | | ... |   Type: string
103 | | ...
104 | | ... | *Return:*
105 | | ... | - No value returned
106 | | ...
107 | | ... | *Example:*
108 | | ...
109 | | ... | \| Send GRE and check received ICMPv4 header \| ${tg_node} \
110 | | ... | \| ${tg_to_dut_if2} \| ${tg_to_dut_if1} \| ${tx_dst_mac} \
111 | | ... | \| ${rx_dst_mac} \| ${net2_host_address} \| ${net1_host_address} \
112 | | ... | \| ${dut2_ip_address} \| ${dut1_ip_address} \|
113 | | ...
114 | | [Arguments] | ${tg_node} | ${tx_if} | ${rx_if}
115 | | ...         | ${tx_dst_mac} | ${rx_dst_mac}
116 | | ...         | ${inner_src_ip} | ${inner_dst_ip}
117 | | ...         | ${outer_src_ip} | ${outer_dst_ip}
118 | | ${args}= | Catenate | --tx_if | ${tx_if} | --rx_if | ${rx_if}
119 | | | ... | --tx_dst_mac | ${tx_dst_mac} | --rx_dst_mac | ${rx_dst_mac}
120 | | | ... | --inner_src_ip | ${inner_src_ip} | --inner_dst_ip | ${inner_dst_ip}
121 | | | ... | --outer_src_ip | ${outer_src_ip} | --outer_dst_ip | ${outer_dst_ip}
122 | | Run Traffic Script On Node
123 | | ... | send_gre_check_icmp_headers.py | ${tg_node} | ${args}