2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.common;
23 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
24 import static com.github.tomakehurst.wiremock.client.WireMock.get;
25 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
26 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
28 public class MockAAIGenericVnfSearch {
30 private static final String EOL = "\n";
32 public MockAAIGenericVnfSearch(){
35 // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
37 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
38 .willReturn(aResponse()
40 .withHeader("Content-Type", "text/xml")
41 .withBodyFile("aaiFault.xml")));
43 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
44 .willReturn(aResponse()
46 .withHeader("Content-Type", "text/xml")
47 .withBody("Generic VNF Not Found")));
48 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
49 .willReturn(aResponse()
51 .withHeader("Content-Type", "text/xml")
52 .withBody("Generic VNF Not Found")));
55 "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
56 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
57 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
58 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
59 " <service-id>SDN-MOBILITY</service-id>" + EOL +
60 " <equipment-role>vMMSC</equipment-role>" + EOL +
61 " <orchestration-status>pending-create</orchestration-status>" + EOL +
62 " <in-maint>false</in-maint>" + EOL +
63 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
64 " <resource-version>1508691</resource-version>" + EOL +
65 " <vf-modules>" + EOL +
66 " <vf-module>" + EOL +
67 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
68 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
69 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
70 " <persona-model-version>1.0</persona-model-version>" + EOL +
71 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
72 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
73 " <orchestration-status>pending-create</orchestration-status>" + EOL +
74 " <resource-version>1508692</resource-version>" + EOL +
75 " </vf-module>" + EOL +
76 " </vf-modules>" + EOL +
77 " <relationship-list/>" + EOL +
78 " <l-interfaces/>" + EOL +
79 " <lag-interfaces/>" + EOL +
80 "</generic-vnf>" + EOL;
81 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
82 .willReturn(aResponse()
84 .withHeader("Content-Type", "text/xml")
86 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
87 .willReturn(aResponse()
89 .withHeader("Content-Type", "text/xml")
93 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
94 " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
95 " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
96 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
97 " <service-id>SDN-MOBILITY</service-id>" + EOL +
98 " <equipment-role>vMMSC</equipment-role>" + EOL +
99 " <orchestration-status>pending-create</orchestration-status>" + EOL +
100 " <in-maint>false</in-maint>" + EOL +
101 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
102 " <resource-version>1508691</resource-version>" + EOL +
103 " <vf-modules>" + EOL +
104 " <vf-module>" + EOL +
105 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
106 " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
107 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
108 " <persona-model-version>1.0</persona-model-version>" + EOL +
109 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
110 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
111 " <orchestration-status>pending-create</orchestration-status>" + EOL +
112 " <resource-version>1508692</resource-version>" + EOL +
113 " </vf-module>" + EOL +
114 " <vf-module>" + EOL +
115 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
116 " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
117 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
118 " <persona-model-version>1.0</persona-model-version>" + EOL +
119 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
120 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
121 " <orchestration-status>pending-create</orchestration-status>" + EOL +
122 " <resource-version>1508692</resource-version>" + EOL +
123 " </vf-module>" + EOL +
124 " </vf-modules>" + EOL +
125 " <relationship-list/>" + EOL +
126 " <l-interfaces/>" + EOL +
127 " <lag-interfaces/>" + EOL +
128 "</generic-vnf>" + EOL;
129 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
130 .willReturn(aResponse()
132 .withHeader("Content-Type", "text/xml")
134 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
135 .willReturn(aResponse()
137 .withHeader("Content-Type", "text/xml")
140 // The following stubs are for DeleteAAIVfModule
142 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
143 .willReturn(aResponse()
145 .withHeader("Content-Type", "text/xml")
146 .withBodyFile("aaiFault.xml")));
148 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
149 .willReturn(aResponse()
151 .withHeader("Content-Type", "text/xml")
152 .withBody("Generic VNF Not Found")));
155 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
156 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
157 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
158 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
159 " <service-id>SDN-MOBILITY</service-id>" + EOL +
160 " <equipment-role>vMMSC</equipment-role>" + EOL +
161 " <orchestration-status>pending-create</orchestration-status>" + EOL +
162 " <in-maint>false</in-maint>" + EOL +
163 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
164 " <resource-version>0000021</resource-version>" + EOL +
165 " <vf-modules>" + EOL +
166 " <vf-module>" + EOL +
167 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
168 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
169 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
170 " <persona-model-version>1.0</persona-model-version>" + EOL +
171 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
172 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
173 " <orchestration-status>pending-create</orchestration-status>" + EOL +
174 " <resource-version>0000073</resource-version>" + EOL +
175 " </vf-module>" + EOL +
176 " </vf-modules>" + EOL +
177 " <relationship-list/>" + EOL +
178 " <l-interfaces/>" + EOL +
179 " <lag-interfaces/>" + EOL +
180 "</generic-vnf>" + EOL;
181 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
182 .willReturn(aResponse()
184 .withHeader("Content-Type", "text/xml")
188 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
189 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
190 " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
191 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
192 " <service-id>SDN-MOBILITY</service-id>" + EOL +
193 " <equipment-role>vMMSC</equipment-role>" + EOL +
194 " <orchestration-status>pending-create</orchestration-status>" + EOL +
195 " <in-maint>false</in-maint>" + EOL +
196 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
197 " <resource-version>0000020</resource-version>" + EOL +
198 " <vf-modules>" + EOL +
199 " <vf-module>" + EOL +
200 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
201 " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
202 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
203 " <persona-model-version>1.0</persona-model-version>" + EOL +
204 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
205 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
206 " <orchestration-status>pending-create</orchestration-status>" + EOL +
207 " <resource-version>0000074</resource-version>" + EOL +
208 " </vf-module>" + EOL +
209 " <vf-module>" + EOL +
210 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
211 " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
212 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
213 " <persona-model-version>1.0</persona-model-version>" + EOL +
214 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
215 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
216 " <orchestration-status>pending-create</orchestration-status>" + EOL +
217 " <resource-version>0000075</resource-version>" + EOL +
218 " </vf-module>" + EOL +
219 " </vf-modules>" + EOL +
220 " <relationship-list/>" + EOL +
221 " <l-interfaces/>" + EOL +
222 " <lag-interfaces/>" + EOL +
223 "</generic-vnf>" + EOL;
224 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
225 .willReturn(aResponse()
227 .withHeader("Content-Type", "text/xml")
231 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
232 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
233 " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
234 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
235 " <service-id>SDN-MOBILITY</service-id>" + EOL +
236 " <equipment-role>vMMSC</equipment-role>" + EOL +
237 " <orchestration-status>pending-create</orchestration-status>" + EOL +
238 " <in-maint>false</in-maint>" + EOL +
239 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
240 " <resource-version>0000019</resource-version>" + EOL +
241 " <vf-modules>" + EOL +
242 " <vf-module>" + EOL +
243 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
244 " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
245 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
246 " <persona-model-version>1.0</persona-model-version>" + EOL +
247 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
248 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
249 " <orchestration-status>pending-create</orchestration-status>" + EOL +
250 " <resource-version>0000076</resource-version>" + EOL +
251 " </vf-module>" + EOL +
252 " <vf-module>" + EOL +
253 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
254 " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
255 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
256 " <persona-model-version>1.0</persona-model-version>" + EOL +
257 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
258 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
259 " <orchestration-status>pending-create</orchestration-status>" + EOL +
260 " <resource-version>0000077</resource-version>" + EOL +
261 " </vf-module>" + EOL +
262 " </vf-modules>" + EOL +
263 " <relationship-list/>" + EOL +
264 " <l-interfaces/>" + EOL +
265 " <lag-interfaces/>" + EOL +
266 "</generic-vnf>" + EOL;
267 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
268 .willReturn(aResponse()
270 .withHeader("Content-Type", "text/xml")
274 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
275 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
276 " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
277 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
278 " <service-id>SDN-MOBILITY</service-id>" + EOL +
279 " <equipment-role>vMMSC</equipment-role>" + EOL +
280 " <orchestration-status>pending-create</orchestration-status>" + EOL +
281 " <in-maint>false</in-maint>" + EOL +
282 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
283 " <resource-version>0000018</resource-version>" + EOL +
284 " <vf-modules>" + EOL +
285 " <vf-module>" + EOL +
286 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
287 " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
288 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
289 " <persona-model-version>1.0</persona-model-version>" + EOL +
290 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
291 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
292 " <orchestration-status>pending-create</orchestration-status>" + EOL +
293 " <resource-version>0000078</resource-version>" + EOL +
294 " </vf-module>" + EOL +
295 " </vf-modules>" + EOL +
296 " <relationship-list/>" + EOL +
297 " <l-interfaces/>" + EOL +
298 " <lag-interfaces/>" + EOL +
299 "</generic-vnf>" + EOL;
300 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
301 .willReturn(aResponse()
303 .withHeader("Content-Type", "text/xml")
307 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
308 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
309 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
310 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
311 " <service-id>SDN-MOBILITY</service-id>" + EOL +
312 " <equipment-role>vMMSC</equipment-role>" + EOL +
313 " <orchestration-status>pending-create</orchestration-status>" + EOL +
314 " <in-maint>false</in-maint>" + EOL +
315 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
316 " <resource-version>0000021</resource-version>" + EOL +
317 " <vf-modules>" + EOL +
318 " <vf-module>" + EOL +
319 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
320 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
321 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
322 " <persona-model-version>1.0</persona-model-version>" + EOL +
323 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
324 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
325 " <orchestration-status>pending-create</orchestration-status>" + EOL +
326 " <resource-version>0000073</resource-version>" + EOL +
327 " </vf-module>" + EOL +
328 " </vf-modules>" + EOL +
329 " <relationship-list/>" + EOL +
330 " <l-interfaces/>" + EOL +
331 " <lag-interfaces/>" + EOL +
332 "</generic-vnf>" + EOL;
333 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
334 .willReturn(aResponse()
336 .withHeader("Content-Type", "text/xml")