X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fdummy%2Fdummy_testbed_api_client.py;h=2c3d363f57639685213c53938e5b92f1491d43de;hb=47090c0a12d8ccffa6d67692461da61a7b7f67e7;hp=e32c15b94ac4814c0cb0cb8fd86114b17def6b76;hpb=1cc8e9613cab8b5b22478de369f259e591c54e6d;p=sfa.git diff --git a/sfa/dummy/dummy_testbed_api_client.py b/sfa/dummy/dummy_testbed_api_client.py index e32c15b9..2c3d363f 100644 --- a/sfa/dummy/dummy_testbed_api_client.py +++ b/sfa/dummy/dummy_testbed_api_client.py @@ -1,15 +1,19 @@ -import xmlrpclib +from __future__ import print_function + from datetime import datetime import time +from sfa.util.py23 import xmlrpc_client dummy_url = "http://localhost:8080" -dummy_api = xmlrpclib.ServerProxy(dummy_url) +dummy_api = xmlrpc_client.ServerProxy(dummy_url) -# Edit the parameters with your user info: -my_user_id = dummy_api.AddUser({'email': 'john.doe@test.net', 'user_name': 'john.doe', 'keys': ['copy here your ssh-rsa public key']}) -# Your user will be attached with the slice named : slice2 : +# Add a user: +my_user_id = dummy_api.AddUser({'email': 'john.doe@test.net', 'user_name': 'john.doe', 'keys': [ + 'copy here your ssh-rsa public key']}) +# Attach the user with the slice named : slice2 : dummy_api.AddUserToSlice({'slice_id': 2, 'user_id': my_user_id}) - -print dummy_api.GetUsers()[-1] -print dummy_api.GetSlices()[-1] +# Display the list of users +print(dummy_api.GetUsers()) +# Display the list of slices +print(dummy_api.GetSlices())