Changeset 10379 in genesis for tools/make_network_kml.py
- Timestamp:
- Apr 7, 2012, 1:09:20 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/make_network_kml.py
r10378 r10379 23 23 <kml xmlns="http://www.opengis.net/kml/2.2"> 24 24 <Document> 25 <Style id="linkDown"> 26 <LineStyle> 27 <color>990000ff</color> 28 <width>2</width> 29 </LineStyle> 30 </Style> 31 <Style id="linkUp"> 32 <LineStyle> 33 <color>9900ff00</color> 34 <width>3</width> 35 </LineStyle> 36 </Style> 37 <Style id="linkPlanned"> 38 <LineStyle> 39 <color>99ff0000</color> 40 <width>1</width> 41 </LineStyle> 42 </Style> 43 25 44 ''' 26 45 … … 37 56 LINE = ''' 38 57 <Placemark> 58 <styleUrl>#%(styleId)s</styleUrl> 39 59 <LineString> 40 60 <coordinates> … … 50 70 </kml> 51 71 ''' 72 52 73 def make_graph(debug=False): 53 74 poel = {} 54 75 link_type = {} 55 76 link_data = {} 77 link_status = {} 56 78 hosts = {} 57 79 … … 63 85 hosts[nodename] = datadump 64 86 65 iface_keys = [elem for elem in datadump.keys() if (elem.startswith('iface_') and not "lo0" in elem)] 66 for iface_key in iface_keys: 87 for iface_key in datadump['autogen_iface_keys']: 67 88 l = datadump[iface_key]['ip'] 68 89 addr, mask = l.split('/') … … 77 98 if poel.has_key(addr): 78 99 poel[addr] += [nodename] 100 if link_status[addr] == 'linkUp': 101 if datadump['status'] == 'planned': 102 link_status[addr] = 'linkPlanned' 103 elif datadump[iface_key]['status'] == 'planned': 104 link_status[addr] = 'linkPlanned' 105 elif datadump[iface_key]['status'] == 'down': 106 link_status[addr] = 'linkDown' 79 107 else: 80 108 poel[addr] = [nodename] … … 84 112 else: 85 113 link_type[addr] = datadump[iface_key]['type'] 114 115 if datadump['status'] == 'planned': 116 link_status[addr] = 'linkPlanned' 117 elif datadump[iface_key]['status'] == 'planned': 118 link_status[addr] = 'linkPlanned' 119 elif datadump[iface_key]['status'] == 'down': 120 link_status[addr] = 'linkDown' 121 else: 122 link_status[addr] = 'linkUp' 86 123 87 124 link_data[addr] = 1 … … 125 162 for buur in leden[index + 1:]: 126 163 keys = {} 164 keys['styleId'] = link_status[addr] 127 165 for key, value in hosts[buur].iteritems(): 128 166 keys[key + 'A'] = value
Note:
See TracChangeset
for help on using the changeset viewer.