Changeset 14230 in genesis


Ignore:
Timestamp:
Nov 21, 2018, 9:11:45 AM (4 years ago)
Author:
rick
Message:

Add gformat feature to disable broken interfaces

Both Meelfabriek2 and PanTerra1 have flapping interfaces

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nodes/Meelfabriek2/wleiden.yaml

    r13951 r14230  
    5151  ns_mac     : "24:a4:3c:0a:42:5c"
    5252  bridge_type: "NanostationM5"
    53   status     : "up"
     53  status     : "broken"
    5454
    5555
     
    6060  type       : "eth"
    6161  dhcp       : False
    62   status     : "up"
     62  status     : "broken"
    6363
    6464
  • nodes/PanTerra1/wleiden.yaml

    r13844 r14230  
    4848  ns_mac     : "dc:9f:db:36:1d:af"
    4949  bridge_type: "NanoStationM2"
    50   status     : "up"
     50  status     : "broken"
    5151
    5252
  • tools/gformat.py

    r14206 r14230  
    716716    if ifacedump.has_key('ether'):
    717717        flags_if[ifname]['ether'] = ifacedump['ether']
     718
     719    # Handle special interface states
     720    flags_if[ifname]['status'] = ifacedump['status']
    718721
    719722    # Add interface IP to list
     
    9981001      output += "# %s || %s || %s\n" % (iface, addr, comment)
    9991002
     1003    prefix = ''
     1004    if flags_if[iface]['status'] == 'broken':
     1005        output += "# Interface %s disabled since status=broken\n" % iface
     1006        prefix = '#'
     1007
    10001008    # Write DHCLIENT entry
    10011009    if iface in dhclient_if and dhclient_if[iface]:
    1002       output += "ifconfig_%s='SYNCDHCP'\n\n" % (iface)
     1010      output += prefix + "ifconfig_%s='SYNCDHCP'\n\n" % (iface)
    10031011      continue
    10041012   
     
    10111019      )
    10121020
     1021
    10131022    idx_offset = 0
    10141023    # Set MAC is required
    10151024    if flags_if[iface].has_key('ether'):
    1016       output += "ifconfig_%s='link %s'\n" % (iface, flags_if[iface]['ether'])
    1017       output += "ifconfig_%s_alias0='inet %s'\n" % (iface, addrs[0][0])
     1025      output += prefix + "ifconfig_%s='link %s'\n" % (iface, flags_if[iface]['ether'])
     1026      output += prefix + "ifconfig_%s_alias0='inet %s'\n" % (iface, addrs[0][0])
    10181027      idx_offset += 1
    10191028    elif iface in bridge_list: 
    1020       output += "ifconfig_%s_alias0='inet %s'\n" % (iface, addrs[0][0])
     1029      output += prefix + "ifconfig_%s_alias0='inet %s'\n" % (iface, addrs[0][0])
    10211030      idx_offset += 1
    10221031    else:   
    1023       output += "ifconfig_%s='inet %s'\n" % (iface, addrs[0][0])
     1032      output += prefix + "ifconfig_%s='inet %s'\n" % (iface, addrs[0][0])
    10241033       
    10251034    for idx, addr in enumerate(addrs[1:]):
    1026       output += "ifconfig_%s_alias%s='inet %s'\n" % (iface, idx + idx_offset, addr[0])
     1035      output += prefix + "ifconfig_%s_alias%s='inet %s'\n" % (iface, idx + idx_offset, addr[0])
    10271036
    10281037    output += "\n"
Note: See TracChangeset for help on using the changeset viewer.