2 * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
5 * ============LICENSE_START=======================================================
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
14 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
24 package org.openecomp.mso.bpmn.mock;
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;
36 * Reusable Mock StubResponses for AAI Endpoints
39 public class StubResponseAAI {
41 public static void setupAllMocks() {
47 * Tunnel-XConnect Mock Stub Response
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()
57 * Allotted Resource Mock StubResponses below
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()
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()
73 * Service Instance Mock StubResponses below
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()
79 .withHeader("Content-Type", "text/xml")
80 .withBodyFile(responseFile)));
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()
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()
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()
99 .withHeader("Content-Type", "text/xml")
100 .withBodyFile(responseFile)));
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()
107 .withHeader("Content-Type", "text/xml")
108 .withBodyFile(responseFile)));
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()
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()
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()
127 .withHeader("Content-Type", "text/xml")
128 .withBodyFile(responseFile)));
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()
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()
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()
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)));
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()
159 .withHeader("Content-Type", "text/xml")));
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)));
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()
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()
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()
184 .withHeader("Content-Type", "text/xml")
185 .withBodyFile(responseFile)));
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()
196 * Service-Subscription Mock StubResponses below
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()
202 .withHeader("Content-Type", "text/xml")
203 .withBodyFile(responseFile)));
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)));
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()
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()
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)));
231 * Customer Mock StubResponses below
233 public static void MockGetCustomer(String globalCustId, String responseFile) {
234 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
235 .willReturn(aResponse()
237 .withHeader("Content-Type", "text/xml")
238 .withBodyFile(responseFile)));
241 public static void MockDeleteCustomer(String globalCustId) {
242 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
243 .willReturn(aResponse()
247 public static void MockPutCustomer(String globalCustId) {
248 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
249 .willReturn(aResponse()
253 public static void MockPutCustomer_500(String globalCustId) {
254 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
255 .willReturn(aResponse()
261 * Generic-Vnf Mock StubResponses below
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)));
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))
274 .willReturn(aResponse()
275 .withStatus(statusCode)
276 .withHeader("Content-Type", "text/xml")
277 .withBodyFile(responseFile)));
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)));
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()
293 .withHeader("Content-Type", "text/xml")
294 .withBodyFile(responseFile)));
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()
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()
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()
313 .withHeader("Content-Type", "text/xml")
314 .withBodyFile(responseFile)));
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()
321 .withHeader("Content-Type", "text/xml")
322 .withBodyFile(responseFile)));
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()
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()
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)));
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()
349 public static void MockPutGenericVnf(String vnfId){
350 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
351 .willReturn(aResponse()
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)));
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)));
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)));
376 * Vce Mock StubResponses below
378 public static void MockGetVceById(String vnfId, String responseFile){
379 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
380 .willReturn(aResponse()
382 .withHeader("Content-Type", "text/xml")
383 .withBodyFile(responseFile)));
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()
390 .withHeader("Content-Type", "text/xml")
391 .withBodyFile(responseFile)));
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)));
400 public static void MockPutVce(String vnfId){
401 stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
402 .willReturn(aResponse()
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()
410 .withHeader("Content-Type", "text/xml")
411 .withBodyFile(responseFile)));
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)));
423 * Tenant Mock StubResponses below
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()
429 .withHeader("Content-Type", "text/xml")
430 .withBodyFile(responseFile)));
433 public static void MockGetTenant(String tenantId, String responseFile) {
434 stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))
435 .willReturn(aResponse()
437 .withHeader("Content-Type", "text/xml")
438 .withBodyFile(responseFile)));
442 * Network Mock StubResponses below
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)));
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)));
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)));
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)));
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)));
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)));
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)));
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)));
510 * Cloud infrastructure below
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)));
522 * Volume Group StubResponse below
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()
528 .withHeader("Content-Type", "text/xml")
529 .withBodyFile(responseFile)));
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)));
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)));
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)));
555 * VF-Module StubResponse below
556 * @param statusCode TODO
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)));
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()
571 .withHeader("Content-Type", "text/xml")));
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()
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()
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)));
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)));
599 //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////
601 public static void MockGetVceById(){
602 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
603 .willReturn(aResponse()
605 .withHeader("Content-Type", "text/xml")
606 .withBodyFile("GenericFlows/getVceResponse.xml")));
609 public static void MockGetVceByName(){
610 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
611 .willReturn(aResponse()
613 .withHeader("Content-Type", "text/xml")
614 .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
617 public static void MockPutVce(){
618 stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
619 .willReturn(aResponse()
623 public static void MockDeleteVce(){
624 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
625 .willReturn(aResponse()
629 public static void MockDeleteVce_404(){
630 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
631 .willReturn(aResponse()
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()
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()
646 .withHeader("Content-Type", "text/xml")
647 .withBodyFile("GenericFlows/getServiceSubscription.xml")));
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()
654 .withHeader("Content-Type", "text/xml")
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()
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()
668 .withHeader("Content-Type", "text/xml")
669 .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
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()
677 .withHeader("Content-Type", "text/xml")
678 .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
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()
685 .withHeader("Content-Type", "text/xml")
686 .withBodyFile("GenericPutServiceInstance/aaiFault.xml")));
690 public static void MockGetGenericVnfById(){
691 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
692 .willReturn(aResponse()
694 .withHeader("Content-Type", "text/xml")
695 .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
698 public static void MockGetGenericVnfById_404(){
699 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
700 .willReturn(aResponse()
704 public static void MockGetGenericVnfByName(){
705 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
706 .willReturn(aResponse()
708 .withHeader("Content-Type", "text/xml")
709 .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
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()
716 .withHeader("Content-Type", "text/xml")
717 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
720 public static void MockGetGenericVnfById_hasRelationships(){
721 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
722 .willReturn(aResponse()
724 .withHeader("Content-Type", "text/xml")
725 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
728 public static void MockGetGenericVnfById_500(){
729 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
730 .willReturn(aResponse()
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()
740 public static void MockPutGenericVnf(){
741 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
742 .willReturn(aResponse()
746 public static void MockPutGenericVnf_400(){
747 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
748 .willReturn(aResponse()
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()
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()
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()
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()