ROBOT_LIBRARY_SCOPE = 'TEST CASE'
def __init__(self, node, qemu_id=1, smp=1, mem=512, vnf=None,
- img='/var/lib/vm/vhost-nested.img', bin_path='/usr/bin'):
+ img=Constants.QEMU_VM_IMAGE):
"""Initialize QemuUtil class.
:param node: Node to run QEMU on.
:param mem: Amount of memory.
:param vnf: Network function workload.
:param img: QEMU disk image or kernel image path.
- :param bin_path: QEMU binary path.
:type node: dict
:type qemu_id: int
:type smp: int
:type mem: int
:type vnf: str
:type img: str
- :type bin_path: str
"""
self._vhost_id = 0
self._node = node
# Input Options.
self._opt = dict()
self._opt['qemu_id'] = qemu_id
- self._opt['bin_path'] = bin_path
self._opt['mem'] = int(mem)
self._opt['smp'] = int(smp)
self._opt['img'] = img
:type kwargs: dict
"""
testpmd_path = ('{path}/{arch}-native-linuxapp-gcc/app'.
- format(path=Constants.QEMU_PERF_VM_DPDK,
+ format(path=Constants.QEMU_VM_DPDK,
arch=Topology.get_node_arch(self._node)))
testpmd_cmd = DpdkUtil.get_testpmd_cmdline(
eal_corelist='0-{smp}'.format(smp=self._opt.get('smp') - 1),
:type kwargs: dict
"""
testpmd_path = ('{path}/{arch}-native-linuxapp-gcc/app'.
- format(path=Constants.QEMU_PERF_VM_DPDK,
+ format(path=Constants.QEMU_VM_DPDK,
arch=Topology.get_node_arch(self._node)))
testpmd_cmd = DpdkUtil.get_testpmd_cmdline(
eal_corelist='0-{smp}'.format(smp=self._opt.get('smp') - 1),
:rtype: dict
"""
command = ('{bin_path}/qemu-system-{arch} {params}'.
- format(bin_path=self._opt.get('bin_path'),
+ format(bin_path=Constants.QEMU_BIN_PATH,
arch=Topology.get_node_arch(self._node),
params=self._params))
message = ('QEMU: Start failed on {host}!'.
:rtype: str or bool
"""
command = ('{bin_path}/qemu-system-{arch} --version'.
- format(bin_path=self._opt.get('bin_path'),
+ format(bin_path=Constants.QEMU_BIN_PATH,
arch=Topology.get_node_arch(self._node)))
try:
stdout, _ = exec_cmd_no_error(self._node, command, sudo=True)
except RuntimeError:
self.qemu_kill_all()
raise
-
- @staticmethod
- def build_qemu(node, force_install=False, apply_patch=False):
- """Build QEMU from sources.
-
- :param node: Node to build QEMU on.
- :param force_install: If True, then remove previous build.
- :param apply_patch: If True, then apply patches from qemu_patches dir.
- :type node: dict
- :type force_install: bool
- :type apply_patch: bool
- :raises RuntimeError: If building QEMU failed.
- """
- directory = (' --directory={install_dir}{patch}'.
- format(install_dir=Constants.QEMU_INSTALL_DIR,
- patch='-patch' if apply_patch else '-base'))
- version = (' --version={install_version}'.
- format(install_version=Constants.QEMU_INSTALL_VERSION))
- force = ' --force' if force_install else ''
- patch = ' --patch' if apply_patch else ''
- target_list = (' --target-list={arch}-softmmu'.
- format(arch=Topology.get_node_arch(node)))
-
- command = ("sudo -E sh -c "
- "'{fw_dir}/{lib_sh}/qemu_build.sh{version}{directory}"
- "{force}{patch}{target_list}'".
- format(fw_dir=Constants.REMOTE_FW_DIR,
- lib_sh=Constants.RESOURCES_LIB_SH,
- version=version, directory=directory, force=force,
- patch=patch, target_list=target_list))
- message = ('QEMU: Build failed on {host}!'.format(host=node['host']))
- exec_cmd_no_error(node, command, sudo=False, message=message,
- timeout=1000)
| | ... | ${qemu_id}=${1} | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024}
| | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${True}
| | ...
-| | ${apply_patch}= | Set Variable | ${False}
-| | ${perf_qemu_path}= | Set Variable If | ${apply_patch}
-| | ... | ${perf_qemu_path}-patch/bin
-| | ... | ${perf_qemu_path}-base/bin
| | ${nf_cpus_count}= | Get Length | ${nf_cpus}
| | ${rxq}= | Run Keyword If | ${auto_scale} == ${True}
| | ... | Set Variable | ${rxq_count_int}
| | ... | ELSE | Set Variable | ${1}
| | Import Library | resources.libraries.python.QemuUtils | ${nodes['${dut}']}
| | ... | qemu_id=${qemu_id} | smp=${nf_cpus_count} | mem=${2048}
-| | ... | img=${perf_vm_image} | bin_path=${perf_qemu_path}
| | ... | WITH NAME | ${vm_name}
| | Run Keyword | ${vm_name}.Qemu Add Vhost User If | ${sock1}
| | ... | jumbo_frames=${jumbo} | queues=${rxq_count_int}
| | Run Keyword | ${vm_name}.Qemu Add Vhost User If | ${sock2}
| | ... | jumbo_frames=${jumbo} | queues=${rxq_count_int}
| | ... | queue_size=${perf_qemu_qsz}
-| | Run Keyword If | ${qemu_build} | ${vm_name}.Build QEMU | ${nodes['${dut}']}
-| | ... | apply_patch=${apply_patch}
| | ${vm}= | Run Keyword | ${vm_name}.Qemu Start
| | Run Keyword | ${vm_name}.Qemu Set Affinity | @{nf_cpus}
| | Run Keyword If | ${use_tuned_cfs} | ${vm_name}.Qemu Set Scheduler Policy
| | ... | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024}
| | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${True}
| | ...
-| | ${apply_patch}= | Set Variable | ${False}
-| | ${perf_qemu_path}= | Set Variable If | ${apply_patch}
-| | ... | ${perf_qemu_path}-patch/bin
-| | ... | ${perf_qemu_path}-base/bin
| | ${nf_cpus_count}= | Get Length | ${nf_cpus}
| | ${rxq}= | Run Keyword If | ${auto_scale} == ${True}
| | ... | Set Variable | ${rxq_count_int}
| | ... | ELSE | Set Variable | ${1}
| | Import Library | resources.libraries.python.QemuUtils | ${nodes['${dut}']}
| | ... | qemu_id=${qemu_id} | smp=${nf_cpus_count} | mem=${2048}
-| | ... | img=${perf_vm_image} | bin_path=${perf_qemu_path}
| | ... | WITH NAME | ${vm_name}
| | Run keyword | ${vm_name}.Qemu Add Vhost User If | ${sock1}
| | ... | jumbo_frames=${jumbo} | queues=${rxq_count_int}
| | Run keyword | ${vm_name}.Qemu Add Vhost User If | ${sock2}
| | ... | jumbo_frames=${jumbo} | queues=${rxq_count_int}
| | ... | queue_size=${perf_qemu_qsz}
-| | Run Keyword If | ${qemu_build} | ${vm_name}.Build QEMU | ${nodes['${dut}']}
-| | ... | apply_patch=${False}
| | ${vm}= | Run keyword | ${vm_name}.Qemu Start
| | Run keyword | ${vm_name}.Qemu Set Affinity | @{nf_cpus}
| | Run keyword If | ${use_tuned_cfs} | ${vm_name}.Qemu Set Scheduler Policy
| | All VPP Interfaces Ready Wait | ${nodes} | timeout=${90}
| | VPP round robin RX placement on all DUTs | ${nodes} | prefix=Virtual
-| Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user on node
-| | [Documentation]
-| | ... | Start 1 chain of 1..N QEMU guests (VNFs) with two vhost-user\
-| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\
-| | ... | rewrite on VPP node.
-| | ...
-| | ... | *Arguments:*
-| | ... | - dut - DUT node to start guest VM on. Type: dictionary
-| | ... | - nf_chains - Number of chains of NFs. Type: integer
-| | ... | - nf_chain - NF chain ID. Type: integer
-| | ... | - nf_nodes - Number of guest VMs. Type: integer
-| | ... | - jumbo - Jumbo frames are used (True) or are not used (False)
-| | ... | in the test. Type: boolean
-| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer
-| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP.
-| | ... | Type: boolean
-| | ... | - auto_scale - Whether to use same amount of RXQs for vhost interface
-| | ... | in VM as vswitch, otherwise use single RXQ. Type: boolean
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Configure chain of NFs with dpdk-testpmd-mac connected via \
-| | ... | vhost-user on node \| DUT1 \| 1 \| 1 \| 1 \| False \| 1024 \|
-| | ...
-| | [Arguments] | ${dut} | ${nf_chains}=${1} | ${nf_chain}=${1}
-| | ... | ${nf_nodes}=${1} | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024}
-| | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${False}
-| | ...
-| | ${tg_if1_mac}= | Get Interface MAC | ${tg} | ${tg_if1}
-| | ${tg_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2}
-| | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes} + ${1}
-| | | ${nf_cpus}= | Create network function CPU list | ${dut}
-| | | ... | chains=${nf_chains} | nodeness=${nf_nodes} | chain_id=${nf_chain}
-| | | ... | node_id=${nf_node} | auto_scale=${False}
-| | | ${qemu_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node}
-| | | ${sock1}= | Set Variable | /var/run/vpp/sock-${qemu_id}-1
-| | | ${sock2}= | Set Variable | /var/run/vpp/sock-${qemu_id}-2
-| | | ${nf_name}= | Set Variable | ${dut}_VM${qemu_id}
-| | | ${prev_qemu_id}= | Evaluate | ${qemu_id} - ${1}
-| | | ${next_qemu_id}= | Evaluate | ${qemu_id} + ${1}
-| | | ${prev_qemu_id_hex}= | Convert To Hex | ${prev_qemu_id} | length=2
-| | | ... | lowercase=yes
-| | | ${next_qemu_id_hex}= | Convert To Hex | ${next_qemu_id} | length=2
-| | | ... | lowercase=yes
-| | | ${vif1_mac}= | Set Variable If | ${nf_node} == ${1}
-| | | ... | ${tg_if1_mac}
-| | | ... | 52:54:00:00:${prev_qemu_id_hex}:02
-| | | ${vif2_mac}= | Set Variable If | ${nf_node} == ${nf_nodes}
-| | | ... | ${tg_if2_mac}
-| | | ... | 52:54:00:00:${next_qemu_id_hex}:01
-| | | ${vm}=
-| | | ... | Configure guest VM with dpdk-testpmd-mac connected via vhost-user
-| | | ... | ${dut} | ${sock1} | ${sock2} | ${nf_name} | ${vif1_mac}
-| | | ... | ${vif2_mac} | ${nf_cpus} | qemu_id=${qemu_id} | jumbo=${jumbo}
-| | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${use_tuned_cfs}
-| | | ... | auto_scale=${auto_scale}
-| | | Set To Dictionary | ${${dut}_vm_refs} | ${nf_name} | ${vm}
-
-| Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user
-| | [Documentation]
-| | ... | Start 1 chain of 1..N QEMU guests (VNFs) with two vhost-user\
-| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\
-| | ... | rewrite on all defined VPP nodes.
-| | ...
-| | ... | *Arguments:*
-| | ... | - nf_chains - Number of chains of NFs. Type: integer
-| | ... | - nf_chain - NF chain ID. Type: integer
-| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer
-| | ... | - jumbo - Jumbo frames are used (True) or are not used (False)
-| | ... | in the test. Type: boolean
-| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer
-| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP.
-| | ... | Type: boolean
-| | ... | - auto_scale - Whether to use same amount of RXQs for vhost interface
-| | ... | in VM as vswitch, otherwise use single RXQ. Type: boolean
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Configure chain of NFs with dpdk-testpmd-mac connected via\
-| | ... | vhost-user \| 1 \| 1 \| 1 \| False \| 1024 \|
-| | ...
-| | [Arguments] | ${nf_chains}=${1} | ${nf_chain}=${1} | ${nf_nodes}=${1}
-| | ... | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024}
-| | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${False}
-| | ...
-| | ${duts}= | Get Matches | ${nodes} | DUT*
-| | :FOR | ${dut} | IN | @{duts}
-| | | Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user on node
-| | | ... | ${dut} | nf_chains=${nf_chains} | nf_chain=${nf_chain}
-| | | ... | nf_nodes=${nf_nodes} | jumbo=${jumbo}
-| | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${False}
-| | | ... | auto_scale=${auto_scale}
-
-| Configure chains of NFs with dpdk-testpmd-mac connected via vhost-user
-| | [Documentation]
-| | ... | Start 1..N chains of 1..N QEMU guests (VNFs) with two vhost-user\
-| | ... | interfaces and interconnecting DPDK testpmd with fwd mode set to mac\
-| | ... | rewrite on all defined VPP nodes.
-| | ...
-| | ... | *Arguments:*
-| | ... | - nf_chains - Number of chains of NFs. Type: integer
-| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer
-| | ... | - jumbo - Jumbo frames are used (True) or are not used (False)
-| | ... | in the test. Type: boolean
-| | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer
-| | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP.
-| | ... | Type: boolean
-| | ... | - auto_scale - Whether to use same amount of RXQs for memif interface
-| | ... | in containers as vswitch, otherwise use single RXQ. Type: boolean
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Configure chains of VMs with dpdk-testpmd-mac connected via \
-| | ... | vhost-user \| 1 \| 1 \| False \| 1024 \|
-| | ...
-| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${jumbo}=${False}
-| | ... | ${perf_qemu_qsz}=${1024} | ${use_tuned_cfs}=${False}
-| | ... | ${auto_scale}=${False}
-| | ...
-| | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains}+1
-| | | Configure chain of NFs with dpdk-testpmd-mac connected via vhost-user
-| | | ... | nf_chains=${nf_chains} | nf_chain=${nf_chain} | nf_nodes=${nf_nodes}
-| | | ... | jumbo=${jumbo} | perf_qemu_qsz=${perf_qemu_qsz}
-| | | ... | use_tuned_cfs=${False} | auto_scale=${auto_scale}
-| | All VPP Interfaces Ready Wait | ${nodes}
-| | VPP round robin RX placement on all DUTs | ${nodes} | prefix=Virtual
-
| Initialize LISP IPv4 forwarding in 3-node circular topology
| | [Documentation] | Custom setup of IPv4 addresses on all DUT nodes and TG \
| | ... | Don`t set route.