def validation(self,action): if self.name == "": return "name" if action == "add": if self.existsHostname(): return "hostAlreadyExists" if self.mac == "": return "mac" if not ValidationUtils.validMAC(self.mac): return "mac" if action == "add": if self.existsMAC(): return "macAlreadyExists" elif action == "modify": if not self.equalMAC(): if self.existsMAC(): return "macAlreadyExists" return "OK"
def validation(self,action): if self.name == "": return "name" if action == "add": if self.existsHostname(): return "hostAlreadyExists" if self.mac == "": return "mac" if not ValidationUtils.validMAC(self.mac): return "mac" if self.macWlan!="": if not ValidationUtils.validMAC(self.macWlan): return "macWlan" if self.mac == self.macWlan: return "macWlanAlreadyExists" if action == "add": if self.existsMAC(self.mac): return "macAlreadyExists" if self.macWlan!="": if self.existsMAC(self.macWlan): return "macWlanAlreadyExists" elif action == "modify": if not self.equalMAC(): if self.existsMAC(self.mac): return "macAlreadyExists" if self.macWlan!="": if not self.equalMACWlan(): if self.existsMAC(self.macWlan): return "macWlanAlreadyExists" if self.username != "": u = Users(self.ldap,"","","","",self.username,"","","","") exists = u.existsUsername() if not exists: return "userNotExists" return "OK"
def validation(self, action): if self.name == "": return "name" if action == "add": if self.existsHostname(): return "hostAlreadyExists" if self.mac == "": return "mac" if not ValidationUtils.validMAC(self.mac): return "mac" if self.macWlan != "": if not ValidationUtils.validMAC(self.macWlan): return "macWlan" if self.mac == self.macWlan: return "macWlanAlreadyExists" if action == "add": if self.existsMAC(self.mac): return "macAlreadyExists" if self.macWlan != "": if self.existsMAC(self.macWlan): return "macWlanAlreadyExists" elif action == "modify": if not self.equalMAC(): if self.existsMAC(self.mac): return "macAlreadyExists" if self.macWlan != "": if not self.equalMACWlan(): if self.existsMAC(self.macWlan): return "macWlanAlreadyExists" if self.username != "": u = Users(self.ldap, "", "", "", "", self.username, "", "", "", "") exists = u.existsUsername() if not exists: return "userNotExists" return "OK"
def validation(self,action): if self.id_trademark == "none": return "id_trademark" if self.serial_number == "": return "serial_number" exists = self.existsSerialNumber(self.serial_number) if action=="add" and exists!=False: return "serial_number_exists" if action=="modify" and exists!=False: if exists!=self.id_laptop: return "serial_number_exists" # Validacion mac eth0 if self.mac_eth0 != "": if not ValidationUtils.validMAC(self.mac_eth0): return "mac_eth0" existsMAC_eth0 = self.existsMAC(self.mac_eth0) if action=="add" and existsMAC_eth0!=False: return "mac_eth0_exists" if action=="modify" and existsMAC_eth0!=False: if existsMAC_eth0!=self.id_laptop: return "mac_eth0_exists" # Validacion mac wlan0 if self.mac_wlan0 != "": if not ValidationUtils.validMAC(self.mac_wlan0): return "mac_wlan0" existsMAC_wlan0 = self.existsMAC(self.mac_wlan0) if action=="add" and existsMAC_wlan0!=False: return "mac_wlan0_exists" if action=="modify" and existsMAC_wlan0!=False: if existsMAC_wlan0!=self.id_laptop: return "mac_wlan0_exists" return "OK"
def validation(self, action): if self.type_host == "none": return "type_host" if self.name == "": return "name" if action == "add": if self.existsHostname(): return "hostAlreadyExists" if self.ip == "": return "ip" if not ValidationUtils.validIP(self.ip): return "ip" if action == "add": if self.existsIP(): return "ipAlreadyExists" elif action == "modify": if not self.equalIP(): if self.existsIP(): return "ipAlreadyExists" if self.mac == "": return "mac" if not ValidationUtils.validMAC(self.mac): return "mac" if action == "add": if self.existsMAC(): return "macAlreadyExists" elif action == "modify": if not self.equalMAC(): if self.existsMAC(): return "macAlreadyExists" return "OK"
def validation(self,action): if self.type_host == "none": return "type_host" if self.name == "": return "name" if action == "add": if self.existsHostname(): return "hostAlreadyExists" if self.ip == "": return "ip" if not ValidationUtils.validIP(self.ip): return "ip" if action == "add": if self.existsIP(): return "ipAlreadyExists" elif action == "modify": if not self.equalIP(): if self.existsIP(): return "ipAlreadyExists" if self.mac == "": return "mac" if not ValidationUtils.validMAC(self.mac): return "mac" if action == "add": if self.existsMAC(): return "macAlreadyExists" elif action == "modify": if not self.equalMAC(): if self.existsMAC(): return "macAlreadyExists" return "OK"