Exemplo n.º 1
0
 def add_computer(self, computer):
     if isinstance(computer, Computer):
         if re.match(MAC_REGULAR_EXPRESSION, computer.mac):
             if re.match(IP_REGULAR_EXPRESSION, computer.ip):
                 if NetMap.can_ip_in_my_network(computer.ip):
                     computer.active = False
                     self.__database.add_row(computer)
                     return "Computer successfully added."
                 return "The IP address entered cannot exist in this network"
             return "Invalid IP format"
         return "Invalid MAC format"