test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Qiu, Michael" <michael.qiu@intel.com>
To: "Jiajia, SunX" <sunx.jiajia@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH v2 05/19] Add a module to instantiate the VM
Date: Mon, 25 May 2015 06:10:31 +0000	[thread overview]
Message-ID: <533710CFB86FA344BFBF2D6802E6028604680F0A@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1432285452-14286-6-git-send-email-sunx.jiajia@intel.com>

On 5/22/2015 5:04 PM, Jiajia, Sun wrote:
> From: sjiajiax <sunx.jiajia@intel.com>
>
> Added module: virt_dut.py
>
> Signed-off-by: sjiajiax <sunx.jiajia@intel.com>
> ---
>  framework/virt_dut.py | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 202 insertions(+)
>  create mode 100644 framework/virt_dut.py
>
> diff --git a/framework/virt_dut.py b/framework/virt_dut.py
> new file mode 100644
> index 0000000..273b29e
> --- /dev/null
> +++ b/framework/virt_dut.py
> @@ -0,0 +1,202 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> +# All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions
> +# are met:
> +#
> +#   * Redistributions of source code must retain the above copyright
> +#     notice, this list of conditions and the following disclaimer.
> +#   * Redistributions in binary form must reproduce the above copyright
> +#     notice, this list of conditions and the following disclaimer in
> +#     the documentation and/or other materials provided with the
> +#     distribution.
> +#   * Neither the name of Intel Corporation nor the names of its
> +#     contributors may be used to endorse or promote products derived
> +#     from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +import os
> +import re
> +import time
> +import dts
> +import settings
> +from config import PortConf
> +from settings import NICS, LOG_NAME_SEP
> +from ssh_connection import SSHConnection
> +from project_dpdk import DPDKdut
> +from dut import Dut
> +from net_device import NetDevice
> +from logger import getLogger
> +
> +
> +class VirtDut(DPDKdut):
> +
> +    """
> +    A connection to the CRB under test.
> +    This class sends commands to the CRB and validates the responses. It is
> +    implemented using either ssh for linuxapp or the terminal server for
> +    baremetal.
> +    All operations are in fact delegated to an instance of either CRBLinuxApp
> +    or CRBBareMetal.
> +    """
> +
> +    def __init__(self, crb, serializer, vm_name, suite):
> +        super(Dut, self).__init__(crb, serializer)
> +        self.vm_ip = self.get_ip_address()
> +        self.NAME = 'virtdut' + LOG_NAME_SEP + '%s' % self.vm_ip
> +        # load port config from suite cfg
> +        self.suite = suite
> +        self.logger = getLogger(self.NAME)
> +        self.logger.config_execution('vmdut')
> +        self.session = SSHConnection(self.vm_ip, self.NAME,
> +                                     self.get_password())
> +        self.session.init_log(self.logger)
> +
> +        # if redirect ssh port, there's only one session enabled
> +        self.alt_session = SSHConnection(self.vm_ip, self.NAME + '_alt',
> +                                         self.get_password())
> +        self.alt_session.init_log(self.logger)
> +
> +        self.number_of_cores = 0
> +        self.tester = None
> +        self.cores = []
> +        self.architecture = None
> +        self.ports_info = None
> +        self.ports_map = []
> +
> +    def set_nic_type(self, nic_type):
> +        """
> +        Set CRB NICS ready to validated.
> +        """
> +        self.nic_type = nic_type
> +        # vm_dut config will load from vm configuration file
> +
> +    def load_portconf(self):
> +        """
> +        Load port config for this virtual machine
> +        """
> +        return
> +
> +    def set_target(self, target):
> +        """
> +        Set env variable, these have to be setup all the time. Some tests
> +        need to compile example apps by themselves and will fail otherwise.
> +        Set hugepage on DUT and install modules required by DPDK.
> +        Configure default ixgbe PMD function.
> +        """
> +        self.set_toolchain(target)
> +
> +        # set env variable
> +        # These have to be setup all the time. Some tests need to compile
> +        # example apps by themselves and will fail otherwise.
> +        self.send_expect("export RTE_TARGET=" + target, "#")
> +        self.send_expect("export RTE_SDK=`pwd`", "#")

Could "RTE_SDK" be configed in config file?

