sfiapi small bugfixes.
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Sun, 29 Jan 2012 15:55:14 +0000 (16:55 +0100)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Sun, 29 Jan 2012 15:55:14 +0000 (16:55 +0100)
src/nepi/testbeds/planetlab/node.py
src/nepi/util/sfiapi.py
test/testbeds/planetlab/integration.py
test/testbeds/planetlab/integration_multi.py

index eb9a6de..125c1cb 100644 (file)
@@ -262,7 +262,7 @@ class Node(object):
             candidates = set(filter(predicate, candidates))
        
         # make sure hostnames are resolvable
-        hostnames = None
+        hostnames = dict() 
         if candidates:
             self._logger.info("  Found %s candidates. Checking for reachability...", len(candidates))
            
index 866792f..d82b28c 100644 (file)
@@ -1,5 +1,8 @@
 # -*- coding: utf-8 -*-
 
+
+import logging
+
 from nepi.util.parser import sfa
 
 ###
@@ -14,15 +17,22 @@ class SFIAPI(object):
         self._slice_nodes = set()
         self._all_nodes = dict()
         self._slice_id = slice_id
+
+        self._logger = logging.getLogger('nepi.utils.sfiapi')
+        
         self.FetchSliceInfo()
 
     def FetchSliceInfo(self):
         p = sfa.SFAResourcesParser()
         import commands
         xml = commands.getoutput("sfi.py resources")
-        self._all_nodes = p.resources_from_xml(xml)
-        xml = commands.getoutput("sfi.py resources %s" % self._slice_id)
-        self._slice_tags, self._slice_nodes = p.slice_info_from_xml(xml)
+        try:
+            self._all_nodes = p.resources_from_xml(xml)
+            xml = commands.getoutput("sfi.py resources %s" % self._slice_id)
+            self._slice_tags, self._slice_nodes = p.slice_info_from_xml(xml)
+        except:
+            self._logger.error("Error in SFA responds: %s", xml)
+            raise
     
     def GetSliceNodes(self, slicename):
         return list(self._slice_nodes)
index 5e5fb41..fe21625 100755 (executable)
@@ -62,7 +62,7 @@ class PlanetLabIntegrationTestCase(unittest.TestCase):
         pl_desc.set_attribute_value("tapPortBase", self.port_base)
         pl_desc.set_attribute_value("p2pDeployment", False) # it's interactive, we don't want it in tests
         pl_desc.set_attribute_value("dedicatedSlice", True)
-        #pl_desc.set_attribute_value("plLogLevel", "DEBUG")
+        pl_desc.set_attribute_value("plLogLevel", "DEBUG")
         if use_sfa:
             pl_desc.set_attribute_value("sfa", True)
             pl_desc.set_attribute_value("sliceHrn", self.slicehrn)
@@ -95,7 +95,7 @@ class PlanetLabIntegrationTestCase(unittest.TestCase):
             inst_root_dir = os.path.join(self.root_dir, "instance")
             os.mkdir(inst_root_dir)
             pl.set_attribute_value(DC.ROOT_DIRECTORY, inst_root_dir)
-            #pl.set_attribute_value(DC.LOG_LEVEL, DC.DEBUG_LEVEL)
+            pl.set_attribute_value(DC.LOG_LEVEL, DC.DEBUG_LEVEL)
 
             if environ:
                 pl.set_attribute_value(DC.DEPLOYMENT_ENVIRONMENT_SETUP, environ)
@@ -254,7 +254,7 @@ FIONREAD = 0x[0-9a-fA-F]{8}.*
             inst_root_dir = os.path.join(self.root_dir, "instance")
             os.mkdir(inst_root_dir)
             pl.set_attribute_value(DC.ROOT_DIRECTORY, inst_root_dir)
-            #pl.set_attribute_value(DC.LOG_LEVEL, DC.DEBUG_LEVEL)
+            pl.set_attribute_value(DC.LOG_LEVEL, DC.DEBUG_LEVEL)
 
             if environ:
                 pl.set_attribute_value(DC.DEPLOYMENT_ENVIRONMENT_SETUP, environ)
index 42d804f..61a8902 100755 (executable)
@@ -71,7 +71,7 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
         pl_desc.set_attribute_value("tapPortBase", self.port_base)
         pl_desc.set_attribute_value("p2pDeployment", False) # it's interactive, we don't want it in tests
         pl_desc.set_attribute_value("dedicatedSlice", True)
-        #pl_desc.set_attribute_value("plLogLevel", "DEBUG")
+        pl_desc.set_attribute_value("plLogLevel", "DEBUG")
 
         pl_desc2 = exp_desc.add_testbed_description(pl_provider)
         pl_desc2.set_attribute_value("homeDirectory", self.root_dir+"v2")
@@ -83,7 +83,7 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
         pl_desc2.set_attribute_value("tapPortBase", self.port_base+500)
         pl_desc2.set_attribute_value("p2pDeployment", False) # it's interactive, we don't want it in tests
         pl_desc2.set_attribute_value("dedicatedSlice", True)
-        #pl_desc2.set_attribute_value("plLogLevel", "DEBUG")
+        pl_desc2.set_attribute_value("plLogLevel", "DEBUG")
         
         return pl_desc, pl_desc2, exp_desc