+
+def create_fed4fire_exp(name, groups, description, walltime, slice_id, exp_owner):
+ # create experiement with tag fed4fire
+ xmldescription='<experiment xmlns="http://api.bonfire-project.eu/doc/schemas/occi"><name>' + name + '</name><groups>' + groups + '</groups><description>' + description + '</description><walltime>' + walltime + '</walltime><status>ready</status><fed4fire><slice_id>' + slice_id + '</slice_id><exp_owner>' + exp_owner + '<exp_owner></fed4fire></experiment>'
+ postexp("https://api.integration.bonfire.grid5000.fr/experiments", xmldescription)
+
+def postexp(url, xmldescription):
+ headers = {'content-type': 'application/vnd.bonfire+xml'}
+ r = requests.post(url, data=xmldescription, headers=headers, verify=False, auth=('nlebreto', 'GDRU_23tc$'))
+
+def stop_vm(testbed, num_compute):
+ # compute bonfire to stopped state
+ url = "https://api.integration.bonfire.grid5000.fr/" + "locations/" + testbed + "/computes/" + num_compute
+ xmldescription = '<compute xmlns="http://api.bonfire-project.eu/doc/schemas/occi"><state>stopped</state></compute>'
+ headers = {'content-type': 'application/vnd.bonfire+xml'}
+ requests.put(url, data=xmldescription, headers=headers, verify=False, auth=('nlebreto', 'GDRU_23tc$'))
+
+def provisioning(num_experiment):
+ # experiment bonfire to running status
+ url = "https://api.integration.bonfire.grid5000.fr/experiments/" + num_experiment
+ xmldescription = '<experiment xmlns="http://api.bonfire-project.eu/doc/schemas/occi"><status>running</status></experiment>'
+ headers = {'content-type': 'application/vnd.bonfire+xml'}
+ requests.put(url, data=xmldescription, headers=headers, verify=False, auth=('nlebreto', 'GDRU_23tc$'))
+