2 * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
\r
5 * ============LICENSE_START=======================================================
\r
7 * ================================================================================
\r
8 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
9 * ================================================================================
\r
10 * Licensed under the Apache License, Version 2.0 (the "License");
\r
11 * you may not use this file except in compliance with the License.
\r
12 * You may obtain a copy of the License at
\r
14 * http://www.apache.org/licenses/LICENSE-2.0
\r
16 * Unless required by applicable law or agreed to in writing, software
\r
17 * distributed under the License is distributed on an "AS IS" BASIS,
\r
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
19 * See the License for the specific language governing permissions and
\r
20 * limitations under the License.
\r
21 * ============LICENSE_END=========================================================
\r
24 package org.openecomp.mso.bpmn.mock;
\r
26 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
\r
27 import static com.github.tomakehurst.wiremock.client.WireMock.containing;
\r
28 import static com.github.tomakehurst.wiremock.client.WireMock.delete;
\r
29 import static com.github.tomakehurst.wiremock.client.WireMock.get;
\r
30 import static com.github.tomakehurst.wiremock.client.WireMock.post;
\r
31 import static com.github.tomakehurst.wiremock.client.WireMock.patch;
\r
32 import static com.github.tomakehurst.wiremock.client.WireMock.put;
\r
33 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
\r
34 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
\r
35 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
\r
38 * Reusable Mock StubResponses for AAI Endpoints
\r
41 public class StubResponseAAI {
\r
43 public static void setupAllMocks() {
\r
49 * Tunnel-XConnect Mock Stub Response
\r
51 public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){
\r
52 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))
\r
53 .willReturn(aResponse()
\r
59 * Allotted Resource Mock StubResponses below
\r
61 public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
\r
62 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))
\r
63 .willReturn(aResponse()
\r
67 public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
\r
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))
\r
69 .willReturn(aResponse()
\r
75 * Service Instance Mock StubResponses below
\r
77 public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
\r
78 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
\r
79 .willReturn(aResponse()
\r
81 .withHeader("Content-Type", "text/xml")
\r
82 .withBodyFile(responseFile)));
\r
85 public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){
\r
86 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
\r
87 .willReturn(aResponse()
\r
91 public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){
\r
92 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
\r
93 .willReturn(aResponse()
\r
97 public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){
\r
98 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId))
\r
99 .willReturn(aResponse()
\r
101 .withHeader("Content-Type", "text/xml")
\r
102 .withBodyFile(responseFile)));
\r
105 public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){
\r
106 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName))
\r
107 .willReturn(aResponse()
\r
109 .withHeader("Content-Type", "text/xml")
\r
110 .withBodyFile(responseFile)));
\r
113 public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){
\r
114 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
\r
115 .willReturn(aResponse()
\r
116 .withStatus(404)));
\r
119 public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){
\r
120 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName))
\r
121 .willReturn(aResponse()
\r
122 .withStatus(500)));
\r
125 public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){
\r
126 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId))
\r
127 .willReturn(aResponse()
\r
129 .withHeader("Content-Type", "text/xml")
\r
130 .withBodyFile(responseFile)));
\r
133 public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){
\r
134 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
\r
135 .willReturn(aResponse()
\r
136 .withStatus(404)));
\r
139 public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){
\r
140 stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId))
\r
141 .willReturn(aResponse()
\r
142 .withStatus(500)));
\r
145 public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
\r
146 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
\r
147 .willReturn(aResponse()
\r
148 .withStatus(204)));
\r
151 public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
\r
152 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
\r
153 .willReturn(aResponse()
\r
154 .withStatus(statusCode)));
\r
157 public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
\r
158 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion))
\r
159 .willReturn(aResponse()
\r
161 .withHeader("Content-Type", "text/xml")));
\r
164 public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
\r
165 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
\r
166 .willReturn(aResponse()
\r
167 .withStatus(statusCode)));
\r
170 public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
\r
171 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234))
\r
172 .willReturn(aResponse()
\r
173 .withStatus(statusCode)));
\r
176 public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
\r
177 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
\r
178 .willReturn(aResponse()
\r
179 .withStatus(404)));
\r
182 public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){
\r
183 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
\r
184 .willReturn(aResponse()
\r
185 .withStatus(500)));
\r
188 public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) {
\r
189 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
\r
190 .willReturn(aResponse()
\r
192 .withHeader("Content-Type", "text/xml")
\r
193 .withBodyFile(responseFile)));
\r
196 public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) {
\r
197 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
\r
198 .willReturn(aResponse()
\r
199 .withStatus(500)));
\r
204 * Service-Subscription Mock StubResponses below
\r
206 public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) {
\r
207 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
\r
208 .willReturn(aResponse()
\r
210 .withHeader("Content-Type", "text/xml")
\r
211 .withBodyFile(responseFile)));
\r
214 public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
\r
215 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
\r
216 .willReturn(aResponse()
\r
217 .withStatus(statusCode)));
\r
220 public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) {
\r
221 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId))
\r
222 .willReturn(aResponse()
\r
223 .withStatus(200)));
\r
226 public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) {
\r
227 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
\r
228 .willReturn(aResponse()
\r
229 .withStatus(200)));
\r
232 public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
\r
233 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
\r
234 .willReturn(aResponse()
\r
235 .withStatus(statusCode)));
\r
239 * Customer Mock StubResponses below
\r
241 public static void MockGetCustomer(String globalCustId, String responseFile) {
\r
242 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
\r
243 .willReturn(aResponse()
\r
245 .withHeader("Content-Type", "text/xml")
\r
246 .withBodyFile(responseFile)));
\r
249 public static void MockDeleteCustomer(String globalCustId) {
\r
250 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
\r
251 .willReturn(aResponse()
\r
252 .withStatus(200)));
\r
255 public static void MockPutCustomer(String globalCustId) {
\r
256 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
\r
257 .willReturn(aResponse()
\r
258 .withStatus(200)));
\r
261 public static void MockPutCustomer_500(String globalCustId) {
\r
262 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId))
\r
263 .willReturn(aResponse()
\r
264 .withStatus(500)));
\r
269 * Generic-Vnf Mock StubResponses below
\r
272 public static void MockGetGenericVnfById(String vnfId, String responseFile){
\r
273 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))
\r
274 .willReturn(aResponse()
\r
276 .withHeader("Content-Type", "text/xml")
\r
277 .withBodyFile(responseFile)));
\r
280 public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){
\r
281 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
\r
282 .willReturn(aResponse()
\r
283 .withStatus(statusCode)
\r
284 .withHeader("Content-Type", "text/xml")
\r
285 .withBodyFile(responseFile)));
\r
288 public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) {
\r
289 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
\r
291 .willReturn(aResponse()
\r
292 .withStatus(statusCode)
\r
293 .withHeader("Content-Type", "text/xml")
\r
294 .withBodyFile(responseFile)));
\r
297 public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {
\r
298 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
\r
299 .atPriority(priority)
\r
300 .willReturn(aResponse()
\r
301 .withStatus(statusCode)
\r
302 .withHeader("Content-Type", "text/xml")
\r
303 .withBodyFile(responseFile)));
\r
306 public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){
\r
307 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth))
\r
308 .willReturn(aResponse()
\r
310 .withHeader("Content-Type", "text/xml")
\r
311 .withBodyFile(responseFile)));
\r
314 public static void MockGetGenericVnfById_404(String vnfId){
\r
315 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
\r
316 .willReturn(aResponse()
\r
317 .withStatus(404)));
\r
320 public static void MockGetGenericVnfById_500(String vnfId){
\r
321 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
\r
322 .willReturn(aResponse()
\r
323 .withStatus(500)));
\r
326 public static void MockGetGenericVnfByName(String vnfName, String responseFile){
\r
327 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
\r
328 .willReturn(aResponse()
\r
330 .withHeader("Content-Type", "text/xml")
\r
331 .withBodyFile(responseFile)));
\r
334 public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){
\r
335 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))
\r
336 .willReturn(aResponse()
\r
338 .withHeader("Content-Type", "text/xml")
\r
339 .withBodyFile(responseFile)));
\r
342 public static void MockGetGenericVnfByName_404(String vnfName){
\r
343 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName))
\r
344 .willReturn(aResponse()
\r
345 .withStatus(404)));
\r
348 public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){
\r
349 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
\r
350 .willReturn(aResponse()
\r
351 .withStatus(204)));
\r
354 public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){
\r
355 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
\r
356 .willReturn(aResponse()
\r
357 .withStatus(statusCode)));
\r
360 public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){
\r
361 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion))
\r
362 .willReturn(aResponse()
\r
363 .withStatus(500)));
\r
366 public static void MockPutGenericVnf(String vnfId){
\r
367 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
\r
368 .willReturn(aResponse()
\r
369 .withStatus(200)));
\r
372 public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) {
\r
373 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
\r
374 .withRequestBody(containing(requestBodyContaining))
\r
375 .willReturn(aResponse()
\r
376 .withStatus(statusCode)));
\r
379 public static void MockPutGenericVnf(String vnfId, int statusCode) {
\r
380 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
\r
381 .willReturn(aResponse()
\r
382 .withStatus(statusCode)));
\r
385 public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){
\r
386 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
\r
387 .willReturn(aResponse()
\r
388 .withStatus(statusCode)));
\r
391 public static void MockPatchGenericVnf(String vnfId){
\r
392 stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
\r
393 .willReturn(aResponse()
\r
394 .withStatus(200)));
\r
397 * Vce Mock StubResponses below
\r
399 public static void MockGetVceById(String vnfId, String responseFile){
\r
400 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
\r
401 .willReturn(aResponse()
\r
403 .withHeader("Content-Type", "text/xml")
\r
404 .withBodyFile(responseFile)));
\r
407 public static void MockGetVceByName(String vnfName, String responseFile){
\r
408 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName))
\r
409 .willReturn(aResponse()
\r
411 .withHeader("Content-Type", "text/xml")
\r
412 .withBodyFile(responseFile)));
\r
415 public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){
\r
416 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion))
\r
417 .willReturn(aResponse()
\r
418 .withStatus(statusCode)));
\r
421 public static void MockPutVce(String vnfId){
\r
422 stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId))
\r
423 .willReturn(aResponse()
\r
424 .withStatus(200)));
\r
427 public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){
\r
428 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))
\r
429 .willReturn(aResponse()
\r
431 .withHeader("Content-Type", "text/xml")
\r
432 .withBodyFile(responseFile)));
\r
435 public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){
\r
436 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))
\r
437 .willReturn(aResponse()
\r
438 .withStatus(statusCode)
\r
439 .withHeader("Content-Type", "text/xml")
\r
440 .withBodyFile(responseFile)));
\r
444 * Tenant Mock StubResponses below
\r
446 public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) {
\r
447 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"))
\r
448 .willReturn(aResponse()
\r
450 .withHeader("Content-Type", "text/xml")
\r
451 .withBodyFile(responseFile)));
\r
454 public static void MockGetTenant(String tenantId, String responseFile) {
\r
455 stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId))
\r
456 .willReturn(aResponse()
\r
458 .withHeader("Content-Type", "text/xml")
\r
459 .withBodyFile(responseFile)));
\r
463 * Network Mock StubResponses below
\r
465 public static void MockGetNetwork(String networkId, String responseFile, int statusCode) {
\r
466 stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
\r
467 .willReturn(aResponse()
\r
468 .withStatus(statusCode)
\r
469 .withHeader("Content-Type", "text/xml")
\r
470 .withBodyFile(responseFile)));
\r
473 public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) {
\r
474 stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
\r
475 .willReturn(aResponse()
\r
477 .withHeader("Content-Type", "text/xml")
\r
478 .withBodyFile(responseFile)));
\r
481 public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) {
\r
482 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))
\r
483 .willReturn(aResponse()
\r
485 .withHeader("Content-Type", "text/xml")
\r
486 .withBodyFile(responseFile)));
\r
489 public static void MockGetNetworkByName(String networkName, String responseFile) {
\r
490 stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
\r
491 .willReturn(aResponse()
\r
493 .withHeader("Content-Type", "text/xml")
\r
494 .withBodyFile(responseFile)));
\r
497 public static void MockGetNetworkByName_404(String responseFile, String networkName) {
\r
498 stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
\r
499 .willReturn(aResponse()
\r
501 .withHeader("Content-Type", "text/xml")
\r
502 .withBodyFile(responseFile)));
\r
505 public static void MockGetNetworkCloudRegion_404(String cloudRegion) {
\r
506 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))
\r
507 .willReturn(aResponse()
\r
508 .withStatus(404)));
\r
511 public static void MockPutNetwork(String networkId, int statusCode, String responseFile) {
\r
512 stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId))
\r
513 .willReturn(aResponse()
\r
514 .withStatus(statusCode)
\r
515 .withHeader("Content-Type", "text/xml")
\r
516 .withBodyFile(responseFile)));
\r
519 public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) {
\r
520 stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))
\r
521 .willReturn(aResponse()
\r
522 .withStatus(statusCode)
\r
523 .withHeader("Content-Type", "text/xml")
\r
524 .withBodyFile(responseFile)));
\r
527 public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) {
\r
528 stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))
\r
529 .willReturn(aResponse()
\r
530 .withStatus(statusCode)
\r
531 .withHeader("Content-Type", "text/xml")
\r
532 .withBodyFile(responseFile)));
\r
535 public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) {
\r
536 stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all"))
\r
537 .willReturn(aResponse()
\r
539 .withHeader("Content-Type", "text/xml")
\r
540 .withBodyFile(responseFile)));
\r
543 public static void MockGetNetworkPolicy(String responseFile, String policy) {
\r
544 stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all"))
\r
545 .willReturn(aResponse()
\r
547 .withHeader("Content-Type", "text/xml")
\r
548 .withBodyFile(responseFile)));
\r
551 public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) {
\r
552 stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))
\r
553 .willReturn(aResponse()
\r
554 .withStatus(statusCode)
\r
555 .withHeader("Content-Type", "text/xml")
\r
556 .withBodyFile(responseFile)));
\r
559 public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) {
\r
560 stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))
\r
561 .willReturn(aResponse()
\r
562 .withStatus(statusCode)
\r
563 .withHeader("Content-Type", "text/xml")
\r
564 .withBodyFile(responseFile)));
\r
567 public static void MockGetNetworkTableReference(String responseFile, String tableReference) {
\r
568 stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all"))
\r
569 .willReturn(aResponse()
\r
571 .withHeader("Content-Type", "text/xml")
\r
572 .withBodyFile(responseFile)));
\r
575 public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) {
\r
576 stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth ))
\r
577 .willReturn(aResponse()
\r
579 .withHeader("Content-Type", "text/xml")
\r
580 .withBodyFile(responseFile)));
\r
583 public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) {
\r
584 stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))
\r
585 .willReturn(aResponse()
\r
586 .withStatus(statusCode)
\r
587 .withHeader("Content-Type", "text/xml")
\r
588 .withBodyFile(responseFile)));
\r
591 public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) {
\r
592 stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))
\r
593 .willReturn(aResponse()
\r
594 .withStatus(statusCode)
\r
595 .withHeader("Content-Type", "text/xml")
\r
596 .withBodyFile(responseFile)));
\r
599 public static void MockPatchVfModuleId(String vnfId, String vfModuleId) {
\r
600 stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
\r
601 .willReturn(aResponse()
\r
602 .withStatus(200)));
\r
607 public static void MockVNFAdapterRestVfModule() {
\r
608 stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
\r
609 .willReturn(aResponse()
\r
611 .withHeader("Content-Type", "application/xml")));
\r
612 stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
\r
613 .willReturn(aResponse()
\r
615 .withHeader("Content-Type", "application/xml")));
\r
616 stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
\r
617 .willReturn(aResponse()
\r
619 .withHeader("Content-Type", "application/xml")));
\r
620 stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
\r
621 .willReturn(aResponse()
\r
623 .withHeader("Content-Type", "application/xml")));
\r
626 public static void MockDBUpdateVfModule(){
\r
627 stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
\r
628 .willReturn(aResponse()
\r
630 .withHeader("Content-Type", "text/xml")
\r
631 .withBodyFile("VfModularity/DBUpdateResponse.xml")));
\r
634 // start of mocks used locally and by other VF Module unit tests
\r
635 public static void MockSDNCAdapterVfModule() {
\r
636 // simplified the implementation to return "success" for all requests
\r
637 stubFor(post(urlEqualTo("/SDNCAdapter"))
\r
638 // .withRequestBody(containing("SvcInstanceId><"))
\r
639 .willReturn(aResponse()
\r
641 .withHeader("Content-Type", "text/xml")
\r
642 .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
\r
646 // start of mocks used locally and by other VF Module unit tests
\r
647 public static void MockAAIVfModule() {
\r
648 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
\r
650 .willReturn(aResponse()
\r
652 .withHeader("Content-Type", "text/xml")
\r
653 .withBodyFile("VfModularity/VfModule-supercool.xml")));
\r
654 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm"))
\r
656 .willReturn(aResponse()
\r
658 .withHeader("Content-Type", "text/xml")
\r
659 .withBodyFile("VfModularity/VfModule-lukewarm.xml")));
\r
660 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
\r
662 .willReturn(aResponse()
\r
664 .withHeader("Content-Type", "text/xml")
\r
665 .withBodyFile("VfModularity/VfModule-new.xml")));
\r
666 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1"))
\r
667 .willReturn(aResponse()
\r
669 .withHeader("Content-Type", "text/xml")
\r
670 .withBodyFile("VfModularity/GenericVnf.xml")));
\r
671 stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
\r
672 // .withRequestBody(containing("PCRF"))
\r
673 .willReturn(aResponse()
\r
674 .withStatus(200)));
\r
675 stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
\r
676 // .withRequestBody(containing("PCRF"))
\r
677 .willReturn(aResponse()
\r
678 .withStatus(200)));
\r
679 // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup
\r
680 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
\r
681 .withRequestBody(containing("PCRF"))
\r
682 .willReturn(aResponse()
\r
683 .withStatus(200)));
\r
684 // HTTP PUT stub still used by DoCreateVfModuleTest
\r
685 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*"))
\r
686 .withRequestBody(containing("MODULELABEL"))
\r
687 .willReturn(aResponse()
\r
688 .withStatus(200)));
\r
689 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
\r
690 .willReturn(aResponse()
\r
692 .withHeader("Content-Type", "text/xml")
\r
693 .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
\r
694 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987"))
\r
695 .willReturn(aResponse()
\r
697 .withHeader("Content-Type", "text/xml")
\r
698 .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml")));
\r
699 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21/volume-groups/volume-group/78987"))
\r
700 .willReturn(aResponse()
\r
702 .withHeader("Content-Type", "text/xml")
\r
703 .withBodyFile("VfModularity/VolumeGroup.xml")));
\r
704 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/78987"))
\r
705 .willReturn(aResponse()
\r
707 .withHeader("Content-Type", "text/xml")
\r
708 .withBodyFile("VfModularity/VolumeGroup.xml")));
\r
709 stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020"))
\r
710 .willReturn(aResponse()
\r
712 .withHeader("Content-Type", "text/xml")
\r
713 .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml")));
\r
714 stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
\r
715 .willReturn(aResponse()
\r
717 .withHeader("Content-Type", "text/xml")
\r
718 .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml")));
\r
719 stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId"))
\r
720 .withRequestBody(containing("NEWvBNGModuleId"))
\r
721 .willReturn(aResponse()
\r
722 .withStatus(200)));
\r
730 * Cloud infrastructure below
\r
733 public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) {
\r
734 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId))
\r
735 .willReturn(aResponse()
\r
736 .withStatus(statusCode)
\r
737 .withHeader("Content-Type", "text/xml")
\r
738 .withBodyFile(responseFile)));
\r
742 * Volume Group StubResponse below
\r
744 public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {
\r
745 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
\r
746 .willReturn(aResponse()
\r
748 .withHeader("Content-Type", "text/xml")
\r
749 .withBodyFile(responseFile)));
\r
752 public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {
\r
753 stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
\r
754 .willReturn(aResponse()
\r
755 .withStatus(statusCode)
\r
756 .withHeader("Content-Type", "text/xml")
\r
757 .withBodyFile(responseFile)));
\r
760 public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {
\r
761 stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
\r
762 .willReturn(aResponse()
\r
763 .withStatus(statusCode)
\r
764 .withHeader("Content-Type", "text/xml")
\r
765 .withBodyFile(responseFile)));
\r
768 public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {
\r
769 stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
\r
770 .willReturn(aResponse()
\r
771 .withStatus(statusCode)));
\r
774 public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) {
\r
775 stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
\r
776 .willReturn(aResponse()
\r
777 .withStatus(404)));
\r
780 public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) {
\r
781 stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
\r
782 .willReturn(aResponse()
\r
783 .withStatus(200)));
\r
787 * VF-Module StubResponse below
\r
788 * @param statusCode TODO
\r
790 public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) {
\r
791 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
\r
792 .willReturn(aResponse()
\r
793 .withStatus(statusCode)
\r
794 .withHeader("Content-Type", "text/xml")
\r
795 .withBodyFile(responseFile)));
\r
798 public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
\r
799 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
\r
800 .withRequestBody(containing(requestContaining))
\r
801 .willReturn(aResponse()
\r
803 .withHeader("Content-Type", "text/xml")));
\r
806 public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
\r
807 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId))
\r
808 .withRequestBody(containing(requestContaining))
\r
809 .willReturn(aResponse()
\r
810 .withStatus(200)));
\r
813 public static void MockPutVfModuleId(String vnfId, String vfModuleId) {
\r
814 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
\r
815 .willReturn(aResponse()
\r
816 .withStatus(200)));
\r
819 public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) {
\r
820 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
\r
821 .willReturn(aResponse()
\r
822 .withStatus(returnCode)));
\r
825 public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) {
\r
826 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))
\r
827 .willReturn(aResponse()
\r
828 .withStatus(returnCode)));
\r
831 public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) {
\r
832 stubFor(patch(urlMatching(endpoint))
\r
833 .willReturn(aResponse()
\r
834 .withStatus(statusCode)));
\r
837 /* AAI Pserver Queries */
\r
838 public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) {
\r
839 stubFor(put(urlMatching("/v10/query.*"))
\r
840 .willReturn(aResponse()
\r
841 .withStatus(statusCode)
\r
842 .withHeader("Content-Type", "application/json")
\r
843 .withBodyFile(responseFile)));
\r
846 public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) {
\r
847 stubFor(get(urlMatching("/v10/network/generic-vnfs/.*"))
\r
848 .willReturn(aResponse()
\r
849 .withStatus(statusCode)
\r
850 .withHeader("Content-Type", "application/json; charset=utf-8")
\r
851 .withBodyFile(responseFile)));
\r
854 public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) {
\r
855 stubFor(patch(urlMatching("/v10/network/generic-vnfs/.*"))
\r
856 .willReturn(aResponse()
\r
857 .withStatus(statusCode)
\r
861 //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////
\r
863 public static void MockGetVceById(){
\r
864 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1"))
\r
865 .willReturn(aResponse()
\r
867 .withHeader("Content-Type", "text/xml")
\r
868 .withBodyFile("GenericFlows/getVceResponse.xml")));
\r
871 public static void MockGetVceByName(){
\r
872 stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123"))
\r
873 .willReturn(aResponse()
\r
875 .withHeader("Content-Type", "text/xml")
\r
876 .withBodyFile("GenericFlows/getVceByNameResponse.xml")));
\r
879 public static void MockPutVce(){
\r
880 stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123"))
\r
881 .willReturn(aResponse()
\r
882 .withStatus(200)));
\r
885 public static void MockDeleteVce(){
\r
886 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
\r
887 .willReturn(aResponse()
\r
888 .withStatus(204)));
\r
891 public static void MockDeleteVce_404(){
\r
892 stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123"))
\r
893 .willReturn(aResponse()
\r
894 .withStatus(404)));
\r
898 public static void MockDeleteServiceSubscription(){
\r
899 stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
\r
900 .willReturn(aResponse()
\r
901 .withStatus(204)));
\r
904 public static void MockGetServiceSubscription(){
\r
905 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
\r
906 .willReturn(aResponse()
\r
908 .withHeader("Content-Type", "text/xml")
\r
909 .withBodyFile("GenericFlows/getServiceSubscription.xml")));
\r
912 public static void MockGetServiceSubscription_200Empty(){
\r
913 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234"))
\r
914 .willReturn(aResponse()
\r
916 .withHeader("Content-Type", "text/xml")
\r
920 public static void MockGetServiceSubscription_404() {
\r
921 stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
\r
922 .willReturn(aResponse()
\r
923 .withStatus(404)));
\r
926 public static void MockGENPSIPutServiceInstance(){
\r
927 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"))
\r
928 .willReturn(aResponse()
\r
930 .withHeader("Content-Type", "text/xml")
\r
931 .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
\r
935 public static void MockGENPSIPutServiceSubscription(){
\r
936 stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET"))
\r
937 .willReturn(aResponse()
\r
939 .withHeader("Content-Type", "text/xml")
\r
940 .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml")));
\r
943 public static void MockGENPSIPutServiceInstance_get500(){
\r
944 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"))
\r
945 .willReturn(aResponse()
\r
947 .withHeader("Content-Type", "text/xml")
\r
948 .withBodyFile("GenericPutServiceInstance/aaiFault.xml")));
\r
952 public static void MockGetGenericVnfById(){
\r
953 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
\r
954 .willReturn(aResponse()
\r
956 .withHeader("Content-Type", "text/xml")
\r
957 .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
\r
960 public static void MockGetGenericVnfById_404(){
\r
961 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
\r
962 .willReturn(aResponse()
\r
963 .withStatus(404)));
\r
966 public static void MockGetGenericVnfByName(){
\r
967 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
\r
968 .willReturn(aResponse()
\r
970 .withHeader("Content-Type", "text/xml")
\r
971 .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
\r
974 public static void MockGetGenericVnfByName_hasRelationships(){
\r
975 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
\r
976 .willReturn(aResponse()
\r
978 .withHeader("Content-Type", "text/xml")
\r
979 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
\r
982 public static void MockGetGenericVnfById_hasRelationships(){
\r
983 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
\r
984 .willReturn(aResponse()
\r
986 .withHeader("Content-Type", "text/xml")
\r
987 .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
\r
990 public static void MockGetGenericVnfById_500(){
\r
991 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
\r
992 .willReturn(aResponse()
\r
993 .withStatus(500)));
\r
996 public static void MockGetGenericVnfByName_404(){
\r
997 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123"))
\r
998 .willReturn(aResponse()
\r
999 .withStatus(404)));
\r
1002 public static void MockPutGenericVnf(){
\r
1003 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
\r
1004 .willReturn(aResponse()
\r
1005 .withStatus(200)));
\r
1008 public static void MockPutGenericVnf_400(){
\r
1009 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123"))
\r
1010 .willReturn(aResponse()
\r
1011 .withStatus(400)));
\r
1014 public static void MockDeleteGenericVnf(){
\r
1015 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
\r
1016 .willReturn(aResponse()
\r
1017 .withStatus(204)));
\r
1020 public static void MockDeleteGenericVnf_404(){
\r
1021 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
\r
1022 .willReturn(aResponse()
\r
1023 .withStatus(404)));
\r
1026 public static void MockDeleteGenericVnf_500(){
\r
1027 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123"))
\r
1028 .willReturn(aResponse()
\r
1029 .withStatus(500)));
\r
1032 public static void MockDeleteGenericVnf_412(){
\r
1033 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123"))
\r
1034 .willReturn(aResponse()
\r
1035 .withStatus(412)));
\r