1ddb6024fb3bcea4787ad9a0b07b583e197eb826
[csit.git] / resources / libraries / robot / l2_traffic.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 | Documentation | Keywords for send and receive different types of traffic through L2 network.
16 | Library | resources.libraries.python.topology.Topology
17 | Library | resources.libraries.python.TrafficScriptExecutor
18
19 *** Keywords ***
20 | Send and receive ICMP Packet
21 | | [Documentation] | Send ICMPv4/ICMPv6 echo request from source interface to
22 | | ...             | destination interface.
23 | | ...
24 | | ... | *Arguments:*
25 | | ...
26 | | ... | - tg_node - TG node. Type: dictionary
27 | | ... | - src_int - Source interface. Type: string
28 | | ... | - dst_int - Destination interface. Type: string
29 | | ... | - src_ip - Source IP address (Optional). Type: string
30 | | ... | - dst_ip - Destination IP address (Optional). Type: string
31 | | ...
32 | | ... | *Return:*
33 | | ...
34 | | ... | - No value returned
35 | | ...
36 | | ... | *Example:*
37 | | ...
38 | | ... | _NOTE:_ Default IP is IPv4
39 | | ...
40 | | ... | \| Send and receive ICMP Packet \| ${nodes['TG']} \
41 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
42 | | ...
43 | | [Arguments] | ${tg_node} | ${src_int} | ${dst_int} |
44 | | ... | ${src_ip}=192.168.100.1 | ${dst_ip}=192.168.100.2
45 | | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int}
46 | | ${dst_mac}= | Get Interface Mac | ${tg_node} | ${dst_int}
47 | | ${args}= | Traffic Script Gen Arg | ${dst_int} | ${src_int} | ${src_mac}
48 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
49 | | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args}
50
51 | Send and receive ICMP Packet should failed
52 | | [Documentation] | Send ICMPv4/ICMPv6 echo request from source interface to
53 | | ...             | destination interface and expect failure with
54 | | ...             | ICMP echo Rx timeout error message.
55 | | ...
56 | | ... | *Arguments:*
57 | | ...
58 | | ... | - tg_node - TG node. Type: dictionary
59 | | ... | - src_int - Source interface. Type: string
60 | | ... | - dst_int - Destination interface. Type: string
61 | | ... | - src_ip - Source IP address (Optional). Type: string
62 | | ... | - dst_ip - Destination IP address (Optional). Type: string
63 | | ...
64 | | ... | *Return:*
65 | | ...
66 | | ... | - No value returned
67 | | ...
68 | | ... | *Example:*
69 | | ...
70 | | ... | _NOTE:_ Default IP is IPv4
71 | | ...
72 | | ... | \| Send and receive ICMP Packet \| ${nodes['TG']} \
73 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
74 | | ...
75 | | [Arguments] | ${tg_node} | ${src_int} | ${dst_int} |
76 | | ... | ${src_ip}=192.168.100.1 | ${dst_ip}=192.168.100.2
77 | | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int}
78 | | ${dst_mac}= | Get Interface Mac | ${tg_node} | ${dst_int}
79 | | ${args}= | Traffic Script Gen Arg | ${dst_int} | ${src_int} | ${src_mac}
80 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
81 | | Run Keyword And Expect Error | ICMP echo Rx timeout |
82 | | ... | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args}
83
84 | Send and receive ICMPv4 bidirectionally
85 | | [Documentation] | Send ICMPv4 echo request from both directions,
86 | | ...             | from interface1 to interface2 and
87 | | ...             | from interface2 to interface1.
88 | | ...
89 | | ... | *Arguments:*
90 | | ...
91 | | ... | - tg_node - TG node. Type: dictionary
92 | | ... | - src_int - Source interface. Type: string
93 | | ... | - dst_int - Destination interface. Type: string
94 | | ... | - src_ip - Source IP address (Optional). Type: string
95 | | ... | - dst_ip - Destination IP address (Optional). Type: string
96 | | ...
97 | | ... | *Return:*
98 | | ...
99 | | ... | - No value returned
100 | | ...
101 | | ... | *Example:*
102 | | ...
103 | | ... | \| Send and receive ICMPv4 bidirectionally \| ${nodes['TG']} \
104 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
105 | | ...
106 | | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=192.168.100.1 |
107 | | ... | ${dst_ip}=192.168.100.2
108 | | Send and receive ICMP Packet | ${tg_node} | ${int1} | ${int2} |
109 | | ... | ${src_ip} | ${dst_ip}
110 | | Send and receive ICMP Packet | ${tg_node} | ${int2} | ${int1} |
111 | | ... | ${dst_ip} | ${src_ip}
112
113 | Send and receive ICMPv6 bidirectionally
114 | | [Documentation] | Send ICMPv6 echo request from both directions,
115 | | ...             | from interface1 to interface2 and
116 | | ...             | from interface2 to interface1.
117 | | ...
118 | | ... | *Arguments:*
119 | | ...
120 | | ... | - tg_node - TG node. Type: dictionary
121 | | ... | - src_int - Source interface. Type: string
122 | | ... | - dst_int - Destination interface. Type: string
123 | | ... | - src_ip - Source IP address (Optional). Type: string
124 | | ... | - dst_ip - Destination IP address (Optional). Type: string
125 | | ...
126 | | ... | *Return:*
127 | | ...
128 | | ... | - No value returned
129 | | ...
130 | | ... | *Example:*
131 | | ...
132 | | ... | \| Send and receive ICMPv6 bidirectionally \| ${nodes['TG']} \
133 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
134 | | ...
135 | | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=3ffe:63::1 |
136 | | ... | ${dst_ip}=3ffe:63::2
137 | | Send and receive ICMP Packet | ${tg_node} | ${int1} | ${int2} |
138 | | ... | ${src_ip} | ${dst_ip}
139 | | Send and receive ICMP Packet | ${tg_node} | ${int2} | ${int1} |
140 | | ... | ${dst_ip} | ${src_ip}