make sure every interface attribute is ok

This commit is contained in:
Solvik Blum 2019-08-07 19:09:09 +02:00
commit ab660b4fcf
No known key found for this signature in database
GPG key ID: CC12B3DC262B6C47

View file

@ -224,6 +224,23 @@ class Network():
interface=interface, name=nic['name'])) interface=interface, name=nic['name']))
interface.name = nic['name'] interface.name = nic['name']
if nic['vlan'] is None and interface.mode is not None:
logging.info('Interface is not tagged, reseting mode')
nic_update = True
interface.mode = None
type = self.get_netbox_type_for_nic(nic)
if type != interface.type.value:
logging.info('Interface type is wrong, resetting')
nic_update = True
interface.type = type
if interface.lag is not None:
if nic['name'] not in self.nics[interface.lag.name]['bonding_slaves']:
logging.info('Interface has no LAG, resetting')
nic_update = True
interface.lag = None
if nic['ip']: if nic['ip']:
# sync local IPs # sync local IPs
for ip in nic['ip']: for ip in nic['ip']: