Exemple #1
0
 def flood_ping():
     logging.info("Flood with large frames")
     virt_test_utils.ping(ip,
                          interface=ifname,
                          packetsize=max_icmp_pkt_size,
                          flood=True,
                          timeout=float(flood_time))
Exemple #2
0
 def flood_ping(src, dst):
     # we must use a dedicated session becuase the aexpect
     # does not have the other method to interrupt the process in
     # the guest rather than close the session.
     session_flood = vm[src].wait_for_login(timeout=60)
     virt_test_utils.ping(vlan_ip[dst],
                          flood=True,
                          interface=ifname[src],
                          session=session_flood,
                          timeout=10)
     session_flood.close()
Exemple #3
0
        def size_increase_ping(step=random.randrange(90, 110)):
            logging.info("Size increase ping")
            for size in range(0, max_icmp_pkt_size + 1, step):
                logging.info("Ping %s with size %s", ip, size)
                s, o = virt_test_utils.ping(ip, 1, interface=ifname,
                                           packetsize=size,
                                           hint="do", timeout=1)
                if s != 0:
                    s, o = virt_test_utils.ping(ip, 10, interface=ifname,
                                               packetsize=size,
                                               adaptive=True, hint="do",
                                               timeout=20)

                    if virt_test_utils.get_loss_ratio(o) > int(params.get(
                                                      "fail_ratio", 50)):
                        raise error.TestFail("Ping loss ratio is greater "
                                             "than 50% for size %s" % size)
Exemple #4
0
 def is_mtu_ok():
     s, o = virt_test_utils.ping(ip,
                                 1,
                                 interface=ifname,
                                 packetsize=max_icmp_pkt_size,
                                 hint="do",
                                 timeout=2)
     return s == 0
Exemple #5
0
 def large_frame_ping(count=100):
     logging.info("Large frame ping")
     s, o = virt_test_utils.ping(ip, count, interface=ifname,
                                packetsize=max_icmp_pkt_size,
                                timeout=float(count) * 2)
     ratio = virt_test_utils.get_loss_ratio(o)
     if ratio != 0:
         raise error.TestFail("Loss ratio of large frame ping is %s" %
                              ratio)
Exemple #6
0
 def large_frame_ping(count=100):
     logging.info("Large frame ping")
     s, o = virt_test_utils.ping(ip,
                                 count,
                                 interface=ifname,
                                 packetsize=max_icmp_pkt_size,
                                 timeout=float(count) * 2)
     ratio = virt_test_utils.get_loss_ratio(o)
     if ratio != 0:
         raise error.TestFail("Loss ratio of large frame ping is %s" %
                              ratio)
Exemple #7
0
 def verify_mtu():
     logging.info("Verify the path MTU")
     s, o = virt_test_utils.ping(ip, 10, interface=ifname,
                                packetsize=max_icmp_pkt_size,
                                hint="do", timeout=15)
     if s != 0 :
         logging.error(o)
         raise error.TestFail("Path MTU is not as expected")
     if virt_test_utils.get_loss_ratio(o) != 0:
         logging.error(o)
         raise error.TestFail("Packet loss ratio during MTU "
                              "verification is not zero")
Exemple #8
0
    def set_link_test(linkid):
        """
        Issue set_link commands and test its function

        @param linkid: id of netdev or devices to be tested
        """
        ip = vm.get_address(0)

        vm.set_link(linkid, up=False)
        s, o = virt_test_utils.ping(ip, count=10, timeout=20)
        if virt_test_utils.get_loss_ratio(o) != 100:
            raise error.TestFail("Still can ping the %s after down %s" %
                                 (ip, linkid))

        vm.set_link(linkid, up=True)
        s, o = virt_test_utils.ping(ip, count=10, timeout=20)
        # we use 100% here as the notification of link status changed may be
        # delayed in guest driver
        if virt_test_utils.get_loss_ratio(o) == 100:
            raise error.TestFail("Packet loss during ping %s after up %s" %
                                 (ip, linkid))
Exemple #9
0
        def size_increase_ping(step=random.randrange(90, 110)):
            logging.info("Size increase ping")
            for size in range(0, max_icmp_pkt_size + 1, step):
                logging.info("Ping %s with size %s", ip, size)
                s, o = virt_test_utils.ping(ip,
                                            1,
                                            interface=ifname,
                                            packetsize=size,
                                            hint="do",
                                            timeout=1)
                if s != 0:
                    s, o = virt_test_utils.ping(ip,
                                                10,
                                                interface=ifname,
                                                packetsize=size,
                                                adaptive=True,
                                                hint="do",
                                                timeout=20)

                    if virt_test_utils.get_loss_ratio(o) > int(
                            params.get("fail_ratio", 50)):
                        raise error.TestFail("Ping loss ratio is greater "
                                             "than 50% for size %s" % size)
