From: Amos Kong <akong@redhat.com>
To: pradeep <psuriset@linux.vnet.ibm.com>
Cc: kvm@vger.kernel.org, mst@redhat.com, autotest@test.kernel.org
Subject: Re: [PATCH 16/18] KVM test: Improve vlan subtest
Date: Tue, 5 Oct 2010 20:56:11 +0800 [thread overview]
Message-ID: <20101005125611.GA12111@z> (raw)
In-Reply-To: <20100930122940.45f80e5f@skywalker>
[-- Attachment #1: Type: text/plain, Size: 1339 bytes --]
On Thu, Sep 30, 2010 at 12:29:40PM +0530, pradeep wrote:
> On Mon, 27 Sep 2010 18:44:02 -0400
> Lucas Meneghel Rodrigues <lmr@redhat.com> wrote:
>
> > From: Amos Kong <akong@redhat.com>
> >
> > This is an enhancement of existed vlan test. Rename the vlan_tag.py
> > to vlan.py, it is more reasonable.
> > . Setup arp from "/proc/sys/net/ipv4/conf/all/arp_ignore"
> > . Multiple vlans exist simultaneously
> > . Test ping between same and different vlans
> > . Test by TCP data transfer, floop ping between same vlan
> > . Maximal plumb/unplumb vlans
> >
>
> > +
> > + vm.append(kvm_test_utils.get_living_vm(env,
> > params.get("main_vm")))
> > + vm.append(kvm_test_utils.get_living_vm(env, "vm2"))
> > +
> > + def add_vlan(session, id, iface="eth0"):
> > + if session.get_command_status("vconfig add %s %s" % (iface,
> > id)) != 0:
> > + raise error.TestError("Fail to add %s.%s" % (iface, id))
> HI Lucas
>
> I got below error with my guests.
>
> With (2.6.32-71 kernel) guest
>
> 21:17:23 DEBUG| Sending command: vconfig add eth0 1
> 21:17:23 DEBUG| Command failed; status: 3, output: ERROR: trying to add
> VLAN #1 to IF -:eth0:- error: No such device
it was caused by the hardcode interface name.
lucas, attached the latest vlan.py. try to get right ifname by kvm_test_utils.get_linux_ifname()
[-- Attachment #2: vlan.py --]
[-- Type: text/x-python, Size: 7667 bytes --]
import logging, time, re
from autotest_lib.client.common_lib import error
import kvm_test_utils, kvm_utils
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(kvm_test_utils.get_living_vm(env, params.get("main_vm")))
vm.append(kvm_test_utils.get_living_vm(env, "vm2"))
def add_vlan(session, id, iface="eth0"):
if session.get_command_status("vconfig add %s %s" % (iface, id)) != 0:
raise error.TestError("Fail to add %s.%s" % (iface, id))
def set_ip_vlan(session, id, ip, iface="eth0"):
iface = "%s.%s" % (iface, id)
if session.get_command_status("ifconfig %s %s" % (iface, ip)) != 0:
raise error.TestError("Fail to configure ip for %s" % iface)
def set_arp_ignore(session, iface="eth0"):
ignore_cmd = "echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore"
if session.get_command_status(ignore_cmd) != 0:
raise error.TestError("Fail to set arp_ignore of %s" % session)
def rem_vlan(session, id, iface="eth0"):
rem_vlan_cmd = "if [[ -e /proc/net/vlan/%s ]];then vconfig rem %s;fi"
iface = "%s.%s" % (iface, id)
s = session.get_command_status(rem_vlan_cmd % (iface, iface))
return s
def nc_transfer(src, dst):
nc_port = kvm_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")
if session[src].get_command_status(send_cmd, timeout = 60) != 0:
raise error.TestFail ("Fail to send file"
" from vm%s to vm%s" % (src+1, dst+1))
s, o = session[dst].read_up_to_prompt(timeout=60)
if s != True:
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].get_command_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].get_command_status("rm -f receive")
for i in range(2):
session.append(kvm_test_utils.wait_for_login(vm[i],
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(kvm_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"
if session[i].get_command_status(dd_cmd % file_size) != 0:
raise error.TestFail("File producing failed")
#record MD5 message digest of file
s, output =session[i].get_command_status_output("md5sum file",
timeout=60)
if s != 0:
raise error.TestFail("File MD5_checking failed" )
digest_origin.append(re.findall(r'(\w+)', output)[0])
#stop firewall in vm
session[i].get_command_status("/etc/init.d/iptables stop")
#load 8021q module for vconfig
load_8021q_cmd = "modprobe 8021q"
if session[i].get_command_status(load_8021q_cmd) != 0:
raise error.TestError("Fail to load 8021q module on VM%s" % i)
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 = kvm_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 kvm_subprocess
# does not have the other method to interrupt the process in
# the guest rather than close the session.
session_flood = kvm_test_utils.wait_for_login(vm[src],
timeout = 60)
kvm_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 unber 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()
[-- Attachment #3: Type: text/plain, Size: 152 bytes --]
_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
next prev parent reply other threads:[~2010-10-05 12:56 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-27 22:43 [PATCH 00/18] Network Patchset v4 Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 01/18] KVM test: Add a new macaddress pool algorithm Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 02/18] KVM test: Make physical_resources_check to work with MAC management Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 03/18] KVM test: Remove address_pools.cfg dependency Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 04/18] KVM test: Add a get_ifname function Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 05/18] KVM Test: Add nw related functions ping and get_linux_ifname Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 06/18] KVM test: Add a new subtest ping Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 07/18] KVM test: Add a subtest jumbo Lucas Meneghel Rodrigues
2010-09-29 6:42 ` pradeep
2010-09-29 11:07 ` Lucas Meneghel Rodrigues
2010-09-29 11:33 ` pradeep
2010-09-29 20:21 ` Lucas Meneghel Rodrigues
2010-09-30 7:05 ` pradeep
2010-09-27 22:43 ` [PATCH 08/18] KVM test: Add basic file transfer test Lucas Meneghel Rodrigues
2010-09-28 13:24 ` Michael S. Tsirkin
2010-09-29 11:45 ` pradeep
2010-09-29 12:33 ` Lucas Meneghel Rodrigues
2010-09-29 14:08 ` Lucas Meneghel Rodrigues
2010-09-29 17:43 ` Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 09/18] KVM test: Add a subtest of load/unload nic driver Lucas Meneghel Rodrigues
2010-10-06 5:49 ` Amos Kong
2010-09-27 22:43 ` [PATCH 10/18] KVM test: Add a subtest of nic promisc Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 11/18] KVM test: Add a subtest of multicast Lucas Meneghel Rodrigues
2010-09-30 9:30 ` pradeep
2010-10-05 12:21 ` Amos Kong
2010-10-05 12:44 ` Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 12/18] KVM test: Add a subtest of pxe Lucas Meneghel Rodrigues
2010-09-27 22:43 ` [PATCH 13/18] KVM test: Add a subtest of changing MAC address Lucas Meneghel Rodrigues
2010-09-30 8:21 ` pradeep
2010-09-27 22:44 ` [PATCH 14/18] KVM test: Add a netperf subtest Lucas Meneghel Rodrigues
2010-10-05 9:00 ` pradeep
2010-10-05 12:59 ` Amos Kong
2010-10-06 10:48 ` pradeep
2010-09-27 22:44 ` [PATCH 15/18] KVM test: kvm_utils - Add support of check if remote port free Lucas Meneghel Rodrigues
2010-09-27 22:44 ` [PATCH 16/18] KVM test: Improve vlan subtest Lucas Meneghel Rodrigues
2010-09-30 6:59 ` pradeep
2010-10-05 12:56 ` Amos Kong [this message]
2010-09-27 22:44 ` [PATCH 17/18] KVM test: vlan subtest - Replace extra_params '-snapshot' with image_snapshot Lucas Meneghel Rodrigues
2010-09-27 22:44 ` [PATCH 18/18] KVM test: Add subtest of testing offload by ethtool Lucas Meneghel Rodrigues
2010-10-06 8:56 ` pradeep
2010-10-06 9:59 ` [Autotest] " pradeep
2010-10-06 15:55 ` Ryan Harper
2010-10-06 16:57 ` Lucas Meneghel Rodrigues
2010-10-07 2:09 ` [PATCH 00/18] Network Patchset v4 Lucas Meneghel Rodrigues
2010-10-07 13:45 ` [Autotest] " pradeep
2010-10-07 13:54 ` Lucas Meneghel Rodrigues
2010-10-07 14:37 ` pradeep
2010-10-07 15:00 ` [Autotest] " Michael S. Tsirkin
2010-10-08 12:27 ` Lucas Meneghel Rodrigues
-- strict thread matches above, loose matches on Subject: below --
2010-09-14 22:25 [PATCH 00/18] KVM autotest network patchset v3 Lucas Meneghel Rodrigues
2010-09-14 22:25 ` [PATCH 16/18] KVM test: Improve vlan subtest Lucas Meneghel Rodrigues
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=20101005125611.GA12111@z \
--to=akong@redhat.com \
--cc=autotest@test.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=psuriset@linux.vnet.ibm.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