aboutsummaryrefslogtreecommitdiffstats
path: root/plans/usecases/pnf-sw-upgrade/so/simulator/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java
blob: 8b6ec8c7b7e0226c363612c8eabbdaccf3a7d5cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
/*-
 * ============LICENSE_START=======================================================
 *  Copyright (C) 2019 Nordix Foundation.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
 * ============LICENSE_END=========================================================
 */
package org.onap.so.aaisimulator.controller;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.onap.so.aaisimulator.utils.Constants.BI_DIRECTIONAL_RELATIONSHIP_LIST_URL;
import static org.onap.so.aaisimulator.utils.Constants.RELATIONSHIP_LIST_RELATIONSHIP_URL;
import static org.onap.so.aaisimulator.utils.Constants.X_HTTP_METHOD_OVERRIDE;
import static org.onap.so.aaisimulator.utils.TestConstants.CLOUD_OWNER_NAME;
import static org.onap.so.aaisimulator.utils.TestConstants.CLOUD_REGION_NAME;
import static org.onap.so.aaisimulator.utils.TestConstants.CUSTOMERS_URL;
import static org.onap.so.aaisimulator.utils.TestConstants.GENERIC_VNF_NAME;
import static org.onap.so.aaisimulator.utils.TestConstants.GENERIC_VNF_URL;
import static org.onap.so.aaisimulator.utils.TestConstants.GLOBAL_CUSTOMER_ID;
import static org.onap.so.aaisimulator.utils.TestConstants.LINE_OF_BUSINESS_NAME;
import static org.onap.so.aaisimulator.utils.TestConstants.PLATFORM_NAME;
import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_INSTANCE_ID;
import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_INSTANCE_URL;
import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_NAME;
import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_SUBSCRIPTIONS_URL;
import static org.onap.so.aaisimulator.utils.TestConstants.SERVICE_TYPE;
import static org.onap.so.aaisimulator.utils.TestConstants.VNF_ID;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
import org.junit.After;
import org.junit.Test;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.RelatedToProperty;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.so.aaisimulator.service.providers.CustomerCacheServiceProvider;
import org.onap.so.aaisimulator.service.providers.GenericVnfCacheServiceProvider;
import org.onap.so.aaisimulator.service.providers.LinesOfBusinessCacheServiceProvider;
import org.onap.so.aaisimulator.service.providers.PlatformCacheServiceProvider;
import org.onap.so.aaisimulator.utils.Constants;
import org.onap.so.aaisimulator.utils.TestConstants;
import org.onap.so.aaisimulator.utils.TestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

/**
 * @author Waqas Ikram (waqas.ikram@est.tech)
 *
 */
public class GenericVnfsControllerTest extends AbstractSpringBootTest {

    @Autowired
    private CustomerCacheServiceProvider customerCacheServiceProvider;

    @Autowired
    private GenericVnfCacheServiceProvider genericVnfCacheServiceProvider;

    @Autowired
    private LinesOfBusinessCacheServiceProvider linesOfBusinessCacheServiceProvider;

    @Autowired
    private PlatformCacheServiceProvider platformVnfCacheServiceProvider;

    @After
    public void after() {
        customerCacheServiceProvider.clearAll();
        genericVnfCacheServiceProvider.clearAll();
        platformVnfCacheServiceProvider.clearAll();
        linesOfBusinessCacheServiceProvider.clearAll();
    }

    @Test
    public void test_putGenericVnf_successfullyAddedToCache() throws Exception {

        final String genericVnfUrl = getUrl(GENERIC_VNF_URL, VNF_ID);
        final ResponseEntity<Void> genericVnfResponse =
                testRestTemplateService.invokeHttpPut(genericVnfUrl, TestUtils.getGenericVnf(), Void.class);
        assertEquals(HttpStatus.ACCEPTED, genericVnfResponse.getStatusCode());

        final ResponseEntity<GenericVnf> response =
                testRestTemplateService.invokeHttpGet(genericVnfUrl, GenericVnf.class);
        assertEquals(HttpStatus.OK, response.getStatusCode());

        assertTrue(response.hasBody());

        final GenericVnf actualGenericVnf = response.getBody();
        assertEquals(GENERIC_VNF_NAME, actualGenericVnf.getVnfName());
        assertEquals(VNF_ID, actualGenericVnf.getVnfId());

    }

    @Test
    public void test_putGenericVnfRelation_successfullyAddedToCache() throws Exception {

        addCustomerServiceAndGenericVnf();

        final String genericVnfRelationShipUrl = getUrl(GENERIC_VNF_URL, VNF_ID, RELATIONSHIP_LIST_RELATIONSHIP_URL);
        final ResponseEntity<Void> genericVnfRelationShipResponse = testRestTemplateService
                .invokeHttpPut(genericVnfRelationShipUrl, TestUtils.getRelationShip(), Void.class);

        assertEquals(HttpStatus.ACCEPTED, genericVnfRelationShipResponse.getStatusCode());


        final Optional<ServiceInstance> optional =
                customerCacheServiceProvider.getServiceInstance(GLOBAL_CUSTOMER_ID, SERVICE_TYPE, SERVICE_INSTANCE_ID);

        assertTrue(optional.isPresent());

        final ServiceInstance actualServiceInstance = optional.get();
        final RelationshipList actualRelationshipList = actualServiceInstance.getRelationshipList();
        assertNotNull(actualRelationshipList);
        assertFalse(actualRelationshipList.getRelationship().isEmpty());
        final Relationship actualRelationShip = actualRelationshipList.getRelationship().get(0);

        assertEquals(Constants.COMPOSED_OF, actualRelationShip.getRelationshipLabel());
        assertEquals(GENERIC_VNF_URL + VNF_ID, actualRelationShip.getRelatedLink());


        assertFalse(actualRelationShip.getRelatedToProperty().isEmpty());
        assertFalse(actualRelationShip.getRelationshipData().isEmpty());
        final RelatedToProperty actualRelatedToProperty = actualRelationShip.getRelatedToProperty().get(0);
        final RelationshipData actualRelationshipData = actualRelationShip.getRelationshipData().get(0);

        assertEquals(Constants.GENERIC_VNF_VNF_NAME, actualRelatedToProperty.getPropertyKey());
        assertEquals(GENERIC_VNF_NAME, actualRelatedToProperty.getPropertyValue());
        assertEquals(Constants.GENERIC_VNF_VNF_ID, actualRelationshipData.getRelationshipKey());
        assertEquals(VNF_ID, actualRelationshipData.getRelationshipValue());

        final Optional<GenericVnf> genericVnfOptional = genericVnfCacheServiceProvider.getGenericVnf(VNF_ID);
        assertTrue(genericVnfOptional.isPresent());
        final GenericVnf actualGenericVnf = genericVnfOptional.get();
        final RelationshipList relationshipList = actualGenericVnf.getRelationshipList();
        assertNotNull(relationshipList);
        assertFalse(relationshipList.getRelationship().isEmpty());

        final Relationship relationship = relationshipList.getRelationship().get(0);
        assertFalse(relationship.getRelatedToProperty().isEmpty());
        assertEquals(3, relationship.getRelationshipData().size());
        assertEquals(CUSTOMERS_URL + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCE_URL, relationship.getRelatedLink());


        final List<RelatedToProperty> relatedToProperty = relationship.getRelatedToProperty();
        final RelatedToProperty firstRelatedToProperty = relatedToProperty.get(0);
        assertEquals(Constants.SERVICE_INSTANCE_SERVICE_INSTANCE_NAME, firstRelatedToProperty.getPropertyKey());
        assertEquals(SERVICE_NAME, firstRelatedToProperty.getPropertyValue());

        final List<RelationshipData> relationshipData = relationship.getRelationshipData();

        final RelationshipData globalRelationshipData =
                getRelationshipData(relationshipData, Constants.CUSTOMER_GLOBAL_CUSTOMER_ID);
        assertNotNull(globalRelationshipData);
        assertEquals(GLOBAL_CUSTOMER_ID, globalRelationshipData.getRelationshipValue());

        final RelationshipData serviceSubscriptionRelationshipData =
                getRelationshipData(relationshipData, Constants.SERVICE_SUBSCRIPTION_SERVICE_TYPE);
        assertNotNull(serviceSubscriptionRelationshipData);
        assertEquals(SERVICE_TYPE, serviceSubscriptionRelationshipData.getRelationshipValue());

        final RelationshipData serviceInstanceRelationshipData =
                getRelationshipData(relationshipData, Constants.SERVICE_INSTANCE_SERVICE_INSTANCE_ID);
        assertNotNull(serviceInstanceRelationshipData);
        assertEquals(SERVICE_INSTANCE_ID, serviceInstanceRelationshipData.getRelationshipValue());

    }

