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 Missing App-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} APP_ID missing parameter
32 1.21 Missing AE-ID should return error
33 [Documentation] when creete AE, Missing AE-ID should return error
34 ${attr} = Set Variable "api":"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} AE_ID missing parameter
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","aei":"ODL"
43 ${r}= Create Resource ${iserver} InCSE1 ${rt_ae} ${attr} AE1
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":"ODL" "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 "aei":"ODL","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 "aei":"ODL","api":"ODL","aei":"ODL1"
162 ${error} = Cannot Update AE Error ${attr}
163 Should Contain ${error} Duplicate key aei
165 3.13 Multiple app-name should return error
166 [Documentation] Multiple app-name should return error
167 ${attr} = Set Variable "aei":"ODL","api":"ODL","apn":"ODL1","apn":"ODL1"
168 ${error} = Cannot Update AE Error ${attr}
169 Should Contain ${error} Duplicate key apn
171 3.14 Multiple label attribute should return error(multiple array)
172 [Documentation] Multiple label attribute should return error(multiple array)
173 ${attr} = Set Variable "aei":"ODL","api":"ODL","lbl":["ODL1"], "lbl":["dsdsd"]
174 ${error} = Cannot Update AE Error ${attr}
175 Should Contain ${error} Duplicate key lbl
177 3.15 Multiple ontologyRef attribute should return error
178 [Documentation] Multiple ontologyRef attribute should return error
179 ${attr} = Set Variable "aei":"ODL","api":"ODL","or":"http://hey/you", "or":"http://hey/you"
180 ${error} = Cannot Update AE Error ${attr}
181 Should Contain ${error} Duplicate key or
183 3.21 Using Container's M attribute to create
184 [Documentation] Using Container's M attribute to create
185 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
186 ${error} = Cannot Update AE Error ${attr}
187 Should Contain ${error} CONTENT(pc)
189 3.22 Using ContentInstance's M attribute to create
190 [Documentation] Using ContentInstance's M attribute to create
191 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
192 ${error} = Cannot Update AE Error ${attr}
193 Should Contain ${error} CONTENT(pc)
194 #------------------------------------------------------
195 # using non-valid attribute to update then expect error
197 3.31 resourceType cannot be update.
198 [Documentation] when update resourceType expext error
199 ${attr} = Set Variable "ty":3
200 ${error} = Cannot Update AE Error ${attr}
201 Should Contain ${error} error
203 3.32 resoureceID cannot be update.
204 [Documentation] when update resourceId expect error
205 ${attr} = Set Variable "ri":"aaa"
206 ${error} = Cannot Update AE Error ${attr}
207 Should Contain ${error} error ri
209 3.33 resouceNme cannot be update.(write once)
210 [Documentation] when update resourceName expect error
211 ${attr} = Set Variable "rn":"aaa"
212 ${error} = Cannot Update AE Error ${attr}
213 Should Contain ${error} error rn
215 3.34 parentID cannot be update.
216 [Documentation] when update parentID expect error
217 ${attr} = Set Variable "pi":"aaa"
218 ${error} = Cannot Update AE Error ${attr}
219 Should Contain ${error} error pi
221 3.35 createTime cannot be update.
222 [Documentation] when update createTime expect error
223 ${attr} = Set Variable "ct":"aaa"
224 ${error} = Cannot Update AE Error ${attr}
225 Should Contain ${error} error ct
227 3.36 app-id cannot be update
228 [Documentation] when update app-id expect error
229 ${attr} = Set Variable "api":"aaa"
230 ${error} = Cannot Update AE Error ${attr}
231 Should Contain ${error} error api
233 3.37 ae-id cannot be updated
234 [Documentation] when update ae-id epxect error
235 ${attr} = Set Variable "aei":"aaa"
236 ${error} = Cannot Update AE Error ${attr}
237 Should Contain ${error} error aei
239 3.38 LastMoifiedTime --- Special, cannot be modified by the user
240 [Documentation] LastMoifiedTime --- Special, cannot be modified by the user
241 ${attr} = Set Variable "lt":"aaa"
242 ${error} = Cannot Update AE Error ${attr}
243 Should Contain ${error} error lt
244 #==================================================
245 # Functional Attribute Test
246 #==================================================
247 # 1. lastModifiedTime
250 4.1 if updated seccessfully, lastModifiedTime must be modified.
251 [Documentation] if updated seccessfully, lastModifiedTime must be modified.
252 ${oldr} = Retrieve Resource ${iserver} InCSE1/AE1
253 ${text} = Text ${oldr}
255 ${lt1} = LastModifiedTime ${oldr}
256 ${attr} = Set Variable "lbl":["aaa"]
258 # We know Beryllium is going to be get rid of all sleep.
259 # But as lastModifiedTime has precision in seconds,
260 # we need to wait 1 second to see different value on update.
261 ${r} = update Resource ${iserver} InCSE1/AE1 ${rt_ae} ${attr}
264 ${lt2} = LastModifiedTime ${r}
265 Should Not Be Equal ${oldr.json()['lt']} ${lt2}
268 [Documentation] check parentID whether it is correct
269 ${oldr} = Retrieve Resource ${iserver} InCSE1
270 ${CSEID} = Set Variable ${oldr.json()['ri']}
271 ${r} = Retrieve Resource ${iserver} InCSE1/AE1
272 Should Be Equal ${oldr.json()['ri']} ${r.json()['pi']}
273 #==================================================
275 #==================================================
278 Update And Retrieve AE
280 ${r} = update Resource ${iserver} InCSE1/AE1 ${rt_ae} ${attr}
283 ${rr} = Retrieve Resource ${iserver} InCSE1/AE1
288 Cannot Update AE Error
290 ${error} = Run Keyword And Expect Error * Update Resource ${iserver} InCSE1/AE1 ${rt_ae}
292 Should Start with ${error} Cannot update this resource [400]