KVM test: Add a subtest of multicast
PATCH 11/19 KVM test: Add a subtest of multicast
From: Amos Kong <[email protected]>
Use 'ping' to test send/recive multicat packets. Flood ping test is also added. Limit guest network as 'bridge' mode, because multicast packets could not be transmitted to guest when using 'user' network.
Add join_mcast.py for joining machine into multicast groups.
Changes from v4:
- Fixed a mistake made during one of the rebases
Changes from v1:
- Just flush the firewall rules with iptables -F
Signed-off-by Amos Kong <[email protected]>
--- client/tests/kvm/scripts/join_mcast.py | 37 +++++++++++++ client/tests/kvm/tests/multicast.py | 91 ++++++++++++++++++++++++++++++++ client/tests/kvm/tests_base.cfg.sample | 9 +++- 3 files changed, 136 insertions(+), 1 deletions(-) create mode 100755 client/tests/kvm/scripts/join_mcast.py create mode 100644 client/tests/kvm/tests/multicast.py
client/tests/kvm/scripts/join_mcast.py new file +37 -0
@@ -0,0 +1,37 @@ +#!/usr/bin/python +import socket, struct, os, signal, sys +# -*- coding: utf-8 -*- + +""" +Script used to join machine into multicast groups. + +@author Amos Kong <[email protected]> +""" + +if __name__ == "__main__": + if len(sys.argv) < 4: + print """%s [mgroup_count] [prefix] [suffix] + mgroup_count: count of multicast addresses + prefix: multicast address prefix + suffix: multicast address suffix""" % sys.argv[0] + sys.exit() + + mgroup_count = int(sys.argv[1]) + prefix = sys.argv[2] + suffix = int(sys.argv[3]) + + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + for i in range(mgroup_count): + mcast = prefix + "." + str(suffix + i) + try: + mreq = struct.pack("4sl", socket.inet_aton(mcast), + socket.INADDR_ANY) + s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) + except: + s.close() + print "Could not join multicast: %s" % mcast + raise + + print "join_mcast_pid:%s" % os.getpid() + os.kill(os.getpid(), signal.SIGSTOP) + s.close()
client/tests/kvm/tests/multicast.py new file +91 -0
91 lines not on this page · raw message
client/tests/kvm/tests_base.cfg.sample +8 -1
@@ -496,6 +496,13 @@ variants: type = nic_promisc file_size = 1, 1460, 65000, 100000000 + - multicast: install setup unattended_install.cdrom + type = multicast + nic_mode = tap + mcast = 225.0.0.1 + mgroup_count = 20 + flood_minutes = 1 + - physical_resources_check: install setup unattended_install.cdrom type = physical_resources_check catch_uuid_cmd = dmidecode | awk -F: '/UUID/ {print $2}'
@@ -1273,7 +1280,7 @@ variants: # Windows section - @Windows: - no autotest linux_s3 vlan_tag ioquit unattended_install.(url|nfs|remote_ks) jumbo file_transfer nicdriver_unload nic_promisc + no autotest linux_s3 vlan_tag ioquit unattended_install.(url|nfs|remote_ks) jumbo file_transfer nicdriver_unload nic_promisc multicast shutdown_command = shutdown /s /f /t 0 reboot_command = shutdown /r /f /t 0 status_test_command = echo %errorlevel%
Signature · 1 line
1.7.1