Miscellaneous administrivia that might be useful
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
428 B

  1. import csv, sys
  2. rdr = csv.reader(sys.stdin)
  3. D_MAC, D_NAME = 0, 1
  4. ADDR_FORM = '128.153.144.{}'
  5. BIAS = 40
  6. for row in rdr:
  7. mac, name = map(lambda i: row[i], (D_MAC, D_NAME))
  8. if name.lower().startswith('itl'):
  9. _, _, rest = name.partition('-')
  10. rest = int(rest)
  11. addr = ADDR_FORM.format(rest + BIAS)
  12. print(f'host {name}.cslabs.clarkson.edu {{ hardware ethernet {mac}; fixed-address {addr}; }}')