+# pseudo authentication for bonfire
+def bonfire_authenticate():
+ h = {}
+ h["user"] = "nlebreto"
+ h["user_pass"] = "GDRU_23tc$"
+ h["location"] = "https://api.integration.bonfire.grid5000.fr"
+ return h
+
+# create a slice and attach a specific user to it
+def create_slice_attach_user(user_slice):
+ call = "sfa.py add -x {0}_slice -t slice -r {0}@dummy.net".format(user_slice)
+ callcreateslice = subprocess.Popen(call, shell=True)
+
+# remove slice or key
+def remove_slice(name):
+ cmdremove = "sfaadmin.py reg remove {0}".format(name)
+ removeaction = subprocess.Popen(cmdremove, shell=True)
+
+# show specific credential of a slice
+def show_slice_credential(slice_name):
+ path = "/root/.sfi/{0}.slice.cred".format(slice_name)
+ tree = ET.parse(path)
+ root = tree.getroot()
+ hash = {}
+ hash["slice_native"] = root.findall(".//signatures//{http://www.w3.org/2000/09/xmldsig#}Signature//{http://www.w3.org/2000/09/xmldsig#}KeyInfo//{http://www.w3.org/2000/09/xmldsig#}X509Data//{http://www.w3.org/2000/09/xmldsig#}X509SubjectName")[0].text
+ for target in root.findall('credential'):
+ hash["slice_user_urn"] = target.find('owner_urn').text
+ hash["slice_urn"] = target.find('target_urn').text
+ hash["serial"] = target.find('serial').text
+ return hash
+
+# create a bonfire experiment from a sfa point of view
+def allocate(user_name, groups, description, walltime, slice_name):
+ hash ={}
+ hash = show_slice_credential(slice_name)
+ create_fed4fire_exp(user_name, groups, description, walltime, hash["slice_urn"], hash["slice_user_urn"], hash["slice_native"])
+
+