isolate settings for plc-config-tty or sfa-config-tty in a separate 'settings' dict...
Thierry Parmentelat [Tue, 20 May 2014 09:07:40 +0000 (11:07 +0200)]
some were missing like PLC_HRN_ROOT and PLC_SHORTNAME

system/Substrate.py
system/TestMain.py
system/TestNode.py
system/TestPlc.py
system/config_default.py
system/config_wifilab.py

index 4b2ad58..0f849c2 100644 (file)
@@ -1072,12 +1072,14 @@ class Substrate:
                                    'name': plc_name,
                                    'vservername':vservername,
                                    'vserverip':vplc_ip,
+#                                   'settings': {
                                    'PLC_DB_HOST':vplc_hostname,
                                    'PLC_API_HOST':vplc_hostname,
                                    'PLC_BOOT_HOST':vplc_hostname,
                                    'PLC_WWW_HOST':vplc_hostname,
                                    'PLC_NET_DNS1' : self.network_settings() [ 'interface_fields:dns1' ],
                                    'PLC_NET_DNS2' : self.network_settings() [ 'interface_fields:dns2' ],
+#                                      }
                                    } ) ]
                   }
 
@@ -1166,11 +1168,11 @@ class Substrate:
 
     def localize_sfa_rspec (self,plc,options):
        
-        plc['sfa']['SFA_REGISTRY_HOST'] = plc['PLC_DB_HOST']
-        plc['sfa']['SFA_AGGREGATE_HOST'] = plc['PLC_DB_HOST']
-        plc['sfa']['SFA_SM_HOST'] = plc['PLC_DB_HOST']
-        plc['sfa']['SFA_DB_HOST'] = plc['PLC_DB_HOST']
-        plc['sfa']['SFA_PLC_URL'] = 'https://' + plc['PLC_API_HOST'] + ':443/PLCAPI/' 
+        plc['sfa']['settings']['SFA_REGISTRY_HOST'] = plc['settings']['PLC_DB_HOST']
+        plc['sfa']['settings']['SFA_AGGREGATE_HOST'] = plc['settings']['PLC_DB_HOST']
+        plc['sfa']['settings']['SFA_SM_HOST'] = plc['settings']['PLC_DB_HOST']
+        plc['sfa']['settings']['SFA_DB_HOST'] = plc['settings']['PLC_DB_HOST']
+        plc['sfa']['settings']['SFA_PLC_URL'] = 'https://%s:443/PLCAPI/' % plc['settings']['PLC_API_HOST']
        return plc
 
     #################### release:
index 92a87e0..0ec1fbb 100755 (executable)
@@ -341,7 +341,7 @@ steps refer to a method in TestPlc or to a step_* module
         ips_bplc_file.close()
         ips_vplc_file=open('arg-ips-vplc','w')
         for plc_spec in all_plc_specs:
-            ips_vplc_file.write("%s\n"%plc_spec['PLC_API_HOST'])
+            ips_vplc_file.write("%s\n"%plc_spec['settings']['PLC_API_HOST'])
         ips_vplc_file.close()
         # ditto for nodes
         ips_bnode_file=open('arg-ips-bnode','w')
index 35db0fd..dcab9dd 100644 (file)
@@ -326,7 +326,7 @@ class TestNode:
         return test_ssh.run ("rpm -q --quiet libvirt-client")==0
 
     def _check_system_slice (self, slicename,dry_run=False):
-        sitename=self.test_plc.plc_spec['PLC_SLICE_PREFIX']
+        sitename=self.test_plc.plc_spec['settings']['PLC_SLICE_PREFIX']
         vservername="%s_%s"%(sitename,slicename)
         test_ssh=self.create_test_ssh()
         if self.has_libvirt():
index 93b5981..d6aed7c 100644 (file)
@@ -313,9 +313,9 @@ class TestPlc:
         return self.yum_check_installed (rpms)
 
     def auth_root (self):
