diff options
Diffstat (limited to 'resources/libraries/robot/shared')
-rw-r--r-- | resources/libraries/robot/shared/container.robot | 73 | ||||
-rw-r--r-- | resources/libraries/robot/shared/default.robot | 168 | ||||
-rw-r--r-- | resources/libraries/robot/shared/suite_setup.robot | 246 | ||||
-rw-r--r-- | resources/libraries/robot/shared/suite_teardown.robot | 2 | ||||
-rw-r--r-- | resources/libraries/robot/shared/test_setup.robot | 57 | ||||
-rw-r--r-- | resources/libraries/robot/shared/test_teardown.robot | 27 |
6 files changed, 455 insertions, 118 deletions
diff --git a/resources/libraries/robot/shared/container.robot b/resources/libraries/robot/shared/container.robot index c1ab1af18d..0b2fcd489b 100644 --- a/resources/libraries/robot/shared/container.robot +++ b/resources/libraries/robot/shared/container.robot @@ -181,3 +181,76 @@ | | ... | all DUT nodes. | | ... | | Run Keyword | ${group}.Destroy all containers + +| Start containers for performance test +| | [Documentation] +| | ... | Start containers for performance test. +| | ... +| | ... | *Arguments:* +| | ... | - nf_chains: Total number of chains. Type: integer +| | ... | - nf_nodes: Total number of nodes per chain. Type: integer +| | ... | - auto_scale - If True, use same amount of Dataplane threads for +| | ... | network function as DUT, otherwise use single physical core for +| | ... | every network function. Type: boolean +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Set up performance test with containers \| 1 \| 1 \| +| | ... +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${auto_scale}=${True} +| | ... +| | Set Test Variable | @{container_groups} | @{EMPTY} +| | Set Test Variable | ${container_group} | CNF +| | Set Test Variable | ${nf_nodes} +| | Import Library | resources.libraries.python.ContainerUtils.ContainerManager +| | ... | engine=${container_engine} | WITH NAME | ${container_group} +| | Construct chains of containers on all DUTs | ${nf_chains} | ${nf_nodes} +| | ... | auto_scale=${auto_scale} +| | Acquire all '${container_group}' containers +| | Create all '${container_group}' containers +| | Configure VPP in all '${container_group}' containers +| | Stop VPP service on all DUTs | ${nodes} +| | Start VPP in all '${container_group}' containers +| | Restart VPP service on all DUTs | ${nodes} +| | Verify VPP on all DUTs | ${nodes} +| | Save VPP PIDs +| | Append To List | ${container_groups} | ${container_group} + +| Start containers for device test +| | [Documentation] +| | ... | Start containers for device test. +| | ... +| | ... | *Arguments:* +| | ... | - nf_chains: Total number of chains (Optional). Type: integer, default +| | ... | value: ${1} +| | ... | - nf_nodes: Total number of nodes per chain (Optional). Type: integer, +| | ... | default value: ${1} +| | ... +| | ... | _NOTE:_ This KW sets following test case variables: +| | ... | - dcr_uuid - Parent container UUID. +| | ... | - dcr_root - Parent container overlay. +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Set up functional test with containers \| 1 \| 1 \| +| | ... +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} +| | ... +| | Set Test Variable | @{container_groups} | @{EMPTY} +| | Set Test Variable | ${container_group} | CNF +| | Import Library | resources.libraries.python.ContainerUtils.ContainerManager +| | ... | engine=${container_engine} | WITH NAME | ${container_group} +| | ... +| | ${dcr_uuid}= | Get Environment Variable | CSIT_DUT1_UUID +| | ${dcr_root}= | Run Keyword | Get Docker Mergeddir | ${nodes['DUT1']} +| | ... | ${dcr_uuid} +| | Set Test Variable | ${dcr_uuid} +| | Set Test Variable | ${dcr_root} +| | ... +| | Construct chains of containers on all DUTs | ${nf_chains} | ${nf_nodes} +| | ... | nested=${True} +| | Acquire all '${container_group}' containers +| | Create all '${container_group}' containers +| | Configure VPP in all '${container_group}' containers +| | Start VPP in all '${container_group}' containers +| | Append To List | ${container_groups} | ${container_group} diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot index b7e4a75773..31c4ae3e0a 100644 --- a/resources/libraries/robot/shared/default.robot +++ b/resources/libraries/robot/shared/default.robot @@ -33,18 +33,18 @@ | Library | resources.libraries.python.Trace | Library | resources.libraries.python.topology.Topology | ... +| Resource | resources/libraries/robot/crypto/ipsec.robot +| Resource | resources/libraries/robot/performance/performance_configuration.robot +| Resource | resources/libraries/robot/performance/performance_limits.robot +| Resource | resources/libraries/robot/performance/performance_utils.robot | Resource | resources/libraries/robot/shared/container.robot | Resource | resources/libraries/robot/shared/qemu.robot | Resource | resources/libraries/robot/shared/suite_teardown.robot +| Resource | resources/libraries/robot/shared/suite_setup.robot | Resource | resources/libraries/robot/shared/test_teardown.robot - +| Resource | resources/libraries/robot/shared/test_setup.robot *** Keywords *** -| Configure all TGs for traffic script -| | [Documentation] | Prepare all TGs before traffic scripts execution. -| | ... -| | All TGs Set Interface Default Driver | ${nodes} - | Show Vpp Errors On All DUTs | | [Documentation] | Show VPP errors verbose on all DUTs. | | ... @@ -59,14 +59,6 @@ | | :FOR | ${dut} | IN | @{duts} | | | Vpp Get Bridge Domain Data | ${nodes['${dut}']} -| Setup Scheduler Policy for Vpp On All DUTs -| | [Documentation] | Set realtime scheduling policy (SCHED_RR) with priority 1 -| | ... | on all VPP worker threads on all DUTs. -| | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* -| | :FOR | ${dut} | IN | @{duts} -| | | Set VPP Scheduling rr | ${nodes['${dut}']} - | Configure crypto device on all DUTs | | [Documentation] | Verify if Crypto QAT device virtual functions are | | ... | initialized on all DUTs. If parameter force_init is set to True, then @@ -85,37 +77,10 @@ | | ... | | [Arguments] | ${crypto_type} | ${numvfs} | ${force_init}=${False} | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Crypto Device Verify | ${nodes['${dut}']} | ${crypto_type} | | | ... | ${numvfs} | force_init=${force_init} -| Configure AVF interfaces on all DUTs -| | [Documentation] | Configure virtual functions for AVF interfaces on PCI -| | ... | interface on all DUTs. -| | ... -| | ... | *Arguments:* -| | ... | - numvfs - Number of VFs to initialize, 0 - disable the VFs -| | ... | (Optional). Type: integer, default value: ${1} -| | ... | - osi_layer - OSI Layer type to initialize TG with. -| | ... | (Optional). Type: string, default value: L2 -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Configure AVF device on all DUTs \| ${1} \| L2 \| -| | ... -| | [Arguments] | ${numvfs}=${1} | ${osi_layer}=L2 -| | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* -| | :FOR | ${dut} | IN | @{duts} -| | | ${if1_avf_arr}= | Init AVF interface | ${nodes['${dut}']} | ${${dut}_if1} -| | | ... | numvfs=${numvfs} | osi_layer=${osi_layer} -| | | ${if2_avf_arr}= | Init AVF interface | ${nodes['${dut}']} | ${${dut}_if2} -| | | ... | numvfs=${numvfs} | osi_layer=${osi_layer} -# Currently only one AVF is supported. -| | | Set Suite Variable | ${${dut}_if1_vf0} | ${if1_avf_arr[0]} -| | | Set Suite Variable | ${${dut}_if2_vf0} | ${if2_avf_arr[0]} - | Configure kernel module on all DUTs | | [Documentation] | Verify if specific kernel module is loaded on all DUTs. | | ... | If parameter force_load is set to True, then try to load. @@ -136,7 +101,6 @@ | Create base startup configuration of VPP on all DUTs | | [Documentation] | Create base startup configuration of VPP to all DUTs. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Import Library | resources.libraries.python.VppConfigGenerator | | | ... | WITH NAME | ${dut} @@ -176,7 +140,6 @@ | | ... | | ${cpu_count_int} | Convert to Integer | ${phy_cores} | | ${thr_count_int} | Convert to Integer | ${phy_cores} -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error | | | ... | Variable Should Exist | ${${dut}_if1} @@ -241,7 +204,6 @@ | | ... | | ${cpu_count_int} | Convert to Integer | ${phy_cores} | | ${thr_count_int} | Convert to Integer | ${phy_cores} -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']} | | | ... | ${${dut}_if1} | ${${dut}_if2} @@ -289,17 +251,68 @@ | | ... | cpu_skip=${cpu_skip} | filename=/tmp/vnf${i}.conf | | ... | i=${i_int} +| Add PCI devices to all DUTs +| | [Documentation] +| | ... | Add PCI devices to VPP configuration file. +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | ${if1_status} | ${value}= | Run Keyword And Ignore Error +| | | ... | Variable Should Exist | ${${dut}_if1} +| | | ${if1_pci}= | Run Keyword If | '${if1_status}' == 'PASS' +| | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1} +| | | ${if1_1_pci}= | Run Keyword Unless | '${if1_status}' == 'PASS' +| | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1_1} +| | | ${if1_2_pci}= | Run Keyword Unless | '${if1_status}' == 'PASS' +| | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1_2} +| | | ${if2_status} | ${value}= | Run Keyword And Ignore Error +| | | ... | Variable Should Exist | ${${dut}_if2} +| | | ${if2_pci}= | Run Keyword If | '${if2_status}' == 'PASS' +| | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if2} +| | | ${if2_1_pci}= | Run Keyword Unless | '${if2_status}' == 'PASS' +| | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if2_1} +| | | ${if2_2_pci}= | Run Keyword Unless | '${if2_status}' == 'PASS' +| | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if2_2} +| | | @{pci_devs}= | Run Keyword If | '${if1_status}' == 'PASS' +| | | ... | Create List | ${if1_pci} +| | | ... | ELSE +| | | ... | Create List | ${if1_1_pci} | ${if1_2_pci} +| | | Run Keyword If | '${if2_status}' == 'PASS' +| | | ... | Append To List | ${pci_devs} | ${if2_pci} +| | | ... | ELSE +| | | ... | Append To List | ${pci_devs} | ${if2_1_pci} | ${if2_2_pci} +| | | Run keyword | ${dut}.Add DPDK Dev | @{pci_devs} +| | | Run Keyword If | '${if1_status}' == 'PASS' +| | | ... | Set Test Variable | ${${dut}_if1_pci} | ${if1_pci} +| | | Run Keyword Unless | '${if1_status}' == 'PASS' +| | | ... | Set Test Variable | ${${dut}_if1_1_pci} | ${if1_1_pci} +| | | Run Keyword Unless | '${if1_status}' == 'PASS' +| | | ... | Set Test Variable | ${${dut}_if1_2_pci} | ${if1_2_pci} +| | | Run Keyword If | '${if2_status}' == 'PASS' +| | | ... | Set Test Variable | ${${dut}_if2_pci} | ${if2_pci} +| | | Run Keyword Unless | '${if2_status}' == 'PASS' +| | | ... | Set Test Variable | ${${dut}_if2_1_pci} | ${if2_1_pci} +| | | Run Keyword Unless | '${if2_status}' == 'PASS' +| | | ... | Set Test Variable | ${${dut}_if2_2_pci} | ${if2_2_pci} + +| Add single PCI device to all DUTs +| | [Documentation] +| | ... | Add single (first) PCI device on DUT1 and single (last) PCI device on +| | ... | DUT2 to VPP configuration file. +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | ${if1_pci}= | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1} +| | | Run keyword | ${dut}.Add DPDK Dev | ${if1_pci} +| | | Set Test Variable | ${${dut}_if1_pci} | ${if1_pci} + | Add no multi seg to all DUTs | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Run keyword | ${dut}.Add DPDK No Multi Seg | Add DPDK no PCI to all DUTs | | [Documentation] | Add DPDK no-pci to VPP startup configuration to all DUTs. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Run keyword | ${dut}.Add DPDK no PCI @@ -316,7 +329,6 @@ | | ... | | [Arguments] | ${rxd} | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Run keyword | ${dut}.Add DPDK Dev Default RXD | ${rxd} @@ -333,7 +345,6 @@ | | ... | | [Arguments] | ${txd} | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Run keyword | ${dut}.Add DPDK Dev Default TXD | ${txd} @@ -350,14 +361,12 @@ | | ... | | [Arguments] | ${uio_driver} | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Run keyword | ${dut}.Add DPDK Uio Driver | ${uio_driver} | Add NAT to all DUTs | | [Documentation] | Add NAT configuration to all DUTs. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Run keyword | ${dut}.Add NAT @@ -372,7 +381,7 @@ | | ... | \| Add cryptodev to all DUTs \| ${4} \| | | ... | | [Arguments] | ${count} -| | ${duts}= | Get Matches | ${nodes} | DUT* +| | ... | | :FOR | ${dut} | IN | @{duts} | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']} | | | ${thr_count_int}= | Run keyword if | ${smt_used} @@ -413,7 +422,6 @@ | Write startup configuration on all VPP DUTs | | [Documentation] | Write VPP startup configuration on all DUTs. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Run keyword | ${dut}.Write Config @@ -421,7 +429,6 @@ | | [Documentation] | Write VPP startup configuration and restart VPP on all | | ... | DUTs. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Run keyword | ${dut}.Apply Config | | Save VPP PIDs @@ -435,6 +442,7 @@ | | ... | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes} | | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids} +| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${key} | IN | @{keys} | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key} | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key} @@ -462,7 +470,7 @@ | | Verify Vpp On All Duts | ${nodes} | | VPP Enable Traces On All Duts | ${nodes} | | Save VPP PIDs -| | Configure all TGs for traffic script +| | All TGs Set Interface Default Driver | ${nodes} | | Update All Interface Data On All Nodes | ${nodes} | | Reset PAPI History On All DUTs | ${nodes} @@ -475,19 +483,6 @@ | | Vpp Show Errors On All DUTs | ${nodes} | | Verify VPP PID in Teardown -| Set up VPP device test -# TODO: Generalize this KW if it will not diverge from Functional derivate too -# much -| | [Documentation] | Common test setup for vpp-device tests. -| | ... -| | Restart Vpp Service On All Duts | ${nodes} -| | Verify Vpp On All Duts | ${nodes} -| | VPP Enable Traces On All Duts | ${nodes} -| | Save VPP PIDs -| | Configure all TGs for traffic script -| | Update All Interface Data On All Nodes | ${nodes} | skip_tg_udev=${True} -| | Reset PAPI History On All DUTs | ${nodes} - | Tear down LISP functional test | | [Documentation] | Common test teardown for functional tests with LISP. | | ... @@ -499,45 +494,6 @@ | | Vpp Show Errors On All DUTs | ${nodes} | | Verify VPP PID in Teardown -| Set up functional test with containers -| | [Documentation] -| | ... | Common test setup for functional tests with containers. -| | ... -| | ... | *Arguments:* -| | ... | - chains: Total number of chains (Optional). Type: integer, default -| | ... | value: ${1} -| | ... | - nodeness: Total number of nodes per chain (Optional). Type: integer, -| | ... | default value: ${1} -| | ... -| | ... | _NOTE:_ This KW sets following test case variables: -| | ... | - dcr_uuid - Parent container UUID. -| | ... | - dcr_root - Parent container overlay. -| | ... -| | ... | *Example:* -| | ... -| | ... | \| Set up functional test with containers \| 1 \| 1 \| -| | ... -| | [Arguments] | ${chains}=${1} | ${nodeness}=${1} -| | ... -| | Set Test Variable | @{container_groups} | @{EMPTY} -| | Set Test Variable | ${container_group} | CNF -| | Import Library | resources.libraries.python.ContainerUtils.ContainerManager -| | ... | engine=${container_engine} | WITH NAME | ${container_group} -| | ... -| | ${dcr_uuid}= | Get Environment Variable | CSIT_DUT1_UUID -| | ${dcr_root}= | Run Keyword | Get Docker Mergeddir | ${nodes['DUT1']} -| | ... | ${dcr_uuid} -| | Set Test Variable | ${dcr_uuid} -| | Set Test Variable | ${dcr_root} -| | ... -| | Construct chains of containers on all DUTs | ${chains} | ${nodeness} -| | ... | nested=${True} -| | Acquire all '${container_group}' containers -| | Create all '${container_group}' containers -| | Configure VPP in all '${container_group}' containers -| | Start VPP in all '${container_group}' containers -| | Append To List | ${container_groups} | ${container_group} - | Stop VPP Service on DUT | | [Documentation] | Stop the VPP service on the specified node. | | ... diff --git a/resources/libraries/robot/shared/suite_setup.robot b/resources/libraries/robot/shared/suite_setup.robot new file mode 100644 index 0000000000..30fb5ac206 --- /dev/null +++ b/resources/libraries/robot/shared/suite_setup.robot @@ -0,0 +1,246 @@ +# Copyright (c) 2019 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: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Keywords used in suite setups.""" + +*** Settings *** +| Library | resources.libraries.python.DPDK.DPDKTools +| Library | resources.libraries.python.InterfaceUtil +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.topology.Topology +| Library | resources.libraries.python.TrafficGenerator +| Library | resources.tools.wrk.wrk +| ... +| Documentation | Suite setup keywords. + +*** Keywords *** +| Setup suite single link +| | [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. +| | ... | - tg - TG node +| | ... | - tg_if1 - 1st TG interface towards DUT. +| | ... | - tg_if1_mac - 1st TG interface MAC address. +| | ... | - tg_if2 - 2nd TG interface towards DUT. +| | ... | - tg_if2_mac - 2nd TG interface MAC address. +| | ... | - 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} +| | Append Node | ${nodes['TG']} +| | ${duts}= | Get Matches | ${nodes} | DUT* +| | :FOR | ${dut} | IN | @{duts} +| | | Append Node | ${nodes['${dut}']} | filter_list=${nic_model_list} +| | Append Node | ${nodes['TG']} +| | Compute Path | always_same_link=${FALSE} +| | ${tg_if1} | ${tg}= | Next Interface +| | :FOR | ${dut} | IN | @{duts} +| | | ${dutx_if1} | ${dutx}= | Next Interface +| | | ${dutx_if2} | ${dutx}= | Next Interface +| | | ${dutx_if1_mac}= | Get Interface MAC | ${dutx} | ${dutx_if1} +| | | ${dutx_if2_mac}= | Get Interface MAC | ${dutx} | ${dutx_if2} +| | | ${dut_str}= | Convert To Lowercase | ${dut} +| | | Set Suite Variable | ${${dut_str}} | ${dutx} +| | | Set Suite Variable | ${${dut_str}_if1} | ${dutx_if1} +| | | Set Suite Variable | ${${dut_str}_if2} | ${dutx_if2} +| | | Set Suite Variable | ${${dut_str}_if1_mac} | ${dutx_if1_mac} +| | | Set Suite Variable | ${${dut_str}_if2_mac} | ${dutx_if2_mac} +| | ${tg_if2} | ${tg}= | Next Interface +| | ${tg_if1_mac}= | Get Interface MAC | ${tg} | ${tg_if1} +| | ${tg_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2} +| | ${duts_count}= | Get Length | ${duts} +| | Set Suite Variable | ${duts} +| | Set Suite Variable | ${duts_count} +| | Set Suite Variable | ${tg} +| | Set Suite Variable | ${tg_if1} +| | Set Suite Variable | ${tg_if1_mac} +| | Set Suite Variable | ${tg_if2} +| | Set Suite Variable | ${tg_if2_mac} +| | :FOR | ${action} | IN | @{actions} +| | | Run Keyword | Additional Suite setup Action For ${action} + +| Setup suite double link +| | [Documentation] +| | ... | Common suite setup for double link tests. +| | ... | +| | ... | Compute path for testing on three given nodes in circular topology +| | ... | with double link between DUTs based on interface model provided as an +| | ... | argument and set corresponding suite variables. +| | ... +| | ... | *Arguments:* +| | ... | - ${actions} - Additional setup action. Type: list +| | ... +| | ... | _NOTE:_ This KW sets following suite variables: +| | ... | - duts - List of DUT nodes +| | ... | - duts_count - Number of DUT nodes. +| | ... | - tg - TG node +| | ... | - tg_if1 - 1st TG interface towards DUT. +| | ... | - tg_if1 - 1st TG interface MAC address. +| | ... | - tg_if2 - 2nd TG interface towards DUT. +| | ... | - tg_if2 - 2nd TG interface MAC address. +| | ... | - dut1 - DUT1 node +| | ... | - dut1_if1 - DUT1 interface towards TG. +| | ... | - dut1_if2_1 - DUT1 interface 1 towards DUT2. +| | ... | - dut1_if2_2 - DUT1 interface 2 towards DUT2. +| | ... | - dut2 - DUT2 node +| | ... | - dut2_if1_1 - DUT2 interface 1 towards DUT1. +| | ... | - dut2_if1_2 - DUT2 interface 2 towards DUT1. +| | ... | - dut2_if2 - DUT2 interface towards TG. +| | ... +| | [Arguments] | @{actions} +| | ... +| | ${nic_model_list}= | Create list | ${nic_name} +| | # Compute path TG - DUT1 with single link in between +| | Append Node | ${nodes['TG']} +| | Append Node | ${nodes['DUT1']} | filter_list=${nic_model_list} +| | Append Node | ${nodes['TG']} +| | Compute Path +| | ${tg_if1} | ${tg}= | Next Interface +| | ${dut1_if1} | ${dut1}= | Next Interface +| | # Compute path TG - DUT2 with single link in between +| | Clear Path +| | Append Node | ${nodes['TG']} +| | Append Node | ${nodes['DUT2']} | filter_list=${nic_model_list} +| | Append Node | ${nodes['TG']} +| | Compute Path +| | ${tg_if2} | ${tg}= | Next Interface +| | ${dut2_if2} | ${dut2}= | Next Interface +| | # Compute path DUT1 - DUT2 with double link in between +| | Clear Path +| | Append Node | ${nodes['DUT1']} | filter_list=${nic_model_list} +| | Append Node | ${nodes['DUT2']} | filter_list=${nic_model_list} +| | Append Node | ${nodes['DUT1']} | filter_list=${nic_model_list} +| | Compute Path | always_same_link=${FALSE} +| | ${dut1_if2_1} | ${dut1}= | First Interface +| | ${dut1_if2_2} | ${dut1}= | Last Interface +| | ${dut2_if1_1} | ${dut2}= | First Ingress Interface +| | ${dut2_if1_2} | ${dut2}= | Last Egress Interface +| | ${tg_if1_mac}= | Get Interface MAC | ${tg} | ${tg_if1} +| | ${tg_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2} +| | ${duts_count}= | Set Variable | 2 +| | ${duts}= | Get Matches | ${nodes} | DUT* +| | # Set suite variables +| | Set Suite Variable | ${duts} +| | Set Suite Variable | ${duts_count} +| | Set Suite Variable | ${tg} +| | Set Suite Variable | ${tg_if1} +| | Set Suite Variable | ${tg_if1_mac} +| | Set Suite Variable | ${tg_if2} +| | Set Suite Variable | ${tg_if2_mac} +| | Set Suite Variable | ${dut1} +| | Set Suite Variable | ${dut1_if1} +| | Set Suite Variable | ${dut1_if2_1} +| | Set Suite Variable | ${dut1_if2_2} +| | Set Suite Variable | ${dut2} +| | Set Suite Variable | ${dut2_if1_1} +| | Set Suite Variable | ${dut2_if1_2} +| | Set Suite Variable | ${dut2_if2} +| | :FOR | ${action} | IN | @{actions} +| | | Run Keyword | Additional Suite setup Action For ${action} + +| Additional Suite Setup Action For performance +| | [Documentation] +| | ... | Additional Setup for suites which uses performance measurement. +| | ... +| | Run Keyword If | ${duts_count} == 1 +| | ... | Initialize traffic generator | ${tg} | ${tg_if1} | ${tg_if2} +| | ... | ${dut1} | ${dut1_if1} | ${dut1} | ${dut1_if2} | ${osi_layer} +| | Run Keyword If | ${duts_count} == 2 +| | ... | Initialize traffic generator | ${tg} | ${tg_if1} | ${tg_if2} +| | ... | ${dut1} | ${dut1_if1} | ${dut2} | ${dut2_if2} | ${osi_layer} + +| Additional Suite Setup Action For dpdk +| | [Documentation] +| | ... | Additional Setup for suites which uses dpdk. +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | ${dut_str}= | Convert To Lowercase | ${dut} +| | | Initialize DPDK Environment | ${nodes['${dut}']} +| | | ... | ${${dut_str}_if1} | ${${dut_str}_if2} + +| Additional Suite Setup Action For performance_avf +| | [Documentation] +| | ... | Additional Setup for suites which uses performance measurement over +| | ... | SRIOV AVF. +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | ${if1_avf_arr}= | Init AVF interface | ${nodes['${dut}']} | ${${dut}_if1} +| | | ... | numvfs=${1} | osi_layer=${osi_layer} +| | | ${if2_avf_arr}= | Init AVF interface | ${nodes['${dut}']} | ${${dut}_if2} +| | | ... | numvfs=${1} | osi_layer=${osi_layer} +# Currently only one AVF is supported. +| | | Set Suite Variable | ${${dut}_if1_vf0} | ${if1_avf_arr[0]} +| | | Set Suite Variable | ${${dut}_if2_vf0} | ${if2_avf_arr[0]} +| | Run Keyword If | ${duts_count} == 1 +| | ... | Initialize traffic generator | ${tg} | ${tg_if1} | ${tg_if2} +| | ... | ${dut1} | ${dut1_if1_vf0} | ${dut1} | ${dut1_if2_vf0} | ${osi_layer} +| | Run Keyword If | ${duts_count} == 2 +| | ... | Initialize traffic generator | ${tg} | ${tg_if1} | ${tg_if2} +| | ... | ${dut1} | ${dut1_if1_vf0} | ${dut2} | ${dut2_if2_vf0} | ${osi_layer} + +| Additional Suite Setup Action For ipsechw +| | [Documentation] +| | ... | Additional Setup for suites which uses QAT HW. +| | ... +| | ${numvfs}= | Set Variable If +| | ... | '${crypto_type}' == 'HW_DH895xcc' | ${32} +| | ... | '${crypto_type}' == 'HW_C3xxx' | ${16} +| | Configure crypto device on all DUTs | ${crypto_type} | numvfs=${numvfs} +| | ... | force_init=${True} +| | Configure kernel module on all DUTs | vfio_pci | force_load=${True} + +| Additional Suite Setup Action For wrk +| | [Documentation] +| | ... | Additional Setup for suites which uses WRK TG. +| | ... +| | Iface update numa node | ${tg} +# Make sure TRex is stopped +| | ${running}= | Is TRex running | ${tg} +| | Run keyword if | ${running}==${True} | Teardown traffic generator | ${tg} +| | ${curr_driver}= | Get PCI dev driver | ${tg} +| | ... | ${tg['interfaces']['${tg_if1}']['pci_address']} +| | Run keyword if | '${curr_driver}'!='${None}' +| | ... | PCI Driver Unbind | ${tg} | +| | ... | ${tg['interfaces']['${tg_if1}']['pci_address']} +# Bind tg_if1 to driver specified in the topology +| | ${driver}= | Get Variable Value | ${tg['interfaces']['${tg_if1}']['driver']} +| | PCI Driver Bind | ${tg} +| | ... | ${tg['interfaces']['${tg_if1}']['pci_address']} | ${driver} +# 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 +| | Set Linux interface up | ${tg} | ${intf_name} +| | Install wrk | ${tg} diff --git a/resources/libraries/robot/shared/suite_teardown.robot b/resources/libraries/robot/shared/suite_teardown.robot index 1b738eaeef..e5db4f05d8 100644 --- a/resources/libraries/robot/shared/suite_teardown.robot +++ b/resources/libraries/robot/shared/suite_teardown.robot @@ -15,6 +15,7 @@ *** Settings *** | Library | resources.libraries.python.DPDK.DPDKTools +| Library | resources.libraries.python.TrafficGenerator | ... | Documentation | Suite teardown keywords. @@ -41,7 +42,6 @@ | | [Documentation] | | ... | Additional teardown for suites which uses dpdk. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Cleanup DPDK Environment | | | ... | ${nodes['${dut}']} | ${${dut}_if1} | ${${dut}_if2} diff --git a/resources/libraries/robot/shared/test_setup.robot b/resources/libraries/robot/shared/test_setup.robot new file mode 100644 index 0000000000..17e9e6c459 --- /dev/null +++ b/resources/libraries/robot/shared/test_setup.robot @@ -0,0 +1,57 @@ +# Copyright (c) 2019 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: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Keywords used in test setups.""" + +*** Settings *** +| Library | resources.libraries.python.PapiHistory +| ... +| Documentation | Test Setup keywords. + +*** Keywords *** +| Setup test +| | [Documentation] +| | ... | Common test setup for tests. +| | ... +| | ... | *Arguments:* +| | ... | - ${actions} - Additional setup action. Type: list +| | ... +| | [Arguments] | @{actions} +| | ... +| | Reset PAPI History On All DUTs | ${nodes} +| | Create base startup configuration of VPP on all DUTs +| | :FOR | ${action} | IN | @{actions} +| | | Run Keyword | Additional Test Setup Action For ${action} + +| Additional Test Setup Action For namespace +| | [Documentation] +| | ... | Additional Setup for tests which uses namespace. +| | ... +| | :FOR | ${dut} | IN | @{duts} +| | | Clean Up Namespaces | ${nodes['${dut}']} + +| Additional Test Setup Action For ligato +| | [Documentation] +| | ... | Additional Setup for tests which uses Ligato Kubernetes. +| | ... +| | Apply Kubernetes resource on all duts | ${nodes} | namespaces/csit.yaml +| | Apply Kubernetes resource on all duts | ${nodes} | pods/kafka.yaml +| | Apply Kubernetes resource on all duts | ${nodes} | pods/etcdv3.yaml +| | Apply Kubernetes resource on all duts | ${nodes} +| | ... | configmaps/vswitch-agent-cfg.yaml +| | Apply Kubernetes resource on all duts | ${nodes} +| | ... | configmaps/vnf-agent-cfg.yaml +| | Apply Kubernetes resource on all duts | ${nodes} +| | ... | pods/contiv-sfc-controller.yaml +| | Apply Kubernetes resource on all duts | ${nodes} +| | ... | pods/contiv-vswitch.yaml diff --git a/resources/libraries/robot/shared/test_teardown.robot b/resources/libraries/robot/shared/test_teardown.robot index e30aa9f41e..f95e369b65 100644 --- a/resources/libraries/robot/shared/test_teardown.robot +++ b/resources/libraries/robot/shared/test_teardown.robot @@ -14,6 +14,11 @@ """Keywords used in test teardowns.""" *** Settings *** +| Resource | resources/libraries/robot/shared/container.robot +| Resource | resources/libraries/robot/shared/qemu.robot +| Library | resources.libraries.python.PapiHistory +| Library | resources.libraries.python.topology.Topology +| ... | Documentation | Test teardown keywords. *** Keywords *** @@ -28,8 +33,10 @@ | | ... | | Remove All Added Ports On All DUTs From Topology | ${nodes} | | Show PAPI History On All DUTs | ${nodes} -| | Get Core Files on All Nodes | ${nodes} -| | Verify VPP PID in Teardown +| | Run Keyword If Test Failed +| | ... | Get Core Files on All Nodes | ${nodes} +| | Run Keyword If Test Failed +| | ... | Verify VPP PID in Teardown | | :FOR | ${action} | IN | @{actions} | | | Run Keyword | Additional Test Tear Down Action For ${action} @@ -59,7 +66,6 @@ | | [Documentation] | | ... | Additional teardown for tests which uses vhost(s) and VM(s). | | ... -| | # TODO: Remove IF condition once devicetest is running KernelVM. | | Show VPP vhost on all DUTs | ${nodes} | | Run Keyword If | "PERFTEST" in @{TEST TAGS} | vnf_manager.Kill All VMs | | Run Keyword If | "DEVICETEST" in @{TEST TAGS} | vm_node.Qemu Kill @@ -68,15 +74,14 @@ | | [Documentation] | | ... | Additional teardown for tests which uses NAT feature. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} -| | | Show NAT verbose | ${nodes['${dut}']} +| | | Run Keyword If Test Failed +| | | ... | Show NAT verbose | ${nodes['${dut}']} | Additional Test Tear Down Action For namespace | | [Documentation] | | ... | Additional teardown for tests which uses namespace. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Clean Up Namespaces | ${nodes['${dut}']} @@ -84,7 +89,6 @@ | | [Documentation] | | ... | Additional teardown for tests which uses linux_bridge. | | ... -| | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Linux Del Bridge | ${nodes['${dut}']} | ${bid_TAP} @@ -94,16 +98,16 @@ | | ... | | Run Keyword If Test Failed | | ... | Vpp Log Plugin Acl Settings | ${dut1} -| | Run Keyword If Test Failed | Run Keyword And Ignore Error +| | Run Keyword If Test Failed | | ... | Vpp Log Plugin Acl Interface Assignment | ${dut1} | Additional Test Tear Down Action For macipacl | | [Documentation] | | ... | Additional teardown for tests which uses MACIP ACL feature. | | ... -| | Run Keyword If Test Failed | Run Keyword And Ignore Error +| | Run Keyword If Test Failed | | ... | Vpp Log Macip Acl Settings | ${dut1} -| | Run Keyword And Ignore Error +| | Run Keyword If Test Failed | | ... | Vpp Log Macip Acl Interface Assignment | ${dut1} | Additional Test Tear Down Action For srv6 @@ -114,7 +118,8 @@ | | ... | Show SR Policies on all DUTs | ${nodes} | | Run Keyword If Test Failed | | ... | Show SR Steering Policies on all DUTs | ${nodes} -| | Run Keyword If Test Failed | Show SR LocalSIDs on all DUTs | ${nodes} +| | Run Keyword If Test Failed +| | ... | Show SR LocalSIDs on all DUTs | ${nodes} | Additional Test Tear Down Action For ligato | | [Documentation] |