aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/model
diff options
context:
space:
mode:
authorEinat Vinouze <einat.vinouze@intl.att.com>2019-07-16 17:17:36 +0300
committerIttay Stern <ittay.stern@att.com>2019-07-30 06:01:44 +0300
commite601bbdc43bae9a08e2e10c5139a6f76b47860d7 (patch)
tree1913f0b369ead3f2ea5557e5649d8281eca9871c /vid-app-common/src/main/java/org/onap/vid/model
parent76c6ee4a697617ec4cdee2f3b48bc83136c858c5 (diff)
Implant vid-app-common org.onap.vid.job (main and test)
Issue-ID: VID-378 Change-Id: I41b0bdc2c4e3635f3f3319b1cd63cefc61912dfc Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com> Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/model')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Action.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java100
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ResourceInfo.java144
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ServiceInfo.java161
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java75
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VersionAndFeatures.kt12
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt25
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java50
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/CollectionResource.kt15
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/InstanceGroup.kt23
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/NCF.kt12
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java116
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java33
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/NodeType.java82
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java34
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java35
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java9
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java18
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.java72
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.kt10
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VpnBinding.kt50
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vrf.java65
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/errorReport/ReportCreationParameters.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java86
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java34
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java54
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java42
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java62
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java49
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java52
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VrfEntry.kt6
33 files changed, 1193 insertions, 357 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Action.java b/vid-app-common/src/main/java/org/onap/vid/model/Action.java
index ebaa691af..c0d4fae6a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/Action.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Action.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,7 +23,9 @@ package org.onap.vid.model;
public enum Action {
Create(ServiceInfo.ServiceAction.INSTANTIATE),
Delete(ServiceInfo.ServiceAction.DELETE),
- None(ServiceInfo.ServiceAction.UPDATE);
+ None(ServiceInfo.ServiceAction.UPDATE),
+ Resume(ServiceInfo.ServiceAction.RESUME),
+ Replace(ServiceInfo.ServiceAction.REPLACE);
private final ServiceInfo.ServiceAction serviceAction;
Action(ServiceInfo.ServiceAction serviceAction){
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java b/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java
index 49e25ecb0..645934530 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/JobAuditStatus.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,6 +20,21 @@
package org.onap.vid.model;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.UUID;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -29,14 +44,6 @@ import org.hibernate.annotations.Type;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.vid.job.Job.JobStatus;
-import javax.persistence.*;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-import java.util.UUID;
-
/*
The following 2 annotations let hibernate to update only fields that actually have been changed.
DynamicUpdate tell hibernate to update only dirty fields.
@@ -54,43 +61,40 @@ public class JobAuditStatus extends VidBaseEntity {
public JobAuditStatus(){}
- public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source){
+ private JobAuditStatus(UUID jobId, String instanceName, String instanceType, String jobStatus,
+ SourceStatus source, UUID requestId, String additionalInfo, Date date, int ordinal) {
this.jobId = jobId;
+ this.instanceName = instanceName;
+ this.instanceType = instanceType;
this.jobStatus = jobStatus;
this.source = source;
+ this.requestId = requestId;
+ setAdditionalInfo(additionalInfo);
+ this.ordinal = ordinal;
+ this.created = date;
}
- public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source, Date date){
- this(jobId, jobStatus, source);
- this.created = date;
+ public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source){
+ this(jobId, null, null, jobStatus, source, null, null, null, 0);
}
public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source, UUID requestId, String additionalInfo) {
- this(jobId, jobStatus, source);
- this.requestId = requestId;
- setAdditionalInfo(additionalInfo);
+ this(jobId, null, null, jobStatus, source, requestId, additionalInfo, null, 0);
}
- public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source, UUID requestId, String additionalInfo, Date date){
- this(jobId, jobStatus, source, requestId, additionalInfo);
- this.created = date;
+ public JobAuditStatus(String instanceName, String jobStatus, UUID requestId, String additionalInfo, String date, String instanceType) {
+ this(null, instanceName, instanceType, jobStatus, null, requestId, additionalInfo, null, 0);
+ this.created = dateStringToDate(date);
}
- public JobAuditStatus(String instanceName, String jobStatus, UUID requestId, String additionalInfo) {
- this.instanceName = instanceName;
- this.jobStatus = jobStatus;
- this.requestId = requestId;
- this.additionalInfo = additionalInfo;
-
+ public static JobAuditStatus createForTest(UUID jobId, String jobStatus, SourceStatus source, Date date, int ordinal) {
+ return new JobAuditStatus(jobId, null, null, jobStatus, source, null, null, date, ordinal);
}
- public JobAuditStatus(String instanceName, String jobStatus, UUID requestId, String additionalInfo, String date, String instanceType) {
- this(instanceName, jobStatus, requestId, additionalInfo);
- this.created = dateStringToDate(date);
- this.instanceType = instanceType;
+ public static JobAuditStatus createForTest(UUID jobId, String jobStatus, SourceStatus source, UUID requestId, String additionalInfo, Date date) {
+ return new JobAuditStatus(jobId, null, null, jobStatus, source, requestId, additionalInfo, date, 0);
}
-
private Date dateStringToDate(String dateAsString){
if (StringUtils.isEmpty(dateAsString)) {
return null;
@@ -121,6 +125,7 @@ public class JobAuditStatus extends VidBaseEntity {
.append(source, that.source)
.append(requestId, that.requestId)
.append(additionalInfo, that.additionalInfo)
+ // ordinal is not part of equality (similarly to "created" field)
.isEquals();
}
@@ -132,6 +137,7 @@ public class JobAuditStatus extends VidBaseEntity {
.append(source)
.append(requestId)
.append(additionalInfo)
+ // ordinal is not part of equality (similarly to "created" field)
.toHashCode();
}
@@ -140,6 +146,25 @@ public class JobAuditStatus extends VidBaseEntity {
VID
}
+ public enum ResourceTypeFilter {
+ SERVICE("serviceInstanceId"),
+ VNF("vnfInstanceId"),
+ VFMODULE("vfModuleInstanceId"),
+ NETWORK("networkInstanceId"),
+ VNFGROUP("instanceGroupId");
+
+ private final String filterBy;
+
+ ResourceTypeFilter(String filterBy) {
+ this.filterBy = filterBy;
+ }
+
+ public String getFilterBy() {
+ return filterBy;
+ }
+ }
+
+
private UUID jobId;
private String instanceName;
private String instanceType;
@@ -147,6 +172,7 @@ public class JobAuditStatus extends VidBaseEntity {
private SourceStatus source;
private UUID requestId;
private String additionalInfo;
+ private int ordinal;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -206,6 +232,18 @@ public class JobAuditStatus extends VidBaseEntity {
this.additionalInfo = StringUtils.substring(additionalInfo, 0, MAX_ADDITIONAL_INFO_LENGTH);
}
+ @Column(name = "ORDINAL", columnDefinition = "INT")
+ public int getOrdinal() {
+ // Ordinal allows sorting audit statuses by
+ // insertion order, regardless of "created"
+ // field
+ return ordinal;
+ }
+
+ public void setOrdinal(int ordinal) {
+ this.ordinal = ordinal;
+ }
+
@Transient
public String getInstanceName() {
return instanceName;
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java b/vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java
index 98514f0c1..45e100fb1 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java
@@ -18,15 +18,8 @@
* ============LICENSE_END=========================================================
*/
-/**
- *
- */
package org.onap.vid.model;
-/**
- * The Class ModelUtil.
- *
- */
public class ModelUtil {
/**
* Gets the tags for the given element according to the configured namespace
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ResourceInfo.java b/vid-app-common/src/main/java/org/onap/vid/model/ResourceInfo.java
new file mode 100644
index 000000000..deda23f37
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ResourceInfo.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.model;
+
+import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.io.IOException;
+import java.util.Objects;
+import java.util.UUID;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import org.hibernate.annotations.DynamicUpdate;
+import org.hibernate.annotations.SelectBeforeUpdate;
+import org.hibernate.annotations.Type;
+import org.onap.vid.exceptions.GenericUncheckedException;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.JobException;
+import org.onap.vid.mso.rest.AsyncRequestStatus;
+
+@DynamicUpdate
+@SelectBeforeUpdate
+@Entity
+@Table(name = "vid_resource_info")
+public class ResourceInfo extends VidBaseEntity {
+
+ private String trackById;
+ private UUID rootJobId;
+ private String instanceId;
+ private Job.JobStatus jobStatus;
+ private AsyncRequestStatus errorMessage;
+
+ public ResourceInfo(){}
+
+ public ResourceInfo(String trackById, UUID rootJobId, String instanceId, Job.JobStatus jobStatus, AsyncRequestStatus errorMessage) {
+ this.trackById = trackById;
+ this.rootJobId = rootJobId;
+ this.instanceId = instanceId;
+ this.jobStatus = jobStatus;
+ this.errorMessage = errorMessage;
+ }
+
+ @Id
+ @Column(name = "TRACK_BY_ID", columnDefinition = "CHAR(36)")
+ public String getTrackById() {
+ return trackById;
+ }
+
+ @Column(name = "ROOT_JOB_ID", columnDefinition = "CHAR(36)")
+ @Type(type="org.hibernate.type.UUIDCharType")
+ public UUID getRootJobId() {
+ return rootJobId;
+ }
+
+ @Column(name="JOB_STATUS")
+ @Enumerated(EnumType.STRING)
+ public Job.JobStatus getJobStatus() {
+ return jobStatus;
+ }
+
+ @Column(name="INSTANCE_ID")
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public void setTrackById(String trackById) {
+ this.trackById = trackById;
+ }
+
+ public void setRootJobId(UUID rootJobId) {
+ this.rootJobId = rootJobId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+ public void setJobStatus(Job.JobStatus jobStatus) {
+ this.jobStatus = jobStatus;
+ }
+
+ @Column(name = "ERROR_MESSAGE", columnDefinition = "VARCHAR(30000)")
+ public String getErrorMessageRaw() {
+ try {
+ return JACKSON_OBJECT_MAPPER.writeValueAsString(errorMessage);
+ } catch (JsonProcessingException e) {
+ throw new GenericUncheckedException(e);
+ }
+ }
+
+ public void setErrorMessageRaw(String failedMessage) {
+ try {
+ this.errorMessage = JACKSON_OBJECT_MAPPER.readValue(failedMessage, AsyncRequestStatus.class);
+ } catch (IOException e) {
+ throw new JobException("Error parsing mso failed message", rootJobId, e);
+ }
+ }
+
+ @Transient
+ public AsyncRequestStatus getErrorMessage() {
+ return this.errorMessage;
+ }
+
+ public void setErrorMessage(AsyncRequestStatus errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ResourceInfo that = (ResourceInfo) o;
+ return Objects.equals(trackById, that.trackById) &&
+ Objects.equals(instanceId, that.instanceId) &&
+ jobStatus == that.jobStatus;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(trackById, instanceId, jobStatus);
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ServiceInfo.java b/vid-app-common/src/main/java/org/onap/vid/model/ServiceInfo.java
index 3b49eedca..1e1e6c2a7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/ServiceInfo.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ServiceInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
- package org.onap.vid.model;
+package org.onap.vid.model;
- import com.fasterxml.jackson.annotation.JsonProperty;
- import org.hibernate.annotations.DynamicUpdate;
- import org.hibernate.annotations.SelectBeforeUpdate;
- import org.hibernate.annotations.Type;
- import org.onap.portalsdk.core.domain.support.DomainVo;
- import org.onap.vid.job.Job;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.hibernate.annotations.DynamicUpdate;
+import org.hibernate.annotations.SelectBeforeUpdate;
+import org.hibernate.annotations.Type;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+import org.onap.vid.job.Job;
- import javax.persistence.*;
- import java.io.Serializable;
- import java.util.Date;
- import java.util.Objects;
- import java.util.Set;
- import java.util.UUID;
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+import java.util.Set;
+import java.util.UUID;
/*
The following 2 annotations let hibernate to update only fields that actually have been changed.
@@ -49,11 +49,9 @@ public class ServiceInfo extends DomainVo {
public enum ServiceAction {
INSTANTIATE,
DELETE,
- UPDATE
- }
-
- public void setUserId(String userId) {
- this.userId = userId;
+ UPDATE,
+ RESUME,
+ REPLACE
}
private UUID jobId;
@@ -65,6 +63,7 @@ public class ServiceInfo extends DomainVo {
private Date statusModifiedDate;
private boolean hidden;
private boolean pause;
+ private boolean retryEnabled;
private Date deletedAt;
private String owningEntityId;
private String owningEntityName;
@@ -90,7 +89,12 @@ public class ServiceInfo extends DomainVo {
}
- public ServiceInfo(String userId, Boolean aLaCarte, Job.JobStatus jobStatus, boolean pause, UUID jobId, UUID templateId, String owningEntityId, String owningEntityName, String project, String aicZoneId, String aicZoneName, String tenantId, String tenantName, String regionId, String regionName, String serviceType, String subscriberName, String subscriberId, String serviceInstanceId, String serviceInstanceName, String serviceModelId, String serviceModelName, String serviceModelVersion, Date createdBulkDate, ServiceAction action) {
+ public ServiceInfo(String userId, Boolean aLaCarte, Job.JobStatus jobStatus, boolean pause, UUID jobId, UUID templateId,
+ String owningEntityId, String owningEntityName, String project, String aicZoneId, String aicZoneName,
+ String tenantId, String tenantName, String regionId, String regionName, String serviceType,
+ String subscriberName, String subscriberId, String serviceInstanceId, String serviceInstanceName,
+ String serviceModelId, String serviceModelName, String serviceModelVersion, Date createdBulkDate,
+ ServiceAction action, boolean retryEnabled) {
this.userId = userId;
this.aLaCarte = aLaCarte;
this.jobStatus = jobStatus;
@@ -116,6 +120,7 @@ public class ServiceInfo extends DomainVo {
this.serviceModelVersion = serviceModelVersion;
this.createdBulkDate = createdBulkDate;
this.action = action;
+ this.retryEnabled = retryEnabled;
}
@Column(name = "JOB_ID", columnDefinition = "CHAR(36)")
@@ -168,6 +173,12 @@ public class ServiceInfo extends DomainVo {
return pause;
}
+ @Column(name="IS_RETRY_ENABLED")
+ @JsonProperty("isRetryEnabled")
+ public boolean isRetryEnabled() {
+ return retryEnabled;
+ }
+
@Column(name="OWNING_ENTITY_ID")
public String getOwningEntityId() {
return owningEntityId;
@@ -260,8 +271,8 @@ public class ServiceInfo extends DomainVo {
@Column(name="DELETED_AT")
public Date getDeletedAt() {
- return deletedAt;
- }
+ return deletedAt;
+ }
@Column(name="ACTION")
@Enumerated(EnumType.STRING)
@@ -319,6 +330,9 @@ public class ServiceInfo extends DomainVo {
return super.getAuditTrail();
}
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
public void setJobId(UUID jobId) {
this.jobId = jobId;
}
@@ -351,6 +365,10 @@ public class ServiceInfo extends DomainVo {
this.pause = pause;
}
+ public void setRetryEnabled(boolean retryEnabled) {
+ this.retryEnabled = retryEnabled;
+ }
+
public void setOwningEntityId(String owningEntityId) {
this.owningEntityId = owningEntityId;
}
@@ -424,55 +442,54 @@ public class ServiceInfo extends DomainVo {
}
public void setDeletedAt(Date deletedAt) {
- this.deletedAt = deletedAt;
- }
+ this.deletedAt = deletedAt;
+ }
public void setAction(ServiceAction action) { this.action = action; }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ServiceInfo)) return false;
- ServiceInfo that = (ServiceInfo) o;
- return isHidden() == that.isHidden() &&
- isPause() == that.isPause() &&
- isALaCarte() == that.isALaCarte() &&
- Objects.equals(getDeletedAt(), that.getDeletedAt()) &&
- Objects.equals(getJobId(), that.getJobId()) &&
- Objects.equals(getTemplateId(), that.getTemplateId()) &&
- Objects.equals(getUserId(), that.getUserId()) &&
- Objects.equals(getMsoRequestId(), that.getMsoRequestId()) &&
- getJobStatus() == that.getJobStatus() &&
- Objects.equals(getStatusModifiedDate(), that.getStatusModifiedDate()) &&
- Objects.equals(getOwningEntityId(), that.getOwningEntityId()) &&
- Objects.equals(getOwningEntityName(), that.getOwningEntityName()) &&
- Objects.equals(getProject(), that.getProject()) &&
- Objects.equals(getAicZoneId(), that.getAicZoneId()) &&
- Objects.equals(getAicZoneName(), that.getAicZoneName()) &&
- Objects.equals(getTenantId(), that.getTenantId()) &&
- Objects.equals(getTenantName(), that.getTenantName()) &&
- Objects.equals(getRegionId(), that.getRegionId()) &&
- Objects.equals(getRegionName(), that.getRegionName()) &&
- Objects.equals(getServiceType(), that.getServiceType()) &&
- Objects.equals(getSubscriberName(), that.getSubscriberName()) &&
- Objects.equals(getSubscriberId(), that.getSubscriberId()) &&
- Objects.equals(getServiceInstanceId(), that.getServiceInstanceId()) &&
- Objects.equals(getServiceInstanceName(), that.getServiceInstanceName()) &&
- Objects.equals(getServiceModelId(), that.getServiceModelId()) &&
- Objects.equals(getServiceModelName(), that.getServiceModelName()) &&
- Objects.equals(getServiceModelVersion(), that.getServiceModelVersion()) &&
- Objects.equals(getCreatedBulkDate(), that.getCreatedBulkDate()) &&
- Objects.equals(getAction(), that.getAction());
- }
-
- @Override
- public int hashCode() {
-
- return Objects.hash(getJobId(), getTemplateId(), getUserId(), getMsoRequestId(), isALaCarte(), getJobStatus(), getStatusModifiedDate(),
- isHidden(), isPause(), getDeletedAt(), getOwningEntityId(), getOwningEntityName(), getProject(),
- getAicZoneId(), getAicZoneName(), getTenantId(), getTenantName(), getRegionId(),
- getRegionName(), getServiceType(), getSubscriberName(), getSubscriberId(), getServiceInstanceId(),
- getServiceInstanceName(), getServiceModelId(), getServiceModelName(),
- getServiceModelVersion(), getCreatedBulkDate(), getAction());
- }
- }
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ServiceInfo)) return false;
+ ServiceInfo that = (ServiceInfo) o;
+ return aLaCarte == that.aLaCarte &&
+ isHidden() == that.isHidden() &&
+ isPause() == that.isPause() &&
+ isRetryEnabled() == that.isRetryEnabled() &&
+ Objects.equals(getJobId(), that.getJobId()) &&
+ Objects.equals(getTemplateId(), that.getTemplateId()) &&
+ Objects.equals(getUserId(), that.getUserId()) &&
+ Objects.equals(getMsoRequestId(), that.getMsoRequestId()) &&
+ getJobStatus() == that.getJobStatus() &&
+ Objects.equals(getStatusModifiedDate(), that.getStatusModifiedDate()) &&
+ Objects.equals(getDeletedAt(), that.getDeletedAt()) &&
+ Objects.equals(getOwningEntityId(), that.getOwningEntityId()) &&
+ Objects.equals(getOwningEntityName(), that.getOwningEntityName()) &&
+ Objects.equals(getProject(), that.getProject()) &&
+ Objects.equals(getAicZoneId(), that.getAicZoneId()) &&
+ Objects.equals(getAicZoneName(), that.getAicZoneName()) &&
+ Objects.equals(getTenantId(), that.getTenantId()) &&
+ Objects.equals(getTenantName(), that.getTenantName()) &&
+ Objects.equals(getRegionId(), that.getRegionId()) &&
+ Objects.equals(getRegionName(), that.getRegionName()) &&
+ Objects.equals(getServiceType(), that.getServiceType()) &&
+ Objects.equals(getSubscriberName(), that.getSubscriberName()) &&
+ Objects.equals(getSubscriberId(), that.getSubscriberId()) &&
+ Objects.equals(getServiceInstanceId(), that.getServiceInstanceId()) &&
+ Objects.equals(getServiceInstanceName(), that.getServiceInstanceName()) &&
+ Objects.equals(getServiceModelId(), that.getServiceModelId()) &&
+ Objects.equals(getServiceModelName(), that.getServiceModelName()) &&
+ Objects.equals(getServiceModelVersion(), that.getServiceModelVersion()) &&
+ Objects.equals(getCreatedBulkDate(), that.getCreatedBulkDate()) &&
+ getAction() == that.getAction();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getJobId(), getTemplateId(), getUserId(), getMsoRequestId(), aLaCarte, getJobStatus(),
+ getStatusModifiedDate(), isHidden(), isPause(), isRetryEnabled(), getDeletedAt(), getOwningEntityId(), getOwningEntityName(),
+ getProject(), getAicZoneId(), getAicZoneName(), getTenantId(), getTenantName(), getRegionId(), getRegionName(), getServiceType(),
+ getSubscriberName(), getSubscriberId(), getServiceInstanceId(), getServiceInstanceName(), getServiceModelId(), getServiceModelName(),
+ getServiceModelVersion(), getCreatedBulkDate(), getAction());
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java b/vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java
index c1e403587..121c7e4c1 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* VID
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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.
@@ -40,14 +40,14 @@ public class ServiceModel {
/** The service. */
private Service service;
-
+
/** The vnfs. */
private Map<String, VNF> vnfs;
-
+
/** The networks. */
private Map<String, Network> networks;
- private Map<String, CR> collectionResource;
+ private Map<String, CR> collectionResources;
/** Port Mirroring Configuration node templates */
private Map<String, PortMirroringConfig> configurations;
@@ -60,12 +60,12 @@ public class ServiceModel {
/**
* The vf modules. The VNF also has vfmodules but the vfmodules at the service level may have additional info
- * that is not present in the VNF, like the vf module customization String
+ * that is not present in the VNF, like the vf module customization String
*/
private Map<String, VfModule> vfModules;
- /**
- * The volume groups. The VNF also has volume groups but the volume groups will be populated at the service level
- * for newer models
+ /**
+ * The volume groups. The VNF also has volume groups but the volume groups will be populated at the service level
+ * for newer models
*/
private Map<String, VolumeGroup> volumeGroups;
@@ -74,12 +74,15 @@ public class ServiceModel {
/** Resource groups of VF (VNF) type. */
private Map<String, ResourceGroup> vnfGroups;
-
+
+ /** The vrfs */
+ private Map<String, Node> vrfs;
+
/**
* Instantiates a new service model.
*/
public ServiceModel() {}
-
+
/**
* Gets the service.
*
@@ -140,6 +143,10 @@ public class ServiceModel {
return vnfGroups;
}
+ public Map<String, Node> getVrfs() {
+ return vrfs;
+ }
+
/**
* Sets the service.
*
@@ -230,12 +237,16 @@ public class ServiceModel {
this.vnfGroups = vnfGroups;
}
- public Map<String, CR> getCollectionResource() {
- return collectionResource;
+ public void setVrfs(Map<String, Node> vrfs) {
+ this.vrfs = vrfs;
}
- public void setCollectionResource(Map<String, CR> collectionResource) {
- this.collectionResource = collectionResource;
+ public Map<String, CR> getCollectionResources() {
+ return collectionResources;
+ }
+
+ public void setCollectionResources(Map<String, CR> collectionResources) {
+ this.collectionResources = collectionResources;
}
public Map<String, Node> getFabricConfigurations() {
@@ -254,9 +265,9 @@ public class ServiceModel {
* @return the service
*/
public static Service extractService(ToscaModel serviceToscaModel, org.onap.vid.asdc.beans.Service asdcServiceMetadata) {
-
+
final Service service = new Service();
-
+
service.setCategory(serviceToscaModel.getMetadata().getCategory());
service.setInvariantUuid(serviceToscaModel.getMetadata().getInvariantUUID());
service.setName(serviceToscaModel.getMetadata().getName());
@@ -274,18 +285,18 @@ public class ServiceModel {
public static void extractGroups (ToscaModel serviceToscaModel,ServiceModel serviceModel) {
// Get the groups. The groups may duplicate the groups that are in the VNF model and have
// additional data like the VF module customization String>
-
+
final Map<String, VfModule> vfModules = new HashMap<> ();
final Map<String, VolumeGroup> volumeGroups = new HashMap<> ();
-
+
String asdcModelNamespace = VidProperties.getAsdcModelNamespace();
- String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
-
+ String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
+
for (Entry<String, Group> component : serviceToscaModel.gettopology_template().getGroups().entrySet()) {
final Group group = component.getValue();
final String type = group.getType();
final String customizationName = component.getKey();
-
+
if (type.startsWith(vfModuleTag)) {
VfModule vfMod = VfModule.extractVfModule(customizationName, group);
vfModules.put(customizationName, vfMod);
@@ -298,14 +309,14 @@ public class ServiceModel {
// add this point vfModules and volume groups are disconnected from VNF
serviceModel.setVfModules (vfModules);
serviceModel.setVolumeGroups (volumeGroups);
-
+
}
/**
* Populate the vf modules and volume groups that we may have under the service level under each VNF.
*/
public void associateGroups() {
String methodName = "associateGroups()";
- LOG.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
+ LOG.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
// go through the vnfs, get the vnf normalized name and look for a vf module with a customization name that starts
// with vnf + ".."
String vnfCustomizationName = null;
@@ -319,13 +330,13 @@ public class ServiceModel {
LOG.debug(EELFLoggerDelegate.debugLogger, methodName +
" VNF customizationName=" + vnfCustomizationName + "normalized customization name=" + normalizedVnfCustomizationName);
-
+
// now check to see if there is a vf module with customization name that starts with normalizedVnfCustomizationName
if (!MapUtils.isEmpty(getVolumeGroups())) {
for (Entry<String, VfModule> vfModuleComponent : getVfModules().entrySet()) {
vfModuleCustomizationName = vfModuleComponent.getValue().getModelCustomizationName();
-
+
LOG.debug(EELFLoggerDelegate.debugLogger, methodName +
" VF Module customizationName=" + vfModuleCustomizationName );
if ( vfModuleCustomizationName.startsWith(normalizedVnfCustomizationName + ".." )) {
@@ -335,7 +346,7 @@ public class ServiceModel {
}
}
}
-
+
}
@@ -346,14 +357,14 @@ public class ServiceModel {
(tmpVnf.getVfModules()).put(vfModuleComponent.getKey(), vfModuleComponent.getValue());
LOG.debug(EELFLoggerDelegate.debugLogger, methodName +
- " Associated VF Module customizationName=" + vfModuleComponent.getKey() + " with VNF customization name=" + vnfCustomizationName);
+ " Associated VF Module customizationName=" + vfModuleComponent.getKey() + " with VNF customization name=" + vnfCustomizationName);
// now find if this vf module has volume groups, if so, find the volume group with the same customization name and put it under the VNF
if ( vfModuleComponent.getValue().isVolumeGroupAllowed() ) {
if (isVolumeGroupsContainsVfModuleCustomName(vfModuleCustomizationName)) {
- (vnfComponent.getValue().getVolumeGroups()).put(vfModuleCustomizationName, (getVolumeGroups()).get(vfModuleCustomizationName));
- }
- }
+ (vnfComponent.getValue().getVolumeGroups()).put(vfModuleCustomizationName, (getVolumeGroups()).get(vfModuleCustomizationName));
+ }
+ }
}
private boolean isVolumeGroupsContainsVfModuleCustomName(String vfModuleCustomizationName) {
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VersionAndFeatures.kt b/vid-app-common/src/main/java/org/onap/vid/model/VersionAndFeatures.kt
new file mode 100644
index 000000000..730e382d3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/VersionAndFeatures.kt
@@ -0,0 +1,12 @@
+package org.onap.vid.model
+
+data class VersionAndFeatures(
+ val features:String,
+ val build:String,
+ val displayVersion:String
+) {
+ companion object {
+ val unknown: VersionAndFeatures = VersionAndFeatures("unknown", "unknown", "unknown")
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt b/vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt
index 7f06bfe2f..f67d8fbd9 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt
@@ -7,9 +7,9 @@
* 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.
@@ -26,7 +26,10 @@ import com.fasterxml.jackson.annotation.JsonValue
import com.google.common.base.CaseFormat
class VidNotions(@get:JsonInclude(JsonInclude.Include.NON_NULL)
- val instantiationUI: InstantiationUI, val modelCategory: ModelCategory, val viewEditUI: InstantiationUI) {
+ val instantiationUI: InstantiationUI,
+ val modelCategory: ModelCategory,
+ val viewEditUI: InstantiationUI,
+ val instantiationType: InstantiationType) {
enum class InstantiationUI {
NETWORK_WITH_PROPERTY_NETWORK_TECHNOLOGY_EQUALS_STANDARD_SRIOV_OR_OVS,
SERVICE_WITH_FABRIC_CONFIGURATION,
@@ -34,7 +37,12 @@ class VidNotions(@get:JsonInclude(JsonInclude.Include.NON_NULL)
SERVICE_UUID_IS_1ffce89f_ef3f_4cbb_8b37_82134590c5de,
ANY_ALACARTE_NEW_UI,
MACRO_SERVICE,
- SERVICE_WITH_VNF_GROUPING;
+ SERVICE_WITH_VNF_GROUPING,
+ TRANSPORT_SERVICE,
+ SERVICE_WITH_COLLECTION_RESOURCE,
+ A_LA_CARTE_VNF_SERVICE_ROLE,
+ INFRASTRUCTURE_VPN
+ ;
@JsonValue
fun toLowerCamel(): String {
@@ -48,7 +56,16 @@ class VidNotions(@get:JsonInclude(JsonInclude.Include.NON_NULL)
IS_5G_PROVIDER_NETWORK_MODEL,
@JsonProperty("5G Fabric Configuration")
IS_5G_FABRIC_CONFIGURATION_MODEL,
+ Transport,
+ SERVICE_WITH_COLLECTION_RESOURCE,
+ INFRASTRUCTURE_VPN,
@JsonProperty("other")
OTHER
}
+
+ enum class InstantiationType {
+ Macro,
+ ALaCarte,
+ ClientConfig
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java
index 4b16b3122..f092c9ae6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AAITreeNode.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,17 +20,19 @@
package org.onap.vid.model.aaiTree;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.StringUtils;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList;
+import org.onap.vid.mso.model.CloudConfiguration;
import java.util.*;
public class AAITreeNode {
- private String type;
- private int uniqueNumber;
+ private NodeType type;
private String orchestrationStatus;
private String provStatus;
- private Boolean inMaint = null;
+ private boolean inMaint;
private String modelVersionId;
private String modelCustomizationId;
private String modelInvariantId;
@@ -41,25 +43,19 @@ public class AAITreeNode {
private String modelCustomizationName;
private final List<AAITreeNode> children = Collections.synchronizedList(new LinkedList<>());
private Map<String, Object> additionalProperties = new HashMap<>();
+ private CloudConfiguration cloudConfiguration;
+ private RelationshipList relationshipList;
private String keyInModel;
private AAITreeNode parent;
- public String getType() {
+ public NodeType getType() {
return type;
}
- public void setType(String type) {
+ public void setType(NodeType type) {
this.type = type;
}
- public int getUniqueNumber() {
- return uniqueNumber;
- }
-
- public void setUniqueNumber(int uniqueNumber) {
- this.uniqueNumber = uniqueNumber;
- }
-
public String getOrchestrationStatus() {
return orchestrationStatus;
}
@@ -76,11 +72,11 @@ public class AAITreeNode {
this.provStatus = provStatus;
}
- public Boolean getInMaint() {
+ public boolean getInMaint() {
return inMaint;
}
- public void setInMaint(Boolean inMaint) {
+ public void setInMaint(boolean inMaint) {
this.inMaint = inMaint;
}
@@ -169,7 +165,7 @@ public class AAITreeNode {
}
public String getUniqueNodeKey() {
- return getNodeKey() + ":" + String.format("%03d", this.uniqueNumber);
+ return this.id;
}
public void setKeyInModel(String keyInModel) {
@@ -180,6 +176,8 @@ public class AAITreeNode {
return keyInModel;
}
+ //prevent cyclic serialization of parent and children
+ @JsonIgnore
public AAITreeNode getParent() {
return parent;
}
@@ -188,6 +186,22 @@ public class AAITreeNode {
this.parent = parent;
}
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
public void addChildren(List<AAITreeNode> children) {
for (AAITreeNode child : children) {
child.setParent(this);
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java
index 64e953e17..a0fa60e97 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/AbstractNode.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,6 +32,7 @@ public abstract class AbstractNode {
protected String productFamilyId;
protected String lcpCloudRegionId;
protected String tenantId;
+ protected String cloudOwner;
protected ModelInfo modelInfo;
public AbstractNode() {
@@ -70,4 +71,7 @@ public abstract class AbstractNode {
return modelInfo;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/CollectionResource.kt b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/CollectionResource.kt
new file mode 100644
index 000000000..054618dd5
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/CollectionResource.kt
@@ -0,0 +1,15 @@
+package org.onap.vid.model.aaiTree
+
+import org.apache.commons.lang.StringUtils
+
+fun isNfc(node: AAITreeNode): Boolean {
+ return node.type == NodeType.INSTANCE_GROUP &&
+ node.additionalProperties["instance-group-type"] != null &&
+ StringUtils.equalsIgnoreCase(node.additionalProperties["instance-group-type"].toString(), "L3-NETWORK")
+}
+
+class CollectionResource(node: AAITreeNode) : Node(node) {
+
+ val ncfs: Map<String, NCF> = node.children.filter { isNfc(it) }.map { it.uniqueNodeKey to NCF(it) }.toMap()
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/InstanceGroup.kt b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/InstanceGroup.kt
new file mode 100644
index 000000000..490853aa1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/InstanceGroup.kt
@@ -0,0 +1,23 @@
+package org.onap.vid.model.aaiTree
+
+open class InstanceGroup(aaiNode: AAITreeNode) : Node(aaiNode) {
+ var instanceGroupRole: String? = null
+ var instanceGroupFunction: String? = null
+
+ init {
+ val INSTANCE_GROUP_TYPE = "instance-group-type"
+ val INSTANCE_GROUP_ROLE = "instance-group-role"
+ val INSTANCE_GROUP_FUNCTION = "instance-group-function"
+
+ if (aaiNode.additionalProperties[INSTANCE_GROUP_TYPE] != null) {
+ instanceType = aaiNode.additionalProperties[INSTANCE_GROUP_TYPE].toString()
+ }
+ if (aaiNode.additionalProperties[INSTANCE_GROUP_FUNCTION] != null) {
+ instanceGroupFunction = aaiNode.additionalProperties[INSTANCE_GROUP_FUNCTION].toString()
+ }
+ if (aaiNode.additionalProperties[INSTANCE_GROUP_ROLE] != null) {
+ instanceGroupRole = aaiNode.additionalProperties[INSTANCE_GROUP_ROLE].toString()
+ }
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/NCF.kt b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/NCF.kt
new file mode 100644
index 000000000..6d407da4c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/NCF.kt
@@ -0,0 +1,12 @@
+package org.onap.vid.model.aaiTree
+
+import org.apache.commons.lang.StringUtils
+
+class NCF(node: AAITreeNode) : InstanceGroup(node) {
+ val numberOfNetworks: Int = if (node.relationshipList != null && node.relationshipList.relationship != null) {
+ node.relationshipList.relationship
+ .filter { StringUtils.equalsIgnoreCase(it.relatedTo, "L3-NETWORK") }
+ .count()
+ } else 0
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java
index e80e57520..6b3023332 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Network.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,21 +20,121 @@
package org.onap.vid.model.aaiTree;
-import org.onap.vid.aai.util.AAITreeConverter;
-
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+import static org.onap.vid.aai.util.AAITreeConverter.NETWORK_ROLE;
import static org.onap.vid.aai.util.AAITreeConverter.NETWORK_TYPE;
+import static org.onap.vid.aai.util.AAITreeConverter.PHYSICAL_NETWORK_NAME;
+import static org.onap.vid.aai.util.AAITreeConverter.SERVICE_INSTANCE;
+import static org.onap.vid.aai.util.AAITreeConverter.SERVICE_INSTANCE_SERVICE_INSTANCE_ID;
+import static org.onap.vid.aai.util.AAITreeConverter.SERVICE_INSTANCE_SERVICE_INSTANCE_NAME;
+import static org.onap.vid.aai.util.AAITreeConverter.TENANT;
+import static org.onap.vid.aai.util.AAITreeConverter.TENANT_TENANT_NAME;
+import static org.onap.vid.aai.util.AAITreeConverter.VPN_BINDING;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import org.apache.commons.collections.CollectionUtils;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList;
+import org.onap.vid.aai.util.AAITreeNodeUtils;
+@JsonInclude(NON_NULL)
public class Network extends Node {
- public Network(AAITreeNode node) {
- super(node, AAITreeConverter.ModelType.network);
+ private String role;
+ private String physicalName;
+ private String serviceName;
+ private String serviceUUID;
+ private String tenantName;
+ private Boolean isBoundToVpn;
+ private RouteTarget routeTarget;
+
+ public Network(){}
+
+ private Network(AAITreeNode node) {
+ super(node);
+ fillCloudConfigurationProperties(this, node.getCloudConfiguration());
}
public static Network from(AAITreeNode node) {
Network network = new Network(node);
- if (node.getAdditionalProperties().get(NETWORK_TYPE) != null) {
- network.setInstanceType(node.getAdditionalProperties().get(NETWORK_TYPE).toString());
+ network.setInstanceType(readValueAsStringFromAdditionalProperties(node, NETWORK_TYPE));
+ network.setRole(readValueAsStringFromAdditionalProperties(node, NETWORK_ROLE));
+ network.setPhysicalName(readValueAsStringFromAdditionalProperties(node, PHYSICAL_NETWORK_NAME));
+ RelationshipList relationshipList = node.getRelationshipList();
+ Relationship serviceInstanceRelationship = AAITreeNodeUtils.findFirstRelationshipByRelatedTo(relationshipList, SERVICE_INSTANCE).orElse(null);
+ if (serviceInstanceRelationship != null) {
+ network.setServiceName(AAITreeNodeUtils.findFirstValue(serviceInstanceRelationship.getRelatedToPropertyList(), SERVICE_INSTANCE_SERVICE_INSTANCE_NAME).orElse(null));
+ network.setServiceUUID(AAITreeNodeUtils.findFirstValue(serviceInstanceRelationship.getRelationDataList(), SERVICE_INSTANCE_SERVICE_INSTANCE_ID).orElse(null));
}
+ AAITreeNodeUtils.findFirstRelationshipByRelatedTo(relationshipList, TENANT).ifPresent(
+ tenantRelationship -> network.setTenantName(AAITreeNodeUtils.findFirstValue(tenantRelationship.getRelatedToPropertyList(), TENANT_TENANT_NAME).orElse(null))
+ );
+ // We are ignoring "is-bound-to-vpn" parameter from additionalProperties because there is a requirement to define vpn binding presence from by related-to: vpn-binding
+ network.setBoundToVpn(AAITreeNodeUtils.findFirstRelationshipByRelatedTo(relationshipList, VPN_BINDING).isPresent());
+
+ //get the route target
+ node.getChildren().stream()
+ .filter(x->x.getType()== NodeType.VPN_BINDING) // get all VPN_BINDING related to the network
+ .map(x->VpnBindingKt.from(x)) // create VPN_BINDING nodes
+ .filter(x-> CollectionUtils.isNotEmpty(x.getRouteTargets())) // get the RouteTargets that are not empty
+ .findFirst() // get the first one
+ .ifPresent(x->network.setRouteTarget(x.getRouteTargets().get(0))); // If there is a route target - add it to the network
return network;
}
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public String getPhysicalName() {
+ return physicalName;
+ }
+
+ public void setPhysicalName(String physicalName) {
+ this.physicalName = physicalName;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getServiceUUID() {
+ return serviceUUID;
+ }
+
+ public void setServiceUUID(String serviceUUID) {
+ this.serviceUUID = serviceUUID;
+ }
+
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+
+ public Boolean isBoundToVpn() {
+ return isBoundToVpn;
+ }
+
+ public void setBoundToVpn(Boolean boundToVpn) {
+ isBoundToVpn = boundToVpn;
+ }
+
+ public RouteTarget getRouteTarget() {
+ return routeTarget;
+ }
+
+ public void setRouteTarget(RouteTarget routeTarget) {
+ this.routeTarget = routeTarget;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java
index 5ce5eec43..435f70f1a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Node.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,9 +20,12 @@
package org.onap.vid.model.aaiTree;
-import org.onap.vid.aai.util.AAITreeConverter;
+import org.onap.vid.mso.model.CloudConfiguration;
import org.onap.vid.mso.model.ModelInfo;
+import java.util.Objects;
+import java.util.UUID;
+
public class Node extends AbstractNode {
private String instanceType;
@@ -38,7 +41,11 @@ public class Node extends AbstractNode {
private final String trackById;
- public Node(AAITreeNode aaiNode, AAITreeConverter.ModelType modelType) {
+ public Node() {
+ trackById = UUID.randomUUID().toString();
+ }
+
+ public Node(AAITreeNode aaiNode) {
super();
this.instanceId = aaiNode.getId();
this.instanceName = aaiNode.getName();
@@ -46,11 +53,13 @@ public class Node extends AbstractNode {
this.provStatus = aaiNode.getProvStatus();
this.inMaint = aaiNode.getInMaint();
this.uuid = aaiNode.getModelVersionId();
- this.originalName = aaiNode.getModelCustomizationName();
+ this.originalName = aaiNode.getKeyInModel();
this.trackById = aaiNode.getUniqueNodeKey();
ModelInfo nodeModelInfo = new ModelInfo();
- nodeModelInfo.setModelType(modelType.name());
+ if (aaiNode.getType() != null) {
+ nodeModelInfo.setModelType(aaiNode.getType().getModelType());
+ }
nodeModelInfo.setModelName(aaiNode.getModelName());
nodeModelInfo.setModelVersion(aaiNode.getModelVersion());
nodeModelInfo.setModelVersionId(aaiNode.getModelVersionId());
@@ -156,4 +165,16 @@ public class Node extends AbstractNode {
public String getTrackById() {
return trackById;
}
+
+ public static void fillCloudConfigurationProperties(AbstractNode that, CloudConfiguration cloudConfiguration) {
+ if (cloudConfiguration !=null) {
+ that.lcpCloudRegionId = cloudConfiguration.getLcpCloudRegionId();
+ that.tenantId = cloudConfiguration.getTenantId();
+ that.cloudOwner = cloudConfiguration.getCloudOwner();
+ }
+ }
+
+ public static String readValueAsStringFromAdditionalProperties(AAITreeNode node, String key) {
+ return Objects.toString(node.getAdditionalProperties().get(key), null);
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/NodeType.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/NodeType.java
new file mode 100644
index 000000000..5e1228f9f
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/NodeType.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.model.aaiTree;
+
+public enum NodeType {
+ SERVICE_INSTANCE("service-instance", "service-instance-id", "service-instance-name", "service"),
+ GENERIC_VNF ("generic-vnf", "vnf-id", "vnf-name", "vnf"),
+ NETWORK ("l3-network", "network-id", "network-name", "network"),
+ FAILURE ("failure_node", NodeType.NONE, NodeType.NONE, NodeType.NONE),
+ COLLECTION_RESOURCE ("collection", "collection-id", "collection-name", "collection"),
+ CONFIGURATION ("configuration", "configuration-id", "configuration-name", "configuration"),
+ PNF ("pnf", "pnf-id", "pnf-name", "pnf"),
+ VF_MODULE ("vf-module", "vf-module-id", "vf-module-name", "vfModule"),
+ INSTANCE_GROUP ("instance-group", "id", "instance-group-name", "instanceGroup"),
+ PORT ("l-interface", "interface-id", "interface-name", "connectionPoint"),
+ VOLUME_GROUP ("volume-group", "volume-group-id", "volume-group-name", "volumeGroup"),
+ VLAN_TAG("vlan-tag", "vlan-tag-id", NodeType.NONE, NodeType.NONE),
+ VPN_BINDING("vpn-binding", "vpn-id", "vpn-name", "vpnBinding"),
+ ;
+
+ private String type;
+ private String id;
+ private String name;
+ private String modelType;
+
+ public static final String NONE = "";
+
+ NodeType(String type, String id, String name, String modelType) {
+ this.type = type;
+ this.id = id;
+ this.name = name;
+ this.modelType = modelType;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getModelType() {
+ return modelType;
+ }
+
+ public static NodeType fromString(String type) {
+ for (NodeType nodeType : NodeType.values()) {
+ if (nodeType.type.equalsIgnoreCase(type)) {
+ return nodeType;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return this.type;
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java
index 37dc45afd..febd8e0fd 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/RelatedVnf.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,10 +20,10 @@
package org.onap.vid.model.aaiTree;
-import org.onap.vid.aai.util.AAITreeConverter;
-
import static org.onap.vid.aai.util.AAITreeConverter.VNF_TYPE;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
public class RelatedVnf extends Node {
private String serviceInstanceId;
@@ -55,13 +55,15 @@ public class RelatedVnf extends Node {
}
public RelatedVnf(AAITreeNode node) {
- super(node, AAITreeConverter.ModelType.vnf);
+ super(node);
}
public static RelatedVnf from(AAITreeNode node) {
RelatedVnf vnf = new RelatedVnf(node);
- vnf.setServiceInstanceId(node.getParent().getId());
- vnf.setServiceInstanceName(node.getParent().getName());
+ if (node.getParent() != null && node.getParent().getType() == NodeType.SERVICE_INSTANCE) {
+ vnf.setServiceInstanceId(node.getParent().getId());
+ vnf.setServiceInstanceName(node.getParent().getName());
+ }
if (node.getAdditionalProperties().get(VNF_TYPE) != null) {
vnf.setInstanceType(node.getAdditionalProperties().get(VNF_TYPE).toString());
@@ -69,4 +71,22 @@ public class RelatedVnf extends Node {
return vnf;
}
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("serviceInstanceId", serviceInstanceId)
+ .append("serviceInstanceName", serviceInstanceName)
+ .append("tenantName", tenantName)
+ .append("action", action)
+ .append("instanceName", instanceName)
+ .append("instanceId", instanceId)
+ .append("orchStatus", orchStatus)
+ .append("productFamilyId", productFamilyId)
+ .append("lcpCloudRegionId", lcpCloudRegionId)
+ .append("tenantId", tenantId)
+ .append("cloudOwner", cloudOwner)
+ .append("modelInfo", modelInfo)
+ .toString();
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java
index 111e98b25..923be132f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,10 +20,9 @@
package org.onap.vid.model.aaiTree;
-import org.onap.vid.mso.model.ModelInfo;
-
import java.util.HashMap;
import java.util.Map;
+import org.onap.vid.mso.model.ModelInfo;
public class ServiceInstance extends AbstractNode {
@@ -43,13 +42,17 @@ public class ServiceInstance extends AbstractNode {
private Map<String, Vnf> vnfs = new HashMap<>();
private Map<String, Network> networks = new HashMap<>();
+ private Map<String, Vrf> vrfs = new HashMap<>();
+
private Map<String, VnfGroup> vnfGroups = new HashMap<>();
+ private Map<String, CollectionResource> collectionResources = new HashMap<>();
private int validationCounter;
private Map<String, Long> existingVNFCounterMap;
private Map<String, Long> existingNetworksCounterMap;
private Map<String, Long> existingVnfGroupCounterMap;
+ private Map<String, Long> existingVRFCounterMap;
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
@@ -175,6 +178,14 @@ public class ServiceInstance extends AbstractNode {
this.networks = networks;
}
+ public Map<String, CollectionResource> getCollectionResources() {
+ return collectionResources;
+ }
+
+ public void setCollectionResources(Map<String, CollectionResource> collectionResources) {
+ this.collectionResources = collectionResources;
+ }
+
public Map<String, VnfGroup> getVnfGroups() { return vnfGroups; }
public void setVnfGroups(Map<String, VnfGroup> vnfGroups) { this.vnfGroups = vnfGroups; }
@@ -210,4 +221,20 @@ public class ServiceInstance extends AbstractNode {
public void setExistingVnfGroupCounterMap(Map<String, Long> existingVnfGroupCounterMap) {
this.existingVnfGroupCounterMap = existingVnfGroupCounterMap;
}
+
+ public Map<String, Vrf> getVrfs() {
+ return vrfs;
+ }
+
+ public void setVrfs(Map<String, Vrf> vrfs) {
+ this.vrfs = vrfs;
+ }
+
+ public Map<String, Long> getExistingVRFCounterMap() {
+ return existingVRFCounterMap;
+ }
+
+ public void setExistingVRFCounterMap(Map<String, Long> existingVRFCounterMap) {
+ this.existingVRFCounterMap = existingVRFCounterMap;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java
index 2a4c83b2a..0db27eaa4 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VfModule.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,8 +20,6 @@
package org.onap.vid.model.aaiTree;
-import org.onap.vid.aai.util.AAITreeConverter;
-
import static org.onap.vid.aai.util.AAITreeConverter.IS_BASE_VF_MODULE;
public class VfModule extends Node {
@@ -30,7 +28,8 @@ public class VfModule extends Node {
private String volumeGroupName;
public VfModule(AAITreeNode node) {
- super(node, AAITreeConverter.ModelType.vfModule);
+ super(node);
+ fillCloudConfigurationProperties(this, node.getCloudConfiguration());
}
public boolean getIsBase() {
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java
index 03c1508f9..2df5bdcf6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vnf.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,21 +20,19 @@
package org.onap.vid.model.aaiTree;
-import org.onap.vid.aai.util.AAITreeConverter;
-import org.onap.vid.services.AAITreeNodeBuilder;
+import static org.onap.vid.aai.util.AAITreeConverter.VNF_TYPE;
import java.util.HashMap;
import java.util.Map;
-import static org.onap.vid.aai.util.AAITreeConverter.VNF_TYPE;
-
public class Vnf extends Node {
private Map<String, Map<String, VfModule>> vfModules = new HashMap<>();
private Map<String, Network> networks = new HashMap<>();
public Vnf(AAITreeNode node) {
- super(node, AAITreeConverter.ModelType.vnf);
+ super(node);
+ fillCloudConfigurationProperties(this, node.getCloudConfiguration());
}
public Map<String, Map<String, VfModule>> getVfModules() {
@@ -60,11 +58,11 @@ public class Vnf extends Node {
}
node.getChildren().forEach(child -> {
- if (child.getType().equals(AAITreeNodeBuilder.VF_MODULE)) {
+ if (child.getType() == NodeType.VF_MODULE) {
vnf.getVfModules().putIfAbsent(child.getNodeKey(), new HashMap<>());
vnf.getVfModules().get(child.getNodeKey())
- .put(child.getUniqueNodeKey(), VfModule.from(child));
- } else if (child.getType().equals(AAITreeNodeBuilder.NETWORK)) {
+ .put(child.getUniqueNodeKey(), VfModule.from(child));
+ } else if (child.getType() == NodeType.NETWORK) {
vnf.getNetworks().put(child.getUniqueNodeKey(), Network.from(child));
}
});
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.java
deleted file mode 100644
index 21e5ca45e..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.vid.model.aaiTree;
-
-import org.onap.vid.aai.util.AAITreeConverter;
-
-
-public class VnfGroup extends Node {
-
- public static final String INSTANCE_GROUP_TYPE = "instance-group-type";
- public static final String INSTANCE_GROUP_ROLE = "instance-group-role";
- public static final String INSTANCE_GROUP_FUNCTION = "instance-group-function";
-
- private String instanceGroupRole;
- private String instanceGroupFunction;
-
-
- public VnfGroup(AAITreeNode node) {
- super(node, AAITreeConverter.ModelType.instanceGroup);
- }
-
- public static VnfGroup from(AAITreeNode node) {
- VnfGroup vnfGroup = new VnfGroup(node);
- if (node.getAdditionalProperties().get(INSTANCE_GROUP_TYPE) != null) {
- vnfGroup.setInstanceType(node.getAdditionalProperties().get(INSTANCE_GROUP_TYPE).toString());
- }
- if (node.getAdditionalProperties().get(INSTANCE_GROUP_FUNCTION) != null) {
- vnfGroup.setInstanceGroupFunction(node.getAdditionalProperties().get(INSTANCE_GROUP_FUNCTION).toString());
- }
- if (node.getAdditionalProperties().get(INSTANCE_GROUP_ROLE) != null) {
- vnfGroup.setInstanceGroupRole(node.getAdditionalProperties().get(INSTANCE_GROUP_ROLE).toString());
- }
-
- return vnfGroup;
- }
-
- public String getInstanceGroupRole() {
- return instanceGroupRole;
- }
-
- public void setInstanceGroupRole(String instanceGroupRole) {
- this.instanceGroupRole = instanceGroupRole;
- }
-
- public String getInstanceGroupFunction() {
- return instanceGroupFunction;
- }
-
- public void setInstanceGroupFunction(String instanceGroupFunction) {
- this.instanceGroupFunction = instanceGroupFunction;
- }
-
-
-}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.kt b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.kt
new file mode 100644
index 000000000..47a6c98be
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VnfGroup.kt
@@ -0,0 +1,10 @@
+package org.onap.vid.model.aaiTree
+
+class VnfGroup(node: AAITreeNode) : InstanceGroup(node) {
+
+ val vnfs: Map<String, RelatedVnf> = node.children
+ .filter { it.type == NodeType.GENERIC_VNF }
+ .map { it.uniqueNodeKey to RelatedVnf.from(it) }
+ .toMap()
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VpnBinding.kt b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VpnBinding.kt
new file mode 100644
index 000000000..d43bf26f0
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/VpnBinding.kt
@@ -0,0 +1,50 @@
+package org.onap.vid.model.aaiTree
+
+import com.fasterxml.jackson.annotation.JsonAlias
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties
+import com.fasterxml.jackson.annotation.JsonInclude
+import com.fasterxml.jackson.core.type.TypeReference
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate
+import org.onap.vid.utils.JACKSON_OBJECT_MAPPER
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+class VpnBinding(aaiNode: AAITreeNode) : Node(aaiNode) {
+ @JsonCreator
+ constructor() : this(AAITreeNode())
+ var region: String? = null
+ var customerId: String? = null
+ var routeTargets: List<RouteTarget>? = null
+}
+
+val LOGGER: EELFLoggerDelegate = EELFLoggerDelegate.getLogger(VpnBinding::class.java)
+
+fun from(node: AAITreeNode): VpnBinding {
+ val vpnBinding = VpnBinding(node)
+ vpnBinding.platformName = Node.readValueAsStringFromAdditionalProperties(node, "vpn-platform")
+ vpnBinding.instanceType = Node.readValueAsStringFromAdditionalProperties(node, "vpn-type")
+ vpnBinding.region = Node.readValueAsStringFromAdditionalProperties(node, "vpn-region")
+ vpnBinding.customerId = Node.readValueAsStringFromAdditionalProperties(node, "customer-vpn-id")
+
+ vpnBinding.routeTargets = try {
+ JACKSON_OBJECT_MAPPER.convertValue(
+ node.additionalProperties.getOrDefault("route-targets", emptyList<RouteTarget>()),
+ object : TypeReference<List<RouteTarget>>() {})
+ } catch (exception: Exception) {
+ LOGGER.error("Failed to parse route-targets of vpn with id:${vpnBinding.instanceId}", exception)
+ listOf(RouteTarget("ParsingFailure", "ParsingFailure"))
+ }
+
+ return vpnBinding
+}
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+data class RouteTarget(
+
+ @JsonAlias("global-route-target")
+ val globalRouteTarget: String? = null,
+
+ @JsonAlias("route-target-role")
+ val routeTargetRole: String? = null
+)
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vrf.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vrf.java
new file mode 100644
index 000000000..d6ef7ab0e
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Vrf.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.model.aaiTree;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Vrf extends Node {
+
+ private Map<String, Network> networks = new HashMap<>();
+ private Map<String, VpnBinding> vpns = new HashMap<>();
+
+
+ public Vrf(AAITreeNode node){
+ super(node);
+ }
+
+ public static Vrf from(AAITreeNode node) {
+ Vrf vrf = new Vrf(node);
+
+ node.getChildren().forEach(child -> {
+ if (child.getType() == NodeType.NETWORK) {
+ vrf.getNetworks().put(child.getUniqueNodeKey(), Network.from(child));
+ }
+ if (child.getType() == NodeType.VPN_BINDING) {
+ vrf.getVpns().put(child.getUniqueNodeKey(), VpnBindingKt.from(child));
+ }
+ });
+ return vrf;
+ }
+
+ public Map<String, Network> getNetworks() {
+ return networks;
+ }
+
+ public void setNetworks(Map<String, Network> networks) {
+ this.networks = networks;
+ }
+
+ public Map<String, VpnBinding> getVpns() {
+ return vpns;
+ }
+
+ public void setVpns(Map<String, VpnBinding> vpns) {
+ this.vpns = vpns;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/errorReport/ReportCreationParameters.java b/vid-app-common/src/main/java/org/onap/vid/model/errorReport/ReportCreationParameters.java
index babbf8906..e7b7fa67d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/errorReport/ReportCreationParameters.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/errorReport/ReportCreationParameters.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.vid.model.errorReport;
public class ReportCreationParameters {
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java
index fe9ebc037..926dc3cdc 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,25 +20,29 @@
package org.onap.vid.model.serviceInstantiation;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.StringUtils;
import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
import org.onap.vid.model.Action;
import org.onap.vid.mso.model.ModelInfo;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
- protected final String instanceId;
+ protected String instanceId;
+
protected ModelInfo modelInfo;
protected String instanceName;
- protected final Action action;
+ protected Action action;
protected String lcpCloudRegionId;
@@ -48,13 +52,21 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
protected boolean rollbackOnFailure;
- private static final Map<String, Action> actionStingToEnumMap = ImmutableMap.of(
- "Delete", Action.Delete,
- "Create", Action.Create,
- "None", Action.None,
- "Update_Delete", Action.Delete,
- "None_Delete", Action.Delete
- );
+ protected String trackById;
+
+ protected Boolean isFailed;
+
+ protected String statusMessage;
+
+ private static final Map<String, Action> actionStingToEnumMap = ImmutableMap.<String, Action>builder()
+ .put("Delete", Action.Delete)
+ .put("Create", Action.Create)
+ .put("None", Action.None)
+ .put("Update_Delete", Action.Delete)
+ .put("None_Delete", Action.Delete)
+ .put("Resume", Action.Resume)
+ .put("Replace", Action.Replace)
+ .build();
protected BaseResource(@JsonProperty("modelInfo") ModelInfo modelInfo,
@@ -65,16 +77,22 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
@JsonProperty("tenantId") String tenantId,
@JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
@JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
- @JsonProperty("instanceId") String instanceId) {
+ @JsonProperty("instanceId") String instanceId,
+ @JsonProperty("trackById") String trackById,
+ @JsonProperty("isFailed") Boolean isFailed,
+ @JsonProperty("statusMessage") String statusMessage) {
this.modelInfo = modelInfo;
this.modelInfo.setModelType(getModelType());
this.rollbackOnFailure = rollbackOnFailure;
- this.instanceName = StringUtils.defaultString(instanceName, "");;
+ this.instanceName = StringUtils.defaultString(instanceName, "");
this.action = actionStringToEnum(action);
this.lcpCloudRegionId = StringUtils.isNotEmpty(legacyRegion) ? legacyRegion : lcpCloudRegionId;
this.tenantId = tenantId;
this.instanceParams = instanceParams;
this.instanceId = instanceId;
+ this.trackById = trackById;
+ this.isFailed = isFailed!= null ? isFailed: false;
+ this.statusMessage = statusMessage;
}
private Action actionStringToEnum(String actionAsString) {
@@ -90,7 +108,7 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
}
public Action getAction() {
- return action;
+ return (action == null ? Action.Create : action);
}
public String getLcpCloudRegionId() {
@@ -105,11 +123,49 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
return instanceParams == null ? Collections.emptyList() : instanceParams;
}
- public boolean isRollbackOnFailure() { return rollbackOnFailure; }
+ public boolean isRollbackOnFailure() { return rollbackOnFailure; }
public String getInstanceId() {
return instanceId;
}
protected abstract String getModelType();
+
+ public String getTrackById() {
+ return trackById;
+ }
+
+ public void setTrackById(String trackById) {
+ this.trackById = trackById;
+ }
+
+ public Boolean getIsFailed() {
+ return isFailed;
+ }
+
+ public void setIsFailed(Boolean isFailed) {
+ this.isFailed = isFailed;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public void setAction(Action action) {
+ this.action = action;
+ }
+
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+
+ public void setStatusMessage(String statusMessage) {
+ this.statusMessage = statusMessage;
+ }
+
+ @JsonIgnore
+ public abstract Collection<? extends BaseResource> getChildren();
+
+ @JsonIgnore
+ public abstract JobType getJobType();
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java
index 3fda8429b..b945f1327 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,21 +22,47 @@ package org.onap.vid.model.serviceInstantiation;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
import org.onap.vid.mso.model.ModelInfo;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
public class InstanceGroup extends BaseResource implements JobAdapter.AsyncJobRequest {
+ private final Map<String, InstanceGroupMember> vnfGroupMembers;
+
public InstanceGroup(@JsonProperty("modelInfo") ModelInfo modelInfo,
@JsonProperty("instanceName") String instanceName,
@JsonProperty("action") String action,
@JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
- @JsonProperty("instanceId") String instanceId) {
+ @JsonProperty("instanceId") String instanceId,
+ @JsonProperty("vnfs") Map<String, InstanceGroupMember> vnfGroupMembers,
+ @JsonProperty("trackById") String trackById,
+ @JsonProperty("isFailed") Boolean isFailed,
+ @JsonProperty("statusMessage") String statusMessage) {
- super(modelInfo, instanceName, action, null, null, null, null, rollbackOnFailure, instanceId);
+ super(modelInfo, instanceName, action, null, null, null, null, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage);
+ this.vnfGroupMembers = vnfGroupMembers;
}
@Override
protected String getModelType() {
return "instanceGroup";
}
+
+ @Override
+ public Collection<InstanceGroupMember> getChildren() {
+ return getVnfGroupMembers().values();
+ }
+
+ public Map<String, InstanceGroupMember> getVnfGroupMembers() {
+ return vnfGroupMembers == null ? Collections.emptyMap() : vnfGroupMembers;
+ }
+
+ @Override
+ public JobType getJobType() {
+ return JobType.InstanceGroup;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java
new file mode 100644
index 000000000..7bfaf02b1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.model.serviceInstantiation;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Collection;
+import java.util.Collections;
+import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
+import org.onap.vid.mso.model.ModelInfo;
+
+public class InstanceGroupMember extends BaseResource implements JobAdapter.AsyncJobRequest{
+
+ public InstanceGroupMember(@JsonProperty("instanceId") String instanceId,
+ @JsonProperty("action") String action,
+ @JsonProperty("trackById") String trackById,
+ @JsonProperty("isFailed") Boolean isFailed,
+ @JsonProperty("statusMessage") String statusMessage) {
+ super(new ModelInfo(), null, action, null, null, null, null, false, instanceId, trackById, isFailed, statusMessage);
+ }
+
+ @Override
+ protected String getModelType() {
+ return "vnf";
+ }
+
+ @Override
+ public Collection<BaseResource> getChildren() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public JobType getJobType() {
+ return JobType.InstanceGroupMember;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java
index addd7e1ee..797e28a02 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* VID
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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.
@@ -22,8 +22,11 @@ package org.onap.vid.model.serviceInstantiation;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
import org.onap.vid.mso.model.ModelInfo;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -36,19 +39,22 @@ public class Network extends BaseResource implements JobAdapter.AsyncJobRequest
private final String lineOfBusiness;
public Network(@JsonProperty("modelInfo") ModelInfo modelInfo,
- @JsonProperty("productFamilyId") String productFamilyId,
- @JsonProperty("instanceName") String instanceName,
+ @JsonProperty("productFamilyId") String productFamilyId,
+ @JsonProperty("instanceName") String instanceName,
@JsonProperty("action") String action,
- @JsonProperty("platformName") String platformName,
- @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
+ @JsonProperty("platformName") String platformName,
+ @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
@JsonProperty("legacyRegion") String legacyRegion,
- @JsonProperty("tenantId") String tenantId,
- @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
- @JsonProperty("lineOfBusinessName") String lineOfBusiness,
- @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
- @JsonProperty("instanceId") String instanceId) {
+ @JsonProperty("tenantId") String tenantId,
+ @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
+ @JsonProperty("lineOfBusinessName") String lineOfBusiness,
+ @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
+ @JsonProperty("instanceId") String instanceId,
+ @JsonProperty("trackById") String trackById,
+ @JsonProperty("isFailed") Boolean isFailed,
+ @JsonProperty("statusMessage") String statusMessage) {
- super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId);
+ super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage);
this.productFamilyId = productFamilyId;
this.platformName = platformName;
this.lineOfBusiness = lineOfBusiness;
@@ -71,4 +77,14 @@ public class Network extends BaseResource implements JobAdapter.AsyncJobRequest
return "network";
}
+ @Override
+ public Collection<BaseResource> getChildren() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public JobType getJobType() {
+ return JobType.NetworkInstantiation;
+ }
+
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java
index 5d963134b..afc8534a1 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,12 +21,18 @@
package org.onap.vid.model.serviceInstantiation;
import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.commons.lang3.ObjectUtils;
import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
+import org.onap.vid.model.VidNotions;
import org.onap.vid.mso.model.ModelInfo;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
public class ServiceInstantiation extends BaseResource implements JobAdapter.AsyncJobRequest {
@@ -58,12 +64,15 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy
private final boolean isPause;
- private final int bulkSize;
+ private int bulkSize;
private final String testApi;
private final boolean isALaCarte;
+ private final VidNotions vidNotions;
+ private Map<String, VrfEntry> vrfs;
+
public ServiceInstantiation(@JsonProperty("modelInfo") ModelInfo modelInfo,
@JsonProperty("owningEntityId") String owningEntityId,
@JsonProperty("owningEntityName") String owningEntityName,
@@ -82,6 +91,7 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy
@JsonProperty("vnfs") Map<String, Vnf> vnfs,
@JsonProperty("networks") Map<String, Network> networks,
@JsonProperty("vnfGroups") Map<String, InstanceGroup> vnfGroups,
+ @JsonProperty("vrfs") Map<String, VrfEntry> vrfs,
@JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
@JsonProperty("pause") boolean isPause,
@JsonProperty("bulkSize") int bulkSize,
@@ -89,9 +99,12 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy
@JsonProperty("isALaCarte") boolean isALaCarte,
@JsonProperty("testApi") String testApi,
@JsonProperty("instanceId") String instanceId,
- @JsonProperty("action") String action
- ) {
- super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId);
+ @JsonProperty("action") String action,
+ @JsonProperty("trackById") String trackById,
+ @JsonProperty("isFailed") Boolean isFailed,
+ @JsonProperty("statusMessage") String statusMessage,
+ @JsonProperty("vidNotions") VidNotions vidNotions) {
+ super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage);
this.owningEntityId = owningEntityId;
this.owningEntityName = owningEntityName;
this.projectName = projectName;
@@ -105,12 +118,15 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy
this.vnfs = vnfs;
this.networks = networks;
this.vnfGroups = vnfGroups;
+ this.vrfs = vrfs;
this.isPause = isPause;
this.bulkSize = bulkSize;
this.isALaCarte = isALaCarte;
this.testApi = isALaCarte ? testApi : null;
+ this.vidNotions = vidNotions;
}
+
public String getOwningEntityId() {
return owningEntityId;
}
@@ -152,15 +168,19 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy
}
public Map<String, Vnf> getVnfs() {
- return vnfs == null ? Collections.emptyMap() : vnfs;
+ return emptyMapIfNull(vnfs);
}
public Map<String, Network> getNetworks() {
- return networks == null ? Collections.emptyMap() : networks;
+ return emptyMapIfNull(networks);
}
public Map<String, InstanceGroup> getVnfGroups() {
- return vnfGroups == null ? Collections.emptyMap() : vnfGroups;
+ return emptyMapIfNull(vnfGroups);
+ }
+
+ public Map<String, VrfEntry> getVrfs() {
+ return emptyMapIfNull(vrfs);
}
public boolean isPause() {
@@ -169,11 +189,24 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy
public int getBulkSize() { return bulkSize; }
+ public void setBulkSize(int bulkSize) {
+ this.bulkSize = bulkSize;
+ }
+
+ public VidNotions getVidNotions() {
+ return vidNotions;
+ }
+
@Override
protected String getModelType() {
return "service";
}
+ @Override
+ public Collection<BaseResource> getChildren() {
+ return Stream.of(getNetworks().values(), getVnfs().values(), getVnfGroups().values()).flatMap(Collection::stream).collect(Collectors.toList());
+ }
+
@JsonProperty("isALaCarte")
public boolean isALaCarte() {
return isALaCarte;
@@ -183,4 +216,13 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy
return this.testApi;
}
-}
+ @Override
+ public JobType getJobType() {
+ return JobType.ALaCarteService;
+ }
+
+ private <T> Map<String, T> emptyMapIfNull(Map<String, T> map) {
+ return ObjectUtils.defaultIfNull(map, Collections.emptyMap());
+ }
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java
index b56f116cd..97b23af20 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* VID
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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.
@@ -23,8 +23,11 @@ package org.onap.vid.model.serviceInstantiation;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
import org.onap.vid.mso.model.ModelInfo;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -37,22 +40,25 @@ import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest {
@JsonInclude(NON_NULL) private final String volumeGroupInstanceName;
- private boolean usePreload;
+ @JsonInclude(NON_NULL) private Boolean usePreload;
private Map<String, String> supplementaryParams;
public VfModule( @JsonProperty("modelInfo") ModelInfo modelInfo,
- @JsonProperty("instanceName") String instanceName,
- @JsonProperty("volumeGroupName") String volumeGroupInstanceName,
+ @JsonProperty("instanceName") String instanceName,
+ @JsonProperty("volumeGroupName") String volumeGroupInstanceName,
@JsonProperty("action") String action,
- @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
- @JsonProperty("legacyRegion") String legacyRegion,
- @JsonProperty("tenantId") String tenantId,
- @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
- @JsonProperty("supplementaryFileContent") Map<String, String> supplementaryParams,
- @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
- @JsonProperty("sdncPreLoad") boolean usePreload,
- @JsonProperty("instanceId") String instanceId) {
- super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId);
+ @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
+ @JsonProperty("legacyRegion") String legacyRegion,
+ @JsonProperty("tenantId") String tenantId,
+ @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
+ @JsonProperty("supplementaryFileContent") Map<String, String> supplementaryParams,
+ @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
+ @JsonProperty("sdncPreLoad") Boolean usePreload,
+ @JsonProperty("instanceId") String instanceId,
+ @JsonProperty("trackById") String trackById,
+ @JsonProperty("isFailed") Boolean isFailed,
+ @JsonProperty("statusMessage") String statusMessage) {
+ super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage);
this.volumeGroupInstanceName = volumeGroupInstanceName;
this.usePreload = usePreload;
this.supplementaryParams = supplementaryParams;
@@ -62,7 +68,8 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
return volumeGroupInstanceName;
}
- public boolean isUsePreload() {
+ public Boolean isUsePreload() {
+
return usePreload;
}
@@ -75,5 +82,13 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
return "vfModule";
}
+ @Override
+ public Collection<BaseResource> getChildren() {
+ return Collections.emptyList();
+ }
-}
+ @Override
+ public JobType getJobType() {
+ return JobType.VfmoduleInstantiation;
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java
index 2619533a7..0da3f0695 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* VID
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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.
@@ -23,10 +23,12 @@ package org.onap.vid.model.serviceInstantiation;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
import org.onap.vid.mso.model.ModelInfo;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+
+import static java.util.stream.Collectors.toList;
/**
* The Class VNF.
@@ -42,24 +44,27 @@ public class Vnf extends BaseResource implements JobAdapter.AsyncJobRequest {
private final Map<String, Map<String, VfModule>> vfModules;
public Vnf(@JsonProperty("modelInfo") ModelInfo modelInfo,
- @JsonProperty("productFamilyId") String productFamilyId,
- @JsonProperty("instanceName") String instanceName,
+ @JsonProperty("productFamilyId") String productFamilyId,
+ @JsonProperty("instanceName") String instanceName,
@JsonProperty("action") String action,
- @JsonProperty("platformName") String platformName,
- @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
- @JsonProperty("legacyRegion") String legacyRegion,
- @JsonProperty("tenantId") String tenantId,
- @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
- @JsonProperty("lineOfBusinessName") String lineOfBusiness,
- @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
+ @JsonProperty("platformName") String platformName,
+ @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
+ @JsonProperty("legacyRegion") String legacyRegion,
+ @JsonProperty("tenantId") String tenantId,
+ @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
+ @JsonProperty("lineOfBusinessName") String lineOfBusiness,
+ @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
@JsonProperty("instanceId") String instanceId,
- @JsonProperty("vfModules") Map<String, Map<String, VfModule>> vfModules) {
+ @JsonProperty("vfModules") Map<String, Map<String, VfModule>> vfModules,
+ @JsonProperty("trackById") String trackById,
+ @JsonProperty("isFailed") Boolean isFailed,
+ @JsonProperty("statusMessage") String statusMessage) {
- super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId);
+ super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage);
this.productFamilyId = productFamilyId;
this.platformName = platformName;
this.lineOfBusiness = lineOfBusiness;
- this.vfModules = vfModules;
+ this.vfModules = vfModules==null ? Collections.emptyMap() : vfModules;
}
public String getProductFamilyId() {
@@ -82,4 +87,17 @@ public class Vnf extends BaseResource implements JobAdapter.AsyncJobRequest {
protected String getModelType() {
return "vnf";
}
+
+ @Override
+ public Collection<BaseResource> getChildren() {
+ return getVfModules().values().stream()
+ .filter(Objects::nonNull)
+ .flatMap(x->x.values().stream())
+ .collect(toList());
+ }
+
+ @Override
+ public JobType getJobType() {
+ return JobType.VnfInstantiation;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VrfEntry.kt b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VrfEntry.kt
new file mode 100644
index 000000000..5c9ac9095
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VrfEntry.kt
@@ -0,0 +1,6 @@
+package org.onap.vid.model.serviceInstantiation
+
+import org.onap.vid.model.aaiTree.Network
+import org.onap.vid.model.aaiTree.VpnBinding
+
+data class VrfEntry(val networks: Map<String, Network>, val vpns: Map<String, VpnBinding>)