+ if not self._omf_api :
+ self._omf_api = OMFAPIFactory.get_api(self.get('version'),
+ self.get('xmppServer'), self.get('xmppUser'), self.get('xmppPort'),
+ self.get('xmppPassword'), exp_id = self.exp_id)
+
+ if not (self.get('name')):
+ msg = "Interface's name is not initialized"
+ self.error(msg)
+ raise RuntimeError, msg
+
+ if not (self.get('mode') and self.get('essid') \
+ and self.get('hw_mode') and self.get('ip')):
+ msg = "Interface's variable are not initialized"
+ self.error(msg)
+ raise RuntimeError, msg
+
+ if self.get('version') == "5":
+ res = self.configure_on_omf5()
+
+ else :
+ res = self.configure_on_omf6()
+
+ if res:
+ super(OMFWifiInterface, self).do_deploy()
+
+ def configure_on_omf6(self):
+ """ Method to configure the wifi interface when OMF 6 is used.
+
+ """
+ if not self.create_id :
+ props = {}
+ props['wlan:if_name'] = self.get('name')
+ props['wlan:mode'] = {
+ "mode": self.get('mode'),
+ "hw_mode" : self.get('hw_mode'),
+ "channel" : self.channel.get('channel'),
+ "essid" : self.get('essid'),
+ "ip_addr" : self.get('ip'),
+ "frequency" : self.channel.frequency,
+ "phy" : "%0%"
+ }
+ props['wlan:hrn'] = self.get('name')
+ props['wlan:type'] = "wlan"
+
+ self.create_id = os.urandom(16).encode('hex')
+ self._omf_api.frcp_create( self.create_id, self.node.get('hostname'), "wlan", props = props)
+
+ if self._create_cnt > confirmation_counter:
+ msg = "Couldn't retrieve the confirmation of the creation"
+ self.error(msg)
+ raise RuntimeError, msg
+
+ uid = self.check_deploy(self.create_id)
+ if not uid:
+ self._create_cnt +=1
+ self.ec.schedule(reschedule_check, self.deploy)
+ return False
+
+ self._topic_iface = uid
+ self._omf_api.enroll_topic(self._topic_iface)
+ return True
+
+ def check_release(self, cid):
+ """ Check, through the mail box in the parser,
+ if the confirmation of the release has been received
+
+ :param cid: the id of the original message
+ :type guid: string