diff options
Diffstat (limited to 'mso-catalog-db')
27 files changed, 671 insertions, 66 deletions
diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml index 08e9719f50..6a4a6774e6 100644 --- a/mso-catalog-db/pom.xml +++ b/mso-catalog-db/pom.xml @@ -102,5 +102,10 @@ <artifactId>asm-xml</artifactId> <version>6.1</version> </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-common</artifactId> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java index 053bf745e1..deaa2a3221 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.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. @@ -120,6 +120,11 @@ public class CloudSite { @Temporal(TemporalType.TIMESTAMP) private Date updated; + @JsonProperty("support_fabric") + @BusinessKey + @Column(name = "SUPPORT_FABRIC") + private Boolean supportFabric = true; + @Transient private URI uri; @@ -142,6 +147,7 @@ public class CloudSite { this.platform = site.getPlatform(); this.regionId = site.getRegionId(); this.identityServiceId = site.getIdentityServiceId(); + this.supportFabric = site.getSupportFabric(); } @@ -247,6 +253,14 @@ public class CloudSite { this.identityService = identity; } + public Boolean getSupportFabric() { + return supportFabric; + } + + public void setSupportFabric(Boolean supportFabric) { + this.supportFabric = supportFabric; + } + @Deprecated public void setIdentityServiceId(String identityServiceId) { this.identityServiceId = identityServiceId; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java index 425e0b8bbc..ac0d09b13b 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java @@ -32,7 +32,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder; @IdClass(ControllerSelectionReferenceId.class) @Entity -@Table(name = "CONTROLLER_SELECTION_REFERENCE") +@Table(name = "controller_selection_reference") public class ControllerSelectionReference implements Serializable { private static final long serialVersionUID = -608098800737567188L; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java index 93e2992d3f..9691eff5f5 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java @@ -22,6 +22,7 @@ package org.onap.so.db.catalog.beans; public enum OrchestrationStatus { ACTIVE("Active", "active"), + ACTIVATED("Activated", "activated"), ASSIGNED("Assigned", "assigned"), CREATED("Created", "created"), INVENTORIED("Inventoried", "inventoried"), diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java index fabbc5007f..db0e0abd3c 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java @@ -83,6 +83,9 @@ public class PnfResourceCustomization implements Serializable { @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION") private Boolean skipPostInstConf; + @Column(name = "CONTROLLER_ACTOR") + private String controllerActor; + @Override public String toString() { return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) @@ -90,7 +93,7 @@ public class PnfResourceCustomization implements Serializable { .append("nfFunction", nfFunction).append("nfType", nfType).append("nfRole", nfRole) .append("nfNamingCode", nfNamingCode).append("multiStageDesign", multiStageDesign) .append("pnfResources", pnfResources).append("blueprintName", blueprintName) - .append("blueprintVersion", blueprintVersion).toString(); + .append("blueprintVersion", blueprintVersion).append("controllerActor", controllerActor).toString(); } @Override @@ -222,4 +225,11 @@ public class PnfResourceCustomization implements Serializable { this.skipPostInstConf = skipPostInstConf; } + public String getControllerActor() { + return controllerActor; + } + + public void setControllerActor(String controllerActor) { + this.controllerActor = controllerActor; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceWorkflow.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceWorkflow.java new file mode 100644 index 0000000000..6e48938f19 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceWorkflow.java @@ -0,0 +1,91 @@ +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import com.openpojo.business.annotation.BusinessKey; +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "pnf_resource_to_workflow") +public class PnfResourceWorkflow implements Serializable { + + private static final long serialVersionUID = 4897166645148426088L; + + @Id + @Column(name = "ID", nullable = false, updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer ID; + + @BusinessKey + @Column(name = "PNF_RESOURCE_MODEL_UUID") + private String pnfResourceModelUUID; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PNF_RESOURCE_MODEL_UUID", updatable = false, insertable = false) + private PnfResource pnfResource; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "WORKFLOW_ID") + private Workflow workflow; + + @Override + public String toString() { + return new ToStringBuilder(this).append("pnfResourceModelUUID", pnfResourceModelUUID).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof PnfResourceWorkflow)) { + return false; + } + PnfResourceWorkflow castOther = (PnfResourceWorkflow) other; + return new EqualsBuilder().append(pnfResourceModelUUID, castOther.pnfResourceModelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(pnfResourceModelUUID).toHashCode(); + } + + public Integer getID() { + return ID; + } + + public String getPnfResourceModelUUID() { + return pnfResourceModelUUID; + } + + public void setPnfResourceModelUUID(String pnfResourceModelUUID) { + this.pnfResourceModelUUID = pnfResourceModelUUID; + } + + @LinkedResource + public PnfResource getPnfResource() { + return pnfResource; + } + + public void setPnfResource(PnfResource pnfResource) { + this.pnfResource = pnfResource; + } + + @LinkedResource + public Workflow getWorkflow() { + return workflow; + } + + public void setWorkflow(Workflow workflow) { + this.workflow = workflow; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java index e591552ebf..ab40cefb4e 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java @@ -142,6 +142,18 @@ public class Service implements Serializable { @Column(name = "ONAP_GENERATED_NAMING") private Boolean onapGeneratedNaming; + @Column(name = "CDS_BLUEPRINT_NAME") + private String blueprintName; + + @Column(name = "CDS_BLUEPRINT_VERSION") + private String blueprintVersion; + + @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION") + private Boolean skipPostInstConf; + + @Column(name = "CONTROLLER_ACTOR") + private String controllerActor; + @Override public String toString() { return new ToStringBuilder(this).append("modelName", modelName).append("description", description) @@ -399,4 +411,35 @@ public class Service implements Serializable { this.onapGeneratedNaming = onapGeneratedNaming; } + public String getBlueprintName() { + return blueprintName; + } + + public void setBlueprintName(String blueprintName) { + this.blueprintName = blueprintName; + } + + public String getBlueprintVersion() { + return blueprintVersion; + } + + public void setBlueprintVersion(String blueprintVersion) { + this.blueprintVersion = blueprintVersion; + } + + public Boolean isSkipPostInstConf() { + return skipPostInstConf; + } + + public void setSkipPostInstConf(Boolean skipPostInstConf) { + this.skipPostInstConf = skipPostInstConf; + } + + public String getControllerActor() { + return controllerActor; + } + + public void setControllerActor(String controllerActor) { + this.controllerActor = controllerActor; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java index 5a241afc3a..9e98041cf8 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java @@ -25,7 +25,8 @@ import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -46,6 +47,7 @@ public class ServiceRecipe implements Serializable, Recipe { @Id @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @BusinessKey @@ -116,6 +118,7 @@ public class ServiceRecipe implements Serializable, Recipe { super(); } + @Override public Integer getId() { return id; } @@ -136,6 +139,7 @@ public class ServiceRecipe implements Serializable, Recipe { this.serviceModelUUID = serviceModelUUID; } + @Override public String getAction() { return action; } @@ -144,6 +148,7 @@ public class ServiceRecipe implements Serializable, Recipe { this.action = action; } + @Override public String getDescription() { return description; } @@ -152,6 +157,7 @@ public class ServiceRecipe implements Serializable, Recipe { this.description = description; } + @Override public String getOrchestrationUri() { return orchestrationUri; } @@ -160,6 +166,7 @@ public class ServiceRecipe implements Serializable, Recipe { this.orchestrationUri = orchestrationUri; } + @Override public String getParamXsd() { return paramXsd; } @@ -168,6 +175,7 @@ public class ServiceRecipe implements Serializable, Recipe { this.paramXsd = paramXsd; } + @Override public Integer getRecipeTimeout() { return recipeTimeout; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java index c2cf2d7cf6..9ec61ff05f 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java @@ -17,7 +17,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; @Entity -@Table(name = "USER_PARAMETERS") +@Table(name = "user_parameters") public class UserParameters implements Serializable { private static final long serialVersionUID = -5036895978102778877L; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java index 29f8bcece5..3420682900 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java @@ -100,6 +100,9 @@ public class VfModuleCustomization implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "vfModuleCustomization") private Set<CvnfcCustomization> cvnfcCustomization; + @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION") + private Boolean skipPostInstConf; + @Override public boolean equals(final Object other) { if (!(other instanceof VfModuleCustomization)) { @@ -239,4 +242,12 @@ public class VfModuleCustomization implements Serializable { public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) { this.cvnfcCustomization = cvnfcCustomization; } + + public Boolean isSkipPostInstConf() { + return skipPostInstConf; + } + + public void setSkipPostInstConf(Boolean skipPostInstConf) { + this.skipPostInstConf = skipPostInstConf; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfComponentsRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfComponentsRecipe.java index 58e7c6c61c..89121bc7e1 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfComponentsRecipe.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfComponentsRecipe.java @@ -23,6 +23,8 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -38,6 +40,7 @@ public class VnfComponentsRecipe implements Serializable, Recipe { @Id @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @BusinessKey @@ -92,6 +95,7 @@ public class VnfComponentsRecipe implements Serializable, Recipe { .toHashCode(); } + @Override public Integer getId() { return id; } @@ -100,6 +104,7 @@ public class VnfComponentsRecipe implements Serializable, Recipe { this.id = id; } + @Override public String getAction() { return action; } @@ -108,6 +113,7 @@ public class VnfComponentsRecipe implements Serializable, Recipe { this.action = action; } + @Override public String getDescription() { return description; } @@ -132,6 +138,7 @@ public class VnfComponentsRecipe implements Serializable, Recipe { this.vnfType = vnfType; } + @Override public String getParamXsd() { return paramXsd; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java index 8bf45b52c7..ef3d8761c1 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java @@ -24,6 +24,8 @@ import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.PrePersist; import javax.persistence.Table; @@ -42,6 +44,7 @@ public class VnfRecipe implements Serializable, Recipe { @Id @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @BusinessKey @@ -117,6 +120,7 @@ public class VnfRecipe implements Serializable, Recipe { this.nfRole = nfRole; } + @Override public String getParamXsd() { return paramXsd; } @@ -133,6 +137,7 @@ public class VnfRecipe implements Serializable, Recipe { this.vfModuleId = vfModuleId; } + @Override public Integer getId() { return id; } @@ -141,6 +146,7 @@ public class VnfRecipe implements Serializable, Recipe { this.id = id; } + @Override public String getAction() { return action; } @@ -149,6 +155,7 @@ public class VnfRecipe implements Serializable, Recipe { this.action = action; } + @Override public String getDescription() { return description; } @@ -157,6 +164,7 @@ public class VnfRecipe implements Serializable, Recipe { this.description = description; } + @Override public String getOrchestrationUri() { return orchestrationUri; } @@ -165,6 +173,7 @@ public class VnfRecipe implements Serializable, Recipe { this.orchestrationUri = orchestrationUri; } + @Override public Integer getRecipeTimeout() { return recipeTimeout; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java index 36c9251d59..094a1f0bf3 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java @@ -23,9 +23,7 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; -import java.util.HashSet; import java.util.List; -import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,7 +32,6 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.PrePersist; @@ -124,6 +121,12 @@ public class VnfResourceCustomization implements Serializable { @Column(name = "VNFCINSTANCEGROUP_ORDER") private String vnfcInstanceGroupOrder; + @Column(name = "NF_DATA_VALID") + private Boolean nfDataValid; + + @Column(name = "CONTROLLER_ACTOR") + private String controllerActor; + @Override public boolean equals(final Object other) { if (!(other instanceof VnfResourceCustomization)) { @@ -152,7 +155,8 @@ public class VnfResourceCustomization implements Serializable { .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources) .append("vfModuleCustomizations", vfModuleCustomizations) .append("vnfcInstanceGroupOrder", vnfcInstanceGroupOrder) - .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString(); + .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations) + .append("controllerActor", controllerActor).toString(); } @PrePersist @@ -336,4 +340,20 @@ public class VnfResourceCustomization implements Serializable { public void setVnfcInstanceGroupOrder(String vnfcInstanceGroupOrder) { this.vnfcInstanceGroupOrder = vnfcInstanceGroupOrder; } + + public Boolean getNfDataValid() { + return nfDataValid; + } + + public void setNfDataValid(Boolean nfDataValid) { + this.nfDataValid = nfDataValid; + } + + public String getControllerActor() { + return controllerActor; + } + + public void setControllerActor(String controllerActor) { + this.controllerActor = controllerActor; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java index 6bd0713085..fc1c753e85 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java @@ -74,6 +74,9 @@ public class Workflow implements Serializable { private List<VnfResourceWorkflow> vnfResourceWorkflow; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "workflow") + private List<PnfResourceWorkflow> pnfResourceWorkflow; + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "workflow") private List<WorkflowActivitySpecSequence> workflowActivitySpecSequence; @PrePersist @@ -191,6 +194,15 @@ public class Workflow implements Serializable { } @LinkedResource + public List<PnfResourceWorkflow> getPnfResourceWorkflow() { + return pnfResourceWorkflow; + } + + public void setPnfResourceWorkflow(List<PnfResourceWorkflow> pnfResourceWorkflow) { + this.pnfResourceWorkflow = pnfResourceWorkflow; + } + + @LinkedResource public List<WorkflowActivitySpecSequence> getWorkflowActivitySpecSequence() { return workflowActivitySpecSequence; } @@ -207,6 +219,7 @@ public class Workflow implements Serializable { .append("resourceTarget", resourceTarget).append("source", source) .append("timeoutMinutes", timeoutMinutes).append("artifactChecksum", artifactChecksum) .append("created", created).append("vnfResourceWorkflow", vnfResourceWorkflow) + .append("pnfResourceWorkflow", pnfResourceWorkflow) .append("WorkflowActivitySpecSequence", workflowActivitySpecSequence).toString(); } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java index b74ade1e1f..91b74d4d6a 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java @@ -34,7 +34,6 @@ import javax.persistence.Table; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; -import org.onap.so.db.catalog.beans.BuildingBlockDetail; import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; @@ -65,6 +64,14 @@ public class OrchestrationFlow implements Serializable { @Column(name = "FLOW_VERSION") private Double flowVersion; + @BusinessKey + @Column(name = "ACTION") + private String bpmnAction; + + @BusinessKey + @Column(name = "SCOPE") + private String bpmnScope; + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "NB_REQ_REF_LOOKUP_ID") private NorthBoundRequest northBoundRequest; @@ -73,7 +80,8 @@ public class OrchestrationFlow implements Serializable { public String toString() { return new ToStringBuilder(this).append("id", id).append("action", action) .append("sequenceNumber", sequenceNumber).append("flowName", flowName) - .append("flowVersion", flowVersion).toString(); + .append("flowVersion", flowVersion).append("bpmnAction", bpmnAction).append("bpmnScope", bpmnScope) + .toString(); } @Override @@ -83,13 +91,14 @@ public class OrchestrationFlow implements Serializable { } OrchestrationFlow castOther = (OrchestrationFlow) other; return new EqualsBuilder().append(action, castOther.action).append(sequenceNumber, castOther.sequenceNumber) - .append(flowName, castOther.flowName).append(flowVersion, castOther.flowVersion).isEquals(); + .append(flowName, castOther.flowName).append(flowVersion, castOther.flowVersion) + .append(bpmnAction, castOther.bpmnAction).append(bpmnScope, castOther.bpmnScope).isEquals(); } @Override public int hashCode() { return new HashCodeBuilder().append(action).append(sequenceNumber).append(flowName).append(flowVersion) - .toHashCode(); + .append(bpmnAction).append(bpmnScope).toHashCode(); } public String getAction() { @@ -132,6 +141,22 @@ public class OrchestrationFlow implements Serializable { this.id = id; } + public String getBpmnAction() { + return bpmnAction; + } + + public void setBpmnAction(String bpmnAction) { + this.bpmnAction = bpmnAction; + } + + public String getBpmnScope() { + return bpmnScope; + } + + public void setBpmnScope(String bpmnScope) { + this.bpmnScope = bpmnScope; + } + @LinkedResource public NorthBoundRequest getNorthBoundRequest() { return northBoundRequest; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index a959f2f5a1..7f5907e9bf 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -27,7 +27,11 @@ import java.util.List; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import javax.persistence.EntityNotFoundException; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; +import org.apache.http.HttpStatus; +import org.onap.logging.filter.base.Constants; +import org.onap.logging.filter.spring.SpringClientPayloadFilter; import org.onap.so.db.catalog.beans.BuildingBlockDetail; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; @@ -61,19 +65,23 @@ import org.onap.so.db.catalog.beans.Workflow; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; -import org.onap.so.logger.LogConstants; -import org.onap.so.logging.jaxrs.filter.SpringClientFilter; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; import org.springframework.http.client.BufferingClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; +import com.google.common.base.Strings; import uk.co.blackpepper.bowman.Client; import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; @@ -116,37 +124,38 @@ public class CatalogDbClient { private static final String SEARCH = "/search"; private static final String URI_SEPARATOR = "/"; - private static final String SERVICE_MODEL_UUID = "serviceModelUUID"; - private static final String SERVICE_NAME = "serviceName"; - private static final String MODEL_UUID = "modelUUID"; - private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID"; - private static final String ACTION = "action"; - private static final String MODEL_NAME = "modelName"; - private static final String MODEL_VERSION = "modelVersion"; - private static final String MODEL_INVARIANT_UUID = "modelInvariantUUID"; - private static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID"; - private static final String NF_ROLE = "nfRole"; - private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID"; - private static final String VNF_COMPONENT_TYPE = "vnfComponentType"; - private static final String BUILDING_BLOCK_NAME = "buildingBlockName"; - private static final String RESOURCE_TYPE = "resourceType"; - private static final String ORCHESTRATION_STATUS = "orchestrationStatus"; - private static final String TARGET_ACTION = "targetAction"; - private static final String REQUEST_SCOPE = "requestScope"; - private static final String IS_ALACARTE = "isALaCarte"; - private static final String CLOUD_OWNER = "cloudOwner"; - private static final String FLOW_NAME = "flowName"; - private static final String ERROR_MESSAGE = "errorMessage"; - private static final String SERVICE_ROLE = "serviceRole"; - private static final String SERVICE_TYPE = "serviceType"; - private static final String VNF_TYPE = "vnfType"; - private static final String ERROR_CODE = "errorCode"; - private static final String WORK_STEP = "workStep"; - private static final String CLLI = "clli"; - private static final String CLOUD_VERSION = "cloudVersion"; - private static final String HOMING_INSTANCE = "/homingInstance"; - private static final String ARTIFACT_UUID = "artifactUUID"; - private static final String SOURCE = "source"; + protected static final String SERVICE_MODEL_UUID = "serviceModelUUID"; + protected static final String SERVICE_NAME = "serviceName"; + protected static final String MODEL_UUID = "modelUUID"; + protected static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID"; + protected static final String ACTION = "action"; + protected static final String MODEL_NAME = "modelName"; + protected static final String MODEL_VERSION = "modelVersion"; + protected static final String MODEL_INVARIANT_UUID = "modelInvariantUUID"; + protected static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID"; + protected static final String PNF_RESOURCE_MODEL_UUID = "pnfResourceModelUUID"; + protected static final String NF_ROLE = "nfRole"; + protected static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID"; + protected static final String VNF_COMPONENT_TYPE = "vnfComponentType"; + protected static final String BUILDING_BLOCK_NAME = "buildingBlockName"; + protected static final String RESOURCE_TYPE = "resourceType"; + protected static final String ORCHESTRATION_STATUS = "orchestrationStatus"; + protected static final String TARGET_ACTION = "targetAction"; + protected static final String REQUEST_SCOPE = "requestScope"; + protected static final String IS_ALACARTE = "isALaCarte"; + protected static final String CLOUD_OWNER = "cloudOwner"; + protected static final String FLOW_NAME = "flowName"; + protected static final String ERROR_MESSAGE = "errorMessage"; + protected static final String SERVICE_ROLE = "serviceRole"; + protected static final String SERVICE_TYPE = "serviceType"; + protected static final String VNF_TYPE = "vnfType"; + protected static final String ERROR_CODE = "errorCode"; + protected static final String WORK_STEP = "workStep"; + protected static final String CLLI = "clli"; + protected static final String CLOUD_VERSION = "cloudVersion"; + protected static final String HOMING_INSTANCE = "/homingInstance"; + protected static final String ARTIFACT_UUID = "artifactUUID"; + protected static final String SOURCE = "source"; private static final String TARGET_ENTITY = "SO:CatalogDB"; private static final String ASTERISK = "*"; @@ -193,6 +202,7 @@ public class CatalogDbClient { private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid"; private String findWorkflowByArtifactUUID = "/findByArtifactUUID"; private String findWorkflowByModelUUID = "/findWorkflowByModelUUID"; + private String findWorkflowByPnfModelUUID = "/findWorkflowByPnfModelUUID"; private String findWorkflowBySource = "/findBySource"; private String findVnfResourceCustomizationByModelUuid = "/findVnfResourceCustomizationByModelUuid"; @@ -330,6 +340,7 @@ public class CatalogDbClient { findWorkflowByArtifactUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByArtifactUUID; findWorkflowByModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByModelUUID; + findWorkflowByPnfModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByPnfModelUUID; findWorkflowBySource = endpoint + WORKFLOW + SEARCH + findWorkflowBySource; findVnfResourceCustomizationByModelUuid = @@ -359,12 +370,13 @@ public class CatalogDbClient { ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> { - restTemplate.getInterceptors().add((new SpringClientFilter())); + restTemplate.getInterceptors().add((new SOSpringClientFilter())); + restTemplate.getInterceptors().add((new SpringClientPayloadFilter())); restTemplate.getInterceptors().add((request, body, execution) -> { request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); - request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY); + request.getHeaders().add(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY); return execution.execute(request, body); }); }).build().buildClientFactory(); @@ -408,12 +420,13 @@ public class CatalogDbClient { ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory) .setRestTemplateConfigurer(restTemplate -> { - restTemplate.getInterceptors().add((new SpringClientFilter())); + restTemplate.getInterceptors().add((new SOSpringClientFilter())); + restTemplate.getInterceptors().add((new SpringClientPayloadFilter())); restTemplate.getInterceptors().add((request, body, execution) -> { request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth); - request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY); + request.getHeaders().add(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY); return execution.execute(request, body); }); }).build().buildClientFactory(); @@ -755,6 +768,12 @@ public class CatalogDbClient { this.postSingleResource(cloudSiteClient, cloudSite); } + public List<CloudSite> getCloudSites() { + return this.getMultipleResources(cloudSiteClient, + UriBuilder.fromUri(endpoint + CLOUD_SITE).queryParam("size", "1000").build()); + } + + public CloudSite getCloudSiteByClliAndAicVersion(String clli, String cloudVersion) { return this.getSingleResource(cloudSiteClient, getUri(UriBuilder.fromUri(findByClliAndCloudVersion) .queryParam(CLLI, clli).queryParam(CLOUD_VERSION, cloudVersion).build().toString())); @@ -801,7 +820,7 @@ public class CatalogDbClient { return client.get(uri); } - private <T> List<T> getMultipleResources(Client<T> client, URI uri) { + protected <T> List<T> getMultipleResources(Client<T> client, URI uri) { Iterable<T> iterator = client.getAll(uri); List<T> list = new ArrayList<>(); Iterator<T> it = iterator.iterator(); @@ -888,6 +907,90 @@ public class CatalogDbClient { "Unable to find CvnfcConfigurationCustomization ModelCustomizationUUID:" + cvnfcCustomizationUuid); } + public org.onap.so.rest.catalog.beans.Service getServiceModelInformation(String serviceModelUUID, String depth) { + if (Strings.isNullOrEmpty(serviceModelUUID)) { + throw new EntityNotFoundException("Service Model UUID passed as Null or Empty String"); + } + try { + HttpEntity<?> entity = getHttpEntity(); + return restTemplate.exchange( + UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID) + .queryParam("depth", depth).build().encode().toString(), + HttpMethod.GET, entity, org.onap.so.rest.catalog.beans.Service.class).getBody(); + } catch (HttpClientErrorException e) { + logger.warn("Entity Not found in DLP", e); + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + throw new EntityNotFoundException("Unable to find Service with ServiceModelUUID:" + serviceModelUUID); + } + throw e; + } + } + + public List<org.onap.so.rest.catalog.beans.Service> getServices() { + try { + HttpEntity<?> entity = getHttpEntity(); + return restTemplate + .exchange( + UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services").build() + .encode().toString(), + HttpMethod.GET, entity, + new ParameterizedTypeReference<List<org.onap.so.rest.catalog.beans.Service>>() {}) + .getBody(); + } catch (HttpClientErrorException e) { + logger.error("Error Calling catalog database", e); + throw e; + } + } + + public org.onap.so.rest.catalog.beans.Vnf getVnfModelInformation(String serviceModelUUID, + String vnfCustomizationUUID, String depth) { + if (Strings.isNullOrEmpty(serviceModelUUID)) { + throw new EntityNotFoundException("Service Model UUID passed as Null or Empty String"); + } + if (Strings.isNullOrEmpty(vnfCustomizationUUID)) { + throw new EntityNotFoundException("Vnf Customization UUID passed as Null or Empty String"); + } + try { + HttpEntity<?> entity = getHttpEntity(); + return restTemplate + .exchange( + UriComponentsBuilder + .fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID + + "/vnfs/" + vnfCustomizationUUID) + .queryParam("depth", depth).build().encode().toString(), + HttpMethod.GET, entity, org.onap.so.rest.catalog.beans.Vnf.class) + .getBody(); + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + throw new EntityNotFoundException( + "Unable to find Vnf with Vnf Customization UUID:" + vnfCustomizationUUID); + } + throw e; + } + } + + public void updateVnf(String serviceModelUUID, org.onap.so.rest.catalog.beans.Vnf vnf) { + if (vnf == null) { + throw new EntityNotFoundException("Vnf passed as null"); + } + try { + HttpHeaders headers = getHttpHeaders(); + HttpEntity<org.onap.so.rest.catalog.beans.Vnf> entity = new HttpEntity<>(vnf, headers); + + restTemplate.exchange( + UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID + + "/vnfs/" + vnf.getModelCustomizationId()).build().encode().toString(), + HttpMethod.PUT, entity, org.onap.so.rest.catalog.beans.Vnf.class).getBody(); + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + throw new EntityNotFoundException( + "Unable to find Vnf with Vnf Customization UUID:" + vnf.getModelCustomizationId()); + } + throw e; + } + } + + public Workflow findWorkflowByArtifactUUID(String artifactUUID) { return this.getSingleResource(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByArtifactUUID) .queryParam(ARTIFACT_UUID, artifactUUID).build().toString())); @@ -898,6 +1001,11 @@ public class CatalogDbClient { .queryParam(VNF_RESOURCE_MODEL_UUID, vnfResourceModelUUID).build().toString())); } + public List<Workflow> findWorkflowByPnfModelUUID(String pnfResourceModelUUID) { + return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByPnfModelUUID) + .queryParam(PNF_RESOURCE_MODEL_UUID, pnfResourceModelUUID).build().toString())); + } + public List<Workflow> findWorkflowBySource(String source) { return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowBySource).queryParam(SOURCE, source).build().toString())); @@ -910,4 +1018,18 @@ public class CatalogDbClient { public void setEndpoint(String endpoint) { this.endpoint = endpoint; } + + private HttpHeaders getHttpHeaders() { + HttpHeaders headers = new HttpHeaders(); + headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth); + headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + headers.set(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY); + return headers; + } + + private HttpEntity<?> getHttpEntity() { + HttpHeaders headers = getHttpHeaders(); + return new HttpEntity<>(headers); + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java index eaeb4292fb..42d107c1ff 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java @@ -23,9 +23,10 @@ package org.onap.so.db.catalog.data.repository; import org.onap.so.db.catalog.beans.NetworkResource; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.stereotype.Repository; -@Repository +@RepositoryRestResource(collectionResourceRel = "networkResource", path = "networkResource") public interface NetworkResourceRepository extends JpaRepository<NetworkResource, String> { /** diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java index 898911fd1c..d49d5e864d 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java @@ -25,7 +25,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "serviceRecipe", path = "serviceRecipe") -public interface ServiceRecipeRepository extends JpaRepository<ServiceRecipe, Long> { +public interface ServiceRecipeRepository extends JpaRepository<ServiceRecipe, Integer> { ServiceRecipe findByActionAndServiceModelUUID(String action, String serviceModelUUID); ServiceRecipe findByAction(String action); diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java index 8bcc60c8be..f1b399325e 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java @@ -39,10 +39,23 @@ public interface WorkflowRepository extends JpaRepository<Workflow, Integer> { * This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide Workflow based on * model UUID without projection. * - * @param vnfResourceModelUUIDmodel UUID + * @param vnfResourceModelUUID UUID * @return List of Workflow */ @Query(value = "select b.* from vnf_resource_to_workflow a join workflow b where a.WORKFLOW_ID = b.ID and a.VNF_RESOURCE_MODEL_UUID = ?1", nativeQuery = true) List<Workflow> findWorkflowByModelUUID(String vnfResourceModelUUID); + + /** + * Used to fetch the @{link Workflow} by the Pnf Model UUID. + * + * This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide Workflow based on + * pnf model UUID without projection. + * + * @param pnfResourceModelUUID UUID + * @return List of Workflow + */ + @Query(value = "select b.* from pnf_resource_to_workflow a join workflow b where a.WORKFLOW_ID = b.ID and a.PNF_RESOURCE_MODEL_UUID = ?1", + nativeQuery = true) + List<Workflow> findWorkflowByPnfModelUUID(String pnfResourceModelUUID); } diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java new file mode 100644 index 0000000000..e22f366ddf --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.rest.catalog.beans; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import org.apache.commons.lang3.builder.ToStringBuilder; + +@JsonInclude(Include.NON_DEFAULT) +public class Cvnfc { + + private String modelCustomizationId; + private String modelInstanceName; + private String modelVersionId; + private String modelInvariantId; + private String modelVersion; + private String modelName; + private String description; + private String nfcFunction; + private String nfcNamingCode; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + private Date created; + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getNfcFunction() { + return nfcFunction; + } + + public void setNfcFunction(String nfcFunction) { + this.nfcFunction = nfcFunction; + } + + public String getNfcNamingCode() { + return nfcNamingCode; + } + + public void setNfcNamingCode(String nfcNamingCode) { + this.nfcNamingCode = nfcNamingCode; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationId", modelCustomizationId) + .append("modelInstanceName", modelInstanceName).append("modelVersionId", modelVersionId) + .append("modelInvariantId", modelInvariantId).append("modelVersion", modelVersion) + .append("modelName", modelName).append("description", description).append("nfcFunction", nfcFunction) + .append("nfcNamingCode", nfcNamingCode).append("created", created).toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java index 1620058e1e..11089046fd 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java @@ -24,6 +24,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -40,6 +41,7 @@ public class Service implements Serializable { private String modelInvariantId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") private Date created; private String modelVersion; diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java index 8e18f94faf..f2a2c77aca 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java @@ -20,9 +20,11 @@ package org.onap.so.rest.catalog.beans; +import java.util.ArrayList; import java.util.Date; import java.util.List; import org.onap.so.db.catalog.beans.HeatEnvironment; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -37,6 +39,7 @@ public class VfModule { private String description; private Boolean isBase; private HeatTemplate heatTemplate; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") private Date created; private List<HeatFile> heatFile; @@ -50,9 +53,7 @@ public class VfModule { private HeatEnvironment heatEnv; private Boolean isVolumeGroup; - - // Add in cvnfcCustomization - + private List<Cvnfc> vnfc = new ArrayList<>(); public String getModelName() { @@ -191,6 +192,12 @@ public class VfModule { this.isVolumeGroup = isVolumeGroup; } + public List<Cvnfc> getVnfc() { + return vnfc; + } + public void setVnfc(List<Cvnfc> vnfc) { + this.vnfc = vnfc; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java index 40d701c3c5..febf69baf1 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java @@ -47,12 +47,14 @@ public class Vnf implements Serializable { private String nfFunction; private String nfRole; private String nfNamingCode; + private String nfType; private String multiStageDesign; private String orchestrationMode; private String cloudVersionMin; private String cloudVersionMax; private String category; private String subCategory; + private Boolean nfDataValid; private List<VfModule> vfModule = new ArrayList<>(); public List<VfModule> getVfModule() { @@ -215,4 +217,21 @@ public class Vnf implements Serializable { public void setMultiStageDesign(String multiStepDesign) { this.multiStageDesign = multiStepDesign; } + + public String getNfType() { + return nfType; + } + + public void setNfType(String nfType) { + this.nfType = nfType; + } + + public Boolean getNfDataValid() { + return nfDataValid; + } + + public void setNfDataValid(Boolean nfDataValid) { + this.nfDataValid = nfDataValid; + } + } diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index b82c17dc84..66fc0f5dc5 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -19,26 +19,33 @@ */ package org.onap.so.db.catalog.client; + import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; import java.util.ArrayList; +import java.util.List; import javax.persistence.EntityNotFoundException; -import org.junit.Before; +import javax.ws.rs.core.UriBuilder; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.Workflow; +import uk.co.blackpepper.bowman.Client; +@RunWith(MockitoJUnitRunner.class) public class CatalogDbClientTest { + @Spy private CatalogDbClient catalogDbClient; - - @Before - public void init() { - catalogDbClient = new CatalogDbClient(); - } - @Rule public ExpectedException thrown = ExpectedException.none(); @@ -171,4 +178,16 @@ public class CatalogDbClientTest { assertTrue(aCvnfc.getModelCustomizationUUID().equals("a123")); } + @Test + public final void testFindWorkflowByPnfModelUUID() throws Exception { + String pnfResourceModelUUID = "f2d1f2b2-88bb-49da-b716-36ae420ccbff"; + + doReturn(new ArrayList()).when(catalogDbClient).getMultipleResources(any(), any()); + List<Workflow> results = catalogDbClient.findWorkflowByPnfModelUUID(pnfResourceModelUUID); + verify(catalogDbClient).getMultipleResources(any(Client.class), + eq(UriBuilder.fromUri("/findWorkflowByPnfModelUUID") + .queryParam(CatalogDbClient.PNF_RESOURCE_MODEL_UUID, pnfResourceModelUUID).build())); + + } + } diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java index 612963d35b..8bf47e71d3 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java @@ -37,6 +37,7 @@ public class VnfcCustomizationRepositoryTest extends BaseTest { private VnfcCustomizationRepository vnfcCustomizationRepository; @Test + @Transactional public void findAllTest() throws Exception { List<VnfcCustomization> vnfcCustomizationList = vnfcCustomizationRepository.findAll(); Assert.assertFalse(CollectionUtils.isEmpty(vnfcCustomizationList)); diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql index 13ab018a27..e5963c183f 100644 --- a/mso-catalog-db/src/test/resources/data.sql +++ b/mso-catalog-db/src/test/resources/data.sql @@ -683,7 +683,7 @@ INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, ` INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `PROJECT_DOMAIN_NAME`, `USER_DOMAIN_NAME`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, NULL, 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33'); -INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); +INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`, `SUPPORT_FABRIC`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28', 1); INSERT INTO `controller_selection_reference` (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`) VALUES ('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut'), @@ -768,10 +768,15 @@ insert into pnf_resource_customization_to_service(service_model_uuid, resource_m insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values ('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); +insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values +('b2fd5627-55e4-4f4f-8064-9e6f443e9152','DummyPnfWorkflow','Dummy Pnf Workflow','DummyPnfWorkflow',1.0,'Dummy Pnf Workflow to test custom Pnf workflow',null,'pnf','native'); insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values ('ff2ae348-214a-11e7-93ae-92361f002671', '1'); +Insert into pnf_resource_to_workflow (`PNF_RESOURCE_MODEL_UUID`,`WORKFLOW_ID`) values +("ff2ae348-214a-11e7-93ae-92361f002680", 2); + insert into activity_spec(name, description, version) values ('testActivity1', 'Test Activity 1', 1); diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index 7cd13a3780..9037e431d4 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -120,6 +120,7 @@ CREATE TABLE `cloud_sites` ( `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, `CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `SUPPORT_FABRIC` bit(1) NOT NULL DEFAULT 1, PRIMARY KEY (`ID`), KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) @@ -735,6 +736,8 @@ CREATE TABLE `orchestration_flow_reference` ( `SEQ_NO` int(11) NOT NULL, `FLOW_NAME` varchar(200) NOT NULL, `FLOW_VERSION` double NOT NULL, + `SCOPE` varchar(200) DEFAULT NULL, + `ACTION` varchar(200) DEFAULT NULL, `NB_REQ_REF_LOOKUP_ID` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`), @@ -806,6 +809,10 @@ CREATE TABLE `service` ( `OVERALL_DISTRIBUTION_STATUS` varchar(45), `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL, `NAMING_POLICY` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL, + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, PRIMARY KEY (`MODEL_UUID`), KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`), CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE @@ -960,6 +967,7 @@ CREATE TABLE `vf_module_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL, `VNF_RESOURCE_CUSTOMIZATION_ID` int(13) DEFAULT NULL, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, PRIMARY KEY (`ID`), KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`), KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`), @@ -1109,7 +1117,9 @@ CREATE TABLE `vnf_resource_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `NF_DATA_VALID` tinyint(1) DEFAULT '0', `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL, + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), @@ -1191,6 +1201,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL, `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`), CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE @@ -1232,6 +1243,18 @@ CREATE TABLE IF NOT EXISTS `vnf_resource_to_workflow` ( CONSTRAINT `fk_vnf_resource_to_workflow__workflow1` FOREIGN KEY (`WORKFLOW_ID`) REFERENCES `workflow` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE IF NOT EXISTS `pnf_resource_to_workflow` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `WORKFLOW_ID` int(11) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `UK_pnf_resource_to_workflow` (`PNF_RESOURCE_MODEL_UUID`,`WORKFLOW_ID`), + KEY `fk_pnf_resource_to_workflow__workflow1_idx` (`WORKFLOW_ID`), + KEY `fk_pnf_resource_to_workflow__pnf_res_mod_uuid_idx` (`PNF_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_pnf_resource_to_workflow__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_pnf_resource_to_workflow__workflow1` FOREIGN KEY (`WORKFLOW_ID`) REFERENCES `workflow` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + CREATE TABLE IF NOT EXISTS `activity_spec` ( `ID` INT(11) NOT NULL AUTO_INCREMENT, `NAME` VARCHAR(200) NOT NULL, |