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