- Timestamp:
- Feb 14, 2012, 10:22:05 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r9938 r9957 3 3 # vim:ts=2:et:sw=2:ai 4 4 # Wireless Leiden configuration generator, based on yaml files' 5 # 6 # XXX: This should be rewritten to make use of the ipaddr.py library. 7 # 5 8 # Rick van der Zwet <info@rickvanderzwet.nl> 9 # 6 10 7 11 # Hack to make the script directory is also threated as a module search path. … … 616 620 617 621 622 # WL uses an /29 to configure an interface. IP's are ordered like this: 623 # MasterA (.1) -- DeviceA (.2) <<>> DeviceB (.5) --- SlaveB (.6) 624 625 sn = lambda x: re.sub(r'(?i)^cnode','',x) 626 618 627 # Automatic naming convention of interlinks namely 2 + remote.lower() 619 628 for (key,value) in pool.iteritems(): … … 621 630 (iface_name, fqdn, ip) = value[0] 622 631 wleiden_zone["2unused-%s.%s" % (iface_name, fqdn)] = ip 632 633 # Device DNS names 634 if 'cnode' in fqdn.lower(): 635 wleiden_zone["d-at-%s.%s" % (iface_name, fqdn)] = showaddr(parseaddr(ip) + 1) 636 wleiden_cname["d-at-%s.%s" % (iface_name,sn(fqdn))] = "d-at-%s.%s" % (iface_name, fqdn) 637 623 638 elif len(value) == 2: 624 639 (a_iface_name, a_fqdn, a_ip) = value[0] 625 640 (b_iface_name, b_fqdn, b_ip) = value[1] 626 641 wleiden_zone["2%s.%s" % (b_fqdn,a_fqdn)] = a_ip 642 # Slave interface 627 643 wleiden_zone["2%s.%s" % (a_fqdn,b_fqdn)] = b_ip 644 645 # Device DNS names 646 if 'cnode' in a_fqdn.lower() and 'cnode' in b_fqdn.lower(): 647 wleiden_zone["d-at-%s.%s" % (a_iface_name, a_fqdn)] = showaddr(parseaddr(a_ip) + 1) 648 wleiden_zone["d-at-%s.%s" % (b_iface_name, b_fqdn)] = showaddr(parseaddr(a_ip) - 1) 649 wleiden_cname["d-at-%s.%s" % (a_iface_name,sn(a_fqdn))] = "d-at-%s.%s" % (a_iface_name, a_fqdn) 650 wleiden_cname["d-at-%s.%s" % (b_iface_name,sn(b_fqdn))] = "d-at-%s.%s" % (b_iface_name, b_fqdn) 651 wleiden_cname["d2%s.%s" % (sn(b_fqdn),sn(a_fqdn))] = "d-at-%s.%s" % (a_iface_name, a_fqdn) 652 wleiden_cname["d2%s.%s" % (sn(a_fqdn),sn(b_fqdn))] = "d-at-%s.%s" % (b_iface_name, b_fqdn) 653 628 654 else: 629 655 pool_members = [k[1] for k in value]
Note:
See TracChangeset
for help on using the changeset viewer.