From: Julien Tribino Date: Tue, 10 Jun 2014 13:23:51 +0000 (+0200) Subject: Add the template file to extend NEPI X-Git-Tag: nepi-3.1.0~28 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c80f0b761a50bd9af3337c7e28e9bcd25b476b16;p=nepi.git Add the template file to extend NEPI --- diff --git a/doc/templates/template.py b/doc/templates/template.py new file mode 100644 index 00000000..8a95124b --- /dev/null +++ b/doc/templates/template.py @@ -0,0 +1,129 @@ +# +# NEPI, a framework to manage network experiments +# Copyright (C) 2013 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Authors: Alina Quereilhac +# Julien Tribino + + + +from nepi.execution.attribute import Attribute, Flags, Types +from nepi.execution.resource import ResourceManager, clsinit_copy, \ + ResourceState, reschedule_delay + +#import time +#import threading + +#clsinit_copy is used to copy the attirbute from parent class +@clsinit_copy +class RMName(ResourceManager): + + _rtype = "RMName" # Name that will be used in the Experiment Description Script + _help = "Help that describe the RM" + _backend_type = "backend" # Name of the platform this RM is attached. + _authorized_connections = ["RMName1" , "RMName2"] # list of valid connection for this RM + + + @classmethod + def _register_attributes(cls): + ''' + This method is used to register all the attribute of this RM. Check the + file src/execution/attribute.py to see all the fields of this class + ''' + + attribute1 = Attribute("nameOfAttribute1", "Description of the Attribute 1", + flags = Flags.Design) + + attribute2 = Attribute("nameOfAttribute2", "Description of the Attribute 2", + flags = Flags.Design) + + cls._register_attribute(attribute1) + cls._register_attribute(attribute2) + + def __init__(self, ec, guid): + ''' + In the init, we usually intialize the variable of the RM that are not attribute + ''' + + super(RMName, self).__init__(ec, guid) + + self.var1 = None + + + def log_message(self, msg): + ''' + In some particular cases, it is required to redefined the log of the RM. + The default log require the name of the node, but sometimes, + it does not mean something. + ''' + return " guid %d - host %s - %s " % (self.guid, + self.get("hostname"), msg) + + + def valid_connection(self, guid): + ''' + Check if the connection is valide or not, depending on the list povided in the parameter + _authorized_connection described above + ''' + return True + + # This one is not mandatory + def do_discover(self): + ''' + Do anything required to discover the resource.The meaning of discover + is different for each RM + ''' + super(RMName, self).do_discover() + + # This one is not mandatory + def do_provision(self): + ''' + Do anything required to provision the resource.The meaning of provision + is different for each RM + ''' + super(RMName, self).do_provision() + + def do_deploy(self): + ''' + Do anything required to deploy the resource.The meaning of deploy + is different for each RM + ''' + super(RMName, self).do_deploy() + + + def do_start(self): + ''' + Do anything required to start the resource.The meaning of start + is different for each RM + ''' + super(RMName, self).do_release() + + + def do_stop(self): + ''' + Do anything required to stop the resource.The meaning of stop + is different for each RM + ''' + super(RMName, self).do_release() + + def do_release(self): + ''' + Do anything required to release the resource.The meaning of release + is different for each RM + ''' + super(RMName, self).do_release() + + diff --git a/src/nepi/resources/omf/node.py b/src/nepi/resources/omf/node.py index c0e10f91..875693fc 100644 --- a/src/nepi/resources/omf/node.py +++ b/src/nepi/resources/omf/node.py @@ -26,8 +26,8 @@ from nepi.resources.omf.omf_api_factory import OMFAPIFactory import time -reschedule_check = "0.3s" -confirmation_counter = 300 +reschedule_check = "0.4s" +confirmation_counter = 600 @clsinit_copy class OMFNode(OMFResource):