INMARSAT-54 Honeycomb configures PBB
[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 to send and receive different types of traffic \
16 | ...           | through L2 network.
17 | Library | resources.libraries.python.topology.Topology
18 | Library | resources.libraries.python.TrafficScriptExecutor
19
20 *** Keywords ***
21 | Send and receive ICMP Packet
22 | | [Documentation] | Send ICMPv4/ICMPv6 echo request from source interface to \
23 | | ...             | destination interface. Packet can be set with Dot1q or
24 | | ...             | Dot1ad tag(s) when required.
25 | | ...
26 | | ... | *Arguments:*
27 | | ...
28 | | ... | - tg_node - TG node. Type: dictionary
29 | | ... | - src_int - Source interface. Type: string
30 | | ... | - dst_int - Destination interface. Type: string
31 | | ... | - src_ip - Source IP address (Optional). Type: string
32 | | ... | - dst_ip - Destination IP address (Optional). Type: string
33 | | ... | - encaps - Encapsulation: Dot1q or Dot1ad (Optional). Type: string
34 | | ... | - vlan1 - VLAN (outer) tag (Optional). Type: integer
35 | | ... | - vlan2 - VLAN inner tag (Optional). Type: integer
36 | | ...
37 | | ... | *Return:*
38 | | ...
39 | | ... | - No value returned
40 | | ...
41 | | ... | *Example:*
42 | | ...
43 | | ... | _NOTE:_ Default IP is IPv4
44 | | ...
45 | | ... | \| Send and receive ICMP Packet \| ${nodes['TG']} \
46 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
47 | | ... | \| Send and receive ICMP Packet \| ${nodes['TG']} \| ${tg_to_dut1} \
48 | | ... | \| ${tg_to_dut2} \| encaps=Dot1q \| vlan1=100 \|
49 | | ... | \| Send and receive ICMP Packet \| ${nodes['TG']} \| ${tg_to_dut1} \
50 | | ... | \| ${tg_to_dut2} \| encaps=Dot1ad \| vlan1=110 \| vlan2=220 \|
51 | | ...
52 | | [Arguments] | ${tg_node} | ${src_int} | ${dst_int}
53 | | ... | ${src_ip}=192.168.100.1 | ${dst_ip}=192.168.100.2 | ${encaps}=${EMPTY}
54 | | ... | ${vlan1}=${EMPTY} | ${vlan2}=${EMPTY}
55 | | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int}
56 | | ${dst_mac}= | Get Interface Mac | ${tg_node} | ${dst_int}
57 | | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int}
58 | | ${dst_int_name}= | Get interface name | ${tg_node} | ${dst_int}
59 | | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name}
60 | | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
61 | | ${args1}= | Run Keyword Unless | '${encaps}' == '${EMPTY}' | Catenate
62 | | ... | --encaps ${encaps} | --vlan1 ${vlan1}
63 | | ${args2}= | Run Keyword Unless | '${vlan2}' == '${EMPTY}' | Set Variable
64 | | ... | --vlan2 ${vlan2}
65 | | ${args}= | Run Keyword If | '${args1}' == 'None' | Set Variable | ${args}
66 | | ... | ELSE IF | '${args2}' == 'None' | Catenate | ${args} | ${args1}
67 | | ... | ELSE | Catenate | ${args} | ${args1} | ${args2}
68 | | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args}
69
70 | Send and receive ICMP Packet should fail
71 | | [Documentation] | Send ICMPv4/ICMPv6 echo request from source interface to
72 | | ...             | destination interface and expect failure with
73 | | ...             | ICMP echo Rx timeout error message.
74 | | ...
75 | | ... | *Arguments:*
76 | | ...
77 | | ... | - tg_node - TG node. Type: dictionary
78 | | ... | - src_int - Source interface. Type: string
79 | | ... | - dst_int - Destination interface. Type: string
80 | | ... | - src_ip - Source IP address (Optional). Type: string
81 | | ... | - dst_ip - Destination IP address (Optional). Type: string
82 | | ...
83 | | ... | *Return:*
84 | | ...
85 | | ... | - No value returned
86 | | ...
87 | | ... | *Example:*
88 | | ...
89 | | ... | _NOTE:_ Default IP is IPv4
90 | | ...
91 | | ... | \| Send and receive ICMP Packet should fail\| ${nodes['TG']} \
92 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
93 | | ...
94 | | [Arguments] | ${tg_node} | ${src_int} | ${dst_int} |
95 | | ... | ${src_ip}=192.168.100.1 | ${dst_ip}=192.168.100.2
96 | | ${src_mac}= | Get Interface Mac | ${tg_node} | ${src_int}
97 | | ${dst_mac}= | Get Interface Mac | ${tg_node} | ${dst_int}
98 | | ${src_int_name}= | Get interface name | ${tg_node} | ${src_int}
99 | | ${dst_int_name}= | Get interface name | ${tg_node} | ${dst_int}
100 | | ${args}= | Traffic Script Gen Arg | ${dst_int_name} | ${src_int_name}
101 | | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
102 | | Run Keyword And Expect Error | ICMP echo Rx timeout |
103 | | ... | Run Traffic Script On Node | send_ip_icmp.py | ${tg_node} | ${args}
104
105 | Send and receive ICMPv4 bidirectionally
106 | | [Documentation] | Send ICMPv4 echo request from both directions,
107 | | ...             | from interface1 to interface2 and
108 | | ...             | from interface2 to interface1.
109 | | ...
110 | | ... | *Arguments:*
111 | | ...
112 | | ... | - tg_node - TG node. Type: dictionary
113 | | ... | - src_int - Source interface. Type: string
114 | | ... | - dst_int - Destination interface. Type: string
115 | | ... | - src_ip - Source IP address (Optional). Type: string
116 | | ... | - dst_ip - Destination IP address (Optional). Type: string
117 | | ...
118 | | ... | *Return:*
119 | | ...
120 | | ... | - No value returned
121 | | ...
122 | | ... | *Example:*
123 | | ...
124 | | ... | \| Send and receive ICMPv4 bidirectionally \| ${nodes['TG']} \
125 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
126 | | ...
127 | | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=192.168.100.1 |
128 | | ... | ${dst_ip}=192.168.100.2
129 | | Send and receive ICMP Packet | ${tg_node} | ${int1} | ${int2} |
130 | | ... | ${src_ip} | ${dst_ip}
131 | | Send and receive ICMP Packet | ${tg_node} | ${int2} | ${int1} |
132 | | ... | ${dst_ip} | ${src_ip}
133
134 | Send and receive ICMPv6 bidirectionally
135 | | [Documentation] | Send ICMPv6 echo request from both directions,
136 | | ...             | from interface1 to interface2 and
137 | | ...             | from interface2 to interface1.
138 | | ...
139 | | ... | *Arguments:*
140 | | ...
141 | | ... | - tg_node - TG node. Type: dictionary
142 | | ... | - src_int - Source interface. Type: string
143 | | ... | - dst_int - Destination interface. Type: string
144 | | ... | - src_ip - Source IP address (Optional). Type: string
145 | | ... | - dst_ip - Destination IP address (Optional). Type: string
146 | | ...
147 | | ... | *Return:*
148 | | ...
149 | | ... | - No value returned
150 | | ...
151 | | ... | *Example:*
152 | | ...
153 | | ... | \| Send and receive ICMPv6 bidirectionally \| ${nodes['TG']} \
154 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
155 | | ...
156 | | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=3ffe:63::1 |
157 | | ... | ${dst_ip}=3ffe:63::2
158 | | Send and receive ICMP Packet | ${tg_node} | ${int1} | ${int2} |
159 | | ... | ${src_ip} | ${dst_ip}
160 | | Send and receive ICMP Packet | ${tg_node} | ${int2} | ${int1} |
161 | | ... | ${dst_ip} | ${src_ip}