2 # NEPI, a framework to manage network experiments
3 # Copyright (C) 2013 INRIA
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Authors: Alina Quereilhac <alina.quereilhac@inria.fr>
19 # Julien Tribino <julien.tribino@inria.fr>
23 from nepi.execution.attribute import Attribute, Flags, Types
24 from nepi.execution.resource import ResourceManager, clsinit_copy, \
25 ResourceState, reschedule_delay
30 #clsinit_copy is used to copy the attirbute from parent class
32 class RMName(ResourceManager):
34 _rtype = "RMName" # Name that will be used in the Experiment Description Script
35 _help = "Help that describe the RM"
36 _backend_type = "backend" # Name of the platform this RM is attached.
37 _authorized_connections = ["RMName1" , "RMName2"] # list of valid connection for this RM
41 def _register_attributes(cls):
43 This method is used to register all the attribute of this RM. Check the
44 file src/execution/attribute.py to see all the fields of this class
47 attribute1 = Attribute("nameOfAttribute1", "Description of the Attribute 1",
50 attribute2 = Attribute("nameOfAttribute2", "Description of the Attribute 2",
53 cls._register_attribute(attribute1)
54 cls._register_attribute(attribute2)
56 def __init__(self, ec, guid):
58 In the init, we usually intialize the variable of the RM that are not attribute
61 super(RMName, self).__init__(ec, guid)
66 def log_message(self, msg):
68 In some particular cases, it is required to redefined the log of the RM.
69 The default log require the name of the node, but sometimes,
70 it does not mean something.
72 return " guid %d - host %s - %s " % (self.guid,
73 self.get("hostname"), msg)
76 def valid_connection(self, guid):
78 Check if the connection is valide or not, depending on the list povided in the parameter
79 _authorized_connection described above
83 # This one is not mandatory
84 def do_discover(self):
86 Do anything required to discover the resource.The meaning of discover
87 is different for each RM
89 super(RMName, self).do_discover()
91 # This one is not mandatory
92 def do_provision(self):
94 Do anything required to provision the resource.The meaning of provision
95 is different for each RM
97 super(RMName, self).do_provision()
101 Do anything required to deploy the resource.The meaning of deploy
102 is different for each RM
104 super(RMName, self).do_deploy()
109 Do anything required to start the resource.The meaning of start
110 is different for each RM
112 super(RMName, self).do_release()
117 Do anything required to stop the resource.The meaning of stop
118 is different for each RM
120 super(RMName, self).do_release()
122 def do_release(self):
124 Do anything required to release the resource.The meaning of release
125 is different for each RM
127 super(RMName, self).do_release()