X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fomf%2Fnode.py;h=c0e10f912621bfcb81ff683d2dc5e63bf7a6cd8f;hb=f025a30a215310a9803067a25e244137b71f56f2;hp=6658f6259f087aad72fe574f1f0117c8af1ec112;hpb=dac2434143d573f76c14eac647645d478cfb4f80;p=nepi.git diff --git a/src/nepi/resources/omf/node.py b/src/nepi/resources/omf/node.py index 6658f625..c0e10f91 100644 --- a/src/nepi/resources/omf/node.py +++ b/src/nepi/resources/omf/node.py @@ -26,6 +26,9 @@ from nepi.resources.omf.omf_api_factory import OMFAPIFactory import time +reschedule_check = "0.3s" +confirmation_counter = 300 + @clsinit_copy class OMFNode(OMFResource): """ @@ -94,7 +97,6 @@ class OMFNode(OMFResource): def do_deploy(self): """ Deploy the RM. It means : Send Xmpp Message Using OMF protocol to enroll the node into the experiment. - It becomes DEPLOYED after sending messages to enroll the node """ if not self.get('xmppServer'): @@ -130,7 +132,8 @@ class OMFNode(OMFResource): super(OMFNode, self).do_deploy() def do_release(self): - """ Clean the RM at the end of the experiment + """ Clean the RM at the end of the experiment by unenrolling + the node from the topic """ from nepi.resources.omf.application import OMFApplication @@ -141,6 +144,14 @@ class OMFNode(OMFResource): self.ec.schedule(reschedule_delay, self.release) return + from nepi.resources.omf.interface import OMFWifiInterface + rm_list = self.get_connected(OMFWifiInterface.get_rtype()) + if rm_list: + for rm in rm_list: + if rm.state < ResourceState.RELEASED: + self.ec.schedule(reschedule_delay, self.release) + return + if self._omf_api: if self.get('version') == "5": self._omf_api.release(self.get('hostname'))