X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fclient%2Fbonfire.py;h=96ec1727958a7b34a3317b002bf7b67e1841935e;hb=f7eb70acf30258f7f3124f3426197e0256c5599e;hp=0b34ce5167a1620fffb58d9076b3ec5c024a68a6;hpb=6023d19b3496717464ba55f7239f5da013fb5be4;p=sfa.git
diff --git a/sfa/client/bonfire.py b/sfa/client/bonfire.py
index 0b34ce51..96ec1727 100644
--- a/sfa/client/bonfire.py
+++ b/sfa/client/bonfire.py
@@ -6,6 +6,30 @@ import xml.etree.ElementTree as ET
# helping functions
# ########################################################## #
+
+def create_fed4fire_exp(name, groups, description, walltime, slice_id, exp_owner):
+ # create experiement with tag fed4fire
+ xmldescription='' + name + '' + groups + '' + description + '' + walltime + 'ready' + slice_id + '' + exp_owner + ''
+ 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 = 'stopped'
+ 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 = 'running'
+ headers = {'content-type': 'application/vnd.bonfire+xml'}
+ requests.put(url, data=xmldescription, headers=headers, verify=False, auth=('nlebreto', 'GDRU_23tc$'))
+
def callcurl(url):
r = requests.get(url, verify=False, auth=('nlebreto', 'GDRU_23tc$'))
if r.status_code == 200:
@@ -52,10 +76,25 @@ def jfedfeat(bonfires, pageurl):
bonfires.append("")
def remove_needless_txt(txt):
+ txt=str(txt)
txt=txt.replace("\n","\n")
txt=txt.replace("\n","\n")
return txt
+def rsa_user_bonfire(testbed, num_compute):
+ url = "https://api.integration.bonfire.grid5000.fr/" + "locations/" + testbed + "/computes/" + num_compute
+ pagebonfirecompute = callcurl(url)
+ xmlreduit = ET.fromstring(pagebonfirecompute)
+ hash = {}
+ hash["url"] = url
+ for name in xmlreduit:
+ if name.tag == "{http://api.bonfire-project.eu/doc/schemas/occi}groups":
+ hash["name"] = name.text
+ for context in name:
+ if context.tag == "{http://api.bonfire-project.eu/doc/schemas/occi}authorized_keys":
+ hash["keys"] = context.text
+ return hash
+
# parameters
# ########################################################## #
locations = ["fr-inria", "be-ibbt", "uk-epcc"]
@@ -75,7 +114,7 @@ def bonsources():
bonfires.append(manag_exp)
bonfires.append("")
jfedfeat(bonfires, "http://frontend.bonfire.grid5000.fr/one-status.xml")
-# jfedfeat(bonfires, "http://bonfire.epcc.ed.ac.uk/logs/one-status.xml")
+ jfedfeat(bonfires, "http://bonfire.epcc.ed.ac.uk/one-status.xml")
jfedfeat(bonfires, "http://bonfire.psnc.pl/one-status.xml")
jfedfeat(bonfires, "http://nebulosus.rus.uni-stuttgart.de/one-status.xml")
bonfires.append("")