New version of RF tests.
[csit.git] / resources / libraries / robot / bridge_domain.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 | Library | resources/libraries/python/VatExecutor.py
16 | Library | resources/libraries/python/VatConfigGenerator.py
17 | Library | resources.libraries.python.topology.Topology
18 | Library | resources/libraries/python/TrafficScriptExecutor.py
19 | Variables | resources/libraries/python/constants.py
20
21 *** Variables ***
22 | ${VAT_BD_TEMPLATE} | ${Constants.RESOURCES_TPL_VAT}/l2_bridge_domain.vat
23 | ${VAT_BD_GEN_FILE} | ${Constants.RESOURCES_TPL_VAT}/l2_bridge_domain_gen.vat
24 | ${VAT_BD_REMOTE_PATH} | ${Constants.REMOTE_FW_DIR}/l2_bridge_domain_gen.vat
25
26 *** Keywords ***
27 | Setup l2 bridge on node "${node}" via links "${link_names}"
28 | | ${interface_config}= | Get Interfaces By Link Names | ${node} | ${link_names}
29 | | ${commands}= | Generate Vat Config File | ${VAT_BD_TEMPLATE} | ${interface_config} | ${VAT_BD_GEN_FILE}
30 | | Copy Config To Remote | ${node} | ${VAT_BD_GEN_FILE} | ${VAT_BD_REMOTE_PATH}
31 # TODO: will be removed once v4 is merged to master.
32 | | Execute Script | l2_bridge_domain_gen.vat | ${node} | json_out=False
33 | | Script Should Have Passed
34
35 | Send traffic on node "${node}" from link "${link1}" to link "${link2}"
36 | | ${src_port}= | Get Interface By Link Name | ${node} | ${link1}
37 | | ${dst_port}= | Get Interface By Link Name | ${node} | ${link2}
38 | | ${src_ip}= | Set Variable | 192.168.100.1
39 | | ${dst_ip}= | Set Variable | 192.168.100.2
40 | | ${src_mac}= | Get Node Link Mac | ${node} | ${link1}
41 | | ${dst_mac}= | Get Node Link Mac | ${node} | ${link2}
42 | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
43 | | Run Traffic Script On Node | send_ip_icmp.py | ${node} | ${args}
44
45 | Setup TG "${tg}" DUT1 "${dut1}" and DUT2 "${dut2}" for 3 node l2 bridge domain test
46 | | ${DUT1_DUT2_link}= | Get first active connecting link between node "${dut1}" and "${dut2}"
47 | | ${DUT1_TG_link}= | Get first active connecting link between node "${dut1}" and "${tg}"
48 | | ${DUT2_TG_link}= | Get first active connecting link between node "${dut2}" and "${tg}"
49 | | ${tg_traffic_links}= | Create List | ${DUT1_TG_link} | ${DUT2_TG_link}
50 | | ${DUT1_BD_links}= | Create_list | ${DUT1_DUT2_link} | ${DUT1_TG_link}
51 | | ${DUT2_BD_links}= | Create_list | ${DUT1_DUT2_link} | ${DUT2_TG_link}
52 | | Setup l2 bridge on node "${dut1}" via links "${DUT1_BD_links}"
53 | | Setup l2 bridge on node "${dut2}" via links "${DUT2_BD_links}"
54 | | [Return] | ${tg_traffic_links}