Update Robot Framework format - step 8
[integration/test.git] / csit / suites / iotdm / basic / 024_ResourceAttributesACP.robot
1 *** Settings ***
2 Documentation       Tests for Access Control Policy (ACP) resource attributes
3
4 Resource            ../../../libraries/SubStrings.robot
5 Library             ../../../libraries/IoTDM/criotdm.py
6 Library             Collections
7 Resource            ../../../variables/Variables.robot
8 Resource            ../../../libraries/IoTDM/IoTDMKeywords.robot
9
10 Suite Setup         IOTDM Basic Suite Setup    ${ODL_SYSTEM_1_IP}    ${ODL_RESTCONF_USER}    ${ODL_RESTCONF_PASSWORD}
11 Suite Teardown      Kill The Tree    ${ODL_SYSTEM_1_IP}    InCSE1    admin    admin
12
13
14 *** Variables ***
15 ${rt_ae}                    2
16 ${rt_container}             3
17 ${rt_contentInstance}       4
18 ${rt_acp}                   1
19
20
21 *** Test Cases ***
22 1.0.0 Test whether default ACP exist
23     Modify Headers Origin    ${iserver}    admin
24     ${r} =    Retrieve Resource    ${iserver}    InCSE1/_defaultACP
25     ${text} =    Text    ${r}
26     LOG    ${text}
27     ${status_code} =    Status Code    ${r}
28     Should Be True    199 < ${status_code} < 299
29
30 1.0.1 ACP C/R resource with mandatory common and specific attributes only
31     [Documentation]    After Created, test whether all the mandatory attribtues exist.
32     ${attr} =    Set Variable
33     ...    "pv":{"acr":[{"acor" : ["111","222"],"acop":35}, {"acor" : ["111","222"],"acop":35}]}, "pvs":{"acr":[{"acor" : ["111","222"],"acop":7}, {"acor" : ["111","222"],"acop":9}]}, "rn":"Acp1"
34     ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_acp}    ${attr}
35     ${status_code} =    Status Code    ${r}
36     Should Be Equal As Integers    ${status_code}    201
37     ${text} =    Convert To String    ${r.text}
38     Should Contain All Sub Strings    ${text}    "ct":    "lt":    "ty"    "ri":    "pi":
39
40 1.0.2 ACP D/R: resource with mandatory common and specific attributes only
41     [Tags]    not-implemented    exclude
42     TODO
43
44 2 ACP common attributes
45     [Documentation]    (TODO remove when implemented), next TCs verifies particular common attribute of ACP.
46     [Tags]    not-implemented    exclude
47     TODO
48
49 2.01 ACP common attribute: resourceName
50     [Tags]    not-implemented    exclude
51     TODO
52
53 2.02 ACP common attribute: resourceType
54     [Tags]    not-implemented    exclude
55     TODO
56
57 2.03 ACP common attribute: resourceID
58     [Tags]    not-implemented    exclude
59     TODO
60
61 2.04 ACP common attribute: parentID
62     [Tags]    not-implemented    exclude
63     TODO
64
65 2.05 ACP common attribute: expirationTime
66     [Tags]    not-implemented    exclude
67     TODO
68
69 2.06 ACP common attribute: labels
70     [Tags]    not-implemented    exclude
71     TODO
72
73 2.07 ACP common attribute: creationTime
74     [Tags]    not-implemented    exclude
75     TODO
76
77 2.08 ACP common attribute: lastModifiedTime
78     [Tags]    not-implemented    exclude
79     TODO
80
81 2.09 ACP common attribute: announceTo
82     [Tags]    not-implemented    exclude
83     TODO
84
85 2.10 ACP common attribute: announcedAttribute
86     [Tags]    not-implemented    exclude
87     TODO
88
89 3 ACP specific attributes
90     [Documentation]    (TODO remove when implemented), next TCs verifies particular specific attribute of ACP.
91     [Tags]    not-implemented    exclude
92     TODO
93
94 3.01 ACP specific attributes: priviliges, selfPrivileges
95     [Tags]    not-implemented    exclude
96     # TODO TCs here should implement all sub-cases as described in the help file
97     # TODO next TC definities just shows subset of TCs and how it could be done
98     TODO
99
100 3.01.01 ACP U/R: priviliges attribute: Update priviliges attribute only
101     [Documentation]    Update only priviliges attribute of ACP and verify by Retrieve operation.
102     [Tags]    not-implemented    exclude
103     TODO
104
105 3.01.02 ACP U/R: selfPriviliges attribute: Update selfPriviliges attribute only
106     [Documentation]    Update only selfPriviliges attribute of ACP and verify by Retrieve operation.
107     [Tags]    not-implemented    exclude
108     TODO
109
110 3.01.03 ACP U/R: priviliges attribute: Delete priviliges attribute only
111     [Documentation]    NEGATIVE: Use Update operation to set priviliges attribute to null. Verify error message and
112     ...    verify original ACP resource by Retrieve operation.
113     [Tags]    not-implemented    exclude
114     TODO
115
116 3.01.04 ACP U/R: selfPriviliges attribute: Delete selfPriviliges attribute only
117     [Documentation]    NEGATIVE: Use Update operation to set selfPriviliges attribute to null. Verify error message and
118     ...    verify original ACP resource by Retrieve operation.
119     [Tags]    not-implemented    exclude
120     TODO
121
122 3.02 ACP elements of specific attributes: priviliges, selfPrivileges
123     [Tags]    not-implemented    exclude
124     # TODO TCs here should implement all sub-cases as described in the help file
125     # TODO next TC definities just shows subset of TCs and how it could be done
126     TODO
127
128 3.02.01 ACP C/R: priviliges, selfPrivileges attributes: With valid IPv4 acip element
129     [Documentation]    After Created, test whether all the mandatory elements exist.
130     ${attr} =    Set Variable
131     ...    "pv":{"acr":[{"acor" : ["111","222"],"acop":35,"acco":[{"acip":{"ipv4":["127.0.0.1"]}}]},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp2"
132     ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_acp}    ${attr}
133     ${status_code} =    Status Code    ${r}
134     Should Be Equal As Integers    ${status_code}    201
135     ${text} =    Convert To String    ${r.text}
136     Should Contain All Sub Strings    ${text}    "ct":    "lt":    "ty"    "ri":    "pi":
137
138 3.02.02 ACP U/R: priviliges, selfPrivileges attributes: With valid IPv4 acip element
139     [Documentation]    After Updated, test whether all the mandatory elements exist.
140     ...    Update resources with/without tested element.
141     [Tags]    not-implemented    exclude
142     TODO
143
144 3.02.03 ACP D/R: priviliges, selfPrivileges attributes: With valid IPv4 acip element
145     [Documentation]    After Deleted, verify by Retrieve operation. Delete resources with/without tested element.
146     [Tags]    not-implemented    exclude
147     TODO
148
149 3.02.04 ACP C/R: priviliges, selfPrivileges attributes: With invalid IPv4 acip element
150     [Documentation]    NEGATIVE: Create with invalid ipv4 address, check error message and verify by Retrieve operation.
151     ${attr} =    Set Variable
152     ...    "pv":{"acr":[{"acor" : ["111","222"],"acop":35,"acco":[{"acip":{"ipv4":["127.0.01"]}}]},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp3"
153     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_acp}
154     ...    ${attr}
155     Should Start with    ${error}    Cannot create this resource [400]
156     Should Contain    ${error}    not a valid Ipv4 address
157     # TODO Verify by Retrieve no operation
158
159 3.02.05 ACP U/R: priviliges, selfPrivileges attributes: With invalid IPv4 acip element
160     [Documentation]    NEGATIVE: Update with invalid ipv4 address, check error message and verify by Retrieve operation.
161     ...    Update resources with/without tested element.
162     [Tags]    not-implemented    exclude
163     TODO
164
165 3.02.06 ACP C/R: priviliges, selfPrivileges attributes: With valid IPv6 acip element
166     [Documentation]    After Created, test whether all the mandatory elements exist.
167     ${attr} =    Set Variable
168     ...    "pv":{"acr":[{"acor" : ["111","222"],"acop":35,"acco":[{"acip":{"ipv6":["2001:db8:0:0:0:ff00:42:8329"]}}]},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp4"
169     ${r} =    Create Resource    ${iserver}    InCSE1    ${rt_acp}    ${attr}
170     ${status_code} =    Status Code    ${r}
171     Should Be Equal As Integers    ${status_code}    201
172     ${text} =    Convert To String    ${r.text}
173     Should Contain All Sub Strings    ${text}    "ct":    "lt":    "ty"    "ri":    "pi":
174     # TODO verify by Retrieve operation
175
176 3.02.07 ACP U/R: priviliges, selfPrivileges attributes: With valid IPv6 acip element
177     [Documentation]    After Updated, test whether all the mandatory elements exist. Update ACP resources with/without
178     ...    tested element.
179     [Tags]    not-implemented    exclude
180     TODO
181
182 3.02.08 ACP D/R: priviliges, selfPrivileges attributes: With valid IPv6 acip element
183     [Documentation]    After Deleted, test whether all the mandatory elements exist. Delete ACP resources with/without
184     ...    tested element.
185     [Tags]    not-implemented    exclude
186     TODO
187
188 3.02.09 ACP C/R: priviliges, selfPrivileges attributes: With invalid IPv6 acip element
189     [Documentation]    NEGATIVE: Create with invalid ipv6 address, check error message and verify by Retrieve operation.
190     ${attr} =    Set Variable
191     ...    "pv":{"acr":[{"acor" : ["111","222"],"acop":35,"acco":[{"acip":{"ipv6":["2001:db8:0:0:0:ff00:42"]}}]},{"acor" : ["111","222"],"acop":35}]},"pvs":{"acr":[{"acor" : ["111","222"],"acop":7},{"acor" : ["111","222"],"acop":9}]},"rn":"Acp3"
192     ${error} =    Run Keyword And Expect Error    *    Create Resource    ${iserver}    InCSE1    ${rt_acp}
193     ...    ${attr}
194     Should Start with    ${error}    Cannot create this resource [400]
195     Should Contain    ${error}    not a valid Ipv6 address
196     # TODO: verify by retrieve operation
197
198 3.02.10 ACP U/R: priviliges, selfPrivileges attributes: With invalid IPv6 acip element
199     [Documentation]    NEGATIVE: Update with invalid ipv6 address, check error message and verify by Retrieve operation.
200     ...    Update resources with/without tested element.
201     [Tags]    not-implemented    exclude
202     TODO
203
204 3.03.01 ACP C/R: priviliges, selfPrivileges attributes: With accessControlWindow element
205     [Documentation]    Create ACP with accessControlWindow element and verify by Retrieve operation.
206     [Tags]    not-implemented    exclude
207     TODO
208
209 3.03.02 ACP U/R: priviliges, selfPrivileges attributes: With accessControlWindow element
210     [Documentation]    Update the accessControlWindow element of ACP resources with/without tested element and verify
211     ...    by Retrieve operation.
212     [Tags]    not-implemented    exclude
213     TODO
214
215 3.03.03 ACP D/R: priviliges, selfPrivileges attributes: With accessControlWindow element
216     [Documentation]    Delete ACP with accessControlWindow element and verify by Retrieve operation.
217     [Tags]    not-implemented    exclude
218     TODO
219
220 3.03.04 ACP C/R: priviliges, selfPrivileges attributes: With invalid accessControlWindow element
221     [Documentation]    NEGTIVE: Create ACP with invalid accessControlWindow element and check error message and
222     ...    verify by Retrieve operation.
223     [Tags]    not-implemented    exclude
224     TODO
225
226 3.03.05 ACP U/R: priviliges, selfPrivileges attributes: With invalid accessControlWindow element
227     [Documentation]    Update the invalid value of accessControlWindow element of ACP resources with/without tested
228     ...    element and verify by Retrieve operation.
229     [Tags]    not-implemented    exclude
230     TODO
231
232 3.03.06 ACP C/R: priviliges, selfPrivileges attributes: With multiple accessControlWindow elements
233     [Documentation]    Create ACP with multiple accessControlWindow elements and verify by Retrieve operation.
234     [Tags]    not-implemented    exclude
235     TODO
236
237 3.03.07 ACP U/R: priviliges, selfPrivileges attributes: With multiple accessControlWindow elements
238     [Documentation]    Update multiple accessControlWindow elements of ACP resources with/without tested elements and verify
239     ...    by Retrieve operation.
240     [Tags]    not-implemented    exclude
241     TODO
242
243 3.03.08 ACP D/R: priviliges, selfPrivileges attributes: With multiple accessControlWindow elements
244     [Documentation]    Delete ACP with multiple accessControlWindow elements and verify by Retrieve operation.
245     [Tags]    not-implemented    exclude
246     TODO
247
248 3.03.09 ACP C/R: priviliges, selfPrivileges attributes: With multiple invalid accessControlWindow elements
249     [Documentation]    NEGTIVE: Create ACP with multiple invalid accessControlWindow elements and check error message and
250     ...    verify by Retrieve operation.
251     ...    Test also combinations of valid and invalid elements.
252     [Tags]    not-implemented    exclude
253     TODO
254
255 3.03.10 ACP U/R: priviliges, selfPrivileges attributes: With multiple invalid accessControlWindow elements
256     [Documentation]    Update the invalid value of accessControlWindow element of ACP resources with/without tested
257     ...    element and verify by Retrieve operation.
258     ...    Test also combinations of valid and invalid elements.
259     [Tags]    not-implemented    exclude
260     TODO
261
262 3.03.11 ACP C/R: priviliges, selfPrivileges attributes: With accessControlLocationRegions element
263     [Documentation]    Create ACP with accessControlLocationRegions element and verify by Retrieve operation.
264     [Tags]    not-implemented    exclude
265     TODO
266
267 3.03.12 ACP U/R: priviliges, selfPrivileges attributes: With accessControlLocationRegions element
268     [Documentation]    Update the accessControlLocationRegions element of ACP resources with/without tested element and verify
269     ...    by Retrieve operation.
270     [Tags]    not-implemented    exclude
271     TODO
272
273 3.03.13 ACP D/R: priviliges, selfPrivileges attributes: With accessControlLocationRegions element
274     [Documentation]    Delete ACP with accessControlLocationRegions element and verify by Retrieve operation.
275     [Tags]    not-implemented    exclude
276     TODO
277
278 3.03.14 ACP C/R: priviliges, selfPrivileges attributes: With invalid accessControlLocationRegions element
279     [Documentation]    NEGTIVE: Create ACP with invalid accessControlLocationRegions element and check error message and
280     ...    verify by Retrieve operation.
281     [Tags]    not-implemented    exclude
282     TODO
283
284 3.03.15 ACP U/R: priviliges, selfPrivileges attributes: With invalid accessControlLocationRegions element
285     [Documentation]    Update the invalid value of accessControlLocationRegions element of ACP resources with/without tested
286     ...    element and verify by Retrieve operation.
287     [Tags]    not-implemented    exclude
288     TODO
289
290 3.03.16 ACP C/R: priviliges, selfPrivileges attributes: With accessControlAuthenticationFlag element
291     [Documentation]    Create ACP with accessControlAuthenticationFlag element and verify by Retrieve operation.
292     [Tags]    not-implemented    exclude
293     TODO
294
295 3.03.17 ACP U/R: priviliges, selfPrivileges attributes: With accessControlAuthenticationFlag element
296     [Documentation]    Update the accessControlAuthenticationFlag element of ACP resources with/without tested element and verify
297     ...    by Retrieve operation.
298     [Tags]    not-implemented    exclude
299     TODO
300
301 3.03.18 ACP D/R: priviliges, selfPrivileges attributes: With accessControlAuthenticationFlag element
302     [Documentation]    Delete ACP with accessControlAuthenticationFlag element and verify by Retrieve operation.
303     [Tags]    not-implemented    exclude
304     TODO
305
306 3.03.19 ACP C/R: priviliges, selfPrivileges attributes: With invalid accessControlAuthenticationFlag element
307     [Documentation]    NEGTIVE: Create ACP with invalid accessControlAuthenticationFlag element and check error message and
308     ...    verify by Retrieve operation.
309     [Tags]    not-implemented    exclude
310     TODO
311
312 3.03.20 ACP U/R: priviliges, selfPrivileges attributes: With invalid accessControlAuthenticationFlag element
313     [Documentation]    Update the invalid value of accessControlAuthenticationFlag element of ACP resources with/without tested
314     ...    element and verify by Retrieve operation.
315     [Tags]    not-implemented    exclude
316     TODO
317
318 3.03.21 ACP C/R: priviliges, selfPrivileges attributes: With multiple accessControlContext (acco) elements
319     [Documentation]    Create ACP with multiple accessControlContext elements and verify by Retrieve operation.
320     [Tags]    not-implemented    exclude
321     TODO
322
323 3.03.22 ACP U/R: priviliges, selfPrivileges attributes: With multiple accessControlContext (acco) elements
324     [Documentation]    Update ACP with multiple accessControlContext elements and verify by Retrieve operation.
325     [Tags]    not-implemented    exclude
326     TODO
327
328 3.03.23 ACP D/R: priviliges, selfPrivileges attributes: With multiple accessControlContext (acco) elements
329     [Documentation]    Delete ACP with multiple accessControlContext elements and verify by Retrieve operation.
330     [Tags]    not-implemented    exclude
331     TODO
332
333 3.03.24 ACP C/R: priviliges, selfPrivileges attributes: With multiple accessControlRules elements
334     [Documentation]    Create ACP with multiple accessControlRules element and verify by Retrieve operation.
335     [Tags]    not-implemented    exclude
336     TODO
337
338 4.01 ACP C/R: With all mandatory and optional common and specific attributes
339     [Tags]    not-implemented    exclude
340     TODO
341
342 4.02 ACP U(modify)/R: With all mandatory and optional common and specific attributes
343     [Tags]    not-implemented    exclude
344     TODO
345
346 4.03 ACP D/R: With all mandatory and optional common and specific attributes
347     [Tags]    not-implemented    exclude
348     TODO
349
350 4.04 ACP Test Create and Update operations with non-existing attributes and elements
351     [Tags]    not-implemented    exclude
352     # TODO use the approach described in the help file
353     TODO
354
355 5.00 ACP CRUD with all valid RCN values
356     [Documentation]    CRUD operations with all mandatory and optiona common and specific attributes, test all RCN values
357     [Tags]    not-implemented    exclude
358     TODO
359
360
361 *** Keywords ***
362 Connect And Create Resource
363     [Arguments]    ${targetURI}    ${resoutceType}    ${attr}    ${resourceName}=${EMPTY}
364     ${iserver} =    Connect To Iotdm    ${ODL_SYSTEM_1_IP}    ${ODL_RESTCONF_USER}    ${ODL_RESTCONF_PASSWORD}    http
365     ${r} =    Create Resource    ${iserver}    ${targetURI}    ${resoutceType}    ${attr}    ${resourceName}
366     ${status_code} =    Status Code    ${r}
367     Should Be Equal As Integers    ${status_code}    201
368
369 Response Is Correct
370     [Arguments]    ${r}
371     ${text} =    Text    ${r}
372     LOG    ${text}
373     ${json} =    Json    ${r}
374     LOG    ${json}
375     ${status_code} =    Status Code    ${r}
376     Should Be True    199 < ${status_code} < 299
377
378 TODO
379     Fail    "Not implemented"