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 | ${TARGETURL} https://${HOST_IP}:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/VIM-test1/RegionOne1 |
| 9 | ${VIMDATA} {"cloud-owner": "VIM-test1", "cloud-region-id": "RegionOne1", "cloud-type": "openstack", "owner-defined-type": "owner-defined-type", "cloud-region-version": "v1.0", "cloud-zone": "cloud zone", "complex-name": "complex name", "cloud-extra-info": "{}", "esr-system-info-list": { "esr-system-info": [{"esr-system-info-id": "vim-esr-system-info-id", "service-url": "http://10.12.25.2:5000/v3", "user-name": "demo", "password": "onapdemo", "system-type": "VIM", "ssl-insecure": true, "cloud-domain": "Default"}]}} |
| 10 | |
| 11 | *** Test Cases *** |
| 12 | |
| 13 | Run AAI Put VIM |
| 14 | [Documentation] Create an VIM object |
| 15 | ${resp}= PutWithCert ${TARGETURL} ${VIMDATA} |
| 16 | log ${TARGETURL} |
| 17 | log ${resp.text} |
| 18 | Should Be Equal As Strings ${resp.status_code} 201 |
| 19 | |
| 20 | Run AAI Get VIM |
| 21 | [Documentation] Get the VIM object just created |
| 22 | ${resp} GetWithCert ${TARGETURL} |
| 23 | log ${resp} |
| 24 | log ${resp.json()} |
| 25 | Should Be Equal As Strings ${resp.status_code} 200 |
| 26 | ${resource_version}= Evaluate $resp.json().get('resource-version') |
| 27 | Set Global Variable ${resource_version} |
| 28 | |
| 29 | Run AAI Delete VIM |
| 30 | [Documentation] Delete the VIM just created |
| 31 | ${resp}= DeleteWithCert ${TARGETURL}?resource-version=${resource_version} |
| 32 | log ${resp.text} |
| 33 | Should Be Equal As Strings ${resp.status_code} 204 |
| 34 | |
| 35 | *** Keywords *** |
| 36 | PutWithCert |
| 37 | [Arguments] ${url} ${data} |
| 38 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 39 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 40 | ${resp}= Evaluate requests.put('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 41 | [return] ${resp} |
| 42 | |
| 43 | PostWithCert |
| 44 | [Arguments] ${url} ${data} |
| 45 | ${auth}= Create List AAI AAI |
| 46 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/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.post('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 49 | [return] ${resp} |
| 50 | |
| 51 | GetWithCert |
| 52 | [Arguments] ${url} |
| 53 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 54 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 55 | ${resp}= Evaluate requests.get('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 56 | [return] ${resp} |
| 57 | |
| 58 | DeleteWithCert |
| 59 | [Arguments] ${url} |
| 60 | ${auth}= Create List AAI AAI |
| 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.delete('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 64 | [return] ${resp} |
| 65 | |