diff options
Diffstat (limited to 'resources')
-rw-r--r-- | resources/libraries/bash/function/device.sh | 28 | ||||
-rw-r--r-- | resources/libraries/python/ContainerUtils.py | 90 | ||||
-rw-r--r-- | resources/libraries/python/Memif.py | 11 | ||||
-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 | ||||
-rw-r--r-- | resources/templates/vat/memif_create.vat | 2 | ||||
-rw-r--r-- | resources/templates/vat/memif_create_chain.vat | 4 | ||||
-rw-r--r-- | resources/templates/vat/memif_create_chain_functional.vat | 12 | ||||
-rw-r--r-- | resources/templates/vat/memif_create_cross_horiz.vat | 2 |
10 files changed, 261 insertions, 85 deletions
diff --git a/resources/libraries/bash/function/device.sh b/resources/libraries/bash/function/device.sh index 7363dc0df6..7a61bf7f71 100644 --- a/resources/libraries/bash/function/device.sh +++ b/resources/libraries/bash/function/device.sh @@ -108,8 +108,8 @@ function bind_interfaces_to_driver () { function clean_environment () { - # Cleanup environment by removing topology containers and binding - # interfaces back to original driver. + # Cleanup environment by removing topology containers and shared volumes + # and binding interfaces back to original driver. # # Variables read: # - DCR_UUIDS - Docker Container UUIDs. @@ -124,6 +124,11 @@ function clean_environment () { # Kill docker containers. docker rm --force "${DCR_UUIDS[@]}" || die "Cleanup containers failed!" + # Remove DUT1 /tmp volume + docker volume rm "${DCR_VOLUMES[dut1]}" || { + die "Failed to remove DUT1 /tmp volume!" + } + # Rebind interfaces back to kernel drivers. for ADDR in ${TG_PCIDEVS[@]}; do DRIVER="${TG_DRIVERS[0]}" @@ -420,8 +425,10 @@ function read_env_variables () { export "${param}" done declare -gA DCR_UUIDS + declare -gA DCR_VOLUMES DCR_UUIDS+=([tg]="${CSIT_TG_UUID}") DCR_UUIDS+=([dut1]="${CSIT_DUT1_UUID}") + DCR_VOLUMES+=([dut1]="${CSIT_DUT1_VOL}") TG_PCIDEVS=("${CSIT_TG_INTERFACES_PORT1_PCI}") TG_DRIVERS=("${CSIT_TG_INTERFACES_PORT1_DRV}") TG_PCIDEVS+=("${CSIT_TG_INTERFACES_PORT2_PCI}") @@ -465,6 +472,7 @@ function set_env_variables () { CSIT_DUT1_ARCH="$(uname -i)" || { die "Reading machine architecture failed!" } + CSIT_DUT1_VOL="${DCR_VOLUMES[dut1]}" CSIT_TG_INTERFACES_PORT1_MAC="${TG_NETMACS[0]}" CSIT_TG_INTERFACES_PORT1_PCI="${TG_PCIDEVS[0]}" CSIT_TG_INTERFACES_PORT1_DRV="${TG_DRIVERS[0]}" @@ -519,6 +527,8 @@ function start_topology_containers () { dcr_stc_params+="--volume /dev/vfio:/dev/vfio " # Mount nested_vm image to be able to run VM tests. dcr_stc_params+="--volume /var/lib/vm/vhost-nested.img:/var/lib/vm/vhost-nested.img " + # Mount docker.sock to be able to use docker deamon of the host. + dcr_stc_params+="--volume /var/run/docker.sock:/var/run/docker.sock " # Docker Container UUIDs. declare -gA DCR_UUIDS @@ -526,13 +536,25 @@ function start_topology_containers () { declare -gA DCR_PORTS # Docker Container PIDs (namespaces). declare -gA DCR_CPIDS + # Docker Container volumes with no relationship to the host. + declare -gA DCR_VOLUMES + + # Create DUT1 /tmp volume to be able to install VPP in "nested" container. + params=(--name DUT1_VOL_$(uuidgen)) + DCR_VOLUMES+=([dut1]="$(docker volume create "${params[@]}")") || { + die "Failed to create DUT1 /tmp volume!" + } + + # Mount DUT1_VOL as /tmp directory on DUT1 container + dcr_stc_params_dut1="--volume ${DCR_VOLUMES[dut1]}:/tmp " # Run TG and DUT1. As initial version we do support only 2-node. params=(${dcr_stc_params} --name csit-tg-$(uuidgen) ${dcr_image}) DCR_UUIDS+=([tg]="$(docker run "${params[@]}")") || { die "Failed to start TG docker container!" } - params=(${dcr_stc_params} --name csit-dut1-$(uuidgen) ${dcr_image}) + params=(${dcr_stc_params} ${dcr_stc_params_dut1} + --name csit-dut1-$(uuidgen) ${dcr_image}) DCR_UUIDS+=([dut1]="$(docker run "${params[@]}")") || { die "Failed to start DUT1 docker container!" } diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py index 786a4013de..5fa0a575e9 100644 --- a/resources/libraries/python/ContainerUtils.py +++ b/resources/libraries/python/ContainerUtils.py @@ -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: @@ -151,19 +151,16 @@ class ContainerManager(object): self.engine.container = self.containers[container] self.engine.restart_vpp() - def configure_vpp_in_all_containers(self, chain_topology, - dut1_if=None, dut2_if=None): + def configure_vpp_in_all_containers(self, chain_topology, **kwargs): """Configure VPP in all containers. :param chain_topology: Topology used for chaining containers can be chain or cross_horiz. Chain topology is using 1 memif pair per container. Cross_horiz topology is using 1 memif and 1 physical interface in container (only single container can be configured). - :param dut1_if: Interface on DUT1 directly connected to DUT2. - :param dut2_if: Interface on DUT2 directly connected to DUT1. - :type container_topology: str - :type dut1_if: str - :type dut2_if: str + :param kwargs: Named parameters. + :type chain_topology: str + :param kwargs: dict """ # Count number of DUTs based on node's host information dut_cnt = len(Counter([self.containers[container].node['host'] @@ -180,12 +177,15 @@ class ContainerManager(object): sid2 = i % mod * 2 + 2 self.engine.container = self.containers[container] self.engine.create_vpp_startup_config() - self.engine.create_vpp_exec_config(container_vat_template, \ - mid1=mid1, mid2=mid2, sid1=sid1, sid2=sid2, \ - socket1='memif-{c.name}-{sid}'. \ - format(c=self.engine.container, sid=sid1), \ - socket2='memif-{c.name}-{sid}'. \ - format(c=self.engine.container, sid=sid2)) + c_name = self.engine.container.name + guest_dir = self.engine.container.mnt[0].split(':')[1] + self.engine.create_vpp_exec_config( + container_vat_template, + mid1=mid1, mid2=mid2, sid1=sid1, sid2=sid2, + socket1='{dir}/memif-{c_name}-{sid}'. + format(c_name=c_name, sid=sid1, dir=guest_dir), + socket2='{dir}/memif-{c_name}-{sid}'. + format(c_name=c_name, sid=sid2, dir=guest_dir)) elif chain_topology == 'cross_horiz': if mod > 1: raise RuntimeError('Container chain topology {topology} ' @@ -194,7 +194,17 @@ class ContainerManager(object): for i, container in enumerate(self.containers): mid1 = i % mod + 1 sid1 = i % mod * 2 + 1 + try: + dut1_if = kwargs['dut1_if'] + except KeyError: + raise AttributeError('Missing dut1_if parameter.') + try: + dut2_if = kwargs['dut2_if'] + except KeyError: + raise AttributeError('Missing dut2_if parameter.') self.engine.container = self.containers[container] + c_name = self.engine.container.name + guest_dir = self.engine.container.mnt[0].split(':')[1] if 'DUT1' in self.engine.container.name: if_pci = Topology.get_interface_pci_addr( \ self.engine.container.node, dut1_if) @@ -206,10 +216,30 @@ class ContainerManager(object): if_name = Topology.get_interface_name( \ self.engine.container.node, dut2_if) self.engine.create_vpp_startup_config_dpdk_dev(if_pci) - self.engine.create_vpp_exec_config(container_vat_template, \ - mid1=mid1, sid1=sid1, if_name=if_name, \ - socket1='memif-{c.name}-{sid}'. \ - format(c=self.engine.container, sid=sid1)) + self.engine.create_vpp_exec_config( + container_vat_template, + mid1=mid1, sid1=sid1, if_name=if_name, + socket1='{dir}/memif-{c_name}-{sid}'. + format(c_name=c_name, sid=sid1, dir=guest_dir)) + elif chain_topology == 'chain_functional': + for i, container in enumerate(self.containers): + mid1 = i % mod + 1 + mid2 = i % mod + 1 + sid1 = i % mod * 2 + 1 + sid2 = i % mod * 2 + 2 + memif_rx_mode = 'interrupt' + self.engine.container = self.containers[container] + self.engine.create_vpp_startup_config_func_dev() + c_name = self.engine.container.name + guest_dir = self.engine.container.mnt[0].split(':')[1] + self.engine.create_vpp_exec_config( + container_vat_template, + mid1=mid1, mid2=mid2, sid1=sid1, sid2=sid2, + socket1='{dir}/memif-{c_name}-{sid}'. + format(c_name=c_name, sid=sid1, dir=guest_dir), + socket2='{dir}/memif-{c_name}-{sid}'. + format(c_name=c_name, sid=sid2, dir=guest_dir), + rx_mode=memif_rx_mode) else: raise RuntimeError('Container topology {topology} not implemented'. format(topology=chain_topology)) @@ -355,9 +385,9 @@ class ContainerEngine(object): vpp_config.add_unix_cli_listen() vpp_config.add_unix_nodaemon() vpp_config.add_unix_exec('/tmp/running.exec') - # We will pop first core from list to be main core + # We will pop the first core from the list to be a main core vpp_config.add_cpu_main_core(str(cpuset_cpus.pop(0))) - # if this is not only core in list, the rest will be used as workers. + # If more cores in the list, the rest will be used as workers. if cpuset_cpus: corelist_workers = ','.join(str(cpu) for cpu in cpuset_cpus) vpp_config.add_cpu_corelist_workers(corelist_workers) @@ -394,6 +424,23 @@ class ContainerEngine(object): self.execute('echo "{config}" | tee /etc/vpp/startup.conf' .format(config=vpp_config.get_config_str())) + def create_vpp_startup_config_func_dev(self): + """Create startup configuration of VPP on container for functional + vpp_device tests. + """ + # Create config instance + vpp_config = VppConfigGenerator() + vpp_config.set_node(self.container.node) + vpp_config.add_unix_cli_listen() + vpp_config.add_unix_nodaemon() + vpp_config.add_unix_exec('/tmp/running.exec') + vpp_config.add_plugin('disable', 'dpdk_plugin.so') + + # Apply configuration + self.execute('mkdir -p /etc/vpp/') + self.execute('echo "{config}" | tee /etc/vpp/startup.conf' + .format(config=vpp_config.get_config_str())) + def create_vpp_exec_config(self, vat_template_file, **kwargs): """Create VPP exec configuration on container. @@ -678,7 +725,8 @@ class Docker(ContainerEngine): if int(ret) != 0: raise RuntimeError('Failed to create container {c.name}.' .format(c=self.container)) - self._configure_cgroup('docker') + if self.container.cpuset_cpus: + self._configure_cgroup('docker') def create(self): """Create/deploy container. diff --git a/resources/libraries/python/Memif.py b/resources/libraries/python/Memif.py index 76e775fcca..40178986d8 100644 --- a/resources/libraries/python/Memif.py +++ b/resources/libraries/python/Memif.py @@ -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: @@ -33,8 +33,8 @@ class Memif(object): :param filename: Memif interface socket filename. :param mid: Memif interface ID. :param sid: Socket ID. - :param rxq: Number of RX queues. - :param txq: Number of TX queues. + :param rxq: Number of RX queues; 0 means do not set. + :param txq: Number of TX queues; 0 means do not set. :param role: Memif interface role [master|slave]. Default is master. :type node: dict :type filename: str @@ -48,12 +48,15 @@ class Memif(object): :raises ValueError: If command 'create memif' fails. """ + rx_q = 'rx-queues {rxq}'.format(rxq=rxq) if rxq else '' + tx_q = 'tx-queues {txq}'.format(txq=txq) if txq else '' + with VatTerminal(node, json_param=False) as vat: vat.vat_terminal_exec_cmd_from_template( 'memif_socket_filename_add_del.vat', add_del='add', id=sid, filename='/tmp/'+filename) vat.vat_terminal_exec_cmd_from_template( - 'memif_create.vat', id=mid, socket=sid, rxq=rxq, txq=txq, + 'memif_create.vat', id=mid, socket=sid, rx_q=rx_q, tx_q=tx_q, role=role) if 'sw_if_index' in vat.vat_stdout: try: 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. diff --git a/resources/templates/vat/memif_create.vat b/resources/templates/vat/memif_create.vat index b20b3d7c52..1e203690b9 100644 --- a/resources/templates/vat/memif_create.vat +++ b/resources/templates/vat/memif_create.vat @@ -1 +1 @@ -memif_create id {id} socket-id {socket} {role} rx-queues {rxq} tx-queues {txq} +memif_create id {id} socket-id {socket} {role} {rx_q} {tx_q} diff --git a/resources/templates/vat/memif_create_chain.vat b/resources/templates/vat/memif_create_chain.vat index 306df83c57..5275f84a65 100644 --- a/resources/templates/vat/memif_create_chain.vat +++ b/resources/templates/vat/memif_create_chain.vat @@ -1,8 +1,8 @@ -create memif socket id {sid1} filename /mnt/host/{socket1} +create memif socket id {sid1} filename {socket1} create interface memif id {mid1} socket-id {sid1} master set int state memif{sid1}/{mid1} up -create memif socket id {sid2} filename /mnt/host/{socket2} +create memif socket id {sid2} filename {socket2} create interface memif id {mid2} socket-id {sid2} master set int state memif{sid2}/{mid2} up diff --git a/resources/templates/vat/memif_create_chain_functional.vat b/resources/templates/vat/memif_create_chain_functional.vat new file mode 100644 index 0000000000..c5db09315c --- /dev/null +++ b/resources/templates/vat/memif_create_chain_functional.vat @@ -0,0 +1,12 @@ +create memif socket id {sid1} filename {socket1} +create interface memif id {mid1} socket-id {sid1} master +set interface rx-mode memif{sid1}/{mid1} {rx_mode} +set int state memif{sid1}/{mid1} up + +create memif socket id {sid2} filename {socket2} +create interface memif id {mid2} socket-id {sid2} master +set interface rx-mode memif{sid2}/{mid2} {rx_mode} +set int state memif{sid2}/{mid2} up + +set interface l2 xconnect memif{sid2}/{mid2} memif{sid1}/{mid1} +set interface l2 xconnect memif{sid1}/{mid1} memif{sid2}/{mid2} diff --git a/resources/templates/vat/memif_create_cross_horiz.vat b/resources/templates/vat/memif_create_cross_horiz.vat index 65db4e409c..40ff2c30fc 100644 --- a/resources/templates/vat/memif_create_cross_horiz.vat +++ b/resources/templates/vat/memif_create_cross_horiz.vat @@ -1,4 +1,4 @@ -create memif socket id {sid1} filename /mnt/host/{socket1} +create memif socket id {sid1} filename {socket1} create interface memif id {mid1} socket-id {sid1} master set int state memif{sid1}/{mid1} up |