Changeset 9958 in genesis for tools


Ignore:
Timestamp:
Feb 14, 2012, 10:57:30 AM (13 years ago)
Author:
rick
Message:

Make sure master is lower and slave is high.

Fix typo causing master ip to be re-used twice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r9957 r9958  
    621621
    622622  #  WL uses an /29 to configure an interface. IP's are ordered like this:
    623   #     MasterA (.1) -- DeviceA (.2) <<>> DeviceB (.5) --- SlaveB (.6)
     623  #     MasterA (.1) -- DeviceA (.2) <<>> DeviceB (.3) --- SlaveB (.4)
    624624   
    625625  sn = lambda x: re.sub(r'(?i)^cnode','',x)
     
    627627  # Automatic naming convention of interlinks namely 2 + remote.lower()
    628628  for (key,value) in pool.iteritems():
     629    # Make sure they are sorted from low-ip to high-ip
     630    value = sorted(value, key=lambda x: parseaddr(x[2]))
     631
    629632    if len(value) == 1:
    630633      (iface_name, fqdn, ip) = value[0]
     
    640643      (b_iface_name, b_fqdn, b_ip) = value[1]
    641644      wleiden_zone["2%s.%s" % (b_fqdn,a_fqdn)] = a_ip
    642       # Slave interface
    643645      wleiden_zone["2%s.%s" % (a_fqdn,b_fqdn)] = b_ip
    644646
     
    646648      if 'cnode' in a_fqdn.lower() and 'cnode' in b_fqdn.lower():
    647649        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)
     650        wleiden_zone["d-at-%s.%s" % (b_iface_name, b_fqdn)] = showaddr(parseaddr(b_ip) - 1)
    649651        wleiden_cname["d-at-%s.%s" % (a_iface_name,sn(a_fqdn))] = "d-at-%s.%s" % (a_iface_name, a_fqdn)
    650652        wleiden_cname["d-at-%s.%s" % (b_iface_name,sn(b_fqdn))] = "d-at-%s.%s" % (b_iface_name, b_fqdn)
Note: See TracChangeset for help on using the changeset viewer.