+ @property
+ def exp_id(self):
+ return self.ec.exp_id
+
+ @property
+ def node(self):
+ rm_list = self.get_connected(OMFNode.get_rtype())
+ if rm_list: return rm_list[0]
+ return None
+
+ @property
+ def channel(self):
+ rm_list = self.get_connected(OMFChannel.get_rtype())
+ if rm_list: return rm_list[0]
+ return None
+
+ def configure_iface(self):
+ """ Configure the interface without the ip
+
+ """
+ if self.node.state < ResourceState.READY:
+ self.ec.schedule(reschedule_delay, self.deploy)
+ return False
+
+ for attrname in ["mode", "type", "essid"]:
+ if attrname == "type" :
+ attrval = self._type
+ else :
+ attrval = self.get(attrname)
+ attrname = "net/%s/%s" % (self.alias, attrname)
+ self._omf_api.configure(self.node.get('hostname'), attrname,
+ attrval)
+
+ super(OMFWifiInterface, self).do_provision()
+ return True
+
+ def configure_ip(self):
+ """ Configure the ip of the interface
+
+ .. note : The ip is separated from the others parameters to avoid
+ CELL ID shraing problem. By putting th ip at the end of the configuration,
+ each node use the same channel and can then share the same CELL ID.
+ In the second case, the channel is defined at the end and the node don't
+ share a common CELL ID and can not communicate.
+
+ """
+ if self.channel.state < ResourceState.READY:
+ self.ec.schedule(reschedule_delay, self.deploy)
+ return False
+
+ attrval = self.get("ip")
+ if '/' in attrval:
+ attrval,mask = attrval.split('/')
+ attrname = "net/%s/%s" % (self.alias, "ip")
+ self._omf_api.configure(self.node.get('hostname'), attrname,
+ attrval)
+ return True
+
+
+ def configure_on_omf5(self):
+ """ Method to configure the wifi interface when OMF 5.4 is used.
+
+ """
+
+ self._type = self.get('hw_mode')
+ if self.get('name') == "wlan0" or "eth0":
+ self.alias = "w0"
+ else:
+ self.alias = "w1"
+ res = False
+ if self.state < ResourceState.PROVISIONED:
+ if self._conf == False:
+ self._conf = self.configure_iface()
+ if self._conf == True:
+ res = self.configure_ip()
+ return res
+
+ def check_deploy(self, cid):
+ """ Check, through the mail box in the parser,
+ if the confirmation of the creation has been received
+
+ :param cid: the id of the original message
+ :type guid: string
+
+ """
+ uid = self._omf_api.check_mailbox("create", cid)
+ if uid :
+ return uid
+ return False
+
+ def do_deploy(self):
+ """ Deploy the RM. It means : Get the xmpp client and send messages
+ using OMF 5.4 or 6 protocol to configure the interface.
+