WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XM-TEST] Move network_utils.py to lib di

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XM-TEST] Move network_utils.py to lib directory
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Apr 2007 13:40:11 -0700
Delivery-date: Thu, 26 Apr 2007 13:39:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Tom Wilkie <tom.wilkie@xxxxxxxxx>
# Date 1177598889 -3600
# Node ID aeb1931eab365fa91881d3a0c4d6be22571e98fd
# Parent  a9b9847d97bbc510e765452a1ad5c4286df50f57
[XM-TEST] Move network_utils.py to lib directory

signed-off-by: Tom Wilkie <tom.wilkie@xxxxxxxxx>
---
 tools/xm-test/tests/network-attach/network_utils.py                         |  
 56 ---------
 tools/xm-test/lib/XmTestLib/network_utils.py                                |  
 60 ++++++++++
 tools/xm-test/tests/network-attach/01_network_attach_pos.py                 |  
  2 
 tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py          |  
  2 
 tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py |  
  2 
 5 files changed, 63 insertions(+), 59 deletions(-)

diff -r a9b9847d97bb -r aeb1931eab36 
tools/xm-test/lib/XmTestLib/network_utils.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xm-test/lib/XmTestLib/network_utils.py      Thu Apr 26 15:48:09 
2007 +0100
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Murillo F. Bernardes <mfb@xxxxxxxxxx>
+
+from XmTestLib import *
+
+def count_eth(console):
+    try:
+        run = console.runCmd("ifconfig -a | grep eth")
+    except ConsoleError, e:
+        FAIL(str(e))
+    return len(run['output'].splitlines())
+
+def get_state(domain_name, number):
+    s, o = traceCommand("xm network-list %s | awk '/^%d/ {print $5}'" %
+                        (domain_name, number))
+    print o
+    
+    if s != 0:
+        FAIL("network-list failed")
+    if o == "":
+        return 0
+    else:
+        return int(o)
+
+def network_attach(domain_name, console, bridge=None):
+    eths_before = count_eth(console)
+    if bridge:
+        status, output = traceCommand("xm network-attach %s bridge=%s"
+                                      % (domain_name, bridge))
+    else:
+        status, output = traceCommand("xm network-attach %s" % domain_name)
+    if status != 0:
+        return -1, "xm network-attach returned invalid %i != 0" % status
+
+    eths_after = count_eth(console)
+    if (eths_after != (eths_before+1)):
+        return -2, "Network device is not actually connected to domU"
+
+    return 0, None 
+
+def network_detach(domain_name, console, num=0):
+    eths_before = count_eth(console)
+    status, output = traceCommand("xm network-detach %s %d" % (domain_name, 
num))
+    if status != 0:
+        return -1, "xm network-detach returned invalid %i != 0" % status
+
+    for i in range(10):
+        if get_state(domain_name, num) == 0:
+            break
+        time.sleep(1)
+    else:
+        FAIL("network-detach failed: device did not disappear")
+
+    eths_after = count_eth(console)
+    if eths_after != (eths_before-1):
+        return -2, "Network device was not actually disconnected from domU"
+
+    return 0, None
diff -r a9b9847d97bb -r aeb1931eab36 
tools/xm-test/tests/network-attach/01_network_attach_pos.py
--- a/tools/xm-test/tests/network-attach/01_network_attach_pos.py       Thu Apr 
26 15:40:35 2007 +0100
+++ b/tools/xm-test/tests/network-attach/01_network_attach_pos.py       Thu Apr 
26 15:48:09 2007 +0100
@@ -6,7 +6,7 @@ import sys
 import sys
 
 from XmTestLib import *
-from network_utils import *
+from XmTestLib.network_utils import *
 
 if ENABLE_HVM_SUPPORT:
     SKIP("Network-attach not supported for HVM domains")
diff -r a9b9847d97bb -r aeb1931eab36 
tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py
--- a/tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py        
Thu Apr 26 15:40:35 2007 +0100
+++ b/tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py        
Thu Apr 26 15:48:09 2007 +0100
@@ -8,7 +8,7 @@ import time
 import time
 
 from XmTestLib import *
-from network_utils import *
+from XmTestLib.network_utils import *
 
 if ENABLE_HVM_SUPPORT:
     SKIP("Network-attach not supported for HVM domains")
diff -r a9b9847d97bb -r aeb1931eab36 
tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py
--- 
a/tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py   
    Thu Apr 26 15:40:35 2007 +0100
+++ 
b/tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py   
    Thu Apr 26 15:48:09 2007 +0100
@@ -8,7 +8,7 @@ import time
 import time
 
 from XmTestLib import *
-from network_utils import *
+from XmTestLib.network_utils import *
 
 if ENABLE_HVM_SUPPORT:
     SKIP("Network-attach not supported for HVM domains")
diff -r a9b9847d97bb -r aeb1931eab36 
tools/xm-test/tests/network-attach/network_utils.py
--- a/tools/xm-test/tests/network-attach/network_utils.py       Thu Apr 26 
15:40:35 2007 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-
-# Copyright (C) International Business Machines Corp., 2005
-# Author: Murillo F. Bernardes <mfb@xxxxxxxxxx>
-
-from XmTestLib import *
-
-def count_eth(console):
-    try:
-        run = console.runCmd("ifconfig -a | grep eth")
-    except ConsoleError, e:
-        FAIL(str(e))
-    return len(run['output'].splitlines())
-
-def get_state(domain_name, number):
-    s, o = traceCommand("xm network-list %s | awk '/^%d/ {print $5}'" %
-                        (domain_name, number))
-    print o
-    
-    if s != 0:
-        FAIL("network-list failed")
-    if o == "":
-        return 0
-    else:
-        return int(o)
-
-def network_attach(domain_name, console):
-    eths_before = count_eth(console)
-    status, output = traceCommand("xm network-attach %s" % domain_name)
-    if status != 0:
-        return -1, "xm network-attach returned invalid %i != 0" % status
-
-    eths_after = count_eth(console)
-    if (eths_after != (eths_before+1)):
-        return -2, "Network device is not actually connected to domU"
-
-    return 0, None 
-
-def network_detach(domain_name, console, num=0):
-    eths_before = count_eth(console)
-    status, output = traceCommand("xm network-detach %s %d" % (domain_name, 
num))
-    if status != 0:
-        return -1, "xm network-detach returned invalid %i != 0" % status
-
-    for i in range(10):
-        if get_state(domain_name, num) == 0:
-            break
-        time.sleep(1)
-    else:
-        FAIL("network-detach failed: device did not disappear")
-
-    eths_after = count_eth(console)
-    if eths_after != (eths_before-1):
-        return -2, "Network device was not actually disconnected from domU"
-
-    return 0, None

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XM-TEST] Move network_utils.py to lib directory, Xen patchbot-unstable <=