Commit 72e084e2 authored by Leigh B Stoller's avatar Leigh B Stoller

Use routines in test-common to get self and slice credentials.

parent 08cec6ef
...@@ -55,37 +55,13 @@ mycredential = get_self_credential() ...@@ -55,37 +55,13 @@ mycredential = get_self_credential()
print "Got my SA credential, looking up " + SLICENAME print "Got my SA credential, looking up " + SLICENAME
# #
# Lookup slice. # Lookup slice and get credential.
# #
params = {} myslice = resolve_slice( SLICEURN, mycredential )
params["credential"] = mycredential
params["type"] = "Slice" print "Asking for slice credential for " + SLICENAME
params["hrn"] = SLICENAME slicecredential = get_slice_credential( myslice, mycredential )
rval,response = do_method("sa", "Resolve", params) print "Got the slice credential"
if rval:
#
# Create a slice.
#
print "Creating new slice called " + SLICENAME
params = {}
params["credential"] = mycredential
params["type"] = "Slice"
params["hrn"] = SLICENAME
rval,response = do_method("sa", "Register", params)
if rval:
Fatal("Could not create new slice")
pass
myslice = response["value"]
print "New slice created"
pass
else:
#
# Get the slice credential.
#
print "Asking for slice credential for " + SLICENAME
myslice = get_slice_credential( response[ "value" ], mycredential )
print "Got the slice credential"
pass
# #
# Get a ticket. We do not have a real resource discovery tool yet, so # Get a ticket. We do not have a real resource discovery tool yet, so
...@@ -96,7 +72,7 @@ print "Asking for a ticket from the local CM" ...@@ -96,7 +72,7 @@ print "Asking for a ticket from the local CM"
params = {} params = {}
params["slice_urn"] = SLICEURN params["slice_urn"] = SLICEURN
params["credentials"] = (myslice,) params["credentials"] = (slicecredential,)
params["rspec"] = rspec params["rspec"] = rspec
params["impotent"] = 0 params["impotent"] = 0
rval,response = do_method("cm", "GetTicket", params, version="2.0") rval,response = do_method("cm", "GetTicket", params, version="2.0")
...@@ -105,6 +81,7 @@ if rval: ...@@ -105,6 +81,7 @@ if rval:
pass pass
ticket = response["value"] ticket = response["value"]
#print str(ticket) #print str(ticket)
sys.exit(0)
# #
# Update the ticket. Send back the original rspec, but technically wrong. # Update the ticket. Send back the original rspec, but technically wrong.
...@@ -115,7 +92,7 @@ print "Got the ticket, doing a update on it. " ...@@ -115,7 +92,7 @@ print "Got the ticket, doing a update on it. "
params = {} params = {}
params["slice_urn"] = SLICEURN params["slice_urn"] = SLICEURN
params["ticket"] = ticket params["ticket"] = ticket
params["credentials"] = (myslice,) params["credentials"] = (slicecredential,)
params["rspec"] = rspec params["rspec"] = rspec
params["impotent"] = 0 params["impotent"] = 0
rval,response = do_method("cm", "UpdateTicket", params, version="2.0") rval,response = do_method("cm", "UpdateTicket", params, version="2.0")
...@@ -123,4 +100,5 @@ if rval: ...@@ -123,4 +100,5 @@ if rval:
Fatal("Could not update ticket") Fatal("Could not update ticket")
pass pass
ticket = response["value"] ticket = response["value"]
print "Updated the ticket."
print str(ticket) print str(ticket)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment