diff options
Diffstat (limited to 'mso-api-handlers')
6 files changed, 108 insertions, 59 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index e09dcd8d2d..cd05aa558e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -116,10 +116,11 @@ public class ActivateVnfStatusOperationalEnvironment { // Update AAI to ACTIVE if Overall success if (isOverallSuccess) { - OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(this.queryServiceModelResponse.getVnfOperationalEnvId()); + String vnfOperationalEnvironmentId = this.queryServiceModelResponse.getVnfOperationalEnvId(); + OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(vnfOperationalEnvironmentId); if (aaiOpEnv != null) { aaiOpEnv.setOperationalEnvironmentStatus("ACTIVE"); - aaiHelper.updateAaiOperationalEnvironment(operationalEnvironmentId, aaiOpEnv); + aaiHelper.updateAaiOperationalEnvironment(vnfOperationalEnvironmentId, aaiOpEnv); }else { requestDb.updateInfraFailureCompletion("Unable to update ACTIVATE status in AAI. ", this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java index 6722941f95..c0250f7315 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java @@ -240,9 +240,9 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + stubFor(put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); activateVnfStatus.execute(requestId, request); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml index 4da57a15f9..5e6b88c039 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml @@ -38,4 +38,4 @@ <logger name="wiremock.org" level="ERROR" /> -</configuration>
\ No newline at end of file +</configuration> 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 fddd7adbf4..e46996181e 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 @@ -776,61 +776,105 @@ AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS cvnfc_customization ( -`ID` INT(11) NOT NULL AUTO_INCREMENT, -`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, -`MODEL_UUID` VARCHAR(200) NOT NULL, -`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, -`MODEL_VERSION` VARCHAR(20) NOT NULL, -`MODEL_NAME` VARCHAR(200) NOT NULL, -`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, -`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, -`NFC_FUNCTION` VARCHAR(200) NULL, -`NFC_NAMING_CODE` VARCHAR(200) NULL, -`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, -`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON -DELETE CASCADE ON -UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `MODEL_UUID` VARCHAR(200) NOT NULL, + `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, + `MODEL_VERSION` VARCHAR(20) NOT NULL, + `MODEL_NAME` VARCHAR(200) NOT NULL, + `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, + `NFC_FUNCTION` VARCHAR(200) NULL, + `NFC_NAMING_CODE` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_cvnfc_customization__vf_module_customization1_idx` ( + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnfc_customization1_idx` ( + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + UNIQUE INDEX `UK_cvnfc_customization` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY ( + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY ( + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( - `ID` INT(11) NOT NULL AUTO_INCREMENT, - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, - `CONFIGURATION_TYPE` VARCHAR(200) NULL, - `CONFIGURATION_ROLE` VARCHAR(200) NULL, - `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, - `POLICY_NAME` VARCHAR(200) NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, - PRIMARY KEY (`ID`), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), - UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), - CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) - REFERENCES `configuration` (`MODEL_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1; + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL, + `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1; + +CREATE TABLE IF NOT EXISTS `pnf_resource` ( + `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT', + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) DEFAULT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `NF_TYPE` varchar(200) DEFAULT NULL, + `NF_ROLE` varchar(200) DEFAULT NULL, + `NF_FUNCTION` varchar(200) DEFAULT NULL, + `NF_NAMING_CODE` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL, + `RESOURCE_INPUT` varchar(2000) DEFAULT NULL, + `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_VERSION` varchar(20) 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 +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; USE requestdb; diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java index 34832b9917..0a74c1d7be 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java @@ -33,10 +33,12 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.openpojo.business.annotation.BusinessKey; /** @@ -50,6 +52,8 @@ import com.openpojo.business.annotation.BusinessKey; */ @Entity + +@JsonInclude(Include.NON_NULL) @Table(name = "request_processing_data") public class RequestProcessingData implements Serializable{ diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index 5958397851..9c29d968c9 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -308,7 +308,7 @@ public class RequestsDbClient { public void saveRequestProcessingData(RequestProcessingData requestProcessingData) { HttpHeaders headers = getHttpHeaders(); - URI uri = getUri(endpoint + requestProcessingDataURI); + URI uri = getUri(requestProcessingDataURI); HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers); restTemplate.postForLocation(uri, entity); } |