-       return {'Username':self.plc_spec['PLC_ROOT_USER'],
+       return {'Username':self.plc_spec['settings']['PLC_ROOT_USER'],
                'AuthMethod':'password',
-               'AuthString':self.plc_spec['PLC_ROOT_PASSWORD'],
+               'AuthString':self.plc_spec['settings']['PLC_ROOT_PASSWORD'],
                 'Role' : self.plc_spec['role']
                 }
     def locate_site (self,sitename):
@@ -590,7 +590,7 @@ class TestPlc:
         print '+ MyPLC',plc_spec['name']
         # WARNING this would not be right for lxc-based PLC's - should be harmless though
         print '+\tvserver address = root@%s:/vservers/%s'%(plc_spec['host_box'],plc_spec['vservername'])
-        print '+\tIP = %s/%s'%(plc_spec['PLC_API_HOST'],plc_spec['vserverip'])
+        print '+\tIP = %s/%s'%(plc_spec['settings']['PLC_API_HOST'],plc_spec['vserverip'])
         for site_spec in plc_spec['sites']:
             for node_spec in site_spec['nodes']:
                 TestPlc.display_mapping_node(node_spec)
@@ -703,26 +703,8 @@ class TestPlc:
         "run plc-config-tty"
         tmpname='%s.plc-config-tty'%(self.name())
         fileconf=open(tmpname,'w')
-        for var in [ 'PLC_NAME',
-                     'PLC_ROOT_USER',
-                     'PLC_ROOT_PASSWORD',
-                     'PLC_SLICE_PREFIX',
-                     'PLC_MAIL_ENABLED',
-                     'PLC_MAIL_SUPPORT_ADDRESS',
-                     'PLC_DB_HOST',
-#                     'PLC_DB_PASSWORD',
-                    # Above line was added for integrating SFA Testing
-                     'PLC_API_HOST',
-                     'PLC_WWW_HOST',
-                     'PLC_BOOT_HOST',
-                     'PLC_NET_DNS1',
-                     'PLC_NET_DNS2',
-                     'PLC_RESERVATION_GRANULARITY',
-                     'PLC_OMF_ENABLED',
-                     'PLC_OMF_XMPP_SERVER',
-                     'PLC_VSYS_DEFAULTS',
-                     ]:
-            fileconf.write ('e %s\n%s\n'%(var,self.plc_spec[var]))
+        for (var,value) in self.plc_spec['settings'].iteritems():
+            fileconf.write ('e %s\n%s\n'%(var,value))
         fileconf.write('w\n')
         fileconf.write('q\n')
         fileconf.close()
@@ -827,7 +809,7 @@ class TestPlc:
         sites = self.apiserver.GetSites(self.auth_root(), {}, ['site_id','login_base'])
         for site in sites:
             # keep automatic site - otherwise we shoot in our own foot, root_auth is not valid anymore
-            if site['login_base']==self.plc_spec['PLC_SLICE_PREFIX']: continue
+            if site['login_base']==self.plc_spec['settings']['PLC_SLICE_PREFIX']: continue
             site_id=site['site_id']
             print 'Deleting site_id',site_id
             self.apiserver.DeleteSite(self.auth_root(),site_id)
@@ -1508,30 +1490,13 @@ class TestPlc:
         "run sfa-config-tty"
         tmpname=self.conffile("sfa-config-tty")
         fileconf=open(tmpname,'w')
-        for var in [ 'SFA_REGISTRY_ROOT_AUTH',
-                     'SFA_INTERFACE_HRN',
-                     'SFA_REGISTRY_LEVEL1_AUTH',
-                    'SFA_REGISTRY_HOST',
-                    'SFA_AGGREGATE_HOST',
-                     'SFA_SM_HOST',
-                    'SFA_PLC_URL',
-                     'SFA_PLC_USER',
-                     'SFA_PLC_PASSWORD',
-                     'SFA_DB_HOST',
-                     'SFA_DB_USER',
-                     'SFA_DB_PASSWORD',
-                     'SFA_DB_NAME',
-                     'SFA_API_LOGLEVEL',
-                     'SFA_GENERIC_FLAVOUR',
-                     'SFA_AGGREGATE_ENABLED',
-                     ]:
-            if self.plc_spec['sfa'].has_key(var):
-                fileconf.write ('e %s\n%s\n'%(var,self.plc_spec['sfa'][var]))
-        # the way plc_config handles booleans just sucks..
-        for var in []:
-            val='false'
-            if self.plc_spec['sfa'][var]: val='true'
-            fileconf.write ('e %s\n%s\n'%(var,val))
+        for (var,value) in self.plc_spec['sfa']['settings'].iteritems():
+            fileconf.write ('e %s\n%s\n'%(var,value))
+#        # the way plc_config handles booleans just sucks..
+#        for var in []:
+#            val='false'
+#            if self.plc_spec['sfa'][var]: val='true'
+#            fileconf.write ('e %s\n%s\n'%(var,val))
         fileconf.write('w\n')
         fileconf.write('R\n')
         fileconf.write('q\n')
index b0eabdb..508f880 100644 (file)
@@ -483,27 +483,30 @@ def plc (options,index) :
         'vservername': 'deferred-vservername',
         'vserverip': 'deferred-vserverip',
         'role' : 'root',
-        'PLC_NAME' : 'Regression TestLab',
-        'PLC_ROOT_USER' : 'root@test.onelab.eu',
-        'PLC_ROOT_PASSWORD' : 'test++',
-        'PLC_SLICE_PREFIX' : 'auto',
-        'PLC_HRN_ROOT': sfa_root(index),
-        'PLC_SHORTNAME' : 'Rlab',
-        'PLC_MAIL_ENABLED':'false',
-        'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr',
-        'PLC_DB_HOST' : 'deferred-myplc-hostname',
-#        'PLC_DB_PASSWORD' : 'mnbvcxzlkjhgfdsapoiuytrewq',
-        'PLC_API_HOST' : 'deferred-myplc-hostname',
-        'PLC_WWW_HOST' : 'deferred-myplc-hostname',
-        'PLC_BOOT_HOST' : 'deferred-myplc-hostname',
-        'PLC_NET_DNS1' : 'deferred-dns-1',
-        'PLC_NET_DNS2' : 'deferred-dns-2',
-        'PLC_RESERVATION_GRANULARITY':1800,
-        'PLC_VSYS_DEFAULTS':' , vif_up, vif_down, fd_tuntap, promisc, ',
+        # these go to plc-config-tty
+        'settings': {
+            'PLC_NAME' : 'Regression TestLab',
+            'PLC_ROOT_USER' : 'root@test.onelab.eu',
+            'PLC_ROOT_PASSWORD' : 'test++',
+            'PLC_SLICE_PREFIX' : 'auto',
+            'PLC_HRN_ROOT': sfa_root(index),
+            'PLC_SHORTNAME' : 'Rlab',
+            'PLC_MAIL_ENABLED':'false',
+            'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr',
+            'PLC_DB_HOST' : 'deferred-myplc-hostname',
+#            'PLC_DB_PASSWORD' : 'mnbvcxzlkjhgfdsapoiuytrewq',
+            'PLC_API_HOST' : 'deferred-myplc-hostname',
+            'PLC_WWW_HOST' : 'deferred-myplc-hostname',
+            'PLC_BOOT_HOST' : 'deferred-myplc-hostname',
+            'PLC_NET_DNS1' : 'deferred-dns-1',
+            'PLC_NET_DNS2' : 'deferred-dns-2',
+            'PLC_RESERVATION_GRANULARITY':1800,
+            'PLC_VSYS_DEFAULTS':' , vif_up, vif_down, fd_tuntap, promisc, ',
+            'PLC_OMF_ENABLED' : 'true',
+            'PLC_OMF_XMPP_SERVER': 'deferred-myplc-hostname',
+        },
         'expected_vsys_tags': [ 'vif_up', 'vif_down', 'fd_tuntap', 'promisc', ],
         # minimal config so the omf plugins actually trigger
-        'PLC_OMF_ENABLED' : 'true',
-        'PLC_OMF_XMPP_SERVER': 'deferred-myplc-hostname',
         'sites' : sites(options,index),
         'keys' : keys(options,index),
         'initscripts': initscripts(options,index),
@@ -523,19 +526,21 @@ def sfa (options,index) :
         # stack config_sfamesh to point to SMs instead
         'neighbours-port':12346,
         ## global sfa-config-tty stuff
-        'SFA_REGISTRY_ROOT_AUTH' : sfa_root(index),
-        'SFA_INTERFACE_HRN' : sfa_root(index),
-       'SFA_REGISTRY_HOST' : 'deferred-myplc-hostname',
-       'SFA_AGGREGATE_HOST': 'deferred-myplc-hostname',
-       'SFA_SM_HOST': 'deferred-myplc-hostname',
-       'SFA_PLC_URL' : 'deferred-myplc-api-url',
-        'SFA_PLC_USER' : 'root@test.onelab.eu',
-        'SFA_PLC_PASSWORD' : 'test++',
+        'settings': {
+            'SFA_REGISTRY_ROOT_AUTH' : sfa_root(index),
+            'SFA_INTERFACE_HRN' : sfa_root(index),
+            'SFA_REGISTRY_HOST' : 'deferred-myplc-hostname',
+            'SFA_AGGREGATE_HOST': 'deferred-myplc-hostname',
+            'SFA_SM_HOST': 'deferred-myplc-hostname',
+            'SFA_PLC_URL' : 'deferred-myplc-api-url',
+            'SFA_PLC_USER' : 'root@test.onelab.eu',
+            'SFA_PLC_PASSWORD' : 'test++',
 # use -c sfadebug to increment this one
-        'SFA_API_LOGLEVEL': 1,
+            'SFA_API_LOGLEVEL': 1,
 # use -c sfavoid to set this to 'void'
-        'SFA_GENERIC_FLAVOUR' : 'pl',
-        'SFA_AGGREGATE_ENABLED' : 'true',
+            'SFA_GENERIC_FLAVOUR' : 'pl',
+            'SFA_AGGREGATE_ENABLED' : 'true',
+        },
         # details of the slices to create
         'auth_sfa_specs' : [ test_auth_sfa_spec(options,index,rspec_style) 
                              for rspec_style in options.rspec_styles ]
index fff7cdf..4da5c9d 100644 (file)
@@ -243,18 +243,20 @@ def plc () :
         # 'vservername': 'somename'
         # 'vserverip': '138.96.250.131'
         'role' : 'root',
-        'PLC_ROOT_USER' : 'root@wlab24.inria.fr',
-        'PLC_ROOT_PASSWORD' : 'test++',
-        'PLC_NAME' : 'WifiLab',
-        'PLC_MAIL_ENABLED':'true',
-        'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr',
-        'PLC_DB_HOST' : 'wlab24.inria.fr',
-        'PLC_API_HOST' : 'wlab24.inria.fr',
-        'PLC_WWW_HOST' : 'wlab24.inria.fr',
-        'PLC_BOOT_HOST' : 'wlab24.inria.fr',
-        'PLC_NET_DNS1' : '138.96.0.10',
-        'PLC_NET_DNS2' : '138.96.0.11',
-        'PLC_DNS_ENABLED' : 'false',
+        'settings': {
+            'PLC_ROOT_USER' : 'root@wlab24.inria.fr',
+            'PLC_ROOT_PASSWORD' : 'test++',
+            'PLC_NAME' : 'WifiLab',
+            'PLC_MAIL_ENABLED':'true',
+            'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr',
+            'PLC_DB_HOST' : 'wlab24.inria.fr',
+            'PLC_API_HOST' : 'wlab24.inria.fr',
+            'PLC_WWW_HOST' : 'wlab24.inria.fr',
+            'PLC_BOOT_HOST' : 'wlab24.inria.fr',
+            'PLC_NET_DNS1' : '138.96.0.10',
+            'PLC_NET_DNS2' : '138.96.0.11',
+            'PLC_DNS_ENABLED' : 'false',
+        },
         'sites' : sites(),
         'keys' : keys(),
         'initscripts': initscripts(),