FIX: IPsec
[csit.git] / resources / libraries / robot / shared / default.robot
index ab8a409..609da92 100644 (file)
@@ -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:
@@ -58,7 +58,6 @@
 | Resource | resources/libraries/robot/overlay/lisp.robot
 | Resource | resources/libraries/robot/overlay/lispgpe.robot
 | Resource | resources/libraries/robot/overlay/lisp_api.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/interfaces.robot
@@ -68,7 +67,6 @@
 | 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/testing_path.robot
 | Resource | resources/libraries/robot/shared/traffic.robot
 | Resource | resources/libraries/robot/shared/vm.robot
 
 | | 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.
 | |
 | | FOR | ${dut} | IN | @{duts}
 | | | Import Library | resources.libraries.python.VppConfigGenerator
 | | | ... | WITH NAME | ${dut}
-| | | Run keyword | ${dut}.Set Node |  ${nodes['${dut}']}
+| | | Run keyword | ${dut}.Set Node |  ${nodes['${dut}']} | node_key=${dut}
 | | | Run keyword | ${dut}.Add Unix Log
 | | | Run keyword | ${dut}.Add Unix CLI Listen
 | | | Run keyword | ${dut}.Add Unix Nodaemon
 | | ${rxd_count_int}= | Set variable | ${rxd}
 | | ${txd_count_int}= | Set variable | ${txd}
 | | FOR | ${dut} | IN | @{duts}
-| | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
-| | | ... | Variable Should Exist | ${${dut}_if1}
-| | | @{if_list}= | Run Keyword If | '${if1_status}' == 'PASS'
-| | | ... | Create List | ${${dut}_if1}
-| | | ... | ELSE | Create List | ${${dut}_if1_1} | ${${dut}_if1_2}
-| | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
-| | | ... | Variable Should Exist | ${${dut}_if2}
-| | | Run Keyword If | '${if2_status}' == 'PASS'
-| | | ... | Append To List | ${if_list} | ${${dut}_if2}
-| | | ... | ELSE
-| | | ... | Append To List | ${if_list} | ${${dut}_if2_1} | ${${dut}_if2_2}
-| | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']} | @{if_list}
+| | | ${numa}= | Get interfaces numa node
+| | | ... | ${nodes['${dut}']} | @{${dut}_pf_keys}
 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
 | | | ${skip_cnt}= | Set variable | ${CPU_CNT_SYSTEM}
 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
 | | | ... | Set variable | ${1}
 | | | ... | ELSE | Set variable | ${rxq_count_int}
-| | | Run keyword if | ${cpu_count_int} > 0
-| | | ... | ${dut}.Add CPU Main Core | ${cpu_main}
+| | | Run Keyword | ${dut}.Add CPU Main Core | ${cpu_main}
 | | | Run keyword if | ${cpu_count_int} > 0
 | | | ... | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
 | | | Run keyword if | ${smt_used}
 | | Set Test Variable | ${rxd_count_int}
 | | Set Test Variable | ${txd_count_int}
 
-| Add DPDK 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}
-| | END
-
-| Add DPDK no PCI to all DUTs
-| | [Documentation] | Add DPDK no-pci to VPP startup configuration to all DUTs.
-| |
-| | FOR | ${dut} | IN | @{duts}
-| | | Run keyword | ${dut}.Add DPDK no PCI
-| | END
-
-| Add VLAN strip offload switch off between DUTs in 3-node single link topology
+| Add DPDK VLAN strip offload switch off between DUTs
 | | [Documentation]
 | | ... | Add VLAN Strip Offload switch off on PCI devices between DUTs to VPP
 | | ... | configuration file.
 | |
