Changeset 6486
- Timestamp:
- Dec 28, 2008, 12:34:42 AM (16 years ago)
- Location:
- trunk/exodus/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exodus/scripts/README
r6485 r6486 3 3 $ svn co http://svn.wirelessleiden.nl/svn/node-config/genesis $SVNROOT 4 4 $ cd $SVNROOT/nodes 5 # make sure that unused nodes aren't in the py.conf file 5 6 $ for file in */wleiden.conf; do ./genesis-to-py.pl $file; done > py.conf 6 7 $ cd -
trunk/exodus/scripts/genesis_to_exodus.py
r6485 r6486 14 14 # XXX - should we update an existing location with new lat/lon data ? 15 15 else: 16 location = LocationForm({ 'description': location['descr'], 16 # XXX: you were overwriting location, which meant that the dict 17 # location was overwritten. 18 loc = LocationForm({ 'description': location['descr'], 17 19 'latitude': location['lat'], 'longitude': location['lon'] }) 18 locmodel = location.save() 19 print 'Location ' + location['descr'] + 'created' 20 if not location.is_valid(): 20 if not loc.is_valid(): 21 21 print location._errors 22 22 return None 23 locmodel = loc.save() 24 print 'Location ' + location['descr'] + 'created' 23 25 return locmodel.id 24 26 … … 26 28 nodesearch = Node.objects.filter(name__exact=node['name']) 27 29 if len(nodesearch): 30 # XXX: Add check that len == 1, else multiple nodes with the same 31 # name could exist and the wrong one might be returned 28 32 print 'Node '+node['name']+' already exists' 29 33 nodemodel = nodesearch[0] … … 75 79 dataform ={'name' : 'Foo8', 'location' : '1', 'status' : 'up', 76 80 'network' : '1', 'masterip' : '127.0.0.1' } 77 import pdb; pdb.set_trace() ;78 81 networks = { } 79 82 config = ConfigParser.SafeConfigParser(dataform) … … 84 87 for s in sections: 85 88 # get only main node blocks (interface-specific blocks 86 # will be accessed later)87 if s.find('/') == -1:89 # will be accessed later) 90 if not '/' in s : 88 91 node = { } 89 92 for key in dataform: … … 92 95 location = { } 93 96 location['descr'] = config.get(s, 'location') 94 if location ['descr']:97 if location.has_key('descr'): 95 98 location['lat'] = config.get(s, 'latitude') 96 99 location['lon'] = config.get(s, 'longitude') … … 105 108 interfaces = config.get(s, 'interfaces') 106 109 for intf in interfaces.split(','): 107 if intf.find(':') == -1: #alias interface110 if not ':' in intf: # discard alias interface 108 111 cfgsection = node['name']+'/'+intf 109 112 # check for an interface-specific block 110 113 if config.has_section(cfgsection): 111 114 # interface defaults 112 interface = { 'iface': intf, 'netmask': 24,113 'ip': '127.0.0.1', 'mode': 'ms', 114 'polar': '', 'type': 'eth', 115 interface = { 'iface': intf, 'netmask': 32, 116 'ip': '127.0.0.1', 'mode': 'ms', 117 'polar': '', 'type': 'eth', 115 118 'accesspoint': False } 116 119 120 #XXX: this section can be discarded because 121 # there is no need to import ips. 117 122 if config.has_option(cfgsection, 'ip'): 118 123 ip = config.get(cfgsection, 'ip') … … 122 127 else: 123 128 interface['ip'] = ip 129 124 130 for key in [ 'type', 'desc', 'ssid', 'channel', 125 131 'mode', 'polar' ]: … … 128 134 key) 129 135 interface['node'] = nodeid 136 137 # XXX: The genesis data is complete, the type of 138 # antenna needs to be passed on. 139 # it's probably better 130 140 131 141 # handle Antenna … … 143 153 networks[ssid] = { 'links': [] } 144 154 if interface['mode'] == 'ms': 155 #XXX: if dhcp != 'no' accesspoint = 1 145 156 interface['accesspoint'] = 1 146 157 networks[ssid]['master'] = import_interface(interface) … … 150 161 # XXX - should we handle links on not-wifi 151 162 # interfaces? 152 # ROLAND: yes we should163 # XXX: yes we should 153 164 import_interface(interface) 154 165 … … 161 172 # links later (once we have already configured all master interfaces) instead of 162 173 # trying to update interfaces progressively 174 175 # XXX:this needn't be done, because exodus defines the ssid. 163 176 for ssid in networks: 164 177 for interface in networks[ssid]['links']:
Note:
See TracChangeset
for help on using the changeset viewer.