+# authentification against bonfire's ldap using a virtual machine
+#def bonldap(mail):
+# ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, '/Fed4FIRE-SFA-Backend/puppet/modules/ca/ca.crt')
+ # using a certificate (client)
+# ldap.set_option(ldap.OPT_PROTOCOL_VERSION, 3)
+# ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
+# ld = ldap.initialize('ldaps://127.0.0.1:2636')
+ # connection with ldaps
+# basedn = "ou=People,dc=bonfire-project,dc=eu"
+# filter_test = "mail=" + mail
+# filter = filter_test
+ # search email in the ldap
+# results = ld.search_s(basedn, ldap.SCOPE_SUBTREE, filter)
+# if not results:
+# print ("error 401, you need to be register to the portal f4f")
+# return results
+
+# 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)