aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/shared
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/robot/shared')
-rw-r--r--resources/libraries/robot/shared/default.robot27
-rw-r--r--resources/libraries/robot/shared/suite_setup.robot77
-rw-r--r--resources/libraries/robot/shared/suite_teardown.robot19
3 files changed, 112 insertions, 11 deletions
diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot
index 3b8f2804c1..160ebc887b 100644
--- a/resources/libraries/robot/shared/default.robot
+++ b/resources/libraries/robot/shared/default.robot
@@ -1,4 +1,4 @@
-# Copyright (c) 2019 Cisco and/or its affiliates.
+# Copyright (c) 2020 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -113,6 +113,31 @@
| | Verify Kernel Module on All DUTs | ${nodes} | ${module}
| | ... | force_load=${force_load}
+| Get Keyname for DUT
+| | [Documentation]
+| | ... | Get the Keyname for the DUT in the keyname list.
+| | ... | Returns lowercase keyname value.
+| |
+| | ... | *Arguments:*
+| | ... | - dutx - DUT to find keyname. Type: dict
+| | ... | - dut_keys - DUT Keynames to search. Type: list
+| |
+| | ... | *Example:*
+| |
+| | ... | \| Get Keyname for DUT \| ${dutx} \| ${duts} \|
+| |
+| | [Arguments] | ${dutx} | ${dut_keys}
+| |
+| | FOR | ${key} | IN | @{dut_keys}
+| | | ${found_key} | ${value}= | Run Keyword and Ignore Error
+| | | ... | Dictionaries Should Be Equal | ${nodes['${key}']} | ${dutx}
+| | | Run Keyword If | '${found_key}' == 'PASS' | EXIT FOR LOOP
+| | END
+| | Run Keyword If | '${found_key}' != 'PASS'
+| | ... | Fail | Keyname for ${dutx} not found
+| | ${keyname}= | Convert To Lowercase | ${key}
+| | Return From Keyword | ${keyname}
+
| Create base startup configuration of VPP on all DUTs
| | [Documentation] | Create base startup configuration of VPP to all DUTs.
| |
diff --git a/resources/libraries/robot/shared/suite_setup.robot b/resources/libraries/robot/shared/suite_setup.robot
index 513cfe8045..0a78226962 100644
--- a/resources/libraries/robot/shared/suite_setup.robot
+++ b/resources/libraries/robot/shared/suite_setup.robot
@@ -1,4 +1,4 @@
-# Copyright (c) 2019 Cisco and/or its affiliates.
+# Copyright (c) 2020 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -20,6 +20,8 @@
| Library | resources.libraries.python.topology.Topology
| Library | resources.libraries.python.TrafficGenerator
| Library | resources.tools.wrk.wrk
+| Variables | resources/libraries/python/Constants.py
+| Resource | resources/libraries/robot/wrk/wrk_utils.robot
|
| Documentation | Suite setup keywords.
@@ -87,6 +89,64 @@
| | | Run Keyword | Additional Suite setup Action For ${action}
| | END
+| Setup suite single link no tg
+| | [Documentation]
+| | ... | Common suite setup for single link tests.
+| | ... |
+| | ... | Compute path for testing on two given nodes in circular topology
+| | ... | based on interface model provided as an argument and set
+| | ... | corresponding suite variables.
+| |
+| | ... | _NOTE:_ This KW sets following suite variables:
+| | ... | - duts - List of DUT nodes
+| | ... | - duts_count - Number of DUT nodes.
+| | ... | - dut{n} - DUTx node
+| | ... | - dut{n}_if1 - 1st DUT interface.
+| | ... | - dut{n}_if1_mac - 1st DUT interface MAC address.
+| | ... | - dut{n}_if2 - 2nd DUT interface.
+| | ... | - dut{n}_if2_mac - 2nd DUT interface MAC address.
+| |
+| | ... | *Arguments:*
+| | ... | - ${actions} - Additional setup action. Type: list
+| |
+| | [Arguments] | @{actions}
+| |
+| | ${nic_model_list}= | Create list | ${nic_name}
+| | ${duts}= | Get Matches | ${nodes} | DUT*
+| | FOR | ${dut} | IN | @{duts}
+| | | Append Node | ${nodes['${dut}']} | filter_list=${nic_model_list}
+| | END
+| | Append Node | ${nodes['@{duts}[0]']} | filter_list=${nic_model_list}
+| | Compute Path | always_same_link=${FALSE}
+| | FOR | ${i} | IN RANGE | 1 | ${DATAPATH_INTERFACES_MAX}
+| | | ${dutx_if} | ${dutx}= | Next Interface
+| | | Run Keyword If | '${dutx_if}' == 'None' | EXIT FOR LOOP
+| | | ${dutx_if_mac}= | Get Interface MAC | ${dutx} | ${dutx_if}
+| | | ${dutx_if_ip4_addr}= | Get Interface Ip4 | ${dutx} | ${dutx_if}
+| | | ${dutx_if_ip4_prefix_length}= | Get Interface Ip4 Prefix Length
+| | | ... | ${dutx} | ${dutx_if}
+| | | ${dut_str}= | Get Keyname For DUT | ${dutx} | ${duts}
+| | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
+| | | ... | Variable Should Exist | ${${dut_str}_if1}
+| | | ${if_name}= | Set Variable If | '${if1_status}' == 'PASS'
+| | | ... | if2 | if1
+| | | Set Suite Variable | ${${dut_str}} | ${dutx}
+| | | Set Suite Variable | ${${dut_str}_${if_name}} | ${dutx_if}
+| | | Set Suite Variable | ${${dut_str}_${if_name}_mac} | ${dutx_if_mac}
+| | | Set Suite Variable | ${${dut_str}_${if_name}_ip4_addr}
+| | | ... | ${dutx_if_ip4_addr}
+| | | Set Suite Variable | ${${dut_str}_${if_name}_ip4_prefix}
+| | | ... | ${dutx_if_ip4_prefix_length}
+| | END
+| | Run Keyword If | ${i}>${DATAPATH_INTERFACES_MAX}
+| | ... | Fatal Error | Datapath length exceeded
+| | ${duts_count}= | Get Length | ${duts}
+| | Set Suite Variable | ${duts}
+| | Set Suite Variable | ${duts_count}
+| | FOR | ${action} | IN | @{actions}
+| | | Run Keyword | Additional Suite setup Action For ${action}
+| | END
+
| Setup suite double link
| | [Documentation]
| | ... | Common suite setup for double link tests.
@@ -241,6 +301,7 @@
| | [Documentation]
| | ... | Additional Setup for suites which uses WRK TG.
| |
+| | Verify Program Installed | ${tg} | wrk
| | Iface update numa node | ${tg}
# Make sure TRex is stopped
| | ${running}= | Is TRex running | ${tg}
@@ -257,13 +318,11 @@
# Set IP on tg_if1
| | ${intf_name}= | Get Linux interface name | ${tg}
| | ... | ${tg['interfaces']['${tg_if1}']['pci_address']}
-| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.10.1 | 24
-| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.20.1 | 24
-| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.30.1 | 24
-| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.40.1 | 24
-| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.50.1 | 24
-| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.60.1 | 24
-| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.70.1 | 24
-| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.80.1 | 24
+| | FOR | ${ip_addr} | IN | @{wrk_ip_addrs}
+| | | ${ip_addr_on_intf}= | Linux interface has IP | ${tg} | ${intf_name}
+| | | ... | ${ip_addr} | ${wrk_ip_prefix}
+| | | Run Keyword If | ${ip_addr_on_intf}==${False} | Set Linux interface IP
+| | | ... | ${tg} | ${intf_name} | ${ip_addr} | ${wrk_ip_prefix}
+| | END
| | Set Linux interface up | ${tg} | ${intf_name}
| | Check wrk | ${tg}
diff --git a/resources/libraries/robot/shared/suite_teardown.robot b/resources/libraries/robot/shared/suite_teardown.robot
index 993d83838f..881f796284 100644
--- a/resources/libraries/robot/shared/suite_teardown.robot
+++ b/resources/libraries/robot/shared/suite_teardown.robot
@@ -1,4 +1,4 @@
-# Copyright (c) 2019 Cisco and/or its affiliates.
+# Copyright (c) 2020 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -48,3 +48,20 @@
| | | Cleanup DPDK Environment
| | | ... | ${nodes['${dut}']} | ${${dut}_if1} | ${${dut}_if2}
| | END
+
+| Additional Suite Tear Down Action For wrk
+| | [Documentation]
+| | ... | Additional teardown for suites which uses wrk.
+| |
+| | ${intf_name}= | Get Linux interface name | ${tg}
+| | ... | ${tg['interfaces']['${tg_if1}']['pci_address']}
+| | FOR | ${ip_addr} | IN | @{wrk_ip_addrs}
+| | | ${ip_addr_on_intf}= | Linux Interface Has IP | ${tg} | ${intf_name}
+| | | ... | ${ip_addr} | ${wrk_ip_prefix}
+| | | Run Keyword If | ${ip_addr_on_intf}==${True} | Delete Linux Interface IP
+| | | ... | ${tg} | ${intf_name} | ${ip_addr} | ${wrk_ip_prefix}
+| | END
+| | Run Keyword And Ignore Error | PCI Driver Unbind
+| | ... | ${tg} | ${tg['interfaces']['${tg_if1}']['pci_address']}
+| | Run Keyword And Ignore Error | PCI Driver Unbind
+| | ... | ${tg} | ${tg['interfaces']['${tg_if2}']['pci_address']}