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/external-system/esr-vnfm-list/esr-vnfm/vnfm-test1 |
| 9 | ${VNFMDATA} {"vnfm-id": "vnfm-test1", "vim-id": "123", "certificate-url": "", "esr-system-info-list": {"esr-system-info": [{"esr-system-info-id":"esr-system-info-vnfm-test1", "system-name": "vnfmtest1", "type": "Tacker", "vendor": "ZTE", "version": "v1.0", "service-url": "http://10.74.44.12", "user-name": "admin", "password": "admin", "system-type": "VNFM"}]}} |
| 10 | |
| 11 | *** Test Cases *** |
| 12 | |
| 13 | Run AAI Put vnfm |
| 14 | [Documentation] Create an vnfm object |
| 15 | ${resp}= PutWithCert ${TARGETURL} ${VNFMDATA} |
| 16 | log ${TARGETURL} |
| 17 | log ${resp.text} |
| 18 | Should Be Equal As Strings ${resp.status_code} 201 |
| 19 | |
| 20 | Run AAI Get vnfm |
| 21 | [Documentation] Get the vnfm 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 vnfm |
| 30 | [Documentation] Delete the vnfm 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 | |