2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.vnfmadapter.rest;
23 import static org.junit.Assert.*;
24 import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
25 import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
26 import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
27 import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
28 import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
29 import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
30 import java.util.ArrayList;
31 import java.util.List;
32 import java.util.Random;
33 import org.junit.Before;
34 import org.junit.Test;
35 import org.junit.runner.RunWith;
36 import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
37 import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.*;
38 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
39 import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
40 import org.slf4j.Logger;
41 import org.slf4j.LoggerFactory;
42 import org.springframework.beans.factory.annotation.Autowired;
43 import org.springframework.beans.factory.annotation.Qualifier;
44 import org.springframework.boot.test.context.SpringBootTest;
45 import org.springframework.boot.test.web.client.TestRestTemplate;
46 import org.springframework.boot.web.server.LocalServerPort;
47 import org.springframework.http.HttpEntity;
48 import org.springframework.http.HttpMethod;
49 import org.springframework.http.HttpStatus;
50 import org.springframework.http.MediaType;
51 import org.springframework.http.ResponseEntity;
52 import org.springframework.test.context.ActiveProfiles;
53 import org.springframework.test.context.junit4.SpringRunner;
54 import org.springframework.test.web.client.MockRestServiceServer;
55 import org.springframework.web.client.RestTemplate;
56 import com.google.gson.Gson;
59 * @author gareth.roper@est.tech
61 @RunWith(SpringRunner.class)
62 @SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
63 @ActiveProfiles("test")
64 public class Sol003PackageManagementControllerTest {
66 private static final Logger logger = LoggerFactory.getLogger(Sol003PackageManagementControllerTest.class);
72 @Qualifier(CONFIGURABLE_REST_TEMPLATE)
73 private RestTemplate testRestTemplate;
76 private Sol003PackageManagementController controller;
79 private TestRestTemplate restTemplate;
81 private static final String VNF_PACKAGE_ID = "myVnfPackageId";
82 private static final String ARTIFACT_PATH = "myArtifactPath";
83 private static final String MSB_BASE_URL = "http://msb_iag.onap:80/api/vnfpkgm/v1/vnf_packages";
84 private static final String VNFPKGM_BASE_URL = PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages";
85 private static final String localhostUrl = "http://localhost:";
86 private static final String GET_VNF_PACKAGES_URL = "";
87 private static final String GET_VNF_PACKAGE_BY_ID_URL = "/" + VNF_PACKAGE_ID;
88 private static final String VNFD_ID = "vnfdId";
89 private static final String VNF_PROVIDER = "vnfProvider";
90 private static final String VNF_PRODUCT_NAME = "vnfProductName";
91 private static final String VNF_SOFTWARE_VERSION = "vnfSoftwareVersion";
92 private static final String VNFD_VERSION = "vnfdVersion";
93 private static final String ALGORITHM = "algorithm";
94 private static final String HASH = "hash";
95 private static final String URI_HREF = "uriHref";
97 private MockRestServiceServer mockRestServer;
98 private BasicHttpHeadersProvider basicHttpHeadersProvider;
99 private final Gson gson = new Gson();
101 public Sol003PackageManagementControllerTest() {}
104 public void setUp() {
105 final MockRestServiceServer.MockRestServiceServerBuilder builder =
106 MockRestServiceServer.bindTo(testRestTemplate);
107 builder.ignoreExpectOrder(true);
108 mockRestServer = builder.build();
109 basicHttpHeadersProvider = new BasicHttpHeadersProvider();
113 public void testGetPackageContent_ValidArray_Success() {
114 final byte[] responseArray = buildByteArrayWithRandomData(10);
116 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
117 .andExpect(method(HttpMethod.GET))
118 .andRespond(withSuccess(responseArray, MediaType.APPLICATION_OCTET_STREAM));
120 final String testURL = "http://localhost:" + port + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/"
121 + VNF_PACKAGE_ID + "/package_content";
122 final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
123 final ResponseEntity<byte[]> responseEntity =
124 restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
126 assertEquals(byte[].class, responseEntity.getBody().getClass());
127 assertArrayEquals(responseEntity.getBody(), responseArray);
128 assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
132 public void testOnGetPackageContent_Conflict_Fail() {
133 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
134 .andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.CONFLICT));
136 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
138 assertTrue(responseEntity.getBody() instanceof ProblemDetails);
139 assertEquals(HttpStatus.CONFLICT, responseEntity.getStatusCode());
143 public void testOnGetPackageContent_NotFound_Fail() {
144 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
145 .andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.NOT_FOUND));
147 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
149 assertTrue(responseEntity.getBody() instanceof ProblemDetails);
150 assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode());
154 public void testOnGetPackageContent_UnauthorizedClient_Fail() {
155 final String testURL = "http://localhost:" + port + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/"
156 + VNF_PACKAGE_ID + "/package_content";
157 final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
158 final ResponseEntity<ProblemDetails> responseEntity =
159 restTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
161 assertTrue(responseEntity.getBody() instanceof ProblemDetails);
162 assertEquals(HttpStatus.UNAUTHORIZED, responseEntity.getStatusCode());
166 public void testOnGetPackageContent_InternalServerError_Fail() {
167 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
168 .andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
170 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
172 assertTrue(responseEntity.getBody() instanceof ProblemDetails);
173 assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
177 public void testOnGetPackageContent_BadRequest_Fail() {
178 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
179 .andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.BAD_REQUEST));
181 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
183 assertTrue(responseEntity.getBody() instanceof ProblemDetails);
184 assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
188 public void testOnGetPackageContent_UnauthorizedServer_InternalError_Fail() {
189 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
190 .andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.UNAUTHORIZED));
192 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
194 assertTrue(responseEntity.getBody() instanceof ProblemDetails);
195 assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
199 public void testGetPackageContent_SuccessResponseFromServerWithNullPackage_Fail() {
200 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
201 .andExpect(method(HttpMethod.GET)).andRespond(withSuccess());
203 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
205 assertEquals(ProblemDetails.class, responseEntity.getBody().getClass());
206 assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
210 public void testVnfPackagesReceivedAsInlineResponse2001ListIfGetVnfPackagesSuccessful() {
211 final VnfPkgInfo[] responses = createVnfPkgArray();
213 mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
214 .andRespond(withSuccess(gson.toJson(responses), MediaType.APPLICATION_JSON));
216 final String testURL = localhostUrl + port + VNFPKGM_BASE_URL;
217 final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
219 final ResponseEntity<InlineResponse2001[]> responseEntity = restTemplate.withBasicAuth("test", "test")
220 .exchange(testURL, HttpMethod.GET, request, InlineResponse2001[].class);
222 assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
223 assertNotNull(responseEntity.getBody());
224 final InlineResponse2001[] inlineResponse2001array = responseEntity.getBody();
225 final InlineResponse2001 inlineResponse2001 = inlineResponse2001array[0];
226 assertEquals(VNF_PACKAGE_ID, inlineResponse2001.getId());
227 assertEquals(VNFD_ID, inlineResponse2001.getVnfdId());
228 assertEquals(VNFD_ID, inlineResponse2001.getSoftwareImages().get(0).getId());
229 assertEquals(VNF_PRODUCT_NAME, inlineResponse2001.getSoftwareImages().get(0).getName());
230 assertEquals(ALGORITHM, inlineResponse2001.getChecksum().getAlgorithm());
231 assertEquals(HASH, inlineResponse2001.getChecksum().getHash());
232 assertEquals(ARTIFACT_PATH, inlineResponse2001.getAdditionalArtifacts().get(0).getArtifactPath());
233 assertEquals(ALGORITHM, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getAlgorithm());
234 assertEquals(HASH, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getHash());
235 assertEquals(URI_HREF, inlineResponse2001.getLinks().getSelf().getHref());
239 public void test400BadRequestInfoReceivedAsProblemDetailsIfGetVnfPackagesIs400BadRequest() {
240 mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
241 .andRespond(withStatus(HttpStatus.BAD_REQUEST));
243 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGES_URL);
244 assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode());
246 assertNotNull(responseEntity.getBody());
247 final ProblemDetails problemDetails = responseEntity.getBody();
248 assertEquals("Error: Bad Request Received", problemDetails.getDetail());
252 public void test404NotFoundInfoReceivedAsProblemDetailsIfGetVnfPackagesIs404NotFound() {
253 mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
254 .andRespond(withStatus(HttpStatus.NOT_FOUND));
256 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGES_URL);
257 assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode());
259 assertNotNull(responseEntity.getBody());
260 final ProblemDetails problemDetails = responseEntity.getBody();
261 assertEquals("No Vnf Packages found", problemDetails.getDetail());
265 public void test500InternalServerErrorProblemDetailsReceivedIfGetVnfPackagesReturns500InternalServerError() {
266 mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
267 .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
269 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGES_URL);
270 assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
272 assertNotNull(responseEntity.getBody());
273 final ProblemDetails problemDetails = responseEntity.getBody();
274 assertEquals("Internal Server Error Occurred.", problemDetails.getDetail());
278 public void test500InternalServerErrorProblemDetailsReceivedIfGetVnfPackagesReturnsANullPackage() {
279 mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET)).andRespond(withSuccess());
281 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGES_URL);
282 assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
284 assertNotNull(responseEntity.getBody());
285 final ProblemDetails problemDetails = responseEntity.getBody();
286 assertEquals("An error occurred, a null response was received by the\n"
287 + " Sol003PackageManagementController from the EtsiCatalogManager using the GET \"vnf_packages\" \n"
288 + "endpoint.", problemDetails.getDetail());
292 public void testVnfPackageReceivedAsInlineResponse2001IfGetVnfPackageByIdSuccessful() {
293 final VnfPkgInfo response = createVnfPkgInfo(VNF_PACKAGE_ID);
295 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
296 .andRespond(withSuccess(gson.toJson(response), MediaType.APPLICATION_JSON));
298 final String testURL = localhostUrl + port + VNFPKGM_BASE_URL + "/" + VNF_PACKAGE_ID;
299 final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
300 final ResponseEntity<InlineResponse2001> responseEntity = restTemplate.withBasicAuth("test", "test")
301 .exchange(testURL, HttpMethod.GET, request, InlineResponse2001.class);
303 assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
304 assertNotNull(responseEntity.getBody());
305 final InlineResponse2001 inlineResponse2001 = responseEntity.getBody();
306 assertEquals(VNF_PACKAGE_ID, inlineResponse2001.getId());
307 assertEquals(VNFD_ID, inlineResponse2001.getVnfdId());
308 assertEquals(VNFD_ID, inlineResponse2001.getSoftwareImages().get(0).getId());
309 assertEquals(VNF_PRODUCT_NAME, inlineResponse2001.getSoftwareImages().get(0).getName());
310 assertEquals(ALGORITHM, inlineResponse2001.getChecksum().getAlgorithm());
311 assertEquals(HASH, inlineResponse2001.getChecksum().getHash());
312 assertEquals(ARTIFACT_PATH, inlineResponse2001.getAdditionalArtifacts().get(0).getArtifactPath());
313 assertEquals(ALGORITHM, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getAlgorithm());
314 assertEquals(HASH, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getHash());
315 assertEquals(URI_HREF, inlineResponse2001.getLinks().getSelf().getHref());
319 public void test400BadRequestInfoReceivedAsProblemDetailsIfGetVnfPackageByIdIs400BadRequest() {
320 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
321 .andRespond(withStatus(HttpStatus.BAD_REQUEST));
323 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGE_BY_ID_URL);
325 assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode());
326 assertNotNull(responseEntity.getBody());
327 final ProblemDetails problemDetails = responseEntity.getBody();
328 assertEquals("Error: Bad Request Received", problemDetails.getDetail());
332 public void test404NotFoundInfoReceivedAsProblemDetailsIfGetVnfPackageByIdIs404NotFound() {
333 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
334 .andRespond(withStatus(HttpStatus.NOT_FOUND));
336 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGE_BY_ID_URL);
338 assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode());
339 assertNotNull(responseEntity.getBody());
340 final ProblemDetails problemDetails = responseEntity.getBody();
341 assertEquals("No Vnf Package found with vnfPkgId: " + VNF_PACKAGE_ID, problemDetails.getDetail());
345 public void test500InternalServerErrorProblemDetailsReceivedIfGetVnfPackageByIdReturns500InternalServerError() {
346 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
347 .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
349 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGE_BY_ID_URL);
351 assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
352 assertNotNull(responseEntity.getBody());
353 final ProblemDetails problemDetails = responseEntity.getBody();
354 assertEquals("Internal Server Error Occurred.", problemDetails.getDetail());
358 public void test500InternalServerErrorProblemDetailsReceivedIfGetVnfPackageByIdReturnsANullPackage() {
359 mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
360 .andRespond(withSuccess());
362 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGE_BY_ID_URL);
363 assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
365 assertNotNull(responseEntity.getBody());
366 final ProblemDetails problemDetails = responseEntity.getBody();
367 assertEquals("An error occurred, a null response was received by the\n"
368 + " Sol003PackageManagementController from the EtsiCatalogManager using the GET \"vnf_packages\" by vnfPkgId: \""
369 + VNF_PACKAGE_ID + "\" \n" + "endpoint.", problemDetails.getDetail());
372 // The below 2 test methods are here to improve code coverage and provide a foundation for writing future tests
374 public void testGetVnfd_Not_Implemented() {
375 final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd");
376 assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
380 public void testGetArtifact_Not_Implemented() {
381 final ResponseEntity<ProblemDetails> responseEntity =
382 sendHttpRequest(VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH);
383 assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
386 // Simply returns a byte array filled with random data, for use in the tests.
387 private byte[] buildByteArrayWithRandomData(final int sizeInKb) {
388 final Random rnd = new Random();
389 final byte[] b = new byte[sizeInKb * 1024]; // converting kb to byte
394 private ResponseEntity<ProblemDetails> sendHttpRequest(final String url) {
395 final String testURL = localhostUrl + port + VNFPKGM_BASE_URL + "/" + url;
396 final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
397 return restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request,
398 ProblemDetails.class);
401 private VnfPkgInfo[] createVnfPkgArray() {
402 final VnfPkgInfo[] vnfPkgInfoArray = new VnfPkgInfo[1];
403 final VnfPkgInfo vnfPkgInfo = createVnfPkgInfo(VNF_PACKAGE_ID);
404 vnfPkgInfoArray[0] = vnfPkgInfo;
405 return vnfPkgInfoArray;
408 private VnfPkgInfo createVnfPkgInfo(final String vnfPackageId) {
409 final VnfPkgInfo vnfPkgInfo = new VnfPkgInfo();
410 vnfPkgInfo.setId(vnfPackageId);
411 vnfPkgInfo.setVnfdId(VNFD_ID);
412 vnfPkgInfo.setVnfProvider(VNF_PROVIDER);
413 vnfPkgInfo.setVnfProductName(VNF_PRODUCT_NAME);
414 vnfPkgInfo.setVnfSoftwareVersion(VNF_SOFTWARE_VERSION);
415 vnfPkgInfo.setVnfdVersion(VNFD_VERSION);
416 vnfPkgInfo.setChecksum(createVnfPkgChecksum());
417 vnfPkgInfo.setSoftwareImages(createSoftwareImages());
418 vnfPkgInfo.setAdditionalArtifacts(createAdditionalArtifacts());
419 vnfPkgInfo.setLinks(createVNFPKGMLinkSerializerLinks());
423 private Checksum createVnfPkgChecksum() {
424 final Checksum checksum = new Checksum();
425 checksum.setAlgorithm(ALGORITHM);
426 checksum.setHash(HASH);
430 private List<VnfPackageSoftwareImageInfo> createSoftwareImages() {
431 final List<VnfPackageSoftwareImageInfo> softwareImages = new ArrayList<>();
432 final VnfPackageSoftwareImageInfo vnfPackageSoftwareImageInfo = new VnfPackageSoftwareImageInfo();
433 vnfPackageSoftwareImageInfo.setId(VNFD_ID);
434 vnfPackageSoftwareImageInfo.setName(VNF_PRODUCT_NAME);
435 vnfPackageSoftwareImageInfo.setProvider("");
436 vnfPackageSoftwareImageInfo.setVersion("");
437 vnfPackageSoftwareImageInfo.setChecksum(createVnfPkgChecksum());
438 vnfPackageSoftwareImageInfo
439 .setContainerFormat(VnfPackageSoftwareImageInfo.ContainerFormatEnum.fromValue("AKI"));
440 softwareImages.add(vnfPackageSoftwareImageInfo);
441 return softwareImages;
444 private List<VnfPackageArtifactInfo> createAdditionalArtifacts() {
445 final List<VnfPackageArtifactInfo> vnfPackageArtifactInfos = new ArrayList<>();
446 final VnfPackageArtifactInfo vnfPackageArtifactInfo =
447 new VnfPackageArtifactInfo().artifactPath(ARTIFACT_PATH).checksum(createVnfPkgChecksum());
448 vnfPackageArtifactInfos.add(vnfPackageArtifactInfo);
449 return vnfPackageArtifactInfos;
452 private VNFPKGMLinkSerializer createVNFPKGMLinkSerializerLinks() {
453 final UriLink uriLink = new UriLink().href(URI_HREF);
454 final VNFPKGMLinkSerializer vnfpkgmLinkSerializer = new VNFPKGMLinkSerializer().self(uriLink);
455 return vnfpkgmLinkSerializer;