b97a6d43607e1eaa263800f3365213ac9e1ea7ef
[csit.git] / resources / libraries / robot / 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 """Traffic keywords"""
15
16 *** Settings ***
17 | Library | resources.libraries.python.IPv6Util
18 | Library | resources.libraries.python.IPv6Setup
19 | Library | resources.libraries.python.TrafficScriptExecutor
20 | Library | resources.libraries.python.NodePath
21 | Library | resources.libraries.python.Routing
22 | Library | resources.libraries.python.InterfaceUtil
23 | Library | resources.libraries.python.topology.Topology
24 | Resource | resources/libraries/robot/default.robot
25 | Resource | resources/libraries/robot/counters.robot
26 | Documentation | Traffic keywords
27
28 *** Keywords ***
29 | Send Packet And Check Headers
30 | | [Documentation] | Sends packet from IP (with source mac) to IP
31 | | ...             | (with dest mac). There has to be 4 MAC addresses
32 | | ...             | when using 2 node +
33 | | ...             | xconnect (one for each eth).
34 | | ...
35 | | ... | *Arguments:*
36 | | ...
37 | | ... | _NOTE:_ Arguments are based on example:
38 | | ...             | TG(if1)->(if1)DUT(if2)->TG(if2)
39 | | ...
40 | | ... | - {tg_node} : Node to execute scripts on (TG). Type: dictionary
41 | | ... | - {src_ip} - IP of source interface (TG-if1). Type: int
42 | | ... | - {dst_ip} - IP of destination interface (TG-if2). Type: int
43 | | ... | - {tx_src_port} - Interface of TG-if1. Type: string
44 | | ... | - {tx_src_mac} - MAC address of TG-if1. Type: string
45 | | ... | - {tx_dst_mac} - MAC address of DUT-if1. Type: string
46 | | ... | - {rx_port} - Interface of TG-if1. Type: string
47 | | ... | - {rx_src_mac} - MAC address of DUT1-if2. Type: string
48 | | ... | - {rx_dst_mac} - MAC address of TG-if2. Type: string
49 | | ...
50 | | ... | *Return:*
51 | | ... | - No value returned
52 | | ...
53 | | ... | *Example:*
54 | | ...
55 | | ... | \| Send Packet And Check Headers \| ${nodes['TG']} \| 10.0.0.1 \
56 | | ... | \| 32.0.0.1 \| eth2 \| 08:00:27:ee:fd:b3 \| 08:00:27:a2:52:5b \
57 | | ... | \| eth3 \| 08:00:27:4d:ca:7a \| 08:00:27:7d:fd:10 \|
58 | | ...
59 | | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_src_port} |
60 | | ... | ${tx_src_mac} | ${tx_dst_mac} | ${rx_port} | ${rx_src_mac}
61 | | ... | ${rx_dst_mac}
62 | | ${args}= | Catenate | --tg_src_mac | ${tx_src_mac} | --tg_dst_mac |
63 | | ... | ${rx_dst_mac} | --dut_if1_mac | ${tx_dst_mac} | --dut_if2_mac |
64 | | ... | ${rx_src_mac} | --src_ip | ${src_ip} | --dst_ip | ${dst_ip} |
65 | | ... | --tx_if | ${tx_src_port} | --rx_if | ${rx_port}
66 | | Run Traffic Script On Node | send_icmp_check_headers.py | ${tg_node} |
67 | | ... | ${args}
68
69 | Send packet from Port to Port should failed
70 | | [Documentation] | Sends packet from ip (with specified mac) to ip
71 | | ...             | (with dest mac). Using keyword : Send packet And Check
72 | | ...             | Headers and subsequently checks the return value
73 | | ...
74 | | ... | *Arguments:*
75 | | ...
76 | | ... | _NOTE:_ Arguments are based on example:
77 | | ...             | TG(if1)->(if1)DUT(if2)->TG(if2)
78 | | ...
79 | | ... | - {tg_node} : Node to execute scripts on (TG). Type: dictionary
80 | | ... | - {src_ip} - IP of source interface (TG-if1). Type: int
81 | | ... | - {dst_ip} - IP of destination interface (TG-if2). Type: int
82 | | ... | - {tx_src_port} - Interface of TG-if1. Type: string
83 | | ... | - {tx_src_mac} - MAC address of TG-if1. Type: string
84 | | ... | - {tx_dst_mac} - MAC address of DUT-if1. Type: string
85 | | ... | - {rx_port} - Interface of TG-if1. Type: string
86 | | ... | - {rx_src_mac} - MAC address of DUT1-if2. Type: string
87 | | ... | - {rx_dst_mac} - MAC address of TG-if2. Type: string
88 | | ...
89 | | ... | *Return:*
90 | | ... | - No value returned
91 | | ...
92 | | ... | *Example:*
93 | | ...
94 | | ... | \| Send packet from Port to Port should failed \| ${nodes['TG']} \
95 | | ... | \| 10.0.0.1 \ \| 32.0.0.1 \| eth2 \| 08:00:27:ee:fd:b3 \
96 | | ... | \| 08:00:27:a2:52:5b \| eth3 \| 08:00:27:4d:ca:7a \
97 | | ... | \| 08:00:27:7d:fd:10 \|
98 | | [Arguments] | ${tg_node} | ${src_ip} | ${dst_ip} | ${tx_src_port} |
99 | | ... | ${tx_src_mac} | ${tx_dst_mac} | ${rx_port} | ${rx_src_mac} |
100 | | ... | ${rx_dst_mac}
101 | | ${args}= | Catenate | --tg_src_mac | ${tx_src_mac} | --tg_dst_mac |
102 | | ... | ${rx_dst_mac} | --dut_if1_mac | ${tx_dst_mac} | --dut_if2_mac |
103 | | ... | ${rx_src_mac} | --src_ip | ${src_ip} | --dst_ip | ${dst_ip} |
104 | | ... | --tx_if | ${tx_src_port} | --rx_if | ${rx_port}
105 | | Run Keyword And Expect Error | ICMP echo Rx timeout |
106 | | ... | Run Traffic Script On Node | send_icmp_check_headers.py
107 | | ... | ${tg_node} | ${args}
108 l