2 Suite Teardown Kill The Tree ${ODL_SYSTEM_IP} InCSE1 admin admin
3 Library ../../../libraries/criotdm.py
7 ${httphost} ${ODL_SYSTEM_IP}
12 ${rt_contentInstance} 4
16 [Documentation] set a suite variable ${iserver}
17 ${iserver} = Connect To Iotdm ${httphost} ${httpuser} ${httppass} http
18 Set Suite Variable ${iserver}
19 #==================================================
20 # AE Mandatory Attribute Test
21 #==================================================
22 # For Creation, there are only 2 mandatory attribute: App-ID(api), AE-ID(aei)
24 1.11 If include AE-ID should return error
25 [Documentation] when create AE, Missing App-ID should return error
26 ${attr} = Set Variable "aei":"ODL"
27 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1 ${rt_ae}
29 Should Start with ${error} Cannot create this resource [400]
30 Should Contain ${error} AE_ID
32 1.21 Missing App-ID should return error
33 [Documentation] when creete AE, Missing AE-ID should return error
34 ${attr} = Set Variable "apn":"ODL"
35 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1 ${rt_ae}
37 Should Start with ${error} Cannot create this resource [400]
38 Should Contain ${error} APP_ID
40 1.3 After Created, test whether all the mandatory attribtues are exist.
41 [Documentation] mandatory attributes should be there after created
42 ${attr} = Set Variable "api":"ODL","rr":true,"rn":"AE1"
43 ${r}= Create Resource ${iserver} InCSE1 ${rt_ae} ${attr}
44 ${status_code} = Status Code ${r}
45 Should Be Equal As Integers ${status_code} 201
47 Should Contain ${text} "ri": "rn": "api":"ODL"
48 Should Contain ${text} "aei": "lt": "pi":
49 Should Contain ${text} "ct": "rty":2
50 Should Not Contain S{text} "lbl" "apn" "or"
51 # 1.13 if Child Container updated, parent Last Modified time will be updated?
52 # 1.14 if Child Container's child updated, parent Last Modified time will not be updated?
53 # support rcn(support change URI in python library)
54 #==================================================
55 # AE Optional Attribute Test (Allowed)
56 #==================================================
57 # update(create)--> update(modified)-->update (delete)
59 2.11 appName can be created through update (0-1)
60 [Documentation] appName can be created through update (0-1)
61 ${attr} = Set Variable "apn":"abcd"
62 ${text} = Update And Retrieve AE ${attr}
63 Should Contain ${text} apn abcd
65 2.12 appName can be modified (1-1)
66 [Documentation] appName can be modified (1-1)
67 ${attr} = Set Variable "apn":"dbac"
68 ${text} = Update And Retrieve AE ${attr}
69 Should Not Contain ${text} abcd
70 Should Contain ${text} apn dbac
72 2.13 if set to null, appName should be deleted
73 [Documentation] if set to null, appName should be deleted
74 ${attr} = Set Variable "apn":null
75 ${text} = Update And Retrieve AE ${attr}
76 Should Not Contain ${text} apn abcd dbac
78 2.21 ontologyRef can be created through update (0-1)
79 [Documentation] ontologyRef can be created through update (0-1)
80 ${attr} = Set Variable "or":"abcd"
81 ${text} = Update And Retrieve AE ${attr}
82 Should Contain ${text} or abcd
84 2.22 ontologyRef can be modified (1-1)
85 [Documentation] ontologyRef can be modified (1-1)
86 ${attr} = Set Variable "or":"dbac"
87 ${text} = Update And Retrieve AE ${attr}
88 Should Not Contain ${text} abcd
89 Should Contain ${text} or dbac
91 2.23 if set to null, ontologyRef should be deleted
92 [Documentation] if set to null, ontologyRef should be deleted
93 ${attr} = Set Variable "or":null
94 ${text} = Update And Retrieve AE ${attr}
95 Should Not Contain ${text} or abcd dbac
97 2.31 labels can be created through update (0-1)
98 [Documentation] labels can be created through update (0-1)
99 ${attr} = Set Variable "lbl":["label1"]
100 ${text} = Update And Retrieve AE ${attr}
101 Should Contain ${text} lbl label1
103 2.32 labels can be modified (1-1)
104 [Documentation] labels can be modified (1-1)
105 ${attr} = Set Variable "lbl":["label2"]
106 ${text} = Update And Retrieve AE ${attr}
107 Should Not Contain ${text} label1
108 Should Contain ${text} lbl label2
110 2.33 if set to null, labels should be deleted(1-0)
111 [Documentation] if set to null, labels should be deleted(1-0)
112 ${attr} = Set Variable "lbl":null
113 ${text} = Update And Retrieve AE ${attr}
114 Should Not Contain ${text} lbl label1 label2
116 2.34 labels can be created through update (0-n)
117 [Documentation] labels can be created through update (0-n)
118 ${attr} = Set Variable "lbl":["label3","label4","label5"]
119 ${text} = Update And Retrieve AE ${attr}
120 Should Contain ${text} lbl label3 label4
121 Should Contain ${text} label5
123 2.35 labels can be modified (n-n)(across)
124 [Documentation] labels can be modified (n-n)(across)
125 ${attr} = Set Variable "lbl":["label4","label5","label6"]
126 ${text} = Update And Retrieve AE ${attr}
127 Should Not Contain ${text} label1 label2 label3
128 Should Contain ${text} lbl label4 label5
129 Should Contain ${text} label6
131 2.36 labels can be modified (n-n)(not across)
132 [Documentation] labels can be modified (n-n)(not across)
133 ${attr} = Set Variable "lbl":["label7","label8","label9"]
134 ${text} = Update And Retrieve AE ${attr}
135 Should Not Contain ${text} label1 label2 label3
136 Should Not Contain ${text} label6 label4 label5
137 Should Contain ${text} lbl label7 label8
138 Should Contain ${text} label9
140 2.37 if set to null, labels should be deleted(n-0)
141 [Documentation] if set to null, labels should be deleted(n-0)
142 ${attr} = Set Variable "lbl":null
143 ${text} = Update And Retrieve AE ${attr}
144 Should Not Contain ${text} label1 label2 label3
145 Should Not Contain ${text} label6 label4 label5
146 Should Not Contain ${text} label7 label8 label9
147 Should Not Contain ${text} lbl
148 #======================================================
149 # AE Disturbing Attribute Test, Not Allowed Update
150 #======================================================
151 # using non-valid attribtue to create then expext error
153 3.11 Mulitiple App-ID should return error
154 [Documentation] Mulitiple App-ID should return error
155 ${attr} = Set Variable "api":"ODL","api":"ODL2"
156 ${error} = Cannot Update AE Error ${attr}
157 Should Contain ${error} Duplicate key api
159 3.12 Mulitiple AE-ID should return error
160 [Documentation] Mulitiple AE-ID should return error
161 ${attr} = Set Variable "api":"ODL","aei":"ODL1"
162 ${error} = Cannot Update AE Error ${attr}
164 3.13 Multiple app-name should return error
165 [Documentation] Multiple app-name should return error
166 ${attr} = Set Variable "api":"ODL","apn":"ODL1","apn":"ODL1"
167 ${error} = Cannot Update AE Error ${attr}
168 Should Contain ${error} Duplicate key apn
170 3.14 Multiple label attribute should return error(multiple array)
171 [Documentation] Multiple label attribute should return error(multiple array)
172 ${attr} = Set Variable "api":"ODL","lbl":["ODL1"], "lbl":["dsdsd"]
173 ${error} = Cannot Update AE Error ${attr}
174 Should Contain ${error} Duplicate key lbl
176 3.15 Multiple ontologyRef attribute should return error
177 [Documentation] Multiple ontologyRef attribute should return error
178 ${attr} = Set Variable "api":"ODL","or":"http://hey/you", "or":"http://hey/you"
179 ${error} = Cannot Update AE Error ${attr}
180 Should Contain ${error} Duplicate key or
182 3.21 Using Container's M attribute to create
183 [Documentation] Using Container's M attribute to create
184 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
185 ${error} = Cannot Update AE Error ${attr}
186 Should Contain ${error} CONTENT(pc)
188 3.22 Using ContentInstance's M attribute to create
189 [Documentation] Using ContentInstance's M attribute to create
190 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
191 ${error} = Cannot Update AE Error ${attr}
192 Should Contain ${error} CONTENT(pc)
193 #------------------------------------------------------
194 # using non-valid attribute to update then expect error
196 3.31 resourceType cannot be update.
197 [Documentation] when update resourceType expext error
198 ${attr} = Set Variable "ty":3
199 ${error} = Cannot Update AE Error ${attr}
200 Should Contain ${error} error
202 3.32 resoureceID cannot be update.
203 [Documentation] when update resourceId expect error
204 ${attr} = Set Variable "ri":"aaa"
205 ${error} = Cannot Update AE Error ${attr}
206 Should Contain ${error} error ri
208 3.33 resouceNme cannot be update.(write once)
209 [Documentation] when update resourceName expect error
210 ${attr} = Set Variable "rn":"aaa"
211 ${error} = Cannot Update AE Error ${attr}
212 Should Contain ${error} error rn
214 3.34 parentID cannot be update.
215 [Documentation] when update parentID expect error
216 ${attr} = Set Variable "pi":"aaa"
217 ${error} = Cannot Update AE Error ${attr}
218 Should Contain ${error} error pi
220 3.35 createTime cannot be update.
221 [Documentation] when update createTime expect error
222 ${attr} = Set Variable "ct":"aaa"
223 ${error} = Cannot Update AE Error ${attr}
224 Should Contain ${error} error ct
226 3.36 app-id cannot be update
227 [Documentation] when update app-id expect error
228 ${attr} = Set Variable "api":"aaa"
229 ${error} = Cannot Update AE Error ${attr}
230 Should Contain ${error} error api
232 3.37 ae-id cannot be updated
233 [Documentation] when update ae-id epxect error
234 ${attr} = Set Variable "aei":"aaa"
235 ${error} = Cannot Update AE Error ${attr}
236 Should Contain ${error} error aei
238 3.38 LastMoifiedTime --- Special, cannot be modified by the user
239 [Documentation] LastMoifiedTime --- Special, cannot be modified by the user
240 ${attr} = Set Variable "lt":"aaa"
241 ${error} = Cannot Update AE Error ${attr}
242 Should Contain ${error} error lt
243 #==================================================
244 # Functional Attribute Test
245 #==================================================
246 # 1. lastModifiedTime
249 4.1 if updated seccessfully, lastModifiedTime must be modified.
250 [Documentation] if updated seccessfully, lastModifiedTime must be modified.
251 ${oldr} = Retrieve Resource ${iserver} InCSE1/AE1
252 ${lt1} = LastModifiedTime ${oldr}
253 ${attr} = Set Variable "lbl":["aaa"]
255 # We know Beryllium is going to be get rid of all sleep.
256 # But as lastModifiedTime has precision in seconds,
257 # we need to wait 1 second to see different value on update.
258 ${r} = update Resource ${iserver} InCSE1/AE1 ${rt_ae} ${attr}
259 ${lt2} = LastModifiedTime ${r}
260 Should Not Be Equal ${lt1} ${lt2}
263 [Documentation] check parentID whether it is correct
264 ${oldr} = Retrieve Resource ${iserver} InCSE1
265 ${CSEID} = Set Variable ${oldr.json()['m2m:cb']['ri']}
266 ${r} = Retrieve Resource ${iserver} InCSE1/AE1
267 Should Be Equal /InCSE1/${oldr.json()['m2m:cb']['ri']} ${r.json()['m2m:ae']['pi']}
268 #==================================================
270 #==================================================
273 Update And Retrieve AE
275 ${r} = update Resource ${iserver} InCSE1/AE1 ${rt_ae} ${attr}
278 ${rr} = Retrieve Resource ${iserver} InCSE1/AE1
283 Cannot Update AE Error
285 ${error} = Run Keyword And Expect Error * Update Resource ${iserver} InCSE1/AE1 ${rt_ae}
287 Should Start with ${error} Cannot update this resource [400]