    @Test
    public void test_putGenericVnfRelationToPlatform_successfullyAddedToCache() throws Exception {
        addCustomerServiceAndGenericVnf();

        final String platformUrl = getUrl(TestConstants.PLATFORMS_URL, PLATFORM_NAME);
        final ResponseEntity<Void> platformResponse =
                testRestTemplateService.invokeHttpPut(platformUrl, TestUtils.getPlatform(), Void.class);
        assertEquals(HttpStatus.ACCEPTED, platformResponse.getStatusCode());

        final String genericVnfRelationShipUrl = getUrl(GENERIC_VNF_URL, VNF_ID, RELATIONSHIP_LIST_RELATIONSHIP_URL);
        final ResponseEntity<Void> genericVnfRelationShipResponse = testRestTemplateService
                .invokeHttpPut(genericVnfRelationShipUrl, TestUtils.getPlatformRelatedLink(), Void.class);

        assertEquals(HttpStatus.ACCEPTED, genericVnfRelationShipResponse.getStatusCode());

        final Optional<GenericVnf> genericVnfOptional = genericVnfCacheServiceProvider.getGenericVnf(VNF_ID);
        assertTrue(genericVnfOptional.isPresent());
        final GenericVnf actualGenericVnf = genericVnfOptional.get();
        final RelationshipList relationshipList = actualGenericVnf.getRelationshipList();
        assertNotNull(relationshipList);
        assertFalse(relationshipList.getRelationship().isEmpty());

        final Relationship relationship = relationshipList.getRelationship().get(0);

        assertEquals(Constants.USES, relationship.getRelationshipLabel());
        assertFalse(relationship.getRelationshipData().isEmpty());
        assertEquals(1, relationship.getRelationshipData().size());
        assertEquals(TestConstants.PLATFORMS_URL + PLATFORM_NAME, relationship.getRelatedLink());


        final List<RelationshipData> relationshipData = relationship.getRelationshipData();

        final RelationshipData platformRelationshipData =
                getRelationshipData(relationshipData, Constants.PLATFORM_PLATFORM_NAME);
        assertNotNull(platformRelationshipData);
        assertEquals(PLATFORM_NAME, platformRelationshipData.getRelationshipValue());

    }

