2 Documentation Test for hierarchy of resources: AE/CONTAINER/CONTENTINSTANCE
4 Resource ../../../libraries/SubStrings.robot
5 Library ../../../libraries/IoTDM/criotdm.py
7 Resource ../../../variables/Variables.robot
8 Resource ../../../libraries/IoTDM/IoTDMKeywords.robot
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
17 ${rt_contentInstance} 4
21 1.11 Valid Input for AE without name
22 [Documentation] Valid Input for AE without name
23 ${attr} = Set Variable "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
24 ${r} = Create Resource ${iserver} InCSE1 ${rt_ae} ${attr}
25 Response Is Correct ${r}
27 1.12 Valid Input for AE with name
28 ${attr} = Set Variable "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"ODL3"
29 ${r} = Create Resource ${iserver} InCSE1 ${rt_ae} ${attr}
30 Response Is Correct ${r}
32 1.13 Invalid Input for AE with name Already Exist, should return error
33 [Documentation] Invalid Input for AE with name Already Exist, should return error
34 ${attr} = Set Variable "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"ODL3"
35 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1 ${rt_ae}
37 Should Start with ${error} Cannot create this resource [409]
39 1.14 Invalid Input for AE (AE cannot be created under AE)
40 [Documentation] Invalid Input for AE (AE cannot be created under AE), expect error
41 ${attr} = Set Variable "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"ODL4"
42 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/ODL3 ${rt_ae}
44 Should Start with ${error} Cannot create this resource [405]
45 # ----------------- Update and Retrieve -------------
47 1.15 Valid Update AE's label
48 [Documentation] Valid Update AE's label
49 ${attr} = Set Variable "lbl":["aaa","bbb","ccc"]
50 ${r} = Update Resource ${iserver} InCSE1/ODL3 ${rt_ae} ${attr}
51 Response Is Correct ${r}
52 # Retrieve and test the lbl
53 ${r} = Retrieve Resource ${iserver} InCSE1/ODL3
54 Should Contain All Sub Strings ${r.text} "aaa" "bbb" "ccc"
55 #==================================================
57 #==================================================
59 2.11 Create Container without name under AE
60 [Documentation] Create Container under AE without name
61 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
62 Connect And Create Resource InCSE1/ODL3 ${rt_container} ${attr}
64 2.12 Create Container with name under AE
65 [Documentation] Create Container Under AE with name containerUnderAE and retrieve it to check if it is created
66 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderAE"
67 ${r} = Create Resource ${iserver} /InCSE1/ODL3 ${rt_container} ${attr}
68 ${container} = Location ${r}
69 Response Is Correct ${r}
71 ${result} = Retrieve Resource ${iserver} ${container}
72 Should Contain ${result.text} containerUnderAE
74 2.13 Invalid Input for Container Under AE with name (Already exist)
75 [Documentation] Invalid Input for Container Under AE with name (Already exist)
76 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderAE"
77 ${error} = Run Keyword And Expect Error
79 ... Connect And Create Resource
83 Should Start with ${error} Cannot create this resource [409]
85 2.14 Update Container Label
86 [Documentation] Update Label to ["aaa","bbb","ccc"]
87 ${attr} = Set Variable "lbl":["aaa","bbb","ccc"]
88 ${r} = Update Resource ${iserver} InCSE1/ODL3/containerUnderAE ${rt_container} ${attr}
89 Response Is Correct ${r}
90 # Retrieve and test the lbl
91 ${r} = Retrieve Resource ${iserver} InCSE1/ODL3/containerUnderAE
92 Should Contain All Sub Strings ${r.text} "aaa" "bbb" "ccc"
93 #----------------------------------------------------------------------
95 2.21 Create Container under InCSE1 without name
96 [Documentation] Create Container under InCSE1 without name
97 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
98 ${r} = Create Resource ${iserver} InCSE1 ${rt_container} ${attr}
99 Response Is Correct ${r}
101 2.22 Create Container under CSE with name
102 [Documentation] Create Container under CSE with name
103 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderCSE"
104 ${r} = Create Resource ${iserver} InCSE1 ${rt_container} ${attr}
105 Response Is Correct ${r}
107 ${result} = Retrieve Resource ${iserver} InCSE1/containerUnderCSE
108 Should Contain ${result.text} containerUnderCSE
110 2.23 Invalid Input for Container Under CSE with name (Already exist)
111 [Documentation] Invalid Input for Container Under CSE with name (Already exist)
112 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderCSE"
113 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1 ${rt_container}
115 Should Start with ${error} Cannot create this resource [409]
117 2.24 Update Container Label
118 [Documentation] Update Container Label
119 ${attr} = Set Variable "lbl":["aaa","bbb","ccc"]
120 ${r} = Update Resource ${iserver} InCSE1/containerUnderCSE ${rt_container} ${attr}
121 Response Is Correct ${r}
122 # Retrieve and test the lbl
123 ${r} = Retrieve Resource ${iserver} InCSE1/containerUnderCSE
124 Should Contain All Sub Strings ${r.text} "aaa" "bbb" "ccc"
125 #----------------------------------------------------------------------
127 2.31 Create Container under Container without name
128 [Documentation] Create Container under Container without name
129 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
130 ${r} = Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_container} ${attr}
131 Response Is Correct ${r}
133 2.32 Create Container under Container with name
134 [Documentation] Create Container under Container with name
135 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderContainer"
136 ${r} = Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_container} ${attr}
137 ${container} = Location ${r}
138 Response Is Correct ${r}
140 ${result} = Retrieve Resource ${iserver} ${container}
141 Should Contain ${result.text} containerUnderContainer
143 2.33 Invalid Input for Container Under Container with name (Already exist)
144 [Documentation] Invalid Input for Container Under Container with name (Already exist)
145 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you","rn":"containerUnderContainer"
146 ${error} = Run Keyword And Expect Error
150 ... InCSE1/containerUnderCSE
153 Should Start with ${error} Cannot create this resource [409]
155 2.34 Update Container Label
156 [Documentation] Update Container Label to ["aaa","bbb","ccc"]
157 ${attr} = Set Variable "lbl":["aaa","bbb","ccc"]
158 ${r} = Update Resource
160 ... InCSE1/containerUnderCSE/containerUnderContainer
163 Response Is Correct ${r}
164 # Retrieve and test the lbl
165 ${r} = Retrieve Resource ${iserver} InCSE1/containerUnderCSE/containerUnderContainer
166 Should Contain All Sub Strings ${r.text} "aaa" "bbb" "ccc"
168 2.41 Invalid Input for AE under container with name(mess up layer)
169 [Documentation] Invalid Input for AE under container withoutname(mess up layer)
170 ${attr} = Set Variable "api":"jb","apn":"jb2","or":"http://hey/you","rr":true,"rn":"ODL4"
171 ${error} = Run Keyword And Expect Error
175 ... InCSE1/containerUnderCSE
178 Should Start with ${error} Cannot create this resource [405]
179 Should Contain ${error} Cannot create AE under this resource type: 3
180 #==================================================
181 # ContentInstance Test
182 #==================================================
184 3.11 Valid contentInstance under CSEBase/container without name
185 [Documentation] Valid contentInstance under CSEBase/container without name
186 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
187 ${r} = Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_contentInstance} ${attr}
188 Response Is Correct ${r}
190 3.12 Valid contentInstance under CSEBase/container with name
191 [Documentation] Valid contentInstance under CSEBase/container with name
192 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"102","rn":"conIn1"
193 ${r} = Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_contentInstance} ${attr}
194 Response Is Correct ${r}
196 3.13 Invalid contentInstance under CSEBase
197 [Documentation] Invalid contentInstance under CSEBase
198 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
199 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1 ${rt_contentInstance}
201 Should Start with ${error} Cannot create this resource [405]
202 Should Contain ${error} Cannot create ContentInstance under this resource type: 5
204 3.14 Invalid contentInstance under AE
205 [Documentation] Invalid contentInstance under AE
206 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
207 ${error} = Run Keyword And Expect Error
212 ... ${rt_contentInstance}
214 Should Start with ${error} Cannot create this resource [405]
215 Should Contain ${error} Cannot create ContentInstance under this resource type: 2
217 3.15 Invalid contentInstance under contentInstance
218 [Documentation] Invalid contentInstance under contentInstance
219 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
220 ${error} = Run Keyword And Expect Error
224 ... InCSE1/containerUnderCSE/conIn1
225 ... ${rt_contentInstance}
227 Should Start with ${error} Cannot create this resource [405]
228 Should Contain ${error} Cannot create ContentInstance under this resource type: 4
230 3.16 Invalid AE under contentInstance
231 [Documentation] Invalid AE under contentInstance
232 ${attr} = Set Variable "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
233 ${error} = Run Keyword And Expect Error
237 ... InCSE1/containerUnderCSE/conIn1
240 Should Start with ${error} Cannot create this resource [405]
241 Should Contain ${error} Cannot create AE under this resource type: 4
243 3.17 Invalid container under contentInstance
244 [Documentation] Invalid container under contentInstance
245 ${attr} = Set Variable "cr":null,"lbl":["aaa","bbb","ccc"]
246 ${error} = Run Keyword And Expect Error
250 ... InCSE1/containerUnderCSE/conIn1
253 Should Start with ${error} Cannot create this resource [405]
254 Should Contain ${error} Cannot create Container under this resource type: 4
255 #==================================================
257 #==================================================
259 4.11 Delete AE without child resource
260 [Documentation] Delete AE without child resource
261 ${attr} = Set Variable "api":"jb","apn":"jb2","or":"http://hey/you","rr":true
262 ${r} = Create Resource ${iserver} InCSE1 ${rt_ae} ${attr},"rn":"AeName"
263 ${ae} = Location ${r}
264 Response Is Correct ${r}
265 ${deleteRes} = Delete Resource ${iserver} ${ae}
266 ${status_code} = Status Code ${deleteRes}
267 Should Be Equal As Integers ${status_code} 200
268 # Delete AE that does not exist/has been deleted should return error
269 ${error} = Run Keyword And Expect Error * Delete Resource ${iserver} ${ae}
270 Should Start with ${error} Cannot delete this resource [404]
272 4.12 Delete Container without child resource
273 [Documentation] Delete Container without child resource
274 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
275 ${r} = Create Resource ${iserver} InCSE1/ODL3 ${rt_container} ${attr}
276 ${container} = Location ${r}
277 Response Is Correct ${r}
278 ${deleteRes} = Delete Resource ${iserver} ${container}
279 ${status_code} = Status Code ${deleteRes}
280 Should Be Equal As Integers ${status_code} 200
281 # Delete container that does not exist/has been deleted should return error
282 ${error} = Run Keyword And Expect Error * Delete Resource ${iserver} ${container}
283 Should Start with ${error} Cannot delete this resource [404]
285 Delete the Container Under CSEBase
286 [Documentation] Delete the Container and AE Under CSEBase
287 ${deleteRes} = Delete Resource ${iserver} InCSE1/containerUnderCSE
288 ${status_code} = Status Code ${deleteRes}
289 Should Be Equal As Integers ${status_code} 200
290 ${deleteRes} = Delete Resource ${iserver} InCSE1/ODL3
291 ${status_code} = Status Code ${deleteRes}
292 Should Be Equal As Integers ${status_code} 200
296 Connect And Create Resource
297 [Arguments] ${targetURI} ${resoutceType} ${attr}
298 ${iserver} = Connect To Iotdm ${ODL_SYSTEM_1_IP} ${ODL_RESTCONF_USER} ${ODL_RESTCONF_PASSWORD} http
299 ${r} = Create Resource ${iserver} ${targetURI} ${resoutceType} ${attr}
300 ${container} = Resid ${r}
301 ${status_code} = Status Code ${r}
302 Should Be Equal As Integers ${status_code} 201
306 ${status_code} = Status Code ${r}
307 Should Be True 199 < ${status_code} < 299