X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Frobot%2Fshared%2Fcontainer.robot;h=1d646a6f227d2e312fa99313ca30652ae200506a;hp=c08dc71fa6cf0120ccccb551e22b9e9109e17cb8;hb=46efda9bd3a32cfe9944cb421ae3e2a3978bf9fc;hpb=11bd03f27a53fa6060bfa72bc98c52532cb6e404 diff --git a/resources/libraries/robot/shared/container.robot b/resources/libraries/robot/shared/container.robot index c08dc71fa6..1d646a6f22 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,49 @@ | | ... | - 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} +| | ... | - pinning: Set True if CPU pinning should be done on starting +| | ... | 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} | ${pinning}=${True} +| | ... +| | ${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 If | ${pinning} +| | ... | 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 +| | | ${dut1_uuid_length} = | Get Length | ${dut1_uuid} +| | | ${root}= | Run Keyword If | ${dut1_uuid_length} +| | | ... | Get Docker Mergeddir | ${nodes['DUT1']} | ${dut1_uuid} +| | | ... | ELSE | Set Variable | ${EMPTY} +| | | ${node_arch}= | Get Node Arch | ${nodes['${dut}']} +| | | ${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/${node_arch}-linux-gnu/:/usr/lib/${node_arch}-linux-gnu/ +| | | ... | ${root}/usr/share/vpp/:/usr/share/vpp/ +| | | ${nf_cpus}= | Set Variable | ${None} +| | | ${nf_cpus}= | Run Keyword If | ${pinning} +| | | ... | 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}${dut1_uuid} | | | ... | node=${nodes['${dut}']} | mnt=${mnt} | env=${env} -| | | Run Keyword If | ${set_nf_cpus} +| | | Run Keyword If | ${pinning} | | | ... | Set To Dictionary | ${cont_args} | cpuset_cpus=${nf_cpus} | | | Run Keyword | ${container_group}.Construct container | &{cont_args} @@ -75,8 +87,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} +| | ... | - pinning: Set True if CPU pinning should be done on starting +| | ... | containers. Type: boolean, default value: ${False} | | ... | | ... | *Example:* | | ... @@ -84,38 +96,38 @@ | | ... | \| ${True} \| | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${nf_chain}=${1} -| | ... | ${auto_scale}=${True} | ${set_nf_cpus}=${True} +| | ... | ${auto_scale}=${True} | ${pinning}=${True} | | ... | | :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} | pinning=${pinning} | Construct chains of containers on all DUTs | | [Documentation] | Construct 1..N chains of 1..N CNFs on all DUT nodes. | | ... | | ... | *Arguments:* | | ... | - nf_chains: Total number of chains (Optional). Type: integer, default -| | ... | value: ${1} +| | ... | value: ${1} | | ... | - nf_nodes: Total number of nodes per chain (Optional). Type: integer, -| | ... | default value: ${1} +| | ... | default value: ${1} | | ... | - 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} +| | ... | - pinning: Set True if CPU pinning should be done on starting +| | ... | containers. Type: boolean, default value: ${True} | | ... | | ... | *Example:* | | ... | | ... | \| Construct chains of containers on all DUTs \| 1 \| 1 \| | | ... | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${auto_scale}=${True} -| | ... | ${set_nf_cpus}=${True} +| | ... | ${pinning}=${True} | | ... | | :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} | pinning=${pinning} | Acquire all '${group}' containers | | [Documentation] | Acquire all container(s) in specific container group on @@ -129,11 +141,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 +184,36 @@ | | ... | all DUT nodes. | | ... | | Run Keyword | ${group}.Destroy all containers + +| Start containers for test +| | [Documentation] +| | ... | Start containers for 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 +| | ... | - pinning: Set True if CPU pinning should be done on starting +| | ... | containers. Type: boolean, default value: ${False} +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Start containers for test \| 1 \| 1 \| +| | ... +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${auto_scale}=${True} +| | ... | ${pinning}=${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} | pinning=${pinning} +| | 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}