diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2020-04-23 01:00:39 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2020-05-07 16:52:22 +0000 |
commit | 424346c5880f49182ca4408f0d77486beeb5b64e (patch) | |
tree | cf9ba922013a0462eaff485f97d4bc781d8b9795 /resources/libraries/robot/shared/suite_setup.robot | |
parent | ad2b8085cddf859214301b19067f1297b2b685f5 (diff) |
perf: refactor 'setup suite topology interfaces'
- and 'setup suite topology interfaces no tg' to
use a common keyword to create suite variables
using the required topology information.
Change-Id: I46894948bc86eb7ce72d036e5b84f09c5c1385db
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'resources/libraries/robot/shared/suite_setup.robot')
-rw-r--r-- | resources/libraries/robot/shared/suite_setup.robot | 91 |
1 files changed, 33 insertions, 58 deletions
diff --git a/resources/libraries/robot/shared/suite_setup.robot b/resources/libraries/robot/shared/suite_setup.robot index 0b1c0caa29..05e8fe8e91 100644 --- a/resources/libraries/robot/shared/suite_setup.robot +++ b/resources/libraries/robot/shared/suite_setup.robot @@ -24,15 +24,10 @@ | Resource | resources/libraries/robot/wrk/wrk_utils.robot | | Documentation | Suite setup keywords. - *** Keywords *** -| Setup suite topology interfaces +| Create suite topology variables | | [Documentation] -| | ... | Common suite setup for one to multiple link tests. -| | ... | -| | ... | Compute path for testing on given topology nodes in circular topology -| | ... | based on interface model provided as an argument and set -| | ... | corresponding suite variables. +| | ... | Create suite topology variables | | | | ... | _NOTE:_ This KW sets various suite variables based on filtered | | ... | topology. All variables are set with also backward compatibility @@ -62,38 +57,47 @@ | | ... | Type: list | | | | ... | *Arguments:* -| | ... | - ${actions} - Additional setup action. Type: list +| | ... | - @{actions} - Additional setup action. Type: list | | | | [Arguments] | @{actions} | | -| | ${nic_model_list}= | Create list | ${nic_name} -| | &{info}= | Compute Circular Topology -| | ... | ${nodes} | filter_list=${nic_model_list} | nic_pfs=${nic_pfs} -| | ${variables}= | Get Dictionary Keys | ${info} +| | ${variables}= | Get Dictionary Keys | ${topology_info} | | FOR | ${variable} | IN | @{variables} -| | | ${value}= | Get From Dictionary | ${info} | ${variable} +| | | ${value}= | Get From Dictionary | ${topology_info} | ${variable} | | | Set Suite Variable | ${${variable}} | ${value} | | END | | FOR | ${action} | IN | @{actions} | | | Run Keyword | Additional Suite setup Action For ${action} | | END -| Setup suite single link no tg +| Setup suite topology interfaces | | [Documentation] -| | ... | Common suite setup for single link tests. +| | ... | Common suite setup for one to multiple link tests. | | ... | -| | ... | Compute path for testing on two given nodes in circular topology +| | ... | Compute path for testing on given topology 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} +| | &{info}= | Compute Circular Topology +| | ... | ${nodes} | filter_list=${nic_model_list} | nic_pfs=${nic_pfs} +| | ... | always_same_link=${False} | topo_has_tg=${True} +| | Set suite variable | &{topology_info} | &{info} +| | Create suite topology variables | @{actions} + +| Setup suite topology interfaces with no TG +| | [Documentation] +| | ... | Common suite setup for single link tests with no traffic generator +| | ... | node. +| | ... | +| | ... | Compute path for testing on given topology nodes in circular topology +| | ... | based on interface model provided as an argument and set +| | ... | corresponding suite variables. | | | | ... | *Arguments:* | | ... | - ${actions} - Additional setup action. Type: list @@ -101,40 +105,11 @@ | | [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=${TRUE} -| | 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 +| | &{info}= | Compute Circular Topology +| | ... | ${nodes} | filter_list=${nic_model_list} | nic_pfs=${nic_pfs} +| | ... | always_same_link=${True} | topo_has_tg=${False} +| | Set suite variable | &{topology_info} | &{info} +| | Create suite topology variables | @{actions} | Additional Suite Setup Action For scapy | | [Documentation] |