Exemple #10
0
 def verify_mtu():
     logging.info("Verify the path MTU")
     s, o = virt_test_utils.ping(ip,
                                 10,
                                 interface=ifname,
                                 packetsize=max_icmp_pkt_size,
                                 hint="do",
                                 timeout=15)
     if s != 0:
         logging.error(o)
         raise error.TestFail("Path MTU is not as expected")
     if virt_test_utils.get_loss_ratio(o) != 0:
         logging.error(o)
         raise error.TestFail("Packet loss ratio during MTU "
                              "verification is not zero")
Exemple #11
0
    vm_ref = params.get("vm_ref", vm.name)
    options = params.get("virsh_migrate_options")
    extra = params.get("virsh_migrate_extra")
    delay = int(params.get("virsh_migrate_delay", 10))
    status_error = params.get("status_error", 'no')
    libvirtd_state = params.get("virsh_migrate_libvirtd_state", 'on')
    src_state = params.get("virsh_migrate_src_state", "running")
    new_nic_mac = "ff:ff:ff:ff:ff:ff"
    dest_xmlfile = ""

    exception = False
    try:
        # Confirm VM can be accessed through network.
        time.sleep(delay)
        vm_ip = vm.get_address()
        s_ping, o_ping = virt_test_utils.ping(vm_ip, count=2, timeout=delay)
        logging.info(o_ping)
        if s_ping != 0:
            raise error.TestError("%s did not respond after %d sec." % (vm.name, delay))

        # Prepare for --xml.
        logging.debug("Preparing new xml file for --xml option.")
        if options.count("xml") or extra.count("xml"):
            dest_xmlfile = params.get("virsh_migrate_xml", "")
            if dest_xmlfile:
                ret_attach = vm.attach_interface("--type bridge --source virbr0 --mac %s" % new_nic_mac, True, True)
                if not ret_attach:
                    exception = True
                    raise error.TestError("Attaching nic to %s failed." % vm.name)
                vm_xml_new = vm.get_xml()
                logging.debug("Xml file on source: %s" % vm_xml_new)
Exemple #12
0
def run_nic_hotplug(test, params, env):
    """
    Test hotplug of NIC devices

    1) Boot up guest with one nic
    2) Add a host network device through monitor cmd and check if it's added
    3) Add nic device through monitor cmd and check if it's added
    4) Check if new interface gets ip address
    5) Disable primary link of guest
    6) Ping guest new ip from host
    7) Delete nic device and netdev
    8) Re-enable primary link of guest

    BEWARE OF THE NETWORK BRIDGE DEVICE USED FOR THIS TEST ("bridge" param).
    The KVM autotest default bridge virbr0, leveraging libvirt, works fine
    for the purpose of this test. When using other bridges, the timeouts
    which usually happen when the bridge topology changes (that is, devices
    get added and removed) may cause random failures.

    @param test:   KVM test object.
    @param params: Dictionary with the test parameters.
    @param env:    Dictionary with test environment.
    """
    vm = virt_test_utils.get_living_vm(env, params.get("main_vm"))
    login_timeout = int(params.get("login_timeout", 360))
    guest_delay = int(params.get("guest_delay", 20))
    pci_model = params.get("pci_model", "rtl8139")
    run_dhclient = params.get("run_dhclient", "no")
    guest_is_not_windows = "Win" not in params.get("guest_name", "")

    session = virt_test_utils.wait_for_login(vm, timeout=login_timeout)

    udev_rules_path = "/etc/udev/rules.d/70-persistent-net.rules"
    udev_rules_bkp_path = "/tmp/70-persistent-net.rules"

    def guest_path_isfile(path):
        try:
            session.cmd("test -f %s" % path)
        except aexpect.ShellError:
            return False
        return True

    if guest_is_not_windows:
        if guest_path_isfile(udev_rules_path):
            session.cmd("mv -f %s %s" % (udev_rules_path, udev_rules_bkp_path))

        # Modprobe the module if specified in config file
        module = params.get("modprobe_module")
        if module:
            session.get_command_output("modprobe %s" % module)

    # hot-add the nic
    nic_info = vm.add_nic(model=pci_model)

    # Only run dhclient if explicitly set and guest is not running Windows.
    # Most modern Linux guests run NetworkManager, and thus do not need this.
    if run_dhclient == "yes" and guest_is_not_windows:
        session_serial = vm.wait_for_serial_login(timeout=login_timeout)
        ifname = virt_test_utils.get_linux_ifname(session, nic_info['mac'])
        session_serial.cmd("dhclient %s &" % ifname)

    logging.info("Shutting down the primary link")
    vm.monitor.cmd("set_link %s off" % vm.netdev_id[0])

    try:
        logging.info("Waiting for new nic's ip address acquisition...")
        if not virt_utils.wait_for(
                lambda:
            (vm.address_cache.get(nic_info['mac']) is not None), 10, 1):
            raise error.TestFail("Could not get ip address of new nic")

        ip = vm.address_cache.get(nic_info['mac'])

        if not virt_utils.verify_ip_address_ownership(ip, nic_info['mac']):
            raise error.TestFail("Could not verify the ip address of new nic")
        else:
            logging.info("Got the ip address of new nic: %s", ip)

        logging.info("Ping test the new nic ...")
        s, o = virt_test_utils.ping(ip, 100)
        if s != 0:
            logging.error(o)
            raise error.TestFail("New nic failed ping test")

        logging.info("Detaching the previously attached nic from vm")
        vm.del_nic(nic_info, guest_delay)

    finally:
        vm.free_mac_address(1)
        logging.info("Re-enabling the primary link")
        vm.monitor.cmd("set_link %s on" % vm.netdev_id[0])

    # Attempt to put back udev network naming rules, even if the command to
    # disable the rules failed. We may be undoing what was done in a previous
    # (failed) test that never reached this point.
    if guest_is_not_windows:
        if guest_path_isfile(udev_rules_bkp_path):
            session.cmd("mv -f %s %s" % (udev_rules_bkp_path, udev_rules_path))
