def clean(self): raw_iface = networkutils.get_interfaces()[0] if self.address == raw_iface.addr: return returncode, stdout = networkutils.ping(self.address, packets=1) if not returncode: raise ValidationError(u'Erro, existe outra máquina com o mesmo IP na rede.')
def __init__(self, *args, **kwargs): super(NetworkInterface, self).__init__(*args, **kwargs) if not self.id: raw_iface = networkutils.get_interfaces()[0] self.address = raw_iface.addr self.netmask = raw_iface.netmask self.gateway = self.default_gateway self.dns1 = self.default_gateway
def get_raw_network_interface_address(): raw_iface = networkutils.get_interfaces()[0] return raw_iface.addr