2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.vid.model.serviceInstantiation;
24 import static java.util.stream.Collectors.toList;
26 import com.fasterxml.jackson.annotation.JsonProperty;
27 import java.util.Collection;
28 import java.util.Collections;
29 import java.util.List;
31 import java.util.Objects;
32 import org.onap.vid.job.JobAdapter;
33 import org.onap.vid.job.JobType;
34 import org.onap.vid.mso.model.ModelInfo;
39 public class Vnf extends BaseResource implements JobAdapter.AsyncJobRequest {
41 private final String productFamilyId;
43 private final String platformName;
45 private final String lineOfBusiness;
47 private final Map<String, Map<String, VfModule>> vfModules;
49 public Vnf(@JsonProperty("modelInfo") ModelInfo modelInfo,
50 @JsonProperty("productFamilyId") String productFamilyId,
51 @JsonProperty("instanceName") String instanceName,
52 @JsonProperty("action") String action,
53 @JsonProperty("platformName") String platformName,
54 @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
55 @JsonProperty("legacyRegion") String legacyRegion,
56 @JsonProperty("tenantId") String tenantId,
57 @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
58 @JsonProperty("lineOfBusinessName") String lineOfBusiness,
59 @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
60 @JsonProperty("instanceId") String instanceId,
61 @JsonProperty("vfModules") Map<String, Map<String, VfModule>> vfModules,
62 @JsonProperty("trackById") String trackById,
63 @JsonProperty("isFailed") Boolean isFailed,
64 @JsonProperty("statusMessage") String statusMessage,
65 @JsonProperty("position") Integer position,
66 @JsonProperty("originalName") String originalName) {
68 super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage,
69 position, null, originalName);
70 this.productFamilyId = productFamilyId;
71 this.platformName = platformName;
72 this.lineOfBusiness = lineOfBusiness;
73 this.vfModules = vfModules==null ? Collections.emptyMap() : vfModules;
76 public String getProductFamilyId() {
77 return productFamilyId;
80 public String getPlatformName() {
84 public String getLineOfBusiness() {
85 return lineOfBusiness;
88 public Map<String, Map<String, VfModule>> getVfModules() {
93 protected String getModelType() {
98 public Collection<BaseResource> getChildren() {
99 return getVfModules().values().stream()
100 .filter(Objects::nonNull)
101 .flatMap(x->x.values().stream())
106 public JobType getJobType() {
107 return JobType.VnfInstantiation;