Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library OperatingSystem |
| 3 | Library RequestsLibrary |
| 4 | Library requests |
| 5 | Library Collections |
| 6 | |
| 7 | *** Variables *** |
| 8 | ${COMPLEXKEYVALUE} complex-integration-test1 |
| 9 | ${COMPLEXURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/complexes/complex/${COMPLEXKEYVALUE} |
| 10 | ${COMPLEXDATA} {"physical-location-id":"${COMPLEXKEYVALUE}","data-center-code":"example-data-center-code-val-77883","complex-name":"example-complex-name-val-12992","identity-url":"example-identity-url-val-74366","physical-location-type":"example-physical-location-type-val-32854","street1":"example-street1-val-26496","street2":"example-street2-val-6629","city":"example-city-val-30262","state":"example-state-val-9058","postal-code":"example-postal-code-val-44893","country":"example-country-val-98673","region":"example-region-val-10014","latitude":"example-latitude-val-47555","longitude":"example-longitude-val-76903","elevation":"example-elevation-val-63385","lata":"example-lata-val-90935"} |
| 11 | |
| 12 | *** Test Cases *** |
| 13 | |
| 14 | Run AAI Put complex |
| 15 | [Documentation] Create an complex object |
| 16 | ${resp}= PutWithCert ${COMPLEXURL} ${COMPLEXDATA} |
| 17 | log ${COMPLEXURL} |
| 18 | log ${resp.text} |
| 19 | Should Be Equal As Strings ${resp.status_code} 201 |
| 20 | |
| 21 | Run AAI Get complex |
| 22 | [Documentation] Get the complex object just created |
| 23 | ${resp} GetWithCert ${COMPLEXURL} |
| 24 | log ${resp} |
| 25 | log ${resp.json()} |
| 26 | Should Be Equal As Strings ${resp.status_code} 200 |
| 27 | ${resource_version}= Evaluate $resp.json().get('resource-version') |
| 28 | Set Global Variable ${resource_version} |
| 29 | |
| 30 | Run AAI Delete complex |
| 31 | [Documentation] Delete the complex just created |
| 32 | ${resp}= DeleteWithCert ${COMPLEXURL}?resource-version=${resource_version} |
| 33 | log ${resp.text} |
| 34 | Should Be Equal As Strings ${resp.status_code} 204 |
| 35 | |
| 36 | *** Keywords *** |
| 37 | PutWithCert |
| 38 | [Arguments] ${url} ${data} |
| 39 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 40 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 41 | ${resp}= Evaluate requests.put('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 42 | [return] ${resp} |
| 43 | |
| 44 | PatchWithCert |
| 45 | [Arguments] ${url} ${data} |
| 46 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/merge-patch+json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 47 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 48 | ${resp}= Evaluate requests.patch('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 49 | [return] ${resp} |
| 50 | |
| 51 | PostWithCert |
| 52 | [Arguments] ${url} ${data} |
| 53 | ${auth}= Create List AAI AAI |
| 54 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 55 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 56 | ${resp}= Evaluate requests.post('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 57 | [return] ${resp} |
| 58 | |
| 59 | GetWithCert |
| 60 | [Arguments] ${url} |
| 61 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 62 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 63 | ${resp}= Evaluate requests.get('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 64 | [return] ${resp} |
| 65 | |
| 66 | DeleteWithCert |
| 67 | [Arguments] ${url} |
| 68 | ${auth}= Create List AAI AAI |
| 69 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 70 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 71 | ${resp}= Evaluate requests.delete('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 72 | [return] ${resp} |