Skip to content

Commit

Permalink
Add os to attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
liorf committed Mar 14, 2017
1 parent 861e4e5 commit c30cc45
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nsot_sync/drivers/device_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,25 @@ def scan(self, ip):

device = find_device_in_ipam(ip, self.devices, self.logger)
# TODO - Add more attributes here
if device_type == 'arista_eos':
os = 'eos'
elif device_type == 'cisco_ios':
os = 'ios'
elif device_type == 'cisco_nxos':
os = 'nxos'
else:
os = 'unknown'
if not device:
self.logger.info('%s - Not exist in IPAM', ip)
attributes = {'address': ip, 'last_reachable': str(st), 'device_type': device_type}
attributes = {'address': ip, 'last_reachable': str(st), 'device_type': device_type, 'hostname': str(hostname), 'os': os}
device = {'hostname': str(hostname),
'attributes': attributes}
else:
self.logger.info('%s - Exist in IPAM', ip)
device['attributes']['device_type'] = device_type
device['attributes']['last_reachable'] = str(st)
device['attributes']['hostname'] = str(hostname)
device['attributes']['os'] = str(os)
device['hostname'] = hostname
self.devices_to_update.append(device)
except NetMikoAuthenticationException as e:
Expand Down

0 comments on commit c30cc45

Please sign in to comment.