2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.mock;
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;
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 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()
63 .withHeader("Content-Type", "text/xml")
64 .withBodyFile(responseFile)));
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()
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()
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()
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()
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()
95 .withHeader("Content-Type", "text/xml")
96 .withBodyFile(responseFile)));
101 * Service Instance Mock StubResponses below
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()
107 .withHeader("Content-Type", "text/xml")));
111 * Service Instance Mock StubResponses below
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()
117 .withHeader("Content-Type", "text/xml")
118 .withBodyFile(responseFile)));
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()
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()
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()
137 .withHeader("Content-Type", "text/xml")
138 .withBodyFile(responseFile)));
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()
145 .withHeader("Content-Type", "text/xml")
146 .withBodyFile(responseFile)));
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()
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()
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()
165 .withHeader("Content-Type", "text/xml")
166 .withBodyFile(responseFile)));
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()
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()
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()
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)));
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()
197 .withHeader("Content-Type", "text/xml")));
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)));
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)));
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()
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()
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()
228 .withHeader("Content-Type", "text/xml")
229 .withBodyFile(responseFile)));
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()
239 * Service-Subscription Mock StubResponses below
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()
245 .withHeader("Content-Type", "text/xml")
246 .withBodyFile(responseFile)));
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)));
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()
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()
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)));
274 * Customer Mock StubResponses below
276 public static void MockGetCustomer(String globalCustId, String responseFile) {
277 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
278 .willReturn(aResponse()
280 .withHeader("Content-Type", "text/xml")
281 .withBodyFile(responseFile)));
284 public static void MockDeleteCustomer(String globalCustId) {
285 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
286 .willReturn(aResponse()
290 public static void MockPutCustomer(String globalCustId) {
291 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
292 .willReturn(aResponse()
296 public static void MockPutCustomer_500(String globalCustId) {
297 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
298 .willReturn(aResponse()
304 * Generic-Vnf Mock StubResponses below
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()
311 .withHeader("Content-Type", "text/xml")
312 .withBodyFile(responseFile)));
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)));
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))
326 .willReturn(aResponse()
327 .withStatus(statusCode)
328 .withHeader("Content-Type", "text/xml")
329 .withBodyFile(responseFile)));
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)));
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()
345 .withHeader("Content-Type", "text/xml")
346 .withBodyFile(responseFile)));
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()
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()
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()
366 .withHeader("Content-Type", "text/xml")
367 .withBodyFile(responseFile)));
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()
374 .withHeader("Content-Type", "text/xml")
375 .withBodyFile(responseFile)));
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()
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()
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)));
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()
402 public static void MockPutGenericVnf(String vnfId){
403 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
404 .willReturn(aResponse()
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)));
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)));
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)));
427 public static void MockPatchGenericVnf(String vnfId){
428 stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
429 .willReturn(aResponse()
433 * Vce Mock StubResponses below
435 public static void MockGetVceById(String vnfId, String responseFile){
436 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
437 .willReturn(aResponse()
439 .withHeader("Content-Type", "text/xml")
440 .withBodyFile(responseFile)));
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()
447 .withHeader("Content-Type", "text/xml")
448 .withBodyFile(responseFile)));
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)));
457 public static void MockPutVce(String vnfId){
458 stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
459 .willReturn(aResponse()
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()
467 .withHeader("Content-Type", "text/xml")
468 .withBodyFile(responseFile)));
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)));
480 * Tenant Mock StubResponses below
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()
486 .withHeader("Content-Type", "text/xml")
487 .withBodyFile(responseFile)));
490 public static void MockGetTenant(String tenantId, String responseFile) {
491 stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))
492 .willReturn(aResponse()
494 .withHeader("Content-Type", "text/xml")
495 .withBodyFile(responseFile)));
499 * Network Mock StubResponses below
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)));
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()
513 .withHeader("Content-Type", "text/xml")
514 .withBodyFile(responseFile)));
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()
521 .withHeader("Content-Type", "text/xml")
522 .withBodyFile(responseFile)));
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()
529 .withHeader("Content-Type", "text/xml")
530 .withBodyFile(responseFile)));
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()
537 .withHeader("Content-Type", "text/xml")
538 .withBodyFile(responseFile)));
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()
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)));
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)));
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)));
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()
575 .withHeader("Content-Type", "text/xml")
576 .withBodyFile(responseFile)));
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()
583 .withHeader("Content-Type", "text/xml")
584 .withBodyFile(responseFile)));
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)));
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)));
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()
607 .withHeader("Content-Type", "text/xml")
608 .withBodyFile(responseFile)));
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()
615 .withHeader("Content-Type", "text/xml")
616 .withBodyFile(responseFile)));
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)));
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)));
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()
643 public static void MockVNFAdapterRestVfModule() {
644 stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
645 .willReturn(aResponse()
647 .withHeader("Content-Type", "application/xml")));
648 stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
649 .willReturn(aResponse()
651 .withHeader("Content-Type", "application/xml")));
652 stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
653 .willReturn(aResponse()
655 .withHeader("Content-Type", "application/xml")));
656 stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
657 .willReturn(aResponse()
659 .withHeader("Content-Type", "application/xml")));
662 public static void MockDBUpdateVfModule(){
663 stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
664 .willReturn(aResponse()
666 .withHeader("Content-Type", "text/xml")
667 .withBodyFile("VfModularity/DBUpdateResponse.xml")));
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()
677 .withHeader("Content-Type", "text/xml")
678 .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
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"))
686 .willReturn(aResponse()
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"))
692 .willReturn(aResponse()
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/.*"))
698 .willReturn(aResponse()
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()
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()
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()
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()
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()
725 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
726 .willReturn(aResponse()
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()
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()
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()
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()
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()
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()
766 * Cloud infrastructure below
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)));
778 * Volume Group StubResponse below
780 public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {
781 MockGetVolumeGroupById(cloudRegionId, volumeGroupId, responseFile, 200);
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)));
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)));
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)));
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)));
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()
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()
827 * VF-Module StubResponse below
828 * @param statusCode TODO
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)));
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)));
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)));
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()
859 .withHeader("Content-Type", "text/xml")));
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()
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()
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)));
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)));
887 public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) {
888 stubFor(patch(urlMatching(endpoint))
889 .willReturn(aResponse()
890 .withStatus(statusCode)));
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)));
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)));
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)
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)
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)));
933 //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////
935 public static void MockGetVceById(){
936 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
937 .willReturn(aResponse()
939 .withHeader("Content-Type", "text/xml")
940 .withBodyFile("GenericFlows/getVceResponse.xml")));
943 public static void MockGetVceByName(){
944 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
945 .willReturn(aResponse()
947 .withHeader("Content-Type", "text/xml")
948 .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
951 public static void MockPutVce(){
952 stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
953 .willReturn(aResponse()
957 public static void MockDeleteVce(){
958 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
959 .willReturn(aResponse()
963 public static void MockDeleteVce_404(){
964 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
965 .willReturn(aResponse()
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()
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()
980 .withHeader("Content-Type", "text/xml")
981 .withBodyFile("GenericFlows/getServiceSubscription.xml")));
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()
988 .withHeader("Content-Type", "text/xml")
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()
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()
1002 .withHeader("Content-Type", "text/xml")
1003 .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
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()
1011 .withHeader("Content-Type", "text/xml")
1012 .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
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()
1019 .withHeader("Content-Type", "text/xml")
1020 .withBodyFile("GenericPutServiceInstance/aaiFault.xml")));
1024 public static void MockGetGenericVnfById(){
1025 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1026 .willReturn(aResponse()
1028 .withHeader("Content-Type", "text/xml")
1029 .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
1032 public static void MockGetGenericVnfById_404(){
1033 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1034 .willReturn(aResponse()
1038 public static void MockGetGenericVnfByName(){
1039 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
1040 .willReturn(aResponse()
1042 .withHeader("Content-Type", "text/xml")
1043 .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
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()
1050 .withHeader("Content-Type", "text/xml")
1051 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
1054 public static void MockGetGenericVnfById_hasRelationships(){
1055 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1056 .willReturn(aResponse()
1058 .withHeader("Content-Type", "text/xml")
1059 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
1062 public static void MockGetGenericVnfById_500(){
1063 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1064 .willReturn(aResponse()
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()
1074 public static void MockPutGenericVnf(){
1075 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1076 .willReturn(aResponse()
1080 public static void MockPutGenericVnf_400(){
1081 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
1082 .willReturn(aResponse()
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()
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()
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()
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()