Changeset 6548
- Timestamp:
- Jan 4, 2009, 10:56:22 AM (16 years ago)
- Location:
- trunk/exodus
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exodus/forms.py
r6534 r6548 20 20 name = self.cleaned_data.get('name') 21 21 re_name = re.compile('[0-9a-zA-Z-]+') 22 if not re_name.match(name) or re_name.match(name) != name: 22 if not re_name.match(name) or re_name.match(name).group() != name: 23 print name 23 24 raise forms.ValidationError( 24 'Not a valid name. Use letters, digits and -.')25 'Not a Node valid name. Use letters, digits and -.') 25 26 return name 26 27 -
trunk/exodus/scripts/genesis_to_exodus.py
r6516 r6548 6 6 from exodus.models import Node, Location, Interface, Antenna 7 7 import ConfigParser 8 import sqlite3 8 9 from sys import argv 9 10 … … 21 22 for i in loc.errors.keys(): 22 23 print loc.errors[i][0] 24 print loc 25 import pdb; pdb.set_trace() ; 23 26 return None 24 27 locmodel = loc.save() … … 41 44 for i in form.errors.keys(): 42 45 print form.errors[i][0] 46 import pdb; pdb.set_trace() ; 43 47 return None 44 48 return nodemodel.id … … 61 65 for i in form.errors.keys(): 62 66 print form.errors[i][0] 67 import pdb; pdb.set_trace() ; 63 68 return None 64 69 return intfmodel.id … … 83 88 dataform ={'name' : 'Foo8', 'location' : '1', 'status' : 'up', 84 89 'network' : '1', 'masterip' : '127.0.0.1' } 85 networks = { } 90 networks = {} 91 ethernet = [] 92 conn = sqlite3.connect(':memory:') 93 cursor = conn.cursor() 94 cursor.execute('CREATE TABLE ifaceip (id INTEGER PRIMARY KEY, iface VARCHAR(20), ip VARCHAR(20))') 86 95 config = ConfigParser.SafeConfigParser(dataform) 87 96 # last cmdline argument is supposed to be the config file to use … … 183 192 pass 184 193 194 #ethernet stuff 195 for intf in interfaces.split(','): 196 cfgsection = node['name']+'/'+intf 197 # build a list of all ethernet interfaces 198 if config.has_section(cfgsection) and \ 199 config.get(cfgsection, 'type') == 'eth' and \ 200 config.has_option(cfgsection, 'ip'): 201 ethernet.append(cfgsection) 202 cursor.execute('insert INTO ifaceip VALUES ' 203 '(null, ?, ?)', ( cfgsection, 204 config.get(cfgsection, 'ip').rsplit('/')[0])) 205 206 conn.commit() 207 208 import pdb; pdb.set_trace() ; 209 non_alias = (i for i in ethernet if not ":" in i) 210 for i in non_alias: 211 for j in [ k for k in ethernet if k.startswith(i)]: 212 if config.has_section(j) and \ 213 config.has_option(j, 'point_to_point'): 214 p2p = config.get(j, 'point_to_point') 215 cursor.execute('SELECT iface FROM ifaceip where ip = ?', (p2p,)) 216 print cursor.fetchone() 217 218 185 219 186 220 # now we have already created all nodes and master interfaces...
Note:
See TracChangeset
for help on using the changeset viewer.