[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] [XM-TEST] New IP address scheme for net tests


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: James Dykman <dykman@xxxxxxxxxx>
  • Date: Wed, 22 Feb 2006 16:42:27 -0500
  • Delivery-date: Wed, 22 Feb 2006 21:42:51 +0000
  • Importance: Normal
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Sensitivity:

While testing TCP & UDP tests (coming soon), I tracked down a bug in the 
IP addressing scheme 
used by xm-test: each machine running network tests is using the same IP 
addresses, so two machines 
in the same network can cross-pollinate/interfere with each other's tests.

This patch changes the IP addressing scheme to add some randomness. It's 
gone through a couple of dozen 
passes of xm-test, some on -bridge and some on -route, while xm-test was 
running on another box on the same network.

Signed-off-by: Jim Dykman <dykman@xxxxxxxxxx>

diff -r 57e6d7218427 tools/xm-test/lib/XmTestLib/Network.py
--- a/tools/xm-test/lib/XmTestLib/Network.py    Fri Feb  3 18:45:14 2006
+++ b/tools/xm-test/lib/XmTestLib/Network.py    Tue Feb 21 14:42:11 2006
@@ -22,6 +22,7 @@
 import sys;
 import os;
 import atexit;
+import random;

 from Test import *
 from Xm import *
@@ -49,12 +50,22 @@
         if rc == 0:
             SKIP("Zeroconf address found: " + out)

+        # Randomize one octet of the IP addresses we choose, so that
+        # multiple machines running network tests don't interfere
+        # with each other.
+        self.subnet = random.randint(1,254)
+
     def calc_ip_address(self, dom, interface):
         # Generate an IP address from the dom# and eth#:
-        #      169.254.(eth#+153).(dom#+10)
+        #      169.254.(self.subnet).(eth#)*16 + (dom# + 1)
         ethnum = int(interface[len("eth"):])
+        if (ethnum > 15):
+            raise NetworkError("ethnum > 15 : " + interface)
         domnum = int(dom[len("dom"):])
-        return "169.254."+ str(ethnum+153) + "." + str(domnum+10)
+        if (domnum > 14):
+            raise NetworkError("domnum > 14 : " + dom)
+
+        return "169.254."+ str(self.subnet) + "." + 
str(ethnum*16+domnum+1)

     def ip(self, dom, interface, todomname=None, toeth=None):
         newip = self.calc_ip_address(dom, interface)
@@ -76,4 +87,4 @@
         return newip

     def mask(self, dom, interface):
-        return "255.255.255.0"
+        return "255.255.255.240"



Attachment: randm.diff
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.