X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Frobot%2Fshared%2Fcontainer.robot;h=c8320b750867936edcf0f5e72437144e92e2d4ea;hb=refs%2Fchanges%2F78%2F20278%2F27;hp=c08dc71fa6cf0120ccccb551e22b9e9109e17cb8;hpb=11bd03f27a53fa6060bfa72bc98c52532cb6e404;p=csit.git diff --git a/resources/libraries/robot/shared/container.robot b/resources/libraries/robot/shared/container.robot index c08dc71fa6..c8320b7508 100644 --- a/resources/libraries/robot/shared/container.robot +++ b/resources/libraries/robot/shared/container.robot @@ -14,9 +14,6 @@ *** Settings *** | Documentation | Keywords related to linux containers | ... -| Library | Collections -| Library | String -| ... | Library | resources.libraries.python.CpuUtils | Library | resources.libraries.python.topology.Topology @@ -34,34 +31,46 @@ | | ... | - 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 -| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per -| | ... | SUT/DUT not required. Type: boolean, default value: ${True} +| | ... | - nested: Set True if starting nested containers. +| | ... | Type: boolean, default value: ${False} | | ... | | ... | *Example:* | | ... | | ... | \| Construct container on all DUTs \| 1 \| 1 \| 1 \| 1 \| ${True} \| | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${nf_chain}=${1} -| | ... | ${nf_node}=${1} | ${auto_scale}=${True} | ${set_nf_cpus}=${True} +| | ... | ${nf_node}=${1} | ${auto_scale}=${True} | ${nested}=${False} | | ... +| | ${nf_dtcr_status} | ${value}= | Run Keyword And Ignore Error +| | ... | Variable Should Exist | ${nf_dtcr} +| | ${nf_dtcr}= | Run Keyword If | '${nf_dtcr_status}' == 'PASS' +| | ... | Set Variable | ${nf_dtcr} | ELSE | Set Variable | ${1} +| | ${nf_dtc}= | Run Keyword Unless | ${nested} +| | ... | Set Variable If | ${auto_scale} | ${cpu_count_int} +| | ... | ${nf_dtc} | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | ${nf_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node} | | | ${env}= | Create List | DEBIAN_FRONTEND=noninteractive -| | | ${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=${nf_chains} | nodeness=${nf_nodes} | chain_id=${nf_chain} -| | | ... | node_id=${nf_node} | auto_scale=${auto_scale} -| | | ... | ELSE | Set Variable | ${None} -| | | ${uuid_str}= | Run Keyword If | '${tmp}' == '/tmp' -| | | ... | Set Variable | ${EMPTY} -| | | ... | ELSE | Remove String | ${tmp} | ${dut}_VOL +| | | ${uuid}= | Get Variable Value | ${dcr_uuid} | ${Empty} +| | | ${root}= | Get Variable Value | ${dcr_root} | ${Empty} +| | | ${mnt}= | Create List +| | | ... | ${root}/tmp/:/mnt/host/ +| | | ... | ${root}/dev/vfio/:/dev/vfio/ +| | | ... | ${root}/usr/bin/vpp:/usr/bin/vpp +| | | ... | ${root}/usr/bin/vppctl:/usr/bin/vppctl +| | | ... | ${root}/usr/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/ +| | | ... | ${root}/usr/share/vpp/:/usr/share/vpp/ +| | | ${nf_cpus}= | Set Variable | ${None} +| | | ${nf_cpus}= | Run Keyword Unless | ${nested} +| | | ... | Get Affinity NF | ${nodes} | ${dut} +| | | ... | nf_chains=${nf_chains} | nf_nodes=${nf_nodes} +| | | ... | nf_chain=${nf_chain} | nf_node=${nf_node} +| | | ... | vs_dtc=${cpu_count_int} | nf_dtc=${nf_dtc} | nf_dtcr=${nf_dtcr} | | | &{cont_args}= | Create Dictionary -| | | ... | name=${dut}_${container_group}${nf_id}${uuid_str} +| | | ... | name=${dut}_${container_group}${nf_id}${uuid} | | | ... | node=${nodes['${dut}']} | mnt=${mnt} | env=${env} -| | | Run Keyword If | ${set_nf_cpus} +| | | Run Keyword Unless | ${nested} | | | ... | Set To Dictionary | ${cont_args} | cpuset_cpus=${nf_cpus} | | | Run Keyword | ${container_group}.Construct container | &{cont_args} @@ -75,8 +84,8 @@ | | ... | - 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 -| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per -| | ... | SUT/DUT not required. Type: boolean, default value: ${True} +| | ... | - nested: Set True if starting nested containers. +| | ... | Type: boolean, default value: ${False} | | ... | | ... | *Example:* | | ... @@ -84,12 +93,12 @@ | | ... | \| ${True} \| | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${nf_chain}=${1} -| | ... | ${auto_scale}=${True} | ${set_nf_cpus}=${True} +| | ... | ${auto_scale}=${True} | ${nested}=${False} | | ... | | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes}+1 | | | Construct container on all DUTs | nf_chains=${nf_chains} | | | ... | nf_nodes=${nf_nodes} | nf_chain=${nf_chain} | nf_node=${nf_node} -| | | ... | auto_scale=${auto_scale} | set_nf_cpus=${set_nf_cpus} +| | | ... | auto_scale=${auto_scale} | nested=${nested} | Construct chains of containers on all DUTs | | [Documentation] | Construct 1..N chains of 1..N CNFs on all DUT nodes. @@ -102,20 +111,20 @@ | | ... | - 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 -| | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per -| | ... | SUT/DUT not required. Type: boolean, default value: ${True} +| | ... | - nested: Set True if starting nested containers. +| | ... | Type: boolean, default value: ${False} | | ... | | ... | *Example:* | | ... | | ... | \| Construct chains of containers on all DUTs \| 1 \| 1 \| | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${auto_scale}=${True} -| | ... | ${set_nf_cpus}=${True} +| | ... | ${nested}=${False} | | ... | | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains}+1 | | | Construct chain of containers on all DUTs | nf_chains=${nf_chains} | | | ... | nf_nodes=${nf_nodes} | nf_chain=${nf_chain} -| | | ... | auto_scale=${auto_scale} | set_nf_cpus=${set_nf_cpus} +| | | ... | auto_scale=${auto_scale} | nested=${nested} | Acquire all '${group}' containers | | [Documentation] | Acquire all container(s) in specific container group on @@ -129,11 +138,11 @@ | | ... | | Run Keyword | ${group}.Create all containers -| Install VPP in all '${group}' containers -| | [Documentation] | Install VPP on all container(s) in specific container +| Start VPP in all '${group}' containers +| | [Documentation] | Start VPP on all container(s) in specific container | | ... | group on all DUT nodes. | | ... -| | Run Keyword | ${group}.Install VPP In All Containers +| | Run Keyword | ${group}.Start VPP In All Containers | Restart VPP in all '${group}' containers | | [Documentation] | Restart VPP on all container(s) in specific container @@ -172,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:* +| | ... +| | ... | \| Start containers for performance test \| 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}