- pass
-
- def start(self):
- """Start the RM. It means nothing special for an interface for now
- It becomes STARTED as soon as this method starts.
-
- """
-
- super(OMFNode, self).start()
-
- def stop(self):
- """Stop the RM. It means nothing special for an interface for now
- It becomes STOPPED as soon as this method stops
-
- """
- super(OMFNode, self).stop()
- self.set_finished()
-
- def release(self):
- """Clean the RM at the end of the experiment
-
- """
- if self._omf_api :
- self._omf_api.release(self.get('hostname'))
-
- OMFAPIFactory.release_api(self.get('xmppSlice'),
- self.get('xmppHost'), self.get('xmppPort'),
- self.get('xmppPassword'), exp_id = self.exp_id)
-
- super(OMFNode, self).release()
+ from nepi.resources.omf.application import OMFApplication
+ rm_list = self.get_connected(OMFApplication.get_rtype())
+ if rm_list:
+ for rm in rm_list:
+ if rm.state < ResourceState.RELEASED:
+ 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'))
+ else:
+ self._omf_api.unenroll_topic(self.get('hostname'))
+
+ OMFAPIFactory.release_api(self.get('version'),
+ self.get('xmppServer'), self.get('xmppUser'), self.get('xmppPort'),
+ self.get('xmppPassword'), exp_id = self.exp_id)
+
+ super(OMFNode, self).do_release()