Fixing wrong license
[nepi.git] / src / nepi / resources / linux / ns3 / ns3dceapplication.py
index bf1a6e3..4c705d0 100644 (file)
@@ -3,9 +3,8 @@
 #    Copyright (C) 2014 INRIA
 #
 #    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation, either version 3 of the License, or
-#    (at your option) any later version.
+#    it under the terms of the GNU General Public License version 2 as
+#    published by the Free Software Foundation;
 #
 #    This program is distributed in the hope that it will be useful,
 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 
 from nepi.execution.attribute import Attribute, Flags, Types
-from nepi.execution.resource import clsinit_copy, ResourceState, reschedule_delay
+from nepi.execution.resource import clsinit_copy, ResourceState
 from nepi.resources.ns3.ns3dceapplication import NS3BaseDceApplication
 
 @clsinit_copy
-class NS3LinuxDceApplication(NS3BaseDceApplication):
-    _rtype = "ns3::LinuxDceApplication"
+class LinuxNS3DceApplication(NS3BaseDceApplication):
+    _rtype = "linux::ns3::dce::Application"
 
     @classmethod
     def _register_attributes(cls):
@@ -41,32 +40,32 @@ class NS3LinuxDceApplication(NS3BaseDceApplication):
                 "binaries to the ${BIN_DCE} directory. ",
                 flags = Flags.Design)
 
-        starttime = Attribute("StartTime",
-            "Time at which the application will start",
-            default = "+0.0ns",  
-            flags = Flags.Reserved | Flags.Construct)
-
-
-        stoptime = Attribute("StopTime",
-            "Time at which the application will stop",
-            default = "+0.0ns",  
-            flags = Flags.Reserved | Flags.Construct)
+        depends = Attribute("depends", 
+                "Space-separated list of packages required to run the application",
+                flags = Flags.Design)
 
         cls._register_attribute(sources)
         cls._register_attribute(build)
-        cls._register_attribute(stoptime)
-        cls._register_attribute(starttime)
+        cls._register_attribute(depends)
 
     def _instantiate_object(self):
         command = []
-        
+
+        # Install package dependencies required to run the binary 
+        depends = self.get("depends")
+        if depends:
+            dcmd = self.simulation.install_dependencies(depends = depends)
+            if dcmd:
+                command.append(dcmd)
+       
+        # Upload sources to generate the binary
         sources = self.get("sources")
         if sources:
-            self.info("Uploading sources %s " % sources)
             scmd = self.simulation.upload_extra_sources(sources = sources)
             if scmd:
                 command.append(scmd)
                 
+        # Upload instructions to build the binary
         build = self.get("build")
         if build:
             bcmd = self.simulation.build(build = build)