added output error message display by remote ssh execution
[integration/test.git] / test / csit / libraries / AAAKeywords.txt
1 *** Settings ***
2 Library           ./RequestsLibrary.py
3 Variables         ../variables/Variables.py
4
5 *** Variables ***
6
7
8 *** Keywords ***
9 AAA Login
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}
15     Delete All Sessions
16     [Return]    ${resp}
17
18 Create Auth Data
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
24     ...    ${data}
25     ${data}=    Run Keyword If    "${client_secret}" != "${EMPTY}"    Set Variable    ${data}&client_secret=${client_secret}    ELSE    Set Variable
26     ...    ${data}
27     [Return]    ${data}
28
29 Validate Token Format
30     [Arguments]    ${token}
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}