Allow customization of the PLC API to be used for experiments
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Thu, 12 May 2011 14:44:36 +0000 (16:44 +0200)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Thu, 12 May 2011 14:44:36 +0000 (16:44 +0200)
src/nepi/testbeds/planetlab/execute.py
src/nepi/testbeds/planetlab/metadata_v01.py

index 47f0550..d9506f5 100644 (file)
@@ -31,7 +31,10 @@ class TestbedController(testbed_impl.TestbedController):
             if self.authUser:
                 self._plapi = plcapi.PLCAPI(
                     username = self.authUser,
-                    password = self.authString)
+                    password = self.authString,
+                    hostname = self.plcHost,
+                    urlpattern = self.plcUrl
+                    )
             else:
                 # anonymous access - may not be enough for much
                 self._plapi = plcapi.PLCAPI()
@@ -59,6 +62,10 @@ class TestbedController(testbed_impl.TestbedController):
             get_attribute_value("authPass")
         self.sliceSSHKey = self._attributes.\
             get_attribute_value("sliceSSHKey")
+        self.plcHost = self._attributes.\
+            get_attribute_value("plcHost")
+        self.plcUrl = self._attributes.\
+            get_attribute_value("plcUrl")
         super(TestbedController, self).do_setup()
 
     def do_preconfigure(self):
index 79d1956..8b765e6 100644 (file)
@@ -1040,6 +1040,22 @@ testbed_attributes = dict({
             "flags": Attribute.DesignOnly | Attribute.HasNoDefaultValue,
             "validation_function": validation.is_string
         }),
+        "plc_host": dict({
+            "name": "plcHost",
+            "help": "The PlanetLab PLC API host",
+            "type": Attribute.STRING,
+            "value": "www.planet-lab.eu",
+            "flags": Attribute.DesignOnly,
+            "validation_function": validation.is_string
+        }),
+        "plc_url": dict({
+            "name": "plcUrl",
+            "help": "The PlanetLab PLC API url pattern - %(hostname)s is replaced by plcHost.",
+            "type": Attribute.STRING,
+            "value": "https://%(hostname)s:443/PLCAPI/",
+            "flags": Attribute.DesignOnly,
+            "validation_function": validation.is_string
+        }),
         "slice_ssh_key": dict({
             "name": "sliceSSHKey",
             "help": "The controller-local path to the slice user's ssh private key. "