Changeset 14053 in genesis for tools/gformat.py


Ignore:
Timestamp:
Feb 20, 2018, 2:54:34 PM (7 years ago)
Author:
rick
Message:

Fix alias VLAN dhcp declaration not mapped to shared-network

While here make all entries-shared networks, since it does not harm anyways:

Note that even when the shared-network declaration is absent, an empty
one is created by the server to contain the subnet (and any scoped
parameters included in the subnet). For practical purposes, this means
that "stateless" DHCP clients, which are not tied to addresses (and
therefore subnets) will receive the same configuration as stateful
ones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r14045 r14053  
    230230          wlan_count += 1
    231231        else:
    232           datadump[key]['autogen_if_dhcp'] = datadump[key]['autogen_ifbase']
    233232          datadump[key]['autogen_ifname'] = '_'.join(key.split('_')[1:])
    234233          if len(key.split('_')) > 2 and key.split('_')[2].isdigit():
    235234            datadump[key]['autogen_vlan'] = key.split('_')[2]
    236235            datadump[key]['autogen_iface'] = '.'.join(key.split('_')[1:])
     236            datadump[key]['autogen_if_dhcp'] = datadump[key]['autogen_ifname']
    237237          else:
    238238            datadump[key]['autogen_iface'] = '_'.join(key.split('_')[1:])
     239            datadump[key]['autogen_if_dhcp'] = datadump[key]['autogen_ifbase']
     240        print key,datadump[key]['autogen_iface'], datadump[key]['autogen_ifname'], datadump[key]['autogen_if_dhcp']
    239241
    240242    except Exception as exc:
     
    549551  for iface_key in get_interface_keys(datadump):
    550552    ifname = datadump[iface_key]['autogen_ifbase']
    551     groupif = ifname if not datadump[iface_key]['autogen_vlan'] else iface_key
     553    groupif = datadump[iface_key]['autogen_if_dhcp']
    552554    if not datadump[iface_key].has_key('comment'):
    553555      datadump[iface_key]['comment'] = None
     
    610612  # Output the blocks in groups
    611613  for ifname,value in sorted(dhcp_out.iteritems()):
    612     if len(value) > 2:
    613       output += ("shared-network %s {\n" % ifname) + indent(''.join(value), 2)  + '\n}\n\n'
    614     else:
    615       output += ''.join(value) + "\n\n"
     614      output += ("shared-network %s {\n" % ifname) + indent(''.join(value), 2).rstrip()  + '\n}\n\n'
    616615  return output
    617616
Note: See TracChangeset for help on using the changeset viewer.