Changeset 10882 in genesis for tools/gformat.py
- Timestamp:
- May 16, 2012, 7:47:50 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10881 r10882 429 429 430 430 (addr, mask) = datadump[iface_key]['ip'].split('/') 431 datadump[iface_key]['a ddr'] = addr432 datadump[iface_key][' netmask'] = cidr2netmask(mask)433 datadump[iface_key][' subnet'] = get_network(addr, mask)431 datadump[iface_key]['autogen_addr'] = addr 432 datadump[iface_key]['autogen_netmask'] = cidr2netmask(mask) 433 datadump[iface_key]['autogen_subnet'] = get_network(addr, mask) 434 434 try: 435 435 (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-') 436 436 except (AttributeError, ValueError, KeyError): 437 dhcp_out[ifname].append(" subnet %( subnet)s netmask %(netmask)s {\n ### not autoritive\n }\n" % datadump[iface_key])437 dhcp_out[ifname].append(" subnet %(autogen_subnet)s netmask %(autogen_netmask)s {\n ### not autoritive\n }\n" % datadump[iface_key]) 438 438 continue 439 439 440 440 dhcp_part = ".".join(addr.split('.')[0:3]) 441 datadump[iface_key][' dhcp_start'] = dhcp_part + "." + dhcp_start442 datadump[iface_key][' dhcp_stop'] = dhcp_part + "." + dhcp_stop441 datadump[iface_key]['autogen_dhcp_start'] = dhcp_part + "." + dhcp_start 442 datadump[iface_key]['autogen_dhcp_stop'] = dhcp_part + "." + dhcp_stop 443 443 dhcp_out[ifname].append("""\ 444 subnet %( subnet)s netmask %(netmask)s {445 range %( dhcp_start)s %(dhcp_stop)s;446 option routers %(a ddr)s;447 option domain-name-servers %(a ddr)s;444 subnet %(autogen_subnet)s netmask %(autogen_netmask)s { 445 range %(autogen_dhcp_start)s %(autogen_dhcp_stop)s; 446 option routers %(autogen_addr)s; 447 option domain-name-servers %(autogen_addr)s; 448 448 } 449 449 """ % datadump[iface_key]) … … 480 480 (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-') 481 481 (ip, cidr) = datadump[iface_key]['ip'].split('/') 482 datadump[iface_key][' netmask'] = cidr2netmask(cidr)482 datadump[iface_key]['autogen_netmask'] = cidr2netmask(cidr) 483 483 except (AttributeError, ValueError, KeyError): 484 484 output += "# not autoritive\n\n" … … 486 486 487 487 dhcp_part = ".".join(ip.split('.')[0:3]) 488 datadump[iface_key][' dhcp_start'] = dhcp_part + "." + dhcp_start489 datadump[iface_key][' dhcp_stop'] = dhcp_part + "." + dhcp_stop490 output += "dhcp-range=%(interface)s,%( dhcp_start)s,%(dhcp_stop)s,%(netmask)s,24h\n\n" % datadump[iface_key]488 datadump[iface_key]['autogen_dhcp_start'] = dhcp_part + "." + dhcp_start 489 datadump[iface_key]['autogen_dhcp_stop'] = dhcp_part + "." + dhcp_stop 490 output += "dhcp-range=%(interface)s,%(autogen_dhcp_start)s,%(autogen_dhcp_stop)s,%(autogen_netmask)s,24h\n\n" % datadump[iface_key] 491 491 492 492 return output … … 695 695 if ifacedump['type'] in ['11a', '11b', '11g', 'wireless']: 696 696 # Default to station (client) mode 697 ifacedump[' wlanmode'] = "sta"697 ifacedump['autogen_wlanmode'] = "sta" 698 698 if ifacedump['mode'] in ['master', 'master-wds', 'ap', 'ap-wds']: 699 ifacedump[' wlanmode'] = "ap"699 ifacedump['autogen_wlanmode'] = "ap" 700 700 # Default to 802.11b mode 701 701 ifacedump['mode'] = '11b' … … 711 711 # Allow special hacks at the back like wds and stuff 712 712 if not ifacedump.has_key('extra'): 713 ifacedump['extra'] = 'regdomain ETSI country NL' 713 ifacedump['autogen_extra'] = 'regdomain ETSI country NL' 714 else: 715 ifacedump['autogen_extra'] = ifacedump['extra'] 716 714 717 715 718 output += "wlans_%(interface)s='%(autogen_ifname)s'\n" % ifacedump 716 output += ("create_args_%(autogen_ifname)s='wlanmode %( wlanmode)s mode " +\717 "%(mode)s ssid %(ssid)s %( extra)s channel %(channel)s'\n") % ifacedump719 output += ("create_args_%(autogen_ifname)s='wlanmode %(autogen_wlanmode)s mode " +\ 720 "%(mode)s ssid %(ssid)s %(autogen_extra)s channel %(channel)s'\n") % ifacedump 718 721 719 722 elif ifacedump['type'] in ['ethernet', 'eth']: … … 1131 1134 try: 1132 1135 (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-') 1133 datadump[iface_key][' netmask'] = cidr2netmask(cidr)1136 datadump[iface_key]['autogen_netmask'] = cidr2netmask(cidr) 1134 1137 dhcp_part = ".".join(ip.split('.')[0:3]) 1135 1138 if ip != datadump['masterip']: … … 1502 1505 if not datadump[iface_key].has_key('comment'): 1503 1506 datadump[iface_key]['comment'] = 'autogen-FIXME' 1507 1508 if datadump[iface_key]['comment'].startswith('autogen-') and datadump[iface_key].has_key('comment'): 1509 datadump[iface_key]['comment'] = datadump[iface_key]['desc'] 1510 1511 if datadump[iface_key].has_key('desc') and datadump[iface_key]['comment'] == datadump[iface_key]['desc']: 1512 del datadump[iface_key]['desc'] 1513 1504 1514 # Set the compass value based on the angle between the poels 1505 1515 if datadump[iface_key].has_key('ns_ip'):
Note:
See TracChangeset
for help on using the changeset viewer.