aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot
diff options
context:
space:
mode:
authorLudovit Mikula <ludovit.mikula@pantheon.tech>2019-07-17 14:36:21 +0000
committerPeter Mikus <pmikus@cisco.com>2019-12-11 08:54:36 +0000
commit3d5a75be5a88931690898e0fe52e4f48bc67c5ed (patch)
tree85b96f1e8e41d20dfd2a96f43689997dc632f78a /resources/libraries/robot
parentf99c79a4035787aff0db70498d022095caa44043 (diff)
Introduce VPP-IPsec container tests.
Change-Id: Ie64d662e81879bd52785e0188450d998bf056bda Signed-off-by: Ludovit Mikula <ludovit.mikula@pantheon.tech>
Diffstat (limited to 'resources/libraries/robot')
-rw-r--r--resources/libraries/robot/crypto/ipsec.robot16
-rw-r--r--resources/libraries/robot/shared/container.robot81
-rw-r--r--resources/libraries/robot/shared/default.robot40
-rw-r--r--resources/libraries/robot/shared/interfaces.robot88
-rw-r--r--resources/libraries/robot/shared/test_teardown.robot1
5 files changed, 184 insertions, 42 deletions
diff --git a/resources/libraries/robot/crypto/ipsec.robot b/resources/libraries/robot/crypto/ipsec.robot
index 33702a43ae..20529dc2e2 100644
--- a/resources/libraries/robot/crypto/ipsec.robot
+++ b/resources/libraries/robot/crypto/ipsec.robot
@@ -197,3 +197,19 @@
| | ... | interface=${dut1_if1}
| | Vpp Route Add | ${dut2} | ${raddr_ip4} | 8 | gateway=${tg_if2_ip4}
| | ... | interface=${dut2_if2}
+
+| Initialize IPSec in 3-node circular container topology
+| | [Documentation]
+| | ... | Set UP state on VPP interfaces in path on nodes in 3-node circular
+| | ... | topology. Get the interface MAC addresses and setup ARP on all VPP
+| | ... | interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG and
+| | ... | DUT1-DUT2 links. Set routing for encrypted traffic on both DUT nodes
+| | ... | with prefix /8 and next hop of neighbour DUT or TG interface IPv4
+| | ... | address.
+| |
+| | Set interfaces in path up on DUT | DUT1
+| | VPP Interface Set IP Address | ${dut1} | ${dut1_if1}
+| | ... | ${dut1_if1_ip4} | 24
+| | VPP Add IP Neighbor | ${dut1} | ${dut1_if1} | ${tg_if1_ip4} | ${tg_if1_mac}
+| | Vpp Route Add | ${dut1} | ${laddr_ip4} | 8 | gateway=${tg_if1_ip4}
+| | ... | interface=${dut1_if1}
diff --git a/resources/libraries/robot/shared/container.robot b/resources/libraries/robot/shared/container.robot
index 0b5cd3ee2b..4d82cf7086 100644
--- a/resources/libraries/robot/shared/container.robot
+++ b/resources/libraries/robot/shared/container.robot
@@ -214,9 +214,12 @@
| | ... | nodes=${nf_nodes}
| | ... | ELSE IF | '${container_chain_topology}' == 'chain_ipsec'
| | ... | ${group}.Configure VPP In All Containers | ${container_chain_topology}
+| | ... | tg_if1_ip4=${tg_if1_ip4} | tg_if1_mac=${tg_if1_mac}
| | ... | tg_if2_ip4=${tg_if2_ip4} | tg_if2_mac=${tg_if2_mac}
+| | ... | dut1_if1_ip4=${dut1_if1_ip4} | dut1_if2_ip4=${dut1_if2_ip4}
| | ... | dut2_if1_ip4=${dut2_if1_ip4} | dut2_if2_ip4=${dut2_if2_ip4}
-| | ... | raddr_ip4=${raddr_ip4} | nodes=${nodes} | nf_nodes=${nf_nodes}
+| | ... | raddr_ip4=${raddr_ip4} | laddr_ip4=${laddr_ip4}
+| | ... | nodes=${nodes} | nf_nodes=${nf_nodes}
| | ... | ELSE IF | '${container_chain_topology}' == 'pipeline_ip4'
| | ... | ${group}.Configure VPP In All Containers | ${container_chain_topology}
| | ... | tg_if1_mac=${tg_if1_mac} | tg_if2_mac=${tg_if2_mac}
@@ -239,6 +242,13 @@
| |
| | Run Keyword | ${group}.Destroy all containers
+| Verify VPP in all '${group}' containers
+| | [Documentation] | Verify that VPP is running inside containers in specific
+| | ... | container group on all DUT nodes. Does 120 retries with one second
+| | ... | between retries.
+| |
+| | Run Keyword | ${group}.Verify VPP in all containers
+
| Start containers for test
| | [Documentation]
| | ... | Start containers for test.
@@ -275,3 +285,72 @@
| | Start VPP in all '${container_group}' containers
| | Append To List | ${container_groups} | ${container_group}
| | Save VPP PIDs
+
+# TODO: Remove the vswitch startup.conf and read the host configuration instead.
+| Start vswitch in container on DUT
+| | [Documentation]
+| | ... | Configure and start vswitch in container.
+| |
+| | ... | *Arguments:*
+| | ... | - dut: DUT node on which to install vswitch. Type: string
+| | ... | - phy_cores - Number of physical cores to use. Type: integer
+| | ... | - rx_queues: Number of RX queues. Type: integer
+| |
+| | ... | *Example:*
+| |
+| | ... | \| Start vswitch in container on DUT \| DUT1 \| 1 \| 1 \|
+| |
+| | [Arguments] | ${dut} | ${phy_cores} | ${rx_queues}=${None}
+| |
+| | Set Test Variable | ${container_group} | VSWITCH
+| | Import Library | resources.libraries.python.ContainerUtils.ContainerManager
+| | ... | engine=${container_engine} | WITH NAME | VSWITCH
+| | Construct container on DUT | ${dut}
+| | ... | nf_chains=${1} | nf_nodes=${1} | nf_chain=${1}
+| | ... | nf_node=${1} | auto_scale=${False} | pinning=${False}
+| | Acquire all '${container_group}' containers
+| | Create all '${container_group}' containers
+| | ${cpu_count_int} | Convert to Integer | ${phy_cores}
+| | ${thr_count_int} | Convert to Integer | ${phy_cores}
+| | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
+| | ${thr_count_int}= | Run keyword if | ${smt_used}
+| | ... | Evaluate | int(${cpu_count_int}*2)
+| | ... | ELSE | Set variable | ${thr_count_int}
+| | ${rxq_count_int}= | Run keyword if | ${rx_queues}
+| | ... | Set variable | ${rx_queues}
+| | ... | ELSE | Evaluate | int(${thr_count_int}/2)
+| | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
+| | ... | Set variable | ${1}
+| | ... | ELSE | Set variable | ${rxq_count_int}
+| | VSWITCH.Configure VPP in all containers | chain_vswitch
+| | ... | rxq=${rxq_count_int} | n_instances=${n_instances}
+| | ... | buffers=${215040} | node=${dut}
+| | ... | dut1_if1=${dut1_if1} | dut1_if2=${dut1_if2}
+| | ... | dut2_if1=${dut2_if1} | dut2_if2=${dut2_if2}
+| | ... | dut2_if2_ip4=${dut2_if2_ip4}
+| | ... | tg_if1_ip4=${tg_if1_ip4} | tg_if1_mac=${tg_if1_mac}
+| | ... | tg_if2_ip4=${tg_if2_ip4} | tg_if2_mac=${tg_if2_mac}
+| | ... | nodes=${nodes}
+| | Start VPP in all '${container_group}' containers
+| | Verify VPP in all '${container_group}' containers
+
+| Start vswitch in container
+| | [Documentation]
+| | ... | Configure and start vswitch in container on all DUTs.
+| |
+| | ... | *Arguments:*
+| | ... | - phy_cores - Number of physical cores to use. Type: integer
+| | ... | - rx_queues: Number of RX queues. Type: integer
+| |
+| | ... | *Example:*
+| |
+| | ... | \| Start vswitch in container \| 1 \| 1 \|
+| |
+| | [Arguments] | ${phy_cores} | ${rx_queues}=${None}
+| |
+| | FOR | ${dut} | IN | @{duts}
+| | | Run Keyword | Start vswitch in container on DUT
+| | | ... | ${dut} | ${phy_cores} | ${rx_queues}
+| | END
+| | Append To List | ${container_groups} | ${container_group}
+| | Save VPP PIDs
diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot
index ab8a409219..3b8f2804c1 100644
--- a/resources/libraries/robot/shared/default.robot
+++ b/resources/libraries/robot/shared/default.robot
@@ -119,7 +119,7 @@
| | 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
@@ -315,14 +315,30 @@
| |
| | 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\
@@ -337,6 +353,24 @@
| | 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\
diff --git a/resources/libraries/robot/shared/interfaces.robot b/resources/libraries/robot/shared/interfaces.robot
index 3d2b70d065..128c3cb568 100644
--- a/resources/libraries/robot/shared/interfaces.robot
+++ b/resources/libraries/robot/shared/interfaces.robot
@@ -21,47 +21,61 @@
| | ... | *Set UP state on VPP interfaces in path on all DUT nodes and set
| | ... | maximal MTU.*
| |
+| | FOR | ${dut} | IN | @{duts}
+| | | Set interfaces in path up on DUT | ${dut}
+| | END
+| | All VPP Interfaces Ready Wait | ${nodes} | retries=${300}
+
+| Set interfaces in path up on DUT
+| | [Documentation]
+| | ... | *Set UP state on VPP interfaces in path on specified DUT node and
+| | ... | set maximal MTU.*
+| |
+| | ... | *Arguments:*
+| | ... | - dut - DUT node on which to set the interfaces up.
+| | ... | Type: string
+| |
+| | ... | *Example:*
+| |
+| | ... | \| Set interfaces in path up on DUT \| DUT1 \|
+| |
+| | [Arguments] | ${dut}
# TODO: Rework KW to set all interfaces in path UP and set MTU (including
# software interfaces. Run KW at the start phase of VPP setup to split
# from other "functional" configuration. This will allow modularity of this
# library
-| | FOR | ${dut} | IN | @{duts}
-| | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
-| | | ... | Variable Should Exist | ${${dut}_if1}
-| | | Run Keyword If | '${if1_status}' == 'PASS'
-| | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1} | up
-| | | ... | ELSE
-| | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_1} | up
-| | | Run Keyword Unless | '${if1_status}' == 'PASS'
-| | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_2} | up
-| | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
-| | | ... | Variable Should Exist | ${${dut}_if2}
-| | | Run Keyword If | '${if2_status}' == 'PASS'
-| | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2} | up
-| | | ... | ELSE
-| | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2_1} | up
-| | | Run Keyword Unless | '${if2_status}' == 'PASS'
-| | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2_2} | up
-| | END
-| | FOR | ${dut} | IN | @{duts}
-| | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
-| | | ... | Variable Should Exist | ${${dut}_if1}
-| | | Run Keyword If | '${if1_status}' == 'PASS'
-| | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1}
-| | | ... | ELSE
-| | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_1}
-| | | Run Keyword Unless | '${if1_status}' == 'PASS'
-| | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_2}
-| | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
-| | | ... | Variable Should Exist | ${${dut}_if2}
-| | | Run Keyword If | '${if2_status}' == 'PASS'
-| | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2}
-| | | ... | ELSE
-| | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2_1}
-| | | Run Keyword Unless | '${if2_status}' == 'PASS'
-| | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2_2}
-| | END
-| | All VPP Interfaces Ready Wait | ${nodes} | retries=${300}
+| | ${if1_status} | ${value}= | Run Keyword And Ignore Error
+| | ... | Variable Should Exist | ${${dut}_if1}
+| | Run Keyword If | '${if1_status}' == 'PASS'
+| | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1} | up
+| | ... | ELSE
+| | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_1} | up
+| | Run Keyword Unless | '${if1_status}' == 'PASS'
+| | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_2} | up
+| | ${if2_status} | ${value}= | Run Keyword And Ignore Error
+| | ... | Variable Should Exist | ${${dut}_if2}
+| | Run Keyword If | '${if2_status}' == 'PASS'
+| | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2} | up
+| | ... | ELSE
+| | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2_1} | up
+| | Run Keyword Unless | '${if2_status}' == 'PASS'
+| | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2_2} | up
+| | ${if1_status} | ${value}= | Run Keyword And Ignore Error
+| | ... | Variable Should Exist | ${${dut}_if1}
+| | Run Keyword If | '${if1_status}' == 'PASS'
+| | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1}
+| | ... | ELSE
+| | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_1}
+| | Run Keyword Unless | '${if1_status}' == 'PASS'
+| | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_2}
+| | ${if2_status} | ${value}= | Run Keyword And Ignore Error
+| | ... | Variable Should Exist | ${${dut}_if2}
+| | Run Keyword If | '${if2_status}' == 'PASS'
+| | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2}
+| | ... | ELSE
+| | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2_1}
+| | Run Keyword Unless | '${if2_status}' == 'PASS'
+| | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2_2}
| Set single interfaces in path up
| | [Documentation]
diff --git a/resources/libraries/robot/shared/test_teardown.robot b/resources/libraries/robot/shared/test_teardown.robot
index 1e7d011fca..96d3cd825b 100644
--- a/resources/libraries/robot/shared/test_teardown.robot
+++ b/resources/libraries/robot/shared/test_teardown.robot
@@ -33,7 +33,6 @@
| |
| | Remove All Added Ports On All DUTs From Topology | ${nodes}
| | Show PAPI History On All DUTs | ${nodes}
-| | Show Log On All DUTs | ${nodes}
| | Run Keyword If Test Failed
| | ... | Get Core Files on All Nodes | ${nodes}
| | Run Keyword If Test Failed