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 com.fasterxml.jackson.annotation.JsonProperty;
25 import org.onap.vid.job.JobAdapter;
26 import org.onap.vid.job.JobType;
27 import org.onap.vid.mso.model.ModelInfo;
31 import static java.util.stream.Collectors.toList;
36 public class Vnf extends BaseResource implements JobAdapter.AsyncJobRequest {
38 private final String productFamilyId;
40 private final String platformName;
42 private final String lineOfBusiness;
44 private final Map<String, Map<String, VfModule>> vfModules;
46 public Vnf(@JsonProperty("modelInfo") ModelInfo modelInfo,
47 @JsonProperty("productFamilyId") String productFamilyId,
48 @JsonProperty("instanceName") String instanceName,
49 @JsonProperty("action") String action,
50 @JsonProperty("platformName") String platformName,
51 @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
52 @JsonProperty("legacyRegion") String legacyRegion,
53 @JsonProperty("tenantId") String tenantId,
54 @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
55 @JsonProperty("lineOfBusinessName") String lineOfBusiness,
56 @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
57 @JsonProperty("instanceId") String instanceId,
58 @JsonProperty("vfModules") Map<String, Map<String, VfModule>> vfModules,
59 @JsonProperty("trackById") String trackById,
60 @JsonProperty("isFailed") Boolean isFailed,
61 @JsonProperty("statusMessage") String statusMessage) {
63 super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage);
64 this.productFamilyId = productFamilyId;
65 this.platformName = platformName;
66 this.lineOfBusiness = lineOfBusiness;
67 this.vfModules = vfModules==null ? Collections.emptyMap() : vfModules;
70 public String getProductFamilyId() {
71 return productFamilyId;
74 public String getPlatformName() {
78 public String getLineOfBusiness() {
79 return lineOfBusiness;
82 public Map<String, Map<String, VfModule>> getVfModules() {
87 protected String getModelType() {
92 public Collection<BaseResource> getChildren() {
93 return getVfModules().values().stream()
94 .filter(Objects::nonNull)
95 .flatMap(x->x.values().stream())
100 public JobType getJobType() {
101 return JobType.VnfInstantiation;