    @Test
    public void test_putGenericVnfRelationToLineOfBusiness_successfullyAddedToCache() throws Exception {
        addCustomerServiceAndGenericVnf();

        final String url = getUrl(TestConstants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
        final ResponseEntity<Void> responseEntity =
                testRestTemplateService.invokeHttpPut(url, TestUtils.getLineOfBusiness(), Void.class);
        assertEquals(HttpStatus.ACCEPTED, responseEntity.getStatusCode());

        final String genericVnfRelationShipUrl = getUrl(GENERIC_VNF_URL, VNF_ID, RELATIONSHIP_LIST_RELATIONSHIP_URL);
        final ResponseEntity<Void> genericVnfRelationShipResponse = testRestTemplateService
                .invokeHttpPut(genericVnfRelationShipUrl, TestUtils.getLineOfBusinessRelatedLink(), Void.class);

        assertEquals(HttpStatus.ACCEPTED, genericVnfRelationShipResponse.getStatusCode());

        final Optional<GenericVnf> genericVnfOptional = genericVnfCacheServiceProvider.getGenericVnf(VNF_ID);
        assertTrue(genericVnfOptional.isPresent());
        final GenericVnf actualGenericVnf = genericVnfOptional.get();
        final RelationshipList relationshipList = actualGenericVnf.getRelationshipList();
        assertNotNull(relationshipList);
        assertFalse(relationshipList.getRelationship().isEmpty());

        final Relationship relationship = relationshipList.getRelationship().get(0);

        assertEquals(Constants.USES, relationship.getRelationshipLabel());
        assertEquals(TestConstants.LINES_OF_BUSINESS_URL + LINE_OF_BUSINESS_NAME, relationship.getRelatedLink());

        assertFalse(relationship.getRelationshipData().isEmpty());
        assertEquals(1, relationship.getRelationshipData().size());

        final List<RelationshipData> relationshipData = relationship.getRelationshipData();

        final RelationshipData lineOfBusinessRelationshipData =
                getRelationshipData(relationshipData, Constants.LINE_OF_BUSINESS_LINE_OF_BUSINESS_NAME);
        assertNotNull(lineOfBusinessRelationshipData);
        assertEquals(LINE_OF_BUSINESS_NAME, lineOfBusinessRelationshipData.getRelationshipValue());

    }

    @Test
    public void test_putGenericVnfRelationToCloudRegion_successfullyAddedToCache() throws Exception {
        addCustomerServiceAndGenericVnf();

        final String url = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);

        final ResponseEntity<Void> responseEntity =
                testRestTemplateService.invokeHttpPut(url, TestUtils.getCloudRegion(), Void.class);
        assertEquals(HttpStatus.ACCEPTED, responseEntity.getStatusCode());

        final String genericVnfRelationShipUrl = getUrl(GENERIC_VNF_URL, VNF_ID, RELATIONSHIP_LIST_RELATIONSHIP_URL);
        final ResponseEntity<Void> genericVnfRelationShipResponse = testRestTemplateService
                .invokeHttpPut(genericVnfRelationShipUrl, TestUtils.getCloudRegionRelatedLink(), Void.class);

        assertEquals(HttpStatus.ACCEPTED, genericVnfRelationShipResponse.getStatusCode());

        final Optional<GenericVnf> genericVnfOptional = genericVnfCacheServiceProvider.getGenericVnf(VNF_ID);
        assertTrue(genericVnfOptional.isPresent());
        final GenericVnf actualGenericVnf = genericVnfOptional.get();
        final RelationshipList relationshipList = actualGenericVnf.getRelationshipList();
        assertNotNull(relationshipList);
        assertFalse(relationshipList.getRelationship().isEmpty());

        final Relationship relationship = relationshipList.getRelationship().get(0);

        assertEquals(Constants.LOCATED_IN, relationship.getRelationshipLabel());
        assertEquals(TestConstants.CLOUD_REGIONS + CLOUD_OWNER_NAME + "/" + CLOUD_REGION_NAME,
                relationship.getRelatedLink());

        assertFalse(relationship.getRelationshipData().isEmpty());
        assertEquals(2, relationship.getRelationshipData().size());

        final List<RelationshipData> relationshipDataList = relationship.getRelationshipData();

        final RelationshipData cloudOwnerRelationshipData =
                getRelationshipData(relationshipDataList, Constants.CLOUD_REGION_CLOUD_OWNER);
        assertNotNull(cloudOwnerRelationshipData);
        assertEquals(CLOUD_OWNER_NAME, cloudOwnerRelationshipData.getRelationshipValue());

        final RelationshipData cloudRegionIdRelationshipData =
                getRelationshipData(relationshipDataList, Constants.CLOUD_REGION_CLOUD_REGION_ID);
        assertNotNull(cloudRegionIdRelationshipData);
        assertEquals(CLOUD_REGION_NAME, cloudRegionIdRelationshipData.getRelationshipValue());

        final List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty();

        final RelatedToProperty cloudRegionOwnerDefinedTypeProperty =
                getRelatedToProperty(relatedToPropertyList, Constants.CLOUD_REGION_OWNER_DEFINED_TYPE);
        assertNotNull(cloudRegionOwnerDefinedTypeProperty);
        assertEquals("OwnerType", cloudRegionOwnerDefinedTypeProperty.getPropertyValue());

    }

    @Test
    public void test_putBiDirectionalRelationShip_successfullyAddedToCache() throws Exception {
        addCustomerServiceAndGenericVnf();

        final String relationShipUrl = getUrl(GENERIC_VNF_URL, VNF_ID, BI_DIRECTIONAL_RELATIONSHIP_LIST_URL);

        final ResponseEntity<Relationship> responseEntity = testRestTemplateService.invokeHttpPut(relationShipUrl,
                TestUtils.getTenantRelationShip(), Relationship.class);
        assertEquals(HttpStatus.ACCEPTED, responseEntity.getStatusCode());

        final Optional<GenericVnf> optional = genericVnfCacheServiceProvider.getGenericVnf(VNF_ID);
        assertTrue(optional.isPresent());

        final GenericVnf actual = optional.get();

        assertNotNull(actual.getRelationshipList());
        final List<Relationship> relationshipList = actual.getRelationshipList().getRelationship();
        assertFalse("Relationship list should not be empty", relationshipList.isEmpty());
        final Relationship relationship = relationshipList.get(0);

        assertFalse("RelationshipData list should not be empty", relationship.getRelationshipData().isEmpty());
        assertFalse("RelatedToProperty list should not be empty", relationship.getRelatedToProperty().isEmpty());
    }

