diff options
15 files changed, 63 insertions, 37 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.9__EnforceNotNullWithDefaults.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.9__EnforceNotNullWithDefaults.sql new file mode 100644 index 0000000000..068ffc447e --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.9__EnforceNotNullWithDefaults.sql @@ -0,0 +1,25 @@ +use catalogdb; + +UPDATE network_resource SET ORCHESTRATION_MODE = 'HEAT' WHERE ORCHESTRATION_MODE IS NULL; +UPDATE vf_module_customization SET INITIAL_COUNT = '0' WHERE INITIAL_COUNT IS NULL; +UPDATE vf_module_customization SET MIN_INSTANCES = '0' WHERE MIN_INSTANCES IS NULL; +UPDATE workflow SET ARTIFACT_CHECKSUM = 'RECORD' WHERE ARTIFACT_CHECKSUM IS NULL; +UPDATE identity_services SET ADMIN_PROJECT_DOMAIN_NAME = 'Default' WHERE ADMIN_PROJECT_DOMAIN_NAME IS NULL; +UPDATE vnf_resource_customization SET SKIP_POST_INSTANTIATION_CONFIGURATION = true WHERE SKIP_POST_INSTANTIATION_CONFIGURATION IS NULL; +UPDATE pnf_resource_customization SET SKIP_POST_INSTANTIATION_CONFIGURATION = true WHERE SKIP_POST_INSTANTIATION_CONFIGURATION IS NULL; +UPDATE vnf_resource_customization SET NF_DATA_VALID = 0 WHERE NF_DATA_VALID IS NULL; +UPDATE cloud_sites SET SUPPORT_FABRIC = 1 WHERE SUPPORT_FABRIC IS NULL; +UPDATE service SET SKIP_POST_INSTANTIATION_CONFIGURATION = true WHERE SKIP_POST_INSTANTIATION_CONFIGURATION IS NULL; +UPDATE vf_module_customization SET SKIP_POST_INSTANTIATION_CONFIGURATION = true WHERE SKIP_POST_INSTANTIATION_CONFIGURATION IS NULL; + +ALTER TABLE network_resource MODIFY ORCHESTRATION_MODE varchar(20) NOT NULL DEFAULT 'HEAT'; +ALTER TABLE vf_module_customization MODIFY INITIAL_COUNT int(11) NOT NULL DEFAULT '0'; +ALTER TABLE vf_module_customization MODIFY MIN_INSTANCES int(11) NOT NULL DEFAULT '0'; +ALTER TABLE workflow MODIFY ARTIFACT_CHECKSUM VARCHAR(200) NOT NULL DEFAULT 'MANUAL RECORD'; +ALTER TABLE identity_services MODIFY ADMIN_PROJECT_DOMAIN_NAME varchar(255) NOT NULL DEFAULT 'Default'; +ALTER TABLE vnf_resource_customization MODIFY SKIP_POST_INSTANTIATION_CONFIGURATION boolean NOT NULL DEFAULT true; +ALTER TABLE pnf_resource_customization MODIFY SKIP_POST_INSTANTIATION_CONFIGURATION boolean NOT NULL DEFAULT true; +ALTER TABLE vnf_resource_customization MODIFY NF_DATA_VALID tinyint(1) NOT NULL DEFAULT 0; +ALTER TABLE cloud_sites MODIFY SUPPORT_FABRIC bit(1) NOT NULL DEFAULT 1; +ALTER TABLE service MODIFY SKIP_POST_INSTANTIATION_CONFIGURATION boolean NOT NULL DEFAULT true; +ALTER TABLE vf_module_customization MODIFY SKIP_POST_INSTANTIATION_CONFIGURATION boolean NOT NULL DEFAULT true;
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json index 2dc83c8963..c99b185557 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json +++ b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json @@ -31,6 +31,7 @@ "cloudVersionMax": "cloudVersionMax", "category": "category", "subCategory": "subCategory", + "nfDataValid": false, "vfModule": [ { "modelVersionId": "modelUUID", diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql index 3357fec109..44fbbd9be6 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -648,7 +648,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, @@ -958,8 +958,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, @@ -1233,7 +1233,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`) diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index 1260461b1b..83be71e5e2 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -651,7 +651,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, @@ -961,8 +961,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, @@ -1230,7 +1230,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) NULL DEFAULT 'MANUAL RECORD', `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`ID`), UNIQUE KEY `UK_workflow` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`SOURCE`) diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json index 1f9a8be5cf..feff0f5fba 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoVfModuleExpected.json @@ -10,5 +10,5 @@ "max-instances": 3, "availability-zone-count": 5, "label": "label", - "initial-count": null + "initial-count": 0 }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql index 11f2d4b2c3..e0ec216399 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql @@ -651,7 +651,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, @@ -958,8 +958,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, @@ -1493,7 +1493,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) NULL DEFAULT 'MANUAL RECORD', `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`ID`), UNIQUE KEY `UK_workflow` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`SOURCE`) 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 63ee35cd9c..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 @@ -76,8 +76,8 @@ public class CloudIdentity { @JsonProperty("admin_project_domain_name ") @BusinessKey - @Column(name = "ADMIN_PROJECT_DOMAIN_NAME") - private String adminProjectDomainName; + @Column(name = "ADMIN_PROJECT_DOMAIN_NAME", nullable = false) + private String adminProjectDomainName = "Default"; @JsonProperty("user_domain_name") @BusinessKey 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 122a20fea9..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,8 +82,8 @@ 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; 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 1b1df2117e..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") + @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/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index 335c49ee8a..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, @@ -1228,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`) |