Aligning FUNC/PERF keywords - Data driven
[csit.git] / resources / libraries / robot / shared / default.robot
index 09ca17d..57ee179 100644 (file)
@@ -24,6 +24,7 @@
 | Library | resources.libraries.python.CpuUtils
 | Library | resources.libraries.python.DUTSetup
 | Library | resources.libraries.python.L2Util
+| Library | resources.libraries.python.Namespaces
 | Library | resources.libraries.python.SchedUtils
 | Library | resources.libraries.python.Tap
 | Library | resources.libraries.python.TGSetup
 | 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/vm/qemu.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
+| Resource | resources/libraries/robot/shared/traffic.robot
 
 *** Keywords ***
-| Configure all DUTs before test
-| | [Documentation] | Setup all DUTs in topology before test execution.
-| | ...
-| | Setup All DUTs | ${nodes}
-
-| 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.
 | | ...
 | | :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
 | | ...
 | | [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.
 | 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}
 | | | Run keyword | ${dut}.Add DPDK Uio Driver
 | | | Run keyword | ${dut}.Add Heapsize | 4G
 | | | Run keyword | ${dut}.Add Statseg size | 4G
+| | | Run keyword | ${dut}.Add Statseg Per Node Counters | on
 | | | Run keyword | ${dut}.Add Plugin | disable | default
 | | | Run keyword | ${dut}.Add Plugin | enable | @{plugins_to_enable}
 | | | Run keyword | ${dut}.Add IP6 Hash Buckets | 2000000
 | | ...
 | | ${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}
 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
 | | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${CPU_CNT_MAIN}
 | | | ${skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN}
-| | | ${cpu_wt}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
+| | | ${cpu_wt}= | Run keyword if | ${cpu_count_int} > 0 |
+| | | ... | Cpu list per node str | ${nodes['${dut}']} | ${numa}
 | | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${cpu_count_int}
 | | | ... | smt_used=${smt_used}
 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
 | | | ... | Set variable | ${1}
 | | | ... | ELSE | Set variable | ${rxq_count_int}
-| | | Run keyword | ${dut}.Add CPU Main Core | ${cpu_main}
-| | | Run keyword | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
-| | | Run keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
+| | | Run keyword if | ${cpu_count_int} > 0
+| | | ... | ${dut}.Add CPU Main Core | ${cpu_main}
+| | | Run keyword if | ${cpu_count_int} > 0
+| | | ... | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
+| | | Run keyword
+| | | ... | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
 # For now there is no way to easily predict the number of buffers. Statically
 # doing maximum amount of buffers allowed by DPDK.
 | | | Run keyword if | ${smt_used}
 | | ...
 | | ${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}
 | | ... | 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
 
 | | ...
 | | [Arguments] | ${rxd}
 | | ...
-| | ${duts}= | Get Matches | ${nodes} | DUT*
 | | :FOR | ${dut} | IN | @{duts}
 | | | Run keyword | ${dut}.Add DPDK Dev Default RXD | ${rxd}
 
 | | ...
 | | [Arguments] | ${txd}
 | | ...
-| | ${duts}= | Get Matches | ${nodes} | DUT*
 | | :FOR | ${dut} | IN | @{duts}
 | | | Run keyword | ${dut}.Add DPDK Dev Default TXD | ${txd}
 
 | | ...
 | | [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
 
 | | ... | \| 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}
 | 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
 
 | | [Documentation] | Write VPP startup configuration and restart VPP on all
 | | ... | DUTs.
 | | ...
-| | ${duts}= | Get Matches | ${nodes} | DUT*
+| | ... | *Arguments:*
+| | ... | - with_trace - Enable packet trace after VPP restart Type: boolean
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Apply startup configuration on all VPP DUTs \| False \|
+| | ...
+| | [Arguments] | ${with_trace}=${False}
+| | ...
 | | :FOR | ${dut} | IN | @{duts}
 | | | Run keyword | ${dut}.Apply Config
+| | Save VPP PIDs
 | | Enable Coredump Limit VPP on All DUTs | ${nodes}
 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${True}
+| | Run keyword If | ${with_trace} | VPP Enable Traces On All Duts | ${nodes}
 
 | Save VPP PIDs
 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
 | | ...
 | | ${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}
-| | | Run Keyword If | ',' in '${pid}'
-| | | ... | FAIL | More then one VPP PID found on node ${key}: ${pid}
 | | Set Test Variable | ${setup_vpp_pids}
 
 | Verify VPP PID in Teardown
 | Set up functional test
 | | [Documentation] | Common test setup for functional tests.
 | | ...
-| | Configure all DUTs before test
+| | 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
+| | All TGs Set Interface Default Driver | ${nodes}
 | | Update All Interface Data On All Nodes | ${nodes}
 | | Reset PAPI History On All DUTs | ${nodes}
 
 | | 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.
-| | ...
-| | Configure all DUTs before test
-| | 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 VPP device test
-# TODO: Generalize this KW if it will not diverge from Functional derivate too
-# much
-| | [Documentation] | Common test teardown for vpp-device tests.
-| | ...
-| | Remove All Added Ports On All DUTs From Topology | ${nodes}
-| | Show Packet Trace on All DUTs | ${nodes}
-| | Show PAPI History On All DUTs | ${nodes}
-| | Vpp Show Errors On All DUTs | ${nodes}
-| | Verify VPP PID in Teardown
-
 | Tear down LISP functional test
 | | [Documentation] | Common test teardown for functional tests with LISP.
 | | ...
 | | Vpp Show Errors On All DUTs | ${nodes}
 | | Verify VPP PID in Teardown
 
-| Tear down LISP functional test with QEMU
-| | [Documentation] | Common test teardown for functional tests with LISP and\
-| | ... | QEMU.
-| | ...
-| | Remove All Added Ports On All DUTs From Topology | ${nodes}
-| | Show Packet Trace on All DUTs | ${nodes}
-| | Show PAPI History On All DUTs | ${nodes}
-| | Show Vpp Settings | ${nodes['DUT1']}
-| | Show Vpp Settings | ${nodes['DUT2']}
-| | Vpp Show Errors On All DUTs | ${nodes}
-| | Tear down QEMU
-| | Verify VPP PID in Teardown
-
-| Set up TAP functional test
-| | [Documentation] | Common test setup for functional tests with TAP.
-| | ...
-| | Set up functional test
-| | Clean Up Namespaces | ${nodes['DUT1']}
-
-| 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}
-
-| Tear down TAP functional test
-| | [Documentation] | Common test teardown for functional tests with TAP.
-| | ...
-| | Tear down functional test
-| | Clean Up Namespaces | ${nodes['DUT1']}
-
-| Tear down TAP functional test with Linux bridge
-| | [Documentation] | Common test teardown for functional tests with TAP and
-| | ... | a Linux bridge.
-| | ...
-| | ... | *Arguments:*
-| | ... | - bid_TAP - Bridge name. Type: string
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Tear down TAP functional test with Linux bridge \| ${bid_TAP} \|
-| | ...
-| | [Arguments] | ${bid_TAP}
-| | ...
-| | Tear down functional test
-| | Linux Del Bridge | ${nodes['DUT1']} | ${bid_TAP}
-| | Clean Up Namespaces | ${nodes['DUT1']}
-
-| Tear down functional test with container
-| | [Documentation]
-| | ... | Common test teardown for functional tests which uses containers.
-| | ...
-| | :FOR | ${container_group} | IN | @{container_groups}
-| | | Destroy all '${container_group}' containers
-
 | Stop VPP Service on DUT
 | | [Documentation] | Stop the VPP service on the specified node.
 | | ...