    @Test
    public void test_patchGenericVnf_usingVnfId_OrchStatusChangedInCache() throws Exception {
        addCustomerServiceAndGenericVnf();

        final HttpHeaders httpHeaders = testRestTemplateService.getHttpHeaders();
        httpHeaders.add(X_HTTP_METHOD_OVERRIDE, HttpMethod.PATCH.toString());
        httpHeaders.remove(HttpHeaders.CONTENT_TYPE);
        httpHeaders.add(HttpHeaders.CONTENT_TYPE, Constants.APPLICATION_MERGE_PATCH_JSON);

        final String genericVnfUrl = getUrl(GENERIC_VNF_URL, VNF_ID);
        final ResponseEntity<Void> orchStatuUpdateServiceInstanceResponse = testRestTemplateService
                .invokeHttpPost(httpHeaders, genericVnfUrl, TestUtils.getGenericVnfOrchStatuUpdate(), Void.class);

        assertEquals(HttpStatus.ACCEPTED, orchStatuUpdateServiceInstanceResponse.getStatusCode());

        final ResponseEntity<GenericVnf> response =
                testRestTemplateService.invokeHttpGet(genericVnfUrl, GenericVnf.class);
        assertEquals(HttpStatus.OK, response.getStatusCode());

        assertTrue(response.hasBody());

        final GenericVnf actualGenericVnf = response.getBody();
        assertEquals(GENERIC_VNF_NAME, actualGenericVnf.getVnfName());
        assertEquals(VNF_ID, actualGenericVnf.getVnfId());
        assertEquals("Assigned", actualGenericVnf.getOrchestrationStatus());

    }

    @Test
    public void test_getGenericVnfs_usingSelfLink_getAllGenericVnfsInCache() throws Exception {

        addCustomerServiceAndGenericVnf();

        final String selfLink = "http://localhost:9921/generic-vnf/" + VNF_ID;
        final String url = getUrl(TestConstants.GENERIC_VNFS_URL_1) + "?selflink=" + selfLink;
        final ResponseEntity<GenericVnfs> response = testRestTemplateService.invokeHttpGet(url, GenericVnfs.class);
        assertEquals(HttpStatus.OK, response.getStatusCode());

        assertTrue(response.hasBody());

        final GenericVnfs actualGenericVnfs = response.getBody();
        final List<GenericVnf> genericVnfList = actualGenericVnfs.getGenericVnf();
        assertNotNull(genericVnfList);
        assertEquals(1, genericVnfList.size());
        final GenericVnf actualGenericVnf = genericVnfList.get(0);
        assertEquals(selfLink, actualGenericVnf.getSelflink());
        assertEquals(GENERIC_VNF_NAME, actualGenericVnf.getVnfName());
        assertEquals(VNF_ID, actualGenericVnf.getVnfId());
    }

    @Test
    public void test_deleteGenericVnf_usingVnfIdAndResourceVersion_removedFromCache() throws Exception {

        addCustomerServiceAndGenericVnf();

        final Optional<GenericVnf> genericVnfOptional = genericVnfCacheServiceProvider.getGenericVnf(VNF_ID);
        assertTrue(genericVnfOptional.isPresent());
        final GenericVnf genericVnf = genericVnfOptional.get();

        final String genericVnfDeleteUrl =
                getUrl(GENERIC_VNF_URL, genericVnf.getVnfId()) + "?resource-version=" + genericVnf.getResourceVersion();

        final ResponseEntity<Void> responseEntity =
                testRestTemplateService.invokeHttpDelete(genericVnfDeleteUrl, Void.class);
        assertEquals(HttpStatus.NO_CONTENT, responseEntity.getStatusCode());
        assertFalse(genericVnfCacheServiceProvider.getGenericVnf(VNF_ID).isPresent());

    }

    private void addCustomerServiceAndGenericVnf() throws Exception, IOException {
        final ResponseEntity<Void> customerResponse =
                testRestTemplateService.invokeHttpPut(getUrl(CUSTOMERS_URL), TestUtils.getCustomer(), Void.class);
        assertEquals(HttpStatus.ACCEPTED, customerResponse.getStatusCode());

        final String serviceInstanceUrl = getUrl(CUSTOMERS_URL, SERVICE_SUBSCRIPTIONS_URL, SERVICE_INSTANCE_URL);
        final ResponseEntity<Void> serviceInstanceResponse =
                testRestTemplateService.invokeHttpPut(serviceInstanceUrl, TestUtils.getServiceInstance(), Void.class);
        assertEquals(HttpStatus.ACCEPTED, serviceInstanceResponse.getStatusCode());

        final String genericVnfUrl = getUrl(GENERIC_VNF_URL, VNF_ID);
        final ResponseEntity<Void> genericVnfResponse =
                testRestTemplateService.invokeHttpPut(genericVnfUrl, TestUtils.getGenericVnf(), Void.class);
        assertEquals(HttpStatus.ACCEPTED, genericVnfResponse.getStatusCode());

    }


}