d8e24b8420631d7873d656fc50ef8fd08c217669
[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 | | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int}
48 | | ${dst_int_name}= | Get interface name | ${tg_node} | ${dst_int}
49 | | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name} | ${src_mac}
50 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
51 | | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args}
52
53 | Send and receive ICMP Packet should failed
54 | | [Documentation] | Send ICMPv4/ICMPv6 echo request from source interface to
55 | | ...             | destination interface and expect failure with
56 | | ...             | ICMP echo Rx timeout error message.
57 | | ...
58 | | ... | *Arguments:*
59 | | ...
60 | | ... | - tg_node - TG node. Type: dictionary
61 | | ... | - src_int - Source interface. Type: string
62 | | ... | - dst_int - Destination interface. Type: string
63 | | ... | - src_ip - Source IP address (Optional). Type: string
64 | | ... | - dst_ip - Destination IP address (Optional). Type: string
65 | | ...
66 | | ... | *Return:*
67 | | ...
68 | | ... | - No value returned
69 | | ...
70 | | ... | *Example:*
71 | | ...
72 | | ... | _NOTE:_ Default IP is IPv4
73 | | ...
74 | | ... | \| Send and receive ICMP Packet \| ${nodes['TG']} \
75 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
76 | | ...
77 | | [Arguments] | ${tg_node} | ${src_int} | ${dst_int} |
78 | | ... | ${src_ip}=192.168.100.1 | ${dst_ip}=192.168.100.2
79 | | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int}
80 | | ${dst_mac}= | Get Interface Mac | ${tg_node} | ${dst_int}
81 | | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int}
82 | | ${dst_int_name}= | Get interface name | ${tg_node} | ${dst_int}
83 | | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name} | ${src_mac}
84 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
85 | | Run Keyword And Expect Error | ICMP echo Rx timeout |
86 | | ... | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args}
87
88 | Send and receive ICMPv4 bidirectionally
89 | | [Documentation] | Send ICMPv4 echo request from both directions,
90 | | ...             | from interface1 to interface2 and
91 | | ...             | from interface2 to interface1.
92 | | ...
93 | | ... | *Arguments:*
94 | | ...
95 | | ... | - tg_node - TG node. Type: dictionary
96 | | ... | - src_int - Source interface. Type: string
97 | | ... | - dst_int - Destination interface. Type: string
98 | | ... | - src_ip - Source IP address (Optional). Type: string
99 | | ... | - dst_ip - Destination IP address (Optional). Type: string
100 | | ...
101 | | ... | *Return:*
102 | | ...
103 | | ... | - No value returned
104 | | ...
105 | | ... | *Example:*
106 | | ...
107 | | ... | \| Send and receive ICMPv4 bidirectionally \| ${nodes['TG']} \
108 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
109 | | ...
110 | | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=192.168.100.1 |
111 | | ... | ${dst_ip}=192.168.100.2
112 | | Send and receive ICMP Packet | ${tg_node} | ${int1} | ${int2} |
113 | | ... | ${src_ip} | ${dst_ip}
114 | | Send and receive ICMP Packet | ${tg_node} | ${int2} | ${int1} |
115 | | ... | ${dst_ip} | ${src_ip}
116
117 | Send and receive ICMPv6 bidirectionally
118 | | [Documentation] | Send ICMPv6 echo request from both directions,
119 | | ...             | from interface1 to interface2 and
120 | | ...             | from interface2 to interface1.
121 | | ...
122 | | ... | *Arguments:*
123 | | ...
124 | | ... | - tg_node - TG node. Type: dictionary
125 | | ... | - src_int - Source interface. Type: string
126 | | ... | - dst_int - Destination interface. Type: string
127 | | ... | - src_ip - Source IP address (Optional). Type: string
128 | | ... | - dst_ip - Destination IP address (Optional). Type: string
129 | | ...
130 | | ... | *Return:*
131 | | ...
132 | | ... | - No value returned
133 | | ...
134 | | ... | *Example:*
135 | | ...
136 | | ... | \| Send and receive ICMPv6 bidirectionally \| ${nodes['TG']} \
137 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
138 | | ...
139 | | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=3ffe:63::1 |
140 | | ... | ${dst_ip}=3ffe:63::2
141 | | Send and receive ICMP Packet | ${tg_node} | ${int1} | ${int2} |
142 | | ... | ${src_ip} | ${dst_ip}
143 | | Send and receive ICMP Packet | ${tg_node} | ${int2} | ${int1} |
144 | | ... | ${dst_ip} | ${src_ip}