> +
> +        if not self.skip_setup:
> +            self.build_install_dpdk(target)
> +
> +        self.setup_memory(hugepages=512)
> +        self.setup_modules(target)
> +
> +        self.bind_interfaces_linux('igb_uio')
> +
> +    def prerequisites(self, pkgName, patch):
> +        """
> +        Prerequest function should be called before execute any test case.
> +        Will call function to scan all lcore's information which on DUT.
> +        Then call pci scan function to collect nic device information.
> +        At last setup DUT' environment for validation.
> +        """
> +        self.prepare_package(pkgName, patch)
> +
> +        self.send_expect("cd %s" % self.base_dir, "# ")
> +        self.host_session.send_expect("cd %s" % self.base_dir, "# ")
> +        self.send_expect("alias ls='ls --color=none'", "#")
> +
> +        self.init_core_list()
> +        self.pci_devices_information()
> +
> +        # scan ports before restore interface
> +        self.scan_ports()
> +        # restore dut ports to kernel
> +        self.restore_interfaces()
> +        # rescan ports after interface up
> +        self.rescan_ports()
> +
> +        # no need to rescan ports for guest os just bootup
> +        # load port infor from config file
> +        self.load_portconf()
> +
> +        # enable tester port ipv6
> +        self.host_dut.enable_tester_ipv6()
> +        self.mount_procfs()
> +        # auto detect network topology
> +        self.map_available_ports()
> +        # disable tester port ipv6
> +        self.host_dut.disable_tester_ipv6()
> +
> +        # print latest ports_info
> +        for port_info in self.ports_info:
> +            self.logger.info(port_info)
> +
> +    def pci_devices_information(self):
> +        self.pci_devices_information_uncached()
> +
> +    def get_memory_channels(self):
> +        """
> +        Virtual machine has no memory channel concept, so always return 1
> +        """
> +        return 1
> +
> +    def check_ports_available(self, pci_bus, pci_id):
> +        """
> +        Check that whether auto scanned ports ready to use
> +        """
> +        pci_addr = "%s:%s" % (pci_bus, pci_id)
> +        if pci_id == "8086:100e":
> +            return False

Why here return false? better to give some comments.

Also pci_id here should be pci_addr I think.

> +        return True
> +
> +    def scan_ports(self):
> +        """
> +        Scan ports information, for vm will always scan
> +        """
> +        self.scan_ports_uncached()
> +
> +    def scan_ports_uncached(self):
> +        """
> +        Scan ports and collect port's pci id, mac adress, ipv6 address.
> +        """
> +        scan_ports_uncached = getattr(
> +            self, 'scan_ports_uncached_%s' % self.get_os_type())
> +        return scan_ports_uncached()
> +
> +    def map_available_ports(self):
> +        """
> +        Load or generate network connection mapping list.
> +        """
> +        self.map_available_ports_uncached()
> +        self.logger.warning("DUT PORT MAP: " + str(self.ports_map))
> +
> +    def send_ping6(self, localPort, ipv6, mac=''):
> +        """
> +        Send ping6 packet from local port with destination ipv6 address.
> +        """
> +        if self.ports_info[localPort]['type'] == 'ixia':
> +            pass
> +        else:
> +            return self.send_expect("ping6 -w 1 -c 1 -A -I %s %s" % (self.ports_info[localPort]['intf'], ipv6), "# ", 10)


  reply	other threads:[~2015-05-25  6:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-22  9:03 [dts] [PATCH v2 00/19] *** Enable virtualization test for dts framework *** Jiajia, Sun
2015-05-22  9:03 ` [dts] [PATCH v2 01/19] Abstract the NIC device as the single class NetDevice Jiajia, Sun
2015-05-22  9:03 ` [dts] [PATCH v2 02/19] Add a base module for virtual test Jiajia, Sun
2015-05-22  9:03 ` [dts] [PATCH v2 03/19] Add QEMU KVM module based on virt_base module for KVM test cases Jiajia, Sun
2015-05-22  9:03 ` [dts] [PATCH v2 04/19] Add a module to manage the host resource Jiajia, Sun
2015-05-22  9:03 ` [dts] [PATCH v2 05/19] Add a module to instantiate the VM Jiajia, Sun
2015-05-25  6:10   ` Qiu, Michael [this message]
2015-05-25  9:14     ` Jiajia, SunX
2015-05-26  9:07       ` Qiu, Michael
2015-05-27  1:36         ` Jiajia, SunX
2015-05-22  9:03 ` [dts] [PATCH v2 06/19] Add a third-party module of qemu-guest-agent to manage VM Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 07/19] Move some general functions from dts.py to utils.py and settings.py Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 08/19] Add and move some functions because of the virtual tests and network device instantiation Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 09/19] Change and add some functions to support virtual test Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 10/19] add some exceptions to support framwork to handle virtual test exceptions Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 11/19] Add some codes to support virtual test log Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 12/19] Add some codes to make session to support virtual test Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 13/19] Add some base functions to get the device info in the testpmd Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 14/19] Change some codes to support network device instantiation and virtualization test Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 15/19] Add some codes to support network instantiation in the tester module Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 16/19] Make test_case know its suite name Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 17/19] Add a global virtualization config and a config related to SRIOV KVM suite Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 18/19] Add a test plan of how to test SRIOV on the KVM ENV Jiajia, Sun
2015-05-22  9:04 ` [dts] [PATCH v2 19/19] Add a test suite to verify the SRIOV feature " Jiajia, Sun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=533710CFB86FA344BFBF2D6802E6028604680F0A@SHSMSX101.ccr.corp.intel.com \
    --to=michael.qiu@intel.com \
    --cc=dts@dpdk.org \
    --cc=sunx.jiajia@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).