VPP_Device - add baseline tests - part IIb) 11/16811/35
authorJan Gelety <jgelety@cisco.com>
Thu, 10 Jan 2019 10:53:58 +0000 (11:53 +0100)
committerJan Gelety <jgelety@cisco.com>
Wed, 23 Jan 2019 08:19:54 +0000 (08:19 +0000)
CSIT-1372

Add following baseline tests to VPP_Device:
- ip4
  eth2p-ethip4-ip4base-eth-2memif-1dcr-dev

- ip6
  eth2p-ethip6-ip6base-eth-2memif-1dcr-dev

- l2bd
  eth2p-eth-l2bdbasemaclrn-eth-2memif-1dcr-dev

- l2xc
  eth2p-eth-l2xcbase-eth-2memif-1dcr-dev

Change-Id: Ic4a3a01b62d800c528a9c9371891dcc26b875220
Signed-off-by: Jan Gelety <jgelety@cisco.com>
14 files changed:
resources/libraries/bash/function/device.sh
resources/libraries/python/ContainerUtils.py
resources/libraries/python/Memif.py
resources/libraries/robot/shared/container.robot
resources/libraries/robot/shared/default.robot
resources/libraries/robot/shared/memif.robot
resources/templates/vat/memif_create.vat
resources/templates/vat/memif_create_chain.vat
resources/templates/vat/memif_create_chain_functional.vat [new file with mode: 0644]
resources/templates/vat/memif_create_cross_horiz.vat
tests/vpp/device/container_memif/eth2p-eth-l2bdbasemaclrn-eth-2memif-1dcr-dev.robot [new file with mode: 0644]
tests/vpp/device/container_memif/eth2p-eth-l2xcbase-eth-2memif-1dcr-dev.robot [new file with mode: 0644]
tests/vpp/device/container_memif/eth2p-ethip4-ip4base-eth-2memif-1dcr-dev.robot [new file with mode: 0644]
tests/vpp/device/container_memif/eth2p-ethip6-ip6base-eth-2memif-1dcr-dev.robot [new file with mode: 0644]

index 7363dc0..7a61bf7 100644 (file)
@@ -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!"
     }
index 786a401..5fa0a57 100644 (file)
@@ -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.
index 76e775f..4017898 100644 (file)
@@ -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:
index c39e24c..e1aba74 100644 (file)
@@ -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:
 
 *** Settings ***
 | Documentation | Keywords related to linux containers
