*** Settings ***
Library RequestsLibrary
-Variables ../variables/Variables.py
+Resource ../variables/Variables.robot
*** Variables ***
${WORKSPACE} /tmp
-${BUNDLEFOLDER} distribution-karaf-0.3.0-SNAPSHOT
${AUTHN_CFG_FILE} ${WORKSPACE}/${BUNDLEFOLDER}/etc/org.opendaylight.aaa.authn.cfg
-${CONTROLLER_USER} ${MININET_USER}
*** Keywords ***
AAA Login
[Arguments] ${controller_ip}
[Documentation] Will disable token based authentication. Currently, that is done with a config file change
SSHLibrary.Open Connection ${controller_ip}
- Login With Public Key ${CONTROLLER_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
+ Login With Public Key ${ODL_SYSTEM_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
${cmd}= Set Variable sed -i 's/^authEnabled=.*$/authEnabled=false/g' ${AUTHN_CFG_FILE}
SSHLibrary.Execute Command ${cmd}
SSHLibrary.Close Connection
[Arguments] ${controller_ip}
[Documentation] Will enable token based authentication. Currently, that is done with a config file change
SSHLibrary.Open Connection ${controller_ip}
- Login With Public Key ${CONTROLLER_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
+ Login With Public Key ${ODL_SYSTEM_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
${cmd}= Set Variable sed -i 's/^authEnabled=.*$/authEnabled=true/g' ${AUTHN_CFG_FILE}
SSHLibrary.Execute Command ${cmd}
SSHLibrary.Close Connection
${auth_data}= Create Auth Data ${USER} ${PWD} ${scope} ${client_id} ${client_secret}
${resp}= AAA Login ${ODL_SYSTEM_IP} ${auth_data}
Should Be Equal As Strings ${resp.status_code} 201
- ${auth_token}= Extract Value From Content ${resp.content} /access_token strip
+ ${auth_token} = Extract Value From Content ${resp.text} 'access_token'
[Return] ${auth_token}
Revoke Auth Token
${headers}= Create Dictionary Content-Type=application/x-www-form-urlencoded
${resp}= RequestsLibrary.GET Request httpbin ${idmurl}/users/${user_id} headers=${headers}
Should Be Equal As Strings ${resp.status_code} 200
- Log ${resp.content}
+ Log ${resp.text}
[Return] ${resp}
Create User
${headers}= Create Dictionary Content-Type=application/json
${resp}= RequestsLibrary.POST Request httpbin ${idmurl}/users headers=${headers} data=${user_data}
Should Be Equal As Strings ${resp.status_code} 201
- Log ${resp.content}
+ Log ${resp.text}
[Return] ${resp}