aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java35
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java18
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java12
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java8
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java23
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java3
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql9
11 files changed, 88 insertions, 34 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
index 61b0b11445..c3617b62c7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
@@ -20,13 +20,7 @@
package org.onap.so.db.catalog.beans;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.openpojo.business.annotation.BusinessKey;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Date;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@@ -36,6 +30,12 @@ import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.openpojo.business.annotation.BusinessKey;
import uk.co.blackpepper.bowman.annotation.RemoteResource;
/**
@@ -74,6 +74,11 @@ public class CloudIdentity {
@Column(name = "PROJECT_DOMAIN_NAME")
private String projectDomainName;
+ @JsonProperty("admin_project_domain_name ")
+ @BusinessKey
+ @Column(name = "ADMIN_PROJECT_DOMAIN_NAME", nullable = false)
+ private String adminProjectDomainName = "Default";
+
@JsonProperty("user_domain_name")
@BusinessKey
@Column(name = "USER_DOMAIN_NAME")
@@ -245,6 +250,14 @@ public class CloudIdentity {
this.projectDomainName = projectDomainName;
}
+ public String getAdminProjectDomainName() {
+ return adminProjectDomainName;
+ }
+
+ public void setAdminProjectDomainName(String adminProjectDomainName) {
+ this.adminProjectDomainName = adminProjectDomainName;
+ }
+
public String getUserDomainName() {
return userDomainName;
}
@@ -267,6 +280,7 @@ public class CloudIdentity {
cloudIdentityCopy.identityServerType = this.identityServerType;
cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType;
cloudIdentityCopy.projectDomainName = this.projectDomainName;
+ cloudIdentityCopy.adminProjectDomainName = this.adminProjectDomainName;
cloudIdentityCopy.userDomainName = this.userDomainName;
return cloudIdentityCopy;
@@ -279,7 +293,8 @@ public class CloudIdentity {
.append("projectDomain", getProjectDomainName()).append("userDomain", getUserDomainName())
.append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole())
.append("tenantMetadata", getTenantMetadata()).append("identityServerType", getIdentityServerType())
- .append("identityAuthenticationType", getIdentityAuthenticationType()).toString();
+ .append("identityAuthenticationType", getIdentityAuthenticationType())
+ .append("adminProjectDomainName", getAdminProjectDomainName()).toString();
}
@Override
@@ -299,7 +314,8 @@ public class CloudIdentity {
.append(getMemberRole(), castOther.getMemberRole())
.append(getTenantMetadata(), castOther.getTenantMetadata())
.append(getIdentityServerType(), castOther.getIdentityServerType())
- .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals();
+ .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType())
+ .append(getAdminProjectDomainName(), castOther.getAdminProjectDomainName()).isEquals();
}
@Override
@@ -307,6 +323,7 @@ public class CloudIdentity {
return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId())
.append(getMsoPass()).append(getProjectDomainName()).append(getUserDomainName())
.append(getAdminTenant()).append(getMemberRole()).append(getTenantMetadata())
- .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode();
+ .append(getIdentityServerType()).append(getIdentityAuthenticationType())
+ .append(getAdminProjectDomainName()).toHashCode();
}
}
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 8e3f47552f..64c4b62b11 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
@@ -127,7 +127,7 @@ public class CloudSite {
@JsonProperty("support_fabric")
@BusinessKey
- @Column(name = "SUPPORT_FABRIC")
+ @Column(name = "SUPPORT_FABRIC", nullable = false)
private Boolean supportFabric = true;
@Transient
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java
index 65444d0819..f35008a519 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java
@@ -55,8 +55,8 @@ public class NetworkResource implements Serializable {
@Column(name = "MODEL_UUID")
private String modelUUID;
- @Column(name = "ORCHESTRATION_MODE")
- private String orchestrationMode = null;
+ @Column(name = "ORCHESTRATION_MODE", nullable = false)
+ private String orchestrationMode = "HEAT";
@Column(name = "DESCRIPTION")
private String description = null;
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 2e4623d25d..2dea0bb752 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
@@ -82,12 +82,15 @@ public class PnfResourceCustomization implements Serializable {
@Column(name = "CDS_BLUEPRINT_VERSION")
private String blueprintVersion;
- @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
- private boolean skipPostInstConf;
+ @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION", nullable = false)
+ private boolean skipPostInstConf = true;
@Column(name = "CONTROLLER_ACTOR")
private String controllerActor;
+ @Column(name = "DEFAULT_SOFTWARE_VERSION")
+ private String defaultSoftwareVersion;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
@@ -95,7 +98,8 @@ 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).append("controllerActor", controllerActor).toString();
+ .append("blueprintVersion", blueprintVersion).append("controllerActor", controllerActor)
+ .append("defaultSoftwareVersion", defaultSoftwareVersion).toString();
}
@Override
@@ -234,4 +238,12 @@ public class PnfResourceCustomization implements Serializable {
public void setControllerActor(String controllerActor) {
this.controllerActor = controllerActor;
}
+
+ public String getDefaultSoftwareVersion() {
+ return defaultSoftwareVersion;
+ }
+
+ public void setDefaultSoftwareVersion(String defaultSoftwareVersion) {
+ this.defaultSoftwareVersion = defaultSoftwareVersion;
+ }
}
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 487b3c6ad9..3cca869663 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
@@ -159,8 +159,8 @@ public class Service implements Serializable {
@Column(name = "CDS_BLUEPRINT_VERSION")
private String blueprintVersion;
- @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
- private Boolean skipPostInstConf;
+ @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION", nullable = false)
+ private Boolean skipPostInstConf = true;
@Column(name = "CONTROLLER_ACTOR")
private String controllerActor;
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 5cacec7185..f745bb8609 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
@@ -64,14 +64,14 @@ public class VfModuleCustomization implements Serializable {
@Column(name = "LABEL")
private String label;
- @Column(name = "MIN_INSTANCES")
- private Integer minInstances;
+ @Column(name = "MIN_INSTANCES", nullable = false)
+ private Integer minInstances = 0;
@Column(name = "MAX_INSTANCES")
private Integer maxInstances;
- @Column(name = "INITIAL_COUNT")
- private Integer initialCount;
+ @Column(name = "INITIAL_COUNT", nullable = false)
+ private Integer initialCount = 0;
@Column(name = "AVAILABILITY_ZONE_COUNT")
private Integer availabilityZoneCount;
@@ -100,8 +100,8 @@ public class VfModuleCustomization implements Serializable {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "vfModuleCustomization")
private List<CvnfcCustomization> cvnfcCustomization;
- @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
- private Boolean skipPostInstConf;
+ @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION", nullable = false)
+ private Boolean skipPostInstConf = true;
@Override
public boolean equals(final Object other) {
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 54d757ad05..740e51a269 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
@@ -117,14 +117,14 @@ public class VnfResourceCustomization implements Serializable {
@Column(name = "CDS_BLUEPRINT_VERSION")
private String blueprintVersion;
- @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
- private Boolean skipPostInstConf;
+ @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION", nullable = false)
+ private Boolean skipPostInstConf = true;
@Column(name = "VNFCINSTANCEGROUP_ORDER")
private String vnfcInstanceGroupOrder;
- @Column(name = "NF_DATA_VALID")
- private Boolean nfDataValid;
+ @Column(name = "NF_DATA_VALID", nullable = false)
+ private Boolean nfDataValid = false;
@Column(name = "CONTROLLER_ACTOR")
private String 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 05e8ddc501..77dc95a309 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
@@ -65,8 +65,8 @@ public class Workflow implements Serializable {
@Column(name = "TIMEOUT_MINUTES")
private Integer timeoutMinutes;
- @Column(name = "ARTIFACT_CHECKSUM")
- private String artifactChecksum;
+ @Column(name = "ARTIFACT_CHECKSUM", nullable = false)
+ private String artifactChecksum = "RECORD";
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@Temporal(TemporalType.TIMESTAMP)
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 ef90dd6984..91cfb00911 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
@@ -47,6 +47,7 @@ import org.onap.so.db.catalog.beans.HomingInstance;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkRecipe;
+import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -98,6 +99,7 @@ public class CatalogDbClient {
private static final String RAINY_DAY_HANDLER_MACRO = "/rainy_day_handler_macro";
private static final String NORTHBOUND_REQUEST_REF_LOOKUP = "/northbound_request_ref_lookup";
private static final String NETWORK_RESOURCE_CUSTOMIZATION = "/networkResourceCustomization";
+ private static final String NETWORK_RESOURCE = "/networkResource";
private static final String COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION =
"/collectionResourceInstanceGroupCustomization";
private static final String VNFC_INSTANCE_GROUP_CUSTOMIZATION = "/vnfcInstanceGroupCustomization";
@@ -223,6 +225,7 @@ public class CatalogDbClient {
private String vnfResourceURI;
private String networkCollectionResourceCustomizationURI;
private String networkResourceCustomizationURI;
+ private String networkResourceURI;
private String collectionNetworkResourceCustomizationURI;
private String instanceGroupURI;
private String cloudifyManagerURI;
@@ -375,6 +378,7 @@ public class CatalogDbClient {
networkCollectionResourceCustomizationURI =
endpoint + NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
networkResourceCustomizationURI = endpoint + NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ networkResourceURI = endpoint + NETWORK_RESOURCE + SEARCH;
collectionNetworkResourceCustomizationURI =
endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
@@ -607,6 +611,25 @@ public class CatalogDbClient {
return networkResourceCustomization;
}
+ public NetworkResource getNetworkResourceByModelName(String networkType) {
+ if (Strings.isNullOrEmpty(networkType)) {
+ throw new EntityNotFoundException("networkType passed as Null or Empty String");
+ }
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate.exchange(
+ UriBuilder.fromUri(networkResourceURI + "/findFirstByModelNameOrderByModelVersionDesc")
+ .queryParam("modelName", networkType).build(),
+ HttpMethod.GET, entity, NetworkResource.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find NetworkResource By networkType " + networkType);
+ }
+ throw e;
+ }
+ }
+
+
public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
BuildingBlockDetail buildingBlockDetail =
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 42d107c1ff..30f3df7110 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,6 +23,7 @@ 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.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
@@ -38,7 +39,7 @@ public interface NetworkResourceRepository extends JpaRepository<NetworkResource
*/
@Query(value = "SELECT * FROM network_resource WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;",
nativeQuery = true)
- NetworkResource findFirstByModelNameOrderByModelVersionDesc(String modelName);
+ NetworkResource findFirstByModelNameOrderByModelVersionDesc(@Param("modelName") String modelName);
NetworkResource findResourceByModelUUID(String modelUUID);
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 68f272cca0..86f56ca3a5 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -650,7 +650,7 @@ CREATE TABLE `network_resource` (
`TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
`AIC_VERSION_MIN` varchar(20) NULL,
`AIC_VERSION_MAX` varchar(20) DEFAULT NULL,
- `ORCHESTRATION_MODE` varchar(20) DEFAULT 'HEAT',
+ `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT',
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`RESOURCE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL,
@@ -960,8 +960,8 @@ CREATE TABLE `vf_module_customization` (
`ID` int(13) NOT NULL AUTO_INCREMENT,
`MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
`LABEL` varchar(200) DEFAULT NULL,
- `INITIAL_COUNT` int(11) DEFAULT '0',
- `MIN_INSTANCES` int(11) DEFAULT '0',
+ `INITIAL_COUNT` int(11) NOT NULL DEFAULT '0',
+ `MIN_INSTANCES` int(11) NOT NULL DEFAULT '0',
`MAX_INSTANCES` int(11) DEFAULT NULL,
`AVAILABILITY_ZONE_COUNT` int(11) DEFAULT NULL,
`HEAT_ENVIRONMENT_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
@@ -1204,6 +1204,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
`SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
`CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
+ `DEFAULT_SOFTWARE_VERSION` varchar(4000) 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
@@ -1227,7 +1228,7 @@ CREATE TABLE IF NOT EXISTS `workflow` (
`RESOURCE_TARGET` varchar(200) NOT NULL,
`SOURCE` varchar(200) NOT NULL,
`TIMEOUT_MINUTES` int(11) DEFAULT NULL,
- `ARTIFACT_CHECKSUM` varchar(200) DEFAULT 'MANUAL RECORD',
+ `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD',
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_workflow` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`SOURCE`)