2 Documentation AAA System Tests
3 Suite Setup Credential Authentication Suite Setup
4 Suite Teardown Credential Authentication Suite Teardown
6 Library OperatingSystem
8 Library HttpLibrary.HTTP
9 Library ../../../libraries/RequestsLibrary.py
10 Library ../../../libraries/Common.py
11 Resource ../../../libraries/Utils.txt
12 Variables ../../../variables/Variables.py
13 Resource ../../../libraries/AAAKeywords.txt
18 Get Token With Valid Username And Password
19 [Documentation] Sanity test to ensure default user/password can get a token
20 ${auth_data}= Create Auth Data ${USER} ${PWD}
21 ${resp}= AAA Login ${CONTROLLER} ${auth_data}
22 ${auth_token}= Extract Value From Content ${resp.content} /access_token strip
23 Should Be String ${auth_token}
24 Log Token: ${auth_token}
25 Should Be Equal As Strings ${resp.status_code} 201
26 Validate Token Format ${auth_token}
28 Fail To Get Token With Invalid Username And Password
29 [Documentation] Negative test to verify invalid user/password is denied a token
30 ${bad_user}= Set Variable notTheAdmin
31 ${auth_data}= Create Auth Data ${bad_user} notTheAdminPassword
32 ${resp}= AAA Login ${CONTROLLER} ${auth_data}
33 Should Be Equal As Strings ${resp.status_code} 401
35 ${error_msg}= Extract Value From Content ${resp.content} /error strip
36 Should Be Equal As Strings ${error_msg} User :${bad_user} does not exist
38 Create Token with Client Authorization
39 [Documentation] Get a token using client domain
40 ${auth_data}= Create Auth Data ${USER} ${PWD} ${SCOPE} dlux secrete
41 ${resp}= AAA Login ${CONTROLLER} ${auth_data}
42 ${auth_token}= Extract Value From Content ${resp.content} /access_token strip
43 Should Be String ${auth_token}
44 Log Token: ${auth_token}
45 Should Be Equal As Strings ${resp.status_code} 201
46 Validate Token Format ${auth_token}
48 Token Authentication In REST Request
49 [Documentation] Use a token to make a successful REST transaction
50 ${auth_data}= Create Auth Data ${USER} ${PWD}
51 ${resp}= AAA Login ${CONTROLLER} ${auth_data}
52 ${auth_token}= Extract Value From Content ${resp.content} /access_token strip
53 Create Session ODL_SESSION http://${CONTROLLER}:8181
54 ${headers}= Create Dictionary Content-Type application/x-www-form-urlencoded
55 Set To Dictionary ${headers} Authorization Bearer ${auth_token}
56 ${resp}= RequestsLibrary.GET ODL_SESSION ${OPERATIONAL_NODES_API} headers=${headers}
57 Log STATUS_CODE: ${resp.status_code} CONTENT: ${resp.content}
58 Should Be Equal As Strings ${resp.status_code} 200
59 Should Contain ${resp.content} nodes
62 [Documentation] negative test to revoke valid token and check that REST transaction fails
63 ${auth_data}= Create Auth Data ${USER} ${PWD}
64 ${resp}= AAA Login ${CONTROLLER} ${auth_data}
65 ${auth_token}= Extract Value From Content ${resp.content} /access_token strip
66 Create Session ODL_SESSION http://${CONTROLLER}:8181
67 ${headers}= Create Dictionary Content-Type application/x-www-form-urlencoded
68 Set To Dictionary ${headers} Authorization Bearer ${auth_token}
69 ${resp}= RequestsLibrary.GET ODL_SESSION ${OPERATIONAL_NODES_API} headers=${headers}
70 Log STATUS_CODE: ${resp.status_code} CONTENT: ${resp.content}
71 Should Be Equal As Strings ${resp.status_code} 200
72 Should Contain ${resp.content} nodes
73 ${headers}= Create Dictionary Content-Type application/x-www-form-urlencoded
74 ${resp}= RequestsLibrary.POST ODL_SESSION ${REVOKE_TOKEN_API} data=${auth_token} headers=${headers}
75 Should Be Equal As Strings ${resp.status_code} 204
76 Set To Dictionary ${headers} Authorization Bearer ${auth_token}
77 ${resp}= RequestsLibrary.GET ODL_SESSION ${OPERATIONAL_NODES_API} headers=${headers}
78 Log STATUS_CODE: ${resp.status_code} CONTENT: ${resp.content}
79 Should Be Equal As Strings ${resp.status_code} 401
82 Credential Authentication Suite Setup
85 Credential Authentication Suite Teardown