X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=forge%2Fscript%2FPlcApi%2FtestRequest.py;fp=forge%2Fscript%2FPlcApi%2FtestRequest.py;h=584450b1d7292057b3abe9b5c20abf13652ed620;hb=2c011fe6120aa3224ae597c22a9bc0e3afbda945;hp=0000000000000000000000000000000000000000;hpb=fcbf96d0fd7ee178e58385a5db6a6d3a73252924;p=myslice.git diff --git a/forge/script/PlcApi/testRequest.py b/forge/script/PlcApi/testRequest.py new file mode 100755 index 00000000..584450b1 --- /dev/null +++ b/forge/script/PlcApi/testRequest.py @@ -0,0 +1,20 @@ +#!/usr/bin/python +import xmlrpclib +import Auth + +plc_host='www.planet-lab.eu' +slice_pref='upmc_' + +slice_name=slice_pref+raw_input('Give me the name of the slice : ') + +api_url="https://%s:443/PLCAPI/"%plc_host +plc_api= xmlrpclib.ServerProxy(api_url, allow_none=True) + +# The slice's node ids +node_ids = plc_api.GetSlices(Auth.auth, slice_name,['node_ids'])[0]['node_ids'] + +# Get Hostname for these nodes +slice_nodes = plc_api.GetNodes(Auth.auth, node_ids, ['hostname', 'run_level']) + +for node in slice_nodes: + print node