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.urlMatching;
27 import com.github.tomakehurst.wiremock.WireMockServer;
29 public class MockAAIGenericVnfSearch {
31 private static final String EOL = "\n";
33 public MockAAIGenericVnfSearch(WireMockServer wireMockServer){
36 // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
38 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
39 .willReturn(aResponse()
41 .withHeader("Content-Type", "text/xml")
42 .withBodyFile("aaiFault.xml")));
44 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
45 .willReturn(aResponse()
47 .withHeader("Content-Type", "text/xml")
48 .withBody("Generic VNF Not Found")));
49 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
50 .willReturn(aResponse()
52 .withHeader("Content-Type", "text/xml")
53 .withBody("Generic VNF Not Found")));
56 "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
57 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
58 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
59 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
60 " <service-id>SDN-MOBILITY</service-id>" + EOL +
61 " <equipment-role>vMMSC</equipment-role>" + EOL +
62 " <orchestration-status>pending-create</orchestration-status>" + EOL +
63 " <in-maint>false</in-maint>" + EOL +
64 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
65 " <resource-version>1508691</resource-version>" + EOL +
66 " <vf-modules>" + EOL +
67 " <vf-module>" + EOL +
68 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
69 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
70 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
71 " <persona-model-version>1.0</persona-model-version>" + EOL +
72 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
73 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
74 " <orchestration-status>pending-create</orchestration-status>" + EOL +
75 " <resource-version>1508692</resource-version>" + EOL +
76 " </vf-module>" + EOL +
77 " </vf-modules>" + EOL +
78 " <relationship-list/>" + EOL +
79 " <l-interfaces/>" + EOL +
80 " <lag-interfaces/>" + EOL +
81 "</generic-vnf>" + EOL;
82 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
83 .willReturn(aResponse()
85 .withHeader("Content-Type", "text/xml")
87 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
88 .willReturn(aResponse()
90 .withHeader("Content-Type", "text/xml")
94 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
95 " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
96 " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
97 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
98 " <service-id>SDN-MOBILITY</service-id>" + EOL +
99 " <equipment-role>vMMSC</equipment-role>" + EOL +
100 " <orchestration-status>pending-create</orchestration-status>" + EOL +
101 " <in-maint>false</in-maint>" + EOL +
102 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
103 " <resource-version>1508691</resource-version>" + EOL +
104 " <vf-modules>" + EOL +
105 " <vf-module>" + EOL +
106 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
107 " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
108 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
109 " <persona-model-version>1.0</persona-model-version>" + EOL +
110 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
111 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
112 " <orchestration-status>pending-create</orchestration-status>" + EOL +
113 " <resource-version>1508692</resource-version>" + EOL +
114 " </vf-module>" + EOL +
115 " <vf-module>" + EOL +
116 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
117 " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
118 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
119 " <persona-model-version>1.0</persona-model-version>" + EOL +
120 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
121 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
122 " <orchestration-status>pending-create</orchestration-status>" + EOL +
123 " <resource-version>1508692</resource-version>" + EOL +
124 " </vf-module>" + EOL +
125 " </vf-modules>" + EOL +
126 " <relationship-list/>" + EOL +
127 " <l-interfaces/>" + EOL +
128 " <lag-interfaces/>" + EOL +
129 "</generic-vnf>" + EOL;
130 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
131 .willReturn(aResponse()
133 .withHeader("Content-Type", "text/xml")
135 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
136 .willReturn(aResponse()
138 .withHeader("Content-Type", "text/xml")
141 // The following stubs are for DeleteAAIVfModule
143 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
144 .willReturn(aResponse()
146 .withHeader("Content-Type", "text/xml")
147 .withBodyFile("aaiFault.xml")));
149 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
150 .willReturn(aResponse()
152 .withHeader("Content-Type", "text/xml")
153 .withBody("Generic VNF Not Found")));
156 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
157 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
158 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
159 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
160 " <service-id>SDN-MOBILITY</service-id>" + EOL +
161 " <equipment-role>vMMSC</equipment-role>" + EOL +
162 " <orchestration-status>pending-create</orchestration-status>" + EOL +
163 " <in-maint>false</in-maint>" + EOL +
164 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
165 " <resource-version>0000021</resource-version>" + EOL +
166 " <vf-modules>" + EOL +
167 " <vf-module>" + EOL +
168 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
169 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
170 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
171 " <persona-model-version>1.0</persona-model-version>" + EOL +
172 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
173 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
174 " <orchestration-status>pending-create</orchestration-status>" + EOL +
175 " <resource-version>0000073</resource-version>" + EOL +
176 " </vf-module>" + EOL +
177 " </vf-modules>" + EOL +
178 " <relationship-list/>" + EOL +
179 " <l-interfaces/>" + EOL +
180 " <lag-interfaces/>" + EOL +
181 "</generic-vnf>" + EOL;
182 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
183 .willReturn(aResponse()
185 .withHeader("Content-Type", "text/xml")
189 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
190 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
191 " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
192 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
193 " <service-id>SDN-MOBILITY</service-id>" + EOL +
194 " <equipment-role>vMMSC</equipment-role>" + EOL +
195 " <orchestration-status>pending-create</orchestration-status>" + EOL +
196 " <in-maint>false</in-maint>" + EOL +
197 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
198 " <resource-version>0000020</resource-version>" + EOL +
199 " <vf-modules>" + EOL +
200 " <vf-module>" + EOL +
201 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
202 " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
203 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
204 " <persona-model-version>1.0</persona-model-version>" + EOL +
205 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
206 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
207 " <orchestration-status>pending-create</orchestration-status>" + EOL +
208 " <resource-version>0000074</resource-version>" + EOL +
209 " </vf-module>" + EOL +
210 " <vf-module>" + EOL +
211 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
212 " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
213 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
214 " <persona-model-version>1.0</persona-model-version>" + EOL +
215 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
216 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
217 " <orchestration-status>pending-create</orchestration-status>" + EOL +
218 " <resource-version>0000075</resource-version>" + EOL +
219 " </vf-module>" + EOL +
220 " </vf-modules>" + EOL +
221 " <relationship-list/>" + EOL +
222 " <l-interfaces/>" + EOL +
223 " <lag-interfaces/>" + EOL +
224 "</generic-vnf>" + EOL;
225 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
226 .willReturn(aResponse()
228 .withHeader("Content-Type", "text/xml")
232 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
233 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
234 " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
235 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
236 " <service-id>SDN-MOBILITY</service-id>" + EOL +
237 " <equipment-role>vMMSC</equipment-role>" + EOL +
238 " <orchestration-status>pending-create</orchestration-status>" + EOL +
239 " <in-maint>false</in-maint>" + EOL +
240 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
241 " <resource-version>0000019</resource-version>" + EOL +
242 " <vf-modules>" + EOL +
243 " <vf-module>" + EOL +
244 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
245 " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
246 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
247 " <persona-model-version>1.0</persona-model-version>" + EOL +
248 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
249 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
250 " <orchestration-status>pending-create</orchestration-status>" + EOL +
251 " <resource-version>0000076</resource-version>" + EOL +
252 " </vf-module>" + EOL +
253 " <vf-module>" + EOL +
254 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
255 " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
256 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
257 " <persona-model-version>1.0</persona-model-version>" + EOL +
258 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
259 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
260 " <orchestration-status>pending-create</orchestration-status>" + EOL +
261 " <resource-version>0000077</resource-version>" + EOL +
262 " </vf-module>" + EOL +
263 " </vf-modules>" + EOL +
264 " <relationship-list/>" + EOL +
265 " <l-interfaces/>" + EOL +
266 " <lag-interfaces/>" + EOL +
267 "</generic-vnf>" + EOL;
268 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
269 .willReturn(aResponse()
271 .withHeader("Content-Type", "text/xml")
275 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
276 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
277 " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
278 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
279 " <service-id>SDN-MOBILITY</service-id>" + EOL +
280 " <equipment-role>vMMSC</equipment-role>" + EOL +
281 " <orchestration-status>pending-create</orchestration-status>" + EOL +
282 " <in-maint>false</in-maint>" + EOL +
283 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
284 " <resource-version>0000018</resource-version>" + EOL +
285 " <vf-modules>" + EOL +
286 " <vf-module>" + EOL +
287 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
288 " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
289 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
290 " <persona-model-version>1.0</persona-model-version>" + EOL +
291 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
292 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
293 " <orchestration-status>pending-create</orchestration-status>" + EOL +
294 " <resource-version>0000078</resource-version>" + EOL +
295 " </vf-module>" + EOL +
296 " </vf-modules>" + EOL +
297 " <relationship-list/>" + EOL +
298 " <l-interfaces/>" + EOL +
299 " <lag-interfaces/>" + EOL +
300 "</generic-vnf>" + EOL;
301 wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
302 .willReturn(aResponse()
304 .withHeader("Content-Type", "text/xml")
308 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
309 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
310 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
311 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
312 " <service-id>SDN-MOBILITY</service-id>" + EOL +
313 " <equipment-role>vMMSC</equipment-role>" + EOL +
314 " <orchestration-status>pending-create</orchestration-status>" + EOL +
315 " <in-maint>false</in-maint>" + EOL +
316 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
317 " <resource-version>0000021</resource-version>" + EOL +
318 " <vf-modules>" + EOL +
319 " <vf-module>" + EOL +
320 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
321 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
322 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
323 " <persona-model-version>1.0</persona-model-version>" + EOL +
324 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
325 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
326 " <orchestration-status>pending-create</orchestration-status>" + EOL +
327 " <resource-version>0000073</resource-version>" + EOL +
328 " </vf-module>" + EOL +
329 " </vf-modules>" + EOL +
330 " <relationship-list/>" + EOL +
331 " <l-interfaces/>" + EOL +
332 " <lag-interfaces/>" + EOL +
333 "</generic-vnf>" + EOL;
334 wireMockServer.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"))
335 .willReturn(aResponse()
337 .withHeader("Content-Type", "text/xml")