eac0be446ba8fe0465948c949e4d797c99bdb75c
[csit.git] / resources / libraries / robot / l2 / l2_traffic.robot
1 # Copyright (c) 2019 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 | Library | resources.libraries.python.topology.Topology
16 | Library | resources.libraries.python.TrafficScriptExecutor
17 | Documentation | Keywords to send and receive different types of traffic \
18 | ... | through L2 network.
19
20 *** Keywords ***
21 | Send IP packet and verify received packet
22 | | [Documentation] | Send IPv4/IPv6 packet 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 | | ... | - encaps_rx - Expected encapsulation on RX side: Dot1q or Dot1ad
37 | | ... | (Optional). Type: string
38 | | ... | - vlan1_rx - VLAN (outer) tag on RX side (Optional). Type: integer
39 | | ... | - vlan2_rx - VLAN inner tag on RX side (Optional). Type: integer
40 | |
41 | | ... | *Return:*
42 | |
43 | | ... | - No value returned
44 | |
45 | | ... | *Example:*
46 | |
47 | | ... | _NOTE:_ Default IP is IPv4
48 | |
49 | | ... | \| Send IP packet and verify received packet \| ${nodes['TG']} \
50 | | ... | \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
51 | | ... | \| Send IP packet and verify received packet \| ${nodes['TG']} \
52 | | ... | \| ${tg_to_dut1} \| ${tg_to_dut2} \| encaps=Dot1q \| vlan1=100 \|
53 | | ... | \| Send IP packet and verify received packet \| ${nodes['TG']} \
54 | | ... | \| ${tg_to_dut1} \| ${tg_to_dut2} \| encaps=Dot1ad \| vlan1=110 \
55 | | ... | \| vlan2=220 \|
56 | | ... | \| Send IP packet and verify received packet \| ${nodes['TG']} \
57 | | ... | \| ${tg_to_dut1} \| ${tg_to_dut2} \| encaps=Dot1q \| vlan1=110 \
58 | | ... | \| encaps_rx=Dot1q \|
59 | | ... | \| Send IP packet and verify received packet \| ${nodes['TG']} \
60 | | ... | \| ${tg_to_dut1} \| ${tg_to_dut2} \| encaps=Dot1q \| vlan1=110 \
61 | | ... | \| encaps_rx=Dot1q \| vlan1_rx=120 \|
62 | |
63 | | [Arguments] | ${tg_node} | ${tx_src_port} | ${rx_dst_port}
64 | | ... | ${src_ip}=192.168.100.1 | ${dst_ip}=192.168.100.2
65 | | ... | ${encaps}=${EMPTY} | ${vlan1}=${EMPTY} | ${vlan2}=${EMPTY}
66 | | ... | ${encaps_rx}=${EMPTY} | ${vlan1_rx}=${EMPTY} | ${vlan2_rx}=${EMPTY}
67 | |
68 | | ${tx_src_mac}= | Get Interface Mac | ${tg_node} | ${tx_src_port}
69 | | ${rx_dst_mac}= | Get Interface Mac | ${tg_node} | ${rx_dst_port}
70 | | Then Send packet and verify headers
71 | | ... | ${tg} | 192.168.0.1 | 192.168.0.2
72 | | ... | ${tx_src_port} | ${tx_src_mac} | ${rx_dst_mac}
73 | | ... | ${rx_dst_port} | ${tx_src_mac} | ${rx_dst_mac}
74 | | ... | encaps_tx=${encaps} | vlan_tx=${vlan1} | vlan_outer_tx=${vlan2}
75 | | ... | encaps_rx=${encaps_rx} | vlan_rx=${vlan1_rx}
76 | | ... | vlan_outer_rx=${vlan2_rx}
77
78 | Send IPv4 bidirectionally and verify received packets
79 | | [Documentation] | Send IPv4 packets from both directions,
80 | | ... | from interface1 to interface2 and from interface2 to interface1.
81 | |
82 | | ... | *Arguments:*
83 | |
84 | | ... | - tg_node - TG node. Type: dictionary
85 | | ... | - src_int - Source interface. Type: string
86 | | ... | - dst_int - Destination interface. Type: string
87 | | ... | - src_ip - Source IP address (Optional). Type: string
88 | | ... | - dst_ip - Destination IP address (Optional). Type: string
89 | |
90 | | ... | *Return:*
91 | |
92 | | ... | - No value returned
93 | |
94 | | ... | *Example:*
95 | |
96 | | ... | \| Send IPv4 bidirectionally and verify received packets \
97 | | ... | \| ${nodes['TG']} \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
98 | |
99 | | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=192.168.100.1 |
100 | | ... | ${dst_ip}=192.168.100.2
101 | |
102 | | Send IP packet and verify received packet
103 | | ... | ${tg_node} | ${int1} | ${int2} | ${src_ip} | ${dst_ip}
104 | | Send IP packet and verify received packet
105 | | ... | ${tg_node} | ${int2} | ${int1} | ${dst_ip} | ${src_ip}
106
107 | Send IPv6 bidirectionally and verify received packets
108 | | [Documentation] | Send IPv6 packets from both directions,
109 | | ... | from interface1 to interface2 and from interface2 to interface1.
110 | |
111 | | ... | *Arguments:*
112 | |
113 | | ... | - tg_node - TG node. Type: dictionary
114 | | ... | - src_int - Source interface. Type: string
115 | | ... | - dst_int - Destination interface. Type: string
116 | | ... | - src_ip - Source IP address (Optional). Type: string
117 | | ... | - dst_ip - Destination IP address (Optional). Type: string
118 | |
119 | | ... | *Return:*
120 | |
121 | | ... | - No value returned
122 | |
123 | | ... | *Example:*
124 | |
125 | | ... | \| Send IPv6 bidirectionally and verify received packets \
126 | | ... | \| ${nodes['TG']} \| ${tg_to_dut_if1} \| ${tg_to_dut_if2} \|
127 | |
128 | | [Arguments] | ${tg_node} | ${int1} | ${int2} | ${src_ip}=3ffe:63::1 |
129 | | ... | ${dst_ip}=3ffe:63::2
130 | |
131 | | Send IP packet and verify received packet
132 | | ... | ${tg_node} | ${int1} | ${int2} | ${src_ip} | ${dst_ip}
133 | | Send IP packet and verify received packet
134 | | ... | ${tg_node} | ${int2} | ${int1} | ${dst_ip} | ${src_ip}