Exemple #13
0
                                (mgroup_count, prefix, suffix))

    # if success to join multicast, the process will be paused, and return PID.
    try:
        pid = re.findall("join_mcast_pid:(\d+)", output)[0]
    except IndexError:
        raise error.TestFail("Can't join multicast groups,output:%s" % output)

    try:
        for i in range(mgroup_count):
            new_suffix = suffix + i
            mcast = "%s.%d" % (prefix, new_suffix)

            logging.info("Initial ping test, mcast: %s", mcast)
            s, o = virt_test_utils.ping(mcast,
                                        10,
                                        interface=ifname,
                                        timeout=20)
            if s != 0:
                raise error.TestFail(" Ping return non-zero value %s" % o)

            logging.info("Flood ping test, mcast: %s", mcast)
            virt_test_utils.ping(mcast,
                                 None,
                                 interface=ifname,
                                 flood=True,
                                 output_func=None,
                                 timeout=flood_minutes * 60)

            logging.info("Final ping test, mcast: %s", mcast)
            s, o = virt_test_utils.ping(mcast,
                                        10,
Exemple #14
0
def run_ping(test, params, env):
    """
    Ping the guest with different size of packets.

    Packet Loss Test:
    1) Ping the guest with different size/interval of packets.

    Stress Test:
    1) Flood ping the guest.
    2) Check if the network is still usable.

    @param test: KVM test object.
    @param params: Dictionary with the test parameters.
    @param env: Dictionary with test environment.
    """
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    session = vm.wait_for_login(timeout=int(params.get("login_timeout", 360)))

    counts = params.get("ping_counts", 100)
    flood_minutes = float(params.get("flood_minutes", 10))
    nics = vm.virtnet
    strict_check = params.get("strict_check", "no") == "yes"

    packet_size = [0, 1, 4, 48, 512, 1440, 1500, 1505, 4054, 4055, 4096, 4192,
                   8878, 9000, 32767, 65507]

    try:
        for i, nic in enumerate(nics):
            ip = vm.get_address(i)
            if not ip:
                logging.error("Could not get the ip of nic index %d: %s",
                              i, nic)
                continue

            for size in packet_size:
                logging.info("Ping with packet size %s", size)
                status, output = virt_test_utils.ping(ip, 10,
                                                     packetsize=size,
                                                     timeout=20)
                if strict_check:
                    ratio = virt_test_utils.get_loss_ratio(output)
                    if ratio != 0:
                        raise error.TestFail("Loss ratio is %s for packet size"
                                             " %s" % (ratio, size))
                else:
                    if status != 0:
                        raise error.TestFail("Ping failed, status: %s,"
                                             " output: %s" % (status, output))

            logging.info("Flood ping test")
            virt_test_utils.ping(ip, None, flood=True, output_func=None,
                                timeout=flood_minutes * 60)

            logging.info("Final ping test")
            status, output = virt_test_utils.ping(ip, counts,
                                                 timeout=float(counts) * 1.5)
            if strict_check:
                ratio = virt_test_utils.get_loss_ratio(output)
                if ratio != 0:
                    raise error.TestFail("Ping failed, status: %s,"
                                         " output: %s" % (status, output))
            else:
                if status != 0:
                    raise error.TestFail("Ping returns non-zero value %s" %
                                         output)
    finally:
        session.close()
Exemple #15
0
def run_vlan(test, params, env):
    """
    Test 802.1Q vlan of NIC, config it by vconfig command.

    1) Create two VMs.
    2) Setup guests in 10 different vlans by vconfig and using hard-coded
       ip address.
    3) Test by ping between same and different vlans of two VMs.
    4) Test by TCP data transfer, floop ping between same vlan of two VMs.
    5) Test maximal plumb/unplumb vlans.
    6) Recover the vlan config.

    @param test: KVM test object.
    @param params: Dictionary with the test parameters.
    @param env: Dictionary with test environment.
    """
    vm = []
    session = []
    ifname = []
    vm_ip = []
    digest_origin = []
    vlan_ip = ['', '']
    ip_unit = ['1', '2']
    subnet = params.get("subnet")
    vlan_num = int(params.get("vlan_num"))
    maximal = int(params.get("maximal"))
    file_size = params.get("file_size")

    vm.append(env.get_vm(params["main_vm"]))
    vm.append(env.get_vm("vm2"))
    for vm_ in vm:
        vm_.verify_alive()

    def add_vlan(session, v_id, iface="eth0"):
        session.cmd("vconfig add %s %s" % (iface, v_id))

    def set_ip_vlan(session, v_id, ip, iface="eth0"):
        iface = "%s.%s" % (iface, v_id)
        session.cmd("ifconfig %s %s" % (iface, ip))

    def set_arp_ignore(session, iface="eth0"):
        ignore_cmd = "echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore"
        session.cmd(ignore_cmd)

    def rem_vlan(session, v_id, iface="eth0"):
        rem_vlan_cmd = "if [[ -e /proc/net/vlan/%s ]];then vconfig rem %s;fi"
        iface = "%s.%s" % (iface, v_id)
        return session.cmd_status(rem_vlan_cmd % (iface, iface))

    def nc_transfer(src, dst):
        nc_port = virt_utils.find_free_port(1025, 5334, vm_ip[dst])
        listen_cmd = params.get("listen_cmd")
        send_cmd = params.get("send_cmd")

        #listen in dst
        listen_cmd = listen_cmd % (nc_port, "receive")
        session[dst].sendline(listen_cmd)
        time.sleep(2)
        #send file from src to dst
        send_cmd = send_cmd % (vlan_ip[dst], str(nc_port), "file")
        session[src].cmd(send_cmd, timeout=60)
        try:
            session[dst].read_up_to_prompt(timeout=60)
        except aexpect.ExpectError:
            raise error.TestFail("Fail to receive file"
                                 " from vm%s to vm%s" % (src + 1, dst + 1))
        #check MD5 message digest of receive file in dst
        output = session[dst].cmd_output("md5sum receive").strip()
        digest_receive = re.findall(r'(\w+)', output)[0]
        if digest_receive == digest_origin[src]:
            logging.info("file succeed received in vm %s", vlan_ip[dst])
        else:
            logging.info("digest_origin is  %s", digest_origin[src])
            logging.info("digest_receive is %s", digest_receive)
            raise error.TestFail("File transfered differ from origin")
        session[dst].cmd_output("rm -f receive")

    for i in range(2):
        session.append(vm[i].wait_for_login(
            timeout=int(params.get("login_timeout", 360))))
        if not session[i]:
            raise error.TestError("Could not log into guest(vm%d)" % i)
        logging.info("Logged in")

        ifname.append(
            virt_test_utils.get_linux_ifname(session[i],
                                             vm[i].get_mac_address()))
        #get guest ip
        vm_ip.append(vm[i].get_address())

        #produce sized file in vm
        dd_cmd = "dd if=/dev/urandom of=file bs=1024k count=%s"
        session[i].cmd(dd_cmd % file_size)
        #record MD5 message digest of file
        output = session[i].cmd("md5sum file", timeout=60)
        digest_origin.append(re.findall(r'(\w+)', output)[0])

        #stop firewall in vm
        session[i].cmd_output("/etc/init.d/iptables stop")

        #load 8021q module for vconfig
        session[i].cmd("modprobe 8021q")

    try:
        for i in range(2):
            for vlan_i in range(1, vlan_num + 1):
                add_vlan(session[i], vlan_i, ifname[i])
                set_ip_vlan(session[i], vlan_i,
                            "%s.%s.%s" % (subnet, vlan_i, ip_unit[i]),
                            ifname[i])
            set_arp_ignore(session[i], ifname[i])

        for vlan in range(1, vlan_num + 1):
            logging.info("Test for vlan %s", vlan)

            logging.info("Ping between vlans")
            interface = ifname[0] + '.' + str(vlan)
            for vlan2 in range(1, vlan_num + 1):
                for i in range(2):
                    interface = ifname[i] + '.' + str(vlan)
                    dest = subnet + '.' + str(vlan2) + '.' + ip_unit[(i + 1) %
                                                                     2]
                    s, o = virt_test_utils.ping(dest,
                                                count=2,
                                                interface=interface,
                                                session=session[i],
                                                timeout=30)
                    if ((vlan == vlan2) ^ (s == 0)):
                        raise error.TestFail("%s ping %s unexpected" %
                                             (interface, dest))

            vlan_ip[0] = subnet + '.' + str(vlan) + '.' + ip_unit[0]
            vlan_ip[1] = subnet + '.' + str(vlan) + '.' + ip_unit[1]

            logging.info("Flood ping")

            def flood_ping(src, dst):
                # we must use a dedicated session becuase the aexpect
                # does not have the other method to interrupt the process in
                # the guest rather than close the session.
                session_flood = vm[src].wait_for_login(timeout=60)
                virt_test_utils.ping(vlan_ip[dst],
                                     flood=True,
                                     interface=ifname[src],
                                     session=session_flood,
                                     timeout=10)
                session_flood.close()

            flood_ping(0, 1)
            flood_ping(1, 0)

            logging.info("Transfering data through nc")
            nc_transfer(0, 1)
            nc_transfer(1, 0)

    finally:
        for vlan in range(1, vlan_num + 1):
            rem_vlan(session[0], vlan, ifname[0])
            rem_vlan(session[1], vlan, ifname[1])
            logging.info("rem vlan: %s", vlan)

    # Plumb/unplumb maximal number of vlan interfaces
    i = 1
    s = 0
    try:
        logging.info("Testing the plumb of vlan interface")
        for i in range(1, maximal + 1):
            add_vlan(session[0], i, ifname[0])
    finally:
        for j in range(1, i + 1):
            s = s or rem_vlan(session[0], j, ifname[0])
        if s == 0:
            logging.info("maximal interface plumb test done")
        else:
            logging.error("maximal interface plumb test failed")

    session[0].close()
    session[1].close()
Exemple #16
0
 def flood_ping():
     logging.info("Flood with large frames")
     virt_test_utils.ping(ip, interface=ifname,
                         packetsize=max_icmp_pkt_size,
                         flood=True, timeout=float(flood_time))
Exemple #17
0
def run_nic_hotplug(test, params, env):
    """
    Test hotplug of NIC devices

    1) Boot up guest with one nic
    2) Add a host network device through monitor cmd and check if it's added
    3) Add nic device through monitor cmd and check if it's added
    4) Check if new interface gets ip address
    5) Disable primary link of guest
    6) Ping guest new ip from host
    7) Delete nic device and netdev
    8) Re-enable primary link of guest

    BEWARE OF THE NETWORK BRIDGE DEVICE USED FOR THIS TEST ("nettype=bridge"
    and "netdst=<bridgename>" param).  The KVM autotest default bridge virbr0,
    leveraging libvirt, works fine for the purpose of this test. When using
    other bridges, the timeouts which usually happen when the bridge
    topology changes (that is, devices get added and removed) may cause random
    failures.

    @param test:   KVM test object.
    @param params: Dictionary with the test parameters.
    @param env:    Dictionary with test environment.
    """
    vm = virt_test_utils.get_living_vm(env, params.get("main_vm"))
    login_timeout = int(params.get("login_timeout", 360))
    guest_delay = int(params.get("guest_delay", 20))
    pci_model = params.get("pci_model", "rtl8139")
    run_dhclient = params.get("run_dhclient", "no")
    guest_is_not_windows = "Win" not in params.get("guest_name", "")

    session = virt_test_utils.wait_for_login(vm, timeout=login_timeout)

    udev_rules_path = "/etc/udev/rules.d/70-persistent-net.rules"
    udev_rules_bkp_path = "/tmp/70-persistent-net.rules"

    def guest_path_isfile(path):
        try:
            session.cmd("test -f %s" % path)
        except aexpect.ShellError:
            return False
        return True

    if guest_is_not_windows:
        if guest_path_isfile(udev_rules_path):
            session.cmd("mv -f %s %s" % (udev_rules_path, udev_rules_bkp_path))

        # Modprobe the module if specified in config file
        module = params.get("modprobe_module")
        if module:
            session.get_command_output("modprobe %s" % module)

    # hot-add the nic
    nic_name = 'hotadded'
    nic_info = vm.hotplug_nic(nic_model=pci_model, nic_name=nic_name)

    # Only run dhclient if explicitly set and guest is not running Windows.
    # Most modern Linux guests run NetworkManager, and thus do not need this.
    if run_dhclient == "yes" and guest_is_not_windows:
        session_serial = vm.wait_for_serial_login(timeout=login_timeout)
        ifname = virt_test_utils.get_linux_ifname(session, nic_info['mac'])
        session_serial.cmd("dhclient %s &" % ifname)

    logging.info("Shutting down the primary link(s)")
    for nic in vm.virtnet:
        if nic.nic_name == nic_name:
            continue
        else:
            vm.monitor.cmd("set_link %s off" % nic.device_id)

    try:
        logging.info("Waiting for new nic's ip address acquisition...")
        try:
            ip = vm.wait_for_get_address(nic_name)
        except virt_vm.VMIPAddressMissingError:
            raise error.TestFail("Could not get or verify ip address of nic")
        logging.info("Got the ip address of new nic: %s", ip)

        logging.info("Ping test the new nic ...")
        s, o = virt_test_utils.ping(ip, 100)
        if s != 0:
            logging.error(o)
            raise error.TestFail("New nic failed ping test")

        logging.info("Detaching the previously attached nic from vm")
        vm.hotunplug_nic(nic_name)

    finally:
        logging.info("Re-enabling the primary link(s)")
        for nic in vm.virtnet:
            if nic.nic_name == nic_name:
                continue
            else:
                vm.monitor.cmd("set_link %s on" % nic.device_id)

    # Attempt to put back udev network naming rules, even if the command to
    # disable the rules failed. We may be undoing what was done in a previous
    # (failed) test that never reached this point.
    if guest_is_not_windows:
        if guest_path_isfile(udev_rules_bkp_path):
            session.cmd("mv -f %s %s" % (udev_rules_bkp_path, udev_rules_path))
Exemple #18
0
    output = session.cmd_output("python /tmp/multicast_guest.py %d %s %d" %
                                (mgroup_count, prefix, suffix))

    # if success to join multicast, the process will be paused, and return PID.
    try:
        pid = re.findall("join_mcast_pid:(\d+)", output)[0]
    except IndexError:
        raise error.TestFail("Can't join multicast groups,output:%s" % output)

    try:
        for i in range(mgroup_count):
            new_suffix = suffix + i
            mcast = "%s.%d" % (prefix, new_suffix)

            logging.info("Initial ping test, mcast: %s", mcast)
            s, o = virt_test_utils.ping(mcast, 10, interface=ifname, timeout=20)
            if s != 0:
                raise error.TestFail(" Ping return non-zero value %s" % o)

            logging.info("Flood ping test, mcast: %s", mcast)
            virt_test_utils.ping(mcast, None, interface=ifname, flood=True,
                                output_func=None, timeout=flood_minutes*60)

            logging.info("Final ping test, mcast: %s", mcast)
            s, o = virt_test_utils.ping(mcast, 10, interface=ifname, timeout=20)
            if s != 0:
                raise error.TestFail("Ping failed, status: %s, output: %s" %
                                     (s, o))

    finally:
        logging.debug(session.cmd_output("ipmaddr show"))
Exemple #19
0
 def is_mtu_ok():
     s, o = virt_test_utils.ping(ip, 1, interface=ifname,
                                packetsize=max_icmp_pkt_size,
                                hint="do", timeout=2)
     return s == 0