+| ...
+| Library | Collections
+| Library | String
+| ...
 | Library | resources.libraries.python.CpuUtils
 | Library | resources.libraries.python.topology.Topology
 
 | | [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.
 | | ... | - 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
 | | [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
index 614c873..b60ebc9 100644 (file)
@@ -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:
 # 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
 | | 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.
 | | ...
 | | 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.
 | | ...
index ea080a1..a433405 100644 (file)
@@ -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:
 # 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.
 | | ... | \| 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}
 | | [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.
index b20b3d7..1e20369 100644 (file)
@@ -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}
index 306df83..5275f84 100644 (file)
@@ -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 (file)
index 0000000..c5db093
--- /dev/null
@@ -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}
index 65db4e4..40ff2c3 100644 (file)
@@ -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
diff --git a/tests/vpp/device/container_memif/eth2p-eth-l2bdbasemaclrn-eth-2memif-1dcr-dev.robot b/tests/vpp/device/container_memif/eth2p-eth-l2bdbasemaclrn-eth-2memif-1dcr-dev.robot
new file mode 100644 (file)
index 0000000..0131aaf
--- /dev/null
@@ -0,0 +1,114 @@
+# 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:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+| Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
+| Resource | resources/libraries/robot/l2/l2_traffic.robot
+| Resource | resources/libraries/robot/shared/default.robot
+| Resource | resources/libraries/robot/shared/memif.robot
+| Resource | resources/libraries/robot/shared/testing_path.robot
+| ...
+| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV
+| ... | FUNCTEST | L2BDMACLRN | BASE | ETH | MEMIF | DOCKER
+| ...
+| Test Setup | Set up VPP device test
+| ...
+| Test Teardown | Run Keywords
+| ... | Tear down functional test with container
+| ... | AND | Tear down VPP device test
+| ... | AND | Show Memif on all DUTs | ${nodes}
+| ...
+| Documentation | *L2 bridge-domain test cases with memif interface*
+| ...
+| ... | *[Top] Network Topologies:* TG-DUT1-TG 2-node circular topology \
+| ... | with single links between nodes.
+| ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for L2 switching of \
+| ... | IPv4; Eth-IPv6-ICMPv6 for L2 switching of IPv6 use. Both apply to all \
+| ... | links.
+| ... | *[Cfg] DUT configuration:* DUT1 is configured with L2 bridge-domain \
+| ... | switching. Container is connected to VPP via Memif interface. \
+| ... | Container is running same VPP version as running on DUT.
+| ... | *[Ver] TG verification:* Test ICMPv4 (or ICMPv6) Echo Request packets \
+| ... | are sent in both directions by TG on links to DUT1 and via container; \
+| ... | on receive TG verifies packets for correctness and their IPv4 (IPv6) \
+| ... | src-addr, dst-addr and MAC addresses.pecifications:* RFC792
+
+*** Variables ***
+# L2BD
+| ${bd_id1}= | 1
+| ${bd_id2}= | 2
+# Memif
+| ${sock_base}= | memif-DUT1_CNF1
+# Container
+| ${container_engine}= | Docker
+| ${container_chain_topology}= | chain_functional
+
+# TODO: Add update of VPP PIDs after container creation
+*** Test Cases ***
+| tc01-eth2p-ethip4-l2bdbase-eth-2memif-1dcr-device
+| | [Documentation]
+| | ... | [Top] TG=DUT=DCR. [Enc] Eth-IPv4-ICMPv4. [Cfg] Configure two \
+| | ... | L2 bridge-domains (L2BD) with MAC learning enabled on DUT1, each \
+| | ... | with one untagged interface to TG and untagged i/f to docker over \
+| | ... | memif. [Ver] Make TG send ICMPv4 Echo Req in both directions between \
+| | ... | two of its interfaces to be switched by DUT1; verify all packets are \
+| | ... | received.
+| | ...
+| | Given Configure path in 2-node circular topology
+| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
+| | And Set up functional test with containers
+| | And Configure interfaces in path up
+| | When Set up memif interfaces on DUT node | ${dut_node} | ${sock_base}
+| | ... | ${sock_base} | dcr_uuid=${dcr_uuid}
+| | ... | memif_if1=memif_if1 | memif_if2=memif_if2 | rxq=${0} | txq=${0}
+| | And Create bridge domain | ${dut_node} | ${bd_id1}
+| | And Add interface to bridge domain | ${dut_node} | ${dut_to_tg_if1}
+| | ... | ${bd_id1}
+| | And Add interface to bridge domain | ${dut_node} | ${memif_if1}
+| | ... | ${bd_id1}
+| | And Create bridge domain | ${dut_node} | ${bd_id2}
+| | And Add interface to bridge domain | ${dut_node} | ${dut_to_tg_if2}
+| | ... | ${bd_id2}
+| | And Add interface to bridge domain | ${dut_node} | ${memif_if2}
+| | ... | ${bd_id2}
+| | Then Send ICMPv4 bidirectionally and verify received packets | ${tg_node}
+| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if2}
+
+| tc02-eth2p-ethip6-l2bdbase-eth-2memif-1dcr-device
+| | [Documentation]
+| | ... | [Top] TG=DUT=DCR. [Enc] Eth-IPv6-ICMPv6. [Cfg] Configure two \
+| | ... | L2 bridge-domains (L2BD) with MAC learning enabled on DUT1, each \
+| | ... | with one untagged interface to TG and untagged i/f to docker over \
+| | ... | memif. [Ver] Make TG send ICMPv4 Echo Req in both directions between \
+| | ... | two of its interfaces to be switched by DUT1; verify all packets are \
+| | ... | received.
+| | ...
+| | Given Configure path in 2-node circular topology
+| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
+| | And Set up functional test with containers
+| | And Configure interfaces in path up
+| | When Set up memif interfaces on DUT node | ${dut_node} | ${sock_base}
+| | ... | ${sock_base} | dcr_uuid=${dcr_uuid}
+| | ... | memif_if1=memif_if1 | memif_if2=memif_if2 | rxq=${0} | txq=${0}
+| | And Create bridge domain | ${dut_node} | ${bd_id1}
+| | And Add interface to bridge domain | ${dut_node} | ${dut_to_tg_if1}
+| | ... | ${bd_id1}
+| | And Add interface to bridge domain | ${dut_node} | ${memif_if1}
+| | ... | ${bd_id1}
+| | And Create bridge domain | ${dut_node} | ${bd_id2}
+| | And Add interface to bridge domain | ${dut_node} | ${dut_to_tg_if2}
+| | ... | ${bd_id2}
+| | And Add interface to bridge domain | ${dut_node} | ${memif_if2}
+| | ... | ${bd_id2}
+| | Then Send ICMPv6 bidirectionally and verify received packets
+| | ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
diff --git a/tests/vpp/device/container_memif/eth2p-eth-l2xcbase-eth-2memif-1dcr-dev.robot b/tests/vpp/device/container_memif/eth2p-eth-l2xcbase-eth-2memif-1dcr-dev.robot
new file mode 100644 (file)
index 0000000..97b9b00
--- /dev/null
@@ -0,0 +1,95 @@
+# 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:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+| Resource | resources/libraries/robot/l2/l2_xconnect.robot
+| Resource | resources/libraries/robot/l2/l2_traffic.robot
+| Resource | resources/libraries/robot/shared/default.robot
+| Resource | resources/libraries/robot/shared/memif.robot
+| Resource | resources/libraries/robot/shared/testing_path.robot
+| ...
+| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV
+| ... | FUNCTEST | L2XCFWD | BASE | ETH | MEMIF | DOCKER
+| ...
+| Test Setup | Set up VPP device test
+| ...
+| Test Teardown | Run Keywords
+| ... | Tear down functional test with container
+| ... | AND | Tear down VPP device test
+| ... | AND | Show Memif on all DUTs | ${nodes}
+| ...
+| Documentation | *L2 cross-connect test cases with memif interface*
+| ...
+| ... | *[Top] Network Topologies:* TG-DUT1-TG 2-node circular topology with \
+| ... | single links between nodes.
+| ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for L2 switching of \
+| ... | IPv4; Eth-IPv6-ICMPv6 for L2 switching of IPv6.
+| ... | *[Cfg] DUT configuration:* DUT1 is configured with L2 cross-connect \
+| ... | (L2XC) switching. Container is connected to VPP via Memif interface. \
+| ... | Container is running same VPP version as running on DUT.
+| ... | *[Ver] TG verification:* Test ICMPv4 (or ICMPv6) Echo Request packets \
+| ... | are sent in both directions by TG on links to DUT1 and via container; \
+| ... | on receive TG verifies packets for correctness and their IPv4 (IPv6) \
+| ... | src-addr, dst-addr and MAC addresses.
+| ... | *[Ref] Applicable standard specifications:* RFC792
+
+*** Variables ***
+# Memif
+| ${sock_base}= | memif-DUT1_CNF1
+# Container
+| ${container_engine}= | Docker
+| ${container_chain_topology}= | chain_functional
+
+# TODO: Add update of VPP PIDs after container creation
+*** Test Cases ***
+| tc01-eth2p-ethip4-l2xcbase-eth-2memif-1dcr-device
+| | [Documentation]
+| | ... | [Top] TG=DUT=DCR. [Enc] Eth-IPv4-ICMPv4. [Cfg] On DUT configure \
+| | ... | two L2 cross-connects (L2XC), each with one untagged interface \
+| | ... | to TG and untagged i/f to docker over memif. [Ver] Make \
+| | ... | TG send ICMPv4 Echo Reqs in both directions between two of its \
+| | ... | i/fs to be switched by DUT to and from docker; verify all packets \
+| | ... | are received. [Ref]
+| | ...
+| | Given Configure path in 2-node circular topology
+| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
+| | And Set up functional test with containers
+| | And Configure interfaces in path up
+| | When Set up memif interfaces on DUT node | ${dut_node} | ${sock_base}
+| | ... | ${sock_base} | dcr_uuid=${dcr_uuid}
+| | ... | memif_if1=memif_if1 | memif_if2=memif_if2 | rxq=${0} | txq=${0}
+| | And Configure L2XC | ${dut_node} | ${dut_to_tg_if1} | ${memif_if1}
+| | And Configure L2XC | ${dut_node} | ${dut_to_tg_if2} | ${memif_if2}
+| | Then Send ICMPv4 bidirectionally and verify received packets | ${tg_node}
+| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if2}
+
+| tc02-eth2p-ethip6-l2xcbase-eth-2memif-1dcr-device
+| | [Documentation]
+| | ... | [Top] TG=DUT=DCR. [Enc] Eth-IPv6-ICMPv6. [Cfg] On DUT configure\
+| | ... | two L2 cross-connects (L2XC), each with one untagged i/f to TG\
+| | ... | and untagged i/f to docker over memif. [Ver] Make TG send\
+| | ... | ICMPv6 Echo Reqs in both directions between two of its i/fs to\
+| | ... | be switched by DUT to and from docker; verify all packets are\
+| | ... | received. [Ref]
+| | ...
+| | Given Configure path in 2-node circular topology
+| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
+| | And Set up functional test with containers
+| | And Configure interfaces in path up
+| | When Set up memif interfaces on DUT node | ${dut_node} | ${sock_base}
+| | ... | ${sock_base} | dcr_uuid=${dcr_uuid}
+| | ... | memif_if1=memif_if1 | memif_if2=memif_if2 | rxq=${0} | txq=${0}
+| | And Configure L2XC | ${dut_node} | ${dut_to_tg_if1} | ${memif_if1}
+| | And Configure L2XC | ${dut_node} | ${dut_to_tg_if2} | ${memif_if2}
+| | Then Send ICMPv6 bidirectionally and verify received packets | ${tg_node}
+| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if2}
diff --git a/tests/vpp/device/container_memif/eth2p-ethip4-ip4base-eth-2memif-1dcr-dev.robot b/tests/vpp/device/container_memif/eth2p-ethip4-ip4base-eth-2memif-1dcr-dev.robot
new file mode 100644 (file)
index 0000000..35be8c0
--- /dev/null
@@ -0,0 +1,111 @@
+# 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:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+| Library | resources.libraries.python.InterfaceUtil
+| Library | resources.libraries.python.IPv6Util
+| Library | resources.libraries.python.Routing
+| ...
+| Resource | resources/libraries/robot/ip/ip4.robot
+| Resource | resources/libraries/robot/shared/default.robot
+| Resource | resources/libraries/robot/shared/memif.robot
+| Resource | resources/libraries/robot/shared/testing_path.robot
+| Resource | resources/libraries/robot/shared/traffic.robot
+| ...
+| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV
+| ... | FUNCTEST | IP4FWD | BASE | ETH | MEMIF | DOCKER
+| ...
+| Test Setup | Set up VPP device test
+| ...
+| Test Teardown | Run Keywords
+| ... | Tear down functional test with container
+| ... | AND | Tear down VPP device test
+| ... | AND | Show Memif on all DUTs | ${nodes}
+| ...
+| Documentation | *IPv4 routing test cases with memif interface*
+| ...
+| ... | *[Top] Network Topologies:* TG-DUT1-TG 2-node circular topology with \
+| ... | single links between nodes.
+| ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for IPv4 routing on \
+| ... | both links.
+| ... | *[Cfg] DUT configuration:* DUT1 is configured with IPv4 routing and \
+| ... | two static IPv4 /24 route entries. Container is connected to VPP via \
+| ... | Memif interface. Container is running same VPP version as running on \
+| ... | DUT.
+| ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets are sent in \
+| ... | one direction by TG on links to DUT1 and via container; on receive TG \
+| ... | verifies packets for correctness and their IPv4 src-addr, dst-addr and \
+| ... | MAC addresses.
+| ... | *[Ref] Applicable standard specifications:* RFC791, RFC826, RFC792
+
+*** Variables ***
+# IP
+| ${net1}= | 10.0.1.0
+| ${net3}= | 10.0.3.0
+| ${net1_ip1}= | 10.0.1.1
+| ${net1_ip2}= | 10.0.1.2
+| ${net2_ip1}= | 10.0.2.1
+| ${net2_ip2}= | 10.0.2.2
+| ${net3_ip1}= | 10.0.3.1
+| ${net3_ip2}= | 10.0.3.2
+| ${prefix_length}= | 24
+| ${fib_table_2}= | 20
+# Memif
+| ${sock_base}= | memif-DUT1_CNF1
+# Container
+| ${container_engine}= | Docker
+| ${container_chain_topology}= | chain_functional
+
+# TODO: Add update of VPP PIDs after container creation
+*** Test Cases ***
+| tc01-eth2p-ethip4-ip4base-eth-2memif-1dcr-device
+| | [Documentation]
+| | ... | [Top] TG=DUT=DCR. [Enc] Eth-IPv4-ICMPv4. [Cfg] Configure two VRFs to \
+| | ... | route IPv4 traffic through two memif interfaces. Both interfaces are \
+| | ... | configured with IP addresses from the same network. [Ver] Make TG to \
+| | ... | send ICMPv4 Echo Reqest form one TG interface to another one to be \
+| | ... | switched by DUT1; verify header of received packet.
+| | ...
+| | Given Configure path in 2-node circular topology
+| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
+| | And Set up functional test with containers
+| | And Configure interfaces in path up
+| | When Set up memif interfaces on DUT node | ${dut_node} | ${sock_base}
+| | ... | ${sock_base} | dcr_uuid=${dcr_uuid}
+| | ... | memif_if1=memif_if1 | memif_if2=memif_if2 | rxq=${0} | txq=${0}
+| | And Add Fib Table | ${dut_node} | ${fib_table_2}
+| | And Assign Interface To Fib Table | ${dut_node}
+| | ... | ${memif_if2} | ${fib_table_2}
+| | And Assign Interface To Fib Table | ${dut_node}
+| | ... | ${dut_to_tg_if2} | ${fib_table_2}
+| | And Configure IP addresses on interfaces
+| | ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_ip1} | ${prefix_length}
+| | ... | ${dut_node} | ${memif_if1} | ${net2_ip1} | ${prefix_length}
+| | ... | ${dut_node} | ${memif_if2} | ${net2_ip2} | ${prefix_length}
+| | ... | ${dut_node} | ${dut_to_tg_if2} | ${net3_ip1} | ${prefix_length}
+| | ${memif_if2_key}= | Get interface by sw index | ${nodes['DUT1']}
+| | ... | ${memif_if2}
+| | ${memif_if2_mac}= | Get interface MAC | ${nodes['DUT1']} | ${memif_if2_key}
+| | And Vpp Route Add | ${dut_node} | ${net3} | ${prefix_length} | ${net2_ip2}
+| | ... | ${memif_if1} | resolve_attempts=${NONE} | count=${NONE}
+| | And Vpp Route Add | ${dut_node} | ${net1} | ${prefix_length} | ${net2_ip1}
+| | ... | ${memif_if2} | resolve_attempts=${NONE} | count=${NONE}
+| | ... | vrf=${fib_table_2}
+| | Add IP Neighbor | ${dut_node} | ${memif_if1} | ${net2_ip2}
+| | ... | ${memif_if2_mac}
+| | Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2} | ${net3_ip2}
+| | ... | ${tg_to_dut_if2_mac}
+| | Then Send packet and verify headers
+| | ... | ${tg_node} | ${net1_ip2} | ${net3_ip2}
+| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
+| | ... | ${tg_to_dut_if2} | ${dut_to_tg_if2_mac} | ${tg_to_dut_if2_mac}
diff --git a/tests/vpp/device/container_memif/eth2p-ethip6-ip6base-eth-2memif-1dcr-dev.robot b/tests/vpp/device/container_memif/eth2p-ethip6-ip6base-eth-2memif-1dcr-dev.robot
new file mode 100644 (file)
index 0000000..f2de319
--- /dev/null
@@ -0,0 +1,114 @@
+# 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:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+| Library | resources.libraries.python.InterfaceUtil
+| Library | resources.libraries.python.IPv6Setup
+| Library | resources.libraries.python.IPv6Util
+| Library | resources.libraries.python.Routing
+| ...
+| Resource | resources/libraries/robot/shared/default.robot
+| Resource | resources/libraries/robot/shared/memif.robot
+| Resource | resources/libraries/robot/shared/testing_path.robot
+| Resource | resources/libraries/robot/shared/traffic.robot
+| ...
+| Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV
+| ... | FUNCTEST | IP6FWD | BASE | ETH | MEMIF | DOCKER
+| ...
+| Test Setup | Set up VPP device test
+| ...
+| Test Teardown | Run Keywords
+| ... | Tear down functional test with container
+| ... | AND | Tear down VPP device test
+| ... | AND | Show Memif on all DUTs | ${nodes}
+| ...
+| Documentation | *IPv4 routing test cases with memif interface*
+| ...
+| ... | *[Top] Network Topologies:* TG-DUT1-TG 2-node circular topology with \
+| ... | single links between nodes.
+| ... | *[Enc] Packet Encapsulations:* Eth-IPv6-ICMPv6 for IPv6 routing on \
+| ... | both links.
+| ... | *[Cfg] DUT configuration:* DUT1 is configured with IPv6 routing and \
+| ... | two static IPv6 /64 route entries. Container is connected to VPP via \
+| ... | Memif interface. Container is running same VPP version as running on \
+| ... | DUT.
+| ... | *[Ver] TG verification:* Test ICMPv6 Echo Request packets are sent in \
+| ... | one direction by TG on links to DUT1 and via container; on receive TG \
+| ... | verifies packets for correctness and their IPv6 src-addr, dst-addr and \
+| ... | MAC addresses.
+| ... | *[Ref] Applicable standard specifications:* RFC791, RFC826, RFC792
+
+*** Variables ***
+# IP
+| ${net1}= | 2001:1::0
+| ${net3}= | 2001:3::0
+| ${net1_ip1}= | 2001:1::1
+| ${net1_ip2}= | 2001:1::2
+| ${net2_ip1}= | 2001:2::1
+| ${net2_ip2}= | 2001:2::2
+| ${net3_ip1}= | 2001:3::1
+| ${net3_ip2}= | 2001:3::2
+| ${prefix_length}= | 64
+| ${fib_table_2}= | 20
+# Memif
+| ${sock_base}= | memif-DUT1_CNF1
+# Container
+| ${container_engine}= | Docker
+| ${container_chain_topology}= | chain_functional
+
+# TODO: Add update of VPP PIDs after container creation
+*** Test Cases ***
+| tc01-eth2p-ethip6-ip6base-eth-2memif-1dcr-device
+| | [Documentation]
+| | ... | [Top] TG=DUT=DCR. [Enc] Eth-IPv6-ICMPv6. [Cfg] Configure two VRFs to \
+| | ... | route IPv6 traffic through two memif interfaces. Both interfaces are \
+| | ... | configured with IP addresses from the same network. [Ver] Make TG to \
+| | ... | send ICMPv6 Echo Reqest form one TG interface to another one to be \
+| | ... | switched by DUT1; verify header of received packet.
+| | ...
+| | Given Configure path in 2-node circular topology
+| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
+| | And Set up functional test with containers
+| | And Configure interfaces in path up
+| | When Set up memif interfaces on DUT node | ${dut_node} | ${sock_base}
+| | ... | ${sock_base} | dcr_uuid=${dcr_uuid}
+| | ... | memif_if1=memif_if1 | memif_if2=memif_if2 | rxq=${0} | txq=${0}
+| | And Add Fib Table | ${dut_node} | ${fib_table_2}
+| | And Assign Interface To Fib Table | ${dut_node}
+| | ... | ${memif_if2} | ${fib_table_2}
+| | And Assign Interface To Fib Table | ${dut_node}
+| | ... | ${dut_to_tg_if2} | ${fib_table_2}
+| | And Vpp Set If IPv6 Addr | ${dut_node} | ${dut_to_tg_if1} | ${net1_ip1}
+| | ... | ${prefix_length}
+| | And Vpp Set If IPv6 Addr | ${dut_node} | ${memif_if1} | ${net2_ip1}
+| | ... | ${prefix_length}
+| | And Vpp Set If IPv6 Addr | ${dut_node} | ${memif_if2} | ${net2_ip2}
+| | ... | ${prefix_length}
+| | And Vpp Set If IPv6 Addr | ${dut_node} | ${dut_to_tg_if2} | ${net3_ip1}
+| | ... | ${prefix_length}
+| | ${memif_if2_key}= | Get interface by sw index | ${nodes['DUT1']}
+| | ... | ${memif_if2}
+| | ${memif_if2_mac}= | Get interface MAC | ${nodes['DUT1']} | ${memif_if2_key}
+| | And Vpp Route Add | ${dut_node} | ${net3} | ${prefix_length} | ${net2_ip2}
+| | ... | ${memif_if1} | resolve_attempts=${NONE} | count=${NONE}
+| | And Vpp Route Add | ${dut_node} | ${net1} | ${prefix_length} | ${net2_ip1}
+| | ... | ${memif_if2} | resolve_attempts=${NONE} | count=${NONE}
+| | ... | vrf=${fib_table_2}
+| | Add IP Neighbor | ${dut_node} | ${memif_if1} | ${net2_ip2}
+| | ... | ${memif_if2_mac}
+| | Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2} | ${net3_ip2}
+| | ... | ${tg_to_dut_if2_mac}
+| | Then Send packet and verify headers
+| | ... | ${tg_node} | ${net1_ip2} | ${net3_ip2}
+| | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
+| | ... | ${tg_to_dut_if2} | ${dut_to_tg_if2_mac} | ${tg_to_dut_if2_mac}