Changeset 13598 in genesis
- Timestamp:
- Aug 9, 2016, 11:49:24 AM (8 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
nodes/GHR/wleiden.yaml
r13597 r13598 38 38 iface_ue0: 39 39 comment : "Link naar Kaag2" 40 ether : "02:00:ac:10:07:44" 40 41 ip : "172.16.7.68/29" 41 42 sdesc : "2kaag2" -
tools/gformat.py
r13568 r13598 615 615 616 616 617 class AutoVivification(dict): 618 """Implementation of perl's autovivification feature.""" 619 def __getitem__(self, item): 620 try: 621 return dict.__getitem__(self, item) 622 except KeyError: 623 value = self[item] = type(self)() 624 return value 625 617 626 def make_interface_list(datadump): 618 627 if interface_list_cache.has_key(datadump['autogen_item']): … … 624 633 addrs_list = { 'lo0' : [("127.0.0.1/8", "LocalHost"), ("172.31.255.1/32","Proxy IP")] } 625 634 vlan_list = defaultdict(list) 635 flags_if = AutoVivification() 626 636 dhclient_if = {'lo0' : False} 627 637 … … 648 658 if not dhclient_if.has_key(ifname) or dhclient_if[ifname] == False: 649 659 dhclient_if[ifname] = dhcp_type(ifacedump) == DHCP_CLIENT 660 661 # Ethernet address 662 if ifacedump.has_key('ether'): 663 flags_if[ifname]['ether'] = ifacedump['ether'] 650 664 651 665 # DHCP interfaces are to be added to bridge0 … … 705 719 assert False, "Unknown type " + ifacedump['type'] 706 720 707 store = (addrs_list, vlan_list, dhclient_if, output)721 store = (addrs_list, vlan_list, dhclient_if, flags_if, output) 708 722 interface_list_cache[datadump['autogen_item']] = store 709 723 return(store) … … 887 901 """) 888 902 889 (addrs_list, vlan_list, dhclient_if, extra_ouput) = make_interface_list(datadump)903 (addrs_list, vlan_list, dhclient_if, flags_if, extra_ouput) = make_interface_list(datadump) 890 904 for iface, vlans in vlan_list.items(): 891 905 output += 'vlans_%s="%s"\n' % (iface, ' '.join(vlans)) … … 927 941 output += "ifconfig_bridge0='%s up'\n" % addrs[0][0] 928 942 else: 929 output += "ifconfig_%s='inet %s'\n" % (iface, addrs[0][0]) 943 if flags_if[iface].has_key('ether'): 944 output += "ifconfig_%s='ether %s inet %s'\n" % (iface, flags_if[iface]['ether'], addrs[0][0]) 945 else: 946 output += "ifconfig_%s='inet %s'\n" % (iface, addrs[0][0]) 930 947 for idx, addr in enumerate(addrs[1:]): 931 948 output += "ifconfig_%s_alias%s='inet %s'\n" % (iface, idx, addr[0]) … … 988 1005 989 1006 def get_neighbours(datadump): 990 (addrs_list, _, dhclient_if, extra_ouput) = make_interface_list(datadump)1007 (addrs_list, _, dhclient_if, _, extra_ouput) = make_interface_list(datadump) 991 1008 992 1009 (poel, errors) = make_relations() … … 1153 1170 return lines 1154 1171 1155 (addrs_list, vlan_list, dhclient_if, extra_ouput) = make_interface_list(datadump)1172 (addrs_list, vlan_list, dhclient_if, flags_if, extra_ouput) = make_interface_list(datadump) 1156 1173 table = [] 1157 1174 for iface,addrs in sorted(addrs_list.iteritems()):
Note:
See TracChangeset
for help on using the changeset viewer.