2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 IBM.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.vid.model.aaiTree;
24 import static org.onap.vid.aai.util.AAITreeConverter.VNF_TYPE;
26 import org.apache.commons.lang3.builder.ToStringBuilder;
28 public class RelatedVnf extends Node {
30 private String serviceInstanceId;
31 private String serviceInstanceName;
32 private String tenantName;
34 public RelatedVnf(AAITreeNode node) {
38 public String getServiceInstanceId() {
39 return serviceInstanceId;
42 public void setServiceInstanceId(String serviceInstanceId) {
43 this.serviceInstanceId = serviceInstanceId;
46 public String getServiceInstanceName() {
47 return serviceInstanceName;
50 public void setServiceInstanceName(String serviceInstanceName) {
51 this.serviceInstanceName = serviceInstanceName;
54 public String getTenantName() {
58 public void setTenantName(String tenantName) {
59 this.tenantName = tenantName;
62 public static RelatedVnf from(AAITreeNode node) {
63 RelatedVnf vnf = new RelatedVnf(node);
64 if (node.getParent() != null && node.getParent().getType() == NodeType.SERVICE_INSTANCE) {
65 vnf.setServiceInstanceId(node.getParent().getId());
66 vnf.setServiceInstanceName(node.getParent().getName());
69 if (node.getAdditionalProperties().get(VNF_TYPE) != null) {
70 vnf.setInstanceType(node.getAdditionalProperties().get(VNF_TYPE).toString());
77 public String toString() {
78 return new ToStringBuilder(this)
79 .append("serviceInstanceId", serviceInstanceId)
80 .append("serviceInstanceName", serviceInstanceName)
81 .append("tenantName", tenantName)
82 .append("action", action)
83 .append("instanceName", instanceName)
84 .append("instanceId", instanceId)
85 .append("orchStatus", orchStatus)
86 .append("productFamilyId", productFamilyId)
87 .append("lcpCloudRegionId", lcpCloudRegionId)
88 .append("tenantId", tenantId)
89 .append("cloudOwner", cloudOwner)
90 .append("modelInfo", modelInfo)