Fix bug caused by netns being a string
authorAndy Bavier <acb@cs.princeton.edu>
Thu, 19 Feb 2009 19:32:56 +0000 (19:32 +0000)
committerAndy Bavier <acb@cs.princeton.edu>
Thu, 19 Feb 2009 19:32:56 +0000 (19:32 +0000)
topo.py

diff --git a/topo.py b/topo.py
index fb9e33c..8174dbf 100755 (executable)
--- a/topo.py
+++ b/topo.py
@@ -125,7 +125,7 @@ def writeConf(slicename, value):
         f.write("%s\n" % value)
         f.close()
         STATUS="OFF"
-        if int(value) >= 1:
+        if value:
             STATUS="ON"
         logger.log("%s: network namespace %s\n" % (slicename, STATUS))
 
@@ -150,8 +150,8 @@ def GetSlivers(data):
         for attribute in sliver['attributes']:
             attrs[attribute['name']] = attribute['value']
         if 'netns' in attrs:
-            writeConf(sliver['name'], attrs['netns'])
-            netns = attrs['netns']
+            netns = int(attrs['netns'])
+            writeConf(sliver['name'], netns)
         else:
             netns = 0