[MSO-8] Update the maven dependency
[so.git] / bpmn / MSOMockServer / src / main / java / org / openecomp / mso / bpmn / mock / StubResponseAAI.java
1 /*
2  * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
3  */
4 /*- 
5  * ============LICENSE_START======================================================= 
6  * OPENECOMP - MSO 
7  * ================================================================================ 
8  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. 
9  * ================================================================================ 
10  * Licensed under the Apache License, Version 2.0 (the "License"); 
11  * you may not use this file except in compliance with the License. 
12  * You may obtain a copy of the License at 
13  * 
14  *      http://www.apache.org/licenses/LICENSE-2.0 
15  * 
16  * Unless required by applicable law or agreed to in writing, software 
17  * distributed under the License is distributed on an "AS IS" BASIS, 
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
19  * See the License for the specific language governing permissions and 
20  * limitations under the License. 
21  * ============LICENSE_END========================================================= 
22  */ 
23
24 package org.openecomp.mso.bpmn.mock;
25
26 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
27 import static com.github.tomakehurst.wiremock.client.WireMock.containing;
28 import static com.github.tomakehurst.wiremock.client.WireMock.delete;
29 import static com.github.tomakehurst.wiremock.client.WireMock.get;
30 import static com.github.tomakehurst.wiremock.client.WireMock.put;
31 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
32 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
33 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
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 MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
60                 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))
61                                 .willReturn(aResponse()
62                                                 .withStatus(200)));
63         }
64
65         public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
66                 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))
67                                 .willReturn(aResponse()
68                                                 .withStatus(500)));
69         }
70
71
72         /**
73          * Service Instance Mock StubResponses below
74          */
75         public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
76                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
77                                 .willReturn(aResponse()
78                                                 .withStatus(200)
79                                                 .withHeader("Content-Type", "text/xml")
80                                                 .withBodyFile(responseFile)));
81         }
82
83         public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){
84                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
85                                                 .willReturn(aResponse()
86                                                 .withStatus(404)));
87         }
88
89         public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){
90                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
91                                                 .willReturn(aResponse()
92                                                 .withStatus(500)));
93         }
94
95         public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){
96                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
97                                                 .willReturn(aResponse()
98                                                 .withStatus(500)
99                                                 .withHeader("Content-Type", "text/xml")
100                                                 .withBodyFile(responseFile)));
101         }
102
103         public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){
104                 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName))
105                                 .willReturn(aResponse()
106                                                 .withStatus(200)
107                                                 .withHeader("Content-Type", "text/xml")
108                                                 .withBodyFile(responseFile)));
109         }
110
111         public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){
112                 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
113                                 .willReturn(aResponse()
114                                                 .withStatus(404)));
115         }
116
117         public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){
118                 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
119                                 .willReturn(aResponse()
120                                                 .withStatus(500)));
121         }
122
123         public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){
124                 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId))
125                                 .willReturn(aResponse()
126                                                 .withStatus(200)
127                                                 .withHeader("Content-Type", "text/xml")
128                                                 .withBodyFile(responseFile)));
129         }
130
131         public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){
132                 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
133                                 .willReturn(aResponse()
134                                                 .withStatus(404)));
135         }
136
137         public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){
138                 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
139                                 .willReturn(aResponse()
140                                                 .withStatus(500)));
141         }
142
143         public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
144                 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
145                                   .willReturn(aResponse()
146                                   .withStatus(204)));
147         }
148         
149         public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
150                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
151                                   .willReturn(aResponse()
152                                   .withStatus(statusCode)));
153         }
154         
155         public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
156                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion))
157                                   .willReturn(aResponse()
158                                   .withStatus(200)
159                                   .withHeader("Content-Type", "text/xml")));
160         }
161         
162         public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
163                 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234))
164                                   .willReturn(aResponse()
165                                   .withStatus(statusCode)));
166         }
167
168         public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
169                 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
170                                  .willReturn(aResponse()
171                                   .withStatus(404)));
172         }
173
174         public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
175                 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
176                                  .willReturn(aResponse()
177                                   .withStatus(500)));
178         }
179
180         public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
181                 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
182                                 .willReturn(aResponse()
183                                                 .withStatus(200)
184                                                 .withHeader("Content-Type", "text/xml")
185                                                 .withBodyFile(responseFile)));
186         }
187
188         public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) {
189                 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
190                                 .willReturn(aResponse()
191                                                 .withStatus(500)));
192         }
193
194
195         /**
196          * Service-Subscription Mock StubResponses below
197          */
198         public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) {
199                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
200                                 .willReturn(aResponse()
201                                                 .withStatus(200)
202                                                 .withHeader("Content-Type", "text/xml")
203                                                 .withBodyFile(responseFile)));
204         }
205
206         public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
207                 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
208                                 .willReturn(aResponse()
209                                                 .withStatus(statusCode)));
210         }
211
212         public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) {
213                 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
214                                 .willReturn(aResponse()
215                                                 .withStatus(200)));
216         }
217
218         public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) {
219                 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
220                                 .willReturn(aResponse()
221                                                 .withStatus(200)));
222         }
223         
224         public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
225                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
226                                 .willReturn(aResponse()
227                                 .withStatus(statusCode)));
228         }
229
230         /**
231          * Customer Mock StubResponses below
232          */
233         public static void MockGetCustomer(String globalCustId, String responseFile) {
234                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
235                                 .willReturn(aResponse()
236                                                 .withStatus(200)
237                                                 .withHeader("Content-Type", "text/xml")
238                                                 .withBodyFile(responseFile)));
239         }
240
241         public static void MockDeleteCustomer(String globalCustId) {
242                 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
243                                 .willReturn(aResponse()
244                                                 .withStatus(200)));
245         }
246
247         public static void MockPutCustomer(String globalCustId) {
248                 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
249                                 .willReturn(aResponse()
250                                                 .withStatus(200)));
251         }
252
253         public static void MockPutCustomer_500(String globalCustId) {
254                 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
255                                 .willReturn(aResponse()
256                                                 .withStatus(500)));
257         }
258
259
260         /**
261          * Generic-Vnf Mock StubResponses below
262          */
263         public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){
264                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
265                                 .willReturn(aResponse()
266                                                 .withStatus(statusCode)
267                                                 .withHeader("Content-Type", "text/xml")
268                                                 .withBodyFile(responseFile)));
269         }
270         
271         public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) {
272                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
273                                 .atPriority(1)
274                                 .willReturn(aResponse()
275                                         .withStatus(statusCode)
276                                         .withHeader("Content-Type", "text/xml")
277                                         .withBodyFile(responseFile)));  
278         }
279         
280         public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {
281                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
282                                 .atPriority(priority)
283                                 .willReturn(aResponse()
284                                         .withStatus(statusCode)
285                                         .withHeader("Content-Type", "text/xml")
286                                         .withBodyFile(responseFile)));  
287         }
288
289         public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){
290                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth))
291                                 .willReturn(aResponse()
292                                                 .withStatus(200)
293                                                 .withHeader("Content-Type", "text/xml")
294                                                 .withBodyFile(responseFile)));
295         }
296         
297         public static void MockGetGenericVnfById_404(String vnfId){
298                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
299                                 .willReturn(aResponse()
300                                                 .withStatus(404)));
301         }
302
303         public static void MockGetGenericVnfById_500(String vnfId){
304                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
305                                 .willReturn(aResponse()
306                                                 .withStatus(500)));
307         }
308
309         public static void MockGetGenericVnfByName(String vnfName, String responseFile){
310                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
311                                 .willReturn(aResponse()
312                                                 .withStatus(200)
313                                                 .withHeader("Content-Type", "text/xml")
314                                                 .withBodyFile(responseFile)));
315         }
316         
317         public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){
318                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))
319                                 .willReturn(aResponse()
320                                                 .withStatus(200)
321                                                 .withHeader("Content-Type", "text/xml")
322                                                 .withBodyFile(responseFile)));
323         }
324
325         public static void MockGetGenericVnfByName_404(String vnfName){
326                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
327                                 .willReturn(aResponse()
328                                                 .withStatus(404)));
329         }
330
331         public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){
332                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
333                                 .willReturn(aResponse()
334                                                 .withStatus(204)));
335         }
336
337         public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){
338                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
339                                 .willReturn(aResponse()
340                                                 .withStatus(statusCode)));
341         }
342
343         public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){
344                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
345                                 .willReturn(aResponse()
346                                                 .withStatus(500)));
347         }
348
349         public static void MockPutGenericVnf(String vnfId){
350                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
351                                 .willReturn(aResponse()
352                                                 .withStatus(200)));
353         }
354         
355         public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) {
356                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
357                                 .withRequestBody(containing(requestBodyContaining))
358                                 .willReturn(aResponse()
359                                         .withStatus(statusCode)));
360         }
361
362         public static void MockPutGenericVnf(String vnfId, int statusCode) {
363                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
364                                 .willReturn(aResponse()
365                                         .withStatus(statusCode)));
366         }
367         
368         public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){
369                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
370                                 .willReturn(aResponse()
371                                                 .withStatus(statusCode)));
372         }
373
374
375         /**
376          * Vce Mock StubResponses below
377          */
378         public static void MockGetVceById(String vnfId, String responseFile){
379                 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
380                                 .willReturn(aResponse()
381                                                 .withStatus(200)
382                                                 .withHeader("Content-Type", "text/xml")
383                                                 .withBodyFile(responseFile)));
384         }
385
386         public static void MockGetVceByName(String vnfName, String responseFile){
387                 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName))
388                                 .willReturn(aResponse()
389                                                 .withStatus(200)
390                                                 .withHeader("Content-Type", "text/xml")
391                                                 .withBodyFile(responseFile)));
392         }
393
394         public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){
395                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
396                                 .willReturn(aResponse()
397                                                 .withStatus(statusCode)));
398         }
399
400         public static void MockPutVce(String vnfId){
401                 stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
402                                 .willReturn(aResponse()
403                                                 .withStatus(200)));
404         }
405         
406         public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){
407                 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))
408                                 .willReturn(aResponse()
409                                                 .withStatus(200)
410                                                 .withHeader("Content-Type", "text/xml")
411                                                 .withBodyFile(responseFile)));
412         }
413
414         public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){
415                 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))
416                                 .willReturn(aResponse()
417                                                 .withStatus(statusCode)
418                                                 .withHeader("Content-Type", "text/xml")
419                                                 .withBodyFile(responseFile)));
420         }
421
422         /**
423          * Tenant Mock StubResponses below
424          */
425         public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) {
426                 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"))
427                                 .willReturn(aResponse()
428                                                 .withStatus(200)
429                                                 .withHeader("Content-Type", "text/xml")
430                                                 .withBodyFile(responseFile)));
431         }
432
433         public static void MockGetTenant(String tenantId, String responseFile) {
434                 stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))
435                                 .willReturn(aResponse()
436                                                 .withStatus(200)
437                                                 .withHeader("Content-Type", "text/xml")
438                                                 .withBodyFile(responseFile)));
439         }
440
441         /**
442          * Network Mock StubResponses below
443          */
444         public static void MockGetNetwork(String networkId, String responseFile, int statusCode) {
445                 stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
446                                 .willReturn(aResponse()
447                                                 .withStatus(statusCode)
448                                                 .withHeader("Content-Type", "text/xml")
449                                                 .withBodyFile(responseFile)));
450         }
451
452         public static void MockPutNetwork(String networkId, int statusCode, String responseFile) {
453                 stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
454                                 .willReturn(aResponse()
455                                                 .withStatus(statusCode)
456                                                 .withHeader("Content-Type", "text/xml")
457                                                 .withBodyFile(responseFile)));
458         }
459         
460         public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) {
461                 stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))
462                                   .willReturn(aResponse()
463                                   .withStatus(statusCode)
464                                   .withHeader("Content-Type", "text/xml")
465                                   .withBodyFile(responseFile)));
466         }
467         
468         public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) {
469                 stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))
470                                   .willReturn(aResponse()
471                                   .withStatus(statusCode)
472                                   .withHeader("Content-Type", "text/xml")
473                                   .withBodyFile(responseFile)));
474         }
475         
476         public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) {
477                 stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))
478                                   .willReturn(aResponse()
479                                   .withStatus(statusCode)
480                                   .withHeader("Content-Type", "text/xml")
481                                   .withBodyFile(responseFile)));
482         }
483         
484         public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) {
485                 stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))
486                                   .willReturn(aResponse()
487                                   .withStatus(statusCode)
488                                   .withHeader("Content-Type", "text/xml")
489                                   .withBodyFile(responseFile)));
490         }
491         
492         public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) {
493                 stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))
494                                   .willReturn(aResponse()
495                                   .withStatus(statusCode)
496                                   .withHeader("Content-Type", "text/xml")
497                                   .withBodyFile(responseFile)));
498         }
499         
500         public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) {
501                 stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))
502                                   .willReturn(aResponse()
503                                   .withStatus(statusCode)
504                                   .withHeader("Content-Type", "text/xml")
505                                   .withBodyFile(responseFile)));
506         }
507         
508
509         /**
510          * Cloud infrastructure below
511          */
512         
513         public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) {
514                 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId))
515                                 .willReturn(aResponse()
516                                                 .withStatus(statusCode)
517                                                 .withHeader("Content-Type", "text/xml")
518                                                 .withBodyFile(responseFile)));
519         }
520         
521         /**
522          * Volume Group StubResponse below
523          */
524         public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {
525                 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
526                                 .willReturn(aResponse()
527                                                 .withStatus(200)
528                                                 .withHeader("Content-Type", "text/xml")
529                                                 .withBodyFile(responseFile)));
530         }
531         
532         public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {
533                 stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
534                                 .willReturn(aResponse()
535                                                 .withStatus(statusCode)
536                                                 .withHeader("Content-Type", "text/xml")
537                                                 .withBodyFile(responseFile)));
538         }
539         
540         public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {
541                 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
542                                 .willReturn(aResponse()
543                                                 .withStatus(statusCode)
544                                                 .withHeader("Content-Type", "text/xml")
545                                                 .withBodyFile(responseFile)));
546         }
547         
548         public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {
549                 stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
550                                   .willReturn(aResponse()
551                                   .withStatus(statusCode)));
552         }
553
554         /**
555          * VF-Module StubResponse below
556          * @param statusCode TODO
557          */
558         public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) {
559                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
560                                 .willReturn(aResponse()
561                                                 .withStatus(statusCode)
562                                                 .withHeader("Content-Type", "text/xml")
563                                                 .withBodyFile(responseFile)));
564         }
565         
566         public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
567                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
568                                 .withRequestBody(containing(requestContaining))
569                                 .willReturn(aResponse()
570                                                 .withStatus(200)
571                                                 .withHeader("Content-Type", "text/xml")));
572         }
573
574         public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
575                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId))
576                                 .withRequestBody(containing(requestContaining))
577                                 .willReturn(aResponse()
578                                         .withStatus(200)));
579         }
580         
581         public static void MockPutVfModuleId(String vnfId, String vfModuleId) {
582                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
583                                 .willReturn(aResponse()
584                                                 .withStatus(200)));
585         }
586         
587         public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) {
588                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
589                                 .willReturn(aResponse()
590                                                 .withStatus(returnCode)));
591         }
592         
593         public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) {
594                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))
595                                 .willReturn(aResponse()
596                                                 .withStatus(returnCode)));
597         }
598
599         //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////
600         @Deprecated
601         public static void MockGetVceById(){
602                 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
603                                 .willReturn(aResponse()
604                                                 .withStatus(200)
605                                                 .withHeader("Content-Type", "text/xml")
606                                                 .withBodyFile("GenericFlows/getVceResponse.xml")));
607         }
608         @Deprecated
609         public static void MockGetVceByName(){
610                 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
611                                 .willReturn(aResponse()
612                                                 .withStatus(200)
613                                                 .withHeader("Content-Type", "text/xml")
614                                                 .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
615         }
616         @Deprecated
617         public static void MockPutVce(){
618                 stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
619                                 .willReturn(aResponse()
620                                                 .withStatus(200)));
621         }
622         @Deprecated
623         public static void MockDeleteVce(){
624                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
625                                 .willReturn(aResponse()
626                                                 .withStatus(204)));
627         }
628         @Deprecated
629         public static void MockDeleteVce_404(){
630                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
631                                 .willReturn(aResponse()
632                                                 .withStatus(404)));
633         }
634
635         @Deprecated
636         public static void MockDeleteServiceSubscription(){
637                 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
638                                   .willReturn(aResponse()
639                                   .withStatus(204)));
640         }
641         @Deprecated
642         public static void MockGetServiceSubscription(){
643                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
644                                   .willReturn(aResponse()
645                                   .withStatus(200)
646                                   .withHeader("Content-Type", "text/xml")
647                                   .withBodyFile("GenericFlows/getServiceSubscription.xml")));
648         }
649         @Deprecated
650         public static void MockGetServiceSubscription_200Empty(){
651                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
652                                   .willReturn(aResponse()
653                                   .withStatus(200)
654                                   .withHeader("Content-Type", "text/xml")
655                                   .withBody(" ")));
656         }
657         @Deprecated
658         public static void MockGetServiceSubscription_404() {
659                 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
660                                 .willReturn(aResponse()
661                                                 .withStatus(404)));
662         }
663         @Deprecated
664         public static void MockGENPSIPutServiceInstance(){
665                 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"))
666                                 .willReturn(aResponse()
667                                                 .withStatus(200)
668                                                 .withHeader("Content-Type", "text/xml")
669                                                 .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
670         }
671
672         @Deprecated
673         public static void MockGENPSIPutServiceSubscription(){
674                 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
675                                 .willReturn(aResponse()
676                                                 .withStatus(200)
677                                                 .withHeader("Content-Type", "text/xml")
678                                                 .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
679         }
680         @Deprecated
681         public static void MockGENPSIPutServiceInstance_get500(){
682                 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"))
683                                 .willReturn(aResponse()
684                                                 .withStatus(500)
685                                                 .withHeader("Content-Type", "text/xml")
686                                                 .withBodyFile("GenericPutServiceInstance/aaiFault.xml")));
687         }
688
689         @Deprecated
690         public static void MockGetGenericVnfById(){
691                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
692                                 .willReturn(aResponse()
693                                                 .withStatus(200)
694                                                 .withHeader("Content-Type", "text/xml")
695                                                 .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
696         }
697         @Deprecated
698         public static void MockGetGenericVnfById_404(){
699                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
700                                 .willReturn(aResponse()
701                                                 .withStatus(404)));
702         }
703         @Deprecated
704         public static void MockGetGenericVnfByName(){
705                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
706                                 .willReturn(aResponse()
707                                                 .withStatus(200)
708                                                 .withHeader("Content-Type", "text/xml")
709                                                 .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
710         }
711         @Deprecated
712         public static void MockGetGenericVnfByName_hasRelationships(){
713                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
714                                 .willReturn(aResponse()
715                                                 .withStatus(200)
716                                                 .withHeader("Content-Type", "text/xml")
717                                                 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
718         }
719         @Deprecated
720         public static void MockGetGenericVnfById_hasRelationships(){
721                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
722                                 .willReturn(aResponse()
723                                                 .withStatus(200)
724                                                 .withHeader("Content-Type", "text/xml")
725                                                 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
726         }
727         @Deprecated
728         public static void MockGetGenericVnfById_500(){
729                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
730                                 .willReturn(aResponse()
731                                                 .withStatus(500)));
732         }
733         @Deprecated
734         public static void MockGetGenericVnfByName_404(){
735                 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
736                                 .willReturn(aResponse()
737                                                 .withStatus(404)));
738         }
739         @Deprecated
740         public static void MockPutGenericVnf(){
741                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
742                                 .willReturn(aResponse()
743                                                 .withStatus(200)));
744         }
745         @Deprecated
746         public static void MockPutGenericVnf_400(){
747                 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
748                                 .willReturn(aResponse()
749                                                 .withStatus(400)));
750         }
751         @Deprecated
752         public static void MockDeleteGenericVnf(){
753                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
754                                 .willReturn(aResponse()
755                                                 .withStatus(204)));
756         }
757         @Deprecated
758         public static void MockDeleteGenericVnf_404(){
759                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
760                                 .willReturn(aResponse()
761                                                 .withStatus(404)));
762         }
763         @Deprecated
764         public static void MockDeleteGenericVnf_500(){
765                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
766                                 .willReturn(aResponse()
767                                                 .withStatus(500)));
768         }
769         @Deprecated
770         public static void MockDeleteGenericVnf_412(){
771                 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))
772                                 .willReturn(aResponse()
773                                                 .withStatus(412)));
774         }
775
776 }