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 | ${L3NETWORKKEYVALUE} l3-network-integration-test1 |
| 9 | ${L3NETWORKURL} https://${HOST_IP}:8443/aai/v11/network/l3-networks/l3-network/${L3NETWORKKEYVALUE} |
| 10 | ${L3NETWORKDATA} {"network-id":"${L3NETWORKKEYVALUE}","network-name":"example-network-name-val-5468","network-type":"example-network-type-val-5468","network-role":"example-network-role-val-5468","network-technology":"example-network-technology-val-5468","neutron-network-id":"example-neutron-network-id-val-5468","is-bound-to-vpn":"true","service-id":"example-service-id-val-5468","orchestration-status":"example-orchestration-status-val-5468","heat-stack-id":"example-heat-stack-id-val-5468","mso-catalog-key":"example-mso-catalog-key-val-5468"} |
| 11 | ${L3NETWORKPATCHDATA} {"network-id":"${L3NETWORKKEYVALUE}","network-name":"example-network-name-val-5468-patched","network-type":"example-network-type-val-5468-patched"} |
| 12 | |
| 13 | *** Test Cases *** |
| 14 | Run AAI Put l3-network |
| 15 | [Documentation] Create l3-network object |
| 16 | ${resp}= PutWithCert ${L3NETWORKURL} ${L3NETWORKDATA} |
| 17 | log ${L3NETWORKURL} |
| 18 | log ${resp.text} |
| 19 | Should Be Equal As Strings ${resp.status_code} 201 |
| 20 | |
| 21 | Run AAI Get l3-network |
| 22 | [Documentation] Get the l3-network object just created |
| 23 | ${resp} GetWithCert ${L3NETWORKURL} |
| 24 | log ${resp} |
| 25 | log ${resp.json()} |
| 26 | Should Be Equal As Strings ${resp.status_code} 200 |
| 27 | |
| 28 | Run AAI Patch l3-network |
| 29 | [Documentation] Update (Parch) l3-network object |
| 30 | ${resp}= PatchWithCert ${L3NETWORKURL} ${L3NETWORKPATCHDATA} |
| 31 | log ${L3NETWORKURL} |
| 32 | log ${resp.text} |
| 33 | Should Be Equal As Strings ${resp.status_code} 200 |
| 34 | |
| 35 | Run AAI Get l3-network |
| 36 | [Documentation] Get the l3-network object just patched |
| 37 | ${resp} GetWithCert ${L3NETWORKURL} |
| 38 | log ${resp} |
| 39 | log ${resp.json()} |
| 40 | Should Be Equal As Strings ${resp.status_code} 200 |
| 41 | ${resource_version}= Evaluate $resp.json().get('resource-version') |
| 42 | Set Global Variable ${resource_version} |
| 43 | |
| 44 | Run AAI Delete l3-network |
| 45 | [Documentation] Delete the l3-network |
| 46 | ${resp}= DeleteWithCert ${L3NETWORKURL}?resource-version=${resource_version} |
| 47 | log ${resp.text} |
| 48 | Should Be Equal As Strings ${resp.status_code} 204 |
| 49 | |
| 50 | *** Keywords *** |
| 51 | PutWithCert |
| 52 | [Arguments] ${url} ${data} |
| 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.put('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 56 | [return] ${resp} |
| 57 | |
| 58 | PatchWithCert |
| 59 | [Arguments] ${url} ${data} |
| 60 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/merge-patch+json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 61 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 62 | ${resp}= Evaluate requests.patch('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 63 | [return] ${resp} |
| 64 | |
| 65 | PostWithCert |
| 66 | [Arguments] ${url} ${data} |
| 67 | ${auth}= Create List AAI AAI |
| 68 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 69 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 70 | ${resp}= Evaluate requests.post('${url}', data='${data}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 71 | [return] ${resp} |
| 72 | |
| 73 | GetWithCert |
| 74 | [Arguments] ${url} |
| 75 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 76 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 77 | ${resp}= Evaluate requests.get('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 78 | [return] ${resp} |
| 79 | |
| 80 | DeleteWithCert |
| 81 | [Arguments] ${url} |
| 82 | ${auth}= Create List AAI AAI |
| 83 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=integration-aai X-FromAppId=integration-aai Authorization=Basic QUFJOkFBSQ== |
| 84 | ${certinfo}= Evaluate ('${CURDIR}/aai.crt', '${CURDIR}/aai.key') |
| 85 | ${resp}= Evaluate requests.delete('${url}', headers=${headers}, cert=${certinfo}, verify=False) requests |
| 86 | [return] ${resp} |