More tests for PlanetLab design, and associated fixes
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Thu, 21 Apr 2011 10:52:18 +0000 (12:52 +0200)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Thu, 21 Apr 2011 10:52:18 +0000 (12:52 +0200)
src/nepi/testbeds/planetlab/metadata_v01.py
test/testbeds/planetlab/design.py

index 61c918a..d8879a1 100644 (file)
@@ -199,7 +199,7 @@ attributes = dict({
                 "validation_function": validation.is_bool,
             }),
     "hostname": dict({      
-                "name": "hosname",
+                "name": "hostname",
                 "help": "Constrain hostname during resource discovery. May use wildcards.",
                 "type": Attribute.STRING, 
                 "flags": Attribute.DesignOnly,
index cdd4159..93acdae 100755 (executable)
@@ -5,7 +5,7 @@ from nepi.core.design import ExperimentDescription, FactoriesProvider
 import unittest
 
 class PlanetlabDesignTestCase(unittest.TestCase):
-    def test_design_if(self):
+    def make_test_design(self):
         exp_desc = ExperimentDescription()
         testbed_version = "01"
         testbed_id = "planetlab"
@@ -24,6 +24,38 @@ class PlanetlabDesignTestCase(unittest.TestCase):
         app = tstbd_desc.create("Application")
         app.set_attribute_value("command", "ping -qc10 10.0.0.2")
         app.connector("node").connect(node1.connector("apps"))
+        
+        return exp_desc, tstbd_desc, node1, node2, iface1, iface2, app
+        
+    def test_design_simple(self):
+        exp_desc, tstbd_desc, node1, node2, iface1, iface2, app = self.make_test_design()
+
+        xml = exp_desc.to_xml()
+        exp_desc2 = ExperimentDescription()
+        exp_desc2.from_xml(xml)
+        xml2 = exp_desc2.to_xml()
+        self.assertTrue(xml == xml2)
+
+    def test_design_constrained(self):
+        exp_desc, tstbd_desc, node1, node2, iface1, iface2, app = self.make_test_design()
+        
+        node1.set_attribute_value("hostname", "onelab*.inria.fr")
+        node2.set_attribute_value("hostname", "onelab*.inria.fr")
+
+        xml = exp_desc.to_xml()
+        exp_desc2 = ExperimentDescription()
+        exp_desc2.from_xml(xml)
+        xml2 = exp_desc2.to_xml()
+        self.assertTrue(xml == xml2)
+
+    def test_design_constrained2(self):
+        exp_desc, tstbd_desc, node1, node2, iface1, iface2, app = self.make_test_design()
+        
+        node1.set_attribute_value("minReliability", 90.0)
+        node1.set_attribute_value("operatingSystem", "f12")
+        node2.set_attribute_value("minReliability", 50.0)
+        node2.set_attribute_value("architecture", "x86_64")
+
         xml = exp_desc.to_xml()
         exp_desc2 = ExperimentDescription()
         exp_desc2.from_xml(xml)