*** Variables ***
# port is fixed in Jetty configuration, as well
-${URI} http://${CONTROLLER}:8282
+${URI} http://${ODL_SYSTEM_IP}:8282
# create lists for Domains, Roles and Users - that can be cleaned up upon Teardown
@{cleanup_domain_list}
@{cleanup_role_list}
# Create the new domain, initialize some values to test against
${domaindesc}= Set Variable "testdomain other"
${domainstatus}= Set Variable "true"
-
# Have to escape the quotes, need quotes to make the POST work properly
${data}= Set Variable {"description":${domaindesc},"domainid":"7","name":\"${domainName}\","enabled":${domainstatus}}
Log ${data}
# now post it
${domain}= Post New Domain ${domainName} ${data}
Log ${domain}
-
${domainid}= Parse Item From Blob By Offset ${domain} 0
Log ${domainid}
-
# get the domain to verify
${fetched_domain}= Get Specific Domain ${domainid}
# add new domain json string to the cleanup list for later cleanup
Log ${cleanup_domain_list}
${domain_item}= Get From List ${cleanup_domain_list} -1
Log ${domain_item}
-
# parse out the domainid from the domain info we just grabbed
${domainid}= Parse Item From Blob By Offset ${domain_item} 0
Log ${domainid}
-
# parse out the name from the same info
${domainname}= Parse Item From Blob By Offset ${domain_item} 1
Log ${domainname}
-
# get the entire dump of created domains
${content}= Get Domains
-
# parse through that massive blob and get the individual name created in Setup
${node_count}= Nodecount ${content} domains domainid
${domainid}= Convert To Integer ${domainid}
-
# Get the domain name from the database, looking it up by its domainid
${domainentry}= Get Domain Name By Domainid ${content} ${domainid} ${node_count}
-
Log ${domainentry}
# compare to see if the parsed user id matches the one we grabbed from list
Should Be Equal ${domainentry} ${domainname}
Log ${cleanup_domain_list}
${domain_item}= Get From List ${cleanup_domain_list} -1
Log ${domain_item}
-
# parse out the domain id from the domain info we just grabbed
${domid}= Parse Item From Blob By Offset ${domain_item} 0
Log ${domid}
-
# parse out the name from the same info
${domname}= Parse Item From Blob By Offset ${domain_item} 1
Log ${domname}
-
${data}= Set Variable {"name":"MasterTest Domain"}
Update Specific Domain ${data} ${domid}
${domname}= Get Specific Domain Name ${domid}
# parse out the domain-id from the domain info we just created
${domainid}= Parse Item From Blob By Offset ${newdomain} 0
Log ${domainid}
-
# now wipe if off the map
Delete Domain ${domainid}
# we should not be able to fetch this domain from the database of domains...should fail...
Log ${cleanup_user_list}
${user_item}= Get From List ${cleanup_user_list} -1
Log ${user_item}
-
# parse out the userid from the user info we just grabbed
${userid}= Parse Item From Blob By Offset ${user_item} 0
Log ${userid}
-
# parse out the name from the same info
${username}= Parse Item From Blob By Offset ${user_item} 1
Log ${username}
-
# get the entire blob of users
${content}= Get Users
# parse through that massive blob and get the individual name
# convert this to unicode
# ${item}= Convert To String ${item}
Log ${item}
-
# parse out the userid from the user info we just grabbed
${userid}= Parse Item From Blob By Offset ${user_item} 0
Log ${userid}
-
# parse out the name from the same info
${username}= Parse Item From Blob By Offset ${user_item} 1
Log ${username}
-
# make a GET call to find the material we want
${content}= Get Specific User ${userid}
-
# parse out the user name from the content we just fetched
${fetched_username}= Parse Item From Blob By Offset ${content} 1
Log ${fetched_username}
-
# compare to see if the parsed user name matches the one we grabbed from list
Should Contain ${fetched_username} ${username}
Log ${cleanup_user_list}
${user_item}= Get From List ${cleanup_user_list} -1
Log ${user_item}
-
# parse out the user-id from the user info we just created
${userid}= Parse Item From Blob By Offset ${user_item} 0
Log ${userid}
-
# update the information for the userid
${testusername}= Create Random Name force-accomplish
${data}= Set Variable {"description":"sample test description", "name":"${testusername}"}
Log ${testusername}
# now, make a GET call to find the material we modified
${existing_useritem}= Get Specific User ${userid}
-
# parse out the name from the existing userinfo
${expected_username}= Parse Item From Blob By Offset ${existing_useritem} 1
Log ${expected_username}
-
# compare to see if the GOTTEN user id matches the one we grabbed from list
Should Be Equal ${expected_username} ${testusername}
${testusername}= Create Random Name Darth-Maul
${data}= Set Variable {"description":"sample user description", "name":"${testusername}", "userid":1}
Log ${testusername}
-
# Post this puppy
${content}= Post New User ${testusername} ${data}
# parse out the userid from the content we just created
${userid}= Parse Item From Blob By Offset ${content} 0
Log ${userid}
-
# now go GET the userid info and compare to the name we fabricated
${existing_useritem}= Get Specific User ${userid}
-
${expected_username}= Parse Item From Blob By Offset ${existing_useritem} 1
Log ${expected_username}
-
# compare to see if the GOTTEN role id matches the one we grabbed from list
Should Be Equal ${expected_username} ${testusername}
# parse out the user-id from the content we just created
${userid}= Parse Item From Blob By Offset ${content} 0
Log ${userid}
-
# now delete it...
${content2}= Delete User ${userid}
# should fail...
# parse out the role-id from the role info we just created
${roleid}= Parse Item From Blob By Offset ${roleitem} 0
Log ${roleid}
-
# make a GET call to find the material we want
${existing_roleitem}= Get Specific Role ${roleid}
-
# parse out the expected role-id from the content we just created
${eroleid}= Parse Item From Blob By Offset ${existing_roleitem} 0
Log ${eroleid}
Log ${cleanup_role_list}
${role_item}= Get From List ${cleanup_role_list} -1
Log ${role_item}
-
# parse out the role-id from the info we just grabbed
${roleid}= Parse Item From Blob By Offset ${role_item} 0
Log ${roleid}
# parse out the name from the same info
${rolename}= Parse Item From Blob By Offset ${role_item} 1
Log ${rolename}
-
# get the entire blob of roles
${content}= Get Roles
# parse through that massive blob and get the individual name
# parse out the role-id from the role info we just created
${roleid}= Parse Item From Blob By Offset ${role_item} 0
Log ${roleid}
-
# update the information for the roleid
${testrolename}= Create Random Name force-accomplish
${data}= Set Variable {"description":"sample test description", "name":"${testrolename}"}
Log ${testrolename}
# now, make a GET call to find the material we modified
${existing_roleitem}= Get Specific Role ${roleid}
-
# parse out the name from the same info
${expected_rolename}= Parse Item From Blob By Offset ${existing_roleitem} 1
Log ${expected_rolename}
-
# compare to see if the GOTTEN role id matches the one we grabbed from list
Should Be Equal ${expected_rolename} ${testrolename}
# parse out the role-id from the content we just created
${roleid}= Parse Item From Blob By Offset ${content} 0
Log ${roleid}
-
# now got GET the roleid info and compare to the name we fabricated
# and parse out role name
${existing_roleitem}= Get Specific Role ${roleid}
${expected_rolename}= Parse Item From Blob By Offset ${content} 1
Log ${expected_rolename}
-
# compare to see if the GOTTEN role id matches the one we grabbed from list
Should Be Equal ${expected_rolename} ${testrolename}
# parse out the role-id from the content we just created
${roleid}= Parse Item From Blob By Offset ${content} 0
Log ${roleid}
-
# now delete it...
${content2}= Delete Role ${roleid}
# should fail...
Test Grant Role To Domain And User
[Documentation] Test the POST of a Role to Domain and User
-
# rely on the creation of a test role, user and domain in the Setup routine
# pop item off of end of the list, for use (does not alter list)
${role_item}= Get From List ${cleanup_role_list} -1
Log ${user_item}
${domain_item}= Get From List ${cleanup_domain_list} -1
Log ${domain_item}
-
# parse out the roleid from the role info we just grabbed
${roleid}= Parse Item From Blob By Offset ${role_item} 0
Log ${roleid}
-
# parse out the name from the same info
- ${rolename}= Parse Item From Blob By Offset ${role_item} 1
+ ${rolename}= Parse Item From Blob By Offset ${role_item} 1
Log ${rolename}
-
# parse out the userid from the user info we just grabbed
${userid}= Parse Item From Blob By Offset ${user_item} 0
Log ${userid}
-
# parse out the name from the same info
${username}= Parse Item From Blob By Offset ${user_item} 1
Log ${username}
-
# parse out the domain-id from the domain info we just grabbed
${domainid}= Parse Item From Blob By Offset ${domain_item} 0
Log ${domainid}
-
# parse out the name from the same info
${domainname}= Parse Item From Blob By Offset ${domain_item} 1
Log ${domainname}
-
# generate the data payload that we wish to post
${data}= Set Variable {"roleid":"${roleid}", "description":"fabricated test roleid"}
# post this monster
Should Contain ${content} ${roleid}
Should Contain ${content} ${userid}
-
*** Keywords ***
IdMLight Suite Setup
Log Suite Setup
${testrole}= Create Random Name Force-User
Log ${testrole}
# now create the domain, role and userid
-
# create the test domain
Create Session httpbin ${URI}
${domaindata}= Set Variable {"description":"planetary domain","domainid":"7","name":"${testdomain}","enabled":"true"}
\ Log ${userid}
\ Delete User ${userid}
Log ${cleanup_user_list}
-
Delete All Sessions
Check Specific Id Does Not Exist
# the ITEM is the area to look under... users, domains, roles, etc
${n1}= Set Variable auth/v1/${area_to_look}/${id}
# do the actual get
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 404
${id_string}= Convert To String ${id}
Should Contain ${resp.content} ${id_string}
[Arguments] ${domainid}
[Documentation] Execute GET command on specified single domain
${n1}= Set Variable auth/v1/domains/${domainid}
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 200
${domainid_string}= Convert To String ${domainid}
Should Contain ${resp.content} ${domainid_string}
[Arguments] ${domainid}
[Documentation] Execute GET command on specified single domain
${n1}= Set Variable auth/v1/domains/${domainid}
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Contain ${resp.content} ${domainid}
Log ${resp.content}
[Return] ${resp.content}
[Arguments] ${roleid}
[Documentation] Exercise REST command to GET a specific role, based on role-id
${n1}= Set Variable auth/v1/roles/${roleid}
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} ${roleid}
[Return] ${resp.content}
Get Domains
[Documentation] Execute getdomains GET command.
${n1}= Set Variable auth/v1/domains
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} "domains"
[Return] ${resp.content}
Get Roles
[Documentation] Execute GET command to obtain list of roles.
${n1}= Set Variable auth/v1/roles
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} "roles"
[Return] ${resp.content}
[Arguments] ${user}
[Documentation] Exercise REST command for users GET command.
${n1}= Set Variable auth/v1/users/${user}
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} ${user}
[Return] ${resp.content}
Get Users
[Documentation] GET the complete set of users.
${n1}= Set Variable auth/v1/users
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} ${user}
[Return] ${resp.content}
[Arguments] ${domain} ${data}
[Documentation] Exercise REST command for domains POST command.
${n1}= Set Variable auth/v1/domains
- ${resp} RequestsLibrary.Post httpbin ${n1} headers=${HEADERS} data=${data}
+ ${resp} RequestsLibrary.Post Request httpbin ${n1} headers=${HEADERS} data=${data}
Should Be Equal As Strings ${resp.status_code} 201
Should Contain ${resp.content} ${domain}
[Return] ${resp.content}
[Arguments] ${data}
[Documentation] Use POST REST command to create specified Role.
${n1}= Set Variable auth/v1/roles
- ${resp} RequestsLibrary.Post httpbin ${n1} headers=${HEADERS} data=${data}
+ ${resp} RequestsLibrary.Post Request httpbin ${n1} headers=${HEADERS} data=${data}
# HTTP/1.1 201 Created
Should Be Equal As Strings ${resp.status_code} 201
[Return] ${resp.content}
[Arguments] ${username} ${data}
[Documentation] Exercise REST command for users POST command.
${n1}= Set Variable auth/v1/users
- ${resp} RequestsLibrary.Post httpbin ${n1} headers=${HEADERS} data=${data}
+ ${resp} RequestsLibrary.Post Request httpbin ${n1} headers=${HEADERS} data=${data}
# grab the list of users, count the list, and then search the list for the specific user id
${users}= Get Users
${depth}= Nodecount ${users} users userid
[Arguments] ${data} ${domainid}
[Documentation] Update the specified domainid with a new name specified in domain-name
${n1}= Set Variable auth/v1/domains/${domainid}
- ${resp} RequestsLibrary.Put httpbin ${n1} headers=${HEADERS} data=${data}
+ ${resp} RequestsLibrary.Put Request httpbin ${n1} headers=${HEADERS} data=${data}
# Should Be Equal As Strings ${resp.status_code} 201
Log ${resp.content}
[Arguments] ${data} ${roleid}
[Documentation] Update the specified roleid with a new information name specified
${n1}= Set Variable auth/v1/roles/${roleid}
- ${resp} RequestsLibrary.Put httpbin ${n1} headers=${HEADERS} data=${data}
+ ${resp} RequestsLibrary.Put Request httpbin ${n1} headers=${HEADERS} data=${data}
# Should Be Equal As Strings ${resp.status_code} 201
Log ${resp.content}
[Arguments] ${data} ${userid}
[Documentation] Update the specified userid with a new information name specified
${n1}= Set Variable auth/v1/users/${userid}
- ${resp} RequestsLibrary.Put httpbin ${n1} headers=${HEADERS} data=${data}
+ ${resp} RequestsLibrary.Put Request httpbin ${n1} headers=${HEADERS} data=${data}
# Should Be Equal As Strings ${resp.status_code} 201
Log ${resp.content}
[Documentation] Delete the specified domain, by id
${n1}= Set Variable auth/v1/domains/${domainid}
Log ${n1}
- ${resp} RequestsLibrary.Delete httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Delete Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 204
Log ${resp.content}
[Arguments] ${userid}
[Documentation] Delete the specified user, by id
${n1}= Set Variable auth/v1/users/${userid}
- ${resp} RequestsLibrary.Delete httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Delete Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 204
Log ${resp.content}
[Arguments] ${roleid}
[Documentation] Use DELETE REST command to wipe out a Role created for testing.
${n1}= Set Variable auth/v1/roles/${roleid}
- ${resp} RequestsLibrary.Delete httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Delete Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 204
#Should NOT Contain ${resp.content} ${roleid}
[Return] ${resp.content}
[Documentation] Exercise REST POST command for posting a role to particular domain and user
${n1}= Set Variable auth/v1/domains/${domainid}/users/${userid}/roles
# now post it
- ${resp} RequestsLibrary.Post httpbin ${n1} headers=${HEADERS} data=${data}
+ ${resp} RequestsLibrary.Post Request httpbin ${n1} headers=${HEADERS} data=${data}
Should Be Equal As Strings ${resp.status_code} 201
[Return] ${resp.content}
[Documentation] Exercise REST GET command for roles in a specific domain and user
${n1}= Set Variable auth/v1/domains/${domainid}/users/${userid}/roles
# now get it
- ${resp} RequestsLibrary.Get httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Get Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.content}
[Documentation] Exercise REST DELETE command for a grant by roleid
${n1}= Set Variable auth/v1/domains/${domainid}/users/${userid}/roles/${roleid}
# now delete it
- ${resp} RequestsLibrary.Delete httpbin ${n1} headers=${HEADERS}
+ ${resp} RequestsLibrary.Delete Request httpbin ${n1} headers=${HEADERS}
Should Be Equal As Strings ${resp.status_code} 204
[Return] ${resp.content}
Parse Item From Blob By Offset
- [Documentation] Parse out a field from JSON structure
[Arguments] ${item} ${offset}
+ [Documentation] Parse out a field from JSON structure
${x}= Split String ${item} ,
${y}= Get From List ${x} ${offset}
${z}= Split String ${y} :
-
# offset is one in next line because you are looking at a key:value pair
${return_item_}= Get From List ${z} 1
${return_item}= Replace String ${return_item_} " ${EMPTY}