Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / bpmn / mock / StubResponseAAI.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.onap.so.bpmn.mock;
22
23 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
24 import static com.github.tomakehurst.wiremock.client.WireMock.containing;
25 import static com.github.tomakehurst.wiremock.client.WireMock.delete;
26 import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
27 import static com.github.tomakehurst.wiremock.client.WireMock.get;
28 import static com.github.tomakehurst.wiremock.client.WireMock.patch;
29 import static com.github.tomakehurst.wiremock.client.WireMock.post;
30 import static com.github.tomakehurst.wiremock.client.WireMock.put;
31 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
32 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
33 import com.github.tomakehurst.wiremock.WireMockServer;
34
35
36 /**
37  * Reusable Mock StubResponses for AAI Endpoints
38  *
39  */
40 public class StubResponseAAI {
41
42     public static void setupAllMocks() {
43
44     }
45
46
47     /**
48      * Allotted Resource Mock StubResponses below
49      */
50     public static void MockGetAllottedResource(WireMockServer wireMockServer, String globalCustId,
51             String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {
52         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
53                 + "/service-subscriptions/service-subscription/" + subscriptionType
54                 + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/"
55                 + allottedResourceId)).willReturn(
56                         aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
57     }
58
59     public static void MockPutAllottedResource(WireMockServer wireMockServer, String globalCustId,
60             String subscriptionType, String serviceInstanceId, String allottedResourceId) {
61         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
62                 + "/service-subscriptions/service-subscription/" + subscriptionType
63                 + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/"
64                 + allottedResourceId)).willReturn(aResponse().withStatus(200)));
65     }
66
67     public static void MockPutAllottedResource_500(WireMockServer wireMockServer, String globalCustId,
68             String subscriptionType, String serviceInstanceId, String allottedResourceId) {
69         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
70                 + "/service-subscriptions/service-subscription/" + subscriptionType
71                 + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/"
72                 + allottedResourceId)).willReturn(aResponse().withStatus(500)));
73     }
74
75     public static void MockDeleteAllottedResource(WireMockServer wireMockServer, String globalCustId,
76             String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {
77         wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
78                 + "/service-subscriptions/service-subscription/" + subscriptionType
79                 + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/"
80                 + allottedResourceId + "[?]resource-version=" + resourceVersion))
81                         .willReturn(aResponse().withStatus(204)));
82     }
83
84     public static void MockPatchAllottedResource(WireMockServer wireMockServer, String globalCustId,
85             String subscriptionType, String serviceInstanceId, String allottedResourceId) {
86         wireMockServer.stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
87                 + "/service-subscriptions/service-subscription/" + subscriptionType
88                 + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/"
89                 + allottedResourceId)).willReturn(aResponse().withStatus(200)));
90     }
91
92     public static void MockQueryAllottedResourceById(WireMockServer wireMockServer, String allottedResourceId,
93             String responseFile) {
94         wireMockServer.stubFor(get(
95                 urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:"
96                         + allottedResourceId))
97                                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
98                                         .withBodyFile(responseFile)));
99     }
100
101
102     /**
103      * Service Instance Mock StubResponses below
104      */
105     public static void MockGetServiceInstance(WireMockServer wireMockServer, String globalCustId,
106             String subscriptionType, String serviceInstanceId) {
107         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
108                 + "/service-subscriptions/service-subscription/" + subscriptionType
109                 + "/service-instances/service-instance/" + serviceInstanceId))
110                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")));
111     }
112
113     /**
114      * Service Instance Mock StubResponses below
115      */
116     public static void MockGetServiceInstance(WireMockServer wireMockServer, String globalCustId,
117             String subscriptionType, String serviceInstanceId, String responseFile) {
118         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
119                 + "/service-subscriptions/service-subscription/" + subscriptionType
120                 + "/service-instances/service-instance/" + serviceInstanceId)).willReturn(
121                         aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
122     }
123
124     public static void MockGetServiceInstance_404(WireMockServer wireMockServer, String customer,
125             String serviceSubscription, String serviceInstanceId) {
126         wireMockServer.stubFor(get(urlMatching(
127                 "/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/"
128                         + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
129                                 .willReturn(aResponse().withStatus(404)));
130     }
131
132     public static void MockGetServiceInstance_500(WireMockServer wireMockServer, String customer,
133             String serviceSubscription, String serviceInstanceId) {
134         wireMockServer.stubFor(get(urlMatching(
135                 "/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/"
136                         + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
137                                 .willReturn(aResponse().withStatus(500)));
138     }
139
140     public static void MockGetServiceInstance_500(WireMockServer wireMockServer, String customer,
141             String serviceSubscription, String serviceInstanceId, String responseFile) {
142         wireMockServer.stubFor(get(urlMatching(
143                 "/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/"
144                         + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
145                                 .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
146                                         .withBodyFile(responseFile)));
147     }
148
149     public static void MockNodeQueryServiceInstanceByName(WireMockServer wireMockServer, String serviceInstanceName,
150             String responseFile) {
151         wireMockServer.stubFor(get(urlMatching(
152                 "/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:"
153                         + serviceInstanceName))
154                                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
155                                         .withBodyFile(responseFile)));
156     }
157
158     public static void MockNodeQueryServiceInstanceByName_404(WireMockServer wireMockServer,
159             String serviceInstanceName) {
160         wireMockServer.stubFor(get(urlMatching(
161                 "/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:"
162                         + serviceInstanceName)).willReturn(aResponse().withStatus(404)));
163     }
164
165     public static void MockNodeQueryServiceInstanceByName_500(WireMockServer wireMockServer,
166             String serviceInstanceName) {
167         wireMockServer.stubFor(get(urlMatching(
168                 "/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:"
169                         + serviceInstanceName)).willReturn(aResponse().withStatus(500)));
170     }
171
172     public static void MockNodeQueryServiceInstanceById(WireMockServer wireMockServer, String serviceInstanceId,
173             String responseFile) {
174         wireMockServer.stubFor(get(urlMatching(
175                 "/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:"
176                         + serviceInstanceId))
177                                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
178                                         .withBodyFile(responseFile)));
179     }
180
181     public static void MockNodeQueryServiceInstanceById_404(WireMockServer wireMockServer, String serviceInstanceId) {
182         wireMockServer.stubFor(get(urlMatching(
183                 "/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:"
184                         + serviceInstanceId)).willReturn(aResponse().withStatus(404)));
185     }
186
187     public static void MockNodeQueryServiceInstanceById_500(WireMockServer wireMockServer, String serviceInstanceId) {
188         wireMockServer.stubFor(get(urlMatching(
189                 "/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:"
190                         + serviceInstanceId)).willReturn(aResponse().withStatus(500)));
191     }
192
193     public static void MockDeleteServiceInstance(WireMockServer wireMockServer, String customer,
194             String serviceSubscription, String serviceInstanceId, String resourceVersion) {
195         wireMockServer.stubFor(delete(urlMatching(
196                 "/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/"
197                         + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId
198                         + "[?]resource-version=" + resourceVersion)).willReturn(aResponse().withStatus(204)));
199     }
200
201     public static void MockGetServiceInstance(WireMockServer wireMockServer, String customer,
202             String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode) {
203         wireMockServer.stubFor(get(urlMatching(
204                 "/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/"
205                         + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId
206                         + "[?]resource-version=" + resourceVersion)).willReturn(aResponse().withStatus(statusCode)));
207     }
208
209     public static void MockGetServiceInstance(WireMockServer wireMockServer, String customer,
210             String serviceSubscription, int statusCode) {
211         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer
212                 + "/service-subscriptions/service-subscription/" + serviceSubscription))
213                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")));
214     }
215
216     public static void MockDeleteServiceInstance(WireMockServer wireMockServer, String customer,
217             String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode) {
218         wireMockServer.stubFor(delete(urlMatching(
219                 "/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/"
220                         + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId
221                         + "[?]resource-version=" + resourceVersion)).willReturn(aResponse().withStatus(statusCode)));
222     }
223
224     public static void MockDeleteServiceInstance(WireMockServer wireMockServer, String customer,
225             String serviceSubscription, String resourceVersion, int statusCode) {
226         wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer
227                 + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + 1234))
228                         .willReturn(aResponse().withStatus(statusCode)));
229     }
230
231     public static void MockDeleteServiceInstance_404(WireMockServer wireMockServer, String customer,
232             String serviceSubscription, String serviceInstanceId, String resourceVersion) {
233         wireMockServer.stubFor(delete(urlMatching(
234                 "/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/"
235                         + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId
236                         + "[?]resource-version=" + resourceVersion)).willReturn(aResponse().withStatus(404)));
237     }
238
239     public static void MockDeleteServiceInstance_500(WireMockServer wireMockServer, String customer,
240             String serviceSubscription, String serviceInstanceId, String resourceVersion) {
241         wireMockServer.stubFor(delete(urlMatching(
242                 "/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/"
243                         + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId
244                         + "[?]resource-version=" + resourceVersion)).willReturn(aResponse().withStatus(500)));
245     }
246
247     public static void MockPutServiceInstance(WireMockServer wireMockServer, String globalCustId,
248             String subscriptionType, String serviceInstanceId, String responseFile) {
249         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
250                 + "/service-subscriptions/service-subscription/" + subscriptionType
251                 + "/service-instances/service-instance/" + serviceInstanceId)).willReturn(
252                         aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
253     }
254
255     public static void MockPutServiceInstance_500(WireMockServer wireMockServer, String globalCustId,
256             String subscriptionType, String serviceInstanceId) {
257         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
258                 + "/service-subscriptions/service-subscription/" + subscriptionType
259                 + "/service-instances/service-instance/" + serviceInstanceId)).willReturn(aResponse().withStatus(500)));
260     }
261
262     /**
263      * Service-Subscription Mock StubResponses below
264      */
265     public static void MockGetServiceSubscription(WireMockServer wireMockServer, String globalCustId,
266             String subscriptionType, String responseFile) {
267         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
268                 + "/service-subscriptions/service-subscription/" + subscriptionType)).willReturn(
269                         aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
270     }
271
272     public static void MockDeleteServiceSubscription(WireMockServer wireMockServer, String globalCustId,
273             String subscriptionType, int statusCode) {
274         wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
275                 + "/service-subscriptions/service-subscription/" + subscriptionType))
276                         .willReturn(aResponse().withStatus(statusCode)));
277     }
278
279     public static void MockDeleteServiceInstanceId(WireMockServer wireMockServer, String globalCustId,
280             String subscriptionType, String serviceInstanceId) {
281         wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
282                 + "/service-subscriptions/service-subscription/" + subscriptionType
283                 + "/service-instances/service-instance/" + serviceInstanceId)).willReturn(aResponse().withStatus(200)));
284     }
285
286     public static void MockPutServiceSubscription(WireMockServer wireMockServer, String globalCustId,
287             String subscriptionType) {
288         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
289                 + "/service-subscriptions/service-subscription/" + subscriptionType))
290                         .willReturn(aResponse().withStatus(200)));
291     }
292
293     public static void MockGetServiceSubscription(WireMockServer wireMockServer, String globalCustId,
294             String subscriptionType, int statusCode) {
295         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId
296                 + "/service-subscriptions/service-subscription/" + subscriptionType))
297                         .willReturn(aResponse().withStatus(statusCode)));
298     }
299
300     /**
301      * Customer Mock StubResponses below
302      */
303     public static void MockGetCustomer(WireMockServer wireMockServer, String globalCustId, String responseFile) {
304         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)).willReturn(
305                 aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
306     }
307
308     public static void MockDeleteCustomer(WireMockServer wireMockServer, String globalCustId) {
309         wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
310                 .willReturn(aResponse().withStatus(200)));
311     }
312
313     public static void MockPutCustomer(WireMockServer wireMockServer, String globalCustId) {
314         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
315                 .willReturn(aResponse().withStatus(200)));
316     }
317
318     public static void MockPutCustomer_500(WireMockServer wireMockServer, String globalCustId) {
319         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
320                 .willReturn(aResponse().withStatus(500)));
321     }
322
323
324     /**
325      * Generic-Vnf Mock StubResponses below
326      */
327
328     public static void MockGetGenericVnfById(WireMockServer wireMockServer, String vnfId, String responseFile) {
329         wireMockServer.stubFor(
330                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")).willReturn(
331                         aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
332     }
333
334     public static void MockGetGenericVnfById(WireMockServer wireMockServer, String vnfId, String responseFile,
335             int statusCode) {
336         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)).willReturn(
337                 aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
338     }
339
340     public static void MockGetGenericVnfByIdWithPriority(WireMockServer wireMockServer, String vnfId, int statusCode,
341             String responseFile) {
342         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)).atPriority(1)
343                 .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
344                         .withBodyFile(responseFile)));
345     }
346
347     public static void MockGetGenericVnfByIdWithPriority(WireMockServer wireMockServer, String vnfId, String vfModuleId,
348             int statusCode, String responseFile, int priority) {
349         wireMockServer.stubFor(get(urlMatching(
350                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
351                         .atPriority(priority).willReturn(aResponse().withStatus(statusCode)
352                                 .withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
353     }
354
355     public static void MockGetGenericVnfByIdWithDepth(WireMockServer wireMockServer, String vnfId, int depth,
356             String responseFile) {
357         wireMockServer.stubFor(
358                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth))
359                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
360                                 .withBodyFile(responseFile)));
361     }
362
363     public static void MockGetGenericVnfById_404(WireMockServer wireMockServer, String vnfId) {
364         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
365                 .willReturn(aResponse().withStatus(404)));
366     }
367
368     public static void MockGetGenericVnfById_500(WireMockServer wireMockServer, String vnfId) {
369         wireMockServer.stubFor(get(urlMatching("/aai/v9/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))
370                 .withQueryParam("depth", equalTo("1")).willReturn(aResponse().withStatus(500)));
371     }
372
373     public static void MockGetGenericVnfByName(WireMockServer wireMockServer, String vnfName, String responseFile) {
374         wireMockServer.stubFor(
375                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)).willReturn(
376                         aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
377     }
378
379     public static void MockGetGenericVnfByNameWithDepth(WireMockServer wireMockServer, String vnfName, int depth,
380             String responseFile) {
381         wireMockServer.stubFor(get(urlMatching(
382                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))
383                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
384                                 .withBodyFile(responseFile)));
385     }
386
387     public static void MockGetGenericVnfByName_404(WireMockServer wireMockServer, String vnfName) {
388         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
389                 .willReturn(aResponse().withStatus(404)));
390     }
391
392     public static void MockDeleteGenericVnf(WireMockServer wireMockServer, String vnfId, String resourceVersion) {
393         wireMockServer.stubFor(delete(urlMatching(
394                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
395                         .willReturn(aResponse().withStatus(204)));
396     }
397
398     public static void MockDeleteGenericVnf(WireMockServer wireMockServer, String vnfId, String resourceVersion,
399             int statusCode) {
400         wireMockServer.stubFor(delete(urlMatching(
401                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
402                         .willReturn(aResponse().withStatus(statusCode)));
403     }
404
405     public static void MockDeleteGenericVnf_500(WireMockServer wireMockServer, String vnfId, String resourceVersion) {
406         wireMockServer.stubFor(delete(urlMatching(
407                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
408                         .willReturn(aResponse().withStatus(500)));
409     }
410
411     public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId) {
412         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
413                 .willReturn(aResponse().withStatus(200)));
414     }
415
416     public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId, String requestBodyContaining,
417             int statusCode) {
418         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
419                 .withRequestBody(containing(requestBodyContaining)).willReturn(aResponse().withStatus(statusCode)));
420     }
421
422     public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId, int statusCode) {
423         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
424                 .willReturn(aResponse().withStatus(statusCode)));
425     }
426
427     public static void MockPutGenericVnf_Bad(WireMockServer wireMockServer, String vnfId, int statusCode) {
428         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
429                 .willReturn(aResponse().withStatus(statusCode)));
430     }
431
432     public static void MockPatchGenericVnf(WireMockServer wireMockServer, String vnfId) {
433         wireMockServer.stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
434                 .willReturn(aResponse().withStatus(200)));
435     }
436
437     /**
438      * Vce Mock StubResponses below
439      */
440     public static void MockGetVceById(WireMockServer wireMockServer, String vnfId, String responseFile) {
441         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)).willReturn(
442                 aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
443     }
444
445     public static void MockGetVceByName(WireMockServer wireMockServer, String vnfName, String responseFile) {
446         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName)).willReturn(
447                 aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
448     }
449
450     public static void MockDeleteVce(WireMockServer wireMockServer, String vnfId, String resourceVersion,
451             int statusCode) {
452         wireMockServer.stubFor(
453                 delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
454                         .willReturn(aResponse().withStatus(statusCode)));
455     }
456
457     public static void MockPutVce(WireMockServer wireMockServer, String vnfId) {
458         wireMockServer.stubFor(
459                 put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)).willReturn(aResponse().withStatus(200)));
460     }
461
462     public static void MockGetGenericVceByNameWithDepth(WireMockServer wireMockServer, String vnfName, int depth,
463             String responseFile) {
464         wireMockServer
465                 .stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))
466                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
467                                 .withBodyFile(responseFile)));
468     }
469
470     public static void MockGetVceGenericQuery(WireMockServer wireMockServer, String serviceInstanceName, int depth,
471             int statusCode, String responseFile) {
472         wireMockServer.stubFor(
473                 get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:"
474                         + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth))
475                                 .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
476                                         .withBodyFile(responseFile)));
477     }
478
479     /**
480      * Tenant Mock StubResponses below
481      */
482     public static void MockGetTenantGenericQuery(WireMockServer wireMockServer, String customer, String serviceType,
483             String responseFile) {
484         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:"
485                 + customer + "&key=service-subscription.service-type:" + serviceType
486                 + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1"))
487                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
488                                 .withBodyFile(responseFile)));
489     }
490
491     public static void MockGetTenant(WireMockServer wireMockServer, String tenantId, String responseFile) {
492         wireMockServer.stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId)).willReturn(
493                 aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
494     }
495
496     /**
497      * Network Mock StubResponses below
498      */
499     public static void MockGetNetwork(WireMockServer wireMockServer, String networkId, String responseFile,
500             int statusCode) {
501         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)).willReturn(
502                 aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
503     }
504
505     public static void MockGetNetworkByIdWithDepth(WireMockServer wireMockServer, String networkId, String responseFile,
506             String depth) {
507         wireMockServer.stubFor(
508                 get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
509                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
510                                 .withBodyFile(responseFile)));
511     }
512
513     public static void MockGetNetworkCloudRegion(WireMockServer wireMockServer, String responseFile,
514             String cloudRegion) {
515         wireMockServer.stubFor(get(
516                 urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegion))
517                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
518                                 .withBodyFile(responseFile)));
519     }
520
521     public static void MockGetNetworkByName(WireMockServer wireMockServer, String networkName, String responseFile) {
522         wireMockServer
523                 .stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkName))
524                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
525                                 .withBodyFile(responseFile)));
526     }
527
528     public static void MockGetNetworkByName_404(WireMockServer wireMockServer, String responseFile,
529             String networkName) {
530         wireMockServer
531                 .stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkName))
532                         .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
533                                 .withBodyFile(responseFile)));
534     }
535
536     public static void MockGetNetworkCloudRegion_404(WireMockServer wireMockServer, String cloudRegion) {
537         wireMockServer.stubFor(get(
538                 urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegion))
539                         .willReturn(aResponse().withStatus(404)));
540     }
541
542     public static void MockPutNetwork(WireMockServer wireMockServer, String networkId, int statusCode,
543             String responseFile) {
544         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)).willReturn(
545                 aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml").withBodyFile(responseFile)));
546     }
547
548     public static void MockPutNetwork(WireMockServer wireMockServer, String networkPolicyId, String responseFile,
549             int statusCode) {
550         wireMockServer
551                 .stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))
552                         .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
553                                 .withBodyFile(responseFile)));
554     }
555
556     public static void MockPostNetwork(WireMockServer wireMockServer, String networkId) {
557         wireMockServer.stubFor(post(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
558                 .willReturn(aResponse().withStatus(201).withHeader("Content-Type", "text/xml")));
559     }
560
561     public static void MockPostNetworkSubnet(WireMockServer wireMockServer, String networkId, String subnetId) {
562         wireMockServer.stubFor(post(
563                 urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "/subnets/subnet/" + subnetId))
564                         .willReturn(aResponse().withStatus(201).withHeader("Content-Type", "text/xml")));
565     }
566
567     public static void MockGetNetworkName(WireMockServer wireMockServer, String networkPolicyName, String responseFile,
568             int statusCode) {
569         wireMockServer.stubFor(
570                 get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))
571                         .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
572                                 .withBodyFile(responseFile)));
573     }
574
575     public static void MockGetNetworkVpnBinding(WireMockServer wireMockServer, String responseFile, String vpnBinding) {
576         MockGetNetworkVpnBindingWithDepth(wireMockServer, responseFile, vpnBinding, "all");
577     }
578
579     public static void MockGetNetworkVpnBindingWithDepth(WireMockServer wireMockServer, String responseFile,
580             String vpnBinding, String depth) {
581         wireMockServer.stubFor(
582                 get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + vpnBinding + "[?]depth=" + depth))
583                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
584                                 .withBodyFile(responseFile)));
585     }
586
587     public static void MockGetNetworkPolicy(WireMockServer wireMockServer, String responseFile, String policy) {
588         wireMockServer.stubFor(
589                 get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + policy + "[?]depth=all"))
590                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
591                                 .withBodyFile(responseFile)));
592     }
593
594     public static void MockGetNetworkVpnBinding(WireMockServer wireMockServer, String networkBindingId,
595             String responseFile, int statusCode) {
596         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))
597                 .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
598                         .withBodyFile(responseFile)));
599     }
600
601     public static void MockGetNetworkPolicy(WireMockServer wireMockServer, String networkPolicy, String responseFile,
602             int statusCode) {
603         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))
604                 .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
605                         .withBodyFile(responseFile)));
606     }
607
608     public static void MockGetNetworkTableReference(WireMockServer wireMockServer, String responseFile,
609             String tableReference) {
610         wireMockServer.stubFor(get(urlMatching(
611                 "/aai/v[0-9]+/network/route-table-references/route-table-reference/" + tableReference + "[?]depth=all"))
612                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
613                                 .withBodyFile(responseFile)));
614     }
615
616     public static void MockPutNetworkIdWithDepth(WireMockServer wireMockServer, String responseFile, String networkId,
617             String depth) {
618         wireMockServer.stubFor(
619                 put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
620                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
621                                 .withBodyFile(responseFile)));
622     }
623
624     public static void MockGetNetworkPolicyfqdn(WireMockServer wireMockServer, String networkPolicy,
625             String responseFile, int statusCode) {
626         wireMockServer.stubFor(get(urlMatching(
627                 "/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))
628                         .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
629                                 .withBodyFile(responseFile)));
630     }
631
632     public static void MockGetNetworkRouteTable(WireMockServer wireMockServer, String networkRouteId,
633             String responseFile, int statusCode) {
634         wireMockServer.stubFor(
635                 get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))
636                         .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
637                                 .withBodyFile(responseFile)));
638     }
639
640     public static void MockPatchVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId) {
641         wireMockServer.stubFor(patch(urlMatching(
642                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
643                         .willReturn(aResponse().withStatus(200)));
644     }
645
646     /////////////
647
648     public static void MockVNFAdapterRestVfModule(WireMockServer wireMockServer) {
649         wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
650                 .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
651         wireMockServer.stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
652                 .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
653         wireMockServer.stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
654                 .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
655         wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
656                 .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/xml")));
657     }
658
659     public static void MockDBUpdateVfModule(WireMockServer wireMockServer) {
660         wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")).willReturn(aResponse().withStatus(200)
661                 .withHeader("Content-Type", "text/xml").withBodyFile("VfModularity/DBUpdateResponse.xml")));
662     }
663
664     // start of mocks used locally and by other VF Module unit tests
665     public static void MockSDNCAdapterVfModule(WireMockServer wireMockServer) {
666         // simplified the implementation to return "success" for all requests
667         wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter"))
668                 // .withRequestBody(containing("SvcInstanceId><"))
669                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
670                         .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
671
672     }
673
674     // start of mocks used locally and by other VF Module unit tests
675     public static void MockAAIVfModule(WireMockServer wireMockServer) {
676         wireMockServer.stubFor(
677                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
678                         .atPriority(1).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
679                                 .withBodyFile("VfModularity/VfModule-supercool.xml")));
680         wireMockServer.stubFor(
681                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm"))
682                         .atPriority(2).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
683                                 .withBodyFile("VfModularity/VfModule-lukewarm.xml")));
684         wireMockServer
685                 .stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
686                         .atPriority(5).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
687                                 .withBodyFile("VfModularity/VfModule-new.xml")));
688         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1"))
689                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
690                         .withBodyFile("VfModularity/GenericVnf.xml")));
691         wireMockServer.stubFor(
692                 patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
693                         // .withRequestBody(containing("PCRF"))
694                         .willReturn(aResponse().withStatus(200)));
695         wireMockServer.stubFor(
696                 patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
697                         // .withRequestBody(containing("PCRF"))
698                         .willReturn(aResponse().withStatus(200)));
699         // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup
700         wireMockServer
701                 .stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
702                         .withRequestBody(containing("PCRF")).willReturn(aResponse().withStatus(200)));
703         // HTTP PUT stub still used by DoCreateVfModuleTest
704         wireMockServer
705                 .stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
706                         .withRequestBody(containing("MODULELABEL")).willReturn(aResponse().withStatus(200)));
707         wireMockServer.stubFor(
708                 get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
709                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
710                                 .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
711         wireMockServer.stubFor(
712                 get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
713                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
714                                 .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
715         wireMockServer.stubFor(get(urlMatching(
716                 "/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/MDTWNJ21/volume-groups/volume-group/78987"))
717                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
718                                 .withBodyFile("VfModularity/VolumeGroup.xml")));
719         wireMockServer.stubFor(get(urlMatching(
720                 "/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/volume-groups/volume-group/78987"))
721                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
722                                 .withBodyFile("VfModularity/VolumeGroup.xml")));
723         wireMockServer.stubFor(delete(urlMatching(
724                 "/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020"))
725                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
726                                 .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml")));
727         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
728                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
729                         .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml")));
730         wireMockServer.stubFor(patch(
731                 urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId"))
732                         .withRequestBody(containing("NEWvBNGModuleId")).willReturn(aResponse().withStatus(200)));
733     }
734
735
736
737     //////////////
738
739     /**
740      * Cloud infrastructure below
741      */
742
743     public static void MockGetCloudRegion(WireMockServer wireMockServer, String cloudRegionId, int statusCode,
744             String responseFile) {
745         wireMockServer.stubFor(get(
746                 urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId))
747                         .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
748                                 .withBodyFile(responseFile)));
749     }
750
751     /**
752      * Volume Group StubResponse below
753      */
754     public static void MockGetVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId,
755             String responseFile) {
756         MockGetVolumeGroupById(wireMockServer, cloudRegionId, volumeGroupId, responseFile, 200);
757     }
758
759     public static void MockGetVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId,
760             String responseFile, int responseCode) {
761         wireMockServer
762                 .stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"
763                         + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
764                                 .willReturn(aResponse().withStatus(responseCode).withHeader("Content-Type", "text/xml")
765                                         .withBodyFile(responseFile)));
766     }
767
768     public static void MockPutVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId,
769             String responseFile, int statusCode) {
770         wireMockServer
771                 .stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"
772                         + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
773                                 .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
774                                         .withBodyFile(responseFile)));
775     }
776
777     public static void MockGetVolumeGroupByName(WireMockServer wireMockServer, String cloudRegionId,
778             String volumeGroupName, String responseFile, int statusCode) {
779         wireMockServer
780                 .stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"
781                         + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
782                                 .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
783                                         .withBodyFile(responseFile)));
784     }
785
786     public static void MockDeleteVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId,
787             String volumeGroupId, String resourceVersion, int statusCode) {
788         wireMockServer.stubFor(delete(
789                 urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId
790                         + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
791                                 .willReturn(aResponse().withStatus(statusCode)));
792     }
793
794     public static void MockGetVolumeGroupByName_404(WireMockServer wireMockServer, String cloudRegionId,
795             String volumeGroupName) {
796         wireMockServer.stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"
797                 + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
798                         .willReturn(aResponse().withStatus(404)));
799     }
800
801     public static void MockDeleteVolumeGroup(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId,
802             String resourceVersion) {
803         wireMockServer.stubFor(delete(
804                 urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId
805                         + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
806                                 .willReturn(aResponse().withStatus(200)));
807     }
808
809     /**
810      * VF-Module StubResponse below
811      * 
812      * @param statusCode TODO
813      */
814     public static void MockGetVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId,
815             String responseFile, int statusCode) {
816         wireMockServer.stubFor(get(urlMatching(
817                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
818                         .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
819                                 .withBodyFile(responseFile)));
820     }
821
822     public static void MockGetVfModuleByNameWithDepth(WireMockServer wireMockServer, String vnfId, String vfModuleName,
823             int depth, String responseFile, int statusCode) {
824         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId
825                 + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth))
826                         .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
827                                 .withBodyFile(responseFile)));
828     }
829
830     public static void MockGetVfModuleByName(WireMockServer wireMockServer, String vnfId, String vfModuleName,
831             String responseFile, int statusCode) {
832         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId
833                 + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName))
834                         .willReturn(aResponse().withStatus(statusCode).withHeader("Content-Type", "text/xml")
835                                 .withBodyFile(responseFile)));
836     }
837
838     public static void MockGetVfModuleIdNoResponse(WireMockServer wireMockServer, String vnfId,
839             String requestContaining, String vfModuleId) {
840         wireMockServer.stubFor(get(urlMatching(
841                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
842                         .withRequestBody(containing(requestContaining))
843                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")));
844     }
845
846     public static void MockPutVfModuleIdNoResponse(WireMockServer wireMockServer, String vnfId,
847             String requestContaining, String vfModuleId) {
848         wireMockServer.stubFor(put(urlMatching(
849                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
850                         .withRequestBody(containing(requestContaining)).willReturn(aResponse().withStatus(200)));
851     }
852
853     public static void MockPutVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId) {
854         wireMockServer.stubFor(put(urlMatching(
855                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
856                         .willReturn(aResponse().withStatus(200)));
857     }
858
859     public static void MockPutVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId,
860             int returnCode) {
861         wireMockServer.stubFor(put(urlMatching(
862                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
863                         .willReturn(aResponse().withStatus(returnCode)));
864     }
865
866     public static void MockDeleteVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId,
867             String resourceVersion, int returnCode) {
868         wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId
869                 + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))
870                         .willReturn(aResponse().withStatus(returnCode)));
871     }
872
873     public static void MockAAIVfModuleBadPatch(WireMockServer wireMockServer, String endpoint, int statusCode) {
874         wireMockServer.stubFor(patch(urlMatching(endpoint)).willReturn(aResponse().withStatus(statusCode)));
875     }
876
877     /* AAI Pserver Queries */
878     public static void MockGetPserverByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile,
879             int statusCode) {
880         wireMockServer.stubFor(put(urlMatching("/aai/v1[0-9]/query.*")).willReturn(aResponse().withStatus(statusCode)
881                 .withHeader("Content-Type", "application/json").withBodyFile(responseFile)));
882     }
883
884     public static void MockGetGenericVnfsByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile,
885             int statusCode) {
886         wireMockServer.stubFor(
887                 get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")).willReturn(aResponse().withStatus(statusCode)
888                         .withHeader("Content-Type", "application/json; charset=utf-8").withBodyFile(responseFile)));
889     }
890
891     public static void MockSetInMaintFlagByVnfId(WireMockServer wireMockServer, String vnfId, int statusCode) {
892         wireMockServer.stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
893                 .willReturn(aResponse().withStatus(statusCode)));
894     }
895
896     public static void MockSetInMaintFlagByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile,
897             int statusCode) {
898         wireMockServer.stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
899                 .willReturn(aResponse().withStatus(statusCode).withBodyFile(responseFile)));
900     }
901
902     public static void MockGetDefaultCloudRegionByCloudRegionId(WireMockServer wireMockServer, String cloudRegionId,
903             String responseFile, int statusCode) {
904         wireMockServer.stubFor(get(urlMatching(
905                 "/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + ".*"))
906                         .willReturn(aResponse().withStatus(statusCode)
907                                 .withHeader("Content-Type", "application/json; charset=utf-8")
908                                 .withBodyFile(responseFile)));
909     }
910
911     //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones
912     //// above ////
913     @Deprecated
914     public static void MockGetVceById(WireMockServer wireMockServer) {
915         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
916                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
917                         .withBodyFile("GenericFlows/getVceResponse.xml")));
918     }
919
920     @Deprecated
921     public static void MockGetVceByName(WireMockServer wireMockServer) {
922         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
923                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
924                         .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
925     }
926
927     @Deprecated
928     public static void MockPutVce(WireMockServer wireMockServer) {
929         wireMockServer.stubFor(
930                 put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123")).willReturn(aResponse().withStatus(200)));
931     }
932
933     @Deprecated
934     public static void MockDeleteVce(WireMockServer wireMockServer) {
935         wireMockServer.stubFor(
936                 delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
937                         .willReturn(aResponse().withStatus(204)));
938     }
939
940     @Deprecated
941     public static void MockDeleteVce_404(WireMockServer wireMockServer) {
942         wireMockServer.stubFor(
943                 delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
944                         .willReturn(aResponse().withStatus(404)));
945     }
946
947     @Deprecated
948     public static void MockDeleteServiceSubscription(WireMockServer wireMockServer) {
949         wireMockServer.stubFor(delete(urlMatching(
950                 "/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
951                         .willReturn(aResponse().withStatus(204)));
952     }
953
954     @Deprecated
955     public static void MockGetServiceSubscription(WireMockServer wireMockServer) {
956         wireMockServer.stubFor(get(urlMatching(
957                 "/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
958                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
959                                 .withBodyFile("GenericFlows/getServiceSubscription.xml")));
960     }
961
962     @Deprecated
963     public static void MockGetServiceSubscription_200Empty(WireMockServer wireMockServer) {
964         wireMockServer.stubFor(get(urlMatching(
965                 "/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
966                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(" ")));
967     }
968
969     @Deprecated
970     public static void MockGetServiceSubscription_404(WireMockServer wireMockServer) {
971         wireMockServer.stubFor(get(urlMatching(
972                 "/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
973                         .willReturn(aResponse().withStatus(404)));
974     }
975
976     @Deprecated
977     public static void MockGetGenericVnfById(WireMockServer wireMockServer) {
978         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
979                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
980                         .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
981     }
982
983     @Deprecated
984     public static void MockGetGenericVnfById_404(WireMockServer wireMockServer) {
985         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
986                 .willReturn(aResponse().withStatus(404)));
987     }
988
989     @Deprecated
990     public static void MockGetGenericVnfByName(WireMockServer wireMockServer) {
991         wireMockServer
992                 .stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
993                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
994                                 .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
995     }
996
997     @Deprecated
998     public static void MockGetGenericVnfByName_hasRelationships(WireMockServer wireMockServer) {
999         wireMockServer
1000                 .stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
1001                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
1002                                 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
1003     }
1004
1005     @Deprecated
1006     public static void MockGetGenericVnfById_hasRelationships(WireMockServer wireMockServer) {
1007         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1008                 .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
1009                         .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
1010     }
1011
1012     @Deprecated
1013     public static void MockGetGenericVnfById_500(WireMockServer wireMockServer) {
1014         wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1015                 .willReturn(aResponse().withStatus(500)));
1016     }
1017
1018     @Deprecated
1019     public static void MockGetGenericVnfByName_404(WireMockServer wireMockServer) {
1020         wireMockServer
1021                 .stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
1022                         .willReturn(aResponse().withStatus(404)));
1023     }
1024
1025     @Deprecated
1026     public static void MockPutGenericVnf(WireMockServer wireMockServer) {
1027         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1028                 .willReturn(aResponse().withStatus(200)));
1029     }
1030
1031     @Deprecated
1032     public static void MockPutGenericVnf_400(WireMockServer wireMockServer) {
1033         wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1034                 .willReturn(aResponse().withStatus(400)));
1035     }
1036
1037     @Deprecated
1038     public static void MockDeleteGenericVnf(WireMockServer wireMockServer) {
1039         wireMockServer.stubFor(delete(urlMatching(
1040                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
1041                         .willReturn(aResponse().withStatus(204)));
1042     }
1043
1044     @Deprecated
1045     public static void MockDeleteGenericVnf_404(WireMockServer wireMockServer) {
1046         wireMockServer.stubFor(delete(urlMatching(
1047                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
1048                         .willReturn(aResponse().withStatus(404)));
1049     }
1050
1051     @Deprecated
1052     public static void MockDeleteGenericVnf_500(WireMockServer wireMockServer) {
1053         wireMockServer.stubFor(delete(urlMatching(
1054                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
1055                         .willReturn(aResponse().withStatus(500)));
1056     }
1057
1058     @Deprecated
1059     public static void MockDeleteGenericVnf_412(WireMockServer wireMockServer) {
1060         wireMockServer.stubFor(delete(urlMatching(
1061                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))
1062                         .willReturn(aResponse().withStatus(412)));
1063     }
1064
1065 }