From: Thierry Parmentelat Date: Wed, 12 Dec 2007 16:15:44 +0000 (+0000) Subject: -Created new Slice. -Added new initscripts && associated the initscripts to the... X-Git-Tag: 2008-02-11-last-vmware-support~207 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=1fe0f9cab47275c854d95fd7d4f38feafddec19d;p=tests.git -Created new Slice. -Added new initscripts && associated the initscripts to the slices --- diff --git a/system/TestConfig.py b/system/TestConfig.py index 67357a2..d8e6edb 100644 --- a/system/TestConfig.py +++ b/system/TestConfig.py @@ -114,6 +114,15 @@ plc_specs = [ plc_spec1 ] key={'key_type':'ssh', 'key':'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4jNj8yT9ieEc6nSJz/ESu4fui9WrJ2y/MCfqIZ5WcdVKhBFUYyIenmUaeTduMcSqvoYRQ4QnFR1BFdLG8XR9D6FWZ5zTKUgpkew22EVNeqai4IXeWYKyt1Qf3ehaz9E3o1PG/bmQNIM6aQay6TD1Y4lqXI+eTVXVQev4K2fixySjFQpp9RB4UHbeA8c28yoa/cgAYHqCqlvm9uvpGMjgm/Qa4M+ZeO7NdjowfaF/wF4BQIzVFN9YRhvQ/d8WDz84B5Pr0J7pWpaX7EyC4bvdskxl6kmdNIwIRcIe4OcuIiX5Z9oO+7h/chsEVJWF4vqNIYlL9Zvyhnr0hLLhhuk2bw== root@onelab-test.inria.fr'} +initscripts =[{ 'enabled' : True, + 'name':'Test1', + 'script' : '#! /bin/sh\n echo Starting test initscript: Stage 1\n date > /tmp/test_initscript_stage1.log \n ', + }, + { 'enabled' : True, + 'name':'Test2', + 'script' : '#! /bin/sh\n echo Starting test initscript: Stage 2\n date > /tmp/test_initscript_stage2.log \n ', + } + ] slice1_spec={ 'slice_spec':{'name':'ts_slicetest1', @@ -124,8 +133,18 @@ slice1_spec={ }, 'slice_users' : [ site_users['pi_spec'], site_users['tech_spec'],site_users['tech_user_spec']], 'slice_nodes' : [ site1_nodes['node1'], site1_nodes['node2'] ], +'slice_initscript' : initscripts[0], } -slices_specs= [slice1_spec] - - +slice2_spec={ +'slice_spec':{'name':'ts_slicetest2', + 'instantiation':'plc-instantiated', + 'url':'http://foo2@ffo2.com', + 'description':'testslice the second slice for the site testsite', + 'max_nodes':100 + }, +'slice_users' : [ site_users['pi_spec'], site_users['tech_spec'],site_users['tech_user_spec']], +'slice_nodes' : [ site1_nodes['node1'], site1_nodes['node2'] ], +'slice_initscript' : initscripts[1], +} +slices_specs= [slice1_spec, slice2_spec ] diff --git a/system/TestMain.py b/system/TestMain.py index 4e38b47..3e111f1 100755 --- a/system/TestMain.py +++ b/system/TestMain.py @@ -86,7 +86,7 @@ myplc-url defaults to the last value used, as stored in URL""" test_plc.install_plc(url) test_plc.config_plc(plc_spec) ##create all the sites under the new plc,and then populate them with - ##nodes,persons and slices + ##nodes,persons and slices(with initscripts) for site_spec in plc_spec['sites']: utils.header('Creating site') pp.pprint(site_spec) @@ -96,6 +96,7 @@ myplc-url defaults to the last value used, as stored in URL""" pp.pprint(node_spec) test_nodes.append(node_spec) test_node = test_plc.init_node(test_site,node_spec,self.path) + test_node.add_initscripts() test_node.create_slice ("pi") utils.header('Starting vmware nodes') test_site.run_vmware(test_nodes,display) diff --git a/system/TestNode.py b/system/TestNode.py index 0e21196..e63b8bd 100644 --- a/system/TestNode.py +++ b/system/TestNode.py @@ -38,11 +38,21 @@ class TestNode: except Exception, e: print str(e) + def add_initscripts(self): + try: + for initscript in TestConfig.initscripts: + utils.header('Adding Initscripts') + pp = pprint.PrettyPrinter(indent=4) + pp.pprint(initscript) + self.initscript_id=self.test_plc.server.AddInitScript(self.test_plc.auth_root(), + initscript) + except Exception, e: + print str(e) + exit (1) + def create_slice(self, role): auth = self.test_site.anyuser_auth (role) liste_hosts=[] - #for l in liste_nodes_spec : - # liste_hosts.append(l['hostname']) try: for slicespec in TestConfig.slices_specs : utils.header('Creating Slice') @@ -58,6 +68,11 @@ class TestNode: self.test_plc.server.AddSliceToNodes(auth, slice_id, liste_hosts) + + self.test_plc.server.AddSliceAttribute(self.test_plc.auth_root(), + slice_id, 'initscript', + slicespec['slice_initscript']['name']) + except Exception, e: print str(e) sys.exit(1)