From patchwork Mon Feb 28 11:20:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 595341 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1SBCOmh014264 for ; Mon, 28 Feb 2011 11:12:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753315Ab1B1LMR (ORCPT ); Mon, 28 Feb 2011 06:12:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8782 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753248Ab1B1LMO (ORCPT ); Mon, 28 Feb 2011 06:12:14 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1SBCDYG031015 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 28 Feb 2011 06:12:13 -0500 Received: from [10.66.91.115] (dhcp-91-115.nay.redhat.com [10.66.91.115]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1SBCAlw009323; Mon, 28 Feb 2011 06:12:10 -0500 Subject: [PATCH] KVM-test: Add a new test: privacy test To: autotest@test.kernel.org From: Amos Kong Cc: lmr@redhat.com, kvm@vger.kernel.org, mst@redhat.com Date: Mon, 28 Feb 2011 19:20:38 +0800 Message-ID: <20110228112038.5878.38791.stgit@t115> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 28 Feb 2011 11:12:25 +0000 (UTC) diff --git a/client/tests/kvm/tests/privacy.py b/client/tests/kvm/tests/privacy.py new file mode 100644 index 0000000..d052c66 --- /dev/null +++ b/client/tests/kvm/tests/privacy.py @@ -0,0 +1,44 @@ +import logging, time +from autotest_lib.client.common_lib import error +import kvm_test_utils + + +def run_privacy(test, params, env): + """ + Privacy test + + 1) Boot up three vms + 2) Flood ping vm1 from vm2 + 3) Verify if we can capture ICMP packages from vm3 + + @param test: kvm test object + @param params: Dictionary with the test parameters + @param env: Dictionary with test environment. + """ + timeout = float(params.get("login_timeout", 360)) + vm1 = kvm_test_utils.get_living_vm(env, params.get("main_vm")) + vm2 = kvm_test_utils.get_living_vm(env, "vm2") + vm3 = kvm_test_utils.get_living_vm(env, "vm3") + session_vm1 = kvm_test_utils.wait_for_login(vm1, 0, timeout, 0, 2) + session_vm2 = kvm_test_utils.wait_for_login(vm2, 0, timeout, 0, 2) + session_vm3 = kvm_test_utils.wait_for_login(vm3, 0, timeout, 0, 2) + + ip = vm1.get_address() + session_vm2.sendline("ping -f %s" % ip) + ethname = kvm_test_utils.get_linux_ifname(session_vm3, + vm3.get_mac_address(0)) + sleep_time = int(params.get("sleep_time", 60)) + cmd = "sleep %s && killall tcpdump & tcpdump -le -vv icmp and" \ + " dst %s -i %s > /tmp/result" % (sleep_time, ip, ethname) + + session_vm3.get_command_output(cmd, timeout=int(sleep_time+60)) + time.sleep(sleep_time) + s, o = session_vm3.get_command_status_output("grep ICMP /tmp/result") + if s == 0: + raise error.TestFail("VM3 unexpected captured ICMP packages(vm2->vm1)!") + else: + logging.debug("Privacy test pass!") + + session_vm1.close() + session_vm2.close() + session_vm3.close() diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index 661d6fe..29b7d97 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -666,6 +666,12 @@ variants: mgroup_count = 20 flood_minutes = 1 + - privacy: + type = privacy + vms += " vm2 vm3" + kill_vm = yes + image_snapshot = yes + - pxe: type = pxe images = pxe @@ -1737,7 +1743,7 @@ variants: # Windows section - @Windows: no autotest, linux_s3, vlan, ioquit, unattended_install.url, unattended_install.nfs, unattended_install.remote_ks - no jumbo, nicdriver_unload, nic_promisc, multicast, mac_change, ethtool, clock_getres + no jumbo, nicdriver_unload, nic_promisc, multicast, mac_change, ethtool, clock_getres, privacy shutdown_command = shutdown /s /f /t 0 reboot_command = shutdown /r /f /t 0