4da5c9da43ed463cbbea7b8017d5f6345bb937c4
[tests.git] / system / config_wifilab.py
1 # Thierry Parmentelat <thierry.parmentelat@inria.fr>
2 # Copyright (C) 2010 INRIA 
3 #
4 # a configuration module is expected:
5 # (*) to define a config method
6 # (*) that takes two arguments
7 #     (**) the current set of plc_specs as output by the preceding config modules
8 #     (**) TestMain options field
9 # (*) and that returns the new set of plc_specs
10
11 # archs & vrefs :
12 # current focus is to
13 ########## myplc
14 # (*) run a 32bits myplc
15 ########## multi-arch
16 # (*) run wlab02 as a plain 32bits node
17 # (*) try and run 64bits in wlab17 (i.e. bootcd & bootstrapfs)
18 #     which should be achieved by simply adding this node in the 'x86_64' nodegroup
19 # (*) investigate what it takes to have the slivers on wlab17 run 32bits as well
20 ########## multi-vref
21 # (*) define slice 'plain' without secific tuning, that should result in f8-based slivers
22 # (*) define slice 'centos' with its vref set to centos5
23 ########## manual stuff
24 # all this would require to
25 # (*) install bootcd            f8-x86_64
26 # (*) install bootstrapfs       f8-x86_64
27 # (*) install noderepo          f8-x86_64 
28 # (*) install noderepo          centos5-i386
29 # (*) install noderepo          centos5-x86_64
30 # (*) install vserver           centos5-i386
31 # (*) and add that to yumgroups.xml
32 ########## unclear stuff
33 # I'm pretty sure that yum.conf.php still needs hacking, at least for centos5
34 ########## unclear stuff
35
36 onelab="onelab.eu"
37
38 # these are real nodes, they dont get started by the framework
39 def nodes():
40     node02 = {'name':'wlab02',
41               'node_fields': {'hostname': 'wlab02.inria.fr', 'model':'Dell Latitude 830'},
42               'owner' : 'pi',
43               'nodegroups' : 'wifi',
44               'interface_fields': { 'method':'dhcp', 'type' : 'ipv4', 'ip':'138.96.250.162',},
45               'extra_interfaces' : [ { 'interface_fields' : { 'method' : 'dhcp',
46                                                             'type' : 'ipv4',
47                                                             'mac' : '00:1B:77:70:F4:C6',
48                                                             'ip' : '138.96.250.192', },
49                                        'settings' : { 'essid' : 'guest-inria-sophia',
50                                                       'ifname' : 'wlan0', },
51                                        },
52                                      ],
53               }
54     node17 = {'name':'wlab17',
55               'node_fields': {'hostname': 'wlab17.inria.fr', 'model':'Dell Latitude 830'},
56               'owner' : 'pi',
57               'nodegroups' : ['wifi','x86_64'] ,
58               'interface_fields': { 'method':'dhcp', 'type' : 'ipv4', 'ip':'138.96.250.177',},
59               'extra_interfaces' : [ { 'interface_fields' : { 'method' : 'dhcp',
60                                                             'type' : 'ipv4',
61                                                             'mac' : '00:1c:bf:51:3c:19',
62                                                             'ip' : '138.96.250.207',},
63                                        'settings' : { 'essid' : 'guest-inria-sophia',
64                                                       'ifname' : 'wlan0',},
65                                        },
66                                      ],
67               }
68     node05 = {'name':'wlab05',
69               'node_fields': {'hostname': 'wlab05.inria.fr', 'model':'Dell Latitude 830'},
70               'owner' : 'pi',
71               'nodegroups' : 'wifi',
72               'interface_fields': { 'method':'dhcp', 'type' : 'ipv4', 'ip':'138.96.250.165',},
73               'extra_interfaces' : [ { 'interface_fields' : { 'method' : 'static',
74                                                             'type' : 'ipv4',
75                                                             'mac' : '00:1B:77:70:FC:84',
76                                                             'ip' : '138.96.250.215',
77                                                             'network' : '138.96.0.0',
78                                                             'dns1': '138.96.0.10',
79                                                             'dns2': '138.96.0.11',
80                                                             'broadcast' : '138.96.255.255',
81                                                             'netmask' : '255.255.0.0',
82                                                             'gateway' : '138.96.248.250',},
83                                        'settings' : { 'essid' : 'guest-inria-sophia',
84                                                       'ifname' : 'wlan0',},
85                                        },
86                                      { 'interface_fields' : { 'method' : 'dhcp',
87                                                             'type' : 'ipv4',
88                                                             'mac' : '00:20:A6:4E:FF:E6',
89                                                             'ip' : '138.96.250.50',
90                                                             'hostname' : 'radio40.inria.fr', },
91                                        'settings' : { 'essid' : 'guest-inria-sophia',
92                                                       'ifname' : 'wifi0',},
93                                        },
94                                      ],
95               }
96
97
98     # wlab05 not avail. for now
99     return [ node02 , node17 ]
100
101 def all_nodenames ():
102     return [ node['name'] for node in nodes()]
103
104 def users (domain=onelab) :
105     return [ {'name' : 'pi', 'keynames' : [ 'key1' ],
106               'user_fields' : {'first_name':'PI', 'last_name':'PI',
107                                'enabled':'True',
108                                'email':'fake-pi1@%s'%domain,
109                                'password':'testpi'},
110               'roles':['pi']},
111              {'name' : 'tech', 'keynames' : [ 'key1' ],
112               'user_fields' : {'first_name':'Tech', 'last_name':'Tech',
113                                'enabled':'true',
114                                'email':'fake-tech1@%s'%domain,
115                                'password':'testtech'},
116               'roles':['tech']},
117              {'name':'user', 'keynames' : [ 'key1' ],
118               'user_fields' : {'first_name':'User', 'last_name':'User',
119                                'enabled':'true',
120                                'email':'fake-user1@%s'%domain,
121                                'password':'testuser'},
122               'roles':['user']},
123              {'name':'techuser', 'keynames' : [ 'key1' ],
124               'user_fields' : {'first_name':'UserTech', 'last_name':'UserTech',
125                                'enabled':'true',
126                                'email':'fake-tech2@%s'%domain,
127                                'password':'testusertech'},
128               'roles':['tech','user']},
129              {'name':'pitech', 'keynames' : [ 'key1' ],
130               'user_fields' : {'first_name':'PiTech',
131                                'last_name':'PiTech',
132                                'enabled':'true',
133                                'email':'fake-pi2@%s'%domain,
134                                'password':'testusertech'},
135               'roles':['pi','tech']},
136              ]
137
138 def all_usernames ():
139     return [ user['name'] for user in users()]
140
141 def sites ():
142     return [ {'site_fields' : {'name':'wifisite',
143                                'login_base':'wifi',
144                                'abbreviated_name':'wifi',
145                                'max_slices':100,
146                                'url':'http://test.onelab.eu',
147                                },
148               'address_fields' : {'line1':'route des lucioles',
149                                   'city':'sophia',
150                                   'state':'fr',
151                                   'postalcode':'06902',
152                                   'country':'france',
153                                   },
154               'users' : users(),
155               'nodes': nodes(),
156             }]
157
158 ##########
159 public_key="""ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4jNj8yT9ieEc6nSJz/ESu4fui9WrJ2y/MCfqIZ5WcdVKhBFUYyIenmUaeTduMcSqvoYRQ4QnFR1BFdLG8XR9D6FWZ5zTKUgpkew22EVNeqai4IXeWYKyt1Qf3ehaz9E3o1PG/bmQNIM6aQay6TD1Y4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 /LerGfFa5D9Jm+6U97gDdq3tH0j95Mo0F00LWq2+vp7U4DTQsiddepzNdbcvSrzT
175 NVZ2cnOAlKTHO4hGggShm04n/M5LOzkHtI5TLcIJjw4b5iiIw9EtAoGBAOhjLTds
176 Zz8UbXVTeGv8yBGhnjAeHQ5WISN6V5KenB4GIyaYCCcQUOUGqc5nCttlnPLv/GHp
177 4DOJ2/0KbwDEwk7HbAtXG2Tv1OkmfcOq9RH19V9lyqynA+zvI6taisCEaMvBlafd
178 k+RgXsR+NdLs96RakKt4BtgpuuADoSIryQ+LAoGBAKremNSzpq0Z4tiMjxc3Ssiz
179 scc7lnxTnmZQkkWq6C+3xmZpqdaYYByra3ahNlxblTK2IcgroozPLM8I/4KCNnwG
180 dmC3VB9eOZF8B3SsXOfLEj+i1GBa8WuJg6kAw4JmzFO70Qz9JfSMErk//c9Jh7IT
181 6YYqaIUN3nATIXrhcFTrAoGAVlC5BfUQZ+MEFaKpEiqwthd1RRJ/0h/9rhd/nNvT
182 lh+JZhs2OmUlXGGPhy2WUX2DcC1AfCOrC9Qego7YxcVsvizQW/vIWLDaDXSyXp6V
183 ilQKrmejDO2Tvmdzpguv4Rs83fdyGcdUMEENQas4kCwhd49aTlEnHRbQYdV2XSY0
184 vKECgYEAlhYzfSswIF2h5/hGDLETxgNJ2kD0HIZYh7aud6X6aEYNdJopbfbEhifU
185 vTbf8GtvERDoxWEsk9Qp7km8xXfKWdcZtqIwsSmn/ri5d7iyvpIk591YIHSY0dr2
186 BO+VyPNWF+kDNI8mSUwi7jLW6liMdhNOmDaSX0+0X8CHtK898xM=
187 -----END RSA PRIVATE KEY-----
188 """
189
190 def keys ():
191     return [ {'name': 'key1',
192               'private' : private_key,
193               'key_fields' : {'key_type':'ssh',
194                               'key': public_key}}
195              ]
196
197 def initscripts(): 
198     return [ { 'initscript_fields' : { 'enabled' : True,
199                                        'name':'script_plain',
200                                        'script' : '#! /bin/sh\n (echo Starting test initscript: Stage 1; date) > /tmp/initscript_plain.log \n ',
201                                        }},
202              { 'initscript_fields' : { 'enabled' : True,
203                                        'name':'script_centos',
204                                        'script' : '#! /bin/sh\n (echo Starting test initscript: Stage 2; date) > /tmp/initscript_centos.log \n ',
205                                        }},
206              ]
207
208 def slices ():
209     plain= { 'slice_fields': {'name':'wifi_plain',
210                                 'instantiation':'plc-instantiated',
211                                 'url':'http://foo@foo.com',
212                                 'description':'plain slice',
213                                 'max_nodes':10,
214                                 },
215                'usernames' : [ 'pi','tech','techuser' ],
216                'nodenames' : all_nodenames(),
217                'initscriptname' : 'script_plain',
218                'sitename' : 'wifi',
219                'owner' : 'pi',
220                }
221     centos= { 'slice_fields': {'name':'wifi_centos',
222                                 'instantiation':'plc-instantiated',
223                                 'url':'http://foo@foo.com',
224                                 'description':'centos slice',
225                                 'max_nodes':10,
226                                 },
227                'usernames' : [ 'pi','tech','techuser' ],
228                'nodenames' : all_nodenames(),
229                'initscriptname' : 'script_centos',
230                'sitename' : 'wifi',
231                'owner' : 'pi',
232               'vref' : 'centos5',
233                }
234              ]
235
236 def plc () :
237     return { 
238         'index' : index,
239         'name' : 'wifilab',
240         # as of yet, not sure we can handle foreign hosts, but this is required though
241         'hostname' : 'wlab24.inria.fr',
242         # set these two items to run within a vserver
243         # 'vservername': 'somename'
244         # 'vserverip': '138.96.250.131'
245         'role' : 'root',
246         'settings': {
247             'PLC_ROOT_USER' : 'root@wlab24.inria.fr',
248             'PLC_ROOT_PASSWORD' : 'test++',
249             'PLC_NAME' : 'WifiLab',
250             'PLC_MAIL_ENABLED':'true',
251             'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr',
252             'PLC_DB_HOST' : 'wlab24.inria.fr',
253             'PLC_API_HOST' : 'wlab24.inria.fr',
254             'PLC_WWW_HOST' : 'wlab24.inria.fr',
255             'PLC_BOOT_HOST' : 'wlab24.inria.fr',
256             'PLC_NET_DNS1' : '138.96.0.10',
257             'PLC_NET_DNS2' : '138.96.0.11',
258             'PLC_DNS_ENABLED' : 'false',
259         },
260         'sites' : sites(),
261         'keys' : keys(),
262         'initscripts': initscripts(),
263         'slices' : slices(),
264     }
265
266 def config (plc_specs,options):
267     print "config_wifilab is obsolete .."
268     import sys
269     sys.exit(1)
270     return plc_specs + [ plc() ]