2 Library ./RequestsLibrary.py
3 Variables ../variables/Variables.py
10 [Arguments] ${controller_ip} ${auth_data}
11 [Documentation] Makes a POST REST call to the AUTH_TOKEN_API with the given auth_data and returns the response
12 Create Session ODL_SESSION http://${controller_ip}:8181
13 ${headers}= Create Dictionary Content-Type application/x-www-form-urlencoded
14 ${resp}= RequestsLibrary.POST ODL_SESSION ${AUTH_TOKEN_API} data=${auth_data} headers=${headers}
19 [Arguments] ${user}=${USER} ${password}=${PWD} ${scope}=${SCOPE} ${client_id}=${EMPTY} ${client_secret}=${EMPTY}
20 [Documentation] returns a string in the direct authentacation format (e.g., grant_type=password&username=admin&password=admin).
21 ... It can also be passed scope, client_id and client_secret arguments for the case of client specific authorization
22 ${data}= Set Variable grant_type=password&username=${user}&password=${password}&scope=${scope}
23 ${data}= Run Keyword If "${client_id}" != "${EMPTY}" Set Variable ${data}&client_id=${client_id} ELSE Set Variable
25 ${data}= Run Keyword If "${client_secret}" != "${EMPTY}" Set Variable ${data}&client_secret=${client_secret} ELSE Set Variable
31 [Documentation] Validates the given string is in the proper "token" format
32 Should Match Regexp ${token} [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}