Browse Source

Initial commit: Fog Export to DHCP

main
Graham Northup 6 months ago
commit
0336d9fe41
  1. 12
      fog_hosts_to_dhcpd.py

12
fog_hosts_to_dhcpd.py

@ -0,0 +1,12 @@
import csv, sys
rdr = csv.reader(sys.stdin)
D_MAC, D_NAME = 0, 1
ADDR_FORM = '128.153.144.{}'
BIAS = 40
for row in rdr:
mac, name = map(lambda i: row[i], (D_MAC, D_NAME))
if name.lower().startswith('itl'):
_, _, rest = name.partition('-')
rest = int(rest)
addr = ADDR_FORM.format(rest + BIAS)
print(f'host {name}.cslabs.clarkson.edu {{ hardware ethernet {mac}; fixed-address {addr}; }}')
Loading…
Cancel
Save