-| | Run keyword | DUT1.Add DPDK Dev Parameter | ${dut1_if2_pci}
-| | ... | vlan-strip-offload | off
-| | Run keyword | DUT2.Add DPDK Dev Parameter | ${dut2_if1_pci}
-| | ... | vlan-strip-offload | off
-
-| Add VLAN strip offload switch off between DUTs in 3-node double link topology
-| | [Documentation]
-| | ... | Add VLAN Strip Offload switch off on PCI devices between DUTs to VPP
-| | ... | configuration file
-| |
-| | Run keyword | DUT1.Add DPDK Dev Parameter | ${dut1_if2_1_pci}
-| | ... | vlan-strip-offload | off
-| | Run keyword | DUT1.Add DPDK Dev Parameter | ${dut1_if2_2_pci}
-| | ... | vlan-strip-offload | off
-| | Run keyword | DUT2.Add DPDK Dev Parameter | ${dut2_if1_1_pci}
-| | ... | vlan-strip-offload | off
-| | Run keyword | DUT2.Add DPDK Dev Parameter | ${dut2_if1_2_pci}
-| | ... | vlan-strip-offload | off
+| | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
+| | | ${_even}= | Evaluate | ${pf} % 2
+| | | Run Keyword Unless | ${even}
+| | | ... | DUT1.Add DPDK Dev Parameter | ${DUT1_${int}${pf}_pci}[0]
+| | | ... | vlan-strip-offload | off
+| | END
+| | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
+| | | ${_even}= | Evaluate | ${pf} % 2
+| | | Run Keyword If | ${even}
+| | | ... | DUT2.Add DPDK Dev Parameter | ${DUT2_${int}${pf}_pci}[0]
+| | | ... | vlan-strip-offload | off
+| | END
 
 | Add NAT to all DUTs
 | | [Documentation] | Add NAT configuration to all DUTs.
 | |
 | | FOR | ${dut} | IN | @{duts}
 | | | Run keyword | ${dut}.Apply Config
-| | | Add New Socket | ${nodes['${dut}']} | PAPI | ${dut} | ${SOCKSVR_PATH}
-| | | Add New Socket | ${nodes['${dut}']} | STATS | ${dut} | ${SOCKSTAT_PATH}
 | | END
 | | 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}
 
+| Apply startup configuration on VPP DUT
+| | [Documentation] | Write VPP startup configuration and restart VPP DUT.
+| |
+| | ... | *Arguments:*
+| | ... | - dut - DUT on which to apply the configuration. Type: string
+| | ... | - with_trace - Enable packet trace after VPP restart Type: boolean
+| |
+| | [Arguments] | ${dut} | ${with_trace}=${False}
+| |
+| | Run keyword | ${dut}.Apply Config
+| | Save VPP PIDs on DUT | ${dut}
+| | Enable Coredump Limit VPP on DUT | ${nodes['${dut}']}
+| | ${dutnode}= | Copy Dictionary | ${nodes}
+| | Keep In Dictionary | ${dutnode} | ${dut}
+| | Update All Interface Data On All Nodes | ${dutnode} | skip_tg=${True}
+| | Run keyword If | ${with_trace} | VPP Enable Traces On Dut
+| | ... | ${nodes['${dut}']}
+
 | Save VPP PIDs
 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
 | |
 | | ${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}
 | | END
 | | Set Test Variable | ${setup_vpp_pids}
 
+| Save VPP PIDs on DUT
+| | [Documentation] | Get PID of VPP processes from DUT and\
+| | ... | set it as a test variable. The PID is stored as dictionary item\
+| | ... | where the key is the host and the value is the PID.
+| |
+| | [Arguments] | ${dut}
+| |
+| | ${vpp_pids}= | Get VPP PID | ${nodes['${dut}']}
+| | Run Keyword If | ${vpp_pids} is None | FAIL
+| | ... | No VPP PID found on node ${nodes['${dut}']['host']
+| | ${status} | ${message}= | Run Keyword And Ignore Error
+| | ... | Variable Should Exist | ${setup_vpp_pids}
+| | ${setup_vpp_pids}= | Run Keyword If | '${status}' == 'FAIL'
+| | ... | Create Dictionary | ${nodes['${dut}']['host']}=${vpp_pids}
+| | ... | ELSE | Set To Dictionary | ${setup_vpp_pids}
+| | ... | ${nodes['${dut}']['host']}=${vpp_pids}
+| | Set Test Variable | ${setup_vpp_pids}
+
 | Verify VPP PID in Teardown
 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
 | | ... | of test as they were at the begining. If they are not, only a message\