Changeset 10162 in genesis for tools


Ignore:
Timestamp:
Mar 14, 2012, 2:13:19 PM (13 years ago)
Author:
rick
Message:

a) Fix IP assignment for wlan0.

b) fixed IP assignment for normal aliases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10156 r10162  
    351351  for iface_key in datadump['iface_keys']:
    352352    ifacedump = datadump[iface_key]
    353     interface = ifacedump['interface'].split(':')[0]
    354     # By default no special interface mapping
    355     iface_map[interface] = interface
     353    ifname = ifacedump['autogen_ifname']
    356354
    357355    # Add interface IP to list
    358356    item = (ifacedump['ip'], ifacedump['desc'])
    359     if addrs_list.has_key(interface):
    360       addrs_list[interface].append(item)
     357    if addrs_list.has_key(ifname):
     358      addrs_list[ifname].append(item)
    361359    else:
    362       addrs_list[interface] = [item]
     360      addrs_list[ifname] = [item]
    363361
    364362    # Alias only needs IP assignment for now, this might change if we
     
    402400  for iface,addrs in sorted(addrs_list.iteritems()):
    403401    for addr, comment in sorted(addrs,key=lambda x: parseaddr(x[0].split('/')[0])):
    404       ifacedump['iface'] = iface
    405402      output += "# %s || %s || %s\n" % (iface, addr, comment)
    406     output += "ipv4_addrs_%s='%s'\n\n" % (iface_map[iface], " ".join([x[0] for x in addrs]))
     403    output += "ipv4_addrs_%s='%s'\n\n" % (iface, " ".join([x[0] for x in addrs]))
    407404
    408405  return output
     
    424421      wlan_count += 1
    425422    else:
    426       datadump[key]['autogen_ifname'] = datadump[key]['interface']
     423      datadump[key]['autogen_ifname'] = datadump[key]['interface'].split(':')[0]
    427424
    428425
     
    972969            if ssid.lower().startswith(prefix.lower()):
    973970              datadump[iface_key]['ssid'] = prefix + ssid[len(prefix)].upper() + ssid[len(prefix) + 1:]
     971          if datadump[iface_key].has_key('ns_ip') and not datadump[iface_key].has_key('mode'):
     972            datadump[iface_key]['mode'] = 'autogen-FIXME'
     973          if not datadump[iface_key].has_key('desc'):
     974            datadump[iface_key]['desc'] = 'autogen-FIXME'
    974975        store_yaml(datadump)
    975976    elif sys.argv[1] == "list":
Note: See TracChangeset for help on using the changeset viewer.