ber.Integer.Long */ }
# Copyright (c) 2016 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.

QEMU is used for VPP-VM testing enviroment. You need to run qemu-2.2.1 or newer
in order to Vhos-user support. In CSIT VIRL setup DUT has preinstalled QEMU and
have small VM image "/var/lib/vm/vhost-nested.img". QEMU binary path must
be "/opt/qemu/bin/qemu-system-x86_64". You can use following script to replicate
QEMU setup on DUT "resources/libraries/bash/qemu_build.sh" for local testing,
out of LF's VM setup. VM image must have installed at least qemu-guest-agent,
sshd, bridge-utils and VirtIO support. Note that VPP must be installed before
starting QEMU, because VPP will do the hugepages configuration as part of it's
installation process. Username/password for the VM must be cisco/cisco and
NOPASSWD sudo access. The interface naming is based on driver (management
interface type is Intel E1000), all E1000 interfaces will be named mgmt<n> and
all VirtIO interfaces will be named virtio<n>. In VM
"/etc/init.d/qemu-guest-agent" you must set "TRANSPORT=isa-serial:/dev/ttyS1"
because ttyS0 is used by serial console and ttyS1 is dedicated for
qemu-guest-agent in QEMU setup.
There is python library for QEMU setup, start and some utilities
"resources/libraries/python/QemuUtils.py" and keyword "Stop and Clear QEMU" for
teardown in resources/libraries/robot/vm/qemu.robot. "Qemu Start" setup one
management interface by default. You can add Vhost-user interfaces by
"Qemu Add Vhost User If" keyword.
Example usage in robot framework test:

*** Settings ***
| Resource | resources/libraries/robot/vm/qemu.robot

*** Test Cases ***
| VM test
| | [Tags] | VPP_VM_ENV
| | Qemu Set Node | ${nodes['DUT1']}
| | Qemu Add Vhost User If | /tmp/vhost_sock
| | ${vm}= | Set Variable | ${None}
| | ${vm}= | Qemu Start
| | [Teardown] | Stop and Clear QEMU | ${dut1} | ${vm}

Note that VPP must be started and configured before starting the VM when using
Vhost-user interfaces.