blob: 90544e4d9079ed2a685b67fab3dc9397f2091714 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library OperatingSystem
3Library RequestsLibrary
4Library requests
5Library 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 ***
14Run 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
21Run 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
28Run 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
35Run 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
44Run 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 ***
51PutWithCert
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
58PatchWithCert
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
65PostWithCert
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
73GetWithCert
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
80DeleteWithCert
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}