Fixing wrong license
[nepi.git] / src / nepi / resources / linux / ns3 / ccn / ns3fibentrydceapplication.py
index 63e5d19..087ccda 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.linux.ns3.ccn.ns3ccndceapplication import LinuxNS3CCNDceApplication
 
 @clsinit_copy
 class LinuxNS3DceFIBEntry(LinuxNS3CCNDceApplication):
-    _rtype = "ns3::LinuxDceFIBEntry"
+    _rtype = "linux::ns3::dce::FIBEntry"
 
     @classmethod
     def _register_attributes(cls):
@@ -53,11 +52,16 @@ class LinuxNS3DceFIBEntry(LinuxNS3CCNDceApplication):
                 "Peer host public IP used in network connection for this FIB entry. ",
                 flags = Flags.Design)
 
+        home = Attribute("home", "Sets HOME environmental variable. ",
+                default = "/root",
+            flags = Flags.Design)
         cls._register_attribute(uri)
         cls._register_attribute(protocol)
         cls._register_attribute(host)
         cls._register_attribute(port)
         cls._register_attribute(ip)
+        cls._register_attribute(home)
 
     def _instantiate_object(self):
         if not self.get("binary"):
@@ -66,8 +70,22 @@ class LinuxNS3DceFIBEntry(LinuxNS3CCNDceApplication):
         if not self.get("arguments"):
             self.set("arguments", self._arguments)
 
+        if not self.get("environment"):
+            self.set("environment", self._environment)
+        
         super(LinuxNS3DceFIBEntry, self)._instantiate_object()
 
+    @property
+    def _environment(self):
+        envs = dict({
+            "home": "HOME",
+            })
+
+        env = ";".join(map(lambda k: "%s=%s" % (envs.get(k), str(self.get(k))), 
+            [k for k in envs.keys() if self.get(k)]))
+
+        return env
+
     @property
     def _arguments(self):
         args = ["-v", "add"]