2 Documentation Test for layers AE/CONTAINER/CONTENTINSTANCE
3 Suite Teardown Kill The Tree ${ODL_SYSTEM_IP} InCSE1 admin admin
4 Library ../../../libraries/criotdm.py
8 ${httphost} ${ODL_SYSTEM_IP}
13 ${rt_contentInstance} 4
17 [Documentation] set a suite variable ${iserver}
18 #==================================================
20 #==================================================
21 ${iserver} = Connect To Iotdm ${httphost} ${httpuser} ${httppass} http
22 Set Suite Variable ${iserver}
24 1.11 Valid Input for AE without name
25 [Documentation] Valid Input for AE without name
26 ${attr} = Set Variable "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
27 ${r} = Create Resource ${iserver} InCSE1 ${rt_ae} ${attr}
28 Response Is Correct ${r}
30 1.12 Valid Input for AE with name
31 ${attr} = Set Variable "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
32 ${r} = Create Resource ${iserver} InCSE1 ${rt_ae} ${attr} ODL3
33 Response Is Correct ${r}
35 1.13 Invalid Input for AE with name Already Exist, should return error
36 [Documentation] Invalid Input for AE with name Already Exist, should return error
37 ${attr} = Set Variable "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
38 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1 ${rt_ae}
40 Should Start with ${error} Cannot create this resource [409]
42 1.14 Invalid Input for AE (AE cannot be created under AE)
43 [Documentation] Invalid Input for AE (AE cannot be created under AE), expect error
44 ${attr} = Set Variable "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
45 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/ODL3 ${rt_ae}
47 Should Start with ${error} Cannot create this resource [405]
48 # ----------------- Update and Retrieve -------------
50 1.15 Valid Update AE's label
51 [Documentation] Valid Update AE's label
52 ${attr} = Set Variable "lbl":["aaa","bbb","ccc"]
53 ${r} = Update Resource ${iserver} InCSE1/ODL3 2 ${attr}
55 Response Is Correct ${r}
56 # Retrieve and test the lbl
57 ${r} = Retrieve Resource ${iserver} ${ae}
59 Should Contain ${Json} "aaa" "bbb" "ccc"
60 Should Contain ${r.json()['lbl']} aaa bbb ccc
61 #==================================================
63 #==================================================
65 2.11 Create Container under AE without name
66 [Documentation] Create Container under AE without name
67 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
68 Connect And Create Resource InCSE1/ODL3 ${rt_container} ${attr}
70 2.12 Create Container under AE with name
71 [Documentation] Invalid Input for Container Under AE with name (Already exist)
72 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
73 ${r} = Create Resource ${iserver} InCSE1/ODL3 ${rt_container} ${attr} containerUnderAE
74 ${container} = Name ${r}
75 Response Is Correct ${r}
77 ${result} = Retrieve Resource ${iserver} ${container}
78 ${text} = Text ${result}
79 Should Contain ${text} "containerUnderAE"
81 2.13 Invalid Input for Container Under AE with name (Already exist)
82 [Documentation] Invalid Input for Container Under AE with name (Already exist)
83 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
84 ${error} = Run Keyword And Expect Error * Connect And Create Resource InCSE1/ODL3 ${rt_container} ${attr}
86 Should Start with ${error} Cannot create this resource [409]
88 2.14 Update Container Label
89 [Documentation] Update Label to ["aaa","bbb","ccc"]
90 ${attr} = Set Variable "lbl":["aaa","bbb","ccc"]
91 ${r} = Update Resource ${iserver} InCSE1/ODL3/containerUnderAE ${rt_container} ${attr}
92 ${container} = Name ${r}
93 Response Is Correct ${r}
94 # Retrieve and test the lbl
95 ${r} = Retrieve Resource ${iserver} ${container}
97 Should Contain ${Json} "aaa" "bbb" "ccc"
98 Should Contain ${r.json()['lbl']} aaa bbb ccc
99 #----------------------------------------------------------------------
101 2.21 Create Container under InCSE1 without name
102 [Documentation] Create Container under InCSE1 without name
103 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
104 ${r} = Create Resource ${iserver} InCSE1 ${rt_container} ${attr}
105 Response Is Correct ${r}
107 2.22 Create Container under CSE with name
108 [Documentation] Create Container under CSE with name
109 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
110 ${r} = Create Resource ${iserver} InCSE1 ${rt_container} ${attr} containerUnderCSE
111 Response Is Correct ${r}
113 ${result} = Retrieve Resource ${iserver} InCSE1/containerUnderCSE
114 ${text} = Text ${result}
115 Should Contain ${text} "contaienrUnderCSE"
117 2.23 Invalid Input for Container Under CSE with name (Already exist)
118 [Documentation] Invalid Input for Container Under CSE with name (Already exist)
119 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
120 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1 ${rt_container}
121 ... ${attr} containerUnderCSE
122 Should Start with ${error} Cannot create this resource [409]
124 2.24 Update Container Label
125 [Documentation] Update Container Label
126 ${attr} = Set Variable "lbl":["aaa","bbb","ccc"]
127 ${r} = Update Resource ${iserver} InCSE1/containerUnderCSE ${rt_container} ${attr}
128 ${container} = Name ${r}
129 Response Is Correct ${r}
130 # Retrieve and test the lbl
131 ${r} = Retrieve Resource ${iserver} ${container}
133 Should Contain ${Json} "aaa" "bbb" "ccc"
134 Should Contain ${r.json()['lbl']} aaa bbb ccc
135 #----------------------------------------------------------------------
137 2.31 Create Container under Container without name
138 [Documentation] Create Container under Container without name
139 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
140 ${r} = Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_container} ${attr}
141 Response Is Correct ${r}
143 2.32 Create Container under Container with name
144 [Documentation] Create Container under Container with name
145 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
146 ${r} = Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_container} ${attr} containerUnderContainer
147 ${container} = Name ${r}
148 Response Is Correct ${r}
150 ${result} = Retrieve Resource ${iserver} ${container}
151 ${text} = Text ${result}
152 Should Contain ${text} "containerUnderContainer"
154 2.33 Invalid Input for Container Under Container with name (Already exist)
155 [Documentation] Invalid Input for Container Under Container with name (Already exist)
156 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
157 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_container}
158 ... ${attr} containerUnderContainer
159 Should Start with ${error} Cannot create this resource [409]
161 2.34 Update Container Label
162 [Documentation] Update Container Label to ["aaa","bbb","ccc"]
163 ${attr} = Set Variable "lbl":["aaa","bbb","ccc"]
164 ${r} = Update Resource ${iserver} InCSE1/containerUnderCSE/containerUnderContainer ${rt_container} ${attr}
165 Response Is Correct ${r}
166 # Retrieve and test the lbl
167 ${r} = Retrieve Resource ${iserver} InCSE1/containerUnderCSE/containerUnderContainer
169 Should Contain ${Json} "aaa" "bbb" "ccc"
170 Should Contain ${r.json()['lbl']} aaa bbb ccc
172 2.41 Invalid Input for AE under container withoutname(mess up layer)
173 [Documentation] Invalid Input for AE under container withoutname(mess up layer)
174 ${attr} = Set Variable "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
175 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_ae}
177 Should Start with ${error} Cannot create this resource [405]
178 Should Contain ${error} Cannot create AE under this resource type: 3
179 #==================================================
180 # ContentInstance Test
181 #==================================================
183 3.11 Valid contentInstance under CSEBase/container without name
184 [Documentation] Valid contentInstance under CSEBase/container without name
185 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
186 ${r} = Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_contentInstance} ${attr}
187 Response Is Correct ${r}
189 3.12 Valid contentInstance under CSEBase/container with name
190 [Documentation] Valid contentInstance under CSEBase/container with name
191 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"102"
192 ${r} = Create Resource ${iserver} InCSE1/containerUnderCSE ${rt_contentInstance} ${attr} conIn1
193 Response Is Correct ${r}
195 3.13 Invalid contentInstance under CSEBase
196 [Documentation] Invalid contentInstance under CSEBase
197 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
198 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1 ${rt_contentInstance}
200 Should Start with ${error} Cannot create this resource [405]
201 Should Contain ${error} Cannot create ContentInstance under this resource type: 5
203 3.14 Invalid contentInstance under AE
204 [Documentation] Invalid contentInstance under AE
205 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
206 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/ODL3 ${rt_contentInstance}
208 Should Start with ${error} Cannot create this resource [405]
209 Should Contain ${error} Cannot create ContentInstance under this resource type: 2
211 3.15 Invalid contentInstance under contentInstance
212 [Documentation] Invalid contentInstance under contentInstance
213 ${attr} = Set Variable "cnf": "1","or": "http://hey/you","con":"101"
214 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/containerUnderCSE/conIn1 ${rt_contentInstance}
216 Should Start with ${error} Cannot create this resource [405]
217 Should Contain ${error} Cannot create ContentInstance under this resource type: 4
219 3.16 Invalid AE under contentInstance
220 [Documentation] Invalid AE under contentInstance
221 ${attr} = Set Variable "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
222 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/containerUnderCSE/conIn1 ${rt_ae}
224 Should Start with ${error} Cannot create this resource [405]
225 Should Contain ${error} Cannot create AE under this resource type: 4
227 3.17 Invalid container under contentInstance
228 [Documentation] Invalid container under contentInstance
229 ${attr} = Set Variable "cr":null,"lbl":["aaa","bbb","ccc"]
230 ${error} = Run Keyword And Expect Error * Create Resource ${iserver} InCSE1/containerUnderCSE/conIn1 ${rt_container}
232 Should Start with ${error} Cannot create this resource [405]
233 Should Contain ${error} Cannot create Container under this resource type: 4
234 #==================================================
236 #==================================================
238 4.11 Delete AE without child resource
239 [Documentation] Delete AE without child resource
240 ${attr} = Set Variable "aei":"ODL","api":"jb","apn":"jb2","or":"http://hey/you"
241 ${r} = Create Resource ${iserver} InCSE1 ${rt_ae} ${attr}
243 Response Is Correct ${r}
244 ${deleteRes} = Delete Resource ${iserver} ${ae}
245 ${status_code} = Status Code ${deleteRes}
246 Should Be Equal As Integers ${status_code} 200
247 # Delete AE that does not exist/has been deleted should return error
248 ${error} = Run Keyword And Expect Error * Delete Resource ${iserver} ${ae}
249 Should Start with ${error} Cannot delete this resource [404]
251 4.12 Delete Container without child resource
252 [Documentation] Delete Container without child resource
253 ${attr} = Set Variable "cr":null,"mni":1,"mbs":15,"or":"http://hey/you"
254 ${r} = Create Resource ${iserver} InCSE1/ODL3 ${rt_container} ${attr}
255 ${container} = Name ${r}
256 Response Is Correct ${r}
257 ${deleteRes} = Delete Resource ${iserver} ${container}
258 ${status_code} = Status Code ${deleteRes}
259 Should Be Equal As Integers ${status_code} 200
260 # Delete container that does not exist/has been deleted should return error
261 ${error} = Run Keyword And Expect Error * Delete Resource ${iserver} ${container}
262 Should Start with ${error} Cannot delete this resource [404]
264 Delete the Container Under CSEBase
265 [Documentation] Delete the Container and AE Under CSEBase
266 ${deleteRes} = Delete Resource ${iserver} InCSE1/containerUnderCSE
267 ${deleteRes} = Delete Resource ${iserver} InCSE1/ODL3
270 Connect And Create Resource
271 [Arguments] ${targetURI} ${resoutceType} ${attr} ${resourceName}=${EMPTY}
272 ${iserver} = Connect To Iotdm ${httphost} ${httpuser} ${httppass} http
273 ${r} = Create Resource ${iserver} ${targetURI} ${resoutceType} ${attr} ${resourceName}
274 ${container} = Name ${r}
275 ${status_code} = Status Code ${r}
276 Should Be Equal As Integers ${status_code} 201
280 ${status_code} = Status Code ${r}
281 Should Be True 199 < ${status_code} < 299