diff options
Diffstat (limited to 'resources/libraries/robot')
-rw-r--r-- | resources/libraries/robot/shared/container.robot | 68 | ||||
-rw-r--r-- | resources/libraries/robot/shared/default.robot | 70 | ||||
-rw-r--r-- | resources/libraries/robot/shared/memif.robot | 59 |
3 files changed, 144 insertions, 53 deletions
diff --git a/resources/libraries/robot/shared/container.robot b/resources/libraries/robot/shared/container.robot index c39e24cf3a..e1aba74ee1 100644 --- a/resources/libraries/robot/shared/container.robot +++ b/resources/libraries/robot/shared/container.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# 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: @@ -13,6 +13,10 @@ *** Settings *** | Documentation | Keywords related to linux containers +| ... +| Library | Collections +| Library | String +| ... | Library | resources.libraries.python.CpuUtils | Library | resources.libraries.python.topology.Topology @@ -21,29 +25,41 @@ | | [Documentation] | Construct 1 CNF of specific technology on all DUT nodes. | | ... | | ... | *Arguments:* -| | ... | - chains: Total number of chains. Type: integer -| | ... | - nodeness: Total number of nodes per chain. Type: integer -| | ... | - chain_id: Chain ID. Type: integer -| | ... | - node_id: Node ID. Type: integer +| | ... | - chains: Total number of chains (Optional). Type: integer, default +| | ... | value: ${1} +| | ... | - nodeness: Total number of nodes per chain (Optional). Type: integer, +| | ... | default value: ${1} +| | ... | - chain_id: Chain ID (Optional). Type: integer, default value: ${1} +| | ... | - node_id: Node ID (Optional). Type: integer, default value: ${1} +| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per +| | ... | SUT/DUT not required. Type: boolean, default value: ${True} | | ... | | ... | *Example:* | | ... -| | ... | \| Construct container on all DUTs \| 1 \| 1 \| 1 \| 1 \| +| | ... | \| Construct container on all DUTs \| 1 \| 1 \| 1 \| 1 \| ${True} \| | | ... | | [Arguments] | ${chains}=${1} | ${nodeness}=${1} | ${chain_id}=${1} -| | ... | ${node_id}=${1} +| | ... | ${node_id}=${1} | ${set_nf_cpus}=${True} | | ... | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | ${env}= | Create List | DEBIAN_FRONTEND=noninteractive -| | | ${mnt}= | Create List | /tmp:/mnt/host | /dev/vfio:/dev/vfio -| | | ${nf_cpus}= | Create network function CPU list | ${dut} +| | | ${tmp}= | Get Variable Value | ${tmp_volume} | /tmp +| | | ${mnt}= | Create List | ${tmp}:/mnt/host | /dev/vfio:/dev/vfio +| | | ${nf_cpus}= | Run Keyword If | ${set_nf_cpus} +| | | ... | Create network function CPU list | ${dut} | | | ... | chains=${chains} | nodeness=${nodeness} | chain_id=${chain_id} | | | ... | node_id=${node_id} | auto_scale=${True} -| | | Run Keyword | ${container_group}.Construct container -| | | ... | name=${dut}_${container_group}${chain_id}${node_id} +| | | ... | ELSE | Set Variable | ${None} +| | | ${uuid_str}= | Run Keyword If | '${tmp}' == '/tmp' +| | | ... | Set Variable | ${EMPTY} +| | | ... | ELSE | Remove String | ${tmp} | ${dut}_VOL +| | | &{cont_args}= | Create Dictionary +| | | ... | name=${dut}_${container_group}${chain_id}${node_id}${uuid_str} | | | ... | node=${nodes['${dut}']} | mnt=${mnt} | env=${env} -| | | ... | cpuset_cpus=${nf_cpus} +| | | Run Keyword If | ${set_nf_cpus} +| | | ... | Set To Dictionary | ${cont_args} | cpuset_cpus=${nf_cpus} +| | | Run Keyword | ${container_group}.Construct container | &{cont_args} | Construct chain of containers on all DUTs | | [Documentation] | Construct 1 chain of 1..N CNFs on all DUT nodes. @@ -52,33 +68,42 @@ | | ... | - chains: Total number of chains. Type: integer | | ... | - nodeness: Total number of nodes per chain. Type: integer | | ... | - chain_id: Chain ID. Type: integer +| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per +| | ... | SUT/DUT not required. Type: boolean, default value: ${True} | | ... | | ... | *Example:* | | ... -| | ... | \| Construct chain of containers on all DUTs \| 1 \| 1 \| 1 \| +| | ... | \| Construct chain of containers on all DUTs \| 1 \| 1 \| 1 \ +| | ... | \| ${True} \| | | ... -| | [Arguments] | ${chains} | ${nodeness} | ${chain_id} +| | [Arguments] | ${chains} | ${nodeness} | ${chain_id} | ${set_nf_cpus}=${True} | | ... | | :FOR | ${node_id} | IN RANGE | 1 | ${nodeness}+1 | | | Construct container on all DUTs | chains=${chains} | nodeness=${nodeness} | | | ... | chain_id=${chain_id} | node_id=${node_id} +| | | ... | set_nf_cpus=${set_nf_cpus} | Construct chains of containers on all DUTs | | [Documentation] | Construct 1..N chains of 1..N CNFs on all DUT nodes. | | ... | | ... | *Arguments:* -| | ... | - chains: Total number of chains. Type: integer -| | ... | - nodeness: Total number of nodes per chain. Type: integer +| | ... | - chains: Total number of chains (Optional). Type: integer, default +| | ... | value: ${1} +| | ... | - nodeness: Total number of nodes per chain (Optional). Type: integer, +| | ... | default value: ${1} +| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per +| | ... | SUT/DUT not required. Type: boolean, default value: ${True} | | ... | | ... | *Example:* | | ... | | ... | \| Construct chains of containers on all DUTs \| 1 \| 1 \| | | ... -| | [Arguments] | ${chains}=${1} | ${nodeness}=${1} +| | [Arguments] | ${chains}=${1} | ${nodeness}=${1} | ${set_nf_cpus}=${True} | | ... | | :FOR | ${chain_id} | IN RANGE | 1 | ${chains}+1 | | | Construct chain of containers on all DUTs | chains=${chains} | | | ... | nodeness=${nodeness} | chain_id=${chain_id} +| | | ... | set_nf_cpus=${set_nf_cpus} | Acquire all '${group}' containers | | [Documentation] | Acquire all container(s) in specific container group on @@ -108,10 +133,13 @@ | | [Documentation] | Configure VPP on all container(s) in specific container | | ... | group on all DUT nodes. | | ... -| | ${dut2_if2} = | Get Variable Value | \${dut2_if2} | ${EMPTY} -| | Run Keyword | ${group}.Configure VPP In All Containers -| | ... | chain_topology=${container_chain_topology} +| | ${dut1_if2} = | Get Variable Value | \${dut1_if2} | ${None} +| | ${dut2_if2} = | Get Variable Value | \${dut2_if2} | ${None} +| | Run Keyword If | '${container_chain_topology}' == 'cross_horiz' +| | ... | ${group}.Configure VPP In All Containers | ${container_chain_topology} | | ... | dut1_if=${dut1_if2} | dut2_if=${dut2_if2} +| | ... | ELSE +| | ... | ${group}.Configure VPP In All Containers | ${container_chain_topology} | Stop all '${group}' containers | | [Documentation] | Stop all container(s) in specific container group on all diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot index 614c873709..b60ebc98a7 100644 --- a/resources/libraries/robot/shared/default.robot +++ b/resources/libraries/robot/shared/default.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Cisco and/or its affiliates. +# 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: @@ -12,22 +12,28 @@ # limitations under the License. *** Settings *** -| Resource | resources/libraries/robot/vm/qemu.robot -| Resource | resources/libraries/robot/vm/double_qemu_setup.robot | Variables | resources/libraries/python/topology.py | Variables | resources/libraries/python/VatHistory.py -| Library | resources.libraries.python.topology.Topology -| Library | resources.libraries.python.VatHistory +| ... +| Library | Collections +| Library | OperatingSystem +| Library | String +| ... | Library | resources.libraries.python.CpuUtils | Library | resources.libraries.python.DUTSetup -| Library | resources.libraries.python.SchedUtils -| Library | resources.libraries.python.TGSetup | Library | resources.libraries.python.L2Util +| Library | resources.libraries.python.SchedUtils | Library | resources.libraries.python.Tap +| Library | resources.libraries.python.TGSetup +| Library | resources.libraries.python.VatHistory | Library | resources.libraries.python.VppCounters | Library | resources.libraries.python.VPPUtil | Library | resources.libraries.python.Trace -| Library | Collections +| Library | resources.libraries.python.topology.Topology +| ... +| Resource | resources/libraries/robot/shared/container.robot +| Resource | resources/libraries/robot/vm/double_qemu_setup.robot +| Resource | resources/libraries/robot/vm/qemu.robot *** Keywords *** | Configure all DUTs before test @@ -533,6 +539,47 @@ | | 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: +| | ... | - tmp_volume - Docker volume mounted as /tmp directory on DUT1. +| | ... | - dcr_uuid - UUID string (including prefix - underscore character) of +| | ... | DUT1 /tmp volume. +| | ... +| | ... | *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} +| | ... +| | ${tmp_volume}= | Get Environment Variable | CSIT_DUT1_VOL +| | ${dcr_uuid}= | Remove String | ${tmp_volume} | DUT1_VOL +| | Set Test Variable | ${tmp_volume} +| | Set Test Variable | ${dcr_uuid} +| | ... +| | Construct chains of containers on all DUTs | ${chains} | ${nodeness} +| | ... | set_nf_cpus=${False} +| | Acquire all '${container_group}' containers +| | Create all '${container_group}' containers +| | Configure VPP in all '${container_group}' containers +| | Stop VPP service on all DUTs | ${nodes} +| | Install VPP in all '${container_group}' containers +| | Start VPP service on all DUTs | ${nodes} +| | Append To List | ${container_groups} | ${container_group} + | Tear down TAP functional test | | [Documentation] | Common test teardown for functional tests with TAP. | | ... @@ -577,6 +624,13 @@ | | Tear down QEMU | ${dut1_node} | ${qemu_node1} | qemu_node1 | | Tear down QEMU | ${dut2_node} | ${qemu_node2} | qemu_node2 +| 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. | | ... diff --git a/resources/libraries/robot/shared/memif.robot b/resources/libraries/robot/shared/memif.robot index ea080a1b83..a4334058c9 100644 --- a/resources/libraries/robot/shared/memif.robot +++ b/resources/libraries/robot/shared/memif.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. +# 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: @@ -12,25 +12,32 @@ # limitations under the License. *** Settings *** -| Library | resources.libraries.python.Memif | Documentation | Memif interface keyword library. +| ... +| Library | resources.libraries.python.Memif *** Keywords *** | Set up memif interfaces on DUT node | | [Documentation] | Create two Memif interfaces on given VPP node. | | ... | | ... | *Arguments:* -| | ... | - ${dut_node} - DUT node. Type: dictionary -| | ... | - ${filename1} - Socket filename for 1st Memif interface. Type: string -| | ... | - ${filename2} - Socket filename for 2nd Memif interface. Type: string -| | ... | - ${mid} - Memif interface ID. Type: integer -| | ... | - ${memif_if1} - Name of the first Memif interface (Optional). -| | ... | Type: string -| | ... | - ${memif_if2} - Name of the second Memif interface (Optional). -| | ... | Type: string -| | ... | - ${rxq} - RX queues. Type: integer -| | ... | - ${txq} - TX queues. Type: integer -| | ... | - ${role} - Memif role. Type: string +| | ... | - dut_node - DUT node. Type: dictionary +| | ... | - filename1 - Socket filename for 1st Memif interface. Type: string +| | ... | - filename2 - Socket filename for 2nd Memif interface. Type: string +| | ... | - mid - Memif interface ID. Type: integer, default value: ${1} +| | ... | - memif_if1 - Name of the first Memif interface (Optional). +| | ... | Type: string, default value: memif_if1 +| | ... | - memif_if2 - Name of the second Memif interface (Optional). +| | ... | Type: string, default value: memif_if2 +| | ... | - rxq - RX queues; 0 means do not set (Optional). Type: integer, +| | ... | default value: ${1} +| | ... | - txq - TX queues; 0 means do not set (Optional). Type: integer, +| | ... | default value: ${1} +| | ... | - role - Memif role (Optional). Type: string, default value: slave +| | ... | - dcr_uuid - UUID string (including prefix - underscore character) of +| | ... | DUT1 /tmp volume created outside of the DUT1 docker in case of +| | ... | vpp-device test. ${EMPTY} value means that /tmp directory is inside +| | ... | the DUT1 docker. (Optional). Type: string, default value: ${EMPTY} | | ... | | ... | _NOTE:_ This KW sets following test case variable: | | ... | - ${${memif_if1}} - 1st Memif interface. @@ -43,18 +50,20 @@ | | ... | \| Set up memif interfaces on DUT node \ | | ... | \| ${nodes['DUT2']} \| sock1 \| sock2 \| 1 \ | | ... | \| dut2_memif_if1 \| dut2_memif_if2 \| 1 \| 1 \| slave \| +| | ... | \| ${nodes['DUT2']} \| sock1 \| sock2 \| 1 \| rxq=0 \| txq=0 \ +| | ... | \| dcr_uuid=_a5730a0a-2ba1-4fe9-91bd-79b9828e968e \| | | ... | | [Arguments] | ${dut_node} | ${filename1} | ${filename2} | ${mid}=${1} | | ... | ${memif_if1}=memif_if1 | ${memif_if2}=memif_if2 | ${rxq}=${1} -| | ... | ${txq}=${1} | ${role}=slave +| | ... | ${txq}=${1} | ${role}=slave | ${dcr_uuid}=${EMPTY} | | ${sid_1}= | Evaluate | (${mid}*2)-1 | | ${sid_2}= | Evaluate | (${mid}*2) | | ${memif_1}= | Create memif interface | ${dut_node} -| | ... | ${filename1}${mid}-${sid_1} | ${mid} | ${sid_1} | rxq=${rxq} -| | ... | txq=${txq} | role=${role} +| | ... | ${filename1}${mid}${dcr_uuid}-${sid_1} | ${mid} | ${sid_1} +| | ... | rxq=${rxq} | txq=${txq} | role=${role} | | ${memif_2}= | Create memif interface | ${dut_node} -| | ... | ${filename2}${mid}-${sid_2} | ${mid} | ${sid_2} | rxq=${rxq} -| | ... | txq=${txq} | role=${role} +| | ... | ${filename2}${mid}${dcr_uuid}-${sid_2} | ${mid} | ${sid_2} +| | ... | rxq=${rxq} | txq=${txq} | role=${role} | | Set Interface State | ${dut_node} | ${memif_1} | up | | Set Interface State | ${dut_node} | ${memif_2} | up | | Set Test Variable | ${${memif_if1}} | ${memif_1} @@ -64,14 +73,14 @@ | | [Documentation] | Create single Memif interface on given VPP node. | | ... | | ... | *Arguments:* -| | ... | - ${dut_node} - DUT node. Type: dictionary -| | ... | - ${filename} - Socket filename for Memif interface. Type: string -| | ... | - ${mid} - Memif interface ID. Type: integer -| | ... | - ${memif_if} - Name of the Memif interface (Optional). +| | ... | - dut_node - DUT node. Type: dictionary +| | ... | - filename - Socket filename for Memif interface. Type: string +| | ... | - mid - Memif interface ID. Type: integer +| | ... | - memif_if - Name of the Memif interface (Optional). | | ... | Type: string -| | ... | - ${rxq} - RX queues. Type: integer -| | ... | - ${txq} - TX queues. Type: integer -| | ... | - ${role} - Memif role. Type: string +| | ... | - rxq - RX queues. Type: integer +| | ... | - txq - TX queues. Type: integer +| | ... | - role - Memif role. Type: string | | ... | | ... | _NOTE:_ This KW sets following test case variable: | | ... | - ${${memif_if}} - Memif interface. |