From d064d9be33bc3a210397adc147967ce77eb63c4f Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Sat, 27 Apr 2019 07:43:35 -0400 Subject: Correct Catalog DB beans Correct Catalog DB beans Change-Id: Ie9bb4aef606da8c87e5960c95b564fb2fc299869 Issue-ID: SO-1828 Signed-off-by: Kuleshov, Elena --- .../WorkflowSpecificationsHandler.java | 4 + .../WorkflowSpecificationsHandlerTest.java | 60 ++ .../catalogdb/ActivitySpecSequence1_Response.json | 20 + .../catalogdb/ActivitySpecSequence2_Response.json | 20 + .../catalogdb/ActivitySpecSequence3_Response.json | 20 + .../ActivitySpecUserParameters1_Response.json | 103 +++ .../ActivitySpecUserParameters2_Response.json | 103 +++ .../ActivitySpecUserParameters3_Response.json | 103 +++ .../catalogdb/UserParameters1_Response.json | 13 + .../catalogdb/UserParameters2_Response.json | 13 + .../catalogdb/UserParameters3_Response.json | 13 + .../catalogdb/UserParameters4_Response.json | 13 + .../catalogdb/UserParameters5_Response.json | 13 + .../catalogdb/UserParameters6_Response.json | 13 + .../WorkflowActivitySpecSequence_Response.json | 480 ++--------- .../WorkflowSpecificationsQuery_Response.json | 937 +++++++++++---------- .../org/onap/so/db/catalog/beans/ActivitySpec.java | 8 +- .../beans/ActivitySpecActivitySpecCategories.java | 7 +- .../ActivitySpecActivitySpecCategoriesId.java | 82 -- .../beans/ActivitySpecActivitySpecParameters.java | 12 +- .../ActivitySpecActivitySpecParametersId.java | 83 -- .../db/catalog/beans/ActivitySpecCategories.java | 16 +- .../db/catalog/beans/ActivitySpecParameters.java | 27 +- .../catalog/beans/ActivitySpecUserParameters.java | 10 +- .../beans/ActivitySpecUserParametersId.java | 84 -- .../onap/so/db/catalog/beans/UserParameters.java | 26 +- .../org/onap/so/db/catalog/beans/Workflow.java | 6 - .../beans/WorkflowActivitySpecSequence.java | 11 +- .../beans/WorkflowActivitySpecSequenceId.java | 84 -- .../data/repository/ActivitySpecRepository.java | 2 +- .../ActivitySpecUserParametersRepository.java | 30 + .../WorkflowActivitySpecSequenceRepository.java | 30 + .../data/repository/WorkflowRepository.java | 3 +- .../data/repository/WorkflowRepositoryTest.java | 2 - 34 files changed, 1109 insertions(+), 1342 deletions(-) create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence1_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence2_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence3_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters1_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters2_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters3_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters1_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters2_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters3_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters4_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters5_Response.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters6_Response.json delete mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategoriesId.java delete mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParametersId.java delete mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParametersId.java delete mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/WorkflowActivitySpecSequenceId.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecUserParametersRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowActivitySpecSequenceRepository.java diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java index c480bdfbd3..890b54758e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java @@ -50,6 +50,8 @@ import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; @@ -69,6 +71,7 @@ public class WorkflowSpecificationsHandler { @Autowired private CatalogDbClient catalogDbClient; + private static Logger logger = LoggerFactory.getLogger(WorkflowSpecificationsHandler.class); private static final String ARTIFACT_TYPE_WORKFLOW = "workflow"; @Path("/{version:[vV]1}/workflows") @@ -153,6 +156,7 @@ public class WorkflowSpecificationsHandler { if (activitySpec != null) { ActivitySequence activitySequence = new ActivitySequence(); activitySequence.setName(activitySpec.getName()); + logger.debug("Adding activity: " + activitySpec.getName()); activitySequence.setDescription(activitySpec.getDescription()); activitySequences.add(activitySequence); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java index 48abeacbc5..915018f7e4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java @@ -87,6 +87,66 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest { .withBody(getWiremockResponseForCatalogdb("WorkflowActivitySpecSequence_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching("/workflowActivitySpecSequence/1/activitySpec")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("ActivitySpecSequence1_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/workflowActivitySpecSequence/2/activitySpec")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("ActivitySpecSequence2_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/workflowActivitySpecSequence/3/activitySpec")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("ActivitySpecSequence3_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpec/1/activitySpecUserParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("ActivitySpecUserParameters1_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpec/2/activitySpecUserParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("ActivitySpecUserParameters2_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpec/3/activitySpecUserParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("ActivitySpecUserParameters3_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpecUserParameters/1/userParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("UserParameters1_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpecUserParameters/2/userParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("UserParameters2_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpecUserParameters/3/userParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("UserParameters3_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpecUserParameters/4/userParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("UserParameters4_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpecUserParameters/5/userParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("UserParameters5_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/activitySpecUserParameters/6/userParameters")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("UserParameters6_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath)) .queryParam("vnfModelVersionId", "b5fa707a-f55a-11e7-a796-005056856d52"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence1_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence1_Response.json new file mode 100644 index 0000000000..37e32631fb --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence1_Response.json @@ -0,0 +1,20 @@ +{ + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "version": null, + "created": null, + "activitySpecActivitySpecCategories": null, + "activitySpecActivitySpecParameters": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpec/1" + }, + "activitySpec": { + "href": "http://localhost:8090/activitySpec/1" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpec/1/activitySpecUserParameters" + } + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence2_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence2_Response.json new file mode 100644 index 0000000000..ee2a02ba33 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence2_Response.json @@ -0,0 +1,20 @@ +{ + "name": "VNFHealthCheckActivity", + "description": "Activity to HealthCheck VNF", + "version": null, + "created": null, + "activitySpecActivitySpecCategories": null, + "activitySpecActivitySpecParameters": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpec/2" + }, + "activitySpec": { + "href": "http://localhost:8090/activitySpec/2" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpec/2/activitySpecUserParameters" + } + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence3_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence3_Response.json new file mode 100644 index 0000000000..69390eea6b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecSequence3_Response.json @@ -0,0 +1,20 @@ +{ + "name": "FlowCompleteActivity", + "description": "Activity to Complete the BPMN Flow", + "version": null, + "created": null, + "activitySpecActivitySpecCategories": null, + "activitySpecActivitySpecParameters": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpec/3" + }, + "activitySpec": { + "href": "http://localhost:8090/activitySpec/3" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpec/3/activitySpecUserParameters" + } + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters1_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters1_Response.json new file mode 100644 index 0000000000..e88691b4d8 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters1_Response.json @@ -0,0 +1,103 @@ +{ + "_embedded": { + "activitySpecUserParameters": [ + { + "activitySpecId": 1, + "userParametersId": 1, + "activitySpec": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/1" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/1" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/1/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 2, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/2" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/2" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/2/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 3, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/3" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/3" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/3/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 4, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/4" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/4" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/4/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 5, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/5" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/5" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/5/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 6, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/6" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/6" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/6/userParameters" + } + } + } + ] + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters2_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters2_Response.json new file mode 100644 index 0000000000..e88691b4d8 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters2_Response.json @@ -0,0 +1,103 @@ +{ + "_embedded": { + "activitySpecUserParameters": [ + { + "activitySpecId": 1, + "userParametersId": 1, + "activitySpec": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/1" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/1" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/1/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 2, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/2" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/2" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/2/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 3, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/3" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/3" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/3/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 4, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/4" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/4" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/4/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 5, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/5" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/5" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/5/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 6, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/6" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/6" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/6/userParameters" + } + } + } + ] + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters3_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters3_Response.json new file mode 100644 index 0000000000..e88691b4d8 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/ActivitySpecUserParameters3_Response.json @@ -0,0 +1,103 @@ +{ + "_embedded": { + "activitySpecUserParameters": [ + { + "activitySpecId": 1, + "userParametersId": 1, + "activitySpec": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/1" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/1" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/1/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 2, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/2" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/2" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/2/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 3, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/3" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/3" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/3/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 4, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/4" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/4" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/4/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 5, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/5" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/5" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/5/userParameters" + } + } + }, + { + "activitySpecId": 1, + "userParametersId": 6, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/activitySpecUserParameters/6" + }, + "activitySpecUserParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/6" + }, + "userParameters": { + "href": "http://localhost:8090/activitySpecUserParameters/6/userParameters" + } + } + } + ] + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters1_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters1_Response.json new file mode 100644 index 0000000000..017add4cd5 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters1_Response.json @@ -0,0 +1,13 @@ +{ + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters2_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters2_Response.json new file mode 100644 index 0000000000..655d659c16 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters2_Response.json @@ -0,0 +1,13 @@ +{ + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters3_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters3_Response.json new file mode 100644 index 0000000000..13e02e7dd6 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters3_Response.json @@ -0,0 +1,13 @@ +{ + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters4_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters4_Response.json new file mode 100644 index 0000000000..e30ec0da88 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters4_Response.json @@ -0,0 +1,13 @@ +{ + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters5_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters5_Response.json new file mode 100644 index 0000000000..98b18522da --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters5_Response.json @@ -0,0 +1,13 @@ +{ + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters6_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters6_Response.json new file mode 100644 index 0000000000..4d8d03b6a7 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UserParameters6_Response.json @@ -0,0 +1,13 @@ +{ + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowActivitySpecSequence_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowActivitySpecSequence_Response.json index 3192865b52..3df17380d6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowActivitySpecSequence_Response.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowActivitySpecSequence_Response.json @@ -1,432 +1,54 @@ { "_embedded": { - - "workflowActivitySpecSequence": [ - { - "activitySpecId": null, - "workflowId": null, - "activitySpec": { - "name": "VNFQuiesceTrafficActivity", - "description": "Activity to QuiesceTraffic on VNF", - "version": null, - "created": null, - "workflowActivitySpecSequence": null, - "activitySpecActivitySpecCategories": null, - "activitySpecUserParameters": [ - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "operations_timeout", - "payloadLocation": "userParams", - "label": "Operations Timeout", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "existing_software_version", - "payloadLocation": "userParams", - "label": "Existing Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "cloudOwner", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Owner", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "tenantId", - "payloadLocation": "cloudConfiguration", - "label": "Tenant/Project ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 36, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "new_software_version", - "payloadLocation": "userParams", - "label": "New Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "lcpCloudRegionId", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Region ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - } - ], - "activitySpecActivitySpecParameters": null, - "id": null - }, - "workflow": null, - "id": null, - "_links": { - "self": { - "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" - }, - "workflowActivitySpecSequence": { - "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" - } - - } - - }, - { - "activitySpecId": null, - "workflowId": null, - "activitySpec": { - "name": "VNFHealthCheckActivity", - "description": "Activity to HealthCheck VNF", - "version": null, - "created": null, - "workflowActivitySpecSequence": null, - "activitySpecActivitySpecCategories": null, - "activitySpecUserParameters": [ - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "operations_timeout", - "payloadLocation": "userParams", - "label": "Operations Timeout", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "existing_software_version", - "payloadLocation": "userParams", - "label": "Existing Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "cloudOwner", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Owner", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "tenantId", - "payloadLocation": "cloudConfiguration", - "label": "Tenant/Project ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 36, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "new_software_version", - "payloadLocation": "userParams", - "label": "New Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "lcpCloudRegionId", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Region ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - } - ], - "activitySpecActivitySpecParameters": null, - "id": null - }, - "workflow": null, - "id": null, - "_links": { - "self": { - "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" - }, - "workflowActivitySpecSequence": { - "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" - } - - } - }, - { - "activitySpecId": null, - "workflowId": null, - "activitySpec": { - "name": "FlowCompleteActivity", - "description": "Activity to Complete the BPMN Flow", - "version": null, - "created": null, - "workflowActivitySpecSequence": null, - "activitySpecActivitySpecCategories": null, - "activitySpecUserParameters": [ - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "operations_timeout", - "payloadLocation": "userParams", - "label": "Operations Timeout", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "existing_software_version", - "payloadLocation": "userParams", - "label": "Existing Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "cloudOwner", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Owner", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "tenantId", - "payloadLocation": "cloudConfiguration", - "label": "Tenant/Project ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 36, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "new_software_version", - "payloadLocation": "userParams", - "label": "New Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "lcpCloudRegionId", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Region ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - } - ], - "activitySpecActivitySpecParameters": null, - "id": null - }, - "workflow": null, - "id": null, - "_links": { - "self": { - "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" - }, - "workflowActivitySpecSequence": { - "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" - } - - } - } - ] - -} + "workflowActivitySpecSequence": [ + { + "activitySpecId": 1, + "workflowId": 1, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/workflowActivitySpecSequence//1/workflowActivitySpecSequence" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflowActivitySpecSequence/1/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflowActivitySpecSequence/1/activitySpec" + } + } + }, + { + "activitySpecId": 2, + "workflowId": 1, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/workflowActivitySpecSequence/2/workflowActivitySpecSequence" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflowActivitySpecSequence/2/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflowActivitySpecSequence/2/activitySpec" + } + } + }, + { + "activitySpecId": 3, + "workflowId": 1, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/workflowActivitySpecSequence/3" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflowActivitySpecSequence/3/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflowActivitySpecSequence/3/activitySpec" + } + } + } + ] + } } \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json index c12365649e..cbbf0b69f6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json @@ -1,468 +1,475 @@ { "_embedded": { - "workflows" :[ - { - "artifactUUID": "ab6478e4-ea33-3346-ac12-ab121484a333", - "artifactName": "inPlaceSoftwareUpdate-1_0.bpmn", - "name": "inPlaceSoftwareUpdate", - "operationName": "inPlaceSoftwareUpdate", - "version": 1, - "description": "xyz xyz", - "body": null, - "resourceTarget": "vnf", - "source": "sdc", - "timeoutMinutes": null, - "artifactChecksum": null, - "created": null, - "vnfResourceWorkflow": null, - "workflowActivitySpecSequence": [ - { - "activitySpecId": null, - "workflowId": null, - "activitySpec": { - "name": "VNFQuiesceTrafficActivity", - "description": "Activity to QuiesceTraffic on VNF", - "version": null, - "created": null, - "workflowActivitySpecSequence": null, - "activitySpecActivitySpecCategories": null, - "activitySpecUserParameters": [ - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "operations_timeout", - "payloadLocation": "userParams", - "label": "Operations Timeout", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "existing_software_version", - "payloadLocation": "userParams", - "label": "Existing Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "cloudOwner", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Owner", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "tenantId", - "payloadLocation": "cloudConfiguration", - "label": "Tenant/Project ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 36, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "new_software_version", - "payloadLocation": "userParams", - "label": "New Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "lcpCloudRegionId", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Region ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - } - ], - "activitySpecActivitySpecParameters": null, - "id": null - }, - "workflow": null, - "id": null, - "_links": { - "self": { - "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID[?]vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" - }, - "workflowActivitySpecSequence": { - "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" - } - - } - - }, - { - "activitySpecId": null, - "workflowId": null, - "activitySpec": { - "name": "VNFHealthCheckActivity", - "description": "Activity to HealthCheck VNF", - "version": null, - "created": null, - "workflowActivitySpecSequence": null, - "activitySpecActivitySpecCategories": null, - "activitySpecUserParameters": [ - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "operations_timeout", - "payloadLocation": "userParams", - "label": "Operations Timeout", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "existing_software_version", - "payloadLocation": "userParams", - "label": "Existing Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "cloudOwner", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Owner", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "tenantId", - "payloadLocation": "cloudConfiguration", - "label": "Tenant/Project ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 36, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "new_software_version", - "payloadLocation": "userParams", - "label": "New Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "lcpCloudRegionId", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Region ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - } - ], - "activitySpecActivitySpecParameters": null, - "id": null - }, - "workflow": null, - "id": null, - "_links": { - "self": { - "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" - }, - "workflowActivitySpecSequence": { - "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" - } - - } - }, - { - "activitySpecId": null, - "workflowId": null, - "activitySpec": { - "name": "FlowCompleteActivity", - "description": "Activity to Complete the BPMN Flow", - "version": null, - "created": null, - "workflowActivitySpecSequence": null, - "activitySpecActivitySpecCategories": null, - "activitySpecUserParameters": [ - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "operations_timeout", - "payloadLocation": "userParams", - "label": "Operations Timeout", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "existing_software_version", - "payloadLocation": "userParams", - "label": "Existing Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "cloudOwner", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Owner", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "tenantId", - "payloadLocation": "cloudConfiguration", - "label": "Tenant/Project ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 36, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "new_software_version", - "payloadLocation": "userParams", - "label": "New Software Version", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 50, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - }, - { - "activitySpecId": null, - "userParametersId": null, - "activitySpec": null, - "userParameters": { - "name": "lcpCloudRegionId", - "payloadLocation": "cloudConfiguration", - "label": "Cloud Region ID", - "type": "text", - "description": null, - "isRequried": true, - "maxLength": 7, - "allowableChars": "someRegEx", - "created": null, - "activitySpecUserParameters": null, - "id": null - }, - "id": null - } - ], - "activitySpecActivitySpecParameters": null, - "id": null - }, - "workflow": null, - "id": null, - "_links": { - "self": { - "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" - }, - "workflowActivitySpecSequence": { - "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" - } - - } - } - ], - "id": null, - - "_links": { - "self": { - "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" - }, - "workflowActivitySpecSequence": { - "href": "http://localhost:8090/workflow/1/workflowActivitySpecSequence" - } - - } - - } -] -}, -"_links": { - "self": { - "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" - }, - "workflowActivitySpecSequence": { - "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" - } - - } + "workflows": [ + { + "artifactUUID": "ab6478e4-ea33-3346-ac12-ab121484a333", + "artifactName": "inPlaceSoftwareUpdate-1_0.bpmn", + "name": "inPlaceSoftwareUpdate", + "operationName": "inPlaceSoftwareUpdate", + "version": 1, + "description": "xyz xyz", + "body": null, + "resourceTarget": "vnf", + "source": "sdc", + "timeoutMinutes": null, + "artifactChecksum": null, + "created": null, + "vnfResourceWorkflow": null, + "workflowActivitySpecSequence": [ + { + "activitySpecId": null, + "workflowId": null, + "activitySpec": { + "name": "VNFQuiesceTrafficActivity", + "description": "Activity to QuiesceTraffic on VNF", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID[?]vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec" + } + } + }, + { + "activitySpecId": null, + "workflowId": null, + "activitySpec": { + "name": "VNFHealthCheckActivity", + "description": "Activity to HealthCheck VNF", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec" + } + } + }, + { + "activitySpecId": null, + "workflowId": null, + "activitySpec": { + "name": "FlowCompleteActivity", + "description": "Activity to Complete the BPMN Flow", + "version": null, + "created": null, + "workflowActivitySpecSequence": null, + "activitySpecActivitySpecCategories": null, + "activitySpecUserParameters": [ + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "operations_timeout", + "payloadLocation": "userParams", + "label": "Operations Timeout", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "existing_software_version", + "payloadLocation": "userParams", + "label": "Existing Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "cloudOwner", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Owner", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "tenantId", + "payloadLocation": "cloudConfiguration", + "label": "Tenant/Project ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 36, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "new_software_version", + "payloadLocation": "userParams", + "label": "New Software Version", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 50, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + }, + { + "activitySpecId": null, + "userParametersId": null, + "activitySpec": null, + "userParameters": { + "name": "lcpCloudRegionId", + "payloadLocation": "cloudConfiguration", + "label": "Cloud Region ID", + "type": "text", + "description": null, + "isRequried": true, + "maxLength": 7, + "allowableChars": "someRegEx", + "created": null, + "activitySpecUserParameters": null, + "id": null + }, + "id": null + } + ], + "activitySpecActivitySpecParameters": null, + "id": null + }, + "workflow": null, + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec" + } + } + } + ], + "id": null, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/1/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec" + } + } + } + ] + }, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec" + } + } } \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java index 00eff8f0c9..20c10748b6 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpec.java @@ -1,7 +1,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.Column; @@ -10,9 +9,6 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; @@ -22,12 +18,10 @@ 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 org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity -@Table(name = "ACTIVITY_SPEC") +@Table(name = "activity_spec") public class ActivitySpec implements Serializable { private static final long serialVersionUID = 6902290480087262973L; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java index 3518805b0d..64c77d27db 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategories.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,13 +28,9 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -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; @@ -43,7 +38,6 @@ import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity -@IdClass(ActivitySpecActivitySpecCategoriesId.class) @Table(name = "activity_spec_to_activity_spec_categories") public class ActivitySpecActivitySpecCategories implements Serializable { @@ -121,6 +115,7 @@ public class ActivitySpecActivitySpecCategories implements Serializable { this.activitySpec = activitySpec; } + @LinkedResource public ActivitySpecCategories getActivitySpecCategories() { return activitySpecCategories; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategoriesId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategoriesId.java deleted file mode 100644 index e3dcd359ec..0000000000 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecCategoriesId.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.db.catalog.beans; - -import java.io.Serializable; -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; - -public class ActivitySpecActivitySpecCategoriesId implements Serializable { - - private static final long serialVersionUID = 1563771827209840959L; - private Integer ID; - @BusinessKey - private Integer activitySpecId; - @BusinessKey - private Integer activitySpecCategoriesId; - - public Integer getID() { - return ID; - } - - public void setID(Integer iD) { - ID = iD; - } - - public Integer getActivitySpecCategoriesId() { - return activitySpecCategoriesId; - } - - public void setActivitySpecCategoriesId(Integer activitySpecCategoriesId) { - this.activitySpecCategoriesId = activitySpecCategoriesId; - } - - public Integer getActivitySpecId() { - return activitySpecId; - } - - public void setActivitySpecId(Integer activitySpecId) { - this.activitySpecId = activitySpecId; - } - - @Override - public String toString() { - return new ToStringBuilder(this).append("activitySpecId", activitySpecId) - .append("activitySpecCategoriesId", activitySpecCategoriesId).toString(); - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof ActivitySpecActivitySpecCategoriesId)) { - return false; - } - ActivitySpecActivitySpecCategoriesId castOther = (ActivitySpecActivitySpecCategoriesId) other; - return new EqualsBuilder().append(activitySpecId, castOther.activitySpecId) - .append(activitySpecCategoriesId, castOther.activitySpecCategoriesId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(activitySpecId).append(activitySpecCategoriesId).toHashCode(); - } -} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java index f0c9bd99ce..f3e6a09b7f 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParameters.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,13 +28,9 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -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; @@ -43,7 +38,6 @@ import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity -@IdClass(ActivitySpecActivitySpecParametersId.class) @Table(name = "activity_spec_to_activity_spec_parameters") public class ActivitySpecActivitySpecParameters implements Serializable { @@ -55,12 +49,10 @@ public class ActivitySpecActivitySpecParameters implements Serializable { private Integer ID; @BusinessKey - @Id @Column(name = "ACTIVITY_SPEC_ID") private Integer activitySpecId; @BusinessKey - @Id @Column(name = "ACTIVITY_SPEC_PARAMETERS_ID") private Integer activitySpecParametersId; @@ -75,7 +67,7 @@ public class ActivitySpecActivitySpecParameters implements Serializable { @Override public String toString() { return new ToStringBuilder(this).append("activitySpecId", activitySpecId) - .append("activitySpecCategoriesId", activitySpecParametersId).toString(); + .append("activitySpecParametersId", activitySpecParametersId).toString(); } @Override @@ -113,6 +105,7 @@ public class ActivitySpecActivitySpecParameters implements Serializable { this.activitySpecParametersId = activitySpecParametersId; } + @LinkedResource public ActivitySpec getActivitySpec() { return activitySpec; } @@ -121,6 +114,7 @@ public class ActivitySpecActivitySpecParameters implements Serializable { this.activitySpec = activitySpec; } + @LinkedResource public ActivitySpecParameters getActivitySpecParameters() { return activitySpecParameters; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParametersId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParametersId.java deleted file mode 100644 index 8f4cc6d966..0000000000 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecActivitySpecParametersId.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.db.catalog.beans; - -import java.io.Serializable; -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; - -public class ActivitySpecActivitySpecParametersId implements Serializable { - - private static final long serialVersionUID = 1563771827209840959L; - - private Integer ID; - @BusinessKey - private Integer activitySpecId; - @BusinessKey - private Integer activitySpecParametersId; - - public Integer getID() { - return ID; - } - - public void setID(Integer iD) { - ID = iD; - } - - public Integer getActivitySpecParametersId() { - return activitySpecParametersId; - } - - public void setActivitySpecParametersId(Integer activitySpecParametersId) { - this.activitySpecParametersId = activitySpecParametersId; - } - - public Integer getActivitySpecId() { - return activitySpecId; - } - - public void setActivitySpecId(Integer activitySpecId) { - this.activitySpecId = activitySpecId; - } - - @Override - public String toString() { - return new ToStringBuilder(this).append("activitySpecId", activitySpecId) - .append("activitySpecCategoriesId", activitySpecParametersId).toString(); - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof ActivitySpecActivitySpecParametersId)) { - return false; - } - ActivitySpecActivitySpecParametersId castOther = (ActivitySpecActivitySpecParametersId) other; - return new EqualsBuilder().append(activitySpecId, castOther.activitySpecId) - .append(activitySpecParametersId, castOther.activitySpecParametersId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(activitySpecId).append(activitySpecParametersId).toHashCode(); - } -} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java index a42a73aac9..e7ace2cda5 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java @@ -41,9 +41,6 @@ public class ActivitySpecCategories implements Serializable { @Column(name = "NAME") private String name; - @OneToMany(fetch = FetchType.LAZY, mappedBy = "activitySpecCategories") - private List activitySpecActivitySpecCategories; - public Integer getID() { return ID; } @@ -56,20 +53,9 @@ public class ActivitySpecCategories implements Serializable { this.name = name; } - @LinkedResource - public List getActivitySpecActivitySpecCategories() { - return activitySpecActivitySpecCategories; - } - - public void setActivitySpecActivitySpecCategories( - List activitySpecActivitySpecCategories) { - this.activitySpecActivitySpecCategories = activitySpecActivitySpecCategories; - } - @Override public String toString() { - return new ToStringBuilder(this).append("name", name) - .append("activitySpecActivitySpecCategories", activitySpecActivitySpecCategories).toString(); + return new ToStringBuilder(this).append("name", name).toString(); } @Override diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java index 49e0f3fa79..5173f27a15 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java @@ -1,20 +1,12 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; import java.util.Date; -import java.util.List; 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.IdClass; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; @@ -23,9 +15,6 @@ 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 org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; -import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @Table(name = "ACTIVITY_SPEC_PARAMETERS") @@ -56,28 +45,14 @@ public class ActivitySpecParameters implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date created; - @OneToMany(fetch = FetchType.LAZY, mappedBy = "activitySpecParameters") - private List activitySpecActivitySpecParameters; - @PrePersist protected void onCreate() { this.created = new Date(); } - @LinkedResource - public List getActivitySpecActivitySpecParameters() { - return activitySpecActivitySpecParameters; - } - - public void setActivitySpecActivitySpecParameters( - List activitySpecActivitySpecParameters) { - this.activitySpecActivitySpecParameters = activitySpecActivitySpecParameters; - } - @Override public String toString() { - return new ToStringBuilder(this).append("name", name).append("direction", direction) - .append("activitySpecActivitySpecParameters", activitySpecActivitySpecParameters).toString(); + return new ToStringBuilder(this).append("name", name).append("direction", direction).toString(); } @Override diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java index be32da379e..d23c782a1a 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParameters.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,13 +28,9 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -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; @@ -43,7 +38,6 @@ import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity -@IdClass(ActivitySpecUserParametersId.class) @Table(name = "activity_spec_to_user_parameters") public class ActivitySpecUserParameters implements Serializable { @@ -55,12 +49,10 @@ public class ActivitySpecUserParameters implements Serializable { private Integer ID; @BusinessKey - @Id @Column(name = "ACTIVITY_SPEC_ID") private Integer activitySpecId; @BusinessKey - @Id @Column(name = "USER_PARAMETERS_ID") private Integer userParametersId; @@ -113,6 +105,7 @@ public class ActivitySpecUserParameters implements Serializable { this.userParametersId = userParametersId; } + @LinkedResource public ActivitySpec getActivitySpec() { return activitySpec; } @@ -121,6 +114,7 @@ public class ActivitySpecUserParameters implements Serializable { this.activitySpec = activitySpec; } + @LinkedResource public UserParameters getUserParameters() { return userParameters; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParametersId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParametersId.java deleted file mode 100644 index fd55d6e961..0000000000 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecUserParametersId.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.db.catalog.beans; - -import java.io.Serializable; -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; - -public class ActivitySpecUserParametersId implements Serializable { - - private static final long serialVersionUID = 1563771827209840959L; - - private Integer ID; - @BusinessKey - private Integer activitySpecId; - @BusinessKey - private Integer userParametersId; - - public Integer getID() { - return ID; - } - - public void setID(Integer iD) { - ID = iD; - } - - public Integer getUserParametersId() { - return userParametersId; - } - - public void setUserParametersId(Integer userParametersId) { - this.userParametersId = userParametersId; - } - - public Integer getActivitySpecId() { - return activitySpecId; - } - - public void setActivitySpecId(Integer activitySpecId) { - this.activitySpecId = activitySpecId; - } - - @Override - public String toString() { - return new ToStringBuilder(this).append("activitySpecId", activitySpecId) - .append("userParametersId", userParametersId).toString(); - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof ActivitySpecUserParametersId)) { - return false; - } - ActivitySpecUserParametersId castOther = (ActivitySpecUserParametersId) other; - return new EqualsBuilder().append(activitySpecId, castOther.activitySpecId) - .append(userParametersId, castOther.userParametersId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(activitySpecId).append(userParametersId).toHashCode(); - } - -} 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 a20647d5c1..c2cf2d7cf6 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 @@ -1,19 +1,12 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; import java.util.Date; -import java.util.List; 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.Lob; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; @@ -22,9 +15,6 @@ 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 org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; -import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @Table(name = "USER_PARAMETERS") @@ -66,10 +56,6 @@ public class UserParameters implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date created; - - @OneToMany(fetch = FetchType.LAZY, mappedBy = "userParameters") - private List activitySpecUserParameters; - @PrePersist protected void onCreate() { this.created = new Date(); @@ -87,19 +73,9 @@ public class UserParameters implements Serializable { this.name = name; } - @LinkedResource - public List getActivitySpecUserParameters() { - return activitySpecUserParameters; - } - - public void setActivitySpecUserParameters(List activitySpecUserParameters) { - this.activitySpecUserParameters = activitySpecUserParameters; - } - @Override public String toString() { - return new ToStringBuilder(this).append("name", name) - .append("ActivitySpecUserParameters", activitySpecUserParameters).toString(); + return new ToStringBuilder(this).append("name", name).toString(); } public String getPayloadLocation() { 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 1f46bc01f7..d1e60a0f76 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 @@ -1,7 +1,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.Column; @@ -10,9 +9,7 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; import javax.persistence.Lob; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; @@ -21,9 +18,6 @@ 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 com.openpojo.business.annotation.BusinessKey; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/WorkflowActivitySpecSequence.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/WorkflowActivitySpecSequence.java index 4b497cc7da..f25be45bb2 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/WorkflowActivitySpecSequence.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/WorkflowActivitySpecSequence.java @@ -21,7 +21,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,21 +28,17 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -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 com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; + @Entity -@IdClass(WorkflowActivitySpecSequenceId.class) @Table(name = "workflow_activity_spec_sequence") public class WorkflowActivitySpecSequence implements Serializable { @@ -55,12 +50,10 @@ public class WorkflowActivitySpecSequence implements Serializable { private Integer ID; @BusinessKey - @Id @Column(name = "ACTIVITY_SPEC_ID") private Integer activitySpecId; @BusinessKey - @Id @Column(name = "WORKFLOW_ID") private Integer workflowId; @@ -113,6 +106,7 @@ public class WorkflowActivitySpecSequence implements Serializable { this.workflowId = workflowId; } + @LinkedResource public ActivitySpec getActivitySpec() { return activitySpec; } @@ -121,6 +115,7 @@ public class WorkflowActivitySpecSequence implements Serializable { this.activitySpec = activitySpec; } + @LinkedResource public Workflow getWorkflow() { return workflow; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/WorkflowActivitySpecSequenceId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/WorkflowActivitySpecSequenceId.java deleted file mode 100644 index 41af2ed3a5..0000000000 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/WorkflowActivitySpecSequenceId.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.db.catalog.beans; - -import java.io.Serializable; -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; - -public class WorkflowActivitySpecSequenceId implements Serializable { - - private static final long serialVersionUID = -8987314754011453123L; - - private Integer ID; - - @BusinessKey - private Integer workflowId; - @BusinessKey - private Integer activitySpecId; - - public Integer getID() { - return ID; - } - - public void setID(Integer ID) { - this.ID = ID; - } - - public Integer getWorkflowId() { - return workflowId; - } - - public void setWorkflowId(Integer workflowId) { - this.workflowId = workflowId; - } - - public Integer getActivitySpecId() { - return activitySpecId; - } - - public void setActivitySpecId(Integer activitySpecId) { - this.activitySpecId = activitySpecId; - } - - @Override - public String toString() { - return new ToStringBuilder(this).append("workflowId", workflowId).append("activitySpecId", activitySpecId) - .toString(); - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof WorkflowActivitySpecSequenceId)) { - return false; - } - WorkflowActivitySpecSequenceId castOther = (WorkflowActivitySpecSequenceId) other; - return new EqualsBuilder().append(workflowId, castOther.workflowId) - .append(activitySpecId, castOther.activitySpecId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(workflowId).append(activitySpecId).toHashCode(); - } -} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java index aa474238fd..f86ae14f93 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecRepository.java @@ -25,7 +25,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "activitySpec", path = "activitySpec") -public interface ActivitySpecRepository extends JpaRepository { +public interface ActivitySpecRepository extends JpaRepository { ActivitySpec findByName(String name); diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecUserParametersRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecUserParametersRepository.java new file mode 100644 index 0000000000..5e4340e392 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ActivitySpecUserParametersRepository.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ActivitySpecUserParameters; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "activitySpecUserParameters", path = "activitySpecUserParameters") +public interface ActivitySpecUserParametersRepository extends JpaRepository { + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowActivitySpecSequenceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowActivitySpecSequenceRepository.java new file mode 100644 index 0000000000..0dfbbb9ead --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowActivitySpecSequenceRepository.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "workflowActivitySpecSequence", path = "workflowActivitySpecSequence") +public interface WorkflowActivitySpecSequenceRepository extends JpaRepository { + +} 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 fb5f202cbc..89df52182c 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 @@ -24,11 +24,10 @@ import java.util.List; import org.onap.so.db.catalog.beans.Workflow; 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; @RepositoryRestResource(collectionResourceRel = "workflow", path = "workflow") -public interface WorkflowRepository extends JpaRepository { +public interface WorkflowRepository extends JpaRepository { Workflow findByArtifactUUID(String artifactUUID); diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java index 4f31e4b38c..547b8e50a4 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java @@ -15,8 +15,6 @@ package org.onap.so.db.catalog.data.repository; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.util.List; import org.junit.Assert; import org.junit.Test; -- cgit 1.2.3-korg From 6c009875e53796b0b79a7bd8010590651d2af028 Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Tue, 30 Apr 2019 01:20:09 -0700 Subject: build sndc and user directives in groovy Fill out the sdnc_directives and user_directives used by the multicloud vnf plugin adapter when invoked via the groovy path. Change-Id: Ia11680be682b38756f188c71e3e000bc21c15aa9 Issue-ID: SO-1822 Signed-off-by: Eric Multanen --- .../so/openstack/utils/MsoMulticloudUtils.java | 2 +- .../so/bpmn/common/scripts/VfModuleBase.groovy | 2300 ++++++++++---------- .../infrastructure/scripts/DoCreateVfModule.groovy | 4 +- .../scripts/DoCreateVfModuleTest.groovy | 17 +- .../__files/DoCreateVfModule/createVnfARequest.xml | 22 +- 5 files changed, 1228 insertions(+), 1117 deletions(-) diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index 4b68ddb674..8c570e25d7 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -158,7 +158,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { sdncDirectives = (String) stackInputs.get(key); } if (key == USER_DIRECTIVES) { - sdncDirectives = (String) stackInputs.get(key); + userDirectives = (String) stackInputs.get(key); } if (key == TEMPLATE_TYPE) { templateType = (String) stackInputs.get(key); diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index c4ef165f63..07d8ec9b8e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -9,9 +9,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. @@ -40,839 +40,924 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { private static final Logger logger = LoggerFactory.getLogger( VfModuleBase.class); - protected XmlParser xmlParser = new XmlParser() - - /** - * Get the XmlParser. - * - * @return the XmlParser. - */ - protected XmlParser getXmlParser() { - return xmlParser - } - - /** - * Find the VF Module with specified ID in the specified Generic VF. If no such - * VF Module is found, null is returned. - * - * @param genericVnf The Generic VNF in which to search for the specified VF Moduel. - * @param vfModuleId The ID of the VF Module for which to search. - * @return a VFModule object for the found VF Module or null if no VF Module is found. - */ - protected VfModule findVfModule(String genericVnf, String vfModuleId) { - - def genericVnfNode = xmlParser.parseText(genericVnf) - def vfModulesNode = utils.getChildNode(genericVnfNode, 'vf-modules') - if (vfModulesNode == null) { - return null - } - def vfModuleList = utils.getIdenticalChildren(vfModulesNode, 'vf-module') - for (vfModuleNode in vfModuleList) { - def vfModuleIdNode = utils.getChildNode(vfModuleNode, 'vf-module-id') - if ((vfModuleIdNode != null) && (vfModuleIdNode.text().equals(vfModuleId))) { - return new VfModule(vfModuleNode, (vfModuleList.size() == 1)) - } - } - return null - } - - /** - * Transform all '*_network' parameter specifications from the incoming '*-params' root - * element to a corresponding list of 'vnf-networks' specifications (typically used when - * invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends - * with '_network' is used to create an 'vnf-networks' element. - * - * @param paramsNode A Node representing a '*-params' element. - * @return a String of 'vnf-networks' elements, one for each 'param' element whose name - * attribute ends with '_network'. - */ - protected String transformNetworkParamsToVnfNetworks(String paramsRootXml) { - if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { - return '' - } - def String vnfNetworks = '' - try { - paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) - def paramsNode = xmlParser.parseText(paramsRootXml) - def params = utils.getIdenticalChildren(paramsNode, 'param') - for (param in params) { - def String attrName = (String) param.attribute('name') - if (attrName.endsWith('_network')) { - def networkRole = attrName.substring(0, (attrName.length()-'_network'.length())) - def networkName = param.text() - String vnfNetwork = """ + protected XmlParser xmlParser = new XmlParser() + + /** + * Get the XmlParser. + * + * @return the XmlParser. + */ + protected XmlParser getXmlParser() { + return xmlParser + } + + /** + * Find the VF Module with specified ID in the specified Generic VF. If no such + * VF Module is found, null is returned. + * + * @param genericVnf The Generic VNF in which to search for the specified VF Moduel. + * @param vfModuleId The ID of the VF Module for which to search. + * @return a VFModule object for the found VF Module or null if no VF Module is found. + */ + protected VfModule findVfModule(String genericVnf, String vfModuleId) { + + def genericVnfNode = xmlParser.parseText(genericVnf) + def vfModulesNode = utils.getChildNode(genericVnfNode, 'vf-modules') + if (vfModulesNode == null) { + return null + } + def vfModuleList = utils.getIdenticalChildren(vfModulesNode, 'vf-module') + for (vfModuleNode in vfModuleList) { + def vfModuleIdNode = utils.getChildNode(vfModuleNode, 'vf-module-id') + if ((vfModuleIdNode != null) && (vfModuleIdNode.text().equals(vfModuleId))) { + return new VfModule(vfModuleNode, (vfModuleList.size() == 1)) + } + } + return null + } + + /** + * Transform all '*_network' parameter specifications from the incoming '*-params' root + * element to a corresponding list of 'vnf-networks' specifications (typically used when + * invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends + * with '_network' is used to create an 'vnf-networks' element. + * + * @param paramsNode A Node representing a '*-params' element. + * @return a String of 'vnf-networks' elements, one for each 'param' element whose name + * attribute ends with '_network'. + */ + protected String transformNetworkParamsToVnfNetworks(String paramsRootXml) { + if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { + return '' + } + def String vnfNetworks = '' + try { + paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) + def paramsNode = xmlParser.parseText(paramsRootXml) + def params = utils.getIdenticalChildren(paramsNode, 'param') + for (param in params) { + def String attrName = (String) param.attribute('name') + if (attrName.endsWith('_network')) { + def networkRole = attrName.substring(0, (attrName.length()-'_network'.length())) + def networkName = param.text() + String vnfNetwork = """ ${MsoUtils.xmlEscape(networkRole)} ${MsoUtils.xmlEscape(networkName)} """ - vnfNetworks = vnfNetworks + vnfNetwork - } - } - } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), - 'Exception transforming network params to vnfNetworks', "BPMN", - ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e); - } - return vnfNetworks - } - - /** - * Transform the parameter specifications from the incoming '*-params' root element to - * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). - * Each element in '*-params' is used to create an 'entry' element. - * - * @param paramsNode A Node representing a '*-params' element. - * @return a String of 'entry' elements, one for each 'param' element. - */ - protected String transformParamsToEntries(String paramsRootXml) { - if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { - return '' - } - def String entries = '' - try { - paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) - def paramsNode = xmlParser.parseText(paramsRootXml) - def params = utils.getIdenticalChildren(paramsNode, 'param') - for (param in params) { - def key = (String) param.attribute('name') - if (key == null) { - key = '' - } - def value = (String) param.text() - String entry = """ + vnfNetworks = vnfNetworks + vnfNetwork + } + } + } catch (Exception e) { + logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + 'Exception transforming network params to vnfNetworks', "BPMN", + ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e); + } + return vnfNetworks + } + + /** + * Transform the parameter specifications from the incoming '*-params' root element to + * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). + * Each element in '*-params' is used to create an 'entry' element. + * + * @param paramsNode A Node representing a '*-params' element. + * @return a String of 'entry' elements, one for each 'param' element. + */ + protected String transformParamsToEntries(String paramsRootXml) { + if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { + return '' + } + def String entries = '' + try { + paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) + def paramsNode = xmlParser.parseText(paramsRootXml) + def params = utils.getIdenticalChildren(paramsNode, 'param') + for (param in params) { + def key = (String) param.attribute('name') + if (key == null) { + key = '' + } + def value = (String) param.text() + String entry = """ ${MsoUtils.xmlEscape(key)} ${MsoUtils.xmlEscape(value)} """ - entries = entries + entry - } - } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), - 'Exception transforming params to entries', "BPMN", - ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); - } - return entries - } - - /** - * Transform the parameter specifications from the incoming '*-params' root element to - * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). - * Each element in '*-params' is used to create an 'entry' element. - * - * @param paramsNode A Node representing a '*-params' element. - * @return a String of 'entry' elements, one for each 'param' element. - */ - protected String transformVolumeParamsToEntries(String paramsRootXml) { - if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { - return '' - } - def String entries = '' - try { - paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) - def paramsNode = xmlParser.parseText(paramsRootXml) - def params = utils.getIdenticalChildren(paramsNode, 'param') - for (param in params) { - def key = (String) param.attribute('name') - if (key == null) { - key = '' - } - if ( !(key in ['vnf_id', 'vnf_name', 'vf_module_id', 'vf_module_name'])) { - def value = (String) param.text() - String entry = """ + entries = entries + entry + } + } catch (Exception e) { + logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + 'Exception transforming params to entries', "BPMN", + ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); + } + return entries + } + + /** + * Transform the parameter specifications from the incoming '*-params' root element to + * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater). + * Each element in '*-params' is used to create an 'entry' element. + * + * @param paramsNode A Node representing a '*-params' element. + * @return a String of 'entry' elements, one for each 'param' element. + */ + protected String transformVolumeParamsToEntries(String paramsRootXml) { + if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) { + return '' + } + def String entries = '' + try { + paramsRootXml = utils.removeXmlNamespaces(paramsRootXml) + def paramsNode = xmlParser.parseText(paramsRootXml) + def params = utils.getIdenticalChildren(paramsNode, 'param') + for (param in params) { + def key = (String) param.attribute('name') + if (key == null) { + key = '' + } + if ( !(key in [ + 'vnf_id', + 'vnf_name', + 'vf_module_id', + 'vf_module_name' + ])) { + def value = (String) param.text() + String entry = """ ${MsoUtils.xmlEscape(key)} ${MsoUtils.xmlEscape(value)} """ - entries = entries + entry - } - } - } catch (Exception e) { - logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), - 'Exception transforming params to entries', "BPMN", - ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); - } - return entries - } - - /* - * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response - * and puts them into the format expected by VNF adapter. - * @param vnfParamsMap - map of VNF parameters passed in the request body - * @param sdncGetResponse - response string from SDNC GET topology request - * @param vnfId - * @param vnfName - * @param vfModuleId - * @param vfModuleName - * @param vfModuleIndex - can be null - * @return a String of key/value entries for vfModuleParams - */ - - - protected String buildVfModuleParams(Map vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName, - String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { - - //Get SDNC Response Data - - String data = utils.getNodeXml(sdncGetResponse, "response-data") - - String serviceData = utils.getNodeXml(data, "service-data") - serviceData = utils.removeXmlPreamble(serviceData) - serviceData = utils.removeXmlNamespaces(serviceData) - String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information") - String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id") - oldVnfId = utils.removeXmlPreamble(oldVnfId) - oldVnfId = utils.removeXmlNamespaces(oldVnfId) - serviceData = serviceData.replace(oldVnfId, "") - def vnfId1 = utils.getNodeText(serviceData, "vnf-id") - - Map paramsMap = new HashMap() - - if (vfModuleIndex != null) { - paramsMap.put("vf_module_index", "${vfModuleIndex}") - } - - // Add-on data - paramsMap.put("vnf_id", "${vnfId}") - paramsMap.put("vnf_name", "${vnfName}") - paramsMap.put("vf_module_id", "${vfModuleId}") - paramsMap.put("vf_module_name", "${vfModuleName}") - paramsMap.put("environment_context", "${environmentContext}") - paramsMap.put("workload_context", "${workloadContext}") - - InputSource source = new InputSource(new StringReader(data)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document responseXml = docBuilder.parse(source) - - - // Availability Zones Data - - NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") - String aZonePosition = "0" - for (int z = 0; z < aZonesList.getLength(); z++) { - Node node = aZonesList.item(z) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String aZoneValue = utils.getElementText(eElement, "availability-zone") - aZonePosition = z.toString() - paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") - } - } - - // Map of network-roles and network-tags from vm-networks - - NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") - Map networkRoleMap = new HashMap() - for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ - Node nodeNetworkKey = vmNetworksListGlobal.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String networkRole = utils.getElementText(eElementNetworkKey, "network-role") - String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkRoleValue.isEmpty()) { - networkRoleValue = networkRole - } - networkRoleMap.put(networkRole, networkRoleValue) - } - } - - // VNF Networks Data - - StringBuilder sbNet = new StringBuilder() - - NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") - for (int x = 0; x < vnfNetworkList.getLength(); x++) { - Node node = vnfNetworkList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") - String networkRole = utils.getElementText(eElement, "network-role") - if (vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRoleMap.get(networkRole) - if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRole - } - } - String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") - String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") - String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") - String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") - String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") - paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") - paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") - paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") - paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") - paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") - - NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") - StringBuffer sriovFilterBuf = new StringBuffer() - String values = "" - for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ - Node node1 = sriovVlanFilterList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - String value = utils.getElementText(eElement1, "sriov-vlan-filter") - if (i != sriovVlanFilterList.getLength() - 1) { - values = sriovFilterBuf.append(value + ",") - } - else { - values = sriovFilterBuf.append(value); - } - } - } - if (!values.isEmpty()) { - paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") - } - } - } - - // VNF-VMS Data - - def key - def value - def networkKey - def networkValue - def floatingIPKey - def floatingIPKeyValue - def floatingIPV6Key - def floatingIPV6KeyValue - StringBuilder sb = new StringBuilder() - - NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") - for (int x = 0; x < vmsList.getLength(); x++) { - Node node = vmsList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - key = utils.getElementText(eElement, "vm-type") - String values - String position = "0" - StringBuilder sb1 = new StringBuilder() - NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") - NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") - for(int i = 0; i < valueList.getLength(); i++){ - Node node1 = valueList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - value = utils.getElementText(eElement1, "vm-name") - if (i != valueList.getLength() - 1) { - values = sb1.append(value + ",") - } - else { - values = sb1.append(value); - } - position = i.toString() - paramsMap.put("${key}_name_${position}", "${value}") - } - } - for(int n = 0; n < vmNetworksList.getLength(); n++){ - String floatingIpKeyValueStr = "" - String floatingIpV6KeyValueStr = "" - Node nodeNetworkKey = vmNetworksList.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String ipAddressValues - String ipV6AddressValues - String networkPosition = "0" - StringBuilder sb2 = new StringBuilder() - StringBuilder sb3 = new StringBuilder() - StringBuilder sb4 = new StringBuilder() - networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkKey.isEmpty()) { - networkKey = utils.getElementText(eElementNetworkKey, "network-role") - } - floatingIPKey = key + '_' + networkKey + '_floating_ip' - floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") - if(!floatingIPKeyValue.isEmpty()){ - paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") - } - floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' - floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") - if(!floatingIPV6KeyValue.isEmpty()){ - paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") - } - NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") - for(int a = 0; a < networkIpsList.getLength(); a++){ - Node ipAddress = networkIpsList.item(a) - if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpAddress = (Element) ipAddress - String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") - if (a != networkIpsList.getLength() - 1) { - ipAddressValues = sb2.append(ipAddressValue + ",") - } - else { - ipAddressValues = sb2.append(ipAddressValue); - } - networkPosition = a.toString() - paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") - } - } - - paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") - - NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") - String interfaceRoutePrefixValues = sb3.append("[") - - for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ - Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) - if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { - Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix - String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") - if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { - interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") - } - if (a != interfaceRoutePrefixesList.getLength() - 1) { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") - } - else { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") - } - } - } - interfaceRoutePrefixValues = sb3.append("]") - if (interfaceRoutePrefixesList.getLength() > 0) { - paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") - } - - NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") - for(int a = 0; a < networkIpsV6List.getLength(); a++){ - Node ipV6Address = networkIpsV6List.item(a) - if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpV6Address = (Element) ipV6Address - String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") - if (a != networkIpsV6List.getLength() - 1) { - ipV6AddressValues = sb4.append(ipV6AddressValue + ",") - } - else { - ipV6AddressValues = sb4.append(ipV6AddressValue); - } - networkPosition = a.toString() - paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") - } - } - paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") - } - } - paramsMap.put("${key}_names", "${values}") - } - } - //SDNC Response Params - String sdncResponseParams = "" - List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] - String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") - if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - // No SDNC params - }else{ - NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") - if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { - String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") - paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") - } - } - } - - // Parameters received from the request should overwrite any parameters received from SDNC - if (vnfParamsMap != null) { - for (Map.Entry entry : vnfParamsMap.entrySet()) { - String vnfKey = entry.getKey() - String vnfValue = entry.getValue() - paramsMap.put("$vnfKey", "$vnfValue") - } - } - - StringBuilder sbParams = new StringBuilder() - def vfModuleParams = "" - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ + entries = entries + entry + } + } + } catch (Exception e) { + logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), + 'Exception transforming params to entries', "BPMN", + ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e); + } + return entries + } + + /* + * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param sdncGetResponse - response string from SDNC GET topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @param vfModuleIndex - can be null + * @return a String of key/value entries for vfModuleParams + */ + + + protected String buildVfModuleParams(Map vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { + + //Get SDNC Response Data + + String data = utils.getNodeXml(sdncGetResponse, "response-data") + + String serviceData = utils.getNodeXml(data, "service-data") + serviceData = utils.removeXmlPreamble(serviceData) + serviceData = utils.removeXmlNamespaces(serviceData) + String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information") + String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id") + oldVnfId = utils.removeXmlPreamble(oldVnfId) + oldVnfId = utils.removeXmlNamespaces(oldVnfId) + serviceData = serviceData.replace(oldVnfId, "") + def vnfId1 = utils.getNodeText(serviceData, "vnf-id") + + Map paramsMap = new HashMap() + + if (vfModuleIndex != null) { + paramsMap.put("vf_module_index", "${vfModuleIndex}") + } + + // Add-on data + paramsMap.put("vnf_id", "${vnfId}") + paramsMap.put("vnf_name", "${vnfName}") + paramsMap.put("vf_module_id", "${vfModuleId}") + paramsMap.put("vf_module_name", "${vfModuleName}") + paramsMap.put("environment_context", "${environmentContext}") + paramsMap.put("workload_context", "${workloadContext}") + + InputSource source = new InputSource(new StringReader(data)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document responseXml = docBuilder.parse(source) + + + // Availability Zones Data + + NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") + } + } + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") + Map networkRoleMap = new HashMap() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + + StringBuilder sbNet = new StringBuilder() + + NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") + paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") + paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") + } + } + } + + // VNF-VMS Data + + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + + NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + paramsMap.put("${key}_name_${position}", "${value}") + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") + } + } + + paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") + } + } + paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") + } + } + paramsMap.put("${key}_names", "${values}") + } + } + //SDNC Response Params + String sdncResponseParams = "" + List sdncResponseParamsToSkip = [ + "vnf_id", + "vf_module_id", + "vnf_name", + "vf_module_name" + ] + String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params + }else{ + NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + // make the sdnc_directives parameter + String sdncDirectives = "{}" + StringBuilder sdncDirectivesBuilder = new StringBuilder() + sdncDirectivesBuilder.append("{ \"attributes\": [") + int pcnt = 0 + for (Map.Entry entry : paramsMap.entrySet()) { + String attributeName = entry.getKey() + String attributeValue = entry.getValue() + if (pcnt > 0) { + sdncDirectivesBuilder.append(",") + } + pcnt++ + sdncDirectivesBuilder.append("{\"attribute_name\":\"${attributeName}\",") + sdncDirectivesBuilder.append("\"attribute_value\":\"${attributeValue}\"}") + } + if (pcnt > 0) { + sdncDirectives = sdncDirectivesBuilder.append("]}").toString() + } + paramsMap.put("sdnc_directives", "${sdncDirectives}") + + // Parameters received from the request should overwrite any parameters received from SDNC + // Also build the user_directives parameter + String userDirectives = "{}" + if (vnfParamsMap != null) { + StringBuilder userDirectivesBuilder = new StringBuilder() + userDirectivesBuilder.append("{ \"attributes\": [") + pcnt = 0 + for (Map.Entry entry : vnfParamsMap.entrySet()) { + String vnfKey = entry.getKey() + String vnfValue = entry.getValue() + paramsMap.put("$vnfKey", "$vnfValue") + if (pcnt > 0) { + userDirectivesBuilder.append(",") + } + pcnt++ + userDirectivesBuilder.append("{\"attribute_name\":\"${vnfKey}\",") + userDirectivesBuilder.append("\"attribute_value\":\"${vnfValue}\"}") + } + if (pcnt > 0) { + userDirectives = userDirectivesBuilder.append("]}").toString() + } + } + paramsMap.put("user_directives", "${userDirectives}") + + StringBuilder sbParams = new StringBuilder() + def vfModuleParams = "" + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ ${MsoUtils.xmlEscape(paramName)} ${MsoUtils.xmlEscape(paramValue)} """ - - vfModuleParams = sbParams.append(paramsXml) - } - - return vfModuleParams - - } - - - /* - * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response - * for both VNF and VF Module - * and puts them into the format expected by VNF adapter. - * @param vnfParamsMap - map of VNF parameters passed in the request body - * @param vnfSdncGetResponse - response string from SDNC GET VNF topology request - * @param vfmoduleSdncGetResponse - response string from SDNC GET VF Module topology request - * @param vnfId - * @param vnfName - * @param vfModuleId - * @param vfModuleName - * @param vfModuleIndex - can be null - * @return a String of key/value entries for vfModuleParams - */ - - protected String buildVfModuleParamsFromCombinedTopologies(Map vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName, - String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { - - // Set up initial parameters - - Map paramsMap = new HashMap() - - if (vfModuleIndex != null) { - paramsMap.put("vf_module_index", "${vfModuleIndex}") - } - - // Add-on data - paramsMap.put("vnf_id", "${vnfId}") - paramsMap.put("vnf_name", "${vnfName}") - paramsMap.put("vf_module_id", "${vfModuleId}") - paramsMap.put("vf_module_name", "${vfModuleName}") - paramsMap.put("environment_context","${environmentContext}") - paramsMap.put("workload_context", "${workloadContext}") - - //Get SDNC Response Data for VNF - - String vnfData = utils.getNodeXml(vnfSdncGetResponse, "response-data") - - String vnfTopology = utils.getNodeXml(vnfData, "vnf-topology") - vnfTopology = utils.removeXmlPreamble(vnfTopology) - vnfTopology = utils.removeXmlNamespaces(vnfTopology) - - InputSource sourceVnf = new InputSource(new StringReader(vnfData)); - DocumentBuilderFactory docFactoryVnf = DocumentBuilderFactory.newInstance(); - docFactoryVnf.setNamespaceAware(true) - DocumentBuilder docBuilderVnf = docFactoryVnf.newDocumentBuilder() - Document responseXmlVnf = docBuilderVnf.parse(sourceVnf) - - // Availability Zones Data - - NodeList aZonesList = responseXmlVnf.getElementsByTagNameNS("*", "availability-zones") - String aZonePosition = "0" - for (int z = 0; z < aZonesList.getLength(); z++) { - Node node = aZonesList.item(z) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String aZoneValue = utils.getElementText(eElement, "availability-zone") - aZonePosition = z.toString() - paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") - } - } - - //Get SDNC Response Data for VF Module - - String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data") - - String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology") - vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology) - vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology) - String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier") - - InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData)); - DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance(); - docFactoryVfModule.setNamespaceAware(true) - DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder() - Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule) - - // Map of network-roles and network-tags from vm-networks - - NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks") - Map networkRoleMap = new HashMap() - for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ - Node nodeNetworkKey = vmNetworksListGlobal.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String networkRole = utils.getElementText(eElementNetworkKey, "network-role") - String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkRoleValue.isEmpty()) { - networkRoleValue = networkRole - } - networkRoleMap.put(networkRole, networkRoleValue) - } - } - - // VNF Networks Data - - StringBuilder sbNet = new StringBuilder() - - NodeList vnfNetworkList = responseXmlVnf.getElementsByTagNameNS("*", "vnf-networks") - for (int x = 0; x < vnfNetworkList.getLength(); x++) { - Node node = vnfNetworkList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") - String networkRole = utils.getElementText(eElement, "network-role") - if (vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRoleMap.get(networkRole) - if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRole - } - } - String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") - String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") - String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") - String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") - String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") - paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") - paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") - paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") - paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") - paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") - - NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") - StringBuffer sriovFilterBuf = new StringBuffer() - String values = "" - for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ - Node node1 = sriovVlanFilterList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - String value = utils.getElementText(eElement1, "sriov-vlan-filter") - if (i != sriovVlanFilterList.getLength() - 1) { - values = sriovFilterBuf.append(value + ",") - } - else { - values = sriovFilterBuf.append(value); - } - } - } - if (!values.isEmpty()) { - paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") - } - } - } - - - - // VMS Data - - def key - def value - def networkKey - def networkValue - def floatingIPKey - def floatingIPKeyValue - def floatingIPV6Key - def floatingIPV6KeyValue - StringBuilder sb = new StringBuilder() - - NodeList vmsList = responseXmlVfModule.getElementsByTagNameNS("*","vm") - for (int x = 0; x < vmsList.getLength(); x++) { - Node node = vmsList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - key = utils.getElementText(eElement, "vm-type") - String values - String position = "0" - StringBuilder sb1 = new StringBuilder() - NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") - NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") - for(int i = 0; i < valueList.getLength(); i++){ - Node node1 = valueList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - value = utils.getElementText(eElement1, "vm-name") - if (i != valueList.getLength() - 1) { - values = sb1.append(value + ",") - } - else { - values = sb1.append(value); - } - position = i.toString() - paramsMap.put("${key}_name_${position}", "${value}") - } - } - for(int n = 0; n < vmNetworksList.getLength(); n++){ - String floatingIpKeyValueStr = "" - String floatingIpV6KeyValueStr = "" - Node nodeNetworkKey = vmNetworksList.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String ipAddressValues - String ipV6AddressValues - String networkPosition = "0" - StringBuilder sb2 = new StringBuilder() - StringBuilder sb3 = new StringBuilder() - StringBuilder sb4 = new StringBuilder() - networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkKey.isEmpty()) { - networkKey = utils.getElementText(eElementNetworkKey, "network-role") - } - floatingIPKey = key + '_' + networkKey + '_floating_ip' - floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") - if(!floatingIPKeyValue.isEmpty()){ - paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") - } - floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' - floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") - if(!floatingIPV6KeyValue.isEmpty()){ - paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") - } - NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") - for(int a = 0; a < networkIpsList.getLength(); a++){ - Node ipAddress = networkIpsList.item(a) - if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpAddress = (Element) ipAddress - String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") - if (a != networkIpsList.getLength() - 1) { - ipAddressValues = sb2.append(ipAddressValue + ",") - } - else { - ipAddressValues = sb2.append(ipAddressValue); - } - networkPosition = a.toString() - paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") - } - } - - paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") - - NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") - String interfaceRoutePrefixValues = sb3.append("[") - - for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ - Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) - if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { - Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix - String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") - if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { - interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") - } - if (a != interfaceRoutePrefixesList.getLength() - 1) { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") - } - else { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") - } - } - } - interfaceRoutePrefixValues = sb3.append("]") - if (interfaceRoutePrefixesList.getLength() > 0) { - paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") - } - - NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") - for(int a = 0; a < networkIpsV6List.getLength(); a++){ - Node ipV6Address = networkIpsV6List.item(a) - if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpV6Address = (Element) ipV6Address - String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") - if (a != networkIpsV6List.getLength() - 1) { - ipV6AddressValues = sb4.append(ipV6AddressValue + ",") - } - else { - ipV6AddressValues = sb4.append(ipV6AddressValue); - } - networkPosition = a.toString() - paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") - } - } - paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") - } - } - paramsMap.put("${key}_names", "${values}") - } - } - //SDNC Response Params - List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] - - String vnfParamsChildNodes = utils.getChildNodes(vnfData, "param") - if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - // No SDNC params for VNF - }else{ - NodeList paramsList = responseXmlVnf.getElementsByTagNameNS("*", "param") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "name") - if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { - String vnfParameterValue = utils.getElementText(eElement, "value") - paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") - } - } - } - - String vfModuleParamsChildNodes = utils.getChildNodes(vfModuleData, "param") - if(vfModuleParamsChildNodes == null || vfModuleParamsChildNodes.length() < 1){ - // No SDNC params for VF Module - }else{ - NodeList paramsList = responseXmlVfModule.getElementsByTagNameNS("*", "param") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "name") - if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { - String vnfParameterValue = utils.getElementText(eElement, "value") - paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") - } - } - } - - // Parameters received from the request should overwrite any parameters received from SDNC - if (vnfParamsMap != null) { - for (Map.Entry entry : vnfParamsMap.entrySet()) { - String vnfKey = entry.getKey() - String vnfValue = entry.getValue() - paramsMap.put("$vnfKey", "$vnfValue") - } - } - - StringBuilder sbParams = new StringBuilder() - def vfModuleParams = "" - for (Map.Entry entry : paramsMap.entrySet()) { - String paramsXml - String paramName = entry.getKey() - String paramValue = entry.getValue() - paramsXml = - """ + + vfModuleParams = sbParams.append(paramsXml) + } + + return vfModuleParams + + } + + + /* + * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response + * for both VNF and VF Module + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param vnfSdncGetResponse - response string from SDNC GET VNF topology request + * @param vfmoduleSdncGetResponse - response string from SDNC GET VF Module topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @param vfModuleIndex - can be null + * @return a String of key/value entries for vfModuleParams + */ + + protected String buildVfModuleParamsFromCombinedTopologies(Map vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) { + + // Set up initial parameters + + Map paramsMap = new HashMap() + + if (vfModuleIndex != null) { + paramsMap.put("vf_module_index", "${vfModuleIndex}") + } + + // Add-on data + paramsMap.put("vnf_id", "${vnfId}") + paramsMap.put("vnf_name", "${vnfName}") + paramsMap.put("vf_module_id", "${vfModuleId}") + paramsMap.put("vf_module_name", "${vfModuleName}") + paramsMap.put("environment_context","${environmentContext}") + paramsMap.put("workload_context", "${workloadContext}") + + //Get SDNC Response Data for VNF + + String vnfData = utils.getNodeXml(vnfSdncGetResponse, "response-data") + + String vnfTopology = utils.getNodeXml(vnfData, "vnf-topology") + vnfTopology = utils.removeXmlPreamble(vnfTopology) + vnfTopology = utils.removeXmlNamespaces(vnfTopology) + + InputSource sourceVnf = new InputSource(new StringReader(vnfData)); + DocumentBuilderFactory docFactoryVnf = DocumentBuilderFactory.newInstance(); + docFactoryVnf.setNamespaceAware(true) + DocumentBuilder docBuilderVnf = docFactoryVnf.newDocumentBuilder() + Document responseXmlVnf = docBuilderVnf.parse(sourceVnf) + + // Availability Zones Data + + NodeList aZonesList = responseXmlVnf.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}") + } + } + + //Get SDNC Response Data for VF Module + + String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data") + + String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology") + vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology) + vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology) + String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier") + + InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData)); + DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance(); + docFactoryVfModule.setNamespaceAware(true) + DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder() + Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule) + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks") + Map networkRoleMap = new HashMap() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + + StringBuilder sbNet = new StringBuilder() + + NodeList vnfNetworkList = responseXmlVnf.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}") + paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}") + paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}") + paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}") + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}") + } + } + } + + + + // VMS Data + + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + + NodeList vmsList = responseXmlVfModule.getElementsByTagNameNS("*","vm") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + paramsMap.put("${key}_name_${position}", "${value}") + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + paramsMap.put("$floatingIPKey", "$floatingIPKeyValue") + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue") + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}") + } + } + + paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}") + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}") + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}") + } + } + paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}") + } + } + paramsMap.put("${key}_names", "${values}") + } + } + //SDNC Response Params + List sdncResponseParamsToSkip = [ + "vnf_id", + "vf_module_id", + "vnf_name", + "vf_module_name" + ] + + String vnfParamsChildNodes = utils.getChildNodes(vnfData, "param") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params for VNF + }else{ + NodeList paramsList = responseXmlVnf.getElementsByTagNameNS("*", "param") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + String vfModuleParamsChildNodes = utils.getChildNodes(vfModuleData, "param") + if(vfModuleParamsChildNodes == null || vfModuleParamsChildNodes.length() < 1){ + // No SDNC params for VF Module + }else{ + NodeList paramsList = responseXmlVfModule.getElementsByTagNameNS("*", "param") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "value") + paramsMap.put("${vnfParameterName}", "${vnfParameterValue}") + } + } + } + + // make the sdnc_directives parameter + String sdncDirectives = "{}" + StringBuilder sdncDirectivesBuilder = new StringBuilder() + sdncDirectivesBuilder.append("{ \"attributes\": [") + int pcnt = 0 + for (Map.Entry entry : paramsMap.entrySet()) { + String attributeName = entry.getKey() + String attributeValue = entry.getValue() + if (pcnt > 0) { + sdncDirectivesBuilder.append(",") + } + pcnt++ + sdncDirectivesBuilder.append("{\"attribute_name\":\"${attributeName}\",") + sdncDirectivesBuilder.append("\"attribute_value\":\"${attributeValue}\"}") + } + if (pcnt > 0) { + sdncDirectives = sdncDirectivesBuilder.append("]}").toString() + } + paramsMap.put("sdnc_directives", "${sdncDirectives}") + + + // Parameters received from the request should overwrite any parameters received from SDNC + String userDirectives = "{}" + if (vnfParamsMap != null) { + StringBuilder userDirectivesBuilder = new StringBuilder() + userDirectivesBuilder.append("{ \"attributes\": [") + pcnt = 0 + for (Map.Entry entry : vnfParamsMap.entrySet()) { + String vnfKey = entry.getKey() + String vnfValue = entry.getValue() + paramsMap.put("$vnfKey", "$vnfValue") + if (pcnt > 0) { + userDirectivesBuilder.append(",") + } + pcnt++ + userDirectivesBuilder.append("{\"attribute_name\":\"${vnfKey}\",") + userDirectivesBuilder.append("\"attribute_value\":\"${vnfValue}\"}") + } + if (pcnt > 0) { + userDirectives = userDirectivesBuilder.append("]}").toString() + } + } + paramsMap.put("user_directives", "${userDirectives}") + + StringBuilder sbParams = new StringBuilder() + def vfModuleParams = "" + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ ${MsoUtils.xmlEscape(paramName)} ${MsoUtils.xmlEscape(paramValue)} """ - - vfModuleParams = sbParams.append(paramsXml) - } - - return vfModuleParams - - } - - - /* - * VBNG specific method that parses VNF parameters passed in on the - * incoming requests and SDNC parameters returned from SDNC get response - * and puts them into the format expected by VNF adapter. - * @param vnfParamsMap - map of VNF parameters passed in the request body - * @param sdncGetResponse - response string from SDNC GET topology request - * @param vnfId - * @param vnfName - * @param vfModuleId - * @param vfModuleName - * @return a String of key/value entries for vfModuleParams - */ - - protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName, - String vfModuleId, String vfModuleName) { - - //Get SDNC Response Data - - String data = utils.getNodeXml(sdncGetResponse, "response-data") - - - - // Add-on data - String vnfInfo = - """ + + vfModuleParams = sbParams.append(paramsXml) + } + + return vfModuleParams + + } + + + /* + * VBNG specific method that parses VNF parameters passed in on the + * incoming requests and SDNC parameters returned from SDNC get response + * and puts them into the format expected by VNF adapter. + * @param vnfParamsMap - map of VNF parameters passed in the request body + * @param sdncGetResponse - response string from SDNC GET topology request + * @param vnfId + * @param vnfName + * @param vfModuleId + * @param vfModuleName + * @return a String of key/value entries for vfModuleParams + */ + + protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName, + String vfModuleId, String vfModuleName) { + + //Get SDNC Response Data + + String data = utils.getNodeXml(sdncGetResponse, "response-data") + + + + // Add-on data + String vnfInfo = + """ vnf_id ${MsoUtils.xmlEscape(vnfId)} @@ -889,347 +974,352 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { ${MsoUtils.xmlEscape(vfModuleName)} """ - logger.debug("vnfInfo: " + vnfInfo) - InputSource source = new InputSource(new StringReader(data)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document responseXml = docBuilder.parse(source) - - - // Availability Zones Data - String aZones = "" - StringBuilder sbAZone = new StringBuilder() - NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") - String aZonePosition = "0" - for (int z = 0; z < aZonesList.getLength(); z++) { - Node node = aZonesList.item(z) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String aZoneValue = utils.getElementText(eElement, "availability-zone") - aZonePosition = z.toString() - String aZoneXml = - """ + logger.debug("vnfInfo: " + vnfInfo) + InputSource source = new InputSource(new StringReader(data)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document responseXml = docBuilder.parse(source) + + + // Availability Zones Data + String aZones = "" + StringBuilder sbAZone = new StringBuilder() + NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones") + String aZonePosition = "0" + for (int z = 0; z < aZonesList.getLength(); z++) { + Node node = aZonesList.item(z) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String aZoneValue = utils.getElementText(eElement, "availability-zone") + aZonePosition = z.toString() + String aZoneXml = + """ availability_zone_${MsoUtils.xmlEscape(aZonePosition)} ${MsoUtils.xmlEscape(aZoneValue)} """ - aZones = sbAZone.append(aZoneXml) - } - } - - // Map of network-roles and network-tags from vm-networks - - NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") - Map networkRoleMap = new HashMap() - for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ - Node nodeNetworkKey = vmNetworksListGlobal.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String networkRole = utils.getElementText(eElementNetworkKey, "network-role") - String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkRoleValue.isEmpty()) { - networkRoleValue = networkRole - } - networkRoleMap.put(networkRole, networkRoleValue) - } - } - - // VNF Networks Data - String vnfNetworkNetId = "" - String vnfNetworkNetName = "" - String vnfNetworkSubNetId = "" - String vnfNetworkV6SubNetId = "" - String vnfNetworkNetFqdn = "" - String vnfNetworksSriovVlanFilters = "" - StringBuilder sbNet = new StringBuilder() - StringBuilder sbNet2 = new StringBuilder() - StringBuilder sbNet3 = new StringBuilder() - StringBuilder sbNet4 = new StringBuilder() - StringBuilder sbNet5 = new StringBuilder() - StringBuilder sbNet6 = new StringBuilder() - NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") - for (int x = 0; x < vnfNetworkList.getLength(); x++) { - Node node = vnfNetworkList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") - String networkRole = utils.getElementText(eElement, "network-role") - if (vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRoleMap.get(networkRole) - if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { - vnfNetworkKey = networkRole - } - } - String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") - String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") - String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") - String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") - String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") - String vnfNetworkNetIdXml = - """ + aZones = sbAZone.append(aZoneXml) + } + } + + // Map of network-roles and network-tags from vm-networks + + NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks") + Map networkRoleMap = new HashMap() + for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){ + Node nodeNetworkKey = vmNetworksListGlobal.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String networkRole = utils.getElementText(eElementNetworkKey, "network-role") + String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkRoleValue.isEmpty()) { + networkRoleValue = networkRole + } + networkRoleMap.put(networkRole, networkRoleValue) + } + } + + // VNF Networks Data + String vnfNetworkNetId = "" + String vnfNetworkNetName = "" + String vnfNetworkSubNetId = "" + String vnfNetworkV6SubNetId = "" + String vnfNetworkNetFqdn = "" + String vnfNetworksSriovVlanFilters = "" + StringBuilder sbNet = new StringBuilder() + StringBuilder sbNet2 = new StringBuilder() + StringBuilder sbNet3 = new StringBuilder() + StringBuilder sbNet4 = new StringBuilder() + StringBuilder sbNet5 = new StringBuilder() + StringBuilder sbNet6 = new StringBuilder() + NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") + for (int x = 0; x < vnfNetworkList.getLength(); x++) { + Node node = vnfNetworkList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag") + String networkRole = utils.getElementText(eElement, "network-role") + if (vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRoleMap.get(networkRole) + if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) { + vnfNetworkKey = networkRole + } + } + String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id") + String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name") + String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id") + String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id") + String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn") + String vnfNetworkNetIdXml = + """ ${MsoUtils.xmlEscape(vnfNetworkKey)}_net_id ${MsoUtils.xmlEscape(vnfNetworkNeutronIdValue)} """ - vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml) - String vnfNetworkNetNameXml = - """ + vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml) + String vnfNetworkNetNameXml = + """ ${MsoUtils.xmlEscape(vnfNetworkKey)}_net_name ${MsoUtils.xmlEscape(vnfNetworkNetNameValue)} """ - vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml) - String vnfNetworkSubNetIdXml = - """ + vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml) + String vnfNetworkSubNetIdXml = + """ ${MsoUtils.xmlEscape(vnfNetworkKey)}_subnet_id ${MsoUtils.xmlEscape(vnfNetworkSubNetIdValue)} """ - vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml) - String vnfNetworkV6SubNetIdXml = - """ + vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml) + String vnfNetworkV6SubNetIdXml = + """ ${MsoUtils.xmlEscape(vnfNetworkKey)}_v6_subnet_id ${MsoUtils.xmlEscape(vnfNetworkV6SubNetIdValue)} """ - vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml) - String vnfNetworkNetFqdnXml = - """ + vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml) + String vnfNetworkNetFqdnXml = + """ ${MsoUtils.xmlEscape(vnfNetworkKey)}_net_fqdn ${MsoUtils.xmlEscape(vnfNetworkNetFqdnValue)} """ - vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml) - - NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") - StringBuffer sriovFilterBuf = new StringBuffer() - String values = "" - for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ - Node node1 = sriovVlanFilterList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - String value = utils.getElementText(eElement1, "sriov-vlan-filter") - if (i != sriovVlanFilterList.getLength() - 1) { - values = sriovFilterBuf.append(value + ",") - } - else { - values = sriovFilterBuf.append(value); - } - } - } - if (!values.isEmpty()) { - String vnfNetworkSriovVlanFilterXml = - """ + vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml) + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + String vnfNetworkSriovVlanFilterXml = + """ ${MsoUtils.xmlEscape(vnfNetworkKey)}_ATT_VF_VLAN_FILTER ${MsoUtils.xmlEscape(values)} """ - vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml) - } - } - } - - // VNF-VMS Data - String vnfVMS = "" - String vnfVMSPositions = "" - String vmNetworks = "" - String vmNetworksPositions = "" - String vmNetworksPositionsV6 = "" - String interfaceRoutePrefixes = "" - def key - def value - def networkKey - def networkValue - def floatingIPKey - def floatingIPKeyValue - def floatingIPV6Key - def floatingIPV6KeyValue - StringBuilder sb = new StringBuilder() - StringBuilder sbPositions = new StringBuilder() - StringBuilder sbVmNetworks = new StringBuilder() - StringBuilder sbNetworksPositions = new StringBuilder() - StringBuilder sbInterfaceRoutePrefixes = new StringBuilder() - StringBuilder sbNetworksPositionsV6 = new StringBuilder() - - NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") - for (int x = 0; x < vmsList.getLength(); x++) { - Node node = vmsList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - key = utils.getElementText(eElement, "vm-type") - String values - String position = "0" - StringBuilder sb1 = new StringBuilder() - NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") - NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") - for(int i = 0; i < valueList.getLength(); i++){ - Node node1 = valueList.item(i) - if (node1.getNodeType() == Node.ELEMENT_NODE) { - Element eElement1 = (Element) node1 - value = utils.getElementText(eElement1, "vm-name") - if (i != valueList.getLength() - 1) { - values = sb1.append(value + ",") - } - else { - values = sb1.append(value); - } - position = i.toString() - String vnfPositionXml = - """ + vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml) + } + } + } + + // VNF-VMS Data + String vnfVMS = "" + String vnfVMSPositions = "" + String vmNetworks = "" + String vmNetworksPositions = "" + String vmNetworksPositionsV6 = "" + String interfaceRoutePrefixes = "" + def key + def value + def networkKey + def networkValue + def floatingIPKey + def floatingIPKeyValue + def floatingIPV6Key + def floatingIPV6KeyValue + StringBuilder sb = new StringBuilder() + StringBuilder sbPositions = new StringBuilder() + StringBuilder sbVmNetworks = new StringBuilder() + StringBuilder sbNetworksPositions = new StringBuilder() + StringBuilder sbInterfaceRoutePrefixes = new StringBuilder() + StringBuilder sbNetworksPositionsV6 = new StringBuilder() + + NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms") + for (int x = 0; x < vmsList.getLength(); x++) { + Node node = vmsList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + key = utils.getElementText(eElement, "vm-type") + String values + String position = "0" + StringBuilder sb1 = new StringBuilder() + NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names") + NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks") + for(int i = 0; i < valueList.getLength(); i++){ + Node node1 = valueList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + value = utils.getElementText(eElement1, "vm-name") + if (i != valueList.getLength() - 1) { + values = sb1.append(value + ",") + } + else { + values = sb1.append(value); + } + position = i.toString() + String vnfPositionXml = + """ ${MsoUtils.xmlEscape(key)}_name_${MsoUtils.xmlEscape(position)} ${MsoUtils.xmlEscape(value)} """ - nfVMSPositions = sbPositions.append(vnfPositionXml) - } - } - for(int n = 0; n < vmNetworksList.getLength(); n++){ - String floatingIpKeyValueStr = "" - String floatingIpV6KeyValueStr = "" - Node nodeNetworkKey = vmNetworksList.item(n) - if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { - Element eElementNetworkKey = (Element) nodeNetworkKey - String ipAddressValues - String ipV6AddressValues - String networkPosition = "0" - StringBuilder sb2 = new StringBuilder() - StringBuilder sb3 = new StringBuilder() - StringBuilder sb4 = new StringBuilder() - networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") - if (networkKey.isEmpty()) { - networkKey = utils.getElementText(eElementNetworkKey, "network-role") - } - floatingIPKey = key + '_' + networkKey + '_floating_ip' - floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") - if(!floatingIPKeyValue.isEmpty()){ - floatingIpKeyValueStr = """ + nfVMSPositions = sbPositions.append(vnfPositionXml) + } + } + for(int n = 0; n < vmNetworksList.getLength(); n++){ + String floatingIpKeyValueStr = "" + String floatingIpV6KeyValueStr = "" + Node nodeNetworkKey = vmNetworksList.item(n) + if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) { + Element eElementNetworkKey = (Element) nodeNetworkKey + String ipAddressValues + String ipV6AddressValues + String networkPosition = "0" + StringBuilder sb2 = new StringBuilder() + StringBuilder sb3 = new StringBuilder() + StringBuilder sb4 = new StringBuilder() + networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag") + if (networkKey.isEmpty()) { + networkKey = utils.getElementText(eElementNetworkKey, "network-role") + } + floatingIPKey = key + '_' + networkKey + '_floating_ip' + floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip") + if(!floatingIPKeyValue.isEmpty()){ + floatingIpKeyValueStr = """ $floatingIPKey $floatingIPKeyValue """ - } - floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' - floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") - if(!floatingIPV6KeyValue.isEmpty()){ - floatingIpV6KeyValueStr = """ + } + floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip' + floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6") + if(!floatingIPV6KeyValue.isEmpty()){ + floatingIpV6KeyValueStr = """ $floatingIPV6Key $floatingIPV6KeyValue """ - } - NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") - for(int a = 0; a < networkIpsList.getLength(); a++){ - Node ipAddress = networkIpsList.item(a) - if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpAddress = (Element) ipAddress - String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") - if (a != networkIpsList.getLength() - 1) { - ipAddressValues = sb2.append(ipAddressValue + ",") - } - else { - ipAddressValues = sb2.append(ipAddressValue); - } - networkPosition = a.toString() - String vmNetworksPositionsXml = - """ + } + NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips") + for(int a = 0; a < networkIpsList.getLength(); a++){ + Node ipAddress = networkIpsList.item(a) + if (ipAddress.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpAddress = (Element) ipAddress + String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address") + if (a != networkIpsList.getLength() - 1) { + ipAddressValues = sb2.append(ipAddressValue + ",") + } + else { + ipAddressValues = sb2.append(ipAddressValue); + } + networkPosition = a.toString() + String vmNetworksPositionsXml = + """ ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_ip_${MsoUtils.xmlEscape(networkPosition)} ${MsoUtils.xmlEscape(ipAddressValue)} """ - vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml) - } - } - vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr) - - String vmNetworksXml = - """ + vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml) + } + } + vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr) + + String vmNetworksXml = + """ ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_ips ${MsoUtils.xmlEscape(ipAddressValues)} """ - vmNetworks = sbVmNetworks.append(vmNetworksXml) - - NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") - String interfaceRoutePrefixValues = sb3.append("[") - - for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ - Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) - if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { - Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix - String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") - if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { - interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") - } - if (a != interfaceRoutePrefixesList.getLength() - 1) { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") - } - else { - interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") - } - } - } - interfaceRoutePrefixValues = sb3.append("]") - if (interfaceRoutePrefixesList.getLength() > 0) { - String interfaceRoutePrefixesXml = - """ + vmNetworks = sbVmNetworks.append(vmNetworksXml) + + NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes") + String interfaceRoutePrefixValues = sb3.append("[") + + for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){ + Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) + if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { + Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } + if (a != interfaceRoutePrefixesList.getLength() - 1) { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") + } + else { + interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}") + } + } + } + interfaceRoutePrefixValues = sb3.append("]") + if (interfaceRoutePrefixesList.getLength() > 0) { + String interfaceRoutePrefixesXml = + """ ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_route_prefixes ${MsoUtils.xmlEscape(interfaceRoutePrefixValues)} - """ - interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml) - } - - NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") - for(int a = 0; a < networkIpsV6List.getLength(); a++){ - Node ipV6Address = networkIpsV6List.item(a) - if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { - Element eElementIpV6Address = (Element) ipV6Address - String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") - if (a != networkIpsV6List.getLength() - 1) { - ipV6AddressValues = sb4.append(ipV6AddressValue + ",") - } - else { - ipV6AddressValues = sb4.append(ipV6AddressValue); - } - networkPosition = a.toString() - String vmNetworksPositionsV6Xml = - """ + """ + interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml) + } + + NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6") + for(int a = 0; a < networkIpsV6List.getLength(); a++){ + Node ipV6Address = networkIpsV6List.item(a) + if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) { + Element eElementIpV6Address = (Element) ipV6Address + String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6") + if (a != networkIpsV6List.getLength() - 1) { + ipV6AddressValues = sb4.append(ipV6AddressValue + ",") + } + else { + ipV6AddressValues = sb4.append(ipV6AddressValue); + } + networkPosition = a.toString() + String vmNetworksPositionsV6Xml = + """ ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_v6_ip_${MsoUtils.xmlEscape(networkPosition)} ${MsoUtils.xmlEscape(ipV6AddressValue)} """ - vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml) - } - } - String vmNetworksV6Xml = - """ + vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml) + } + } + String vmNetworksV6Xml = + """ ${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_v6_ips ${MsoUtils.xmlEscape(ipV6AddressValues)} """ - vmNetworks = sbVmNetworks.append(vmNetworksV6Xml) - } - } - String vnfXml = - """ + vmNetworks = sbVmNetworks.append(vmNetworksV6Xml) + } + } + String vnfXml = + """ ${MsoUtils.xmlEscape(key)}_names ${MsoUtils.xmlEscape(values)} """ - vnfVMS = sb.append(vnfXml) - } - } - //SDNC Response Params - String sdncResponseParams = "" - List sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"] - String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") - if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - // No SDNC params - }else{ - NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - Element eElement = (Element) node - String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") - if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { - String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") - String paraEntry = - """ + vnfVMS = sb.append(vnfXml) + } + } + //SDNC Response Params + String sdncResponseParams = "" + List sdncResponseParamsToSkip = [ + "vnf_id", + "vf_module_id", + "vnf_name", + "vf_module_name" + ] + String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + // No SDNC params + }else{ + NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters") + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + Element eElement = (Element) node + String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name") + if (!sdncResponseParamsToSkip.contains(vnfParameterName)) { + String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value") + String paraEntry = + """ ${MsoUtils.xmlEscape(vnfParameterName)} ${MsoUtils.xmlEscape(vnfParameterValue)} """ - sdncResponseParams = sb.append(paraEntry) - } - } - } - - - def vfModuleParams = """ + sdncResponseParams = sb.append(paraEntry) + } + } + } + + + def vfModuleParams = """ ${vnfInfo} ${aZones} ${vnfNetworkNetId} @@ -1247,8 +1337,8 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { ${vnfParams} ${sdncResponseParams}""" - return vfModuleParams + return vfModuleParams - } + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 6b4fc840f7..ea9987e2ec 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -270,11 +270,11 @@ public class DoCreateVfModule extends VfModuleBase { Map vfModuleInputParams = execution.getVariable("vfModuleInputParams") if (oofDirectives != null && vfModuleInputParams != null) { vfModuleInputParams.put("oof_directives", oofDirectives) - vfModuleInputParams.put("sdnc_directives", "{}") + //vfModuleInputParams.put("sdnc_directives", "{}") logger.debug("OofDirectives are: " + oofDirectives) } else if (vfModuleInputParams != null) { vfModuleInputParams.put("oof_directives", "{}") - vfModuleInputParams.put("sdnc_directives", "{}") + //vfModuleInputParams.put("sdnc_directives", "{}") } if (vfModuleInputParams != null) { execution.setVariable("DCVFM_vnfParamsMap", vfModuleInputParams) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy index faa6a0e395..5a6ad4291e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy @@ -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. @@ -47,6 +47,9 @@ import static org.mockito.Mockito.* class DoCreateVfModuleTest { def prefix = "DCVFM_" + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + @Captor static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) @@ -54,7 +57,7 @@ class DoCreateVfModuleTest { void init() throws IOException { MockitoAnnotations.initMocks(this); } - + @Test void testQueryAAIVfModule() { ExecutionEntity mockExecution = setupMock() @@ -90,7 +93,7 @@ class DoCreateVfModuleTest { Mockito.verify(mockExecution).setVariable("DCVFM_queryAAIVfModuleForStatusResponseCode", 200) } - + @Test void testPreProcessVNFAdapterRequest() { @@ -122,7 +125,7 @@ class DoCreateVfModuleTest { map.put("vrr_image_name", "MDT17"); map.put("availability_zone_0", "nova"); map.put("vrr_flavor_name", "ns.c16r32d128.v1"); - when(mockExecution.getVariable("vnfParamsMap")).thenReturn(map) + when(mockExecution.getVariable(prefix + "vnfParamsMap")).thenReturn(map) when(mockExecution.getVariable("mso-request-id")).thenReturn("testRequestId-1503410089303") when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("http://localhost:28080/mso/WorkflowMesssage") @@ -155,7 +158,7 @@ class DoCreateVfModuleTest { Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionReturnCode", "200") } - + @Test void testCreateNetworkPoliciesInAAI() { @@ -181,7 +184,7 @@ class DoCreateVfModuleTest { Mockito.verify(mockExecution).setVariable(prefix + "aaiQqueryNetworkPolicyByFqdnReturnCode", 200) } - + private static ExecutionEntity setupMock() { ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml index f78d38f802..782936c382 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml @@ -1,5 +1,6 @@ RDM2WAGPLCP + null fba1bd1e195a404cacb9ce17a9b2b421 skask skask-test @@ -46,6 +47,10 @@ workload_context null + + user_directives + { "attributes": [{"attribute_name":"vrr_image_name","attribute_value":"MDT17"},{"attribute_name":"availability_zone_0","attribute_value":"nova"},{"attribute_name":"vrr_flavor_name","attribute_value":"ns.c16r32d128.v1"}]} + vf_module_name PCRF::module-0-2 @@ -70,6 +75,10 @@ ADIG_SRIOV_1_subnet_id + + vrr_flavor_name + ns.c16r32d128.v1 + ADIG_SRIOV_2_net_name ADIG_SRIOV_2 @@ -102,6 +111,10 @@ vrra_ADIG_SRIOV_2_ips null + + sdnc_directives + { "attributes": [{"attribute_name":"vf_module_id","attribute_value":"cb510af0-5b21-4bc7-86d9-323cb396ce32"},{"attribute_name":"vrra_Internal-Network1_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_2_subnet_id","attribute_value":""},{"attribute_name":"vrra_ADIGOam.OAM_v6_ips","attribute_value":"null"},{"attribute_name":"vnf_name","attribute_value":"skask-test"},{"attribute_name":"ADIGOam.OAM_v6_subnet_id","attribute_value":""},{"attribute_name":"workload_context","attribute_value":"null"},{"attribute_name":"vf_module_name","attribute_value":"PCRF::module-0-2"},{"attribute_name":"vnf_id","attribute_value":"skask"},{"attribute_name":"ADIG_SRIOV_2_v6_subnet_id","attribute_value":""},{"attribute_name":"vrra_ADIG_SRIOV_1_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_1_v6_subnet_id","attribute_value":""},{"attribute_name":"ADIG_SRIOV_1_subnet_id","attribute_value":""},{"attribute_name":"ADIG_SRIOV_2_net_name","attribute_value":"ADIG_SRIOV_2"},{"attribute_name":"ADIGOam.OAM_subnet_id","attribute_value":""},{"attribute_name":"ADIGOam.OAM_net_id","attribute_value":"491c7cef-a3f4-4990-883e-b0af397466d0"},{"attribute_name":"environment_context","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_1_net_fqdn","attribute_value":""},{"attribute_name":"ADIGOam.OAM_net_name","attribute_value":"ADIGOAM.OAM"},{"attribute_name":"vrra_name_0","attribute_value":"frkdevRvrra24"},{"attribute_name":"vrra_ADIG_SRIOV_2_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_2_net_fqdn","attribute_value":""},{"attribute_name":"vrra_Internal-Network2_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_1_net_name","attribute_value":"ADIG_SRIOV_1"},{"attribute_name":"vrra_ADIG_SRIOV_1_v6_ips","attribute_value":"null"},{"attribute_name":"vrra_ADIGOam.OAM_ips","attribute_value":"null"},{"attribute_name":"vrra_Internal-Network1_v6_ips","attribute_value":"null"},{"attribute_name":"ADIGOam.OAM_net_fqdn","attribute_value":""},{"attribute_name":"vrra_names","attribute_value":"frkdevRvrra24"},{"attribute_name":"ADIG_SRIOV_1_net_id","attribute_value":"491c7cef-a3f4-4990-883e-b0af397466d0"},{"attribute_name":"vrra_Internal-Network2_v6_ips","attribute_value":"null"},{"attribute_name":"vrra_ADIG_SRIOV_2_v6_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_2_net_id","attribute_value":"491c7cef-a3f4-4990-883e-b0af397466d0"},{"attribute_name":"vf_module_index","attribute_value":"index"},{"attribute_name":"availability_zone_0","attribute_value":"frkde-esx-az01"}]} + ADIG_SRIOV_2_net_fqdn @@ -126,6 +139,10 @@ vrra_Internal-Network1_v6_ips null + + vrr_image_name + MDT17 + ADIGOam.OAM_net_fqdn @@ -156,9 +173,10 @@ availability_zone_0 - frkde-esx-az01 + nova + testRequestId @@ -166,4 +184,4 @@ testRequestId-1503410089303-1513204371234 http://localhost:28080/mso/WorkflowMesssage/VNFAResponse/testRequestId-1503410089303-1513204371234 - \ No newline at end of file + -- cgit 1.2.3-korg From ac9387ceb0d2a4f1e1dd85be4e6d7818ab83363d Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 25 Apr 2019 11:31:45 +0000 Subject: Fixed issues found in integration testing Issue-ID: SO-1814 Change-Id: Ica6929e10cb40d535657eefc9786090af996ba32 Signed-off-by: MichaelMorris (cherry picked from commit df6508f90ffb0247b94a7357035e36af61b4f207) --- .../mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml | 5 ++ .../mso-vnfm-adapter-ext-clients/pom.xml | 6 +- .../mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml | 6 ++ .../vnfmadapter/VnfmAdapterApplication.java | 5 +- .../vnfmadapter/extclients/SdcPackageProvider.java | 100 ++++++++++----------- .../vnfmadapter/extclients/aai/AaiHelper.java | 11 ++- .../extclients/aai/AaiServiceProvider.java | 4 +- .../extclients/aai/AaiServiceProviderImpl.java | 8 +- .../vnfmadapter/extclients/vnfm/VnfmHelper.java | 36 ++++---- .../extclients/vnfm/VnfmServiceProviderImpl.java | 3 + .../extclients/vnfm/VnfmUrlProvider.java | 4 +- .../vnfmadapter/lifecycle/LifecycleManager.java | 20 +++-- .../notificationhandling/NotificationHandler.java | 20 ++--- .../vnfmadapter/rest/Sol003GrantController.java | 38 +++----- .../src/main/resources/application.yaml | 16 ++++ .../rest/Sol003GrantControllerTest.java | 51 +++++++---- .../vnfmadapter/rest/Sol003LcnControllerTest.java | 72 ++++++++------- .../rest/VnfmAdapterControllerTest.java | 47 +++++----- .../rest/service/HttpRestServiceProviderImpl.java | 2 +- 19 files changed, 256 insertions(+), 198 deletions(-) diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml index 66a1cb1ca7..9d9e33a524 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml @@ -100,5 +100,10 @@ com.google.code.gson gson + + com.squareup.okio + okio + 1.13.0 + diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml index da778d286e..91478e1f8e 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml @@ -62,7 +62,6 @@ org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.api org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model - true src/gen/java/main true true @@ -79,15 +78,16 @@ ${basedir}/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json java - retrofit2 + okhttp-gson ${project.build.directory}/generated-sources/sol003-vnf-grant - false + org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model false src/gen/java/main true true + true diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml index c561721b3e..09c28f93f1 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml @@ -63,6 +63,12 @@ org.springframework.boot spring-boot-starter-web + + + com.fasterxml.jackson.core + jackson-databind + + org.springframework.boot diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java index 30ce0c2253..62d2f7e2a9 100755 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java @@ -20,11 +20,13 @@ package org.onap.so.adapters.vnfmadapter; +import static org.slf4j.LoggerFactory.getLogger; import org.onap.so.adapters.vnfmadapter.rest.VnfmAdapterController; import org.slf4j.Logger; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; -import static org.slf4j.LoggerFactory.getLogger; +import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; /** * The spring boot application for the VNFM (Virtual Network Function Manager) Adapter. @@ -36,6 +38,7 @@ import static org.slf4j.LoggerFactory.getLogger; * SOL003 v2.5.1 */ @SpringBootApplication(scanBasePackages = {"org.onap.so"}) +@EnableAutoConfiguration(exclude = {JacksonAutoConfiguration.class}) public class VnfmAdapterApplication { private static final Logger logger = getLogger(VnfmAdapterApplication.class); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java index f1074bcba8..fd92910e36 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java @@ -22,20 +22,21 @@ package org.onap.so.adapters.vnfmadapter.extclients; +import static com.google.common.base.Splitter.on; +import static com.google.common.collect.Iterables.filter; +import static com.google.common.io.ByteStreams.toByteArray; +import static java.lang.String.format; +import static org.apache.http.HttpHeaders.ACCEPT; +import static org.apache.http.HttpHeaders.AUTHORIZATION; +import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.abortOperation; +import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.child; +import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.childElement; +import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.children; +import static org.slf4j.LoggerFactory.getLogger; +import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE; import com.google.common.io.ByteStreams; import com.google.gson.Gson; import com.google.gson.JsonObject; -import org.apache.commons.codec.binary.Base64; -import org.apache.http.HttpEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.onap.so.utils.CryptoUtils; -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.yaml.snakeyaml.Yaml; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -48,25 +49,24 @@ import java.util.NoSuchElementException; import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import static com.google.common.base.Splitter.on; -import static com.google.common.collect.Iterables.filter; -import static com.google.common.io.ByteStreams.toByteArray; -import static java.lang.String.format; -import static org.apache.http.HttpHeaders.ACCEPT; -import static org.apache.http.HttpHeaders.AUTHORIZATION; -import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.abortOperation; -import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.child; -import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.childElement; -import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.children; -import static org.slf4j.LoggerFactory.getLogger; -import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE; +import org.apache.commons.codec.binary.Base64; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.onap.so.utils.CryptoUtils; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.yaml.snakeyaml.Yaml; @Component public class SdcPackageProvider { - private static final String GET_PACKAGE_URL = "%s/catalog/resources/%s/toscaModel"; + private static final String GET_PACKAGE_URL = "%s/sdc/v1/catalog/resources/%s/toscaModel"; @Value("${sdc.toscametapath:TOSCA-Metadata/TOSCA.meta}") private List toscaMetaPaths; - private final String TOSCA_VNFD_KEY = "Entry-Definitions"; + private static final String TOSCA_VNFD_KEY = "Entry-Definitions"; private static Logger logger = getLogger(SdcPackageProvider.class); @Value("${sdc.username}") @@ -78,7 +78,7 @@ public class SdcPackageProvider { @Value("${sdc.endpoint}") private String baseUrl; - public String getVnfdId(String csarId) { + public String getVnfdId(final String csarId) { return getVnfNodeProperty(csarId, "descriptor_id"); } @@ -96,7 +96,7 @@ public class SdcPackageProvider { for (final JsonObject child : children(nodeTemplates)) { final String type = childElement(child, "type").getAsString(); String propertyValue = null; - if (type.equals("tosca.nodes.nfv.VNF")) { + if ("tosca.nodes.nfv.VNF".equals(type)) { final JsonObject properties = child(child, "properties"); logger.debug("properties: " + properties.toString()); @@ -119,7 +119,7 @@ public class SdcPackageProvider { final JsonObject nodeTypes = child(root, "node_types"); final JsonObject nodeType = child(nodeTypes, nodeTypeName); - if (childElement(nodeType, "derived_from").getAsString().equals("tosca.nodes.nfv.VNF")) { + if ("tosca.nodes.nfv.VNF".equals(childElement(nodeType, "derived_from").getAsString())) { final JsonObject properties = child(nodeType, "properties"); logger.debug("properties: " + properties.toString()); final JsonObject property = child(properties, propertyName); @@ -130,34 +130,33 @@ public class SdcPackageProvider { return null; } - private byte[] getPackage(String csarId) { + private byte[] getPackage(final String csarId) { final String SERVICE_NAME = "vnfm-adapter"; try (CloseableHttpClient client = HttpClients.createDefault()) { - HttpGet httpget = new HttpGet(format(GET_PACKAGE_URL, baseUrl, csarId)); + final HttpGet httpget = new HttpGet(format(GET_PACKAGE_URL, baseUrl, csarId)); httpget.setHeader(ACCEPT, APPLICATION_OCTET_STREAM_VALUE); httpget.setHeader("X-ECOMP-InstanceID", SERVICE_NAME); httpget.setHeader("X-FromAppId", SERVICE_NAME); - String auth = sdcUsername + ":" + CryptoUtils.decrypt(sdcPassword, sdcKey); - byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1)); - String authHeader = "Basic " + new String(encodedAuth); + final String auth = sdcUsername + ":" + CryptoUtils.decrypt(sdcPassword, sdcKey); + final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1)); + final String authHeader = "Basic " + new String(encodedAuth); httpget.setHeader(AUTHORIZATION, authHeader); logger.debug("Fetching from SDC: " + httpget); - CloseableHttpResponse response = client.execute(httpget); - HttpEntity entity = response.getEntity(); - InputStream is = entity.getContent(); - byte[] bytes = toByteArray(is); - return bytes; - } catch (Exception e) { + final CloseableHttpResponse response = client.execute(httpget); + final HttpEntity entity = response.getEntity(); + final InputStream is = entity.getContent(); + return toByteArray(is); + } catch (final Exception e) { throw abortOperation("Unable to download " + csarId + " package from SDC", e); } } - private String getVnfdLocation(InputStream stream) throws IOException { - Iterator pathIterator = toscaMetaPaths.iterator(); + private String getVnfdLocation(final InputStream stream) throws IOException { + final Iterator pathIterator = toscaMetaPaths.iterator(); while (pathIterator.hasNext()) { - String toscaMetadata = new String(getFileInZip(stream, pathIterator.next().toString()).toByteArray()); + final String toscaMetadata = new String(getFileInZip(stream, pathIterator.next()).toByteArray()); if (!toscaMetadata.isEmpty()) { - String toscaVnfdLine = + final String toscaVnfdLine = filter(on("\n").split(toscaMetadata), line -> line.contains(TOSCA_VNFD_KEY)).iterator().next(); return toscaVnfdLine.replace(TOSCA_VNFD_KEY + ":", "").trim(); } @@ -165,20 +164,21 @@ public class SdcPackageProvider { throw abortOperation("Unable to find valid Tosca Path"); } - private static ByteArrayOutputStream getFileInZip(InputStream zip, String path) throws IOException { - ZipInputStream zipInputStream = new ZipInputStream(zip); - ByteArrayOutputStream fileContent = getFileInZip(zipInputStream, path); + private static ByteArrayOutputStream getFileInZip(final InputStream zip, final String path) throws IOException { + final ZipInputStream zipInputStream = new ZipInputStream(zip); + final ByteArrayOutputStream fileContent = getFileInZip(zipInputStream, path); zipInputStream.close(); return fileContent; } - private static ByteArrayOutputStream getFileInZip(ZipInputStream zipInputStream, String path) throws IOException { + private static ByteArrayOutputStream getFileInZip(final ZipInputStream zipInputStream, final String path) + throws IOException { ZipEntry zipEntry; - Set items = new HashSet<>(); + final Set items = new HashSet<>(); while ((zipEntry = zipInputStream.getNextEntry()) != null) { items.add(zipEntry.getName()); if (zipEntry.getName().matches(path)) { - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteStreams.copy(zipInputStream, byteArrayOutputStream); return byteArrayOutputStream; } @@ -187,7 +187,7 @@ public class SdcPackageProvider { throw new NoSuchElementException("Unable to find the " + path + " in archive found: " + items); } - public String getFlavourId(String csarId) { + public String getFlavourId(final String csarId) { return getVnfNodeProperty(csarId, "flavour_id"); } } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java index 50fd5bcf3a..867b6522f5 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java @@ -20,6 +20,9 @@ package org.onap.so.adapters.vnfmadapter.extclients.aai; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import org.onap.aai.domain.yang.EsrSystemInfo; import org.onap.aai.domain.yang.EsrSystemInfoList; import org.onap.aai.domain.yang.EsrVnfm; @@ -40,9 +43,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; /** * Provides helper methods for interactions with AAI. @@ -257,7 +257,12 @@ public class AaiHelper { relationship.setRelatedTo("tenant"); relationship.setRelatedLink("/aai/" + AAIVersion.LATEST + AAIUriFactory.createResourceUri(AAIObjectType.TENANT, tenant.getCloudOwner(), tenant.getRegionName(), tenant.getTenantId()).build().toString()); + relationship.getRelationshipData() + .add(createRelationshipData("cloud-region.cloud-owner", tenant.getCloudOwner())); + relationship.getRelationshipData() + .add(createRelationshipData("cloud-region.cloud-region-id", tenant.getRegionName())); relationship.getRelationshipData().add(createRelationshipData("tenant.tenant-id", tenant.getTenantId())); return relationship; } + } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java index f991ffafba..7021c02511 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java @@ -24,9 +24,9 @@ import org.onap.aai.domain.yang.EsrSystemInfoList; import org.onap.aai.domain.yang.EsrVnfm; import org.onap.aai.domain.yang.EsrVnfmList; import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Vserver; import org.onap.vnfmadapter.v1.model.Tenant; -import java.util.List; /** * Provides methods for invoking REST calls to AAI. @@ -47,7 +47,7 @@ public interface AaiServiceProvider { * @param selfLink the selfLink * @return the matching generic vnfs */ - List invokeQueryGenericVnf(final String selfLink); + GenericVnfs invokeQueryGenericVnf(final String selfLink); /** * Invoke a GET request for the VNFMs. diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java index fa07ab5720..50e579dd83 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java @@ -24,6 +24,7 @@ import org.onap.aai.domain.yang.EsrSystemInfoList; import org.onap.aai.domain.yang.EsrVnfm; import org.onap.aai.domain.yang.EsrVnfmList; import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Vserver; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.uri.AAIUriFactory; @@ -32,7 +33,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; @Service public class AaiServiceProviderImpl implements AaiServiceProvider { @@ -56,9 +56,9 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { } @Override - public List invokeQueryGenericVnf(final String selfLink) { + public GenericVnfs invokeQueryGenericVnf(final String selfLink) { return aaiClientProvider.getAaiClient() - .get(List.class, + .get(GenericVnfs.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam("selflink", selfLink)) .orElseGet(() -> { logger.debug("No vnf found in AAI with selflink: {}", selfLink); @@ -104,7 +104,7 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { @Override public void invokePutVserver(final String cloudOwner, final String cloudRegion, final String tenant, final Vserver vserver) { - aaiClientProvider.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, + aaiClientProvider.getAaiClient().create(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenant, vserver.getVserverId()), vserver); } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java index 31399f7720..249cf74cb2 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java @@ -20,10 +20,16 @@ package org.onap.so.adapters.vnfmadapter.extclients.vnfm; +import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL; +import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import java.security.GeneralSecurityException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.onap.aai.domain.yang.EsrSystemInfo; import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider; import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo; @@ -40,7 +46,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilte import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilterVnfInstanceSubscriptionFilter; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo; -import org.onap.so.security.WebSecurityConfig; +import org.onap.so.utils.CryptoUtils; import org.onap.vnfmadapter.v1.model.CreateVnfRequest; import org.onap.vnfmadapter.v1.model.ExternalVirtualLink; import org.onap.vnfmadapter.v1.model.Tenant; @@ -49,11 +55,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL; -import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT; /** * Provides helper methods for interactions with VNFM. @@ -64,15 +65,19 @@ public class VnfmHelper { private static final Logger logger = LoggerFactory.getLogger(VnfmHelper.class); private static final String SEPARATOR = "_"; private final AaiServiceProvider aaiServiceProvider; - private final WebSecurityConfig webSecurityConfig; @Value("${vnfmadapter.endpoint}") private String vnfmAdapterEndoint; + @Value("${vnfmadapter.auth:E39823AAB2739CC654C4E92B52C05BC34149342D0A46451B00CA508C8EDC62242CE4E9DA9445D3C01A3F13}") + private String vnfmAdapterAuth; + + @Value("${mso.key}") + private String msoEncryptionKey; + @Autowired - public VnfmHelper(final AaiServiceProvider aaiServiceProvider, final WebSecurityConfig webSecurityConfig) { + public VnfmHelper(final AaiServiceProvider aaiServiceProvider) { this.aaiServiceProvider = aaiServiceProvider; - this.webSecurityConfig = webSecurityConfig; } /** @@ -171,8 +176,10 @@ public class VnfmHelper { * * @param the ID of the VNF notifications are required for * @return the request + * @throws GeneralSecurityException */ - public LccnSubscriptionRequest createNotificationSubscriptionRequest(final String vnfId) { + public LccnSubscriptionRequest createNotificationSubscriptionRequest(final String vnfId) + throws GeneralSecurityException { final LccnSubscriptionRequest lccnSubscriptionRequest = new LccnSubscriptionRequest(); lccnSubscriptionRequest.setAuthentication(getSubscriptionsAuthentication()); lccnSubscriptionRequest.setCallbackUri(vnfmAdapterEndoint + BASE_URL + OPERATION_NOTIFICATION_ENDPOINT); @@ -186,12 +193,11 @@ public class VnfmHelper { return lccnSubscriptionRequest; } - private SubscriptionsAuthentication getSubscriptionsAuthentication() { + private SubscriptionsAuthentication getSubscriptionsAuthentication() throws GeneralSecurityException { final SubscriptionsAuthenticationParamsBasic basicAuthParams = new SubscriptionsAuthenticationParamsBasic(); - basicAuthParams.setUserName("vnfm"); - basicAuthParams.setPassword(webSecurityConfig.getUsercredentials().stream() - .filter(userCredentials -> "vnfm".equals(userCredentials.getUsername())).findFirst().get() - .getPassword()); + final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":"); + basicAuthParams.setUserName(decrypedAuth[0]); + basicAuthParams.setPassword(decrypedAuth[1]); final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication(); authentication.addAuthTypeItem(AuthTypeEnum.BASIC); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java index 951c6f187b..645f37e72f 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java @@ -84,10 +84,12 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider { @Override public InlineResponse2001 subscribeForNotifications(final String vnfmId, final LccnSubscriptionRequest subscriptionRequest) { + logger.info("Subscribing for notifications {}", subscriptionRequest); final String url = urlProvider.getSubscriptionsUrl(vnfmId); ResponseEntity response = null; try { response = httpServiceProvider.postHttpRequest(subscriptionRequest, url, InlineResponse2001.class); + logger.info("Subscribing for notifications response {}", response); } catch (final Exception exception) { final String errorMessage = "Subscription to VNFM " + vnfmId + " resulted in exception" + subscriptionRequest; @@ -146,6 +148,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider { @Override public Optional createVnf(final String vnfmId, final CreateVnfRequest createVnfRequest) { final String url = urlProvider.getCreationUrl(vnfmId); + logger.debug("Sending create request {} to : {}", createVnfRequest, url); try { return httpServiceProvider.post(createVnfRequest, url, InlineResponse201.class); } catch (final Exception exception) { diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java index d4aa65d159..f948f3cfac 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java @@ -20,6 +20,8 @@ package org.onap.so.adapters.vnfmadapter.extclients.vnfm; +import static org.slf4j.LoggerFactory.getLogger; +import java.net.URI; import org.onap.aai.domain.yang.EsrSystemInfo; import org.onap.aai.domain.yang.EsrSystemInfoList; import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider; @@ -28,8 +30,6 @@ import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.util.UriComponentsBuilder; -import java.net.URI; -import static org.slf4j.LoggerFactory.getLogger; /** * Provides URLs for REST calls to a VNFM. diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java index e6b787bacc..32bb9b93a4 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java @@ -21,6 +21,7 @@ package org.onap.so.adapters.vnfmadapter.lifecycle; import com.google.common.base.Optional; +import java.util.Map; import org.onap.aai.domain.yang.EsrVnfm; import org.onap.aai.domain.yang.GenericVnf; import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider; @@ -46,7 +47,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Map; /** * Manages lifecycle operations towards the VNFMs. @@ -64,7 +64,7 @@ public class LifecycleManager { @Autowired LifecycleManager(final AaiServiceProvider aaiServiceProvider, final AaiHelper aaiHelper, final VnfmHelper vnfmHelper, final VnfmServiceProvider vnfmServiceProvider, final JobManager jobManager, - SdcPackageProvider packageProvider) { + final SdcPackageProvider packageProvider) { this.aaiServiceProvider = aaiServiceProvider; this.vnfmServiceProvider = vnfmServiceProvider; this.aaiHelper = aaiHelper; @@ -90,7 +90,11 @@ public class LifecycleManager { aaiHelper.addRelationshipFromGenericVnfToVnfm(genericVnf, vnfm.getVnfmId()); } aaiHelper.addRelationshipFromGenericVnfToTenant(genericVnf, request.getTenant()); - InlineResponse201 vnfmResponse = sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm.getVnfmId()); + final InlineResponse201 vnfmResponse = + sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm.getVnfmId()); + + logger.info("Create response: {}", vnfmResponse); + genericVnf.setSelflink(vnfmResponse.getLinks().getSelf().getHref()); aaiServiceProvider.invokePutGenericVnf(genericVnf); final String vnfIdInVnfm = vnfmResponse.getId(); @@ -135,18 +139,18 @@ public class LifecycleManager { } } - private InlineResponse201 sendCreateRequestToVnfm(CreateVnfRequest aaiRequest, GenericVnf genericVnf, - String vnfIdInAai, String vnfmId) { + private InlineResponse201 sendCreateRequestToVnfm(final CreateVnfRequest aaiRequest, final GenericVnf genericVnf, + final String vnfIdInAai, final String vnfmId) { logger.debug("Sending a create request to SVNFM " + aaiRequest); - org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest vnfmRequest = + final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest vnfmRequest = new org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest(); - String vnfdId = packageProvider.getVnfdId(genericVnf.getModelVersionId()); + final String vnfdId = packageProvider.getVnfdId(genericVnf.getModelVersionId()); vnfmRequest.setVnfdId(vnfdId); vnfmRequest.setVnfInstanceName(aaiRequest.getName().replaceAll(" ", "_")); vnfmRequest.setVnfInstanceDescription(vnfIdInAai); - Optional optionalResponse = vnfmServiceProvider.createVnf(vnfmId, vnfmRequest); + final Optional optionalResponse = vnfmServiceProvider.createVnf(vnfmId, vnfmRequest); try { return optionalResponse.get(); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java index a339b9be70..d39a2cb761 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java @@ -20,6 +20,10 @@ package org.onap.so.adapters.vnfmadapter.notificationhandling; +import static org.slf4j.LoggerFactory.getLogger; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.json.JSONException; import org.json.JSONObject; import org.onap.aai.domain.yang.GenericVnf; @@ -36,10 +40,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo; import org.onap.so.adapters.vnfmadapter.jobmanagement.JobManager; import org.slf4j.Logger; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.slf4j.LoggerFactory.getLogger; /** * Performs updates to AAI based on a received notification. The updates are executed in a separate thread so as the @@ -93,8 +93,8 @@ public class NotificationHandler implements Runnable { } private void handleVnfInstantiateCompleted() { - final GenericVnf genericVnf = - aaiServiceProvider.invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).get(0); + final GenericVnf genericVnf = aaiServiceProvider + .invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0); setOamIpAddress(genericVnf, vnfInstance); genericVnf.setOrchestrationStatus("Created"); @@ -141,16 +141,16 @@ public class NotificationHandler implements Runnable { } private void handleVnfTerminateFailed() { - final GenericVnf genericVnf = - aaiServiceProvider.invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).get(0); + final GenericVnf genericVnf = aaiServiceProvider + .invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0); updateVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), vnfInstance.getVimConnectionInfo()); jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getId(), false); } private void handleVnfTerminateCompleted() { - final GenericVnf genericVnf = - aaiServiceProvider.invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).get(0); + final GenericVnf genericVnf = aaiServiceProvider + .invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0); updateVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), vnfInstance.getVimConnectionInfo()); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java index 6b8802eed2..e241d0de7e 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java @@ -20,6 +20,11 @@ package org.onap.so.adapters.vnfmadapter.rest; +import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import javax.ws.rs.core.MediaType; import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper; import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHelper; @@ -36,15 +41,10 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -import javax.ws.rs.core.MediaType; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL; +import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping(value = BASE_URL, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) @@ -52,9 +52,6 @@ public class Sol003GrantController { private static final String SEPARATOR = "_"; private static final String VIM_TYPE = "OPENSTACK"; - private static final String CLOUD_OWNER = "myTestCloudOwner"; - private static final String REGION = "myTestRegion"; - private static final String TENANT_ID = "myTestTenantId"; private static final Logger logger = LoggerFactory.getLogger(Sol003GrantController.class); public final AaiServiceProvider aaiServiceProvider; public final AaiHelper aaiHelper; @@ -71,7 +68,7 @@ public class Sol003GrantController { @GetMapping(value = "/grants/{grantId}") public ResponseEntity grantsGrantIdGet(@PathVariable("grantId") final String grantId) { logger.info("Get grant received from VNFM, grant id: " + grantId); - return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @PostMapping(value = "/grants") @@ -80,7 +77,7 @@ public class Sol003GrantController { final InlineResponse201 grantResponse = createGrantResponse(grantRequest); logger.info("Grant request returning to VNFM: " + grantResponse); - return new ResponseEntity(grantResponse, HttpStatus.CREATED); + return new ResponseEntity<>(grantResponse, HttpStatus.CREATED); } private InlineResponse201 createGrantResponse(final GrantRequest grantRequest) { @@ -88,8 +85,9 @@ public class Sol003GrantController { grantResponse.setId(UUID.randomUUID().toString()); grantResponse.setVnfInstanceId(grantRequest.getVnfInstanceId()); grantResponse.setVnfLcmOpOccId(grantRequest.getVnfLcmOpOccId()); - final Tenant tenant = - aaiHelper.getAssignedTenant(aaiServiceProvider.invokeGetGenericVnf((grantRequest.getVnfInstanceId()))); + final String vnfSelfLink = grantRequest.getLinks().getVnfInstance().getHref(); + final Tenant tenant = aaiHelper + .getAssignedTenant(aaiServiceProvider.invokeQueryGenericVnf(vnfSelfLink).getGenericVnf().get(0)); String vimConnectionId = ""; final InlineResponse201VimConnections vimConnection = vnfmHelper.getVimConnections(tenant); @@ -104,14 +102,6 @@ public class Sol003GrantController { return grantResponse; } - private InlineResponse201VimConnections getVimConnectionsItem(final Tenant tenant) { - final InlineResponse201VimConnections vimConnection = new InlineResponse201VimConnections(); - vimConnection.setId(createVimConnectionId(tenant.getCloudOwner(), tenant.getRegionName())); - vimConnection.setVimId(vimConnection.getId()); - vimConnection.setVimType(VIM_TYPE); - return vimConnection; - } - private List getResources(final List requestResources, final String vimId) { final List resources = new ArrayList<>(); @@ -123,8 +113,4 @@ public class Sol003GrantController { } return resources; } - - private String createVimConnectionId(String cloudOwner, String cloudRegionId) { - return cloudOwner + SEPARATOR + cloudRegionId; - } } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml index 4fb110349d..951d4a3bb9 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml @@ -11,6 +11,19 @@ # 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. +spring: + security: + usercredentials: + - username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPEL-Client + - username: vnfm + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + http: + converters: + preferred-json-mapper: gson + server: port: 9092 tomcat: @@ -29,6 +42,9 @@ sdc: password: sdcPassword key: adadadadad endpoint: http://sdc.onap/1234A + +vnfmadapter: + endpoint: http://so-vnfm-adapter.onap:9092 #Actuator management: diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java index b7f5e96eab..4af0da1485 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java @@ -20,7 +20,14 @@ package org.onap.so.adapters.vnfmadapter.rest; -import com.google.gson.Gson; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.junit.Before; @@ -30,6 +37,7 @@ import org.mockito.hamcrest.MockitoHamcrest; import org.onap.aai.domain.yang.EsrSystemInfo; import org.onap.aai.domain.yang.EsrSystemInfoList; import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipData; import org.onap.aai.domain.yang.RelationshipList; @@ -38,6 +46,8 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest.OperationEnum; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources.TypeEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinks; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinksVnfLcmOpOcc; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections; import org.onap.so.client.aai.AAIResourcesClient; @@ -54,12 +64,6 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.web.client.RestTemplate; -import java.util.Optional; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; @RunWith(SpringRunner.class) @SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @@ -84,7 +88,6 @@ public class Sol003GrantControllerTest { @Autowired private Sol003GrantController controller; - private final Gson gson = new Gson(); @Before public void setUp() throws Exception { @@ -94,17 +97,17 @@ public class Sol003GrantControllerTest { @Test public void grantRequest_ValidRequestInstantiate_GrantApproved() { - GrantRequest grantRequest = createGrantRequest("INSTANTIATE"); + final GrantRequest grantRequest = createGrantRequest("INSTANTIATE"); setUpGenericVnfWithVnfmRelationshipInMockAai("vnfmType", "vnfm1"); final ResponseEntity response = controller.grantsPost(grantRequest); assertEquals(HttpStatus.CREATED, response.getStatusCode()); assertEquals(1, response.getBody().getAddResources().size()); assertEquals(vimConnectionId, response.getBody().getAddResources().get(0).getVimConnectionId()); - assertEquals("myTestVnfId", response.getBody().getVnfInstanceId()); + assertEquals("myTestVnfIdOnVnfm", response.getBody().getVnfInstanceId()); assertEquals("123456", response.getBody().getVnfLcmOpOccId()); - InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0); + final InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0); assertEquals(vimConnectionId, vimConnections.getVimId()); assertEquals("OPENSTACK", vimConnections.getVimType()); assertNotNull(vimConnections.getAccessInfo()); @@ -120,17 +123,17 @@ public class Sol003GrantControllerTest { @Test public void grantRequest_ValidRequestTerminate_GrantApproved() { - GrantRequest grantRequest = createGrantRequest("TERMINATE"); + final GrantRequest grantRequest = createGrantRequest("TERMINATE"); setUpGenericVnfWithVnfmRelationshipInMockAai("vnfmType", "vnfm1"); final ResponseEntity response = controller.grantsPost(grantRequest); assertEquals(HttpStatus.CREATED, response.getStatusCode()); assertEquals(1, response.getBody().getAddResources().size()); assertEquals(vimConnectionId, response.getBody().getAddResources().get(0).getVimConnectionId()); - assertEquals("myTestVnfId", response.getBody().getVnfInstanceId()); + assertEquals("myTestVnfIdOnVnfm", response.getBody().getVnfInstanceId()); assertEquals("123456", response.getBody().getVnfLcmOpOccId()); - InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0); + final InlineResponse201VimConnections vimConnections = response.getBody().getVimConnections().get(0); assertEquals(vimConnectionId, vimConnections.getVimId()); assertEquals("OPENSTACK", vimConnections.getVimType()); assertNotNull(vimConnections.getAccessInfo()); @@ -139,19 +142,21 @@ public class Sol003GrantControllerTest { } - private GrantRequest createGrantRequest(String operation) { - GrantRequest grantRequest = new GrantRequest(); - grantRequest.setVnfInstanceId("myTestVnfId"); + private GrantRequest createGrantRequest(final String operation) { + final GrantRequest grantRequest = new GrantRequest(); + grantRequest.setVnfInstanceId("myTestVnfIdOnVnfm"); grantRequest.setVnfLcmOpOccId("123456"); + grantRequest.links(new GrantsLinks() + .vnfInstance(new GrantsLinksVnfLcmOpOcc().href("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm"))); if (operation == "INSTANTIATE") { grantRequest.setOperation(OperationEnum.INSTANTIATE); - GrantsAddResources resource = new GrantsAddResources(); + final GrantsAddResources resource = new GrantsAddResources(); resource.setId("123"); resource.setType(TypeEnum.COMPUTE); grantRequest.addAddResourcesItem(resource); } else if (operation == "TERMINATE") { grantRequest.setOperation(OperationEnum.TERMINATE); - GrantsAddResources resource = new GrantsAddResources(); + final GrantsAddResources resource = new GrantsAddResources(); resource.setId("123"); resource.setType(TypeEnum.COMPUTE); grantRequest.addRemoveResourcesItem(resource); @@ -210,6 +215,14 @@ public class Sol003GrantControllerTest { doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class), MockitoHamcrest.argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId"))); + + final List listOfGenericVnfs = new ArrayList<>(); + listOfGenericVnfs.add(genericVnf); + final GenericVnfs genericVnfs = new GenericVnfs(); + genericVnfs.getGenericVnf().addAll(listOfGenericVnfs); + doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class), + MockitoHamcrest.argThat(new AaiResourceUriMatcher( + "/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm"))); } private class AaiResourceUriMatcher extends BaseMatcher { diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java index 66e8e99f72..822201ea1c 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java @@ -20,7 +20,25 @@ package org.onap.so.adapters.vnfmadapter.rest; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; import com.google.gson.Gson; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.inject.Inject; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.junit.Before; @@ -29,6 +47,7 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.hamcrest.MockitoHamcrest; import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.Vserver; import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication; @@ -64,24 +83,6 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.web.client.RestTemplate; -import javax.inject.Inject; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.timeout; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.verify; -import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; @RunWith(SpringRunner.class) @SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @@ -166,9 +167,11 @@ public class Sol003LcnControllerTest { .andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON)); final GenericVnf genericVnf = createGenericVnf("vnfmType1"); - final List genericVnfs = new ArrayList<>(); - genericVnfs.add(genericVnf); - doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(List.class), + final List listOfGenericVnfs = new ArrayList<>(); + listOfGenericVnfs.add(genericVnf); + final GenericVnfs genericVnfs = new GenericVnfs(); + genericVnfs.getGenericVnf().addAll(listOfGenericVnfs); + doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class), MockitoHamcrest.argThat(new AaiResourceUriMatcher( "/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm"))); @@ -176,23 +179,27 @@ public class Sol003LcnControllerTest { controller.lcnVnfLcmOperationOccurrenceNotificationPost(vnfLcmOperationOccurrenceNotification); assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode()); - final ArgumentCaptor bodyArgument = ArgumentCaptor.forClass(Object.class); - final ArgumentCaptor uriArgument = ArgumentCaptor.forClass(AAIResourceUri.class); + final ArgumentCaptor bodyArgument1 = ArgumentCaptor.forClass(Object.class); + final ArgumentCaptor uriArgument1 = ArgumentCaptor.forClass(AAIResourceUri.class); - verify(aaiResourcesClient, timeout(1000).times(2)).update(uriArgument.capture(), bodyArgument.capture()); + verify(aaiResourcesClient, timeout(1000)).update(uriArgument1.capture(), bodyArgument1.capture()); assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId", - uriArgument.getAllValues().get(0).build().toString()); - final GenericVnf updatedGenericVnf = (GenericVnf) bodyArgument.getAllValues().get(0); + uriArgument1.getAllValues().get(0).build().toString()); + final GenericVnf updatedGenericVnf = (GenericVnf) bodyArgument1.getAllValues().get(0); assertEquals("10.10.10.10", updatedGenericVnf.getIpv4OamAddress()); assertEquals("Created", updatedGenericVnf.getOrchestrationStatus()); + final ArgumentCaptor bodyArgument2 = ArgumentCaptor.forClass(Object.class); + final ArgumentCaptor uriArgument2 = ArgumentCaptor.forClass(AAIResourceUri.class); + verify(aaiResourcesClient, timeout(1000)).create(uriArgument2.capture(), bodyArgument2.capture()); + assertEquals( "/cloud-infrastructure/cloud-regions/cloud-region/" + CLOUD_OWNER + "/" + REGION + "/tenants/tenant/" + TENANT_ID + "/vservers/vserver/myVnfc1", - uriArgument.getAllValues().get(1).build().toString()); + uriArgument2.getAllValues().get(0).build().toString()); - final Vserver vserver = (Vserver) bodyArgument.getAllValues().get(1); + final Vserver vserver = (Vserver) bodyArgument2.getAllValues().get(0); assertEquals("myVnfc1", vserver.getVserverId()); final Relationship relationship = vserver.getRelationshipList().getRelationship().get(0); assertEquals("generic-vnf", relationship.getRelatedTo()); @@ -218,9 +225,12 @@ public class Sol003LcnControllerTest { final GenericVnf genericVnf = createGenericVnf("vnfmType1"); genericVnf.setSelflink("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm"); - final List genericVnfs = new ArrayList<>(); - genericVnfs.add(genericVnf); - doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(List.class), + final List listOfGenericVnfs = new ArrayList<>(); + listOfGenericVnfs.add(genericVnf); + final GenericVnfs genericVnfs = new GenericVnfs(); + genericVnfs.getGenericVnf().addAll(listOfGenericVnfs); + + doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class), MockitoHamcrest.argThat(new AaiResourceUriMatcher( "/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm"))); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java index 20a074b2ba..73a49e9c40 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java @@ -20,7 +20,21 @@ package org.onap.so.adapters.vnfmadapter.rest; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; +import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.content; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withBadRequest; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; import com.google.gson.Gson; +import java.net.URI; +import java.util.Optional; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.junit.Before; @@ -36,24 +50,23 @@ import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipData; import org.onap.aai.domain.yang.RelationshipList; +import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication; +import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201Links; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201LinksSelf; +import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.vnfmadapter.v1.model.CreateVnfRequest; import org.onap.vnfmadapter.v1.model.CreateVnfResponse; import org.onap.vnfmadapter.v1.model.DeleteVnfResponse; import org.onap.vnfmadapter.v1.model.OperationEnum; import org.onap.vnfmadapter.v1.model.OperationStateEnum; import org.onap.vnfmadapter.v1.model.QueryJobResponse; -import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication; -import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*; -import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.vnfmadapter.v1.model.CreateVnfRequest; import org.onap.vnfmadapter.v1.model.Tenant; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; @@ -72,18 +85,6 @@ import org.springframework.web.client.RestTemplate; import org.threeten.bp.LocalDateTime; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.ZoneOffset; -import java.net.URI; -import java.util.Optional; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.verify; -import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.content; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.*; @RunWith(SpringRunner.class) @SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @@ -131,7 +132,7 @@ public class VnfmAdapterControllerTest { setUpVimInMockAai(); final String expectedsubscriptionRequest = - "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"BASIC\"],\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke\"}}}"; + "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"BASIC\"],\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"password1$\"}}}"; final InlineResponse2001 subscriptionResponse = new InlineResponse2001(); final InlineResponse201 createResponse = createCreateResponse(); diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java index 8e6ebab43a..a627e82802 100644 --- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java +++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java @@ -96,7 +96,7 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { private Optional createOptional(final ResponseEntity response, final String url, final HttpMethod httpMethod) { - if (!response.getStatusCode().equals(HttpStatus.OK)) { + if (!response.getStatusCode().equals(HttpStatus.OK) && !response.getStatusCode().equals(HttpStatus.CREATED)) { final String message = "Unable to invoke HTTP " + httpMethod + " using URL: " + url + ", Response Code: " + response.getStatusCode(); LOGGER.error(message); -- cgit 1.2.3-korg From 3d74a5add7424aa490f70e2a4453048028f5d882 Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Wed, 1 May 2019 23:07:07 -0700 Subject: Fixup handling of multicloud post response Make the handling of the multicloud post response more flexible. Add additional parameters that may come back. Change-Id: I0a5c7016f11dbfe832c81e2fcafc398a998b622b Issue-ID: SO-1833 Signed-off-by: Eric Multanen --- .../openstack/utils/MulticloudCreateResponse.java | 42 +++++++++++++--- .../utils/MulticloudCreateStackResponse.java | 57 ---------------------- .../vnf/MsoVnfMulticloudAdapterImplTest.java | 47 +++++++++++++++++- .../__files/MulticloudResponse_Stack_Create2.json | 15 ++++++ 4 files changed, 96 insertions(+), 65 deletions(-) delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack_Create2.json diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java index bb15e58c88..732f9b5196 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java @@ -22,13 +22,16 @@ package org.onap.so.openstack.utils; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.JsonNode; import org.apache.commons.lang.builder.ToStringBuilder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"template_type", "workload_id", "template_response"}) +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonPropertyOrder({"template_type", "workload_id", "template_response", "workload_status_reason", "workload_status"}) public class MulticloudCreateResponse implements Serializable { private final static long serialVersionUID = -5215028275577848311L; @@ -37,12 +40,16 @@ public class MulticloudCreateResponse implements Serializable { @JsonProperty("workload_id") private String workloadId; @JsonProperty("template_response") - private MulticloudCreateStackResponse templateResponse; + private JsonNode templateResponse; + @JsonProperty("workload_status_reason") + private JsonNode workloadStatusReason; + @JsonProperty("workload_status") + private String workloadStatus; @JsonCreator public MulticloudCreateResponse(@JsonProperty("template_type") String templateType, @JsonProperty("workload_id") String workloadId, - @JsonProperty("template_response") MulticloudCreateStackResponse templateResponse) { + @JsonProperty("template_response") JsonNode templateResponse) { this.templateType = templateType; this.workloadId = workloadId; this.templateResponse = templateResponse; @@ -69,18 +76,41 @@ public class MulticloudCreateResponse implements Serializable { } @JsonProperty("template_response") - public void setTemplateResponse(MulticloudCreateStackResponse templateResponse) { + public void setTemplateResponse(JsonNode templateResponse) { this.templateResponse = templateResponse; } @JsonProperty("template_response") - public MulticloudCreateStackResponse getTemplateResponse() { + public JsonNode getTemplateResponse() { return templateResponse; } + @JsonProperty("workload_status_reason") + public void setWorkloadStatusReason(JsonNode workloadStatusReason) { + this.workloadStatusReason = workloadStatusReason; + } + + @JsonProperty("workload_status_reason") + public JsonNode getWorkloadStatusReason() { + return workloadStatusReason; + } + + @JsonProperty("workload_status") + public String getWorkloadSstatus() { + return workloadStatus; + } + + @JsonProperty("workload_status") + public void setWorkloadStatus(String workloadStatus) { + this.workloadStatus = workloadStatus; + } + + @Override public String toString() { return new ToStringBuilder(this).append("templateType", templateType).append("workloadId", workloadId) - .append("templateResponse", templateResponse).toString(); + .append("templateResponse", templateResponse) + .append("workload_status_reason", workloadStatusReason.toString()) + .append("workload_status", workloadStatus).toString(); } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java deleted file mode 100644 index 67cb73539d..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.openstack.utils; - -import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"stack"}) -public class MulticloudCreateStackResponse implements Serializable { - private final static long serialVersionUID = -5215028275577848311L; - - @JsonProperty("stack") - private MulticloudCreateHeatResponse stack; - - @JsonCreator - public MulticloudCreateStackResponse(@JsonProperty("stack") MulticloudCreateHeatResponse stack) { - this.stack = stack; - } - - @JsonProperty("stack") - public MulticloudCreateHeatResponse getStack() { - return stack; - } - - @JsonProperty("stack") - public void setStack(MulticloudCreateHeatResponse stack) { - this.stack = stack; - } - - @Override - public String toString() { - return new ToStringBuilder(this).append("stack", stack).toString(); - } -} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java index 5f2057524f..48ca0fd79c 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java @@ -55,8 +55,6 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils { @Autowired private CloudConfig cloudConfig; - private static final String CREATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": " - + "\"workload-id\", \"template_response\": {\"stack\": {\"id\": \"TEST-stack\", \"links\": []}}}"; private static final String UPDATE_STACK_RESPONSE = "{\"template_type\": \"heat\", \"workload_id\": " + "\"workload-id\"}"; private static final String GET_CREATE_STACK_RESPONSE = "{\"template_type\": \"heat\", \"workload_id\": " @@ -124,6 +122,51 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils { wireMockServer.resetScenarios(); } + @Test + public void createVfModule2() throws Exception { + + Map stackInputs = new HashMap<>(); + stackInputs.put("oof_directives", "{}"); + stackInputs.put("sdnc_directives", "{}"); + stackInputs.put("user_directives", "{}"); + stackInputs.put("generic_vnf_id", "genVNFID"); + stackInputs.put("vf_module_id", "vfMODULEID"); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_NAME)).willReturn( + aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); + + wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE") + .whenScenarioStateIs("CREATING").willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(GET_CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE") + .whenScenarioStateIs("UPDATING").willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(GET_UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE") + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("MulticloudResponse_Stack_Create2.json").withStatus(HttpStatus.SC_CREATED)) + .willSetStateTo("CREATING")); + + wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH)) + .inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_ACCEPTED)) + .willSetStateTo("UPDATING")); + + try { + instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", + "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, + msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + } catch (VnfException e) { + fail("createVfModule success expected, failed with exception: " + e.toString()); + } + wireMockServer.resetScenarios(); + } + @Test public void createVfModuleAlreadyExists() throws Exception { diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack_Create2.json b/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack_Create2.json new file mode 100644 index 0000000000..8532fae97c --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack_Create2.json @@ -0,0 +1,15 @@ +{ + "template_type": "HEAT", + "workload_id": "workload-id", + "workload_status_reason": + { + "id": "workload-id", + "links": [ + { + "href": "http://localhost:1234/v1/id12345678/stacks/workload-id/abcdef00-1234-abcd-5678-ef9123456789", + "rel": "self" + } + ] + }, + "workload_status": "CREATE_IN_PROGRESS" +} -- cgit 1.2.3-korg From fa628a82ce084a70db99df70e7d7273044963d8d Mon Sep 17 00:00:00 2001 From: Lathish Date: Fri, 26 Apr 2019 08:46:13 +0000 Subject: VNFM simulator implementation for instantiate flow Issue-ID: SO-1773 Change-Id: I710fe6905d650df29f7550f4eafde2f672301bc4 Signed-off-by: Lathish (cherry picked from commit c0b9d01cbc3a3d3b1ce32178394e8fd74a10de65) --- vnfm-simulator/vnf-service/pom.xml | 78 ------ .../simulator/controller/SvnfmController.java | 69 ----- .../simulator/controller/SvnfmHealthcheck.java | 58 ---- .../exception/GlobalExceptionHandler.java | 27 -- .../exception/InvalidRestRequestException.java | 37 --- .../exception/RestProcessingException.java | 37 --- .../svnfm/simulator/services/SvnfmService.java | 60 ----- .../src/main/resources/json/createVNFResponse.json | 19 -- vnfm-simulator/vnfm-service/pom.xml | 261 ++++++++++-------- .../svnfm/simulator/config/ApplicationConfig.java | 43 +++ .../svnfm/simulator/config/SvnfmApplication.java | 6 +- .../simulator/config/WebSecurityConfigImpl.java | 48 ++++ .../onap/svnfm/simulator/constants/Constant.java | 8 +- .../simulator/controller/SvnfmController.java | 121 +++++---- .../org/onap/svnfm/simulator/model/VnfJob.java | 73 ----- .../onap/svnfm/simulator/model/VnfOperation.java | 80 ++++++ .../java/org/onap/svnfm/simulator/model/Vnfds.java | 97 +++++++ .../simulator/repository/VnfJobRepository.java | 33 --- .../repository/VnfOperationRepository.java | 33 +++ .../simulator/repository/VnfmCacheRepository.java | 31 ++- .../simulator/services/OperationProgressor.java | 296 +++++++++++++++++++++ .../simulator/services/SubscriptionService.java | 21 ++ .../svnfm/simulator/services/SvnfmService.java | 148 ++++++----- .../onap/svnfm/simulator/services/VnfmHelper.java | 39 ++- .../src/main/resources/application.properties | 13 - .../src/main/resources/application.yaml | 59 ++++ .../simulator/controllers/TestSvnfmController.java | 17 +- 27 files changed, 1053 insertions(+), 759 deletions(-) delete mode 100644 vnfm-simulator/vnf-service/pom.xml delete mode 100644 vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java delete mode 100644 vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmHealthcheck.java delete mode 100644 vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/GlobalExceptionHandler.java delete mode 100644 vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/InvalidRestRequestException.java delete mode 100644 vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/RestProcessingException.java delete mode 100644 vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java delete mode 100644 vnfm-simulator/vnf-service/src/main/resources/json/createVNFResponse.json create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/WebSecurityConfigImpl.java delete mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/VnfJob.java create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/VnfOperation.java create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/Vnfds.java delete mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfJobRepository.java create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfOperationRepository.java create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SubscriptionService.java delete mode 100644 vnfm-simulator/vnfm-service/src/main/resources/application.properties create mode 100644 vnfm-simulator/vnfm-service/src/main/resources/application.yaml diff --git a/vnfm-simulator/vnf-service/pom.xml b/vnfm-simulator/vnf-service/pom.xml deleted file mode 100644 index 9a6825cf43..0000000000 --- a/vnfm-simulator/vnf-service/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - 4.0.0 - - org.onap.vnfm - vnfm-simulator - 0.0.1-SNAPSHOT - - vnf-service - - - - UTF-8 - 1.8 - - - - - - org.onap.vnfm - vnfm-api - ${project.version} - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-test - test - - - junit - junit - test - - - io.swagger - swagger-jaxrs - 1.5.0 - - - org.apache.directory.studio - org.apache.commons.io - 2.4 - - - com.googlecode.json-simple - json-simple - 1.1.1 - - - - io.springfox - springfox-swagger-ui - 2.6.1 - compile - - - io.springfox - springfox-swagger2 - 2.6.1 - compile - - - com.fasterxml.jackson.core - jackson-databind - 2.9.8 - - - - \ No newline at end of file diff --git a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java b/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java deleted file mode 100644 index b9703b3a13..0000000000 --- a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.svnfm.simulator.controller; - -import javax.ws.rs.core.MediaType; - -import org.onap.svnfm.simulator.services.SvnfmService; -import org.onap.vnfm.v1.model.CreateVnfRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -/** - * This class contains the VNF life cycle management operations - * - * @author ronan.kenny@est.tech - * - */ - -/** - * TO DO - * - * Implement Exception handling Implement VNFM adaptor call Identify the Create - * VNF response Test itwith the VNFM Adaptor - */ - -@RestController -@RequestMapping("/svnfm") - -public class SvnfmController { - - @Autowired - private SvnfmService svnfmService; - - private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmController.class); - - @RequestMapping(method = RequestMethod.POST, value = "/vnf_instances") - public ResponseEntity createVNFInstance(@RequestBody final CreateVnfRequest createVNFRequest) { - LOGGER.info("Start createVNFInstance"); - HttpHeaders headers = new HttpHeaders(); - headers.add("Content-Type", MediaType.APPLICATION_JSON); - return new ResponseEntity<>(svnfmService.createVNF(), headers, HttpStatus.CREATED); - } -} diff --git a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmHealthcheck.java b/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmHealthcheck.java deleted file mode 100644 index e6f55f6c5d..0000000000 --- a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmHealthcheck.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.svnfm.simulator.controller; - -import org.onap.svnfm.simulator.exception.InvalidRestRequestException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - - -/** - * TO DO - * - * Implement Exception handling - * Implement VNFM adaptor call - * Identify the Create VNF response - * Test it with the VNFM Adaptor - */ - -@RestController -@RequestMapping("/svnfm") -public class SvnfmHealthcheck { - - private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmHealthcheck.class); - - @RequestMapping(method = RequestMethod.GET, value = "/healthcheck") - public ResponseEntity healthCheck() { - try { - return new ResponseEntity<>(HttpStatus.OK); - } catch (final InvalidRestRequestException extensions) { - final String message = "Not Found"; - LOGGER.error(message); - return new ResponseEntity<>(message, HttpStatus.NOT_FOUND); - } - } -} diff --git a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/GlobalExceptionHandler.java b/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/GlobalExceptionHandler.java deleted file mode 100644 index a06f2d22ad..0000000000 --- a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/GlobalExceptionHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.onap.svnfm.simulator.exception; - -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.http.converter.HttpMessageNotReadableException; -import org.springframework.web.HttpMediaTypeNotSupportedException; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.context.request.WebRequest; -import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; - -@ControllerAdvice -public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { - @Override - protected ResponseEntity handleHttpMessageNotReadable(HttpMessageNotReadableException ex, - HttpHeaders headers, HttpStatus status, WebRequest request) { - String error = "Malformed JSON request"; - return new ResponseEntity<>(error, HttpStatus.BAD_REQUEST); - } - - @Override - protected ResponseEntity handleHttpMediaTypeNotSupported(HttpMediaTypeNotSupportedException ex, - HttpHeaders headers, HttpStatus status, WebRequest request) { - String error = "Media type Not Supported"; - return new ResponseEntity<>(error, HttpStatus.UNSUPPORTED_MEDIA_TYPE); - } -} diff --git a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/InvalidRestRequestException.java b/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/InvalidRestRequestException.java deleted file mode 100644 index eabd4ec414..0000000000 --- a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/InvalidRestRequestException.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.svnfm.simulator.exception; - -/** - * @author ronan.kenny@est.tech - * - */ -public class InvalidRestRequestException extends RuntimeException { - - private static final long serialVersionUID = 3977807111893986938L; - - public InvalidRestRequestException(final String message) { - super(message); - } - - public InvalidRestRequestException(final String message, final Throwable cause) { - super(message, cause); - } -} diff --git a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/RestProcessingException.java b/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/RestProcessingException.java deleted file mode 100644 index c84416e245..0000000000 --- a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/exception/RestProcessingException.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.svnfm.simulator.exception; - -/** - * @author ronan.kenny@est.tech - * - */ -public class RestProcessingException extends RuntimeException { - - private static final long serialVersionUID = 16862313537198441L; - - public RestProcessingException(final String message) { - super(message); - } - - public RestProcessingException(final String message, final Throwable cause) { - super(message, cause); - } -} diff --git a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java b/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java deleted file mode 100644 index e2dc43a24b..0000000000 --- a/vnfm-simulator/vnf-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.svnfm.simulator.services; - -import java.io.IOException; - -import org.apache.commons.io.IOUtils; -import org.onap.svnfm.simulator.notifications.VnfmAdapterCreationNotification; -import org.onap.vnfm.v1.model.InlineResponse201; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * This class handles the logic of VNF lifecycle - * - * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) - * - */ -@Service -public class SvnfmService { - - /** - * This method read the create VNF response from the json file and return it - * to the VNFM Adaptor - * - * @return - */ - public InlineResponse201 createVNF() { - Thread creationNodtification = new Thread(new VnfmAdapterCreationNotification()); - creationNodtification.start(); - ObjectMapper mapper = new ObjectMapper(); - InlineResponse201 inlineResponse201 = null; - try { - inlineResponse201 = mapper.readValue( - IOUtils.toString(getClass().getClassLoader().getResource("json/createVNFResponse.json")), - InlineResponse201.class); - } catch (IOException e) { - e.printStackTrace(); - } - return inlineResponse201; - } -} diff --git a/vnfm-simulator/vnf-service/src/main/resources/json/createVNFResponse.json b/vnfm-simulator/vnf-service/src/main/resources/json/createVNFResponse.json deleted file mode 100644 index a66bcc1334..0000000000 --- a/vnfm-simulator/vnf-service/src/main/resources/json/createVNFResponse.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "id": "147d9468-4646-11e9-80af-fa163e169afd", - "vnfInstanceName": "MME85_8.EricssonMMEVSPV2_0", - "vnfInstanceDescription": "2f3e21dd-99ba-45b1-b4da-1f71283c46f6", - "vnfdId": "sgsn-mme_onapmme01_cxp9025898_4r85d01", - "vnfProvider": "Ericsson", - "vnfProductName": "SGSN-MME", - "vnfSoftwareVersion": "1.24 (CXS101289_R85D01)", - "vnfdVersion": "onapmme01_cxp9025898_4r85d01", - "vnfPkgId": null, - "vnfConfigurableProperties": null, - "vimConnectionInfo": null, - "instantiationState": "NOT_INSTANTIATED", - "instantiatedVnfInfo": null, - "metadata": null, - "extensions": null, - "links": null - -} diff --git a/vnfm-simulator/vnfm-service/pom.xml b/vnfm-simulator/vnfm-service/pom.xml index 3f4f4512b3..380381f53b 100644 --- a/vnfm-simulator/vnfm-service/pom.xml +++ b/vnfm-simulator/vnfm-service/pom.xml @@ -1,116 +1,149 @@ - - 4.0.0 - - org.onap.so.vnfm - vnfm-simulator - 1.4.0-SNAPSHOT - - vnfm-service - ${project.artifactId} + + 4.0.0 + + org.onap.so.vnfm + vnfm-simulator + 1.4.0-SNAPSHOT + + vnfm-service + ${project.artifactId} - - UTF-8 - 1.8 - - - - org.onap.so.vnfm - vnfm-api - ${project.version} - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.boot - spring-boot-devtools - runtime - - - junit - junit - test - - - io.swagger - swagger-jaxrs - 1.5.0 - - - org.apache.directory.studio - org.apache.commons.io - 2.4 - - - com.googlecode.json-simple - json-simple - 1.1.1 - + + UTF-8 + 1.8 + 2.7.5 + 2.8.1 + + + + org.onap.so.adapters + mso-vnfm-adapter-ext-clients + ${project.version} + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-devtools + runtime + + + junit + junit + test + + + io.swagger + swagger-jaxrs + 1.5.0 + + + org.apache.directory.studio + org.apache.commons.io + 2.4 + + + com.googlecode.json-simple + json-simple + 1.1.1 + - - io.springfox - springfox-swagger-ui - 2.6.1 - compile - - - io.springfox - springfox-swagger2 - 2.6.1 - compile - - - com.fasterxml.jackson.core - jackson-databind - 2.9.8 - - - com.h2database - h2 - - - - commons-beanutils - commons-beanutils - 1.9.3 - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${springboot.version} - - org.onap.svnfm.simulator.config.SvnfmApplication - - - - - repackage - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - \ No newline at end of file + + io.springfox + springfox-swagger-ui + 2.6.1 + compile + + + io.springfox + springfox-swagger2 + 2.6.1 + compile + + + com.fasterxml.jackson.core + jackson-databind + 2.9.8 + + + com.h2database + h2 + + + + commons-beanutils + commons-beanutils + 1.9.3 + + + org.modelmapper + modelmapper + 2.3.0 + + + com.squareup.okio + okio + 1.13.0 + + + com.squareup.okhttp + okhttp + ${okhttp-version} + + + com.squareup.okhttp + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + org.onap.so + common + ${project.version} + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${springboot.version} + + org.onap.svnfm.simulator.config.SvnfmApplication + + + + + repackage + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java new file mode 100644 index 0000000000..91b79754a5 --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java @@ -0,0 +1,43 @@ +package org.onap.svnfm.simulator.config; + +import java.net.InetAddress; +import java.util.Arrays; +import org.onap.svnfm.simulator.constants.Constant; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.concurrent.ConcurrentMapCache; +import org.springframework.cache.support.SimpleCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class ApplicationConfig implements ApplicationRunner { + + private static final String PORT = "local.server.port"; + + @Autowired + private Environment environment; + + private String baseUrl; + + @Override + public void run(final ApplicationArguments args) throws Exception { + baseUrl = "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + environment.getProperty(PORT); + } + + public String getBaseUrl() { + return baseUrl; + } + + @Bean + public CacheManager cacheManager() { + Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE); + SimpleCacheManager manager = new SimpleCacheManager(); + manager.setCaches(Arrays.asList(inlineResponse201)); + return manager; + } +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java index 84b45d0bac..723ae906e6 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java @@ -20,6 +20,7 @@ package org.onap.svnfm.simulator.config; +import org.onap.svnfm.simulator.controller.SvnfmController; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; @@ -27,7 +28,10 @@ import org.springframework.cache.annotation.EnableCaching; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; /** - * + * The spring boot application for the VNF LCM. + *

+ * The VNFM receives requests through its REST API {@link SvnfmController} + * * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) * @author ronan.kenny@est.tech */ diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/WebSecurityConfigImpl.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/WebSecurityConfigImpl.java new file mode 100644 index 0000000000..18eadd2fc3 --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/WebSecurityConfigImpl.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.svnfm.simulator.config; + +import org.onap.so.security.MSOSpringFirewall; +import org.onap.so.security.WebSecurityConfig; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.firewall.StrictHttpFirewall; + +/** + * Configure the web security for the application. + */ +@EnableWebSecurity +public class WebSecurityConfigImpl extends WebSecurityConfig { + + @Override + protected void configure(final HttpSecurity http) throws Exception { + http.csrf().disable().authorizeRequests().antMatchers("/**").permitAll(); + } + + @Override + public void configure(final WebSecurity web) throws Exception { + super.configure(web); + final StrictHttpFirewall firewall = new MSOSpringFirewall(); + web.httpFirewall(firewall); + } + +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/constants/Constant.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/constants/Constant.java index bd380903d5..98f47bf455 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/constants/Constant.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/constants/Constant.java @@ -27,9 +27,13 @@ package org.onap.svnfm.simulator.constants; */ public class Constant { + public static final String BASE_URL = "/vnflcm/v1"; public static final String VNF_PROVIDER = "XYZ"; - public static final String VNF_PROVIDER_NAME = "SGSN-MME"; + public static final String VNF_PROVIDER_NAME = "vCPE"; public static final String VNF_SOFTWARE_VERSION = "1.24"; - public static final String VNFD_VERSION = "onapmme01_cxp9025898_4r85d01"; + public static final String VNFD_VERSION = "onapvcpe01_cxp9025898_4r85d01"; public static final String VNF_NOT_INSTANTIATED = "NOT_INSTANTIATED"; + public static final String VNF_CONFIG_PROPERTIES = + "{\"isAutoScaleEnabled\": \"true\",\"isAutoHealingEnabled\": \"true\"}"; + public static final String IN_LINE_RESPONSE_201_CACHE = "inlineResponse201"; } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java index 11099a24fc..e6bc06374c 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java @@ -22,30 +22,37 @@ package org.onap.svnfm.simulator.controller; import java.util.UUID; import javax.ws.rs.core.MediaType; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest; +import org.onap.svnfm.simulator.constants.Constant; import org.onap.svnfm.simulator.repository.VnfmCacheRepository; import org.onap.svnfm.simulator.services.SvnfmService; -import org.onap.vnfm.v1.model.CreateVnfRequest; -import org.onap.vnfm.v1.model.InlineResponse201; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; /** - * + * * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) * @author Ronan Kenny (ronan.kenny@est.tech) */ @RestController -@RequestMapping("/svnfm") +@RequestMapping(path = Constant.BASE_URL, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) public class SvnfmController { @Autowired @@ -57,25 +64,30 @@ public class SvnfmController { private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmController.class); /** - * - * @param createVNFRequest - * @return + * To create the Vnf and stores the response in cache + * + * @param CreateVnfRequest + * @return InlineResponse201 */ - @RequestMapping(method = RequestMethod.POST, value = "/vnf_instances") + @PostMapping(value = "/vnf_instances") public ResponseEntity createVnf(@RequestBody final CreateVnfRequest createVNFRequest) { - LOGGER.info("Start createVnf------"); + LOGGER.info("Start createVnf {}", createVNFRequest); + final String id = UUID.randomUUID().toString(); final HttpHeaders headers = new HttpHeaders(); - headers.add("Content-Type", MediaType.APPLICATION_JSON); - return new ResponseEntity<>(vnfmCacheRepository.createVnf(createVNFRequest), headers, HttpStatus.CREATED); + headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + final ResponseEntity responseEntity = + new ResponseEntity<>(vnfmCacheRepository.createVnf(createVNFRequest, id), headers, HttpStatus.CREATED); + LOGGER.info("Finished create {}", responseEntity); + return responseEntity; } /** - * + * Get the vnf by id from cache + * * @param vnfId - * @return vnfm cache repository + * @return InlineResponse201 */ - @RequestMapping(method = RequestMethod.GET, value = "/vnf_instances/{vnfInstanceId}", - produces = MediaType.APPLICATION_JSON) + @GetMapping(value = "/vnf_instances/{vnfInstanceId}") @ResponseStatus(code = HttpStatus.OK) public InlineResponse201 getVnf(@PathVariable("vnfInstanceId") final String vnfId) { LOGGER.info("Start getVnf------"); @@ -83,42 +95,29 @@ public class SvnfmController { } /** - * + * To instantiate the vnf and returns the operation id + * * @param vnfId - * @return response entity * @throws InterruptedException */ - @RequestMapping(method = RequestMethod.POST, value = "/vnf_instances/{vnfInstanceId}/instantiate") - public ResponseEntity instantiateVnf(@PathVariable("vnfInstanceId") final String vnfId) - throws InterruptedException { - LOGGER.info("Start instantiateVNFRequest"); - final String instantiateJobId = UUID.randomUUID().toString(); - final HttpHeaders headers = new HttpHeaders(); - headers.add("Content-Type", MediaType.APPLICATION_JSON); - headers.add("Location", instantiateJobId); - return new ResponseEntity<>(svnfmService.instatiateVnf(vnfId, instantiateJobId), headers, HttpStatus.ACCEPTED); - } + @PostMapping(value = "/vnf_instances/{vnfInstanceId}/instantiate") + public ResponseEntity instantiateVnf(@PathVariable("vnfInstanceId") final String vnfId, + @RequestBody final InstantiateVnfRequest instantiateVNFRequest) { + LOGGER.info("Start instantiateVNFRequest {} ", instantiateVNFRequest); - /** - * - * @param jobId - * @return response entity - * @throws InterruptedException - */ - public ResponseEntity getJobStatus(@PathVariable("jobId") final String jobId) throws InterruptedException { - LOGGER.info("Start getJobStatus"); final HttpHeaders headers = new HttpHeaders(); - headers.add("Content-Type", MediaType.APPLICATION_JSON); - return new ResponseEntity<>(svnfmService.getJobStatus(jobId), headers, HttpStatus.ACCEPTED); + headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + headers.add(HttpHeaders.LOCATION, svnfmService.instantiateVnf(vnfId, instantiateVNFRequest)); + return new ResponseEntity<>(headers, HttpStatus.ACCEPTED); } /** - * + * To delete the vnf by id + * * @param vnfId - * @return delete VNF + * @return InlineResponse201 */ - @RequestMapping(method = RequestMethod.DELETE, value = "/vnf_instances/{vnfInstanceId}", - produces = MediaType.APPLICATION_JSON) + @DeleteMapping(value = "/vnf_instances/{vnfInstanceId}") @ResponseStatus(code = HttpStatus.OK) public InlineResponse201 deleteVnf(@PathVariable("vnfInstanceId") final String vnfId) { LOGGER.info("Start deleting Vnf------"); @@ -126,17 +125,45 @@ public class SvnfmController { } /** - * + * To terminate the vnf by id + * * @param vnfId - * @return response entity * @throws InterruptedException */ - @RequestMapping(method = RequestMethod.POST, value = "/vnf_instances/{vnfInstanceId}/terminate") - public ResponseEntity terminateVnf(@PathVariable("vnfInstanceId") final String vnfId) - throws InterruptedException { + @PostMapping(value = "/vnf_instances/{vnfInstanceId}/terminate") + public ResponseEntity terminateVnf(@PathVariable("vnfInstanceId") final String vnfId) { LOGGER.info("Start terminateVNFRequest"); final HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", MediaType.APPLICATION_JSON); return new ResponseEntity<>(svnfmService.terminateVnf(vnfId), headers, HttpStatus.ACCEPTED); } + + + /** + * To get the status of the operation by id + * + * @param operationId + * @return response entity + * @throws InterruptedException + */ + @GetMapping(value = "/vnf_lcm_op_occs/{vnfLcmOpOccId}") + public ResponseEntity getOperationStatus( + @PathVariable("vnfLcmOpOccId") final String operationId) { + LOGGER.info("Start getOperationStatus"); + final HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Type", MediaType.APPLICATION_JSON); + return new ResponseEntity<>(svnfmService.getOperationStatus(operationId), headers, HttpStatus.OK); + } + + @PostMapping(value = "/subscriptions") + public ResponseEntity subscribeForNotifications( + @RequestBody final LccnSubscriptionRequest lccnSubscriptionRequest) { + LOGGER.info("Subscription request received: {}", lccnSubscriptionRequest); + svnfmService.registerSubscription(lccnSubscriptionRequest); + final InlineResponse2001 response = new InlineResponse2001(); + + final HttpHeaders headers = new HttpHeaders(); + headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + return new ResponseEntity<>(response, headers, HttpStatus.OK); + } } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/VnfJob.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/VnfJob.java deleted file mode 100644 index 575223c700..0000000000 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/VnfJob.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.svnfm.simulator.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * - * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) - * @author Ronan Kenny (ronan.kenny@est.tech) - */ -@Entity -@Table(name = "VNF_JOB") -public class VnfJob { - @Id - @Column(name = "jobId", nullable = false) - private String jobId; - private String vnfInstanceId; - private String vnfId; - private String status; - - public String getJobId() { - return jobId; - } - - public void setJobId(final String jobId) { - this.jobId = jobId; - } - - public String getVnfInstanceId() { - return vnfInstanceId; - } - - public void setVnfInstanceId(final String vnfInstanceId) { - this.vnfInstanceId = vnfInstanceId; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(final String vnfId) { - this.vnfId = vnfId; - } - - public String getStatus() { - return status; - } - - public void setStatus(final String status) { - this.status = status; - } -} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/VnfOperation.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/VnfOperation.java new file mode 100644 index 0000000000..c37f433668 --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/VnfOperation.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.svnfm.simulator.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.Table; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; + +/** + * + * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) + * @author Ronan Kenny (ronan.kenny@est.tech) + */ +@Entity +@Table(name = "VNF_OPERATION") +public class VnfOperation { + @Id + @Column(name = "operationId", nullable = false) + private String id; + private String vnfInstanceId; + + @Enumerated(EnumType.STRING) + private InlineResponse200.OperationEnum operation; + + @Enumerated(EnumType.STRING) + private InlineResponse200.OperationStateEnum operationState; + + public String getId() { + return id; + } + + public void setId(final String id) { + this.id = id; + } + + public String getVnfInstanceId() { + return vnfInstanceId; + } + + public void setVnfInstanceId(final String vnfInstanceId) { + this.vnfInstanceId = vnfInstanceId; + } + + public InlineResponse200.OperationEnum getOperation() { + return operation; + } + + public void setOperation(final InlineResponse200.OperationEnum operation) { + this.operation = operation; + } + + public InlineResponse200.OperationStateEnum getOperationState() { + return operationState; + } + + public void setOperationState(final InlineResponse200.OperationStateEnum operationState) { + this.operationState = operationState; + } +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/Vnfds.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/Vnfds.java new file mode 100644 index 0000000000..ea171f0fce --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/model/Vnfds.java @@ -0,0 +1,97 @@ +package org.onap.svnfm.simulator.model; + +import java.util.List; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@ConfigurationProperties(prefix = "vnfds") +@Component +public class Vnfds { + + private List vnfdList; + + public static class Vnfd { + + private String vnfdId; + private List vnfclist; + + + public String getVnfdId() { + return vnfdId; + } + + public void setVnfdId(final String vnfdId) { + this.vnfdId = vnfdId; + } + + public List getVnfcList() { + return vnfclist; + } + + public void setVnfcList(final List vnfclist) { + this.vnfclist = vnfclist; + } + } + + + public static class Vnfc { + + private String vnfcId; + private String type; + private String vduId; + private String resourceTemplateId; + private String grantResourceId; + + public String getVnfcId() { + return vnfcId; + } + + public void setVnfcId(final String vnfcId) { + this.vnfcId = vnfcId; + } + + public String getVduId() { + return vduId; + } + + public void setVduId(final String vduId) { + this.vduId = vduId; + } + + public String getType() { + return type; + } + + public void setType(final String type) { + this.type = type; + } + + public String getResourceTemplateId() { + return resourceTemplateId; + } + + public void setResourceTemplateId(final String resourceTemplateId) { + this.resourceTemplateId = resourceTemplateId; + } + + public String getGrantResourceId() { + return grantResourceId; + } + + public void setGrantResourceId(final String grantResourceId) { + this.grantResourceId = grantResourceId; + } + + } + + + public List getVnfdList() { + return vnfdList; + } + + + public void setVnfdList(final List vnfdList) { + this.vnfdList = vnfdList; + } + +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfJobRepository.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfJobRepository.java deleted file mode 100644 index b3b39bfdf1..0000000000 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfJobRepository.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.svnfm.simulator.repository; - -import org.onap.svnfm.simulator.model.VnfJob; -import org.springframework.data.repository.CrudRepository; - -/** - * - * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) - * @author Ronan Kenny (ronan.kenny@est.tech) - */ -public interface VnfJobRepository extends CrudRepository { - -} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfOperationRepository.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfOperationRepository.java new file mode 100644 index 0000000000..43c201734f --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfOperationRepository.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.svnfm.simulator.repository; + +import org.onap.svnfm.simulator.model.VnfOperation; +import org.springframework.data.repository.CrudRepository; + +/** + * + * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) + * @author Ronan Kenny (ronan.kenny@est.tech) + */ +public interface VnfOperationRepository extends CrudRepository { + +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java index e41cbe1e3a..030b073da4 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java @@ -20,15 +20,21 @@ package org.onap.svnfm.simulator.repository; +import java.util.List; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo; +import org.onap.svnfm.simulator.constants.Constant; import org.onap.svnfm.simulator.services.SvnfmService; -import org.onap.vnfm.v1.model.CreateVnfRequest; -import org.onap.vnfm.v1.model.InlineResponse201; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Repository; /** - * + * * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) * @author Ronan Kenny (ronan.kenny@est.tech) */ @@ -38,12 +44,21 @@ public class VnfmCacheRepository { @Autowired private SvnfmService svnfmService; - @Cacheable(value = "inlineResponse201", key = "#createVnfRequest.vnfdId") - public InlineResponse201 createVnf(final CreateVnfRequest createVnfRequest) { - return svnfmService.createVnf(createVnfRequest); + @Cacheable(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id") + public InlineResponse201 createVnf(final CreateVnfRequest createVnfRequest, final String id) { + return svnfmService.createVnf(createVnfRequest, id); + } + + @CachePut(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id") + public InlineResponse201 updateVnf(final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo, final String id, + final List vimConnectionInfo) { + final InlineResponse201 vnf = getVnf(id); + vnf.setInstantiatedVnfInfo(instantiatedVnfInfo); + vnf.setInstantiationState(InstantiationStateEnum.INSTANTIATED); + vnf.setVimConnectionInfo(vimConnectionInfo); + return vnf; } - @Cacheable(value = "inlineResponse201", key = "#id") public InlineResponse201 getVnf(final String id) { return svnfmService.getVnf(id); } @@ -52,7 +67,7 @@ public class VnfmCacheRepository { * @param vnfId * @return */ - public InlineResponse201 deleteVnf(String vnfId) { + public InlineResponse201 deleteVnf(final String vnfId) { // TODO return null; } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java new file mode 100644 index 0000000000..d231e1b098 --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java @@ -0,0 +1,296 @@ +package org.onap.svnfm.simulator.services; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import javax.ws.rs.core.MediaType; +import org.apache.commons.codec.binary.Base64; +import org.modelmapper.ModelMapper; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiResponse; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources.TypeEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinks; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinksVnfLcmOpOcc; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201AddResources; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.ApiClient; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.ApiException; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.api.DefaultApi; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinks; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.NotificationStatusEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.NotificationTypeEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoResourceHandle; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic; +import org.onap.svnfm.simulator.config.ApplicationConfig; +import org.onap.svnfm.simulator.model.VnfOperation; +import org.onap.svnfm.simulator.model.Vnfds; +import org.onap.svnfm.simulator.model.Vnfds.Vnfc; +import org.onap.svnfm.simulator.model.Vnfds.Vnfd; +import org.onap.svnfm.simulator.repository.VnfOperationRepository; +import org.onap.svnfm.simulator.repository.VnfmCacheRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OperationProgressor implements Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(OperationProgressor.class); + private final VnfOperation operation; + private final VnfmCacheRepository vnfRepository; + private final VnfOperationRepository vnfOperationRepository; + private final ApplicationConfig applicationConfig; + private final Vnfds vnfds; + private final SubscriptionService subscriptionService; + private final DefaultApi notificationClient; + private final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi grantClient; + + public OperationProgressor(final VnfOperation operation, final VnfmCacheRepository vnfRepository, + final VnfOperationRepository vnfOperationRepository, final ApplicationConfig applicationConfig, + final Vnfds vnfds, final SubscriptionService subscriptionService) { + this.operation = operation; + this.vnfRepository = vnfRepository; + this.vnfOperationRepository = vnfOperationRepository; + this.applicationConfig = applicationConfig; + this.vnfds = vnfds; + this.subscriptionService = subscriptionService; + + final ApiClient apiClient = new ApiClient(); + String callBackUrl = subscriptionService.getSubscriptions().iterator().next().getCallbackUri(); + callBackUrl = callBackUrl.substring(0, callBackUrl.indexOf("/lcn/")); + apiClient.setBasePath(callBackUrl); + notificationClient = new DefaultApi(apiClient); + + final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient grantApiClient = + new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient(); + grantApiClient.setBasePath(callBackUrl); + grantClient = new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi(grantApiClient); + } + + @Override + public void run() { + try { + final VnfLcmOperationOccurrenceNotification notificationOfStarting = + buildNotification(NotificationStatusEnum.START, OperationStateEnum.STARTING); + sendNotification(notificationOfStarting); + + sleep(2000); + setState(InlineResponse200.OperationStateEnum.PROCESSING); + final VnfLcmOperationOccurrenceNotification notificationOfProcessing = + buildNotification(NotificationStatusEnum.START, OperationStateEnum.PROCESSING); + sendNotification(notificationOfProcessing); + + + final GrantRequest grantRequest = buildGrantRequest(); + final InlineResponse201 grantResponse = sendGrantRequest(grantRequest); + final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo = createInstantiatedVnfInfo(grantResponse); + vnfRepository.updateVnf(instantiatedVnfInfo, operation.getVnfInstanceId(), + getVimConnections(grantResponse)); + + sleep(10000); + setState(InlineResponse200.OperationStateEnum.COMPLETED); + final VnfLcmOperationOccurrenceNotification notificationOfCompleted = + buildNotification(NotificationStatusEnum.RESULT, OperationStateEnum.COMPLETED); + notificationOfCompleted.setAffectedVnfcs(getVnfcs(instantiatedVnfInfo.getVnfcResourceInfo())); + + sendNotification(notificationOfCompleted); + } catch (final Exception exception) { + LOGGER.error("Error in OperationProgressor ", exception); + } + + } + + private void sleep(final long milliSeconds) { + try { + Thread.sleep(milliSeconds); + } catch (final InterruptedException e) { + operation.setOperationState(InlineResponse200.OperationStateEnum.FAILED); + } + } + + private void setState(final InlineResponse200.OperationStateEnum state) { + LOGGER.info("Setting state to {} for operation {}", state, operation.getId()); + operation.setOperationState(state); + vnfOperationRepository.save(operation); + } + + private VnfLcmOperationOccurrenceNotification buildNotification(final NotificationStatusEnum status, + final OperationStateEnum operationState) { + final VnfLcmOperationOccurrenceNotification notification = new VnfLcmOperationOccurrenceNotification(); + notification.setId(UUID.randomUUID().toString()); + notification.setNotificationType(NotificationTypeEnum.VNFLCMOPERATIONOCCURRENCENOTIFICATION); + notification.setNotificationStatus(status); + notification.setOperationState(operationState); + notification.setOperation(OperationEnum.fromValue(operation.getOperation().toString())); + notification.setVnfInstanceId(operation.getVnfInstanceId()); + + final LcnVnfLcmOperationOccurrenceNotificationLinks links = new LcnVnfLcmOperationOccurrenceNotificationLinks(); + final LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance vnfInstanceLink = + new LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance(); + vnfInstanceLink.setHref(getVnfLink()); + links.setVnfInstance(vnfInstanceLink); + + + final LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance operationLink = + new LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance(); + operationLink.setHref(getOperationLink()); + links.setVnfLcmOpOcc(operationLink); + + notification.setLinks(links); + + return notification; + } + + private List getVnfcs( + final List instantiatedVnfcs) { + final List vnfcs = new ArrayList<>(); + for (final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo instantiatedVnfc : instantiatedVnfcs) { + LOGGER.info("VNFC TO BE CONVERTED: {}", instantiatedVnfc); + final ModelMapper mapper = new ModelMapper(); + final LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs vnfc = + mapper.map(instantiatedVnfc, LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.class); + LOGGER.info("VNFC FROM CONVERSION: {}", vnfc); + vnfc.setChangeType(ChangeTypeEnum.ADDED); + vnfcs.add(vnfc); + } + return vnfcs; + } + + private void sendNotification(final VnfLcmOperationOccurrenceNotification notification) { + LOGGER.info("Sending notification: {}", notification); + try { + final SubscriptionsAuthenticationParamsBasic subscriptionAuthentication = + subscriptionService.getSubscriptions().iterator().next().getAuthentication().getParamsBasic(); + final String auth = + subscriptionAuthentication.getUserName() + ":" + subscriptionAuthentication.getPassword(); + final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1)); + final String authHeader = "Basic " + new String(encodedAuth); + notificationClient.lcnVnfLcmOperationOccurrenceNotificationPostWithHttpInfo(notification, + MediaType.APPLICATION_JSON, authHeader); + } catch (final ApiException exception) { + LOGGER.error("Error sending notification: " + notification, exception); + } + } + + + public GrantRequest buildGrantRequest() { + final GrantRequest grantRequest = new GrantRequest(); + grantRequest.setVnfInstanceId(operation.getVnfInstanceId()); + final String vnfdId = vnfRepository.getVnf(operation.getVnfInstanceId()).getVnfdId(); + grantRequest.setVnfdId(vnfdId); + grantRequest.setAddResources(getAddResources(vnfdId)); + grantRequest.setVnfLcmOpOccId(operation.getId()); + grantRequest + .setOperation(org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest.OperationEnum + .fromValue(operation.getOperation().getValue())); + grantRequest.setIsAutomaticInvocation(false); + + final GrantsLinksVnfLcmOpOcc vnfInstanceLink = new GrantsLinksVnfLcmOpOcc(); + vnfInstanceLink.setHref(getVnfLink()); + final GrantsLinksVnfLcmOpOcc operationInstanceLink = new GrantsLinksVnfLcmOpOcc(); + operationInstanceLink.setHref(getOperationLink()); + final GrantsLinks links = new GrantsLinks(); + links.setVnfInstance(vnfInstanceLink); + links.setVnfLcmOpOcc(operationInstanceLink); + grantRequest.setLinks(links); + return grantRequest; + } + + private List getAddResources(final String vnfdId) { + final List resources = new ArrayList<>(); + + for (final Vnfd vnfd : vnfds.getVnfdList()) { + if (vnfd.getVnfdId().equals(vnfdId)) { + for (final Vnfc vnfc : vnfd.getVnfcList()) { + final GrantsAddResources addResource = new GrantsAddResources(); + vnfc.setGrantResourceId(UUID.randomUUID().toString()); + addResource.setId(vnfc.getGrantResourceId()); + addResource.setType(TypeEnum.fromValue(vnfc.getType())); + addResource.setResourceTemplateId(vnfc.getResourceTemplateId()); + addResource.setVduId(vnfc.getVduId()); + resources.add(addResource); + } + } + } + return resources; + } + + private InlineResponse201 sendGrantRequest(final GrantRequest grantRequest) { + LOGGER.info("Sending grant request: {}", grantRequest); + try { + final ApiResponse response = grantClient.grantsPostWithHttpInfo(grantRequest, + MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, "Basic dm5mbTpwYXNzd29yZDEk"); + LOGGER.info("Grant Response: {}", response); + return response.getData(); + } catch (final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiException exception) { + LOGGER.error("Error sending notification: " + grantRequest, exception); + return null; + } + } + + private InlineResponse201InstantiatedVnfInfo createInstantiatedVnfInfo(final InlineResponse201 grantResponse) { + final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo = new InlineResponse201InstantiatedVnfInfo(); + + final Map mapOfGrantResourceIdToVimConnectionId = new HashMap<>(); + for (final InlineResponse201AddResources addResource : grantResponse.getAddResources()) { + mapOfGrantResourceIdToVimConnectionId.put(addResource.getResourceDefinitionId(), + addResource.getVimConnectionId()); + } + + for (final Vnfd vnfd : vnfds.getVnfdList()) { + if (vnfd.getVnfdId().equals(vnfRepository.getVnf(operation.getVnfInstanceId()).getVnfdId())) { + for (final Vnfc vnfc : vnfd.getVnfcList()) { + final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo vnfcResourceInfoItem = + new InlineResponse201InstantiatedVnfInfoVnfcResourceInfo(); + vnfcResourceInfoItem.setId(vnfc.getVnfcId()); + vnfcResourceInfoItem.setVduId(vnfc.getVduId()); + final InlineResponse201InstantiatedVnfInfoResourceHandle computeResource = + new InlineResponse201InstantiatedVnfInfoResourceHandle(); + computeResource.setResourceId(UUID.randomUUID().toString()); + computeResource + .setVimConnectionId(mapOfGrantResourceIdToVimConnectionId.get(vnfc.getGrantResourceId())); + computeResource.setVimLevelResourceType("OS::Nova::Server"); + vnfcResourceInfoItem.setComputeResource(computeResource); + instantiatedVnfInfo.addVnfcResourceInfoItem(vnfcResourceInfoItem); + } + } + } + + return instantiatedVnfInfo; + } + + private List getVimConnections(final InlineResponse201 grantResponse) { + final List vimConnectionInfo = new ArrayList<>(); + for (final InlineResponse201VimConnections vimConnection : grantResponse.getVimConnections()) { + final ModelMapper modelMapper = new ModelMapper(); + vimConnectionInfo.add(modelMapper.map(vimConnection, InlineResponse201VimConnectionInfo.class)); + } + return vimConnectionInfo; + } + + private String getVnfLink() { + return getLinkBaseUrl() + "/vnf_instances/" + operation.getVnfInstanceId(); + } + + private String getOperationLink() { + return getLinkBaseUrl() + "/vnf_lcm_op_occs/" + operation.getId(); + } + + private String getLinkBaseUrl() { + return applicationConfig.getBaseUrl() + "/vnflcm/v1"; + } + +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SubscriptionService.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SubscriptionService.java new file mode 100644 index 0000000000..6a2340bdf6 --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SubscriptionService.java @@ -0,0 +1,21 @@ +package org.onap.svnfm.simulator.services; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest; +import org.springframework.stereotype.Service; + +@Service +public class SubscriptionService { + + Collection subscriptions = new ArrayList<>(); + + public void registerSubscription(final LccnSubscriptionRequest subscription) { + subscriptions.add(subscription); + } + + public Collection getSubscriptions() { + return Collections.unmodifiableCollection(subscriptions); + } +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java index f7f4eaa4a2..cac5075682 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java @@ -21,22 +21,35 @@ package org.onap.svnfm.simulator.services; import java.lang.reflect.InvocationTargetException; -import java.util.Optional; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import org.modelmapper.ModelMapper; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest; +import org.onap.svnfm.simulator.config.ApplicationConfig; +import org.onap.svnfm.simulator.constants.Constant; import org.onap.svnfm.simulator.model.VnfInstance; -import org.onap.svnfm.simulator.model.VnfJob; +import org.onap.svnfm.simulator.model.VnfOperation; +import org.onap.svnfm.simulator.model.Vnfds; import org.onap.svnfm.simulator.notifications.VnfInstantiationNotification; import org.onap.svnfm.simulator.notifications.VnfmAdapterCreationNotification; -import org.onap.svnfm.simulator.repository.VnfJobRepository; +import org.onap.svnfm.simulator.repository.VnfOperationRepository; +import org.onap.svnfm.simulator.repository.VnfmCacheRepository; import org.onap.svnfm.simulator.repository.VnfmRepository; -import org.onap.vnfm.v1.model.CreateVnfRequest; -import org.onap.vnfm.v1.model.InlineResponse201; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.support.SimpleValueWrapper; import org.springframework.stereotype.Service; /** - * + * * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) * @author Ronan Kenny (ronan.kenny@est.tech) */ @@ -47,27 +60,44 @@ public class SvnfmService { VnfmRepository vnfmRepository; @Autowired - VnfJobRepository vnfJobRepository; + VnfmCacheRepository vnfRepository; + + @Autowired + VnfOperationRepository vnfOperationRepository; @Autowired private VnfmHelper vnfmHelper; + @Autowired + ApplicationConfig applicationConfig; + + @Autowired + CacheManager cacheManager; + + @Autowired + Vnfds vnfds; + + @Autowired + SubscriptionService subscriptionService; + + private final ExecutorService executor = Executors.newCachedThreadPool(); + private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmService.class); /** - * + * * @param createVNFRequest * @return inlineResponse201 */ - public InlineResponse201 createVnf(final CreateVnfRequest createVNFRequest) { + public InlineResponse201 createVnf(final CreateVnfRequest createVNFRequest, final String id) { InlineResponse201 inlineResponse201 = null; try { - final VnfInstance vnfInstance = vnfmHelper.createVnfInstance(createVNFRequest); + final VnfInstance vnfInstance = vnfmHelper.createVnfInstance(createVNFRequest, id); vnfmRepository.save(vnfInstance); final Thread creationNotification = new Thread(new VnfmAdapterCreationNotification()); creationNotification.start(); inlineResponse201 = vnfmHelper.getInlineResponse201(vnfInstance); - LOGGER.debug("Response from Create VNF", inlineResponse201); + LOGGER.debug("Response from Create VNF {}", inlineResponse201); } catch (IllegalAccessException | InvocationTargetException e) { LOGGER.error("Failed in Create Vnf", e); } @@ -75,94 +105,80 @@ public class SvnfmService { } /** - * + * * @param vnfId - * @param instantiateJobId + * @param instantiateVNFRequest + * @param operationId * @throws InterruptedException */ - public Object instatiateVnf(final String vnfId, final String instantiateJobId) throws InterruptedException { - final VnfJob vnfJob = buildVnfInstantiation(vnfId, instantiateJobId); - vnfJobRepository.save(vnfJob); - getJobStatus(vnfJob.getJobId()); - return null; + public String instantiateVnf(final String vnfId, final InstantiateVnfRequest instantiateVNFRequest) { + final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.INSTANTIATE, vnfId); + vnfOperationRepository.save(vnfOperation); + executor.submit(new OperationProgressor(vnfOperation, vnfRepository, vnfOperationRepository, applicationConfig, + vnfds, subscriptionService)); + return vnfOperation.getId(); } /** - * + * vnfOperationRepository + * * @param vnfId - * @param instantiateJobId + * @param instantiateOperationId */ - public VnfJob buildVnfInstantiation(final String vnfId, final String instantiateJobId) { - final VnfJob vnfJob = new VnfJob(); - final Optional vnfInstance = vnfmRepository.findById(vnfId); - - if (vnfInstance.isPresent()) { - vnfJob.setJobId(instantiateJobId); - for (final VnfInstance instance : vnfmRepository.findAll()) { - if (instance.getId().equals(vnfId)) { - vnfJob.setVnfInstanceId(instance.getVnfInstanceDescription()); - } - } - vnfJob.setVnfId(vnfId); - vnfJob.setStatus("STARTING"); - } - return vnfJob; + public VnfOperation buildVnfOperation(final InlineResponse200.OperationEnum operation, final String vnfId) { + final VnfOperation vnfOperation = new VnfOperation(); + vnfOperation.setId(UUID.randomUUID().toString()); + vnfOperation.setOperation(operation); + vnfOperation.setOperationState(InlineResponse200.OperationStateEnum.STARTING); + vnfOperation.setVnfInstanceId(vnfId); + return vnfOperation; } /** - * - * @param jobId + * + * @param operationId * @throws InterruptedException */ - public Object getJobStatus(final String jobId) throws InterruptedException { - LOGGER.info("Getting job status with id: " + jobId); - for (int i = 0; i < 5; i++) { - LOGGER.info("Instantiation status: RUNNING"); - Thread.sleep(5000); - for (final VnfJob job : vnfJobRepository.findAll()) { - if (job.getJobId().equals(jobId)) { - job.setStatus("RUNNING"); - vnfJobRepository.save(job); - } - } - } + public InlineResponse200 getOperationStatus(final String operationId) { + LOGGER.info("Getting operation status with id: {}", operationId); final Thread instantiationNotification = new Thread(new VnfInstantiationNotification()); instantiationNotification.start(); - for (final VnfJob job : vnfJobRepository.findAll()) { - if (job.getJobId().equals(jobId)) { - job.setStatus("COMPLETE"); - vnfJobRepository.save(job); + for (final VnfOperation operation : vnfOperationRepository.findAll()) { + LOGGER.info("Operation found: {}", operation); + if (operation.getId().equals(operationId)) { + final ModelMapper modelMapper = new ModelMapper(); + return modelMapper.map(operation, InlineResponse200.class); } } return null; } /** - * + * * @param vnfId * @return inlineResponse201 */ public InlineResponse201 getVnf(final String vnfId) { - InlineResponse201 inlineResponse201 = null; - - final Optional vnfInstance = vnfmRepository.findById(vnfId); - try { - if (vnfInstance.isPresent()) { - inlineResponse201 = vnfmHelper.getInlineResponse201(vnfInstance.get()); - LOGGER.debug("Response from get VNF", inlineResponse201); - } - } catch (IllegalAccessException | InvocationTargetException e) { - LOGGER.error("Failed in get Vnf", e); + final Cache ca = cacheManager.getCache(Constant.IN_LINE_RESPONSE_201_CACHE); + final SimpleValueWrapper wrapper = (SimpleValueWrapper) ca.get(vnfId); + final InlineResponse201 inlineResponse201 = (InlineResponse201) wrapper.get(); + if (inlineResponse201 != null) { + LOGGER.info("Cache Read Successful"); + return inlineResponse201; } - return inlineResponse201; + return null; } /** * @param vnfId * @return */ - public Object terminateVnf(String vnfId) { + public Object terminateVnf(final String vnfId) { // TODO return null; } + + public void registerSubscription(final LccnSubscriptionRequest subscription) { + subscriptionService.registerSubscription(subscription); + } } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java index f35cbf2f49..7c038b823f 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java @@ -22,30 +22,36 @@ package org.onap.svnfm.simulator.services; import java.lang.reflect.InvocationTargetException; import org.apache.commons.beanutils.BeanUtils; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201Links; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201LinksSelf; +import org.onap.svnfm.simulator.config.ApplicationConfig; import org.onap.svnfm.simulator.constants.Constant; import org.onap.svnfm.simulator.model.VnfInstance; -import org.onap.vnfm.v1.model.CreateVnfRequest; -import org.onap.vnfm.v1.model.InlineResponse201; -import org.onap.vnfm.v1.model.InlineResponse201.InstantiationStateEnum; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * + * * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) * @author Ronan Kenny (ronan.kenny@est.tech) */ @Component public class VnfmHelper { + @Autowired + private ApplicationConfig applicationConfig; + /** - * + * * @param createVNFRequest * @return vnfInstance */ - public VnfInstance createVnfInstance(final CreateVnfRequest createVNFRequest) { + public VnfInstance createVnfInstance(final CreateVnfRequest createVNFRequest, final String id) { final VnfInstance vnfInstance = new VnfInstance(); - final String vnfId = createVNFRequest.getVnfdId(); - vnfInstance.setId(vnfId); + vnfInstance.setId(id); vnfInstance.setVnfInstanceName(createVNFRequest.getVnfInstanceName()); vnfInstance.setVnfInstanceDescription(createVNFRequest.getVnfInstanceDescription()); vnfInstance.setVnfdId(createVNFRequest.getVnfdId()); @@ -55,7 +61,7 @@ public class VnfmHelper { } /** - * + * * @param vnfInstance * @return inlineResponse201 * @throws IllegalAccessException @@ -68,6 +74,21 @@ public class VnfmHelper { inlineResponse201.setVnfdVersion(Constant.VNFD_VERSION); inlineResponse201.setVnfSoftwareVersion(Constant.VNF_SOFTWARE_VERSION); inlineResponse201.setInstantiationState(InstantiationStateEnum.NOT_INSTANTIATED); + inlineResponse201.setVnfConfigurableProperties(Constant.VNF_CONFIG_PROPERTIES); + addAdditionalPRopertyInlineResponse201(inlineResponse201); return inlineResponse201; } + + private void addAdditionalPRopertyInlineResponse201(final InlineResponse201 inlineResponse201) { + final InlineResponse201LinksSelf VnfInstancesLinksSelf = new InlineResponse201LinksSelf(); + VnfInstancesLinksSelf + .setHref(applicationConfig.getBaseUrl() + "/vnflcm/v1/vnf_instances/" + inlineResponse201.getId()); + final InlineResponse201LinksSelf VnfInstancesLinksSelfInstantiate = new InlineResponse201LinksSelf(); + VnfInstancesLinksSelfInstantiate.setHref(applicationConfig.getBaseUrl() + "/vnflcm/v1/vnf_instances/" + + inlineResponse201.getId() + "/instantiate"); + final InlineResponse201Links inlineResponse201Links = new InlineResponse201Links(); + inlineResponse201Links.setSelf(VnfInstancesLinksSelf); + inlineResponse201Links.setInstantiate(VnfInstancesLinksSelfInstantiate); + inlineResponse201.setLinks(inlineResponse201Links); + } } diff --git a/vnfm-simulator/vnfm-service/src/main/resources/application.properties b/vnfm-simulator/vnfm-service/src/main/resources/application.properties deleted file mode 100644 index c5b36d77f4..0000000000 --- a/vnfm-simulator/vnfm-service/src/main/resources/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -# Enabling H2 Console -spring.h2.console.enabled=true -spring.h2.console.path=/console -spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE -spring.datasource.username=admin -spring.datasource.password=admin -spring.datasource.driverClassName=org.h2.Driver -spring.jpa.hibernate.ddl-auto = update -spring.jpa.show-sql=true -logging.level.org.hibernate.SQL=DEBUG -logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE - -server.port=9081 \ No newline at end of file diff --git a/vnfm-simulator/vnfm-service/src/main/resources/application.yaml b/vnfm-simulator/vnfm-service/src/main/resources/application.yaml new file mode 100644 index 0000000000..2ef302ce25 --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/resources/application.yaml @@ -0,0 +1,59 @@ +# Copyright © 2019 Nordix Foundation +# +# 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. + +spring: + h2: + console: + enabled: true + path: console + datasource: + url: jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE + username: admin + password: admin + http: + converters: + preferred-json-mapper: gson + security: + usercredentials: + - username: vnfm + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + +server: + port: 9093 + tomcat: + max-threads: 50 + +vnfds: + vnfdlist: + - vnfdid: 1 + vnfclist: + - vnfcid: VNFC1 + resourceTemplateId: vnfd1_vnfc1 + vduId: vnfd1_vduForVnfc1 + type: COMPUTE + - vnfcid: VNFC2 + resourceTemplateId: vnfd1_vnfc2 + vduId: vnfd1_vduForVnfc2 + type: COMPUTE + - vnfdid: 2 + vnfclist: + - vnfcid: VNFC3 + resourceTemplateId: vnfd2_vnfc3 + vduId: vnfd2_vduForVnfc3 + type: COMPUTE + - vnfcid: VNFC4 + resourceTemplateId: vnfd2_vnfc4 + vduId: vnfd2_vduForVnfc4 + type: COMPUTE \ No newline at end of file diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java index f338b5828e..9cb0702ee0 100644 --- a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java +++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java @@ -20,10 +20,13 @@ package org.onap.svnfm.simulator.controllers; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -31,15 +34,15 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; +import org.onap.svnfm.simulator.constants.Constant; import org.onap.svnfm.simulator.controller.SvnfmController; import org.onap.svnfm.simulator.repository.VnfmCacheRepository; import org.onap.svnfm.simulator.services.SvnfmService; -import org.onap.vnfm.v1.model.CreateVnfRequest; -import org.onap.vnfm.v1.model.InlineResponse201; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(MockitoJUnitRunner.class) public class TestSvnfmController { @@ -69,14 +72,12 @@ public class TestSvnfmController { createVnfRequest.setVnfInstanceName("createVnfInstanceTest"); createVnfRequest.setVnfInstanceDescription("createVnfInstanceTest"); - when(vnfmCacheRepository.createVnf(createVnfRequest)).thenReturn(new InlineResponse201()); - - svnfmService.createVnf(createVnfRequest); + when(vnfmCacheRepository.createVnf(eq(createVnfRequest), anyString())).thenReturn(new InlineResponse201()); final String body = (new ObjectMapper()).valueToTree(createVnfRequest).toString(); this.mockMvc - .perform(post("/svnfm/vnf_instances").content(body).contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) + .perform(post(Constant.BASE_URL + "/vnf_instances").content(body) + .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andExpect(status().isCreated()).andExpect(content().contentType(MediaType.APPLICATION_JSON)); } } -- cgit 1.2.3-korg From b0074af5d92fd57aea9a32f435f139dd32cf2715 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Mon, 29 Apr 2019 10:16:49 +0000 Subject: Fixed issues found in delete integration testing Issue-ID: SO-1827 Change-Id: I73fdcad3d466634cea850e4df10291a66ec2aa61 Signed-off-by: MichaelMorris (cherry picked from commit f4f9c027afc2981d36d607612b6e67cd0a1e8d52) --- .../vnfmadapter/extclients/aai/AaiHelper.java | 46 +++++++++++-- .../extclients/vnfm/VnfmServiceProviderImpl.java | 2 +- .../vnfmadapter/jobmanagement/JobManager.java | 11 ++-- .../vnfmadapter/jobmanagement/VnfmOperation.java | 7 ++ .../notificationhandling/NotificationHandler.java | 75 ++++++++++++---------- .../vnfmadapter/rest/Sol003GrantController.java | 2 +- .../rest/Sol003GrantControllerTest.java | 7 +- .../vnfmadapter/rest/Sol003LcnControllerTest.java | 30 ++++++++- 8 files changed, 131 insertions(+), 49 deletions(-) diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java index 867b6522f5..1374e89a19 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java @@ -22,6 +22,7 @@ package org.onap.so.adapters.vnfmadapter.extclients.aai; import java.util.Collections; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import org.onap.aai.domain.yang.EsrSystemInfo; import org.onap.aai.domain.yang.EsrSystemInfoList; @@ -110,7 +111,7 @@ public class AaiHelper { */ public String getIdOfAssignedVnfm(final GenericVnf vnf) { final Relationship relationship = getRelationship(vnf, "esr-vnfm"); - return getRelationshipKey(relationship, "esr-vnfm.vnfm-id"); + return getRelationshipData(relationship, "esr-vnfm.vnfm-id"); } /** @@ -121,9 +122,9 @@ public class AaiHelper { */ public Tenant getAssignedTenant(final GenericVnf vnf) { final Relationship relationship = getRelationship(vnf, "tenant"); - final String cloudOwner = getRelationshipKey(relationship, "cloud-region.cloud-owner"); - final String cloudRegion = getRelationshipKey(relationship, "cloud-region.cloud-region-id"); - final String tenantId = getRelationshipKey(relationship, "tenant.tenant-id"); + final String cloudOwner = getRelationshipData(relationship, "cloud-region.cloud-owner"); + final String cloudRegion = getRelationshipData(relationship, "cloud-region.cloud-region-id"); + final String tenantId = getRelationshipData(relationship, "tenant.tenant-id"); if (cloudOwner == null || cloudRegion == null || tenantId == null) { throw new TenantNotFoundException("No matching Tenant found in AAI. VNFID: " + vnf.getVnfId()); } else { @@ -141,10 +142,17 @@ public class AaiHelper { return null; } - private String getRelationshipKey(final Relationship relationship, final String relationshipKey) { + /** + * Get the value of the relationship data with the given key in the given relationship. + * + * @param relationship the relationship + * @param relationshipDataKey the key for the relationship data + * @return the value of the relationship data for the given key + */ + public String getRelationshipData(final Relationship relationship, final String relationshipDataKey) { if (relationship != null) { for (final RelationshipData relationshipData : relationship.getRelationshipData()) { - if (relationshipData.getRelationshipKey().equals(relationshipKey)) { + if (relationshipData.getRelationshipKey().equals(relationshipDataKey)) { return relationshipData.getRelationshipValue(); } } @@ -152,6 +160,32 @@ public class AaiHelper { return null; } + /** + * Delete from the given VNF the relationship matching the given criteria. + * + * @param vnf the VNF + * @param relationshipRelatedToValue the related-to value for the relationship + * @param dataKey the relationship data key to match on + * @param dataValue the value the relationship data with the given key must match + * @return the deleted relationship or null if none found matching the given criteria + */ + public Relationship deleteRelationshipWithDataValue(final GenericVnf vnf, final String relationshipRelatedToValue, + final String dataKey, final String dataValue) { + final Iterator relationships = + vnf.getRelationshipList() == null ? Collections.emptyList().iterator() + : vnf.getRelationshipList().getRelationship().iterator(); + + while (relationships.hasNext()) { + final Relationship relationship = relationships.next(); + if (relationship.getRelatedTo().equals(relationshipRelatedToValue) + && dataValue.equals(getRelationshipData(relationship, dataKey))) { + relationships.remove(); + return relationship; + } + } + return null; + } + /** * Select a VNFM to use for the given generic VNF. Should only be used when no VNFM has already been assigned to the * VNF. diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java index 645f37e72f..e66f86b66f 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java @@ -133,7 +133,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider { public void deleteVnf(final String vnfSelfLink) { logger.debug("Sending delete request to : " + vnfSelfLink); final ResponseEntity response = httpServiceProvider.deleteHttpRequest(vnfSelfLink, Void.class); - if (response.getStatusCode() != HttpStatus.OK) { + if (response.getStatusCode() != HttpStatus.NO_CONTENT) { throw new VnfmRequestFailureException( "Delete request to " + vnfSelfLink + " return status code: " + response.getStatusCode()); } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java index e61bf860b3..345ff5119a 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java @@ -20,8 +20,11 @@ package org.onap.so.adapters.vnfmadapter.jobmanagement; +import static org.slf4j.LoggerFactory.getLogger; import com.google.common.base.Optional; import com.google.common.collect.Maps; +import java.util.Map; +import java.util.UUID; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; import org.onap.so.adapters.vnfmadapter.rest.exceptions.JobNotFoundException; @@ -32,9 +35,6 @@ import org.onap.vnfmadapter.v1.model.QueryJobResponse; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Map; -import java.util.UUID; -import static org.slf4j.LoggerFactory.getLogger; /** * Manages jobs enabling the status of jobs to be queried. A job is associated with an operation on a VNFM. @@ -123,12 +123,15 @@ public class JobManager { public void notificationProcessedForOperation(final String operationId, final boolean notificationProcessingWasSuccessful) { + logger.debug("Notification processed for operation ID {} success?: {}", operationId, + notificationProcessingWasSuccessful); final java.util.Optional relatedOperation = mapOfJobIdToVnfmOperation.values().stream() .filter(operation -> operation.getOperationId().equals(operationId)).findFirst(); if (relatedOperation.isPresent()) { relatedOperation.get().setNotificationProcessed(notificationProcessingWasSuccessful); + } else { + logger.debug("No operation found for operation ID " + operationId); } - logger.debug("No operation found for operation ID " + operationId); } } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java index 3ed66ad713..7ce08df52f 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java @@ -94,4 +94,11 @@ public class VnfmOperation { NOTIFICATION_PROCESSING_FAILED; } + @Override + public String toString() { + return "VnfmOperation [vnfmId=" + vnfmId + ", operationId=" + operationId + ", notificationStatus=" + + notificationStatus + "]"; + } + + } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java index d39a2cb761..c09aa0cd48 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java @@ -27,6 +27,7 @@ import java.util.Map; import org.json.JSONException; import org.json.JSONObject; import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.Vserver; import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper; import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider; @@ -34,6 +35,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource; import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource.OamIpAddressType; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; @@ -100,8 +102,7 @@ public class NotificationHandler implements Runnable { aaiServiceProvider.invokePutGenericVnf(genericVnf); - updateVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), - vnfInstance.getVimConnectionInfo()); + addVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), vnfInstance.getVimConnectionInfo()); logger.debug("Finished handling notification for vnfm: " + vnfInstance.getId()); } @@ -114,16 +115,17 @@ public class NotificationHandler implements Runnable { } if (oamIpAddressSource.getType().equals(OamIpAddressType.LITERAL)) { genericVnf.setIpv4OamAddress(oamIpAddressSource.getValue()); - } - try { - logger.debug("ConfigurableProperties: " + vnfInstance.getVnfConfigurableProperties()); - if (vnfInstance.getVnfConfigurableProperties() == null) { - logger.warn("No ConfigurableProperties, cannot set OAM IP Address"); + } else { + try { + logger.debug("ConfigurableProperties: " + vnfInstance.getVnfConfigurableProperties()); + if (vnfInstance.getVnfConfigurableProperties() == null) { + logger.warn("No ConfigurableProperties, cannot set OAM IP Address"); + } + final JSONObject properties = new JSONObject((Map) vnfInstance.getVnfConfigurableProperties()); + genericVnf.setIpv4OamAddress(properties.get(oamIpAddressSource.getValue()).toString()); + } catch (final JSONException jsonException) { + logger.error("Error getting vnfIpAddress", jsonException); } - final JSONObject properties = new JSONObject((Map) vnfInstance.getVnfConfigurableProperties()); - genericVnf.setIpv4OamAddress(properties.get(oamIpAddressSource.getValue()).toString()); - } catch (final JSONException jsonException) { - logger.error("Error getting vnfIpAddress", jsonException); } } @@ -143,30 +145,29 @@ public class NotificationHandler implements Runnable { private void handleVnfTerminateFailed() { final GenericVnf genericVnf = aaiServiceProvider .invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0); - updateVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), - vnfInstance.getVimConnectionInfo()); - jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getId(), false); + deleteVservers(vnfLcmOperationOccurrenceNotification, genericVnf); + jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(), false); } private void handleVnfTerminateCompleted() { final GenericVnf genericVnf = aaiServiceProvider .invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0); - updateVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), - vnfInstance.getVimConnectionInfo()); + deleteVservers(vnfLcmOperationOccurrenceNotification, genericVnf); boolean deleteSuccessful = false; try { vnfmServiceProvider.deleteVnf(genericVnf.getSelflink()); deleteSuccessful = true; } finally { - jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getId(), + jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(), deleteSuccessful); genericVnf.setOrchestrationStatus("Assigned"); + genericVnf.setSelflink(""); aaiServiceProvider.invokePutGenericVnf(genericVnf); } } - private void updateVservers(final VnfLcmOperationOccurrenceNotification notification, final String vnfId, + private void addVservers(final VnfLcmOperationOccurrenceNotification notification, final String vnfId, final List vnfInstancesVimConnectionInfo) { final Map vimConnectionIdToVimConnectionInfo = new HashMap<>(); for (final InlineResponse201VimConnectionInfo vimConnectionInfo : vnfInstancesVimConnectionInfo) { @@ -176,22 +177,28 @@ public class NotificationHandler implements Runnable { for (final LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs vnfc : notification.getAffectedVnfcs()) { final InlineResponse201VimConnectionInfo vimConnectionInfo = getVimConnectionInfo(vimConnectionIdToVimConnectionInfo, vnfc); - switch (vnfc.getChangeType()) { - case ADDED: - final Vserver vserver = aaiHelper.createVserver(vnfc); - aaiHelper.addRelationshipFromVserverVnfToGenericVnf(vserver, vnfId); - - aaiServiceProvider.invokePutVserver(getCloudOwner(vimConnectionInfo), - getCloudRegion(vimConnectionInfo), getTenant(vimConnectionInfo), vserver); - break; - case REMOVED: - aaiServiceProvider.invokeDeleteVserver(getCloudOwner(vimConnectionInfo), - getCloudRegion(vimConnectionInfo), getTenant(vimConnectionInfo), - vnfc.getComputeResource().getResourceId()); - break; - case MODIFIED: - case TEMPORARY: - default: + if (ChangeTypeEnum.ADDED.equals(vnfc.getChangeType())) { + final Vserver vserver = aaiHelper.createVserver(vnfc); + aaiHelper.addRelationshipFromVserverVnfToGenericVnf(vserver, vnfId); + + aaiServiceProvider.invokePutVserver(getCloudOwner(vimConnectionInfo), getCloudRegion(vimConnectionInfo), + getTenant(vimConnectionInfo), vserver); + } + } + } + + private void deleteVservers(final VnfLcmOperationOccurrenceNotification notification, final GenericVnf vnf) { + for (final LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs vnfc : notification.getAffectedVnfcs()) { + if (ChangeTypeEnum.REMOVED.equals(vnfc.getChangeType())) { + + final Relationship relationshipToVserver = aaiHelper.deleteRelationshipWithDataValue(vnf, "vserver", + "vserver.vserver-id", vnfc.getComputeResource().getResourceId()); + + aaiServiceProvider.invokeDeleteVserver( + aaiHelper.getRelationshipData(relationshipToVserver, "cloud-region.cloud-owner"), + aaiHelper.getRelationshipData(relationshipToVserver, "cloud-region.cloud-region-id"), + aaiHelper.getRelationshipData(relationshipToVserver, "tenant.tenant-id"), + vnfc.getComputeResource().getResourceId()); } } } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java index e241d0de7e..3ead98fce2 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java @@ -97,7 +97,7 @@ public class Sol003GrantController { if (grantRequest.getOperation().equals(GrantRequest.OperationEnum.INSTANTIATE)) { grantResponse.addResources(getResources(grantRequest.getAddResources(), vimConnectionId)); } else if (grantRequest.getOperation().equals(GrantRequest.OperationEnum.TERMINATE)) { - grantResponse.addResources(getResources(grantRequest.getRemoveResources(), vimConnectionId)); + grantResponse.removeResources(getResources(grantRequest.getRemoveResources(), vimConnectionId)); } return grantResponse; } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java index 4af0da1485..69223d7922 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java @@ -22,6 +22,7 @@ package org.onap.so.adapters.vnfmadapter.rest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; @@ -102,6 +103,7 @@ public class Sol003GrantControllerTest { final ResponseEntity response = controller.grantsPost(grantRequest); assertEquals(HttpStatus.CREATED, response.getStatusCode()); assertEquals(1, response.getBody().getAddResources().size()); + assertNull(response.getBody().getRemoveResources()); assertEquals(vimConnectionId, response.getBody().getAddResources().get(0).getVimConnectionId()); assertEquals("myTestVnfIdOnVnfm", response.getBody().getVnfInstanceId()); @@ -128,8 +130,9 @@ public class Sol003GrantControllerTest { final ResponseEntity response = controller.grantsPost(grantRequest); assertEquals(HttpStatus.CREATED, response.getStatusCode()); - assertEquals(1, response.getBody().getAddResources().size()); - assertEquals(vimConnectionId, response.getBody().getAddResources().get(0).getVimConnectionId()); + assertNull(response.getBody().getAddResources()); + assertEquals(1, response.getBody().getRemoveResources().size()); + assertEquals(vimConnectionId, response.getBody().getRemoveResources().get(0).getVimConnectionId()); assertEquals("myTestVnfIdOnVnfm", response.getBody().getVnfInstanceId()); assertEquals("123456", response.getBody().getVnfLcmOpOccId()); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java index 822201ea1c..aeb7cd3540 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java @@ -49,6 +49,8 @@ import org.mockito.hamcrest.MockitoHamcrest; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Relationship; +import org.onap.aai.domain.yang.RelationshipData; +import org.onap.aai.domain.yang.RelationshipList; import org.onap.aai.domain.yang.Vserver; import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication; import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper; @@ -221,7 +223,7 @@ public class Sol003LcnControllerTest { .andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON)); mockRestServer.expect(requestTo(new URI("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm"))) - .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON)); + .andRespond(withStatus(HttpStatus.NO_CONTENT).contentType(MediaType.APPLICATION_JSON)); final GenericVnf genericVnf = createGenericVnf("vnfmType1"); genericVnf.setSelflink("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm"); @@ -229,6 +231,7 @@ public class Sol003LcnControllerTest { listOfGenericVnfs.add(genericVnf); final GenericVnfs genericVnfs = new GenericVnfs(); genericVnfs.getGenericVnf().addAll(listOfGenericVnfs); + addRelationshipFromGenericVnfToVserver(genericVnf, "myVnfc1"); doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class), MockitoHamcrest.argThat(new AaiResourceUriMatcher( @@ -320,6 +323,31 @@ public class Sol003LcnControllerTest { return genericVnf; } + private void addRelationshipFromGenericVnfToVserver(final GenericVnf genericVnf, final String vserverId) { + final Relationship relationshipToVserver = new Relationship(); + relationshipToVserver.setRelatedTo("vserver"); + final RelationshipData relationshipData1 = new RelationshipData(); + relationshipData1.setRelationshipKey("vserver.vserver-id"); + relationshipData1.setRelationshipValue(vserverId); + relationshipToVserver.getRelationshipData().add(relationshipData1); + final RelationshipData relationshipData2 = new RelationshipData(); + relationshipData2.setRelationshipKey("cloud-region.cloud-owner"); + relationshipData2.setRelationshipValue(CLOUD_OWNER); + relationshipToVserver.getRelationshipData().add(relationshipData2); + final RelationshipData relationshipData3 = new RelationshipData(); + relationshipData3.setRelationshipKey("cloud-region.cloud-region-id"); + relationshipData3.setRelationshipValue(REGION); + relationshipToVserver.getRelationshipData().add(relationshipData3); + final RelationshipData relationshipData4 = new RelationshipData(); + relationshipData4.setRelationshipKey("tenant.tenant-id"); + relationshipData4.setRelationshipValue(TENANT_ID); + relationshipToVserver.getRelationshipData().add(relationshipData4); + + final RelationshipList relationshipList = new RelationshipList(); + relationshipList.getRelationship().add(relationshipToVserver); + genericVnf.setRelationshipList(relationshipList); + } + private class AaiResourceUriMatcher extends BaseMatcher { final String uriAsString; -- cgit 1.2.3-korg From 4e5717544475bfe878e1804d146e3900325356d3 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Mon, 29 Apr 2019 10:17:43 +0000 Subject: VNFM simulator implementation for delete flow Issue-ID: SO-1773 Change-Id: I14c8325dbb8fbdaebff7b7ec674fd0ddbb5930c3 Signed-off-by: MichaelMorris (cherry picked from commit 252f18a05916bd8f50e7fa803129e3e4c44cd0a5) --- .../simulator/controller/SvnfmController.java | 14 ++- .../simulator/repository/VnfmCacheRepository.java | 22 +--- .../services/InstantiateOperationProgressor.java | 123 +++++++++++++++++++++ .../simulator/services/OperationProgressor.java | 119 ++++++-------------- .../svnfm/simulator/services/SvnfmService.java | 33 ++++-- .../services/TerminateOperationProgressor.java | 74 +++++++++++++ .../onap/svnfm/simulator/services/VnfmHelper.java | 10 +- 7 files changed, 274 insertions(+), 121 deletions(-) create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/InstantiateOperationProgressor.java create mode 100644 vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/TerminateOperationProgressor.java diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java index e6bc06374c..9c3a02d4e6 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java @@ -119,9 +119,12 @@ public class SvnfmController { */ @DeleteMapping(value = "/vnf_instances/{vnfInstanceId}") @ResponseStatus(code = HttpStatus.OK) - public InlineResponse201 deleteVnf(@PathVariable("vnfInstanceId") final String vnfId) { + public ResponseEntity deleteVnf(@PathVariable("vnfInstanceId") final String vnfId) { LOGGER.info("Start deleting Vnf------"); - return vnfmCacheRepository.deleteVnf(vnfId); + vnfmCacheRepository.deleteVnf(vnfId); + final HttpHeaders headers = new HttpHeaders(); + headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + return new ResponseEntity<>(headers, HttpStatus.NO_CONTENT); } /** @@ -132,10 +135,11 @@ public class SvnfmController { */ @PostMapping(value = "/vnf_instances/{vnfInstanceId}/terminate") public ResponseEntity terminateVnf(@PathVariable("vnfInstanceId") final String vnfId) { - LOGGER.info("Start terminateVNFRequest"); + LOGGER.info("Start terminateVNFRequest {}", vnfId); final HttpHeaders headers = new HttpHeaders(); - headers.add("Content-Type", MediaType.APPLICATION_JSON); - return new ResponseEntity<>(svnfmService.terminateVnf(vnfId), headers, HttpStatus.ACCEPTED); + headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + headers.add(HttpHeaders.LOCATION, svnfmService.terminateVnf(vnfId)); + return new ResponseEntity<>(headers, HttpStatus.ACCEPTED); } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java index 030b073da4..fbdbf744d0 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/repository/VnfmCacheRepository.java @@ -20,16 +20,12 @@ package org.onap.svnfm.simulator.repository; -import java.util.List; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo; import org.onap.svnfm.simulator.constants.Constant; import org.onap.svnfm.simulator.services.SvnfmService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Repository; @@ -49,15 +45,7 @@ public class VnfmCacheRepository { return svnfmService.createVnf(createVnfRequest, id); } - @CachePut(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id") - public InlineResponse201 updateVnf(final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo, final String id, - final List vimConnectionInfo) { - final InlineResponse201 vnf = getVnf(id); - vnf.setInstantiatedVnfInfo(instantiatedVnfInfo); - vnf.setInstantiationState(InstantiationStateEnum.INSTANTIATED); - vnf.setVimConnectionInfo(vimConnectionInfo); - return vnf; - } + public InlineResponse201 getVnf(final String id) { return svnfmService.getVnf(id); @@ -67,8 +55,6 @@ public class VnfmCacheRepository { * @param vnfId * @return */ - public InlineResponse201 deleteVnf(final String vnfId) { - // TODO - return null; - } + @CacheEvict(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id") + public void deleteVnf(final String id) {} } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/InstantiateOperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/InstantiateOperationProgressor.java new file mode 100644 index 0000000000..020fa0390d --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/InstantiateOperationProgressor.java @@ -0,0 +1,123 @@ +package org.onap.svnfm.simulator.services; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.modelmapper.ModelMapper; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources.TypeEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201AddResources; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoResourceHandle; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo; +import org.onap.svnfm.simulator.config.ApplicationConfig; +import org.onap.svnfm.simulator.model.VnfOperation; +import org.onap.svnfm.simulator.model.Vnfds; +import org.onap.svnfm.simulator.model.Vnfds.Vnfc; +import org.onap.svnfm.simulator.model.Vnfds.Vnfd; +import org.onap.svnfm.simulator.repository.VnfOperationRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class InstantiateOperationProgressor extends OperationProgressor { + + private static final Logger LOGGER = LoggerFactory.getLogger(InstantiateOperationProgressor.class); + + public InstantiateOperationProgressor(final VnfOperation operation, final SvnfmService svnfmService, + final VnfOperationRepository vnfOperationRepository, final ApplicationConfig applicationConfig, + final Vnfds vnfds, final SubscriptionService subscriptionService) { + super(operation, svnfmService, vnfOperationRepository, applicationConfig, vnfds, subscriptionService); + } + + @Override + protected List getAddResources(final String vnfdId) { + final List resources = new ArrayList<>(); + + for (final Vnfd vnfd : vnfds.getVnfdList()) { + if (vnfd.getVnfdId().equals(vnfdId)) { + for (final Vnfc vnfc : vnfd.getVnfcList()) { + final GrantsAddResources addResource = new GrantsAddResources(); + vnfc.setGrantResourceId(UUID.randomUUID().toString()); + addResource.setId(vnfc.getGrantResourceId()); + addResource.setType(TypeEnum.fromValue(vnfc.getType())); + addResource.setResourceTemplateId(vnfc.getResourceTemplateId()); + addResource.setVduId(vnfc.getVduId()); + resources.add(addResource); + } + } + } + return resources; + } + + @Override + protected List getRemoveResources(final String vnfdId) { + return Collections.emptyList(); + } + + @Override + protected List handleGrantResponse( + final InlineResponse201 grantResponse) { + final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo = createInstantiatedVnfInfo(grantResponse); + svnfmService.updateVnf(InstantiationStateEnum.INSTANTIATED, instantiatedVnfInfo, operation.getVnfInstanceId(), + getVimConnections(grantResponse)); + return instantiatedVnfInfo.getVnfcResourceInfo(); + } + + private InlineResponse201InstantiatedVnfInfo createInstantiatedVnfInfo(final InlineResponse201 grantResponse) { + final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo = new InlineResponse201InstantiatedVnfInfo(); + + final Map mapOfGrantResourceIdToVimConnectionId = new HashMap<>(); + for (final InlineResponse201AddResources addResource : grantResponse.getAddResources()) { + mapOfGrantResourceIdToVimConnectionId.put(addResource.getResourceDefinitionId(), + addResource.getVimConnectionId()); + } + LOGGER.info("VIM connections in grant response: {}", mapOfGrantResourceIdToVimConnectionId); + + for (final Vnfd vnfd : vnfds.getVnfdList()) { + if (vnfd.getVnfdId().equals(svnfmService.getVnf(operation.getVnfInstanceId()).getVnfdId())) { + for (final Vnfc vnfc : vnfd.getVnfcList()) { + final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo vnfcResourceInfoItem = + new InlineResponse201InstantiatedVnfInfoVnfcResourceInfo(); + vnfcResourceInfoItem.setId(vnfc.getVnfcId()); + vnfcResourceInfoItem.setVduId(vnfc.getVduId()); + final InlineResponse201InstantiatedVnfInfoResourceHandle computeResource = + new InlineResponse201InstantiatedVnfInfoResourceHandle(); + computeResource.setResourceId(UUID.randomUUID().toString()); + LOGGER.info("Checking for VIM connection id for : {}", vnfc.getGrantResourceId()); + computeResource + .setVimConnectionId(mapOfGrantResourceIdToVimConnectionId.get(vnfc.getGrantResourceId())); + + computeResource.setVimLevelResourceType("OS::Nova::Server"); + vnfcResourceInfoItem.setComputeResource(computeResource); + instantiatedVnfInfo.addVnfcResourceInfoItem(vnfcResourceInfoItem); + } + } + } + + return instantiatedVnfInfo; + } + + + private List getVimConnections(final InlineResponse201 grantResponse) { + final List vimConnectionInfo = new ArrayList<>(); + for (final InlineResponse201VimConnections vimConnection : grantResponse.getVimConnections()) { + final ModelMapper modelMapper = new ModelMapper(); + vimConnectionInfo.add(modelMapper.map(vimConnection, InlineResponse201VimConnectionInfo.class)); + } + return vimConnectionInfo; + } + + @Override + protected ChangeTypeEnum getVnfcChangeType() { + return ChangeTypeEnum.ADDED; + } + +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java index d231e1b098..1e31ab2fdb 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java @@ -2,9 +2,7 @@ package org.onap.svnfm.simulator.services; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.UUID; import javax.ws.rs.core.MediaType; import org.apache.commons.codec.binary.Base64; @@ -12,12 +10,9 @@ import org.modelmapper.ModelMapper; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiResponse; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources.TypeEnum; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinks; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinksVnfLcmOpOcc; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201AddResources; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.ApiClient; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.ApiException; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.api.DefaultApi; @@ -31,38 +26,32 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperatio import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoResourceHandle; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo; -import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic; import org.onap.svnfm.simulator.config.ApplicationConfig; import org.onap.svnfm.simulator.model.VnfOperation; import org.onap.svnfm.simulator.model.Vnfds; -import org.onap.svnfm.simulator.model.Vnfds.Vnfc; -import org.onap.svnfm.simulator.model.Vnfds.Vnfd; import org.onap.svnfm.simulator.repository.VnfOperationRepository; -import org.onap.svnfm.simulator.repository.VnfmCacheRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class OperationProgressor implements Runnable { +public abstract class OperationProgressor implements Runnable { private static final Logger LOGGER = LoggerFactory.getLogger(OperationProgressor.class); - private final VnfOperation operation; - private final VnfmCacheRepository vnfRepository; + protected final VnfOperation operation; + protected final SvnfmService svnfmService; private final VnfOperationRepository vnfOperationRepository; private final ApplicationConfig applicationConfig; - private final Vnfds vnfds; + protected final Vnfds vnfds; private final SubscriptionService subscriptionService; private final DefaultApi notificationClient; private final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi grantClient; - public OperationProgressor(final VnfOperation operation, final VnfmCacheRepository vnfRepository, + public OperationProgressor(final VnfOperation operation, final SvnfmService svnfmService, final VnfOperationRepository vnfOperationRepository, final ApplicationConfig applicationConfig, final Vnfds vnfds, final SubscriptionService subscriptionService) { this.operation = operation; - this.vnfRepository = vnfRepository; + this.svnfmService = svnfmService; this.vnfOperationRepository = vnfOperationRepository; this.applicationConfig = applicationConfig; this.vnfds = vnfds; @@ -96,15 +85,15 @@ public class OperationProgressor implements Runnable { final GrantRequest grantRequest = buildGrantRequest(); final InlineResponse201 grantResponse = sendGrantRequest(grantRequest); - final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo = createInstantiatedVnfInfo(grantResponse); - vnfRepository.updateVnf(instantiatedVnfInfo, operation.getVnfInstanceId(), - getVimConnections(grantResponse)); + final List vnfcs = handleGrantResponse(grantResponse); + + svnfmService.getVnf(operation.getVnfInstanceId()).getInstantiatedVnfInfo(); sleep(10000); setState(InlineResponse200.OperationStateEnum.COMPLETED); final VnfLcmOperationOccurrenceNotification notificationOfCompleted = buildNotification(NotificationStatusEnum.RESULT, OperationStateEnum.COMPLETED); - notificationOfCompleted.setAffectedVnfcs(getVnfcs(instantiatedVnfInfo.getVnfcResourceInfo())); + notificationOfCompleted.setAffectedVnfcs(getVnfcs(vnfcs)); sendNotification(notificationOfCompleted); } catch (final Exception exception) { @@ -136,6 +125,7 @@ public class OperationProgressor implements Runnable { notification.setOperationState(operationState); notification.setOperation(OperationEnum.fromValue(operation.getOperation().toString())); notification.setVnfInstanceId(operation.getVnfInstanceId()); + notification.setVnfLcmOpOccId(operation.getId()); final LcnVnfLcmOperationOccurrenceNotificationLinks links = new LcnVnfLcmOperationOccurrenceNotificationLinks(); final LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance vnfInstanceLink = @@ -157,14 +147,16 @@ public class OperationProgressor implements Runnable { private List getVnfcs( final List instantiatedVnfcs) { final List vnfcs = new ArrayList<>(); - for (final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo instantiatedVnfc : instantiatedVnfcs) { - LOGGER.info("VNFC TO BE CONVERTED: {}", instantiatedVnfc); - final ModelMapper mapper = new ModelMapper(); - final LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs vnfc = - mapper.map(instantiatedVnfc, LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.class); - LOGGER.info("VNFC FROM CONVERSION: {}", vnfc); - vnfc.setChangeType(ChangeTypeEnum.ADDED); - vnfcs.add(vnfc); + if (instantiatedVnfcs != null) { + for (final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo instantiatedVnfc : instantiatedVnfcs) { + LOGGER.info("VNFC TO BE CONVERTED: {}", instantiatedVnfc); + final ModelMapper mapper = new ModelMapper(); + final LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs vnfc = + mapper.map(instantiatedVnfc, LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.class); + LOGGER.info("VNFC FROM CONVERSION: {}", vnfc); + vnfc.setChangeType(getVnfcChangeType()); + vnfcs.add(vnfc); + } } return vnfcs; } @@ -189,9 +181,10 @@ public class OperationProgressor implements Runnable { public GrantRequest buildGrantRequest() { final GrantRequest grantRequest = new GrantRequest(); grantRequest.setVnfInstanceId(operation.getVnfInstanceId()); - final String vnfdId = vnfRepository.getVnf(operation.getVnfInstanceId()).getVnfdId(); + final String vnfdId = svnfmService.getVnf(operation.getVnfInstanceId()).getVnfdId(); grantRequest.setVnfdId(vnfdId); grantRequest.setAddResources(getAddResources(vnfdId)); + grantRequest.setRemoveResources(getRemoveResources(vnfdId)); grantRequest.setVnfLcmOpOccId(operation.getId()); grantRequest .setOperation(org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest.OperationEnum @@ -209,24 +202,14 @@ public class OperationProgressor implements Runnable { return grantRequest; } - private List getAddResources(final String vnfdId) { - final List resources = new ArrayList<>(); - - for (final Vnfd vnfd : vnfds.getVnfdList()) { - if (vnfd.getVnfdId().equals(vnfdId)) { - for (final Vnfc vnfc : vnfd.getVnfcList()) { - final GrantsAddResources addResource = new GrantsAddResources(); - vnfc.setGrantResourceId(UUID.randomUUID().toString()); - addResource.setId(vnfc.getGrantResourceId()); - addResource.setType(TypeEnum.fromValue(vnfc.getType())); - addResource.setResourceTemplateId(vnfc.getResourceTemplateId()); - addResource.setVduId(vnfc.getVduId()); - resources.add(addResource); - } - } - } - return resources; - } + protected abstract List getAddResources(final String vnfdId); + + protected abstract List getRemoveResources(final String vnfdId); + + protected abstract List handleGrantResponse( + InlineResponse201 grantResponse); + + protected abstract ChangeTypeEnum getVnfcChangeType(); private InlineResponse201 sendGrantRequest(final GrantRequest grantRequest) { LOGGER.info("Sending grant request: {}", grantRequest); @@ -241,46 +224,6 @@ public class OperationProgressor implements Runnable { } } - private InlineResponse201InstantiatedVnfInfo createInstantiatedVnfInfo(final InlineResponse201 grantResponse) { - final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo = new InlineResponse201InstantiatedVnfInfo(); - - final Map mapOfGrantResourceIdToVimConnectionId = new HashMap<>(); - for (final InlineResponse201AddResources addResource : grantResponse.getAddResources()) { - mapOfGrantResourceIdToVimConnectionId.put(addResource.getResourceDefinitionId(), - addResource.getVimConnectionId()); - } - - for (final Vnfd vnfd : vnfds.getVnfdList()) { - if (vnfd.getVnfdId().equals(vnfRepository.getVnf(operation.getVnfInstanceId()).getVnfdId())) { - for (final Vnfc vnfc : vnfd.getVnfcList()) { - final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo vnfcResourceInfoItem = - new InlineResponse201InstantiatedVnfInfoVnfcResourceInfo(); - vnfcResourceInfoItem.setId(vnfc.getVnfcId()); - vnfcResourceInfoItem.setVduId(vnfc.getVduId()); - final InlineResponse201InstantiatedVnfInfoResourceHandle computeResource = - new InlineResponse201InstantiatedVnfInfoResourceHandle(); - computeResource.setResourceId(UUID.randomUUID().toString()); - computeResource - .setVimConnectionId(mapOfGrantResourceIdToVimConnectionId.get(vnfc.getGrantResourceId())); - computeResource.setVimLevelResourceType("OS::Nova::Server"); - vnfcResourceInfoItem.setComputeResource(computeResource); - instantiatedVnfInfo.addVnfcResourceInfoItem(vnfcResourceInfoItem); - } - } - } - - return instantiatedVnfInfo; - } - - private List getVimConnections(final InlineResponse201 grantResponse) { - final List vimConnectionInfo = new ArrayList<>(); - for (final InlineResponse201VimConnections vimConnection : grantResponse.getVimConnections()) { - final ModelMapper modelMapper = new ModelMapper(); - vimConnectionInfo.add(modelMapper.map(vimConnection, InlineResponse201VimConnectionInfo.class)); - } - return vimConnectionInfo; - } - private String getVnfLink() { return getLinkBaseUrl() + "/vnf_instances/" + operation.getVnfInstanceId(); } diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java index cac5075682..21bb00dba7 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java @@ -21,6 +21,7 @@ package org.onap.svnfm.simulator.services; import java.lang.reflect.InvocationTargetException; +import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -28,6 +29,9 @@ import org.modelmapper.ModelMapper; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest; import org.onap.svnfm.simulator.config.ApplicationConfig; @@ -38,13 +42,13 @@ import org.onap.svnfm.simulator.model.Vnfds; import org.onap.svnfm.simulator.notifications.VnfInstantiationNotification; import org.onap.svnfm.simulator.notifications.VnfmAdapterCreationNotification; import org.onap.svnfm.simulator.repository.VnfOperationRepository; -import org.onap.svnfm.simulator.repository.VnfmCacheRepository; import org.onap.svnfm.simulator.repository.VnfmRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.CachePut; import org.springframework.cache.support.SimpleValueWrapper; import org.springframework.stereotype.Service; @@ -59,9 +63,6 @@ public class SvnfmService { @Autowired VnfmRepository vnfmRepository; - @Autowired - VnfmCacheRepository vnfRepository; - @Autowired VnfOperationRepository vnfOperationRepository; @@ -104,6 +105,17 @@ public class SvnfmService { return inlineResponse201; } + @CachePut(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id") + public InlineResponse201 updateVnf(final InstantiationStateEnum instantiationState, + final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo, final String id, + final List vimConnectionInfo) { + final InlineResponse201 vnf = getVnf(id); + vnf.setInstantiatedVnfInfo(instantiatedVnfInfo); + vnf.setInstantiationState(instantiationState); + vnf.setVimConnectionInfo(vimConnectionInfo); + return vnf; + } + /** * * @param vnfId @@ -114,8 +126,8 @@ public class SvnfmService { public String instantiateVnf(final String vnfId, final InstantiateVnfRequest instantiateVNFRequest) { final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.INSTANTIATE, vnfId); vnfOperationRepository.save(vnfOperation); - executor.submit(new OperationProgressor(vnfOperation, vnfRepository, vnfOperationRepository, applicationConfig, - vnfds, subscriptionService)); + executor.submit(new InstantiateOperationProgressor(vnfOperation, this, vnfOperationRepository, + applicationConfig, vnfds, subscriptionService)); return vnfOperation.getId(); } @@ -173,9 +185,12 @@ public class SvnfmService { * @param vnfId * @return */ - public Object terminateVnf(final String vnfId) { - // TODO - return null; + public String terminateVnf(final String vnfId) { + final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.TERMINATE, vnfId); + vnfOperationRepository.save(vnfOperation); + executor.submit(new TerminateOperationProgressor(vnfOperation, this, vnfOperationRepository, applicationConfig, + vnfds, subscriptionService)); + return vnfOperation.getId(); } public void registerSubscription(final LccnSubscriptionRequest subscription) { diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/TerminateOperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/TerminateOperationProgressor.java new file mode 100644 index 0000000000..c829be9a4f --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/TerminateOperationProgressor.java @@ -0,0 +1,74 @@ +package org.onap.svnfm.simulator.services; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources.TypeEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsResource; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoResourceHandle; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo; +import org.onap.svnfm.simulator.config.ApplicationConfig; +import org.onap.svnfm.simulator.model.VnfOperation; +import org.onap.svnfm.simulator.model.Vnfds; +import org.onap.svnfm.simulator.repository.VnfOperationRepository; + +public class TerminateOperationProgressor extends OperationProgressor { + + public TerminateOperationProgressor(final VnfOperation operation, final SvnfmService svnfmService, + final VnfOperationRepository vnfOperationRepository, final ApplicationConfig applicationConfig, + final Vnfds vnfds, final SubscriptionService subscriptionService) { + super(operation, svnfmService, vnfOperationRepository, applicationConfig, vnfds, subscriptionService); + } + + @Override + protected List getAddResources(final String vnfdId) { + return Collections.emptyList(); + } + + @Override + protected List getRemoveResources(final String vnfdId) { + final List resources = new ArrayList<>(); + + final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201 vnf = + svnfmService.getVnf(operation.getVnfInstanceId()); + for (final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo vnfc : vnf.getInstantiatedVnfInfo() + .getVnfcResourceInfo()) { + final GrantsAddResources addResource = new GrantsAddResources(); + addResource.setId(UUID.randomUUID().toString()); + addResource.setType(TypeEnum.COMPUTE); + addResource.setVduId(vnfc.getVduId()); + final GrantsResource resource = new GrantsResource(); + + final InlineResponse201InstantiatedVnfInfoResourceHandle computeResource = vnfc.getComputeResource(); + resource.setResourceId(computeResource.getResourceId()); + resource.setVimConnectionId(computeResource.getVimConnectionId()); + resource.setVimLevelResourceType(computeResource.getVimLevelResourceType()); + addResource.setResource(resource); + resources.add(addResource); + + } + return resources; + } + + @Override + protected List handleGrantResponse( + final InlineResponse201 grantResponse) { + final List vnfcs = + svnfmService.getVnf(operation.getVnfInstanceId()).getInstantiatedVnfInfo().getVnfcResourceInfo(); + svnfmService.updateVnf(InstantiationStateEnum.NOT_INSTANTIATED, null, operation.getVnfInstanceId(), null); + return vnfcs; + } + + @Override + protected ChangeTypeEnum getVnfcChangeType() { + return ChangeTypeEnum.REMOVED; + } + + + +} diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java index 7c038b823f..60b251c4d4 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java @@ -21,6 +21,8 @@ package org.onap.svnfm.simulator.services; import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.beanutils.BeanUtils; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; @@ -74,11 +76,17 @@ public class VnfmHelper { inlineResponse201.setVnfdVersion(Constant.VNFD_VERSION); inlineResponse201.setVnfSoftwareVersion(Constant.VNF_SOFTWARE_VERSION); inlineResponse201.setInstantiationState(InstantiationStateEnum.NOT_INSTANTIATED); - inlineResponse201.setVnfConfigurableProperties(Constant.VNF_CONFIG_PROPERTIES); + inlineResponse201.setVnfConfigurableProperties(getConfigProperties()); addAdditionalPRopertyInlineResponse201(inlineResponse201); return inlineResponse201; } + private Map getConfigProperties() { + final Map configProperties = new HashMap<>(); + configProperties.put("ipAddress", "10.11.12.13"); + return configProperties; + } + private void addAdditionalPRopertyInlineResponse201(final InlineResponse201 inlineResponse201) { final InlineResponse201LinksSelf VnfInstancesLinksSelf = new InlineResponse201LinksSelf(); VnfInstancesLinksSelf -- cgit 1.2.3-korg From eee110cb38b47745cadc65ca7cbb5c64a1965418 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Sun, 5 May 2019 07:51:49 -0400 Subject: Fix deployment of workflows on start Fix deployment of workflows on start Change-Id: Iaa5cb96020da20c96bedb81e0829f73c7461b67f Issue-ID: SO-1837 Signed-off-by: Kuleshov, Elena --- .../so/db/catalog/client/CatalogDbClientTest.java | 15 ++++++ .../MSOInfrastructureApplication.java | 58 ++++++++++++---------- .../onap/so/db/catalog/client/CatalogDbClient.java | 8 +++ .../data/repository/WorkflowRepository.java | 2 + .../data/repository/WorkflowRepositoryTest.java | 10 ++++ 5 files changed, 67 insertions(+), 26 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index 51b44b0d3a..9265e5aa54 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -673,4 +673,19 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest { Assert.assertNull(workflow); } + @Test + public void getWorkflowBySource_validSource_expectedOutput() { + List workflows = client.findWorkflowBySource("sdc"); + assertTrue(workflows != null); + assertTrue(workflows.size() != 0); + + assertEquals("testingWorkflow", workflows.get(0).getArtifactName()); + } + + @Test + public void getWorkflowBySource_invalidSource_nullOutput() { + List workflow = client.findWorkflowBySource("abc"); + Assert.assertNull(workflow); + } + } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index c61808ebb1..8168d2a4b8 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -24,14 +24,14 @@ package org.onap.so.bpmn.infrastructure; import java.util.List; import java.util.concurrent.Executor; -import org.camunda.bpm.application.PostDeploy; +import javax.annotation.PostConstruct; import org.camunda.bpm.application.PreUndeploy; import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.engine.repository.DeploymentBuilder; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; import org.onap.so.db.catalog.beans.Workflow; -import org.onap.so.db.catalog.data.repository.WorkflowRepository; +import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,13 +39,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.Primary; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -56,17 +54,17 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @SpringBootApplication @EnableAsync -@EnableJpaRepositories("org.onap.so.db.catalog.data.repository") -@EntityScan({"org.onap.so.db.catalog.beans"}) @ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class MSOInfrastructureApplication { private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class); + @Autowired + private ProcessEngine processEngine; @Autowired - private WorkflowRepository workflowRepository; + private CatalogDbClient catalogDbClient; @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -79,6 +77,7 @@ public class MSOInfrastructureApplication { private static final String LOGS_DIR = "logs_dir"; private static final String BPMN_SUFFIX = ".bpmn"; + private static final String SDC_SOURCE = "sdc"; private static void setLogsDir() { @@ -93,10 +92,14 @@ public class MSOInfrastructureApplication { setLogsDir(); } - @PostDeploy - public void postDeploy(ProcessEngine processEngineInstance) { - DeploymentBuilder deploymentBuilder = processEngineInstance.getRepositoryService().createDeployment(); - deployCustomWorkflows(deploymentBuilder); + @PostConstruct + public void postConstruct() { + try { + DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment(); + deployCustomWorkflows(deploymentBuilder); + } catch (Exception e) { + logger.warn("Unable to invoke deploymentBuilder: " + e.getMessage()); + } } @PreUndeploy @@ -117,23 +120,26 @@ public class MSOInfrastructureApplication { } public void deployCustomWorkflows(DeploymentBuilder deploymentBuilder) { - if (workflowRepository == null) { - return; - } - List workflows = workflowRepository.findAll(); - if (workflows != null && workflows.size() != 0) { - for (Workflow workflow : workflows) { - String workflowName = workflow.getName(); - String workflowBody = workflow.getBody(); - if (!workflowName.endsWith(BPMN_SUFFIX)) { - workflowName += BPMN_SUFFIX; - } - if (workflowBody != null) { - logger.info("{} {}", "Deploying custom workflow", workflowName); - deploymentBuilder.addString(workflowName, workflowBody); + logger.debug("Attempting to deploy custom workflows"); + try { + List workflows = catalogDbClient.findWorkflowBySource(SDC_SOURCE); + if (workflows != null && workflows.size() != 0) { + for (Workflow workflow : workflows) { + String workflowName = workflow.getName(); + String workflowBody = workflow.getBody(); + if (!workflowName.endsWith(BPMN_SUFFIX)) { + workflowName += BPMN_SUFFIX; + } + if (workflowBody != null) { + logger.info("{} {}", "Deploying custom workflow", workflowName); + deploymentBuilder.addString(workflowName, workflowBody); + } } + deploymentBuilder.enableDuplicateFiltering(true); + deploymentBuilder.deploy(); } - deploymentBuilder.deploy(); + } catch (Exception e) { + logger.warn("Unable to deploy custom workflows, " + e.getMessage()); } } } 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 19200468ae..ab5fdb939c 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 @@ -145,6 +145,7 @@ public class CatalogDbClient { 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"; private static final String TARGET_ENTITY = "SO:CatalogDB"; private static final String ASTERISK = "*"; @@ -191,6 +192,7 @@ public class CatalogDbClient { private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid"; private String findWorkflowByArtifactUUID = "/findByArtifactUUID"; private String findWorkflowByModelUUID = "/findWorkflowByModelUUID"; + private String findWorkflowBySource = "/findBySource"; private String findVnfResourceCustomizationByModelUuid = "/findVnfResourceCustomizationByModelUuid"; private String serviceURI; @@ -333,6 +335,7 @@ public class CatalogDbClient { findWorkflowByArtifactUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByArtifactUUID; findWorkflowByModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByModelUUID; + findWorkflowBySource = endpoint + WORKFLOW + SEARCH + findWorkflowBySource; findVnfResourceCustomizationByModelUuid = endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findVnfResourceCustomizationByModelUuid; @@ -889,4 +892,9 @@ public class CatalogDbClient { return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByModelUUID) .queryParam(VNF_RESOURCE_MODEL_UUID, vnfResourceModelUUID).build().toString())); } + + public List findWorkflowBySource(String source) { + return this.getMultipleResources(workflowClient, + getUri(UriBuilder.fromUri(findWorkflowBySource).queryParam(SOURCE, source).build().toString())); + } } 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 89df52182c..8bcc60c8be 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 @@ -31,6 +31,8 @@ public interface WorkflowRepository extends JpaRepository { Workflow findByArtifactUUID(String artifactUUID); + List findBySource(String source); + /** * Used to fetch the @{link Workflow} by the Model UUID. * diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java index 547b8e50a4..171d4b29f5 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java @@ -44,4 +44,14 @@ public class WorkflowRepositoryTest extends BaseTest { Assert.assertTrue("testingWorkflow".equals(workflows.get(0).getArtifactName())); } + @Test + public void findBySourceTest() throws Exception { + List workflows = workflowRepository.findBySource("sdc"); + + Assert.assertTrue(workflows != null); + Assert.assertTrue(workflows.size() != 0); + + Assert.assertTrue("testingWorkflow".equals(workflows.get(0).getArtifactName())); + } + } -- cgit 1.2.3-korg From 6a32a3f617190b70b3ef285834c9d928f73c2ab1 Mon Sep 17 00:00:00 2001 From: "Merkel, Jeff" Date: Sun, 5 May 2019 11:13:06 -0400 Subject: Check if InstanceGroup modelUUID already exists - Added code to check if InstanceGroup modelUUID already exists in DB. Change-Id: Ibf3bf27e6c0523df80adad6debafa2c2f3a337ec Issue-ID: SO-1845 Signed-off-by: Benjamin, Max (mb388a) --- .../installer/heat/ToscaResourceInstaller.java | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 4e97b5f290..6f3e6c2ec0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -85,6 +85,7 @@ import org.onap.so.db.catalog.beans.HeatEnvironment; import org.onap.so.db.catalog.beans.HeatFiles; import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.so.db.catalog.beans.HeatTemplateParam; +import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.InstanceGroupType; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkInstanceGroup; @@ -1724,16 +1725,25 @@ public class ToscaResourceInstaller { VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) { Metadata instanceMetadata = group.getMetadata(); - // Populate InstanceGroup + + InstanceGroup existingInstanceGroup = + instanceGroupRepo.findByModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup(); - vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - vfcInstanceGroup.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - vfcInstanceGroup.setToscaNodeType(group.getType()); - vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role - vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type + if (existingInstanceGroup == null) { + // Populate InstanceGroup + vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + vfcInstanceGroup + .setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + vfcInstanceGroup.setToscaNodeType(group.getType()); + vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role + vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type + } else { + vfcInstanceGroup = (VFCInstanceGroup) existingInstanceGroup; + } // Populate VNFCInstanceGroupCustomization VnfcInstanceGroupCustomization vfcInstanceGroupCustom = new VnfcInstanceGroupCustomization(); -- cgit 1.2.3-korg From 4fd7200bce3e2addf45dfade43ed901674a82398 Mon Sep 17 00:00:00 2001 From: "Merkel, Jeff" Date: Sun, 5 May 2019 11:14:39 -0400 Subject: VFModule To HeatTemplateUUID - Set existing Heat files on the vfModuleArtifact. Change-Id: Ie01a7932115158dc974ab9ba89a8954a3e732e79 Issue-ID: SO-1846 Signed-off-by: Benjamin, Max (mb388a) --- .../org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 4e97b5f290..1a8026424a 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -1180,6 +1180,8 @@ public class ToscaResourceInstaller { vfModuleArtifact.getArtifactInfo().getArtifactUUID()); heatTemplate.setParameters(heatParam); vfModuleArtifact.setHeatTemplate(heatTemplate); + } else { + vfModuleArtifact.setHeatTemplate(existingHeatTemplate); } } @@ -1208,6 +1210,8 @@ public class ToscaResourceInstaller { heatEnvironment.setArtifactChecksum(MANUAL_RECORD); } vfModuleArtifact.setHeatEnvironment(heatEnvironment); + } else { + vfModuleArtifact.setHeatEnvironment(existingHeatEnvironment); } } @@ -1232,7 +1236,8 @@ public class ToscaResourceInstaller { heatFile.setArtifactChecksum(MANUAL_RECORD); } vfModuleArtifact.setHeatFiles(heatFile); - + } else { + vfModuleArtifact.setHeatFiles(existingHeatFiles); } } -- cgit 1.2.3-korg From e836f741d95b52bd4972626f506e5a8e3082cfc8 Mon Sep 17 00:00:00 2001 From: seshukm Date: Mon, 6 May 2019 14:04:15 +0530 Subject: update the SDC tosca version to 1.5.1 Issue-ID: SO-1834 Change-Id: Iea99bfce2d96611b61f0cba21038d08dd1fa9758 Signed-off-by: seshukm --- asdc-controller/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index 8317b660a6..60c517d944 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -16,8 +16,8 @@ UTF-8 4.7.1 1.8 - 1.5.0 - 1.5.0 + 1.5.1 + 1.5.1 -- cgit 1.2.3-korg From f3eb27f45d205b2d498e4a8bdd307bdb5696b610 Mon Sep 17 00:00:00 2001 From: seshukm Date: Mon, 6 May 2019 14:24:39 +0530 Subject: remove jtosca dependency from BPMN Infra Issue-ID: SO-1834 Change-Id: I94886972032bff3bcd9cb033ccd337ad9e597bf4 Signed-off-by: seshukm --- bpmn/MSOCommonBPMN/pom.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 891a57d0f2..20be69c006 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -363,16 +363,6 @@ org.glassfish.jersey.media jersey-media-json-jackson - - org.onap.sdc.sdc-tosca - sdc-tosca - 1.4.4 - - - org.onap.sdc.jtosca - jtosca - 1.4.4 - org.springframework.boot spring-boot-starter-test -- cgit 1.2.3-korg From 7f5acb3d83b2dc040ba28a57dbde947d792dfbb5 Mon Sep 17 00:00:00 2001 From: seshukm Date: Mon, 6 May 2019 14:26:40 +0530 Subject: Update the Arc diags for SO Issue-ID: SO-675 Change-Id: I55522f10344da148b83cda26820f82f54ebcec90 Signed-off-by: seshukm --- docs/architecture/SO Internal Arc.pptx | Bin 56617 -> 58944 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/docs/architecture/SO Internal Arc.pptx b/docs/architecture/SO Internal Arc.pptx index bff3e352e0..ee4b112b3b 100644 Binary files a/docs/architecture/SO Internal Arc.pptx and b/docs/architecture/SO Internal Arc.pptx differ -- cgit 1.2.3-korg From 51b1454cb5477456e05c4d503f51b31aeb14b0d4 Mon Sep 17 00:00:00 2001 From: seshukm Date: Mon, 6 May 2019 18:52:18 +0530 Subject: bump the SO dublin version to 1.4.1 Issue-ID: SO-1851 Change-Id: I21ab3222a716e8b70ee9d33a9c00832c1807628c Signed-off-by: seshukm --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 668657e962..eff345ceb1 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=4 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} -- cgit 1.2.3-korg From 59b60c10163d492105b32419f1350af2b09f9393 Mon Sep 17 00:00:00 2001 From: seshukm Date: Thu, 9 May 2019 10:25:30 +0530 Subject: UPDATE lICENSE INFO Issue-ID: SO-1854 Change-Id: Ica4cd90f0b89904dbd518521d9722cc2b065771e Signed-off-by: seshukm --- .../resource-examples/vFW/service-Vfw.csar | Bin 96717 -> 96150 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar b/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar index fe0b9f3131..9803d9cd2d 100644 Binary files a/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar and b/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar differ -- cgit 1.2.3-korg From 6a02c565b2cd3f4083617166fa36dea842838601 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Thu, 9 May 2019 20:29:01 -0400 Subject: Add missing UserParametersRepository Add missing UserParametersRepository Change-Id: Iba30896cab00687fcfb6cd5ba703d3579efcac30 Issue-ID: SO-1888 Signed-off-by: Kuleshov, Elena --- .../data/repository/UserParametersRepository.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/UserParametersRepository.java diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/UserParametersRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/UserParametersRepository.java new file mode 100644 index 0000000000..984f8fac99 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/UserParametersRepository.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.UserParameters; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "userParameters", path = "userParameters") +public interface UserParametersRepository extends JpaRepository { + +} -- cgit 1.2.3-korg From d050c852f7a112cbf2cea5012e0cc0997c1936f7 Mon Sep 17 00:00:00 2001 From: Yang Xu Date: Sat, 11 May 2019 20:00:11 -0400 Subject: Fix default Generic NeutronNet template error Change-Id: Ifff06e6b0e37a6c0689ddca925386fdf671366f2 Issue-ID: SO-1873 Signed-off-by: Yang Xu --- .../db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql index 3d8f68408d..5d940fb9ea 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql @@ -11,9 +11,9 @@ parameters: description: Name of the Neutron Network default: ONAP-NW1 shared: - type: boolean - description: Shared amongst tenants - default: False + type: boolean + description: Shared amongst tenants + default: False outputs: network_id: description: Openstack network identifier -- cgit 1.2.3-korg From 3c32e98e85576724f7001dbeb27251552fa2161f Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Mon, 13 May 2019 14:12:13 -0700 Subject: Fix common ccsdk dependency and build Issue-ID: SO-1874 Change-Id: Ie151de0e2a0a0354a988e0d23deb77cd2a66a930 Signed-off-by: Marcus G K Williams --- common/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/pom.xml b/common/pom.xml index 0e9aa1d47c..2742afee1a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -15,7 +15,7 @@ 1.17.1 3.6.1 4.1.30.Final - 0.4.2-SNAPSHOT + 0.4.2 -- cgit 1.2.3-korg From ff70bfacf24da3e9d606bc68f344c982b6dd0419 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Mon, 13 May 2019 13:52:15 -0700 Subject: Fix GR_API no homing path Set correct variable name "homing" in AAICreateTasks.createVNF to ensure GR_API no homing path does not fail. Issue-ID: SO-1870 Change-Id: Ie19d9b5d475d2e3c5bec1f744975906813ab8723 Signed-off-by: Marcus G K Williams --- .../java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 4d4b7c9ad2..d23f9c52ea 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -195,7 +195,7 @@ public class AAICreateTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - execution.setVariable("callHoming", Boolean.TRUE.equals(vnf.isCallHoming())); + execution.setVariable("homing", Boolean.TRUE.equals(vnf.isCallHoming())); aaiVnfResources.createVnfandConnectServiceInstance(vnf, serviceInstance); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); -- cgit 1.2.3-korg From b6571203e371d28229ee1c0c6fda2bfcac59a5b5 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Tue, 14 May 2019 17:04:53 -0700 Subject: Fix build, update sdnc nb version Fix sdnc generic-resource-api-client version by using the released version of the artifact 1.5.1 instead of 1.5.1-SNAPSHOT Issue-ID: SO-1877 Change-Id: Id0419e44ffd88b206a9d183bfd27e4f1da98e60e Signed-off-by: Marcus G K Williams --- bpmn/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 9beb02e329..c4aad4ba69 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -24,7 +24,7 @@ 2.4.0 UTF-8 UTF-8 - 1.5.1-SNAPSHOT + 1.5.1 -- cgit 1.2.3-korg From 406908c43e35f4ff3f8334d00452048c71d93955 Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat (vb8416)" Date: Mon, 13 May 2019 03:00:16 -0400 Subject: Add SO native workflows to result list Added native workflows to result list Issue-ID: SO-1852 Signed-off-by: Bonkur, Venkat (vb8416) Change-Id: Ifeb2adf4ea78b191bcf46a1e7367bc0939d53b83 --- .../WorkflowSpecificationsHandler.java | 7 ++++++ .../WorkflowSpecificationsHandlerTest.java | 11 ++++++++ .../__files/catalogdb/WorkflowSpecifications.json | 16 ++++++++++++ .../WorkflowSpecificationsQuery_Response.json | 29 ++++++++++++++++++++++ 4 files changed, 63 insertions(+) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java index 890b54758e..e8171ac834 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java @@ -73,6 +73,7 @@ public class WorkflowSpecificationsHandler { private static Logger logger = LoggerFactory.getLogger(WorkflowSpecificationsHandler.class); private static final String ARTIFACT_TYPE_WORKFLOW = "workflow"; + private static final String NATIVE_WORKFLOW = "native"; @Path("/{version:[vV]1}/workflows") @GET @@ -88,6 +89,12 @@ public class WorkflowSpecificationsHandler { mapper1.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); List workflows = catalogDbClient.findWorkflowByModelUUID(vnfModelVersionId); + + List nativeWorkflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW); + if (nativeWorkflows != null && nativeWorkflows.size() != 0) { + workflows.addAll(nativeWorkflows); + } + WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(workflows); String jsonResponse = null; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java index 915018f7e4..0beab1bd13 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java @@ -297,6 +297,17 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest { workflow.setWorkflowActivitySpecSequence(workflowActivitySpecSequences); workflows.add(workflow); + Workflow workflowNative = new Workflow(); + workflowNative.setArtifactUUID("da6478e4-ea33-3346-ac12-ab121284a333"); + workflowNative.setArtifactName("VnfInPlaceUpdate.bpmn"); + workflowNative.setVersion(1.0); + workflowNative.setDescription("native workflow"); + workflowNative.setName("VnfInPlaceUpdate"); + workflowNative.setOperationName("inPlaceSoftwareUpdate"); + workflowNative.setSource("native"); + workflowNative.setResourceTarget("vnf"); + workflows.add(workflowNative); + WorkflowSpecifications workflowSpecifications = workflowSpecificationsHandler.mapWorkflowsToWorkflowSpecifications(workflows); ObjectMapper mapper = new ObjectMapper(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json index 5556c602be..545fbbe26c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json @@ -108,6 +108,22 @@ } ] } + }, + { + "workflowSpecification": { + + "artifactInfo": { + "artifactType": "workflow", + "artifactUuid": "da6478e4-ea33-3346-ac12-ab121284a333", + "artifactName": "VnfInPlaceUpdate.bpmn", + "artifactVersion": "1.0", + "artifactDescription": "native workflow", + "workflowName": "VnfInPlaceUpdate", + "operationName": "inPlaceSoftwareUpdate", + "workflowSource": "native", + "workflowResourceTarget": "vnf" + } + } } ] } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json index cbbf0b69f6..8919dbbf2c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsQuery_Response.json @@ -458,6 +458,35 @@ "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec" } } + }, + { + "artifactUUID": "da6478e4-ea33-3346-ac12-ab121284a333", + "artifactName": "VnfInPlaceUpdate.bpmn", + "name": "VnfInPlaceUpdate", + "operationName": "inPlaceSoftwareUpdate", + "version": 1, + "description": "native workflow", + "body": null, + "resourceTarget": "vnf", + "source": "native", + "timeoutMinutes": null, + "artifactChecksum": null, + "created": null, + "vnfResourceWorkflow": null, + "workflowActivitySpecSequence": [], + "id": null, + "workflow": null, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findWorkflowByModelUUID?vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/b5fa707a-f55a-11e7-a796-005056856d52/workflowActivitySpecSequence" + }, + "activitySpec": { + "href": "http://localhost:8090/workflows/b5fa707a-f55a-11e7-a796-005056856d52/activitySpec" + } + } } ] }, -- cgit 1.2.3-korg From a385c0cc6a0ed25cc63fab1368fc686d79f06bca Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Thu, 9 May 2019 12:27:30 -0400 Subject: Use workflow's name for invocation Use workflow's name for invocation Change-Id: Ie527788f029bdccc91f7f406df0a478e55375c01 Issue-ID: SO-1876 Signed-off-by: Kuleshov, Elena --- .../java/org/onap/so/db/catalog/client/CatalogDbClientTest.java | 6 +++--- .../src/test/resources/db/migration/afterMigrate.sql | 2 +- asdc-controller/src/test/resources/data.sql | 2 +- .../main/java/org/onap/so/apihandlerinfra/InstanceManagement.java | 2 +- .../src/test/resources/__files/catalogdb/workflow_Response.json | 3 ++- .../onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java | 6 +++--- mso-catalog-db/src/test/resources/data.sql | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index 9265e5aa54..d8d9ee191a 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -649,7 +649,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest { @Test public void getWorkflowByArtifactUUID_validUuid_expectedOutput() { Workflow workflow = client.findWorkflowByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1"); - assertEquals("artifactName", "testingWorkflow", workflow.getArtifactName()); + assertEquals("artifactName", "testingWorkflow.bpmn", workflow.getArtifactName()); } @Test @@ -664,7 +664,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest { assertTrue(workflows != null); assertTrue(workflows.size() != 0); - assertEquals("testingWorkflow", workflows.get(0).getArtifactName()); + assertEquals("testingWorkflow.bpmn", workflows.get(0).getArtifactName()); } @Test @@ -679,7 +679,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest { assertTrue(workflows != null); assertTrue(workflows.size() != 0); - assertEquals("testingWorkflow", workflows.get(0).getArtifactName()); + assertEquals("testingWorkflow.bpmn", workflows.get(0).getArtifactName()); } @Test diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql index 0229dd0d85..1ba1597c73 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -225,7 +225,7 @@ insert into pnf_resource_customization_to_service(service_model_uuid, resource_m ('5df8b6de-2083-11e7-93ae-92361f002676', '68dc9a92-214c-11e7-93ae-92361f002680'); insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values -('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); +('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values ('ff2ae348-214a-11e7-93ae-92361f002671', '1'); diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql index 47e6c4c982..c9179fe65f 100644 --- a/asdc-controller/src/test/resources/data.sql +++ b/asdc-controller/src/test/resources/data.sql @@ -26,7 +26,7 @@ insert into vnf_resource(orchestration_mode, description, creation_timestamp, mo ('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null); insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values -('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); +('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values ('ff2ae348-214a-11e7-93ae-92361f002671', '1'); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java index c491444f39..dd6050bf60 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java @@ -255,7 +255,7 @@ public class InstanceManagement { if (workflow == null) { return null; } else { - String workflowName = workflow.getArtifactName(); + String workflowName = workflow.getName(); recipeUri = "/mso/async/services/" + workflowName; } return new RecipeLookupResult(recipeUri, 180); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_Response.json index 6e358f7e17..d6ed585537 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_Response.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_Response.json @@ -1,4 +1,5 @@ { "artifactUUID": "71526781-e55c-4cb7-adb3-97e09d9c76be", - "artifactName": "testingWorkflow" + "artifactName": "testingWorkflow.bpmn", + "name": "testingWorkflow" } \ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java index 171d4b29f5..7d1b8d0d96 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java @@ -31,7 +31,7 @@ public class WorkflowRepositoryTest extends BaseTest { public void findByArtifactUuid_ValidUuid_ExpectedOutput() throws Exception { Workflow workflow = workflowRepository.findByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1"); - assertEquals("artifactName", "testingWorkflow", workflow.getArtifactName()); + assertEquals("artifactName", "testingWorkflow.bpmn", workflow.getArtifactName()); } @Test @@ -41,7 +41,7 @@ public class WorkflowRepositoryTest extends BaseTest { Assert.assertTrue(workflows != null); Assert.assertTrue(workflows.size() != 0); - Assert.assertTrue("testingWorkflow".equals(workflows.get(0).getArtifactName())); + Assert.assertTrue("testingWorkflow.bpmn".equals(workflows.get(0).getArtifactName())); } @Test @@ -51,7 +51,7 @@ public class WorkflowRepositoryTest extends BaseTest { Assert.assertTrue(workflows != null); Assert.assertTrue(workflows.size() != 0); - Assert.assertTrue("testingWorkflow".equals(workflows.get(0).getArtifactName())); + Assert.assertTrue("testingWorkflow.bpmn".equals(workflows.get(0).getArtifactName())); } } diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql index f6d04263c0..31f59203ca 100644 --- a/mso-catalog-db/src/test/resources/data.sql +++ b/mso-catalog-db/src/test/resources/data.sql @@ -742,7 +742,7 @@ insert into pnf_resource_customization_to_service(service_model_uuid, resource_m ('5df8b6de-2083-11e7-93ae-92361f002676', '68dc9a92-214c-11e7-93ae-92361f002680'); insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values -('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); +('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc'); insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values ('ff2ae348-214a-11e7-93ae-92361f002671', '1'); -- cgit 1.2.3-korg From e987cf53cb03f19cb77a23b805dda270efe62385 Mon Sep 17 00:00:00 2001 From: sarada prasad sahoo Date: Thu, 16 May 2019 15:07:16 +0530 Subject: Fix DeleteE2EServiceInstance flow Fixed the issue when subprocess 'DoDeleteE2EServiceInstance' calls 'AAI GenericGetService' sub-process which is deleted from SO common-bpmn Change-Id: Ie170b430a21df6dc8e7ff95a9d7f2091c11a600b Issue-ID: SO-1809 Signed-off-by: sarada prasad sahoo --- .../onap/so/bpmn/common/recipe/ResourceInput.java | 3 +- .../scripts/DeleteSDNCNetworkResource.groovy | 13 +- .../scripts/DoDeleteE2EServiceInstance.groovy | 201 +++++++++--------- .../scripts/DoDeleteResourcesV1.groovy | 9 +- .../subprocess/DoDeleteE2EServiceInstance.bpmn | 232 +++++++++------------ 5 files changed, 215 insertions(+), 243 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index 2bb024897c..340addcabf 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -21,6 +21,7 @@ */ package org.onap.so.bpmn.common.recipe; +import java.io.Serializable; import org.onap.so.bpmn.core.domain.ModelInfo; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -43,7 +44,7 @@ import org.slf4j.LoggerFactory; "operationId", "serviceModelInfo", "resourceModelInfo", "resourceInstancenUuid", "resourceParameters", "operationType"}) @JsonRootName("variables") -public class ResourceInput { +public class ResourceInput implements Serializable { private static Logger logger = LoggerFactory.getLogger(ResourceInput.class); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 20134a77a9..dd9991bbd4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -152,6 +152,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } + logger.info(" ***** Exit preProcessRequest *****") } /** @@ -174,6 +175,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") + String resourceInput = execution.getVariable(Prefix + "resourceInput") + logger.info("The resourceInput is: " + resourceInput) ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() @@ -373,6 +376,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) { + logger.debug( " *** prepareUpdateBeforeDeleteSDNCResource *** ") + String resourceInput = execution.getVariable(Prefix + "resourceInput"); ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() @@ -402,10 +407,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { """; setProgressUpdateVariables(execution, body) + logger.debug(" ***** Exit prepareUpdateBeforeDeleteSDNCResource *****") } public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) { + logger.debug( " *** prepareUpdateAfterDeleteSDNCResource *** ") + String resourceInput = execution.getVariable(Prefix + "resourceInput"); ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() @@ -435,15 +443,16 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { """; setProgressUpdateVariables(execution, body) + logger.debug(" ***** Exit prepareUpdateAfterDeleteSDNCResource *****") } public void postDeleteSDNCCall(DelegateExecution execution){ - logger.info(" ***** Started prepareSDNCRequest *****") + logger.info(" ***** Started postDeleteSDNCCall *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) - logger.info(" ***** Exit prepareSDNCRequest *****") + logger.info(" ***** Exit postDeleteSDNCCall *****") } public void sendSyncResponse (DelegateExecution execution) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index f2af481f66..e5b8d52376 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -28,6 +28,10 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject +import org.onap.aai.domain.yang.RelatedToProperty +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipData +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -38,6 +42,11 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity @@ -46,6 +55,7 @@ import org.w3c.dom.Document import org.w3c.dom.Node import org.xml.sax.InputSource +import javax.ws.rs.NotFoundException import javax.ws.rs.core.Response import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory @@ -113,7 +123,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution) + String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback', execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" logger.info(msg) @@ -161,80 +171,60 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String msg = "" try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - if(foundInAAI){ - logger.debug("Found Service-instance in AAI") + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('serviceType') - String siData = execution.getVariable("GENGS_service") - logger.debug("SI Data") - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - logger.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - InputSource source = new InputSource(new StringReader(siData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - serviceXml.getDocumentElement().normalize() - // get model invariant id - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - logger.debug("SI Data model-invariant-id and model-version-id exist") - def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent() - def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent() - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - logger.debug("SI Data" + siData) - //Confirm there are no related service instances (vnf/network or volume) - if (utils.nodeExists(siData, "relationship-list")) { - logger.debug("SI Data relationship-list exists") - JSONArray jArray = new JSONArray() + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) - XmlParser xmlParser = new XmlParser() - Node root = xmlParser.parseText(siData) - def relation_list = utils.getChildNode(root, 'relationship-list') - def relationships = utils.getIdenticalChildren(relation_list, 'relationship') + if (!resourceClient.exists(serviceInstanceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } - for (def relation: relationships) { - def jObj = getRelationShipData(relation, isDebugEnabled) - jArray.put(jObj) - } + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) - execution.setVariable("serviceRelationShip", jArray.toString()) - execution.setVariable("serviceRelationShip", jArray.toString()) - } + Optional si = wrapper.asBean(ServiceInstance.class) + + // found in AAI + if (si.isPresent() && StringUtils.isNotEmpty(si.get().getServiceInstanceName())) { + logger.debug("Found Service-instance in AAI") + execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName()) + // get model invariant id + // Get Template uuid and version + if ((null != si.get().getModelInvariantId()) && (null != si.get().getModelVersionId())) { + logger.debug("SI Data model-invariant-id and model-version-id exist") + + // Set Original Template info + execution.setVariable("model-invariant-id-original", si.get().getModelInvariantId()) + execution.setVariable("model-version-id-original", si.get().getModelVersionId()) } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - logger.debug("Error getting Service-instance from AAI :" + serviceInstanceId) - WorkflowException workflowException = execution.getVariable("WorkflowException") - if(workflowException != null){ - logger.error("workflowException: " + workflowException) - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - logger.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + + if ((null != si.get().getRelationshipList()) && (null != si.get().getRelationshipList().getRelationship())) { + logger.debug("SI Data relationship-list exists") + List relationshipList = si.get().getRelationshipList().getRelationship() + JSONArray jArray = new JSONArray() + for (Relationship relationship : relationshipList) { + def jObj = getRelationShipData(relationship) + jArray.put(jObj) } + + execution.setVariable("serviceRelationShip", jArray.toString()) } - logger.debug("Service-instance NOT found in AAI. Silent Success") + } else { + + msg = "Service-instance: " + serviceInstanceId + " NOT found in AAI." + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } - }catch (BpmnError e) { + } catch (BpmnError e) { throw e + } catch (NotFoundException e) { + logger.debug("Service Instance does not exist AAI") + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance was not found in aai") } catch (Exception ex) { msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() logger.debug(msg) @@ -243,50 +233,50 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { logger.debug(" *** Exit postProcessAAIGET *** ") } - private JSONObject getRelationShipData(node, isDebugEnabled){ - JSONObject jObj = new JSONObject() + private JSONObject getRelationShipData(Relationship relationship) { + JSONObject jObj = new JSONObject() - def relation = utils.nodeToString(node) - def rt = utils.getNodeText(relation, "related-to") - def rl = utils.getNodeText(relation, "related-link") - logger.debug("ServiceInstance Related NS/Configuration :" + rl) + def rt = relationship.getRelatedTo() - def rl_datas = utils.getIdenticalChildren(node, "relationship-data") - for(def rl_data : rl_datas) { - def eKey = utils.getChildNodeText(rl_data, "relationship-key") - def eValue = utils.getChildNodeText(rl_data, "relationship-value") + def rl = relationship.getRelatedLink() + logger.debug("ServiceInstance Related NS/Configuration :" + rl) - if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-id") - )){ - jObj.put("resourceInstanceId", eValue) - } - // for sp-partner and others - else if(eKey.endsWith("-id")){ - jObj.put("resourceInstanceId", eValue) - String resourceName = rt + eValue; - jObj.put("resourceType", resourceName) - } + List rl_datas = relationship.getRelationshipData() + for (RelationshipData rl_data : rl_datas) { + def eKey = rl_data.getRelationshipKey() + def eValue = rl_data.getRelationshipValue() - jObj.put("resourceLinkUrl", rl) - } + if ((rt.equals("service-instance") && eKey.equals("service-instance.service-instance-id")) + //for overlay/underlay + || (rt.equals("configuration") && eKey.equals("configuration.configuration-id") + )) { + jObj.put("resourceInstanceId", eValue) + } + // for sp-partner and others + else if (eKey.endsWith("-id")) { + jObj.put("resourceInstanceId", eValue) + String resourceName = rt + eValue; + jObj.put("resourceType", resourceName) + } - def rl_props = utils.getIdenticalChildren(node, "related-to-property") - for(def rl_prop : rl_props) { - def eKey = utils.getChildNodeText(rl_prop, "property-key") - def eValue = utils.getChildNodeText(rl_prop, "property-value") - if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){ - jObj.put("resourceType", eValue) - } - } + jObj.put("resourceLinkUrl", rl) + } - logger.debug("Relationship related to Resource:" + jObj.toString()) - return jObj - } + List rl_props = relationship.getRelatedToProperty() + for (RelatedToProperty rl_prop : rl_props) { + def eKey = rl_prop.getPropertyKey() + def eValue = rl_prop.getPropertyValue() + if ((rt.equals("service-instance") && eKey.equals("service-instance.service-instance-name")) + //for overlay/underlay + || (rt.equals("configuration") && eKey.equals("configuration.configuration-type"))) { + jObj.put("resourceType", eValue) + } + } + + logger.debug("Relationship related to Resource:" + jObj.toString()) + return jObj + } public void getCurrentNS(DelegateExecution execution){ logger.info( "======== Start getCurrentNS Process ======== ") @@ -392,7 +382,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } public void postDecomposeService(DelegateExecution execution) { - logger.debug(" ***** Inside processDecomposition() of delete generic e2e service flow ***** ") + logger.debug(" ***** Inside postDecomposeService() of delete generic e2e service flow ***** ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") @@ -439,7 +429,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { // only delete real existing resources execution.setVariable("deleteResourceList", deleteRealResourceList) - + boolean isDeleteResourceListValid = false if(deleteRealResourceList.size() > 0) { isDeleteResourceListValid = true @@ -452,7 +442,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { logger.error(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - logger.debug( " ***** exit processDecomposition() of delete generic e2e service flow ***** ") + logger.debug( " ***** exit postDecomposeService() of delete generic e2e service flow ***** ") } public void preInitResourcesOperStatus(DelegateExecution execution){ @@ -506,7 +496,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } logger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ") } - + public void prepareUpdateServiceOperationStatus(DelegateExecution execution){ logger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ") try{ @@ -517,7 +507,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String progress = execution.getVariable("progress") String reason = "" String operationContent = execution.getVariable("operationContent") - + serviceId = UriUtils.encode(serviceId,"UTF-8") def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) @@ -560,4 +550,5 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { //to do } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 7e194657fb..0d096f3b16 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -102,7 +102,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution) + String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback', execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" logger.error(msg) @@ -263,9 +263,10 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); resourceInput.setServiceType(serviceType) - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri - - HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + recipeUri + + BpmnRestClient bpmnRestClient = new BpmnRestClient() + HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) logger.debug(" ======== END executeResourceDelete Process ======== ") }catch(BpmnError b){ logger.error("Rethrowing MSOWorkflowException") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 9f9d58fa19..4d0324e478 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0vz7cd9 @@ -7,28 +7,28 @@ SequenceFlow_0vz7cd9 SequenceFlow_11e6bfy - import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoDeleteE2EServiceInstance() ddsi.preProcessRequest(execution) -]]> + SequenceFlow_0e7inkl - SequenceFlow_188ejvu + SequenceFlow_11e6bfy SequenceFlow_0vi0sv6 - import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoDeleteE2EServiceInstance() -ddsi.postProcessAAIGET(execution)]]> +ddsi.postProcessAAIGET(execution) SequenceFlow_1cevtpy SequenceFlow_12rr1yy SequenceFlow_0e7inkl - import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCustomDeleteE2EServiceInstance() -ddsi.deleteServiceInstance(execution)]]> +ddsi.deleteServiceInstance(execution) @@ -41,22 +41,22 @@ ddsi.deleteServiceInstance(execution)]]> SequenceFlow_1921mo3 SequenceFlow_18vlzfo - import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]> +ex.processJavaException(execution) - + SequenceFlow_1961633 SequenceFlow_1ym9otf - import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoDeleteE2EServiceInstance() -ddsi.preInitResourcesOperStatus(execution)]]> +ddsi.preInitResourcesOperStatus(execution) @@ -81,22 +81,6 @@ ddsi.preInitResourcesOperStatus(execution)]]> SequenceFlow_1j08ko3 - - - - - - - - - - - - - SequenceFlow_11e6bfy - SequenceFlow_188ejvu - - @@ -108,9 +92,9 @@ ddsi.preInitResourcesOperStatus(execution)]]> SequenceFlow_1q2mqnm SequenceFlow_0fo5vw5 - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoDeleteE2EServiceInstance() -dcsi.prepareDecomposeService(execution)]]> +dcsi.prepareDecomposeService(execution) @@ -130,9 +114,9 @@ dcsi.prepareDecomposeService(execution)]]> SequenceFlow_0orw2f8 SequenceFlow_013rime - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoDeleteE2EServiceInstance() -dcsi.postDecomposeService(execution)]]> +dcsi.postDecomposeService(execution) @@ -177,7 +161,7 @@ dcsi.postDecomposeService(execution)]]> - + #{(execution.getVariable("isDeleteResourceListValid" ) == true)} @@ -206,12 +190,12 @@ dcsi.postDecomposeService(execution)]]> SequenceFlow_0h5c1bd SequenceFlow_1ab3vex - import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("result", "finished") execution.setVariable("operationContent", "No actual resoure in service instance") def csi= new DoDeleteE2EServiceInstance() -csi.prepareUpdateServiceOperationStatus(execution)]]> +csi.prepareUpdateServiceOperationStatus(execution) SequenceFlow_0h5c1bd @@ -224,263 +208,249 @@ csi.prepareUpdateServiceOperationStatus(execution)]]> - + - + - + - + - + - + - + - - - - + + + + - - - - + + - - + + - + - + - + - - + + - - + + - + - + - - + + - - - - - - - - - - - - - - + + - - - - + + + + - - - - + + + + - + - + - - + + - + - + - + - + - - + + - + - + - - + + - + - + - - - - + + + + - + - + - + - + - + - + - - + + - + - - + + - - + + - + - + - + - + - - + + - - + + - - - - + + + + -- cgit 1.2.3-korg From 6f1e0c58c104c6cfbefd7dbb6e10f9f8933961ce Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Thu, 16 May 2019 08:12:13 -0700 Subject: Bump SO artifact version Since SO 1.4.1 has already been released, the staging builds should be building the next version going forward. Change-Id: I54e898054f2928bc4e727003574c54199485a71f Issue-ID: SO-1851 Signed-off-by: Gary Wu --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index eff345ceb1..77e67b1c3c 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=4 -patch=1 +patch=2 base_version=${major}.${minor}.${patch} -- cgit 1.2.3-korg From f560858c81aba4da53c7033870b235d608c0c162 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Thu, 16 May 2019 16:44:32 -0700 Subject: Fix CloudOwner Capitalization in R__MacroData.sql Issue-ID: SO-1889 Change-Id: I2f964ba9ca7dbeb73796853d367b090cb5c26c0f Signed-off-by: Marcus G K Williams --- .../main/resources/db/migration/R__MacroData.sql | 288 ++++++++++----------- 1 file changed, 144 insertions(+), 144 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 238c4cf467..824d1df3d6 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -8,146 +8,146 @@ DELETE FROM orchestration_status_state_transition_directive; INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE,IS_TOPLEVELFLOW, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER) VALUES -('Service-Create', 'createInstance', 'Service', true,true, '7','7', 'cloudOwner'), -('Service-Delete', 'deleteInstance', 'Service', true,true, '7','7', 'cloudOwner'), -('Service-Macro-Assign', 'assignInstance', 'Service', false,true, '7','7', 'cloudOwner'), -('Service-Macro-Activate', 'activateInstance', 'Service', false,true, '7','7', 'cloudOwner'), -('Service-Macro-Unassign', 'unassignInstance', 'Service', false,true, '7','7', 'cloudOwner'), -('Service-Macro-Create', 'createInstance', 'Service', false,true, '7','7', 'cloudOwner'), -('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'cloudOwner'), -('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'cloudOwner'), -('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'cloudOwner'), -('VNF-Macro-Recreate', 'recreateInstance', 'Vnf', false,true, '7','7', 'cloudOwner'), -('VNF-Macro-Replace', 'replaceInstance', 'Vnf', false,true, '7','7', 'cloudOwner'), -('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'cloudOwner'), -('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'cloudOwner'), -('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'cloudOwner'), -('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'cloudOwner'), -('VFModule-Create', 'createInstance', 'VfModule', true,true, '7','7', 'cloudOwner'), -('VFModule-Delete', 'deleteInstance', 'VfModule', true,true, '7','7', 'cloudOwner'), -('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'cloudOwner'), -('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'cloudOwner'), -('VFModule-ScaleOut', 'createInstance', 'VfModule', true, true, '7','7', 'cloudOwner'); +('Service-Create', 'createInstance', 'Service', true,true, '7','7', 'CloudOwner'), +('Service-Delete', 'deleteInstance', 'Service', true,true, '7','7', 'CloudOwner'), +('Service-Macro-Assign', 'assignInstance', 'Service', false,true, '7','7', 'CloudOwner'), +('Service-Macro-Activate', 'activateInstance', 'Service', false,true, '7','7', 'CloudOwner'), +('Service-Macro-Unassign', 'unassignInstance', 'Service', false,true, '7','7', 'CloudOwner'), +('Service-Macro-Create', 'createInstance', 'Service', false,true, '7','7', 'CloudOwner'), +('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'CloudOwner'), +('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'CloudOwner'), +('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'CloudOwner'), +('VNF-Macro-Recreate', 'recreateInstance', 'Vnf', false,true, '7','7', 'CloudOwner'), +('VNF-Macro-Replace', 'replaceInstance', 'Vnf', false,true, '7','7', 'CloudOwner'), +('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'CloudOwner'), +('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'CloudOwner'), +('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'CloudOwner'), +('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'CloudOwner'), +('VFModule-Create', 'createInstance', 'VfModule', true,true, '7','7', 'CloudOwner'), +('VFModule-Delete', 'deleteInstance', 'VfModule', true,true, '7','7', 'CloudOwner'), +('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner'), +('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner'), +('VFModule-ScaleOut', 'createInstance', 'VfModule', true, true, '7','7', 'CloudOwner'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES -('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Create', '2', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Delete', '1', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Delete', '2', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Assign', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Assign', '2', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Assign', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Assign', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Assign', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Assign', '6', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '1', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '2', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '3', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '4', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '5', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '6', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '7', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Activate', '9', 'ActivateServiceInstance', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Unassign', '1', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Unassign', '2', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Unassign', '3', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Unassign', '4', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Unassign', '5', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '2', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '3', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '4', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '5', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '6', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '7', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '8', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '9', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '10', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '11', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '12', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '13', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '14', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '15', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '16', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Create', '17', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '10', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '11', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '12', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '13', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '14', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Service-Macro-Delete', '15', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Network-Create', '1', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')), -('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')), -('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')), -('Network-Delete', '1', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Network-Delete', '2', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')), -('Network-Delete', '3', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Create', '1', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Create', '2', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Delete', '1', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Delete', '2', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '6', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '7', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '9', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Recreate', '10', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '5', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '6', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '7', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '8', 'ChangeModelVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '9', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '10', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '13', 'ChangeModelVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '14', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '15', 'ChangeModelServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '16', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VNF-Macro-Replace', '17', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), -('VolumeGroup-Create', '1', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')), -('VolumeGroup-Create', '2', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')), -('VolumeGroup-Create', '3', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')), -('VolumeGroup-Delete', '1', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VolumeGroup-Delete', '2', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VolumeGroup-Delete', '3', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-Create', '1', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-Create', '2', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-Create', '3', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-Delete', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-Delete', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-Delete', '5', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Create', '1', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Create', '2', 'AssignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Create', '3', 'CreateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Create', '4', 'ActivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Create', '5', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Delete', '1', 'DeactivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Delete', '2', 'DeleteNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Delete', '3', 'UnassignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Delete', '4', 'DeactivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('NetworkCollection-Macro-Delete', '5', 'DeleteNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-ScaleOut', '1', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-ScaleOut', '2', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-ScaleOut', '3', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-ScaleOut', '4', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-ScaleOut', '5', 'ConfigurationScaleOutBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-ScaleOut', '6', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')); +('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Create', '2', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Delete', '1', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Delete', '2', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Assign', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Assign', '2', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Assign', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Assign', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Assign', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Assign', '6', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '1', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '2', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '3', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '4', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '5', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '6', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '7', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Activate', '9', 'ActivateServiceInstance', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Unassign', '1', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Unassign', '2', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Unassign', '3', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Unassign', '4', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Unassign', '5', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '2', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '3', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '4', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '5', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '6', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '7', 'ConfigAssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '8', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '9', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '10', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '11', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '12', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '13', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '14', 'ConfigDeployVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '15', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '16', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Create', '17', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '10', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '11', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '12', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '13', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '14', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Service-Macro-Delete', '15', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Network-Create', '1', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'CloudOwner')), +('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'CloudOwner')), +('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'CloudOwner')), +('Network-Delete', '1', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Network-Delete', '2', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'CloudOwner')), +('Network-Delete', '3', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Create', '1', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Create', '2', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Delete', '1', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Delete', '2', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '6', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '7', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '9', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Recreate', '10', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '5', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '6', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '7', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '8', 'ChangeModelVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '9', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '10', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '13', 'ChangeModelVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '14', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '15', 'ChangeModelServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '16', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VNF-Macro-Replace', '17', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'CloudOwner')), +('VolumeGroup-Create', '1', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'CloudOwner')), +('VolumeGroup-Create', '2', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'CloudOwner')), +('VolumeGroup-Create', '3', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'CloudOwner')), +('VolumeGroup-Delete', '1', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VolumeGroup-Delete', '2', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VolumeGroup-Delete', '3', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-Create', '1', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-Create', '2', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-Create', '3', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-Delete', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-Delete', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-Delete', '5', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Create', '1', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Create', '2', 'AssignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Create', '3', 'CreateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Create', '4', 'ActivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Create', '5', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Delete', '1', 'DeactivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Delete', '2', 'DeleteNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Delete', '3', 'UnassignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Delete', '4', 'DeactivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('NetworkCollection-Macro-Delete', '5', 'DeleteNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-ScaleOut', '1', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-ScaleOut', '2', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-ScaleOut', '3', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-ScaleOut', '4', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-ScaleOut', '5', 'ConfigurationScaleOutBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-ScaleOut', '6', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'CloudOwner')); INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY) VALUES @@ -620,17 +620,17 @@ VALUES ('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE'); INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES -('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true, 'cloudOwner'); +('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true, 'CloudOwner'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES -('VFModule-DeactivateAndCloudDelete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'cloudOwner')), -('VFModule-DeactivateAndCloudDelete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'cloudOwner')); +('VFModule-DeactivateAndCloudDelete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'CloudOwner')), +('VFModule-DeactivateAndCloudDelete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'CloudOwner')); INSERT INTO northbound_request_ref_lookup (REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) -values ( 'Service', 'Service-Macro-Deactivate', 'deactivateInstance', '0', '7', '7', '1', 'cloudOwner'); +values ( 'Service', 'Service-Macro-Deactivate', 'deactivateInstance', '0', '7', '7', '1', 'CloudOwner'); INSERT INTO orchestration_flow_reference (COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) -values ( 'Service-Macro-Deactivate', '1', 'DeactivateServiceInstanceBB', '1', (SELECT id FROM northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Deactivate' and CLOUD_OWNER = 'cloudOwner')); +values ( 'Service-Macro-Deactivate', '1', 'DeactivateServiceInstanceBB', '1', (SELECT id FROM northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Deactivate' and CLOUD_OWNER = 'CloudOwner')); UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Create'; @@ -640,9 +640,9 @@ UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Deactivate'; INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES -('Network-Update', 'updateInstance', 'Network', true, '7','7','1', 'cloudOwner'); +('Network-Update', 'updateInstance', 'Network', true, '7','7','1', 'CloudOwner'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES -('Network-Update', '1', 'UpdateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Update' and CLOUD_OWNER = 'cloudOwner')); +('Network-Update', '1', 'UpdateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Update' and CLOUD_OWNER = 'CloudOwner')); INSERT INTO building_block_detail(BUILDING_BLOCK_NAME,RESOURCE_TYPE,TARGET_ACTION) VALUES ('UpdateNetworkBB','NETWORK','UPDATE'); -- cgit 1.2.3-korg From c0650e43c4228596831e5c49934a26ba4c221099 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Thu, 16 May 2019 17:42:38 -0700 Subject: Fix homing gateway in AssignVnfBB Issue-ID: SO-1870 Change-Id: Id750d961276c5a4074363ed4746e95c9b67cceeb Signed-off-by: Marcus G K Williams --- .../src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn index 7bb97939dd..d522f3445e 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -24,7 +24,7 @@ - + -- cgit 1.2.3-korg From 2fcd0d81688ca3dbde9c3853a0eca5aed9e4da7d Mon Sep 17 00:00:00 2001 From: Ramesh Parthasarathy Date: Thu, 16 May 2019 21:15:29 -0700 Subject: Addressed vCPE-Infra processing issue ASDC Controller code was modified to address vCPE-infra notification received from SDC. Also added unit tests to ensure that the code works as expected. Change-Id: I217e2dfed9548bfb0e9b93c96aaf75afc1d4171c Issue-ID: SO-1861 Signed-off-by: Ramesh Parthasarathy(rp6768) --- .../org/onap/so/asdc/client/ASDCController.java | 24 +- .../client/test/rest/ASDCRestInterfaceTest.java | 46 +++ asdc-controller/src/test/resources/data.sql | 2 + .../vcpe-infra/base_vcpe_infra.env | 37 ++ .../vcpe-infra/base_vcpe_infra.yaml | 460 +++++++++++++++++++++ .../vcpe-infra/demovcpeinfra-notification.json | 111 +++++ .../vcpe-infra/service-Demovcpeinfra-csar.csar | Bin 0 -> 115651 bytes .../vcpe_infrabf35304fe92f0_modules.json | 25 ++ .../vcpe-infra/vendor-license-model.xml | 1 + .../vcpe-infra/vf-license-model.xml | 1 + 10 files changed, 695 insertions(+), 12 deletions(-) create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml create mode 100644 asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 9597158cb6..c0f403f388 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -784,24 +784,24 @@ public class ASDCController { errorMessage = e.getMessage(); logger.error("Exception occurred", e); } + } - if (!hasVFResource) { + if (!hasVFResource) { - logger.debug("No resources found for Service: " + iNotif.getServiceUUID()); + logger.debug("No resources found for Service: " + iNotif.getServiceUUID()); - logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID()); - try { - this.deployResourceStructure(resourceStructure, toscaResourceStructure); - } catch (ArtifactInstallerException e) { - deployStatus = DistributionStatusEnum.DEPLOY_ERROR; - errorMessage = e.getMessage(); - logger.error("Exception occurred", e); - } + logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID()); + try { + this.deployResourceStructure(resourceStructure, toscaResourceStructure); + } catch (ArtifactInstallerException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + errorMessage = e.getMessage(); + logger.error("Exception occurred", e); } - this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus, - errorMessage); } + this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus, + errorMessage); } catch (ASDCDownloadException | UnsupportedEncodingException e) { logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index ac107f6449..2c520a3bba 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -27,11 +27,15 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashSet; +import java.util.List; +import java.util.Optional; import java.util.Set; import javax.transaction.Transactional; import javax.ws.rs.core.Response; @@ -45,11 +49,15 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.db.catalog.beans.AllottedResource; import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResource; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.Workflow; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; +import org.onap.so.db.catalog.data.repository.ToscaCsarRepository; import org.onap.so.db.catalog.data.repository.WorkflowRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -74,6 +82,9 @@ public class ASDCRestInterfaceTest extends BaseTest { @Autowired private WorkflowRepository workflowRepo; + @Autowired + private ToscaCsarRepository toscaCsarRepo; + @Autowired private ASDCRestInterface asdcRestInterface; @@ -244,6 +255,41 @@ public class ASDCRestInterfaceTest extends BaseTest { } + + @Test + public void test_Vcpe_Infra_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + String resourceLocation = "src/test/resources/resource-examples/vcpe-infra/"; + + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demovcpeinfra-notification.json"), + NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity entity = new HttpEntity(request, headers); + + ResponseEntity response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional toscaCsar = toscaCsarRepo.findById("144606d8-a505-4ba0-90a9-6d1c6219fc6b"); + assertTrue(toscaCsar.isPresent()); + assertEquals("service-Demovcpeinfra-csar.csar", toscaCsar.get().getName()); + + Optional service = serviceRepo.findById("8a77cbbb-9850-40bb-a42f-7aec8e3e6ab7"); + assertTrue(service.isPresent()); + assertEquals("demoVCPEInfra", service.get().getModelName()); + + Optional networkResource = networkRepo.findById("89789b26-a46b-4cee-aed0-d46e21f93a5e"); + assertTrue(networkResource.isPresent()); + assertEquals("Generic NeutronNet", networkResource.get().getModelName()); + } + protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql index c9179fe65f..bc97b1e54a 100644 --- a/asdc-controller/src/test/resources/data.sql +++ b/asdc-controller/src/test/resources/data.sql @@ -21,6 +21,8 @@ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_ ('TENANT_OAM_NETWORK', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL); INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES ('SRIOV_PROVIDER_NETWORK', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL); +INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES +('Generic NeutronNet', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL); insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values ('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null); diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env new file mode 100644 index 0000000000..85d3ea19a3 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env @@ -0,0 +1,37 @@ +parameters: + cloud_env: "PUT THE CLOUD PROVIDED HERE (openstack or rackspace)" + cpe_public_net_cidr: "10.2.0.0/24" + cpe_public_net_id: "zdfw1cpe01_public" + cpe_public_subnet_id: "zdfw1cpe01_sub_public" + cpe_signal_net_cidr: "10.4.0.0/24" + cpe_signal_net_id: "zdfw1cpe01_private" + cpe_signal_subnet_id: "zdfw1cpe01_sub_private" + dcae_collector_ip: "10.0.4.1" + dcae_collector_port: "8081" + demo_artifacts_version: "1.4.0" + install_script_version: "1.4.0" + key_name: "vaaa_key" + mr_ip_addr: "10.0.11.1" + mr_ip_port: "3904" + nexus_artifact_repo: "https://nexus.onap.org" + onap_private_net_cidr: "10.0.0.0/16" + onap_private_net_id: "PUT THE ONAP PRIVATE NETWORK NAME HERE" + onap_private_subnet_id: "PUT THE ONAP PRIVATE SUBNETWORK NAME HERE" + pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN" + public_net_id: "PUT THE PUBLIC NETWORK ID HERE" + vaaa_name_0: "zdcpe1cpe01aaa01" + vaaa_private_ip_0: "10.4.0.4" + vaaa_private_ip_1: "10.0.101.2" + vcpe_flavor_name: "PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED)" + vcpe_image_name: "PUT THE IMAGE NAME HERE (Ubuntu 1604 SUGGESTED)" + vdhcp_name_0: "zdcpe1cpe01dhcp01" + vdhcp_private_ip_0: "10.4.0.1" + vdhcp_private_ip_1: "10.0.101.1" + vdns_name_0: "zdcpe1cpe01dns01" + vdns_private_ip_0: "10.2.0.1" + vdns_private_ip_1: "10.0.101.3" + vf_module_id: "vCPE_Intrastructure" + vnf_id: "vCPE_Infrastructure_demo_app" + vweb_name_0: "zdcpe1cpe01web01" + vweb_private_ip_0: "10.2.0.10" + vweb_private_ip_1: "10.0.101.40" diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml new file mode 100644 index 0000000000..9f3bf27492 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml @@ -0,0 +1,460 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +########################################################################## + +heat_template_version: 2013-05-23 + +description: Heat template to deploy vCPE Infrastructue emlements (vAAA, vDHCP, vDNS_DHCP, webServer) + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + vcpe_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vcpe_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + public_net_id: + type: string + label: Public network name or ID + description: Public network that enables remote connection to VNF + onap_private_net_id: + type: string + label: ONAP management network name or ID + description: Private network that connects ONAP components and the VNF + onap_private_subnet_id: + type: string + label: ONAP management sub-network name or ID + description: Private sub-network that connects ONAP components and the VNF + onap_private_net_cidr: + type: string + label: ONAP private network CIDR + description: The CIDR of the protected private network + cpe_signal_net_id: + type: string + label: vAAA private network name or ID + description: Private network that connects vAAA with vDNSs + cpe_signal_subnet_id: + type: string + label: CPE Signal subnet + description: CPE Signal subnet + cpe_signal_net_cidr: + type: string + label: vAAA private network CIDR + description: The CIDR of the vAAA private network + cpe_public_net_id: + type: string + label: vCPE Public network (emulates internet) name or ID + description: Private network that connects vGW to emulated internet + cpe_public_subnet_id: + type: string + label: CPE Public subnet + description: CPE Public subnet + cpe_public_net_cidr: + type: string + label: vCPE public network CIDR + description: The CIDR of the vCPE public + vaaa_private_ip_0: + type: string + label: vAAA private IP address towards the CPE_SIGNAL private network + description: Private IP address that is assigned to the vAAA to communicate with the vCPE components + vaaa_private_ip_1: + type: string + label: vAAA private IP address towards the ONAP management network + description: Private IP address that is assigned to the vAAA to communicate with ONAP components + vdns_private_ip_0: + type: string + label: vDNS private IP address towards the CPE_PUBLIC private network + description: Private IP address that is assigned to the vDNS to communicate with the vCPE components + vdns_private_ip_1: + type: string + label: vDNS private IP address towards the ONAP management network + description: Private IP address that is assigned to the vDNS to communicate with ONAP components + vdhcp_private_ip_0: + type: string + label: vDHCP private IP address towards the CPE_SIGNAL private network + description: Private IP address that is assigned to the vDHCP to communicate with the vCPE components + vdhcp_private_ip_1: + type: string + label: vDNS private IP address towards the ONAP management network + description: Private IP address that is assigned to the vDHCP to communicate with ONAP components + vweb_private_ip_0: + type: string + label: vWEB private IP address towards the CPE_PUBLIC private network + description: Private IP address that is assigned to the vWEB to communicate with the vGWs + vweb_private_ip_1: + type: string + label: vWEB private IP address towards the ONAP management network + description: Private IP address that is assigned to the vWEB to communicate with ONAP components + vaaa_name_0: + type: string + label: vAAA name + description: Name of the vAAA + vdns_name_0: + type: string + label: vDNS name + description: Name of the vDNS + vdhcp_name_0: + type: string + label: vDHCP name + description: Name of the vDHCP + vweb_name_0: + type: string + label: vWEB name + description: Name of the vWEB + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ONAP + vf_module_id: + type: string + label: vFirewall module ID + description: The vAAA Module ID is provided by ONAP + dcae_collector_ip: + type: string + label: DCAE collector IP address + description: IP address of the DCAE collector + dcae_collector_port: + type: string + label: DCAE collector port + description: Port of the DCAE collector + mr_ip_addr: + type: string + label: Message Router IP address + description: IP address of the Message Router that for vDHCP configuration + mr_ip_port: + type: string + label: Message Router Port + description: IP port of the Message Router that for vDHCP configuration + key_name: + type: string + label: Key pair name + description: Public/Private key pair name + pub_key: + type: string + label: Public key + description: Public key to be installed on the compute instance + install_script_version: + type: string + label: Installation script version number + description: Version number of the scripts that install the vFW demo app + demo_artifacts_version: + type: string + label: Artifacts version used in demo vnfs + description: Artifacts (jar, tar.gz) version used in demo vnfs + nexus_artifact_repo: + type: string + description: Root URL for the Nexus repository for Maven artifacts. + default: "https://nexus.onap.org" + cloud_env: + type: string + label: Cloud environment + description: Cloud environment (e.g., openstack, rackspace) + +############# +# # +# RESOURCES # +# # +############# + +resources: + + random-str: + type: OS::Heat::RandomString + properties: + length: 4 + + my_keypair: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: base_rand + params: + base: { get_param: key_name } + rand: { get_resource: random-str } + public_key: { get_param: pub_key } + save_private_key: false + + + # Virtual AAA server Instantiation + vaaa_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_signal_net_id } + fixed_ips: [{"subnet": { get_param: cpe_signal_subnet_id }, "ip_address": { get_param: vaaa_private_ip_0 }}] + + vaaa_private_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: onap_private_net_id } + fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vaaa_private_ip_1 }}] + + vaaa_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vaaa_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vaaa_private_0_port } + - port: { get_resource: vaaa_private_1_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __dcae_collector_ip__: { get_param: dcae_collector_ip } + __dcae_collector_port__: { get_param: dcae_collector_port } + __cpe_signal_net_ipaddr__: { get_param: vaaa_private_ip_0 } + __oam_ipaddr__: { get_param: vaaa_private_ip_1 } + __oam_cidr__: { get_param: onap_private_net_cidr } + __cpe_signal_net_cidr__: { get_param: cpe_signal_net_cidr } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt + echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt + echo "__cpe_signal_net_ipaddr__" > /opt/config/cpe_signal_net_ipaddr.txt + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get update + apt-get -y install unzip + if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip + unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_aaa_install.sh + cd /opt + chmod +x v_aaa_install.sh + ./v_aaa_install.sh + + + # Virtual DNS Instantiation + vdns_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_public_net_id } + fixed_ips: [{"subnet": { get_param: cpe_public_subnet_id }, "ip_address": { get_param: vdns_private_ip_0 }}] + + vdns_private_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: onap_private_net_id } + fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}] + + vdns_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vdns_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vdns_private_0_port } + - port: { get_resource: vdns_private_1_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __oam_ipaddr__ : { get_param: vdns_private_ip_1 } + __cpe_public_net_ipaddr__: { get_param: vdns_private_ip_0 } + __oam_cidr__: { get_param: onap_private_net_cidr } + __cpe_public_net_cidr__: { get_param: cpe_public_net_cidr } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__cpe_public_net_ipaddr__" > /opt/config/cpe_public_net_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get update + apt-get -y install unzip + if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip + unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_dns_install.sh + cd /opt + chmod +x v_dns_install.sh + ./v_dns_install.sh + + + # Virtual DHCP Instantiation + vdhcp_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_signal_net_id } + fixed_ips: [{"subnet": { get_param: cpe_signal_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_0 }}] + + vdhcp_private_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: onap_private_net_id } + fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_1 }}] + + vdhcp_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vdhcp_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vdhcp_private_0_port } + - port: { get_resource: vdhcp_private_1_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __oam_ipaddr__ : { get_param: vdhcp_private_ip_1 } + __cpe_signal_ipaddr__ : { get_param: vdhcp_private_ip_0 } + __oam_cidr__ : { get_param: onap_private_net_cidr } + __cpe_signal_net_cidr__ : { get_param: cpe_signal_net_cidr } + __mr_ip_addr__ : { get_param: mr_ip_addr } + __mr_ip_port__ : { get_param: mr_ip_port } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__cpe_signal_ipaddr__" > /opt/config/cpe_signal_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt + echo "__mr_ip_addr__" > /opt/config/mr_ip_addr.txt + echo "__mr_ip_port__" > /opt/config/mr_ip_port.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get update + apt-get -y install unzip + if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip + unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_dhcp_install.sh + cd /opt + chmod +x v_dhcp_install.sh + ./v_dhcp_install.sh + + # vWEB instantiaion + vweb_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_public_net_id } + fixed_ips: [{"subnet": { get_param: cpe_public_subnet_id }, "ip_address": { get_param: vweb_private_ip_0 }}] + + vweb_private_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: onap_private_net_id } + fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vweb_private_ip_1 }}] + + + vweb_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vweb_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vweb_private_0_port } + - port: { get_resource: vweb_private_1_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __oam_ipaddr__ : { get_param: vweb_private_ip_1 } + __cpe_public_ipaddr__: { get_param: vweb_private_ip_0 } + __oam_cidr__: { get_param: onap_private_net_cidr } + __cpe_public_net_cidr__: { get_param: cpe_public_net_cidr } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __install_script_version__ : { get_param: install_script_version } + __cloud_env__ : { get_param: cloud_env } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__cpe_public_ipaddr__" > /opt/config/cpe_public_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get update + apt-get -y install unzip + if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip + unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_web_install.sh + cd /opt + chmod +x v_web_install.sh + ./v_web_install.sh diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json new file mode 100644 index 0000000000..61468a74f7 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json @@ -0,0 +1,111 @@ +{ + "distributionID": "e61f72f2-eee9-4c46-bf76-ae24414c6396", + "serviceName": "demoVCPEInfra", + "serviceVersion": "1.0", + "serviceUUID": "8a77cbbb-9850-40bb-a42f-7aec8e3e6ab7", + "serviceDescription": "catalog service description", + "serviceInvariantUUID": "21c102b6-c3e6-49ca-8021-83c105a191fa", + "resources": [{ + "resourceInstanceName": "CPE_PUBLIC", + "resourceName": "Generic NeutronNet", + "resourceVersion": "1.0", + "resoucreType": "VL", + "resourceUUID": "67bf9c77-aa78-4fab-99f4-3939a6d42348", + "resourceInvariantUUID": "8917e73c-88cf-42ed-8b33-6ea8ad080285", + "resourceCustomizationUUID": "4b3bd88b-6351-4564-b1de-e01021cdb79b", + "category": "Generic", + "subcategory": "Network Elements", + "artifacts": [] + }, { + "resourceInstanceName": "vCPE_infra bf35304f-e92f 0", + "resourceName": "vCPE_infra bf35304f-e92f", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "9a91c854-86fb-4072-8d4d-94dc0e96a311", + "resourceInvariantUUID": "dcd9cb6c-1634-4424-86e6-b03baed3e10a", + "resourceCustomizationUUID": "01564fe7-0541-4d92-badc-464cc35f83ba", + "category": "Generic", + "subcategory": "Abstract", + "artifacts": [{ + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "vf-license-model.xml", + "artifactChecksum": "ODc4YjdjY2M5MDE1NDcxN2JhYTA2MjdiNGUxODE2MTM=", + "artifactDescription": "VF license file", + "artifactTimeout": 120, + "artifactUUID": "7fbbb913-0309-4a8b-8596-a1faf84886e8", + "artifactVersion": "1" + }, { + "artifactName": "vcpe_infrabf35304fe92f0_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "vcpe_infrabf35304fe92f0_modules.json", + "artifactChecksum": "OGQ2MTI5YjZjYTFlYzUyOTYyOTY4YWZkYTQxYzViYzg=", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "518b313a-4484-4cfd-92f0-0b23e2a415fd", + "artifactVersion": "1" + }, { + "artifactName": "base_vcpe_infra.yaml", + "artifactType": "HEAT", + "artifactURL": "base_vcpe_infra.yaml", + "artifactChecksum": "ZGEyNDgwNmEzZDk3ODU3ZDg3YTg1MDc0NmU1ZTMwYmI=", + "artifactDescription": "created from csar", + "artifactTimeout": 120, + "artifactUUID": "183353d4-2b50-4dc1-aecc-f2818f666b70", + "artifactVersion": "2" + }, { + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "vendor-license-model.xml", + "artifactChecksum": "OTJhOTQyNTczZGRiYTJlM2M0MDQxZTdlMTE3NDE5YTQ=", + "artifactDescription": " Vendor license file", + "artifactTimeout": 120, + "artifactUUID": "7f4577e5-9f89-4c8e-985e-500e58425276", + "artifactVersion": "1" + }, { + "artifactName": "base_vcpe_infra.env", + "artifactType": "HEAT_ENV", + "artifactURL": "base_vcpe_infra.env", + "artifactChecksum": "ZmQxYTM1Yjg0ODJmN2I0OWE4OWMxN2NjOGEwMTM5NTY=", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactTimeout": 120, + "artifactUUID": "1e9e20c7-6801-4a6c-a270-c8f5cec034c0", + "artifactVersion": "2", + "generatedFromUUID": "183353d4-2b50-4dc1-aecc-f2818f666b70" + } + ] + }, { + "resourceInstanceName": "CPE_SIGNAL", + "resourceName": "Generic NeutronNet", + "resourceVersion": "1.0", + "resoucreType": "VL", + "resourceUUID": "67bf9c77-aa78-4fab-99f4-3939a6d42348", + "resourceInvariantUUID": "8917e73c-88cf-42ed-8b33-6ea8ad080285", + "resourceCustomizationUUID": "803e0da3-6c40-4a4f-918b-7f3484de61ff", + "category": "Generic", + "subcategory": "Network Elements", + "artifacts": [] + } + ], + "serviceArtifacts": [{ + "artifactName": "service-Demovcpeinfra-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "service-Demovcpeinfra-template.yml", + "artifactChecksum": "ZDY3ZGY4ZTM4ZDA3ZjY4M2Y2MDgxNzI0MDE3NjkzODM=", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "a4180154-1279-47d5-acbc-392e87d3fc7f", + "artifactVersion": "1" + }, { + "artifactName": "service-Demovcpeinfra-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "service-Demovcpeinfra-csar.csar", + "artifactChecksum": "NjlhMDk2YzNlNTI5OTg3MzE2ZmUzYjI5MTY2M2Y5YmU=", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "144606d8-a505-4ba0-90a9-6d1c6219fc6b", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +} diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar new file mode 100644 index 0000000000..841c681088 Binary files /dev/null and b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar differ diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json new file mode 100644 index 0000000000..d005a09730 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json @@ -0,0 +1,25 @@ +[ + { + "vfModuleModelName": "VcpeInfraBf35304fE92f..base_vcpe_infra..module-0", + "vfModuleModelInvariantUUID": "e9a09595-26cd-4929-89e6-a79a02d3ef8f", + "vfModuleModelVersion": "1", + "vfModuleModelUUID": "4555cb57-7dc6-4680-912f-84739fc8d03e", + "vfModuleModelCustomizationUUID": "354b1e83-47db-4af1-8af4-9c14b03b482d", + "isBase": true, + "artifacts": [ + "183353d4-2b50-4dc1-aecc-f2818f666b70", + "1e9e20c7-6801-4a6c-a270-c8f5cec034c0" + ], + "properties": { + "min_vf_module_instances": "1", + "vf_module_label": "base_vcpe_infra", + "max_vf_module_instances": "1", + "vfc_list": "", + "vf_module_description": "", + "vf_module_type": "Base", + "availability_zone_count": "", + "volume_group": "false", + "initial_count": "1" + } + } +] \ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml new file mode 100644 index 0000000000..4c6a44d46b --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml @@ -0,0 +1 @@ +4c24f75d-4191-4447-9b61af63f5c36c93451c99640c1b63ae5bc9187EE1211F1A437CBCC6032B608418461.04e401c4f-0679-46a0-b7f1vendor entitlement pool111111Percentage1002019-05-10T00:00:00Z2020-05-09T23:59:59Z1.022353211-5524-4b26-af02vendor license key groupUniversal111114e872234ca73482da2d4efc0a7da9e0665C063A5402146DC9CEDDB7D99F9BA1APercentage1002019-05-10T00:00:00Z2020-05-09T23:59:59Z \ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml new file mode 100644 index 0000000000..cc13fa4fea --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml @@ -0,0 +1 @@ +4c24f75d-4191-4447-9b61b9cd64d6d4dc4a93953193ac0bc096194e401c4f-0679-46a0-b7f1vendor entitlement poolaf63f5c36c93451c99640c1b63ae5bc9187EE1211F1A437CBCC6032B60841846111111Percentage1001.02019-05-10T00:00:00Z2020-05-09T23:59:59Z22353211-5524-4b26-af02vendor license key groupUniversal4e872234ca73482da2d4efc0a7da9e0665C063A5402146DC9CEDDB7D99F9BA1A11111Percentage1001.02019-05-10T00:00:00Z2020-05-09T23:59:59Z9bc21ea0-5bcd-44d6-93f0f7fdb15660df4254b520797c59297b24123abc456vendor feature group \ No newline at end of file -- cgit 1.2.3-korg From 5e25344cc7f4fca4e3bbb980e11024bf85e89b3b Mon Sep 17 00:00:00 2001 From: "Mnushkin, Dmitry" Date: Fri, 17 May 2019 10:32:49 -0400 Subject: make HostRoute serializable class make HostRoute serializable class Change-Id: Id9eb0e42568ab96ce533288c15000ef8fd8fe066 Issue-ID: SO-1894 Signed-off-by: Benjamin, Max (mb388a) --- .../src/main/java/org/onap/so/openstack/beans/HostRoute.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java index 431870ba9e..afe9d71e92 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java @@ -20,16 +20,16 @@ package org.onap.so.openstack.beans; - - +import java.io.Serializable; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = {"prefix", "nextHop"}) -public class HostRoute { +public class HostRoute implements Serializable { + private static final long serialVersionUID = 2468793257174064133L; private String prefix; private String nextHop; -- cgit 1.2.3-korg From 969333e6374d3e2259ab5fbbdbcbb3f4c12a134e Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Mon, 20 May 2019 11:45:55 -0400 Subject: Check for null requestInfo Check for null requestInfo Issue-ID: SO-1900 Signed-off-by: Kuleshov, Elena Change-Id: I2a3eb7ddbee396b19bcc71a2f647b9cf90082ed4 --- .../tasks/BBInputSetupMapperLayer.java | 6 ++++- .../tasks/BBInputSetupMapperLayerTest.java | 13 ++++++++++ ...estDetailsInput_mapReqContextNoRequestInfo.json | 29 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 177c918305..b90ae19ca6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -378,7 +378,11 @@ public class BBInputSetupMapperLayer { protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) { OrchestrationContext context = new OrchestrationContext(); - context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback())); + if (requestDetails.getRequestInfo() != null) { + context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback())); + } else { + context.setIsRollbackEnabled(false); + } return context; } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index e7afa9ec8b..39650a2142 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -570,6 +570,19 @@ public class BBInputSetupMapperLayerTest { assertThat(actual, sameBeanAs(expected)); } + @Test + public void testMapOrchestrationContextNoRequestInfo() throws IOException { + OrchestrationContext expected = new OrchestrationContext(); + expected.setIsRollbackEnabled(false); + + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContextNoRequestInfo.json"), RequestDetails.class); + + OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails); + + assertThat(actual, sameBeanAs(expected)); + } + @Test public void testMapLocationContext() { CloudRegion expected = new CloudRegion(); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json new file mode 100644 index 0000000000..41f0fde834 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json @@ -0,0 +1,29 @@ +{ + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType", + "userParams": [ + { + "name" : "mns_vfw_protected_route_prefixes", + "value" : [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ] + }, + { + "name": "name1", + "value": "value1" + }, + { + "ignore": "false", + "skip": "ignore" + }] + }, + "configurationParameters": [ + { + "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] +} + -- cgit 1.2.3-korg From e6e0c906bddeb9bb5b67b16b4b9530d6b0c1946c Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Mon, 20 May 2019 17:22:18 -0400 Subject: Change serviceInstance CM retrieval Change serviceInstance CM retrieval Issue-ID: SO-1903 Signed-off-by: Kuleshov, Elena Change-Id: I6bc1e3f0d219d6c9feff083ce43cd6afdec1c439 --- .../bpmn/servicedecomposition/tasks/ExtractPojosForBB.java | 9 +++++++-- .../so/bpmn/servicedecomposition/ExtractPojosForBBTest.java | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index 86bbead9a4..b76316bf0e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -57,8 +57,13 @@ public class ExtractPojosForBB { GenericVnf vnf; switch (key) { case SERVICE_INSTANCE_ID: - result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), - value); + if (gBBInput.getCustomer().getServiceSubscription() == null + && gBBInput.getServiceInstance() != null) { + result = Optional.of((T) gBBInput.getServiceInstance()); + } else { + result = lookupObjectInList( + gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value); + } break; case GENERIC_VNF_ID: serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java index 8ab2c8e155..7bd2beeb92 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java @@ -227,4 +227,16 @@ public class ExtractPojosForBBTest extends BaseTest { gBBInput.setCustomer(customer); extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID); } + + @Test + public void getServiceInstanceWithNoCustomer() throws BBObjectNotFoundException { + ServiceInstance serviceInstancePend = new ServiceInstance(); + serviceInstancePend.setServiceInstanceId("abc"); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstancePend.getServiceInstanceId()); + Customer customer = new Customer(); + gBBInput.setCustomer(customer); + gBBInput.setServiceInstance(serviceInstancePend); + ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId()); + } } -- cgit 1.2.3-korg From 8e40406c6dd82de42d592ca8abb6203697b0aa8b Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat (vb8416)" Date: Mon, 20 May 2019 17:40:21 -0400 Subject: Add SO WFD activity BBs to building_block_detail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added dublin-WFD activity BBs to building_block_detaili tbl Also updated the resource_type to NO_VALIDATE where target_action is CUSTOM During the execute of the Activity building blocks for the Workflow Designer running into orchestrationStatusValidation exception as it could not find the activity's name in building_block_detail table. Updated the test/resources/data.sql to reflect the above changes Issue-ID: SO-1901 Signed-off-by: Bonkur, Venkat (vb8416) Change-Id: I9a5c60fc818ec4abc18005e3ef9b8c7b3313f55d --- .../main/resources/db/migration/R__MacroData.sql | 66 +++++++++++++++------ mso-catalog-db/src/test/resources/data.sql | 67 +++++++++++++++------- 2 files changed, 93 insertions(+), 40 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 824d1df3d6..0054bcff53 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -597,27 +597,27 @@ WHERE TARGET_ACTION = 'CHANGEMODEL'; INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION) VALUES ('UnassignVfModuleBB', 'VF_MODULE', 'UNASSIGN'), -('SniroHoming', 'CUSTOM', 'CUSTOM'), -('DeactivateAndUnassignVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'), -('DeactivateNetworkCollectionBB', 'CUSTOM', 'CUSTOM'), -('AAICheckVnfInMaintBB', 'CUSTOM', 'CUSTOM'), -('AAISetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), -('AAIUnsetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), -('SDNOVnfHealthCheckBB', 'CUSTOM', 'CUSTOM'), -('VNF-Macro-Replace', 'CUSTOM', 'CUSTOM'), -('HomingBB', 'CUSTOM', 'CUSTOM'); +('SniroHoming', 'NO_VALIDATE', 'CUSTOM'), +('DeactivateAndUnassignVpnBondingLinksBB', 'NO_VALIDATE', 'CUSTOM'), +('DeactivateNetworkCollectionBB', 'NO_VALIDATE', 'CUSTOM'), +('AAICheckVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'), +('AAISetVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'), +('AAIUnsetVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'), +('SDNOVnfHealthCheckBB', 'NO_VALIDATE', 'CUSTOM'), +('VNF-Macro-Replace', 'NO_VALIDATE', 'CUSTOM'), +('HomingBB', 'NO_VALIDATE', 'CUSTOM'); INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) VALUES -('CUSTOM', 'ACTIVE', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'ASSIGNED', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'CREATED', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'INVENTORIED', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PENDING', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE'); +('NO_VALIDATE', 'ACTIVE', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'ASSIGNED', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'CREATED', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'INVENTORIED', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PENDING', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PRECREATED', 'CUSTOM', 'CONTINUE'); INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES ('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true, 'CloudOwner'); @@ -776,4 +776,32 @@ UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Rollback' WHERE FLOW_NAME INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY) VALUES ('GenericVnfHealthCheckBB', '*', '*', '*', "*" , 'Retry'), -('ConfigurationScaleOutBB', '*', '*', '*', "*" , 'Retry'); \ No newline at end of file +('ConfigurationScaleOutBB', '*', '*', '*', "*" , 'Retry'); + +INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION) +VALUES +('VNFSetInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFCheckPserversLockedFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFCheckInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFCheckClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFSetClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUnsetClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFLockActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUnlockActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFStopActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFStartActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFSnapShotActivity', 'NO_VALIDATE', 'CUSTOM'), +('FlowCompleteActivity', 'NO_VALIDATE', 'CUSTOM'), +('PauseForManualTaskActivity', 'NO_VALIDATE', 'CUSTOM'), +('DistributeTrafficActivity', 'NO_VALIDATE', 'CUSTOM'), +('DistributeTrafficCheckActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFHealthCheckActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFQuiesceTrafficActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFResumeTrafficActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUnsetInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUpgradeBackupActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUpgradePostCheckActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUpgradePreCheckActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'), +('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'); + diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql index 31f59203ca..13ab018a27 100644 --- a/mso-catalog-db/src/test/resources/data.sql +++ b/mso-catalog-db/src/test/resources/data.sql @@ -266,18 +266,43 @@ VALUES ('DeleteVfModuleBB', 'VF_MODULE', 'DELETE'), ('DeleteNetworkBB', 'NETWORK', 'DELETE'), ('DeleteNetworkCollectionBB', 'NETWORK', 'DELETE'), -('AssignAndActivateVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'), -('AvpnAssignServiceInstanceBB', 'CUSTOM', 'CUSTOM'), -('CreateCustomerVpnBindingBB', 'CUSTOM', 'CUSTOM'), -('SniroHoming', 'CUSTOM', 'CUSTOM'), -('DeactivateAndUnassignVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'), -('DeactivateNetworkCollectionBB', 'CUSTOM', 'CUSTOM'), -('AAICheckVnfInMaintBB', 'CUSTOM', 'CUSTOM'), -('AAISetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), -('AAIUnsetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), -('SDNOVnfHealthCheckBB', 'CUSTOM', 'CUSTOM'), -('VNF-Macro-Replace', 'CUSTOM', 'CUSTOM'), -('HomingBB', 'CUSTOM', 'CUSTOM'); +('AssignAndActivateVpnBondingLinksBB', 'NO_VALIDATE', 'CUSTOM'), +('AvpnAssignServiceInstanceBB', 'NO_VALIDATE', 'CUSTOM'), +('CreateCustomerVpnBindingBB', 'NO_VALIDATE', 'CUSTOM'), +('SniroHoming', 'NO_VALIDATE', 'CUSTOM'), +('DeactivateAndUnassignVpnBondingLinksBB', 'NO_VALIDATE', 'CUSTOM'), +('DeactivateNetworkCollectionBB', 'NO_VALIDATE', 'CUSTOM'), +('AAICheckVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'), +('AAISetVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'), +('AAIUnsetVnfInMaintBB', 'NO_VALIDATE', 'CUSTOM'), +('SDNOVnfHealthCheckBB', 'NO_VALIDATE', 'CUSTOM'), +('VNF-Macro-Replace', 'NO_VALIDATE', 'CUSTOM'), +('HomingBB', 'NO_VALIDATE', 'CUSTOM'), +('VNFSetInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFCheckPserversLockedFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFCheckInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFCheckClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFSetClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUnsetClosedLoopDisabledFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFLockActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUnlockActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFStopActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFStartActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFSnapShotActivity', 'NO_VALIDATE', 'CUSTOM'), +('FlowCompleteActivity', 'NO_VALIDATE', 'CUSTOM'), +('PauseForManualTaskActivity', 'NO_VALIDATE', 'CUSTOM'), +('DistributeTrafficActivity', 'NO_VALIDATE', 'CUSTOM'), +('DistributeTrafficCheckActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFHealthCheckActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFQuiesceTrafficActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFResumeTrafficActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUnsetInMaintFlagActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUpgradeBackupActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUpgradePostCheckActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUpgradePreCheckActivity', 'NO_VALIDATE', 'CUSTOM'), +('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'), +('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'); + INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES ('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create')), @@ -644,15 +669,15 @@ VALUES ('VOLUME_GROUP', 'PENDING', 'DELETE', 'SILENT_SUCCESS'), ('VF_MODULE', 'PENDING', 'DELETE', 'FAIL'), ('NETWORK', 'PENDING', 'DELETE', 'FAIL'), -('CUSTOM', 'ACTIVE', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'ASSIGNED', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'CREATED', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'INVENTORIED', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PENDING', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), -('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE'); +('NO_VALIDATE', 'ACTIVE', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'ASSIGNED', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'CREATED', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'INVENTORIED', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PENDING', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), +('NO_VALIDATE', 'PRECREATED', 'CUSTOM', 'CONTINUE'); INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08'); -- cgit 1.2.3-korg From da706c74e561962a73b8c79dae133c3f59e1cffd Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Tue, 21 May 2019 02:49:48 -0400 Subject: Send syncAck on first Activity Send syncAck on first Activity Issue-ID: SO-1905 Signed-off-by: Kuleshov, Elena Change-Id: I0965b8247aa88a19be4417e2b5d58bce2d5dab27 --- .../onap/so/bpmn/infrastructure/activity/ExecuteActivity.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 05d4f56fdc..426ef931b6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -31,6 +31,7 @@ import org.camunda.bpm.engine.delegate.JavaDelegate; import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables; import org.camunda.bpm.engine.variable.VariableMap; import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; @@ -55,6 +56,7 @@ public class ExecuteActivity implements JavaDelegate { private static final String G_REQUEST_ID = "mso-request-id"; private static final String VNF_ID = "vnfId"; private static final String SERVICE_INSTANCE_ID = "serviceInstanceId"; + private static final String WORKFLOW_SYNC_ACK_SENT = "workflowSyncAckSent"; private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation"; private static final String ACTIVITY_PREFIX = "activity:"; @@ -65,12 +67,19 @@ public class ExecuteActivity implements JavaDelegate { private RuntimeService runtimeService; @Autowired private ExceptionBuilder exceptionBuilder; + @Autowired + private WorkflowActionBBTasks workflowActionBBTasks; @Override public void execute(DelegateExecution execution) throws Exception { final String requestId = (String) execution.getVariable(G_REQUEST_ID); try { + Boolean workflowSyncAckSent = (Boolean) execution.getVariable(WORKFLOW_SYNC_ACK_SENT); + if (workflowSyncAckSent == null || workflowSyncAckSent == false) { + workflowActionBBTasks.sendSyncAck(execution); + execution.setVariable(WORKFLOW_SYNC_ACK_SENT, Boolean.TRUE); + } final String implementationString = execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE); logger.debug("activity implementation String: {}", implementationString); -- cgit 1.2.3-korg From 064752304122e631bcefe9c8f471171ca2ec1da4 Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Tue, 14 May 2019 14:07:20 +0200 Subject: Missing modifications for DistributeTraffic actions Added input parameters for DistributeTraffic and DistributeTrafficCheck action Change-Id: I423979f6e8a682bff2aaff02bba4d79d2fbe22c8 Issue-ID: SO-1553 Signed-off-by: Lukasz Rajewski --- .../db/migration/R__WorkflowDesignerData.sql | 15 +++++ .../onap/so/bpmn/appc/payload/PayloadClient.java | 35 ++++++++++ .../ConfigurationParametersDistributeTraffic.java | 78 ++++++++++++++++++++++ .../payload/beans/DistributeTrafficAction.java | 44 ++++++++++++ .../beans/DistributeTrafficCheckAction.java | 44 ++++++++++++ .../client/appc/ApplicationControllerAction.java | 31 ++++++++- 6 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersDistributeTraffic.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficAction.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficCheckAction.java diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql index 054fb1af57..fd7fcd48d0 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql @@ -148,6 +148,9 @@ VALUES ('existing_software_version','userParams','Existing Software Version','text','',1,50,''), ('tenantId','cloudConfiguration','Tenant/Project ID','text','',1,36,''), ('new_software_version','userParams','New Software Version','text','',1,50,''), +('book_name','userParams','Name of Commands Book Set','text','',1,50,''), +('node_list','userParams','List of Nodes','text','',1,200,''), +('file_parameter_content','userParams','Configuration File Content','text','',1,50000,''), ('lcpCloudRegionId','cloudConfiguration','Cloud Region ID','text','',1,7,''); INSERT INTO `activity_spec_to_user_parameters`(`ACTIVITY_SPEC_ID`,`USER_PARAMETERS_ID`) @@ -166,6 +169,18 @@ VALUES (select ID from user_parameters where NAME='tenantId')), ((select ID from activity_spec where NAME='VNFQuiesceTrafficActivity' and VERSION=1.0), (select ID from user_parameters where NAME='operations_timeout')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='book_name')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='node_list')), +((select ID from activity_spec where NAME='DistributeTrafficActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='file_parameter_content')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='book_name')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='node_list')), +((select ID from activity_spec where NAME='DistributeTrafficCheckActivity' and VERSION=1.0), +(select ID from user_parameters where NAME='file_parameter_content')), ((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), (select ID from user_parameters where NAME='existing_software_version')), ((select ID from activity_spec where NAME='VNFUpgradeBackupActivity' and VERSION=1.0), diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index 3b768cbc3b..9e9c4b5cfa 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -24,11 +24,14 @@ import java.util.Optional; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersDistributeTraffic; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersUpgrade; import org.onap.so.bpmn.appc.payload.beans.HealthCheckAction; import org.onap.so.bpmn.appc.payload.beans.QuiesceTrafficAction; import org.onap.so.bpmn.appc.payload.beans.RequestParametersHealthCheck; import org.onap.so.bpmn.appc.payload.beans.ResumeTrafficAction; +import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficAction; +import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficCheckAction; import org.onap.so.bpmn.appc.payload.beans.SnapshotAction; import org.onap.so.bpmn.appc.payload.beans.StartStopAction; import org.onap.so.bpmn.appc.payload.beans.UpgradeAction; @@ -56,6 +59,38 @@ public class PayloadClient { return Optional.of(mapper.writeValueAsString(payloadResult)); } + public static Optional distributeTrafficFormat(Optional payload, String vnfName) + throws JsonProcessingException { + DistributeTrafficAction payloadResult = new DistributeTrafficAction(); + ConfigurationParametersDistributeTraffic configParams = new ConfigurationParametersDistributeTraffic(); + String payloadString = payload.isPresent() ? payload.get() : ""; + String bookName = JsonUtils.getJsonValue(payloadString, "book_name"); + String nodeList = JsonUtils.getJsonValue(payloadString, "node_list"); + String fileParameterContent = JsonUtils.getJsonValue(payloadString, "file_parameter_content"); + configParams.setBookName(bookName); + configParams.setNodeList(nodeList); + configParams.setFileParameterContent(fileParameterContent); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional distributeTrafficCheckFormat(Optional payload, String vnfName) + throws JsonProcessingException { + DistributeTrafficCheckAction payloadResult = new DistributeTrafficCheckAction(); + ConfigurationParametersDistributeTraffic configParams = new ConfigurationParametersDistributeTraffic(); + String payloadString = payload.isPresent() ? payload.get() : ""; + String bookName = JsonUtils.getJsonValue(payloadString, "book_name"); + String nodeList = JsonUtils.getJsonValue(payloadString, "node_list"); + String fileParameterContent = JsonUtils.getJsonValue(payloadString, "file_parameter_content"); + configParams.setBookName(bookName); + configParams.setNodeList(nodeList); + configParams.setFileParameterContent(fileParameterContent); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + public static Optional resumeTrafficFormat(String vnfName) throws JsonProcessingException { ResumeTrafficAction payloadResult = new ResumeTrafficAction(); ConfigurationParametersResumeTraffic configParams = new ConfigurationParametersResumeTraffic(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersDistributeTraffic.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersDistributeTraffic.java new file mode 100644 index 0000000000..a4ffdbfdba --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersDistributeTraffic.java @@ -0,0 +1,78 @@ +/*- + * ============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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"vnf_name", "book_name", "node_list", "file_parameter_content"}) +public class ConfigurationParametersDistributeTraffic { + @JsonProperty("vnf_name") + private String vnfName; + @JsonProperty("book_name") + private String bookName; + @JsonProperty("node_list") + private String nodeList; + @JsonProperty("file_parameter_content") + private String fileParameterContent; + + @JsonProperty("vnf_name") + public String getVnfName() { + return vnfName; + } + + @JsonProperty("vnf_name") + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + @JsonProperty("book_name") + public String getBookName() { + return bookName; + } + + @JsonProperty("book_name") + public void setBookName(String bookName) { + this.bookName = bookName; + } + + @JsonProperty("node_list") + public String getNodeList() { + return nodeList; + } + + @JsonProperty("node_list") + public void setNodeList(String nodeList) { + this.nodeList = nodeList; + } + + @JsonProperty("file_parameter_content") + public String getFileParameterContent() { + return fileParameterContent; + } + + @JsonProperty("file_parameter_content") + public void setFileParameterContent(String fileParameterContent) { + this.fileParameterContent = fileParameterContent; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficAction.java new file mode 100644 index 0000000000..9b7856e33f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficAction.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Orange 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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"configuration-parameters"}) +public class DistributeTrafficAction { + + @JsonProperty("configuration-parameters") + private ConfigurationParametersDistributeTraffic configurationParameters; + + @JsonProperty("configuration-parameters") + public ConfigurationParametersDistributeTraffic getConfigurationParameters() { + return configurationParameters; + } + + @JsonProperty("configuration-parameters") + public void setConfigurationParameters(ConfigurationParametersDistributeTraffic configurationParameters) { + this.configurationParameters = configurationParameters; + } +} + diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficCheckAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficCheckAction.java new file mode 100644 index 0000000000..b9831a90c4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficCheckAction.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Orange 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.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"configuration-parameters"}) +public class DistributeTrafficCheckAction { + + @JsonProperty("configuration-parameters") + private ConfigurationParametersDistributeTraffic configurationParameters; + + @JsonProperty("configuration-parameters") + public ConfigurationParametersDistributeTraffic getConfigurationParameters() { + return configurationParameters; + } + + @JsonProperty("configuration-parameters") + public void setConfigurationParameters(ConfigurationParametersDistributeTraffic configurationParameters) { + this.configurationParameters = configurationParameters; + } +} + diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index eccd81217f..b97b9ac1ca 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -68,6 +68,12 @@ public class ApplicationControllerAction { case QuiesceTraffic: appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); break; + case DistributeTraffic: + appCStatus = distributeTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); + break; + case DistributeTrafficCheck: + appCStatus = distributeTrafficCheckAction(msoRequestId, vnfId, payload, vnfName, controllerType); + break; case HealthCheck: appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType); break; @@ -91,8 +97,6 @@ public class ApplicationControllerAction { break; case ConfigModify: case ConfigScaleOut: - case DistributeTraffic: - case DistributeTrafficCheck: appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType); break; case UpgradePreCheck: @@ -158,6 +162,29 @@ public class ApplicationControllerAction { return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } + private Status distributeTrafficAction(String msoRequestId, String vnfId, Optional payload, String vnfName, + String controllerType) + throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + if (!(payload.isPresent())) { + throw new IllegalArgumentException("Payload is not present for " + Action.DistributeTraffic.toString()); + } + payload = PayloadClient.distributeTrafficFormat(payload, vnfName); + return client.vnfCommand(Action.DistributeTraffic, msoRequestId, vnfId, Optional.empty(), payload, + controllerType); + } + + private Status distributeTrafficCheckAction(String msoRequestId, String vnfId, Optional payload, + String vnfName, String controllerType) + throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + if (!(payload.isPresent())) { + throw new IllegalArgumentException( + "Payload is not present for " + Action.DistributeTrafficCheck.toString()); + } + payload = PayloadClient.distributeTrafficCheckFormat(payload, vnfName); + return client.vnfCommand(Action.DistributeTrafficCheck, msoRequestId, vnfId, Optional.empty(), payload, + controllerType); + } + private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException { Optional payload = PayloadClient.resumeTrafficFormat(vnfName); -- cgit 1.2.3-korg From f18614794608d81d6a6b868fa2e580e44e7ee6a8 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steve (ss835w)" Date: Tue, 21 May 2019 11:18:44 -0400 Subject: Set Variable Fix issue here variable is not set if SI is found. Issue-ID: SO-1419 Change-Id: If9a75fc57e280c2aba5361096e4ebf01ab13056f Signed-off-by: Smokowski, Steve (ss835w) --- .../onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index 0c676b5589..1acadbdad8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -290,7 +290,8 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { AAIResourcesClient resourceClient = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) - if(resourceClient.exists(uri)){ + if(resourceClient.exists(uri)){ + execution.setVariable("GENGS_FoundIndicator", true) execution.setVariable("GENGS_siResourceLink", uri.build().toString()) Map keys = uri.getURIKeys() String globalSubscriberId = execution.getVariable("globalSubscriberId") -- cgit 1.2.3-korg From 152fb54b77e845e9e0aa7b6295442f1e8c2c3e1f Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Tue, 21 May 2019 23:47:39 -0400 Subject: Add WORKFLOW artifactType to SDC Config Add WORKFLOW artifactType to SDC Config Issue-ID: SO-1911 Signed-off-by: Kuleshov, Elena Change-Id: I8933438ae63ca73605a05fec5467806f41fbda10 --- .../src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index f0eb77300b..60abdc33ef 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -60,7 +60,7 @@ public class ASDCConfiguration implements IConfiguration { public static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"; private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, - HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT}; + HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT, WORKFLOW}; public static final List SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); -- cgit 1.2.3-korg From 8e8476033905ac1e07e5cb22e7fe193bcc8ae903 Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Wed, 22 May 2019 06:29:53 -0700 Subject: Fix CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT distribute Add CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT type so it does not cancel the distribution of services. Change-Id: I68fe4892156312233fe677c0826e95c8aaa8da02 Issue-ID: SO-1907 Signed-off-by: Eric Multanen --- .../src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java | 9 +++++---- .../java/org/onap/so/asdc/installer/VfResourceStructure.java | 1 + .../org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index 2eace7587f..f0eb77300b 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -9,9 +9,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. @@ -57,9 +57,10 @@ public class ASDCConfiguration implements IConfiguration { public static final String TOSCA_CSAR = "TOSCA_CSAR"; public static final String WORKFLOW = "WORKFLOW"; public static final String VF_MODULES_METADATA = "VF_MODULES_METADATA"; + public static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"; - private static final String[] SUPPORTED_ARTIFACT_TYPES = - {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA}; + private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, + HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT}; public static final List SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java index 16e9fda7c4..0f58a21747 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java @@ -115,6 +115,7 @@ public class VfResourceStructure extends ResourceStructure { case ASDCConfiguration.HEAT_ARTIFACT: case ASDCConfiguration.HEAT_NET: case ASDCConfiguration.OTHER: + case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT: artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact); break; case ASDCConfiguration.VF_MODULES_METADATA: diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index ad3e2d8161..6f0d2d7180 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -1071,6 +1071,7 @@ public class ToscaResourceInstaller { break; case ASDCConfiguration.HEAT_NET: case ASDCConfiguration.OTHER: + case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT: logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(), vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact.getArtifactInfo().getArtifactName() + ")", -- cgit 1.2.3-korg From 1bfa9304d3104f2741fa24601d459fb254d4324e Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat (vb8416)" Date: Wed, 22 May 2019 09:55:26 -0400 Subject: Add SO Update the repeatable Macro - northbound_request_ref_lookup Added dublin - Update repeatable Macro not to lose the ability to drive flows differently based on service type. UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE = NULL; Issue-ID: SO-1892 Signed-off-by: Bonkur, Venkat (vb8416) Change-Id: I3fa58559fe4596b3a0e184a8391ac93fb9496a26 --- .../src/main/resources/db/migration/R__MacroData.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 0054bcff53..372fbab33d 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -805,3 +805,4 @@ VALUES ('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'), ('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'); +UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE = NULL; -- cgit 1.2.3-korg From 65d71e97406a9a9b1c56475855f1d2e59adeec81 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 22 May 2019 11:08:32 -0400 Subject: HttpLookupUri is now serializable again cachedValue is now transient added custom serialization created serialization unit test for ServiceInstancesUri Change-Id: Idbc414a8483a4eae9c93ae8b06a1e77cbe683ca8 Issue-ID: SO-1906 Signed-off-by: Benjamin, Max (mb388a) --- .../so/client/aai/entities/uri/HttpLookupUri.java | 23 +++++++++-- .../aai/entities/uri/ServiceInstanceUriTest.java | 46 ++++++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java index f086a6abcf..37d21b375e 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java @@ -21,6 +21,8 @@ package org.onap.so.client.aai.entities.uri; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.net.URI; import java.util.Map; import java.util.Optional; @@ -42,7 +44,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri { - private Optional cachedValue = Optional.empty(); + private transient Optional cachedValue = Optional.empty(); private final AAIObjectType aaiType; protected HttpLookupUri(AAIObjectType type, Object... values) { @@ -78,8 +80,7 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e); } } - Optional cachedValueOpt = this.getCachedValue(); - return cachedValueOpt.isPresent() ? cachedValueOpt.get() : ""; + return cachedValue.get(); } protected Optional extractRelatedLink(String jsonString) throws IOException { @@ -139,6 +140,22 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri return new AAIResourcesClient(); } + private void writeObject(ObjectOutputStream oos) throws IOException { + + oos.writeUTF(this.cachedValue.orElse("")); + } + + private void readObject(ObjectInputStream ois) throws IOException { + + String value = ois.readUTF(); + if ("".equals(value)) { + this.cachedValue = Optional.empty(); + } else { + this.cachedValue = Optional.ofNullable(value); + } + + } + @Override public abstract URI buildNoNetwork(); } diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java index e829666577..9bef35e3b5 100644 --- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java +++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java @@ -31,8 +31,14 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; @@ -50,9 +56,11 @@ import org.mockito.InjectMocks; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.client.aai.AAIClient; +import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; +import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; @@ -227,4 +235,42 @@ public class ServiceInstanceUriTest { exception.expect(NotFoundException.class); spy.build(); } + + @Test + public void serializeTest() throws IOException, ClassNotFoundException, GraphInventoryUriNotFoundException, + GraphInventoryPayloadException { + ServiceInstanceUri instance = new ServiceInstanceUri("key3"); + final String content = new String( + Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json"))); + + ServiceInstanceUri spy = spy(instance); + AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class); + AAIResultWrapper wrapper = mock(AAIResultWrapper.class); + when(mockResourcesClient.get(ArgumentMatchers.any(AAIResourceUri.class), + ArgumentMatchers.>any())).thenReturn(wrapper); + when(wrapper.getJson()).thenReturn(content); + when(spy.getResourcesClient()).thenReturn(mockResourcesClient); + spy.build(); + instance = spy.clone(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + ObjectOutputStream objectOutputStream = new ObjectOutputStream(bos); + objectOutputStream.writeObject(instance); + objectOutputStream.flush(); + objectOutputStream.close(); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + + ObjectInputStream objectInputStream = new ObjectInputStream(bis); + ServiceInstanceUri e2 = (ServiceInstanceUri) objectInputStream.readObject(); + objectInputStream.close(); + + ServiceInstanceUri spy2 = spy(e2); + + assertEquals(spy2.build().toString(), instance.build().toString()); + + // use the cached value do not call out to external system + verify(spy2, times(0)).getResourcesClient(); + + } } -- cgit 1.2.3-korg From d8644b26c6d411870b704a04dec8470184d0f081 Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Wed, 22 May 2019 21:53:05 +0300 Subject: removed unused CatalogDbUtils instantiation Issue-ID: SO-1910 Signed-off-by: MariosIakovidis Change-Id: I50a2c75e2ce59a4eb7b6fb60076a34cae5482344 --- .../bpmn/infrastructure/scripts/HandlePNF.groovy | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy index 90c2b923b0..261f107140 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.scripts import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.CatalogDbUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames @@ -35,11 +34,10 @@ public class HandlePNF extends AbstractServiceTaskProcessor{ ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - CatalogDbUtils cutils = new CatalogDbUtils() @Override void preProcessRequest(DelegateExecution execution) { - msoLogger.debug("Start preProcess for HandlePNF") + logger.debug("Start preProcess for HandlePNF") // set correlation ID def resourceInput = execution.getVariable("resourceInput") @@ -47,38 +45,38 @@ public class HandlePNF extends AbstractServiceTaskProcessor{ String correlationId = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_pnf_name") if (!StringUtils.isEmpty(correlationId)) { execution.setVariable(ExecutionVariableNames.CORRELATION_ID, correlationId) - msoLogger.debug("Found correlation id : " + correlationId) + logger.debug("Found correlation id : " + correlationId) } else { - msoLogger.error("== correlation id is empty ==") + logger.error("== correlation id is empty ==") exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "correlation id is not provided") } // next task will set the uuid - msoLogger.debug("exit preProcess for HandlePNF") + logger.debug("exit preProcess for HandlePNF") } void postProcessRequest(DelegateExecution execution) { - msoLogger.debug("start postProcess for HandlePNF") + logger.debug("start postProcess for HandlePNF") - msoLogger.debug("exit postProcess for HandlePNF") + logger.debug("exit postProcess for HandlePNF") } public void sendSyncResponse (DelegateExecution execution) { - msoLogger.debug(" *** sendSyncResponse *** ") + logger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exception in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResponse *****") + logger.debug(" ***** Exit sendSyncResponse *****") } } -- cgit 1.2.3-korg From b87ccbbf96a0eac4261f5a2d51c03e18b4243ddb Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Wed, 22 May 2019 21:11:42 -0400 Subject: Handle case of null requestInfo Handle case of null requestInfo Issue-ID: SO-1918 Signed-off-by: Kuleshov, Elena Change-Id: Ie8a0dd9e27734d96442eceaa378e5d1e64667b06 --- .../servicedecomposition/tasks/BBInputSetupMapperLayer.java | 4 +++- bpmn/mso-infrastructure-bpmn/pom.xml | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index b90ae19ca6..6f3710835c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -335,7 +335,9 @@ public class BBInputSetupMapperLayer { public RequestContext mapRequestContext(RequestDetails requestDetails) { RequestContext context = new RequestContext(); - modelMapper.map(requestDetails.getRequestInfo(), context); + if (null != requestDetails.getRequestInfo()) { + modelMapper.map(requestDetails.getRequestInfo(), context); + } org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters(); if (null != requestParameters) { context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 4dd7a467ea..e9ed15aa0f 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -152,12 +152,12 @@ org.camunda.bpm.springboot camunda-bpm-spring-boot-starter-rest ${camunda.springboot.version} - - - org.camunda.bpmn - camunda-engine-rest-core - - + + + org.camunda.bpmn + camunda-engine-rest-core + + org.camunda.bpm.springboot -- cgit 1.2.3-korg From 52a1a5a22a9bd4e183c8c0607e2b75f6503a43c9 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Thu, 23 May 2019 02:07:32 -0400 Subject: Return empty WorkflowInputParameters Return empty WorkflowInputParameters when none are available Issue-ID: SO-1919 Signed-off-by: Kuleshov, Elena Change-Id: I057e30bb55f6545c25060c28e1af097286f4e88b --- .../org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java | 4 ++-- .../src/test/resources/__files/catalogdb/WorkflowSpecifications.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java index e8171ac834..bba8064f7c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java @@ -175,7 +175,7 @@ public class WorkflowSpecificationsHandler { private List buildWorkflowInputParameters(Workflow workflow) { List workflowActivitySpecSequences = workflow.getWorkflowActivitySpecSequence(); if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.size() == 0) { - return null; + return new ArrayList(); } Map workflowInputParameterMap = new HashMap(); for (WorkflowActivitySpecSequence workflowActivitySpecSequence : workflowActivitySpecSequences) { @@ -199,7 +199,7 @@ public class WorkflowSpecificationsHandler { } if (workflowInputParameterMap.size() == 0) { - return null; + return new ArrayList(); } List workflowInputParameterList = workflowInputParameterMap.values().stream().collect(Collectors.toList()); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json index 545fbbe26c..59bc12d92d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecifications.json @@ -122,7 +122,8 @@ "operationName": "inPlaceSoftwareUpdate", "workflowSource": "native", "workflowResourceTarget": "vnf" - } + }, + "workflowInputParameters": [] } } ] -- cgit 1.2.3-korg From 8ef2ec86175055aba4158f7ae571e259c7ddeddf Mon Sep 17 00:00:00 2001 From: eeginux Date: Thu, 23 May 2019 10:51:36 +0100 Subject: exception handling Update the appc client jar version Throw exception for non success cds call Fix CreateVcpeResCustServiceSimplifiedTest IT Issue-ID: SO-1857 SO-1779 Change-Id: Ifee080600051c92fd964a92d16efb67e4ab05d5d Signed-off-by: eeginux --- bpmn/MSOCommonBPMN/pom.xml | 4 +- .../client/cds/AbstractCDSProcessingBBUtils.java | 18 +++++- bpmn/pom.xml | 1 + .../resources/process/ConfigurePnfResource.bpmn | 4 +- .../CreateVcpeResCustServiceSimplifiedTest.java | 70 ++++++++++------------ 5 files changed, 55 insertions(+), 42 deletions(-) diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 20be69c006..e233e6a7c6 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -311,7 +311,7 @@ org.onap.appc.client client-lib - 1.5.0-SNAPSHOT + ${appc.client.version} org.mockito @@ -330,7 +330,7 @@ org.onap.appc.client client-kit - 1.5.0-SNAPSHOT + ${appc.client.version} org.mockito diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java index 6bfa67502d..5498b5be31 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java @@ -34,6 +34,7 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOu import org.onap.so.client.PreconditionFailedException; import org.onap.so.client.RestPropertiesLoader; import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; +import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,6 +59,12 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { private static final String FAILED = "Failed"; private static final String PROCESSING = "Processing"; + /** + * indicate exception thrown. + */ + private static final String EXCEPTION = "Exception"; + + private final AtomicReference cdsResponse = new AtomicReference<>(); @Autowired @@ -132,7 +139,15 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { } if (cdsResponse != null) { - execution.setVariable("CDSStatus", cdsResponse.get()); + String cdsResponseStatus = cdsResponse.get(); + execution.setVariable("CDSStatus", cdsResponseStatus); + + /** + * throw CDS failed exception. + */ + if (cdsResponseStatus != SUCCESS) { + throw new BadResponseException("CDS call failed with status: " + cdsResponseStatus); + } } } catch (Exception ex) { @@ -177,6 +192,7 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { public void onError(Throwable t) { Status status = Status.fromThrowable(t); logger.error("Failed processing blueprint {}", status, t); + cdsResponse.set(EXCEPTION); } } diff --git a/bpmn/pom.xml b/bpmn/pom.xml index c4aad4ba69..fd070bb81b 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -25,6 +25,7 @@ UTF-8 UTF-8 1.5.1 + 1.6.0-SNAPSHOT diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn index f489a27052..9a1a7ed628 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn @@ -30,7 +30,7 @@ SequenceFlow_17llfxw SequenceFlow_0p0aqtx - + SequenceFlow_0p0aqtx SequenceFlow_1owbpsy SequenceFlow_1w4p9f7 @@ -49,7 +49,7 @@ SequenceFlow_0jfgn7n SequenceFlow_08voj55 - + SequenceFlow_08voj55 SequenceFlow_1n080up SequenceFlow_0d24h26 diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java index f51ea006d2..35f8f45999 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java @@ -33,10 +33,8 @@ import com.google.protobuf.Struct; import java.io.IOException; import java.util.List; import java.util.UUID; -import org.camunda.bpm.engine.runtime.Execution; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; @@ -52,12 +50,13 @@ import org.springframework.beans.factory.annotation.Autowired; /** * Basic Integration test for createVcpeResCustService_Simplified.bpmn workflow. */ -@Ignore public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest { - private static final long WORKFLOW_WAIT_TIME = 1000L; private Logger logger = LoggerFactory.getLogger(getClass()); + private static final long WORKFLOW_WAIT_TIME = 1000L; + private static final int DMAAP_DELAY_TIME_MS = 2000; + private static final String TEST_PROCESSINSTANCE_KEY = "CreateVcpeResCustService_simplified"; private String testBusinessKey; @@ -113,17 +112,9 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest { ProcessInstance pi = runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables); - assertThat(pi).isNotNull(); - - Thread.sleep(WORKFLOW_WAIT_TIME); - - Execution execution = runtimeService.createExecutionQuery().processInstanceBusinessKey(testBusinessKey) - .messageEventSubscriptionName("WorkflowMessage").singleResult(); - - assertThat(execution).isNotNull(); int waitCount = 10; - while (!pi.isEnded() && waitCount >= 0) { + while (!isProcessInstanceEnded() && waitCount >= 0) { Thread.sleep(WORKFLOW_WAIT_TIME); waitCount--; } @@ -145,6 +136,11 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest { } } + private boolean isProcessInstanceEnded() { + return runtimeService.createProcessInstanceQuery().processDefinitionKey(TEST_PROCESSINSTANCE_KEY) + .singleResult() == null; + } + private void checkConfigAssign(ExecutionServiceInput executionServiceInput) { logger.info("Checking the configAssign request"); @@ -154,26 +150,26 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest { * the fields of actionIdentifiers should match the one in the * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0"); - assertThat(actionIdentifiers.getActionName()).matches("config-assign"); - assertThat(actionIdentifiers.getMode()).matches("sync"); + assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf"); + assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); + assertThat(actionIdentifiers.getActionName()).isEqualTo("config-assign"); + assertThat(actionIdentifiers.getMode()).isEqualTo("sync"); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).matches("SO"); - assertThat(commonHeader.getRequestId()).matches(msoRequestId); + assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow("config-assign-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo"); + assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo"); + assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421"); + .isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421"); assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .matches("68dc9a92-214c-11e7-93ae-92361f002680"); + .isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680"); } private void checkConfigDeploy(ExecutionServiceInput executionServiceInput) { @@ -185,32 +181,32 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest { * the fields of actionIdentifiers should match the one in the * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0"); - assertThat(actionIdentifiers.getActionName()).matches("config-deploy"); - assertThat(actionIdentifiers.getMode()).matches("async"); + assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf"); + assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); + assertThat(actionIdentifiers.getActionName()).isEqualTo("config-deploy"); + assertThat(actionIdentifiers.getMode()).isEqualTo("async"); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).matches("SO"); - assertThat(commonHeader.getRequestId()).matches(msoRequestId); + assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow("config-deploy-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo"); + assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-deploy-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo"); + assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421"); + .isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421"); assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .matches("68dc9a92-214c-11e7-93ae-92361f002680"); + .isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680"); /** * IP addresses match the OAM ip addresses from AAI. */ - assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).matches("1.1.1.1"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).matches("::/128"); + assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).isEqualTo("1.1.1.1"); + assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).isEqualTo("::/128"); } /** @@ -223,8 +219,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest { /** * Get the events from PNF topic */ - wireMockServer - .stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")).willReturn(okJson(pnfResponse))); + wireMockServer.stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")) + .willReturn(okJson(pnfResponse).withFixedDelay(DMAAP_DELAY_TIME_MS))); } private void mockAai() { -- cgit 1.2.3-korg From 832539c87d7334ad68454c886c4b53d510bcd64d Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Thu, 23 May 2019 11:40:17 -0400 Subject: Fix retrieval of mso.config.path Fix retrieval of mso.config.path Issue-ID: SO-1925 Signed-off-by: Kuleshov, Elena Change-Id: I5eed704334de6335672624f9e9eca809856fb984 --- .../org/onap/so/asdc/installer/bpmn/BpmnInstaller.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index 7945ad0174..0379e2a423 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -34,6 +34,7 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; @@ -45,6 +46,7 @@ import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.ByteArrayBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.HttpClientBuilder; +import org.onap.so.asdc.client.ASDCConfiguration; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -63,6 +65,9 @@ public class BpmnInstaller { @Autowired private Environment env; + @Autowired + private ASDCConfiguration asdcConfig; + public void installBpmn(String csarFilePath) { logger.info("Deploying BPMN files from {}", csarFilePath); try { @@ -139,7 +144,7 @@ public class BpmnInstaller { protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception { FileInputStream bpmnFileStream = new FileInputStream( - Paths.get(System.getProperty("mso.config.path"), "ASDC", version, bpmnFileName).normalize().toString()); + Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString()); byte[] bytesToSend = IOUtils.toByteArray(bpmnFileStream); HttpEntity requestEntity = @@ -193,4 +198,14 @@ public class BpmnInstaller { logger.error("Unable to open file.", e); } } + + private String getMsoConfigPath() { + String msoConfigPath = System.getProperty("mso.config.path"); + if (msoConfigPath == null) { + logger.info("Unable to find the system property mso.config.path, use the default configuration"); + msoConfigPath = StringUtils.defaultString(asdcConfig.getPropertyOrNull("mso.config.defaultpath")); + } + logger.info("MSO config path is: {}", msoConfigPath); + return msoConfigPath; + } } -- cgit 1.2.3-korg From acc7ff95a7e34daf0c1ded4a29ba98b4855ef68f Mon Sep 17 00:00:00 2001 From: seshukm Date: Fri, 24 May 2019 11:07:06 +0530 Subject: Update the version to release Issue-ID: SO-1921 Change-Id: Ib178c25b1d8704f77efa7499d724e0dead85728a Signed-off-by: seshukm --- bpmn/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpmn/pom.xml b/bpmn/pom.xml index fd070bb81b..85a45db6ba 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -25,7 +25,7 @@ UTF-8 UTF-8 1.5.1 - 1.6.0-SNAPSHOT + 1.5.0 -- cgit 1.2.3-korg From 1e3588de060764bd3b5f054c83e2ab5dfa6bb815 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 23 May 2019 15:52:59 +0000 Subject: Calls to/from VNFM fail Issue-ID: SO-1909 Change-Id: I2f8a19dfd456316e5436be4e85d8a384d7d5ed6f Signed-off-by: MichaelMorris (cherry picked from commit a7160456335b2ce3710efd00658711d431eac0b4) --- .../vnfmadapter/MessageConverterConfiguration.java | 46 ++++++++++++++++++++++ .../vnfmadapter/WebSecurityConfigImpl.java | 8 ++-- .../vnfmadapter/extclients/SdcPackageProvider.java | 1 + .../vnfmadapter/extclients/aai/AaiHelper.java | 5 ++- .../extclients/aai/AaiServiceProviderImpl.java | 4 +- .../extclients/vnfm/VnfmServiceProviderImpl.java | 4 +- .../extclients/vnfm/VnfmUrlProvider.java | 6 +-- .../vnfmadapter/lifecycle/LifecycleManager.java | 11 +++++- 8 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java new file mode 100644 index 0000000000..d99b68846e --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.adapters.vnfmadapter; + +import com.google.gson.Gson; +import java.util.ArrayList; +import java.util.Collection; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.GsonHttpMessageConverter; + +/** + * Configures message converter + */ +@Configuration +public class MessageConverterConfiguration { + + @Bean + public HttpMessageConverters customConverters() { + final Collection> messageConverters = new ArrayList<>(); + final Gson gson = new JSON().getGson(); + final GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(gson); + messageConverters.add(gsonHttpMessageConverter); + return new HttpMessageConverters(true, messageConverters); + } +} diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java index 2b33e8b11d..f0830139b7 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java @@ -36,9 +36,11 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { @Override protected void configure(final HttpSecurity http) throws Exception { - http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and() - .httpBasic(); + http.csrf().disable().authorizeRequests() + .antMatchers("/manage/health", "/manage/info", Constants.BASE_URL + "/lcn/**", + Constants.BASE_URL + "/grants/**") + .permitAll().antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")) + .and().httpBasic(); } @Override diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java index fd92910e36..57d6615d66 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java @@ -89,6 +89,7 @@ public class SdcPackageProvider { try { final String vnfdLocation = getVnfdLocation(new ByteArrayInputStream(onapPackage)); final String onapVnfdContent = getFileInZip(new ByteArrayInputStream(onapPackage), vnfdLocation).toString(); + logger.debug("VNFD CONTENTS: " + onapVnfdContent); final JsonObject root = new Gson().toJsonTree(new Yaml().load(onapVnfdContent)).getAsJsonObject(); final JsonObject topologyTemplates = child(root, "topology_template"); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java index 1374e89a19..110bbabdb2 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java @@ -202,6 +202,9 @@ public class AaiHelper { logger.debug("VNFMs in ESR: " + vnfmsInEsr); for (final EsrVnfm vnfm : vnfmsInEsr.getEsrVnfm()) { + final EsrSystemInfoList systemInfolist = + aaiServiceProvider.invokeGetVnfmEsrSystemInfoList(vnfm.getVnfmId()); + vnfm.setEsrSystemInfoList(systemInfolist); if (vnfmHasMatchingEsrSystemInfoType(vnfm, vnf.getNfType())) { return vnfm; } @@ -212,7 +215,7 @@ public class AaiHelper { private boolean vnfmHasMatchingEsrSystemInfoType(final EsrVnfm vnfm, final String type) { logger.debug("Checking VNFM ID: " + vnfm + ": " + vnfm.getVnfmId()); - final EsrSystemInfoList systemInfolist = aaiServiceProvider.invokeGetVnfmEsrSystemInfoList(vnfm.getVnfmId()); + final EsrSystemInfoList systemInfolist = vnfm.getEsrSystemInfoList(); if (systemInfolist != null) { for (final EsrSystemInfo esrSystemInfo : systemInfolist.getEsrSystemInfo()) { if (esrSystemInfo.getType().equals(type)) { diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java index 50e579dd83..1fa62efa25 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java @@ -58,8 +58,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider { @Override public GenericVnfs invokeQueryGenericVnf(final String selfLink) { return aaiClientProvider.getAaiClient() - .get(GenericVnfs.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam("selflink", selfLink)) + .get(GenericVnfs.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS) + .queryParam("selflink", selfLink.replaceAll("https", "http"))) .orElseGet(() -> { logger.debug("No vnf found in AAI with selflink: {}", selfLink); return null; diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java index e66f86b66f..0b5b09ae39 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java @@ -54,7 +54,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider { @Override public Optional getVnf(final String vnfSelfLink) { - return httpServiceProvider.get(vnfSelfLink, InlineResponse201.class); + return httpServiceProvider.get(vnfSelfLink.replaceAll("https", "http"), InlineResponse201.class); } @Override @@ -96,7 +96,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider { logger.error(errorMessage, exception); throw new VnfmRequestFailureException(errorMessage, exception); } - if (response.getStatusCode() != HttpStatus.OK) { + if (response.getStatusCode() != HttpStatus.CREATED) { final String errorMessage = "Subscription to VNFM " + vnfmId + " returned status code: " + response.getStatusCode() + ", request: " + subscriptionRequest; logger.error(errorMessage); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java index f948f3cfac..9c760b44b1 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java @@ -52,7 +52,7 @@ public class VnfmUrlProvider { * @return the URL of the operation */ public String getOperationUrl(final String vnfmId, final String operationId) { - final String url = UriComponentsBuilder.fromUri(getBaseUri(vnfmId)).pathSegment("/vnf_lcm_op_occs/") + final String url = UriComponentsBuilder.fromUri(getBaseUri(vnfmId)).pathSegment("vnf_lcm_op_occs") .pathSegment(operationId).build().toString(); logger.debug("getOperationUrl:" + url); @@ -67,7 +67,7 @@ public class VnfmUrlProvider { */ public String getSubscriptionsUrl(final String vnfmId) { final String url = - UriComponentsBuilder.fromUri(getBaseUri(vnfmId)).pathSegment("/subscriptions").build().toString(); + UriComponentsBuilder.fromUri(getBaseUri(vnfmId)).pathSegment("subscriptions").build().toString(); logger.debug("getSubscriptionUrl:" + url); return url; @@ -75,7 +75,7 @@ public class VnfmUrlProvider { public String getCreationUrl(final String vnfmId) { final String url = - UriComponentsBuilder.fromUri(getBaseUri(vnfmId)).pathSegment("/vnf_instances").build().toString(); + UriComponentsBuilder.fromUri(getBaseUri(vnfmId)).pathSegment("vnf_instances").build().toString(); logger.debug("getCreationUrl:" + url); return url; diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java index 32bb9b93a4..a4f7d3206d 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java @@ -95,7 +95,7 @@ public class LifecycleManager { logger.info("Create response: {}", vnfmResponse); - genericVnf.setSelflink(vnfmResponse.getLinks().getSelf().getHref()); + genericVnf.setSelflink(getSelfLink(vnfmResponse, vnfm)); aaiServiceProvider.invokePutGenericVnf(genericVnf); final String vnfIdInVnfm = vnfmResponse.getId(); @@ -111,6 +111,15 @@ public class LifecycleManager { return response; } + private String getSelfLink(final InlineResponse201 vnfmResponse, final EsrVnfm vnfm) { + if (vnfmResponse.getLinks() != null && vnfmResponse.getLinks().getSelf() != null + && vnfmResponse.getLinks().getSelf().getHref() != null) { + return vnfmResponse.getLinks().getSelf().getHref().replaceAll("https", "http"); + } + return vnfm.getEsrSystemInfoList().getEsrSystemInfo().iterator().next().getServiceUrl() + "/vnf_instances/" + + vnfmResponse.getId(); + } + private OamIpAddressSource extractOamIpAddressSource(final CreateVnfRequest request) { final Map additionalParams = request.getAdditionalParams(); try { -- cgit 1.2.3-korg From 3e70758d25bab6c43cbc9445b14254d8a42146a4 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Fri, 24 May 2019 10:20:56 -0400 Subject: Persist native CM workflows in CatalogDB Add native CM workflows to Workflow table to make them available to VID Issue-ID: SO-1942 Signed-off-by: Kuleshov, Elena Change-Id: Ifbf3ed8a513f4704583df8a565dba97344702ede --- .../src/main/resources/db/migration/R__WorkflowDesignerData.sql | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql index fd7fcd48d0..3f76334bd9 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql @@ -196,4 +196,10 @@ VALUES ((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), (select ID from user_parameters where NAME='existing_software_version')), ((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0), -(select ID from user_parameters where NAME='new_software_version')); \ No newline at end of file +(select ID from user_parameters where NAME='new_software_version')); + +INSERT INTO `workflow` (`ARTIFACT_UUID`,`ARTIFACT_NAME`,`NAME`,`OPERATION_NAME`,`VERSION`,`DESCRIPTION`,`RESOURCE_TARGET`,`SOURCE`) +VALUES +('9d45cd30-1a89-4993-87c1-6dd09c1696cf','VFModule-ScaleOut','VNF Scale Out','ScaleOut',1.0,'native static workflow to support ScaleOut','vfModule','native'), +('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VNF In Place Software Update','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'), +('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VNF Config Update','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native'); \ No newline at end of file -- cgit 1.2.3-korg From 03c7d857ca9aea9efd59223b6eaec7ee30545727 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Fri, 24 May 2019 11:37:34 -0700 Subject: Fix Missing Import in OofHoming.groovy Issue-ID: SO-1926 Change-Id: Idee7eb0ab789fd8ac335b8c97b344b6e4f4b7fba Signed-off-by: Marcus G K Williams --- .../src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index d17a3c42a6..623d5a67e3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -36,9 +36,11 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.slf4j.Logger import org.slf4j.LoggerFactory +import org.onap.so.db.catalog.beans.AuthenticationType import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance +import org.onap.so.db.catalog.beans.ServerType import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.utils.TargetEntity -- cgit 1.2.3-korg From 253a7e17c7b89acfc3cb8748239a544bade75437 Mon Sep 17 00:00:00 2001 From: Yang Xu Date: Fri, 24 May 2019 16:17:50 -0400 Subject: Typo in bpmn mso-request-id variable name Change-Id: I50e7f33a3a38e77c84874d75ab33c5f9bb693f8b Issue-ID: SO-1922 Signed-off-by: Yang Xu --- .../src/main/resources/subprocess/DoCreateVnf.bpmn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn index 50436352ea..df95cf0210 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -90,7 +90,7 @@ createVnf.preProcessSDNCActivateRequest(execution)]]> - + -- cgit 1.2.3-korg From 2097de57c95002d6f1a9f3e5f4e5398ab6e19e94 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Sat, 25 May 2019 00:22:33 -0400 Subject: Handle lazy init of activitySpecs Use Transactional setting for activitySpecs retrieval Issue-ID: SO-1957 Signed-off-by: Kuleshov, Elena Change-Id: Idfe57474bfdec055a12a1e8fd787d31ac9dc7507 --- .../main/java/org/onap/so/asdc/Application.java | 5 +- .../onap/so/asdc/activity/DeployActivitySpecs.java | 5 +- .../asdc/activity/DeployActivitySpecsITTest.java | 76 ++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java index a05eeea466..eb2957c6f8 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java @@ -22,6 +22,8 @@ package org.onap.so.asdc; import javax.annotation.PostConstruct; import org.onap.so.asdc.activity.DeployActivitySpecs; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -32,7 +34,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @EnableScheduling @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") public class Application { - + private static final Logger logger = LoggerFactory.getLogger(Application.class); private static final String MSO_CONFIG_PATH = "mso.config.path"; private static final String LOGS_DIR = "logs_dir"; @@ -55,6 +57,7 @@ public class Application { try { deployActivitySpecs.deployActivities(); } catch (Exception e) { + logger.warn("{} {}", "Exception on deploying activitySpecs: ", e.getMessage()); } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java index 87008f1d8f..54da1b9247 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java @@ -25,6 +25,7 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import org.onap.so.asdc.activity.beans.ActivitySpec; import org.onap.so.asdc.activity.beans.Input; import org.onap.so.asdc.activity.beans.Output; @@ -52,14 +53,16 @@ public class DeployActivitySpecs { protected static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class); - + @Transactional public void deployActivities() throws Exception { String hostname = env.getProperty(SDC_ENDPOINT); + logger.debug("{} {}", "SDC ActivitySpec endpoint: ", hostname); if (hostname == null || hostname.isEmpty()) { return; } List activitySpecsFromCatalog = activitySpecRepository.findAll(); for (org.onap.so.db.catalog.beans.ActivitySpec activitySpecFromCatalog : activitySpecsFromCatalog) { + logger.debug("{} {}", "Attempting to create activity ", activitySpecFromCatalog.getName()); ActivitySpec activitySpec = mapActivitySpecFromCatalogToSdc(activitySpecFromCatalog); String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec); if (activitySpecId != null) { diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java new file mode 100644 index 0000000000..81977da278 --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java @@ -0,0 +1,76 @@ +/*- + * ============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.asdc.activity; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; +import org.junit.Test; +import org.mockito.Mock; +import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.activity.DeployActivitySpecs; +import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpHeaders; +import com.fasterxml.jackson.databind.ObjectMapper; +import javax.ws.rs.core.MediaType; + +public class DeployActivitySpecsITTest extends BaseTest { + @Mock + protected Environment env; + + @Value("${wiremock.server.port}") + private String wiremockPort; + + @Autowired + private DeployActivitySpecs deployActivitySpecs; + + @Test + public void deployActivitySpecsIT_Test() throws Exception { + ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); + activitySpecCreateResponse.setId("testActivityId"); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + + ObjectMapper mapper = new ObjectMapper(); + String body = mapper.writeValueAsString(activitySpecCreateResponse); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body))); + + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://localhost:8090"); + + String urlPath = "/v1.0/activity-spec/testActivityId/versions/latest/actions"; + + wireMockServer.stubFor( + put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()))); + + deployActivitySpecs.deployActivities(); + assertTrue(activitySpecCreateResponse.getId().equals("testActivityId")); + } +} -- cgit 1.2.3-korg From 3aa69ccef204f8df3ea310d5014384390a59890b Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Sat, 25 May 2019 08:30:00 -0400 Subject: Use lowercase for table names in beans Uppercase table names cause issues on db queries Issue-ID: SO-1969 Signed-off-by: Kuleshov, Elena Change-Id: I468cfc6635c68771caf04a1f75d336559877d288 --- .../main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java | 2 +- .../main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java | 2 +- .../src/main/java/org/onap/so/db/catalog/beans/VnfResourceWorkflow.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java index e7ace2cda5..b5da55c7d6 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java @@ -27,7 +27,7 @@ import org.hibernate.annotations.NotFoundAction; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity -@Table(name = "ACTIVITY_SPEC_CATEGORIES") +@Table(name = "activity_spec_categories") public class ActivitySpecCategories implements Serializable { private static final long serialVersionUID = -6251150462067699643L; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java index 5173f27a15..ed056400b2 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecParameters.java @@ -17,7 +17,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; @Entity -@Table(name = "ACTIVITY_SPEC_PARAMETERS") +@Table(name = "activity_spec_parameters") public class ActivitySpecParameters implements Serializable { private static final long serialVersionUID = 3627711377147710046L; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceWorkflow.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceWorkflow.java index f49ae26305..92cc5d18f0 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceWorkflow.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceWorkflow.java @@ -44,7 +44,7 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @IdClass(VnfResourceWorkflowId.class) -@Table(name = "VNF_RESOURCE_TO_WORKFLOW") +@Table(name = "vnf_resource_to_workflow") public class VnfResourceWorkflow implements Serializable { private static final long serialVersionUID = -1326433350241927676L; -- cgit 1.2.3-korg From 01fab1cee5eaea546f35d601e2d5b83dfa15cad6 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Sun, 26 May 2019 22:20:47 -0400 Subject: Modify scaleOut-related settings Corrections for execution of VfModule-ScaleOut Issue-ID: SO-1972 Signed-off-by: Kuleshov, Elena Change-Id: Ia654a223f1e86749d34d78b5918eda38a0a630c7 --- .../src/main/resources/db/migration/R__MacroData.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 372fbab33d..2183d3b6d3 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -27,7 +27,7 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I ('VFModule-Delete', 'deleteInstance', 'VfModule', true,true, '7','7', 'CloudOwner'), ('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner'), ('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner'), -('VFModule-ScaleOut', 'createInstance', 'VfModule', true, true, '7','7', 'CloudOwner'); +('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'CloudOwner'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES @@ -234,8 +234,8 @@ VALUES ('DeleteNetworkBB', 'NETWORK', 'DELETE'), ('DeleteNetworkCollectionBB', 'NETWORK', 'DELETE'), -('ConfigurationScaleOutBB', 'VF_MODULE', 'CREATE'), -('GenericVnfHealthCheckBB', 'VF_MODULE', 'CREATE'); +('ConfigurationScaleOutBB', 'NO_VALIDATE', 'CUSTOM'), +('GenericVnfHealthCheckBB', 'NO_VALIDATE', 'CUSTOM'); INSERT INTO orchestration_status_state_transition_directive (resource_type, orchestration_status, target_action, flow_directive) VALUES -- cgit 1.2.3-korg From 0d9e1e9383e17e715fdabac7744c6b930eca1b20 Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Thu, 23 May 2019 18:29:10 +0300 Subject: fixed typos and added SERVICE_INSTANCE_ID Change-Id: I68174bf2e67280a4bf65d8f26b04793b76896f04 Issue-ID: SO-1913 Signed-off-by: MariosIakovidis --- .../org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy | 12 ++++++++++-- .../src/main/resources/process/HandlePNF.bpmn | 5 +++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy index 261f107140..f06d71cec4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy @@ -38,18 +38,26 @@ public class HandlePNF extends AbstractServiceTaskProcessor{ @Override void preProcessRequest(DelegateExecution execution) { logger.debug("Start preProcess for HandlePNF") - // set correlation ID def resourceInput = execution.getVariable("resourceInput") String serInput = jsonUtil.getJsonValue(resourceInput, "requestsInputs") String correlationId = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_pnf_name") if (!StringUtils.isEmpty(correlationId)) { - execution.setVariable(ExecutionVariableNames.CORRELATION_ID, correlationId) + execution.setVariable(ExecutionVariableNames.PNF_CORRELATION_ID, correlationId) logger.debug("Found correlation id : " + correlationId) } else { logger.error("== correlation id is empty ==") exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "correlation id is not provided") } + + String serviceInstanceID = jsonUtil.getJsonValue(resourceInput, ExecutionVariableNames.SERVICE_INSTANCE_ID) + if (!StringUtils.isEmpty(serviceInstanceID)) { + execution.setVariable(ExecutionVariableNames.SERVICE_INSTANCE_ID, serviceInstanceID) + logger.debug("found serviceInstanceID: "+serviceInstanceID) + } else { + logger.error("== serviceInstance ID is empty ==") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "serviceInstance ID is not provided") + } // next task will set the uuid logger.debug("exit preProcess for HandlePNF") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn index c81b289737..01ca152e61 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1c92ks3_activate @@ -21,8 +21,9 @@ handlePNF.preProcessRequest(execution) - + + SequenceFlow_1apj1fn SequenceFlow_0pujwl4 -- cgit 1.2.3-korg From f3655618ffadc982bd8b45488e3b3bc2bc01ec02 Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Mon, 27 May 2019 22:54:42 +0300 Subject: Fixed errors in HandlePnf flow Change-Id: I1cf49f98f26e322b4785cc14f96ee63a5830117e Issue-ID: SO-1930 Signed-off-by: MariosIakovidis --- .../src/main/resources/process/HandlePNF.bpmn | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn index 01ca152e61..257a0dee64 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn @@ -6,14 +6,12 @@ SequenceFlow_1c92ks3_activate - SequenceFlow_17xr584 SequenceFlow_12q67gd import org.onap.so.bpmn.infrastructure.scripts.* def handlePNF = new HandlePNF() handlePNF.preProcessRequest(execution) - SequenceFlow_02fi1yn @@ -24,6 +22,7 @@ handlePNF.preProcessRequest(execution) + SequenceFlow_1apj1fn SequenceFlow_0pujwl4 @@ -31,7 +30,6 @@ handlePNF.preProcessRequest(execution) SequenceFlow_0pujwl4 SequenceFlow_1la8oih - SequenceFlow_1ezf4gu import org.onap.so.bpmn.infrastructure.scripts.* def handlePNF = new HandlePNF() handlePNF.postProcessRequest(execution) @@ -40,13 +38,10 @@ handlePNF.postProcessRequest(execution) SequenceFlow_12q67gd - SequenceFlow_17xr584 SequenceFlow_1apj1fn - - SequenceFlow_1ezf4gu SequenceFlow_1la8oih SequenceFlow_02fi1yn import org.onap.so.bpmn.infrastructure.scripts.* @@ -69,10 +64,6 @@ handlePNF.sendSyncResponse(execution) - - - - @@ -95,19 +86,15 @@ handlePNF.sendSyncResponse(execution) - + - + - + - - - - -- cgit 1.2.3-korg From 019a4125af612b59f11571f52e4f369cfa59ba0c Mon Sep 17 00:00:00 2001 From: Yang Xu Date: Tue, 28 May 2019 01:09:11 -0400 Subject: Set response code in UpdateAAIGenericVnf Change-Id: I67fb789d40ea86a82379e76b94c2da1bd552cd31 Issue-ID: SO-1927 Signed-off-by: Yang Xu --- .../groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index a40bf59097..ebab6ad0ac 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -226,6 +226,8 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { try { getAAIClient().update(uri,payload) + execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 200) + execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', "Success") } catch (Exception ex) { logger.debug('Exception occurred while executing AAI PATCH: {}', ex.getMessage(), ex) execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500) -- cgit 1.2.3-korg From 55eef418214449ce11bf2247019389ddfd01af2e Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Tue, 28 May 2019 13:01:41 +0300 Subject: Corrected instance names Issue-ID: SO-1931 Signed-off-by: MariosIakovidis Change-Id: I4c3700cdc1cc058f3a37a77d087d38b2aadad29d --- .../bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 3e059e53bf..3f9d10eaa4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -152,12 +152,12 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { execution.setVariable("isActivateRequired", "true") break - case ~/[\w\s\W]*OLT[\w\s\W]*/ : + case ~/[\w\s\W]*AccessConnectivity[\w\s\W]*/ : operationType = "AccessConnectivity" execution.setVariable("isActivateRequired", "false") break - case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ : + case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ : operationType = "InternetProfile" execution.setVariable("isActivateRequired", "false") break @@ -225,7 +225,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String serInput = jsonUtil.getJsonValue(resourceInputTmp, "requestsInputs") switch (modelName) { - case ~/[\w\s\W]*OLT[\w\s\W]*/ : + case ~/[\w\s\W]*AccessConnectivity[\w\s\W]*/ : // get the required properties and update in resource input def resourceInput = resourceInputObj.getResourceParameters() @@ -252,7 +252,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { msoLogger.debug("new resource Input :" + resourceInputObj.toString()) break - case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ : + case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ : // get the required properties and update in resource input def resourceInput = resourceInputObj.getResourceParameters() String incomingRequest = resourceInputObj.getRequestsInputs() -- cgit 1.2.3-korg From 4db782068934ebd20caa8405cd8644a2bf922934 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Tue, 28 May 2019 20:46:03 -0700 Subject: Fix UriBuilder import in OofUtils Import all changes from Casablanca that were incorrectly removed during merge from Casablanca back into master. Issue-ID: SO-1926 Change-Id: I8355e804586aa80e291f3c72a00bf69ce424316b Signed-off-by: Marcus G K Williams --- .../onap/so/bpmn/common/scripts/OofHoming.groovy | 36 ++++++++++++---------- .../onap/so/bpmn/common/scripts/OofUtils.groovy | 35 ++++++--------------- .../main/java/org/onap/so/utils/TargetEntity.java | 2 +- 3 files changed, 31 insertions(+), 42 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 623d5a67e3..6583ded413 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -32,17 +32,18 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.DefaultProperties import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.slf4j.Logger -import org.slf4j.LoggerFactory +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.db.catalog.beans.AuthenticationType import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.db.catalog.beans.ServerType -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.utils.TargetEntity +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.json.JSONArray import org.json.JSONObject @@ -108,12 +109,12 @@ class OofHoming extends AbstractServiceTaskProcessor { if (isBlank(subscriberInfo)) { subscriber = new Subscriber("", "", "") } else { - String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") - String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") - String subCommonSiteId = "" - if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { - subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") - } + String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") + String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") + String subCommonSiteId = "" + if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { + subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") + } subscriber = new Subscriber(subId, subName, subCommonSiteId) } @@ -163,21 +164,24 @@ class OofHoming extends AbstractServiceTaskProcessor { logger.debug( "Posting to OOF Url: " + urlString) - URL url = new URL(urlString); - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO) + URL url = new URL(urlString) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.OOF) httpClient.addAdditionalHeader("Authorization", authHeader) - Response httpResponse = httpClient.post(oofRequest) + Response httpResponse = httpClient.post(oofRequest) - int responseCode = httpResponse.getStatus() - logger.debug("OOF sync response code is: " + responseCode) + int responseCode = httpResponse.getStatus() + logger.debug("OOF sync response code is: " + responseCode) + if(responseCode != 202){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + } logger.debug( "*** Completed Homing Call OOF ***") } } catch (BpmnError b) { throw b } catch (Exception e) { - logger.error(e); + logger.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing callOof: " + e.getMessage()) } @@ -360,7 +364,7 @@ class OofHoming extends AbstractServiceTaskProcessor { throw b } catch (Exception e) { logger.debug( "ProcessHomingSolution Exception: " + e) - logger.error(e); + logger.error(e); exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution") } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 2f46630715..4bfb29bc45 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.util.OofInfraUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.domain.HomingSolution import org.onap.so.bpmn.core.domain.ModelInfo @@ -53,6 +54,7 @@ import org.slf4j.LoggerFactory import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response +import javax.ws.rs.core.UriBuilder import javax.xml.ws.http.HTTPException import static org.onap.so.bpmn.common.scripts.GenericUtils.* @@ -62,6 +64,7 @@ class OofUtils { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + OofInfraUtils oofInfraUtils = new OofInfraUtils() private AbstractServiceTaskProcessor utils @@ -504,27 +507,8 @@ class OofUtils { * * @return void */ - Void createCloudSiteCatalogDb(CloudSite cloudSite, DelegateExecution execution) { - - String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution) - String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution) - String uri = "/cloudSite" - - URL url = new URL(endpoint + uri) - HttpClient client = new HttpClientFactory().newJsonClient(url, TargetEntity.EXTERNAL) - client.addAdditionalHeader(HttpHeaders.AUTHORIZATION, auth) - client.addAdditionalHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) - - Response response = client.post(request.getBody().toString()) - - int responseCode = response.getStatus() - logger.debug("CatalogDB response code is: " + responseCode) - String syncResponse = response.readEntity(String.class) - logger.debug("CatalogDB response is: " + syncResponse) - - if(responseCode != 202){ - exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.") - } + Void createCloudSite(CloudSite cloudSite, DelegateExecution execution) { + oofInfraUtils.createCloudSite(cloudSite, execution) } /** @@ -537,11 +521,12 @@ class OofUtils { Void createHomingInstance(HomingInstance homingInstance, DelegateExecution execution) { oofInfraUtils.createHomingInstance(homingInstance, execution) } - String getMsbHost(DelegateExecution execution) { - String msbHost = UrnPropertiesReader.getVariable("mso.msb.host", execution, "msb-iag.onap") - Integer msbPort = UrnPropertiesReader.getVariable("mso.msb.port", execution, "80").toInteger() + String getMsbHost(DelegateExecution execution) { + String msbHost = UrnPropertiesReader.getVariable("mso.msb.host", execution, "msb-iag.onap") + + Integer msbPort = UrnPropertiesReader.getVariable("mso.msb.port", execution, "80").toInteger() - return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString() + return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString() } } diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java index 5f87378b79..ea0b70413b 100644 --- a/common/src/main/java/org/onap/so/utils/TargetEntity.java +++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java @@ -23,7 +23,7 @@ package org.onap.so.utils; import java.util.EnumSet; public enum TargetEntity { - OPENSTACK_ADAPTER, BPMN, GRM, AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, SNIRO, SDC, EXTERNAL, MULTICLOUD; + OPENSTACK_ADAPTER, BPMN, GRM, AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, SNIRO, SDC, EXTERNAL, MULTICLOUD, OOF; private static final String PREFIX = "SO"; -- cgit 1.2.3-korg From 7fd0f0846a860d4daf4f6d48e757dc03882c0ffc Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Tue, 28 May 2019 22:35:44 +0300 Subject: Renamed accessId to remoteid Issue-ID: SO-1933 Signed-off-by: MariosIakovidis Change-Id: I6b63286f10ebc129b72a36cf41f0bb85b797f9ef --- .../bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 3f9d10eaa4..b16a3060f4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -234,7 +234,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") String cvlan = "10" String svlan = "100" - String accessId = "AC9.0234.0337" + String remoteId = "AC9.0234.0337" String manufacturer = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_manufacturer") String ontsn = jsonUtil.getJsonValue(serInput, @@ -242,7 +242,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.CVLAN", cvlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.SVLAN", svlan) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.accessID", accessId) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.remote_id", remoteId) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ONTSN", ontsn) @@ -264,14 +264,14 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String svlan = "1000" String manufacturer = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_manufacturer") - String accessId = "AC9.0234.0337" + String remoteId = "AC9.0234.0337" String ontsn = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_serial_num") String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_access_id", accessId) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_remote_id", remoteId) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ont_sn", ontsn) msoLogger.debug("old resource input:" + resourceInputObj.toString()) resourceInputObj.setResourceParameters(uResourceInput) -- cgit 1.2.3-korg From f8270fc54d69ed3765ef788db1292bf27a68a351 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Thu, 30 May 2019 09:48:21 +0000 Subject: Fixing ETSI BB execution failure Change-Id: Icbcd43be40c7717a714bc866bf153ac3ea0e427c Issue-ID: SO-1934 Signed-off-by: waqas.ikram --- .../subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn index 13bd107fdb..38bbdc1134 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_18fsqzd @@ -25,16 +25,22 @@ - - + + + + SequenceFlow_0hp0ka1 SequenceFlow_1owx4yu + + + + SequenceFlow_1owx4yu SequenceFlow_0n57z81 -- cgit 1.2.3-korg From 10c70c41244d74b04292ee1fa5c369169c07b7c9 Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Thu, 30 May 2019 13:12:39 +0300 Subject: added extra parameters Issue-ID: SO-1933 Signed-off-by: MariosIakovidis Change-Id: I7fdd9ff5373e2f27d225f265ff13b4e14a8b3abc --- .../scripts/CreateSDNCNetworkResource.groovy | 56 ++++++++++++++-------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index b16a3060f4..b0749ded86 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -232,24 +232,27 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String incomingRequest = resourceInputObj.getRequestsInputs() String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") - String cvlan = "10" - String svlan = "100" - String remoteId = "AC9.0234.0337" + String cvlan = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.cvlan") + String svlan = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.svlan") + String remoteId = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id") String manufacturer = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_manufacturer") String ontsn = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_serial_num") - String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.CVLAN", cvlan) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.SVLAN", svlan) + String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.remote_id", remoteId) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ONTSN", ontsn) - msoLogger.debug("old resource input:" + resourceInputObj.toString()) + logger.debug("old resource input:" + resourceInputObj.toString()) resourceInputObj.setResourceParameters(uResourceInput) execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) - msoLogger.debug("new resource Input :" + resourceInputObj.toString()) + logger.debug("new resource Input :" + resourceInputObj.toString()) break case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ : @@ -260,23 +263,38 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") JSONObject inputParameters = new JSONObject(requestInputs) - String cvlan = "100" - String svlan = "1000" + String cvlan = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.cvlan") + String svlan = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.svlan") String manufacturer = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_manufacturer") - String remoteId = "AC9.0234.0337" + String remoteId = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id") String ontsn = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_serial_num") + String serviceType = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_service_type") + String macAddr = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_rg_mac_addr") + String upStream = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_upstream_speed") + String downStream = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_downstream_speed") String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_remote_id", remoteId) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ont_sn", ontsn) - msoLogger.debug("old resource input:" + resourceInputObj.toString()) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_service_type", serviceType) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_rg_mac_addr", macAddr) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_upstream_speed", upStream) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_downstream_speed", downStream) + logger.debug("old resource input:" + resourceInputObj.toString()) resourceInputObj.setResourceParameters(uResourceInput) execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) - msoLogger.debug("new resource Input :" + resourceInputObj.toString()) + logger.debug("new resource Input :" + resourceInputObj.toString()) break @@ -308,13 +326,13 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName" String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName) - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName) - ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get() - ServiceInstance si = sis.getServiceInstance().get(0) + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName) + ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get() + ServiceInstance si = sis.getServiceInstance().get(0) - def parentServiceInstanceId = si.getServiceInstanceId() - execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + def parentServiceInstanceId = si.getServiceInstanceId() + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) break default: @@ -646,7 +664,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id" break - // for SDWANConnectivity and SOTNConnectivity and default: + // for SDWANConnectivity and SOTNConnectivity and default: default: val = response."response-data"."RequestData"."output"."network-response-information"."instance-id" break -- cgit 1.2.3-korg From f8ef6b32ba67831c485330f6349ea773be566183 Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Thu, 30 May 2019 07:35:13 -0700 Subject: Remove oof_directives from user_directives Oof_directives - when populated with a json string, breaks the parsing of the user_directives. Since it is not needed in the user_directives, remove it. Change-Id: I0e2c3deef8266df52ac73b95209843ac31f986ef Issue-ID: SO-1939 Signed-off-by: Eric Multanen --- .../org/onap/so/bpmn/common/scripts/VfModuleBase.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy index 07d8ec9b8e..e261fb9fdd 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy @@ -519,12 +519,14 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { String vnfKey = entry.getKey() String vnfValue = entry.getValue() paramsMap.put("$vnfKey", "$vnfValue") - if (pcnt > 0) { - userDirectivesBuilder.append(",") + if (!"oof_directives".equals(vnfKey)) { + if (pcnt > 0) { + userDirectivesBuilder.append(",") + } + pcnt++ + userDirectivesBuilder.append("{\"attribute_name\":\"${vnfKey}\",") + userDirectivesBuilder.append("\"attribute_value\":\"${vnfValue}\"}") } - pcnt++ - userDirectivesBuilder.append("{\"attribute_name\":\"${vnfKey}\",") - userDirectivesBuilder.append("\"attribute_value\":\"${vnfValue}\"}") } if (pcnt > 0) { userDirectives = userDirectivesBuilder.append("]}").toString() -- cgit 1.2.3-korg From 5133d030cc914a1953151b2e009076d0d043ff6e Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 30 May 2019 12:01:17 +0000 Subject: Get operation state from VNFM failing Issue-ID: SO-1943 Change-Id: I8d0fd3e9cd4aea26e94a18a6e610abd34f2e5fe9 Signed-off-by: MichaelMorris --- .../extclients/vnfm/VnfmServiceProviderConfiguration.java | 9 ++++++--- .../so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java index 164f12ea29..2aee1c06e3 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java @@ -20,6 +20,10 @@ package org.onap.so.adapters.vnfmadapter.extclients.vnfm; +import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; +import com.google.gson.Gson; +import java.util.Iterator; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON; import org.onap.so.configuration.rest.BasicHttpHeadersProvider; import org.onap.so.configuration.rest.HttpHeadersProvider; import org.onap.so.rest.service.HttpRestServiceProvider; @@ -32,8 +36,6 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.GsonHttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestTemplate; -import java.util.Iterator; -import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; /** * Configures the HttpRestServiceProvider for REST call to a VNFM. @@ -60,7 +62,8 @@ public class VnfmServiceProviderConfiguration { iterator.remove(); } } - restTemplate.getMessageConverters().add(new GsonHttpMessageConverter()); + final Gson gson = new JSON().getGson(); + restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson)); } } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java index 73a49e9c40..b48de30f88 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java @@ -52,6 +52,7 @@ import org.onap.aai.domain.yang.RelationshipData; import org.onap.aai.domain.yang.RelationshipList; import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication; import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; @@ -115,7 +116,7 @@ public class VnfmAdapterControllerTest { @Autowired VnfmAdapterController controller; - Gson gson = new Gson(); + Gson gson = new JSON().getGson(); @Before public void setUp() throws Exception { -- cgit 1.2.3-korg From 791b6ad26eeee01a41379a4c6a6cc914ff98675f Mon Sep 17 00:00:00 2001 From: seshukm Date: Thu, 30 May 2019 17:39:23 +0530 Subject: update INFO.yaml Issue-ID: SO-1944 Change-Id: I2d773bed6822eaf440a8f941870fac2fdff1800f Signed-off-by: seshukm --- INFO.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/INFO.yaml b/INFO.yaml index f6b8b4eebb..065bea8128 100644 --- a/INFO.yaml +++ b/INFO.yaml @@ -110,4 +110,9 @@ tsc: name: 'Subhash Kumar Singh' name: 'Lukasz Muszkieta' link: 'https://lists.onap.org/g/onap-tsc/message/4320' + - type: 'removal' + name: 'Rob Daugherty' + - type: 'addition' + name: 'Max Benjamin' + link: 'https://lists.onap.org/g/onap-tsc/message/4981?p=,,,20,0,0,0::Created,,committer,20,2,0,31638681' -- cgit 1.2.3-korg From 53791d7d6434eb5ae821cba4572a96796d65c2ee Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Thu, 30 May 2019 13:15:16 +0000 Subject: Fixing infinte loop of flow Change-Id: I80dc144750406d5afcec9b4da717a55a3840e503 Issue-ID: SO-1946 Signed-off-by: waqas.ikram --- .../adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java | 17 ++++++++++++----- .../adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java | 16 ++++++++++++---- .../vnfm/tasks/VnfmAdapterServiceProviderImpl.java | 2 +- .../vnfm/tasks/VnfmAdapterServiceProviderImplTest.java | 5 ++--- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java index 4645680fc2..4c84bcaa1f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java @@ -55,11 +55,18 @@ public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask { * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} */ public void getCurrentOperationStatus(final BuildingBlockExecution execution) { - LOGGER.debug("Executing getCurrentOperationStatus ..."); - final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME); - execution.setVariable(OPERATION_STATUS_PARAM_NAME, - getOperationStatus(execution, vnfInstantiateResponse.getJobId())); - LOGGER.debug("Finished executing getCurrentOperationStatus ..."); + try { + LOGGER.debug("Executing getCurrentOperationStatus ..."); + final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME); + execution.setVariable(OPERATION_STATUS_PARAM_NAME, + getOperationStatus(execution, vnfInstantiateResponse.getJobId())); + LOGGER.debug("Finished executing getCurrentOperationStatus ..."); + } catch (final Exception exception) { + final String message = "Unable to invoke get current Operation status"; + LOGGER.error(message); + exceptionUtil.buildAndThrowWorkflowException(execution, 1209, message); + + } } /** diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java index e91f362d53..34e3efa8f5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java @@ -56,10 +56,18 @@ public class MonitorVnfmDeleteJobTask extends MonitorVnfmJobTask { * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} */ public void getCurrentOperationStatus(final BuildingBlockExecution execution) { - LOGGER.debug("Executing getCurrentOperationStatus ..."); - final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME); - execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId())); - LOGGER.debug("Finished executing getCurrentOperationStatus ..."); + try { + LOGGER.debug("Executing getCurrentOperationStatus ..."); + final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME); + execution.setVariable(OPERATION_STATUS_PARAM_NAME, + getOperationStatus(execution, deleteVnfResponse.getJobId())); + LOGGER.debug("Finished executing getCurrentOperationStatus ..."); + } catch (final Exception exception) { + final String message = "Unable to invoke get current Operation status"; + LOGGER.error(message); + exceptionUtil.buildAndThrowWorkflowException(execution, 1216, message); + + } } /** diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java index f193967a32..4a51891184 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java @@ -145,7 +145,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide return Optional.of(response.getBody()); } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) { LOGGER.error("Unexpected error while processing job request", httpInvocationException); - return Optional.absent(); + throw httpInvocationException; } } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java index 7bd6435b60..e94d7c2923 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java @@ -228,7 +228,7 @@ public class VnfmAdapterServiceProviderImplTest { assertFalse(actual.isPresent()); } - @Test + @Test(expected = RestProcessingException.class) public void testGetInstantiateOperationJobStatus_Exception() { when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL), @@ -237,8 +237,7 @@ public class VnfmAdapterServiceProviderImplTest { final VnfmAdapterServiceProvider objUnderTest = new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider); - final Optional actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID); - assertFalse(actual.isPresent()); + objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID); } private QueryJobResponse getQueryJobResponse() { -- cgit 1.2.3-korg From de49c2d4edc81d6671dba6654c0825914092d6bf Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 30 May 2019 20:49:05 +0000 Subject: Handle operation state null from VNFM Issue-ID: SO-1956 Change-Id: I8d2efe3f9d97a38a533b33eabd0be2a42cebef66 Signed-off-by: MichaelMorris --- .../org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java index 345ff5119a..b3552c780e 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java @@ -93,6 +93,10 @@ public class JobManager { logger.debug("Job Id: " + jobId + ", operationId: " + operation.getId() + ", operation details: " + operation); + if (operation.getOperationState() == null) { + return response.operationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS); + } + response.setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND); response.setId(operation.getId()); response.setOperation(OperationEnum.fromValue(operation.getOperation().getValue())); -- cgit 1.2.3-korg From c32829b9f2e67a46fb56b590c253fd3bdc9cce97 Mon Sep 17 00:00:00 2001 From: seshukm Date: Fri, 31 May 2019 10:01:16 +0530 Subject: update INFO.yaml Issue-ID: SO-1944 Change-Id: I221fc3cce7f72373ad35a6ce07c887e928038348 Signed-off-by: seshukm --- INFO.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/INFO.yaml b/INFO.yaml index 065bea8128..77f51bc873 100644 --- a/INFO.yaml +++ b/INFO.yaml @@ -50,10 +50,10 @@ committers: company: 'Cloudify' id: 'dfilppi' timezone: '' - - name: 'Rob Daugherty' - email: 'rd472p@att.com' + - name: 'Max Benjamin' + email: 'max.benjamin@att.com' company: 'ATT' - id: 'rd472p' + id: 'mfour' timezone: '' - name: 'Yan Yang' email: 'yangyanyj@chinamobile.com' -- cgit 1.2.3-korg From 471b676355b1be9afe7c020a7c1436539cd5a365 Mon Sep 17 00:00:00 2001 From: seshukm Date: Fri, 31 May 2019 10:14:34 +0530 Subject: bump the SO release version Issue-ID: SO-1929 Change-Id: Idca0ebbe73d0b8d725840167730b354f16753ed6 Signed-off-by: seshukm --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 77e67b1c3c..44e6ad0dbb 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=4 -patch=2 +patch=3 base_version=${major}.${minor}.${patch} -- cgit 1.2.3-korg From a737222ca2fa0fcf87c2062c52fca8577aab87b9 Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Fri, 31 May 2019 06:44:05 -0700 Subject: Remove oof_directives from user_directives BB path Remove oof_directives from user_directives in the BB code path (as was done for the groovy code path). Change-Id: I018c3c85cc4a68ab128a2be869567b44fda08e48 Issue-ID: SO-1939 Signed-off-by: Eric Multanen --- .../vnf/mapper/VnfAdapterVfModuleObjectMapper.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 94e95687db..b0ba0595d5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -205,14 +205,22 @@ public class VnfAdapterVfModuleObjectMapper { private void buildDirectivesParamFromMap(Map paramsMap, String directive, Map srcMap) { StringBuilder directives = new StringBuilder(); - if (srcMap.size() > 0) { + int no_directives_size = 0; + if (directives.equals(MsoMulticloudUtils.USER_DIRECTIVES) + && srcMap.containsKey(MsoMulticloudUtils.OOF_DIRECTIVES)) { + no_directives_size = 1; + } + if (srcMap.size() > no_directives_size) { directives.append("{ \"attributes\": [ "); int i = 0; for (String attributeName : srcMap.keySet()) { - directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString())); - if (i < (srcMap.size() - 1)) - directives.append(", "); - i++; + if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directives) + && attributeName.equals(MsoMulticloudUtils.OOF_DIRECTIVES))) { + directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString())); + if (i < (srcMap.size() - 1 + no_directives_size)) + directives.append(", "); + i++; + } } directives.append("] }"); } else { -- cgit 1.2.3-korg From 2eb4e1106010db7ed404f5e65257321e18fe3eb5 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Fri, 31 May 2019 16:50:25 +0000 Subject: Fixing Null Value Exception Change-Id: I07553affad2297e1fa1e4e67b27bb08c51e4b8c3 Issue-ID: SO-1968 Signed-off-by: waqas.ikram --- .../subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn index 6d54262dc5..e7d40e84b5 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn @@ -1,6 +1,6 @@ - - + + SequenceFlow_1miob62 @@ -56,7 +56,7 @@ - + -- cgit 1.2.3-korg From f5034c75fb4178791a51fd16e1322e80c05b44a8 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Sun, 2 Jun 2019 15:24:20 +0000 Subject: Fixing EtSI BB ClassCastException Change-Id: Ia5a37f80392693f603d6597760ca9725882de169 Issue-ID: SO-1971 Signed-off-by: waqas.ikram --- .../BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn | 2 +- .../BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn | 4 +- .../vnfm/tasks/MonitorInstantiateVnfmNodeTask.java | 53 +++++++++ .../vnfm/tasks/MonitorTerminateVnfmNodeTask.java | 53 +++++++++ .../adapter/vnfm/tasks/MonitorVnfmNodeTask.java | 53 ++++++--- .../exception/GenericVnfNotFoundException.java | 33 ++++++ .../tasks/MonitorInstantiateVnfmNodeTaskTest.java | 129 +++++++++++++++++++++ .../tasks/MonitorTerminateVnfmNodeTaskTest.java | 113 ++++++++++++++++++ .../adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java | 111 ------------------ 9 files changed, 424 insertions(+), 127 deletions(-) create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java create mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java delete mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn index e7d40e84b5..9712ca8ab7 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn @@ -24,7 +24,7 @@ SequenceFlow_1rxbeqi - + SequenceFlow_1moaz0q SequenceFlow_09t51ao SequenceFlow_0qvy3sn diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn index 8fababaffe..668cfaa44a 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0spr34x @@ -28,7 +28,7 @@ ${execution.getVariable("deleteVnfNodeStatus")} - + SequenceFlow_17vvpzi SequenceFlow_11rfobu SequenceFlow_1unicf9 diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java new file mode 100644 index 0000000000..b885cc2ee5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; + +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author waqas.ikram@est.tech + * + */ +@Component +public class MonitorInstantiateVnfmNodeTask extends MonitorVnfmNodeTask { + + @Autowired + public MonitorInstantiateVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, + final ExceptionBuilder exceptionUtil, final AAIVnfResources aaiVnfResources) { + super(extractPojosForBB, exceptionUtil, aaiVnfResources); + } + + @Override + public String getNodeStatusVariableName() { + return CREATE_VNF_NODE_STATUS; + } + + @Override + public boolean isOrchestrationStatusValid(final String orchestrationStatus) { + return VNF_CREATED.equalsIgnoreCase(orchestrationStatus); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java new file mode 100644 index 0000000000..34296c20d6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; + +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author waqas.ikram@est.tech + * + */ +@Component +public class MonitorTerminateVnfmNodeTask extends MonitorVnfmNodeTask { + + @Autowired + public MonitorTerminateVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil, + final AAIVnfResources aaiVnfResources) { + super(extractPojosForBB, exceptionUtil, aaiVnfResources); + } + + @Override + public String getNodeStatusVariableName() { + return DELETE_VNF_NODE_STATUS; + } + + @Override + public boolean isOrchestrationStatusValid(final String orchestrationStatus) { + return VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java index 65b05e21f5..a7a4eadb33 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java @@ -19,38 +19,39 @@ */ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED; import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID; +import java.util.Optional; import org.onap.aai.domain.yang.GenericVnf; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; /** * * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) + * @author Waqas Ikram (waqas.ikram@est.tech) * */ -@Component -public class MonitorVnfmNodeTask { +public abstract class MonitorVnfmNodeTask { private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmNodeTask.class); private final ExtractPojosForBB extractPojosForBB; private final ExceptionBuilder exceptionUtil; + private final AAIVnfResources aaiVnfResources; @Autowired - public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil) { + public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil, + final AAIVnfResources aaiVnfResources) { this.exceptionUtil = exceptionUtil; this.extractPojosForBB = extractPojosForBB; + this.aaiVnfResources = aaiVnfResources; } /** @@ -61,17 +62,43 @@ public class MonitorVnfmNodeTask { public void getNodeStatus(final BuildingBlockExecution execution) { try { LOGGER.debug("Executing getNodeStatus ..."); - final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID); - String orchestrationStatus = vnf.getOrchestrationStatus(); - LOGGER.debug("Orchestration Status in AAI {}", orchestrationStatus); - execution.setVariable(CREATE_VNF_NODE_STATUS, VNF_CREATED.equalsIgnoreCase(orchestrationStatus)); - execution.setVariable(DELETE_VNF_NODE_STATUS, VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus)); + + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = + extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID); + + final String vnfId = vnf.getVnfId(); + LOGGER.debug("Query A&AI for generic VNF using vnfID: {}", vnfId); + final Optional aaiGenericVnfOptional = aaiVnfResources.getGenericVnf(vnfId); + + if (!aaiGenericVnfOptional.isPresent()) { + throw new GenericVnfNotFoundException("Unable to find generic vnf in A&AI using vnfID: " + vnfId); + } + final GenericVnf genericVnf = aaiGenericVnfOptional.get(); + final String orchestrationStatus = genericVnf.getOrchestrationStatus(); + LOGGER.debug("Found generic vnf with orchestration status : {}", orchestrationStatus); + + execution.setVariable(getNodeStatusVariableName(), isOrchestrationStatusValid(orchestrationStatus)); + } catch (final Exception exception) { LOGGER.error("Unable to get vnf from AAI", exception); exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception); } } + /** + * Get variable to store in execution context + * + * @return the variable name + */ + public abstract String getNodeStatusVariableName(); + + /** + * @param orchestrationStatus the orchestration status from A&AI + * @return true if valid + */ + public abstract boolean isOrchestrationStatusValid(final String orchestrationStatus); + + /** * Log and throw exception on timeout for job status * diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java new file mode 100644 index 0000000000..d33d0bc895 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception; + +/** + * @author waqas.ikram@est.tech + * + */ +public class GenericVnfNotFoundException extends Exception { + private static final long serialVersionUID = -2049370314818025597L; + + public GenericVnfNotFoundException(final String message) { + super(message); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java new file mode 100644 index 0000000000..effcf24a8d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED; +import java.util.Optional; +import java.util.UUID; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.orchestration.AAIVnfResources; + +/** + * + * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class MonitorInstantiateVnfmNodeTaskTest extends BaseTaskTest { + + private static final String VNF_ID = UUID.randomUUID().toString(); + + private static final String VNF_NAME = "VNF_NAME"; + + private MonitorVnfmNodeTask objUnderTest; + + @Mock + private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider; + + @Mock + private AAIVnfResources mockedAaiVnfResources; + + private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution(); + + @Before + public void setUp() { + objUnderTest = getEtsiVnfMonitorNodeJobTask(); + } + + @Test + public void testGetNodeStatus_genericVnfWithOrchStatusCreated_executionVariableSetToCreate() throws Exception { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf(); + final GenericVnf aaiGenericVnf = getAAIGenericVnf(); + aaiGenericVnf.setOrchestrationStatus(VNF_CREATED); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); + when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.of(aaiGenericVnf)); + objUnderTest.getNodeStatus(stubbedxecution); + assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); + } + + @Test + public void testGetNodeStatus_noGenericVnfFoundInAAI_throwException() throws Exception { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf(); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); + when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.empty()); + objUnderTest.getNodeStatus(stubbedxecution); + verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220), + any(Exception.class)); + assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); + + } + + @Test + public void testGetNodeStatusException() throws Exception { + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class); + objUnderTest.getNodeStatus(stubbedxecution); + assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); + verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220), + any(Exception.class)); + } + + @Test + public void testTimeOutLogFailue() throws Exception { + objUnderTest.timeOutLogFailue(stubbedxecution); + verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1221), + eq("Node operation time out")); + } + + private GenericVnf getAAIGenericVnf() { + final GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(VNF_ID); + genericVnf.setVnfName(VNF_NAME); + return genericVnf; + } + + private org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf getGenericVnf() { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = + new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + genericVnf.setVnfId(VNF_ID); + return genericVnf; + + } + + private MonitorInstantiateVnfmNodeTask getEtsiVnfMonitorNodeJobTask() { + return new MonitorInstantiateVnfmNodeTask(extractPojosForBB, exceptionUtil, mockedAaiVnfResources); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java new file mode 100644 index 0000000000..04831733e1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java @@ -0,0 +1,113 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS; +import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED; +import java.util.Optional; +import java.util.UUID; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.orchestration.AAIVnfResources; + +/** + * + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class MonitorTerminateVnfmNodeTaskTest extends BaseTaskTest { + + private static final String VNF_ID = UUID.randomUUID().toString(); + + private static final String VNF_NAME = "VNF_NAME"; + + private MonitorVnfmNodeTask objUnderTest; + + @Mock + private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider; + + @Mock + private AAIVnfResources mockedAaiVnfResources; + + private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution(); + + @Before + public void setUp() { + objUnderTest = getEtsiVnfMonitorNodeJobTask(); + } + + @Test + public void testGetNodeStatusDelete() throws Exception { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf(); + final GenericVnf aaiGenericVnf = getAAIGenericVnf(); + aaiGenericVnf.setOrchestrationStatus(VNF_ASSIGNED); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); + when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.of(aaiGenericVnf)); + + objUnderTest.getNodeStatus(stubbedxecution); + assertTrue(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS)); + } + + @Test + public void testGetNodeStatus_noGenericVnfFoundInAAI_throwException() throws Exception { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf(); + + when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); + when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.empty()); + objUnderTest.getNodeStatus(stubbedxecution); + verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220), + any(Exception.class)); + assertNull(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS)); + + } + + private GenericVnf getAAIGenericVnf() { + final GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(VNF_ID); + genericVnf.setVnfName(VNF_NAME); + return genericVnf; + } + + private org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf getGenericVnf() { + final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = + new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + genericVnf.setVnfId(VNF_ID); + return genericVnf; + + } + + private MonitorTerminateVnfmNodeTask getEtsiVnfMonitorNodeJobTask() { + return new MonitorTerminateVnfmNodeTask(extractPojosForBB, exceptionUtil, mockedAaiVnfResources); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java deleted file mode 100644 index 6b84f6a918..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; - -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED; -import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import java.util.UUID; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.so.bpmn.BaseTaskTest; -import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; - -/** - * - * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) - * - */ -public class MonitorVnfmNodeJobTest extends BaseTaskTest { - - private static final String VNF_ID = UUID.randomUUID().toString(); - - private static final String VNF_NAME = "VNF_NAME"; - - private MonitorVnfmNodeTask objUnderTest; - - @Mock - private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider; - - private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution(); - - @Before - public void setUp() { - objUnderTest = getEtsiVnfMonitorNodeJobTask(); - } - - @Test - public void testGetNodeStatusCreate() throws Exception { - GenericVnf vnf = getGenericVnf(); - vnf.setOrchestrationStatus(VNF_CREATED); - when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); - objUnderTest.getNodeStatus(stubbedxecution); - assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); - } - - @Test - public void testGetNodeStatusDelete() throws Exception { - GenericVnf vnf = getGenericVnf(); - vnf.setOrchestrationStatus(VNF_ASSIGNED); - when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf); - objUnderTest.getNodeStatus(stubbedxecution); - assertTrue(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS)); - } - - @Test - public void testGetNodeStatusException() throws Exception { - when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class); - objUnderTest.getNodeStatus(stubbedxecution); - assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS)); - assertNull(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS)); - verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220), - any(Exception.class)); - } - - @Test - public void testTimeOutLogFailue() throws Exception { - objUnderTest.timeOutLogFailue(stubbedxecution); - verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1221), - eq("Node operation time out")); - } - - private GenericVnf getGenericVnf() { - final GenericVnf genericVnf = new GenericVnf(); - genericVnf.setVnfId(VNF_ID); - genericVnf.setVnfName(VNF_NAME); - return genericVnf; - } - - private MonitorVnfmNodeTask getEtsiVnfMonitorNodeJobTask() { - return new MonitorVnfmNodeTask(extractPojosForBB, exceptionUtil); - } - -} -- cgit 1.2.3-korg From 6f0f3ab69de1013f6d3e5951223e014f2b3daa48 Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Mon, 3 Jun 2019 00:31:21 +0300 Subject: Added orchestration status to service Issue-ID: SO-1938 Signed-off-by: MariosIakovidis Change-Id: I78cc401a746ef4dbca41a869729b9791210038f4 --- .../scripts/CreateCustomE2EServiceInstance.groovy | 43 +++++++ .../scripts/CreateSDNCNetworkResource.groovy | 5 +- .../scripts/DoCreateResources.groovy | 5 + .../process/CreateCustomE2EServiceInstance.bpmn | 35 +++-- .../subprocess/DoCreateE2EServiceInstance.bpmn | 141 +++++++++++---------- 5 files changed, 147 insertions(+), 82 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index bd465eb9a8..a771741e18 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -23,6 +23,13 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.VnfResource +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.ErrorCode; import static org.apache.commons.lang3.StringUtils.* @@ -332,5 +339,41 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } logger.trace("finished prepareInitServiceOperationStatus") } + + public void updateAAIOrchStatus (DelegateExecution execution){ + logger.debug(" ***** start updateAAIOrchStatus ***** ") + String msg = "" + String serviceInstanceId = execution.getVariable("serviceInstanceId") + logger.debug("serviceInstanceId: "+serviceInstanceId) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + try { + ServiceInstance si = execution.getVariable("serviceInstanceData") + boolean allActive = true + for (VnfResource resource : serviceDecomposition.vnfResources) { + logger.debug("resource.modelInfo.getModelName: " + resource.modelInfo.getModelName() +" | resource.getOrchestrationStatus: "+resource.getOrchestrationStatus()) + if (resource.getOrchestrationStatus() != "Active") { + allActive = false + } + } + + if (allActive){ + si.setOrchestrationStatus("Active") + }else { + si.setOrchestrationStatus("Pending") + } + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + client.update(uri, si) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.updateAAIOrchStatus " + ex.getMessage() + logger.info( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(" ***** end updateAAIOrchStatus ***** ") + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index b0749ded86..b70797c63b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -243,12 +243,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String ontsn = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_serial_num") - String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan) + String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.CVLAN", cvlan) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.SVLAN", svlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.remote_id", remoteId) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ONTSN", ontsn) - logger.debug("old resource input:" + resourceInputObj.toString()) resourceInputObj.setResourceParameters(uResourceInput) execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 98def612de..b49f00a247 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -280,5 +280,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ public void postConfigRequest(DelegateExecution execution){ //now do noting + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + for (VnfResource resource : serviceDecomposition.vnfResources) { + resource.setOrchestrationStatus("Active") + } + execution.setVariable("serviceDecomposition", serviceDecomposition) } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn index 04ff48d4ed..c1b5ef82de 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0s2spoq @@ -44,6 +44,8 @@ ex.processJavaException(execution) + + SequenceFlow_19eilro SequenceFlow_0klbpxx @@ -74,7 +76,7 @@ csi.prepareCompletionRequest(execution) - SequenceFlow_0je30si + SequenceFlow_0kaz8ac SequenceFlow_0yayvrf @@ -140,7 +142,7 @@ csi.sendSyncResponse(execution) #{execution.getVariable("WorkflowException") == null} - + #{execution.getVariable("WorkflowException") != null} @@ -175,6 +177,14 @@ csi.prepareInitServiceOperationStatus(execution) SequenceFlow_081z8l2 + + + SequenceFlow_0je30si + SequenceFlow_0kaz8ac + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.updateAAIOrchStatus(execution) + @@ -192,9 +202,9 @@ csi.prepareInitServiceOperationStatus(execution) - + - + @@ -204,7 +214,7 @@ csi.prepareInitServiceOperationStatus(execution) - + @@ -246,8 +256,8 @@ csi.prepareInitServiceOperationStatus(execution) - - + + @@ -270,7 +280,7 @@ csi.prepareInitServiceOperationStatus(execution) - + @@ -386,6 +396,13 @@ csi.prepareInitServiceOperationStatus(execution) + + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index eccb9486dd..76dd6facd6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1qiiycn @@ -7,10 +7,10 @@ SequenceFlow_1qiiycn SequenceFlow_0w9t6tc - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() dcsi.preProcessRequest(execution) -]]> + @@ -36,28 +36,28 @@ dcsi.preProcessRequest(execution) SequenceFlow_0tgrn11 SequenceFlow_1lqktwf - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() dcsi.preProcessRollback(execution) -]]> + SequenceFlow_0eumzpf SequenceFlow_1xzgv5k - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() dcsi.postProcessRollback(execution) -]]> + SequenceFlow_012h7yx SequenceFlow_1tkgqu3 - import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateE2EServiceInstance() -ddsi.createServiceInstance(execution)]]> +ddsi.createServiceInstance(execution) SequenceFlow_0w9t6tc @@ -66,9 +66,9 @@ ddsi.createServiceInstance(execution)]]> SequenceFlow_0xjwb45 SequenceFlow_012h7yx - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.processDecomposition(execution)]]> +dcsi.processDecomposition(execution) @@ -85,9 +85,9 @@ dcsi.processDecomposition(execution)]]> SequenceFlow_166w91p SequenceFlow_0qxzgvq - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.prepareDecomposeService(execution)]]> +dcsi.prepareDecomposeService(execution) SequenceFlow_166w91p @@ -111,9 +111,9 @@ dcsi.prepareDecomposeService(execution)]]> SequenceFlow_1y9rkfr SequenceFlow_0n7nbx3 - import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateE2EServiceInstance() -ddsi.preInitResourcesOperStatus(execution)]]> +ddsi.preInitResourcesOperStatus(execution) @@ -154,6 +154,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> + SequenceFlow_0b1dsaj SequenceFlow_0sphcy5 @@ -161,16 +162,16 @@ ddsi.preInitResourcesOperStatus(execution)]]> SequenceFlow_022onug SequenceFlow_0b1dsaj - import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() -csi.preProcessForAddResource(execution)]]> +csi.preProcessForAddResource(execution) SequenceFlow_0sphcy5 SequenceFlow_18gnns6 - import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() -csi.postProcessForAddResource(execution)]]> +csi.postProcessForAddResource(execution) SequenceFlow_18gnns6 @@ -178,16 +179,16 @@ csi.postProcessForAddResource(execution)]]> SequenceFlow_0yuzaen SequenceFlow_1y9rkfr - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.doProcessSiteLocation(execution)]]> +dcsi.doProcessSiteLocation(execution) SequenceFlow_0ckto7v SequenceFlow_022onug - import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.doTPResourcesAllocation(execution)]]> +dcsi.doTPResourcesAllocation(execution) @@ -230,15 +231,15 @@ dcsi.doTPResourcesAllocation(execution)]]> - - + + - - + + @@ -250,8 +251,8 @@ dcsi.doTPResourcesAllocation(execution)]]> - - + + @@ -260,10 +261,10 @@ dcsi.doTPResourcesAllocation(execution)]]> - - - - + + + + @@ -290,29 +291,29 @@ dcsi.doTPResourcesAllocation(execution)]]> - - + + - - + + - - + + - - + + @@ -324,19 +325,19 @@ dcsi.doTPResourcesAllocation(execution)]]> - - - - + + + + - - - - + + + + @@ -348,10 +349,10 @@ dcsi.doTPResourcesAllocation(execution)]]> - - - - + + + + @@ -384,61 +385,61 @@ dcsi.doTPResourcesAllocation(execution)]]> - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - \ No newline at end of file + -- cgit 1.2.3-korg From 4ba62d110d700d3cfe18635af0a43201e1901632 Mon Sep 17 00:00:00 2001 From: seshukm Date: Mon, 3 Jun 2019 19:55:34 +0530 Subject: update INFO.yaml Issue-ID: SO-1929 Change-Id: I21b68e16851a23bc4869fa08df86d57f68de1c5a Signed-off-by: seshukm --- INFO.yaml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/INFO.yaml b/INFO.yaml index 77f51bc873..95b0c6a96a 100644 --- a/INFO.yaml +++ b/INFO.yaml @@ -50,11 +50,6 @@ committers: company: 'Cloudify' id: 'dfilppi' timezone: '' - - name: 'Max Benjamin' - email: 'max.benjamin@att.com' - company: 'ATT' - id: 'mfour' - timezone: '' - name: 'Yan Yang' email: 'yangyanyj@chinamobile.com' company: 'China Mobile' @@ -65,11 +60,6 @@ committers: company: 'Intel' id: 'mgkwill' timezone: 'America/Los Angeles' - - name: 'Sanchita Pathak' - email: 'sanchita@techmahindra.com' - company: 'Tech Mahindra' - id: 'sanchitap' - timezone: 'Asia/Kolkata' - name: 'Steve Smokowski' email: 'ss835w@att.com' company: 'ATT' @@ -85,6 +75,11 @@ committers: company: 'Nokia' id: 'lukaszM' timezone: 'Europe/Warsaw' + - name: 'Max Benjamin' + email: 'max.benjamin@att.com' + company: 'ATT' + id: 'mfour' + timezone: '' tsc: approval: 'https://lists.onap.org/pipermail/onap-tsc' changes: -- cgit 1.2.3-korg From d6d76e63c5eeaf1090efa4f28f5a8e3d6beb3781 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 3 Jun 2019 09:58:07 -0400 Subject: Fix ConfigAssignVnfBB and ConfigDeployVnfBB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If5a175ee26e279cf71e38c996a75fa627e5e2c00 Issue-ID: SO-1981 Signed-off-by: Alexis de Talhouët --- .../main/resources/db/migration/R__MacroData.sql | 5 ++++ .../BuildingBlock/ConfigAssignVnfBB.bpmn | 30 +++++++++++----------- .../flowspecific/tasks/ConfigAssignVnf.java | 10 +++++--- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 2183d3b6d3..3d19b3a471 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -806,3 +806,8 @@ VALUES ('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'); UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE = NULL; + +INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION) +VALUES +('ConfigAssignVnfBB', 'NO_VALIDATE', 'CUSTOM'), +('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM'); diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn index 9892fbdd91..11d77bf97a 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0gmfit3 @@ -23,7 +23,7 @@ SequenceFlow_1mkhog2 - + SequenceFlow_0gmfit3 SequenceFlow_05qembo @@ -34,7 +34,7 @@ - #{execution.getVariable("CDSStatus").equals("Success")} + SequenceFlow_15gxql1 @@ -49,15 +49,15 @@ - - + + - - + + @@ -66,8 +66,8 @@ - - + + @@ -76,12 +76,12 @@ - - + + - - + + @@ -90,8 +90,8 @@ - - + + diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java index 8a24330093..b2058b25a0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; +import java.util.List; import java.util.Map; import java.util.UUID; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -68,7 +69,8 @@ public class ConfigAssignVnf { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - Map userParams = execution.getGeneralBuildingBlock().getRequestContext().getUserParams(); + List> userParams = + execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams(); ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf(); configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId()); @@ -79,8 +81,10 @@ public class ConfigAssignVnf { configAssignPropertiesForVnf.setVnfId(vnf.getVnfId()); configAssignPropertiesForVnf.setVnfName(vnf.getVnfName()); - for (Map.Entry entry : userParams.entrySet()) { - configAssignPropertiesForVnf.setUserParam(entry.getKey(), entry.getValue()); + for (Map params : userParams) { + for (Map.Entry entry : params.entrySet()) { + configAssignPropertiesForVnf.setUserParam(entry.getKey(), entry.getValue()); + } } ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf(); -- cgit 1.2.3-korg From b802b088c9a46ba34ae1cdfe7c70ba8a8a51cbb5 Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat (vb8416)" Date: Mon, 3 Jun 2019 15:36:31 -0400 Subject: Add SO Turn off OpenStack heat stack audit UPDATE these files so/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml so/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml should have mso: infra: auditInventory: false Issue-ID: SO-1974 Signed-off-by: Bonkur, Venkat (vb8416) Change-Id: I57bb396604e9eb2787122199cdf8a2d1ce54048a --- bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml | 4 ++-- .../mso-api-handler-infra/src/main/resources/application.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml index a91cb9d88d..e364981a66 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -4,7 +4,7 @@ server: max-threads: 50 mso: infra: - auditInventory: true + auditInventory: false spring: datasource: driver-class-name: org.mariadb.jdbc.Driver @@ -36,4 +36,4 @@ management: export: prometheus: enabled: true # Whether exporting of metrics to Prometheus is enabled. - step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file + step: 1m # Step size (i.e. reporting frequency) to use. diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml index e709758223..03934edf20 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml @@ -7,7 +7,7 @@ server: mso: infra: - auditInventory: true + auditInventory: false default: versions: apiMinorVersion: 0 @@ -70,4 +70,4 @@ org: so: adapters: network: - encryptionKey: aa3871669d893c7fb8abbcda31b88b4f \ No newline at end of file + encryptionKey: aa3871669d893c7fb8abbcda31b88b4f -- cgit 1.2.3-korg From 1509e37517bfb61e2b98190528290987983db293 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Tue, 4 Jun 2019 13:33:44 -0700 Subject: Fix northbound_request_ref_lookup SERVICE_TYPE = '*' Make sure SERVICE_TYPE is not NULL so that GR_API alacarte requests work. Issue-ID: SO-1904 SO-1892 Change-Id: Ib4c617311b17f6d521a3eee0a71a6247d7770d54 Signed-off-by: Marcus G K Williams --- .../main/resources/db/migration/R__MacroData.sql | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 3d19b3a471..a4bdd96f5c 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -7,27 +7,27 @@ DELETE FROM building_block_detail; DELETE FROM orchestration_status_state_transition_directive; -INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE,IS_TOPLEVELFLOW, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER) VALUES -('Service-Create', 'createInstance', 'Service', true,true, '7','7', 'CloudOwner'), -('Service-Delete', 'deleteInstance', 'Service', true,true, '7','7', 'CloudOwner'), -('Service-Macro-Assign', 'assignInstance', 'Service', false,true, '7','7', 'CloudOwner'), -('Service-Macro-Activate', 'activateInstance', 'Service', false,true, '7','7', 'CloudOwner'), -('Service-Macro-Unassign', 'unassignInstance', 'Service', false,true, '7','7', 'CloudOwner'), -('Service-Macro-Create', 'createInstance', 'Service', false,true, '7','7', 'CloudOwner'), -('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'CloudOwner'), -('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'CloudOwner'), -('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'CloudOwner'), -('VNF-Macro-Recreate', 'recreateInstance', 'Vnf', false,true, '7','7', 'CloudOwner'), -('VNF-Macro-Replace', 'replaceInstance', 'Vnf', false,true, '7','7', 'CloudOwner'), -('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'CloudOwner'), -('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'CloudOwner'), -('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'CloudOwner'), -('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'CloudOwner'), -('VFModule-Create', 'createInstance', 'VfModule', true,true, '7','7', 'CloudOwner'), -('VFModule-Delete', 'deleteInstance', 'VfModule', true,true, '7','7', 'CloudOwner'), -('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner'), -('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner'), -('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'CloudOwner'); +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE,IS_TOPLEVELFLOW, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER, SERVICE_TYPE) VALUES +('Service-Create', 'createInstance', 'Service', true,true, '7','7', 'CloudOwner', '*'), +('Service-Delete', 'deleteInstance', 'Service', true,true, '7','7', 'CloudOwner', '*'), +('Service-Macro-Assign', 'assignInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'), +('Service-Macro-Activate', 'activateInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'), +('Service-Macro-Unassign', 'unassignInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'), +('Service-Macro-Create', 'createInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'), +('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'CloudOwner', '*'), +('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'CloudOwner', '*'), +('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'CloudOwner', '*'), +('VNF-Macro-Recreate', 'recreateInstance', 'Vnf', false,true, '7','7', 'CloudOwner', '*'), +('VNF-Macro-Replace', 'replaceInstance', 'Vnf', false,true, '7','7', 'CloudOwner', '*'), +('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'CloudOwner', '*'), +('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'CloudOwner', '*'), +('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'CloudOwner', '*'), +('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'CloudOwner', '*'), +('VFModule-Create', 'createInstance', 'VfModule', true,true, '7','7', 'CloudOwner', '*'), +('VFModule-Delete', 'deleteInstance', 'VfModule', true,true, '7','7', 'CloudOwner', '*'), +('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner', '*'), +('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'CloudOwner', '*'), +('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'CloudOwner', '*'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES @@ -619,15 +619,15 @@ VALUES ('NO_VALIDATE', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), ('NO_VALIDATE', 'PRECREATED', 'CUSTOM', 'CONTINUE'); -INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES -('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true, 'CloudOwner'); +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER, SERVICE_TYPE) VALUES +('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true, 'CloudOwner', '*'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES ('VFModule-DeactivateAndCloudDelete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'CloudOwner')), ('VFModule-DeactivateAndCloudDelete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'CloudOwner')); -INSERT INTO northbound_request_ref_lookup (REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) -values ( 'Service', 'Service-Macro-Deactivate', 'deactivateInstance', '0', '7', '7', '1', 'CloudOwner'); +INSERT INTO northbound_request_ref_lookup (REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER, SERVICE_TYPE) +values ( 'Service', 'Service-Macro-Deactivate', 'deactivateInstance', '0', '7', '7', '1', 'CloudOwner', '*'); INSERT INTO orchestration_flow_reference (COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) values ( 'Service-Macro-Deactivate', '1', 'DeactivateServiceInstanceBB', '1', (SELECT id FROM northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Deactivate' and CLOUD_OWNER = 'CloudOwner')); @@ -639,8 +639,8 @@ UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Deactivate'; -INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES -('Network-Update', 'updateInstance', 'Network', true, '7','7','1', 'CloudOwner'); +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER, SERVICE_TYPE) VALUES +('Network-Update', 'updateInstance', 'Network', true, '7','7','1', 'CloudOwner', '*'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES ('Network-Update', '1', 'UpdateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Update' and CLOUD_OWNER = 'CloudOwner')); @@ -805,7 +805,7 @@ VALUES ('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'), ('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'); -UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE = NULL; +UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE IS NULL; INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION) VALUES -- cgit 1.2.3-korg From b50847def6ec0a4912f06e7b57b3b316bd2f8e02 Mon Sep 17 00:00:00 2001 From: sunilb Date: Wed, 5 Jun 2019 05:00:15 +0530 Subject: Fix ConfigAssign/Deploy null return of BlueprintName/Version Fix ConfigAssign/Deploy null return of BlueprintName/Version Issue-ID: SO-1985 Signed-off-by: sunilb Change-Id: I15b6d38a21320eae6ca58a1e3d515813b9c243fd --- .../modelinfo/ModelInfoGenericVnf.java | 19 +++++++++++++++ .../ModelInfoGenericVnfExpected.json | 4 +++- .../VnfResourceCustomizationInput.json | 2 ++ .../flowspecific/tasks/ConfigAssignVnf.java | 5 ++-- .../flowspecific/tasks/ConfigDeployVnf.java | 6 +++-- .../workflow/tasks/WorkflowActionBBTasks.java | 5 ++-- .../workflow/tasks/WorkflowActionBBTasksTest.java | 28 ++++++++++++---------- 7 files changed, 49 insertions(+), 20 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java index 14327a3583..a558057979 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java @@ -55,7 +55,26 @@ public class ModelInfoGenericVnf extends ModelInfoMetadata implements Serializab private String MultiStageDesign; @JsonProperty("created") private String Created; + @JsonProperty("blueprintName") + private String blueprintName; + @JsonProperty("blueprintVersion") + private String blueprintVersion; + 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 String getToscaNodeType() { return ToscaNodeType; diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json index 98f966e753..9703b9c105 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json @@ -17,5 +17,7 @@ "model-version" : "modelVersion", "model-invariant-uuid" : "modelInvariantUUID", "model-name" : "modelName", - "model-uuid" : "modelUUID" + "model-uuid" : "modelUUID", + "blueprintName" : "testBlueprintName", + "blueprintVersion" : "testBlueprintVersion" } \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json index 26516ce907..95b116cec8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json @@ -9,6 +9,8 @@ "nfRole" : "nfRole", "nfNamingCode" : "nfNamingCode", "multiStageDesign" : "multiStageDesign", + "blueprintName" : "testBlueprintName", + "blueprintVersion" : "testBlueprintVersion", "vnfResources" : { "modelUUID" : "modelUUID", "modelInvariantUUID" : "modelInvariantUUID", diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java index b2058b25a0..bc71fc6f67 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java @@ -91,8 +91,9 @@ public class ConfigAssignVnf { configAssignRequestVnf.setResolutionKey(vnf.getVnfName()); configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf); - String blueprintName = vnf.getBlueprintName(); - String blueprintVersion = vnf.getBlueprintVersion(); + String blueprintName = vnf.getModelInfoGenericVnf().getBlueprintName(); + String blueprintVersion = vnf.getModelInfoGenericVnf().getBlueprintVersion(); + logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion); AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java index 359f19285f..6e7ca5f4e5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java @@ -92,8 +92,10 @@ public class ConfigDeployVnf { configDeployRequestVnf.setResolutionKey(vnf.getVnfName()); configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf); - String blueprintName = vnf.getBlueprintName(); - String blueprintVersion = vnf.getBlueprintVersion(); + String blueprintName = vnf.getModelInfoGenericVnf().getBlueprintName(); + String blueprintVersion = vnf.getModelInfoGenericVnf().getBlueprintVersion(); + logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion); + AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean(); abstractCDSPropertiesBean.setBlueprintName(blueprintName); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index f0a102dfeb..8ec283032f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -87,11 +87,10 @@ public class WorkflowActionBBTasks { if (ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigAssignVnfBB") || ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigDeployVnfBB")) { - String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId(); String vnfCustomizationUUID = ebb.getBuildingBlock().getKey(); - List vnfResourceCustomizations = - catalogDbClient.getVnfResourceCustomizationByModelUuid(serviceInstanceId); + List vnfResourceCustomizations = catalogDbClient + .getVnfResourceCustomizationByModelUuid(ebb.getRequestDetails().getModelInfo().getModelUuid()); if (vnfResourceCustomizations != null && vnfResourceCustomizations.size() >= 1) { VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java index a60927d694..1013cc8330 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -48,6 +48,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.RequestDetails; import org.springframework.core.env.Environment; public class WorkflowActionBBTasksTest extends BaseTaskTest { @@ -95,14 +97,16 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); String vnfCustomizationUUID = "1234567"; - String serviceInstanceId = "1234567"; + String modelUuid = "1234567"; BuildingBlock buildingBlock = new BuildingBlock(); buildingBlock.setBpmnFlowName("ConfigAssignVnfBB"); buildingBlock.setKey(vnfCustomizationUUID); ebb.setBuildingBlock(buildingBlock); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId(serviceInstanceId); - ebb.setWorkflowResourceIds(workflowResourceIds); + RequestDetails rd = new RequestDetails(); + ModelInfo mi = new ModelInfo(); + mi.setModelUuid(modelUuid); + rd.setModelInfo(mi); + ebb.setRequestDetails(rd); flowsToExecute.add(ebb); List vnfResourceCustomizations = new ArrayList(); @@ -112,8 +116,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { vnfResourceCustomizations.add(vrc); GenericVnf genericVnf = new GenericVnf(); genericVnf.setModelCustomizationId(vnfCustomizationUUID); - doReturn(vnfResourceCustomizations).when(catalogDbClient) - .getVnfResourceCustomizationByModelUuid(serviceInstanceId); + doReturn(vnfResourceCustomizations).when(catalogDbClient).getVnfResourceCustomizationByModelUuid(modelUuid); doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations); @@ -138,14 +141,16 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); String vnfCustomizationUUID = "1234567"; - String serviceInstanceId = "1234567"; + String modelUuid = "1234567"; BuildingBlock buildingBlock = new BuildingBlock(); buildingBlock.setBpmnFlowName("ConfigDeployVnfBB"); buildingBlock.setKey(vnfCustomizationUUID); ebb.setBuildingBlock(buildingBlock); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId(serviceInstanceId); - ebb.setWorkflowResourceIds(workflowResourceIds); + RequestDetails rd = new RequestDetails(); + ModelInfo mi = new ModelInfo(); + mi.setModelUuid(modelUuid); + rd.setModelInfo(mi); + ebb.setRequestDetails(rd); flowsToExecute.add(ebb); List vnfResourceCustomizations = new ArrayList(); @@ -155,8 +160,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { vnfResourceCustomizations.add(vrc); GenericVnf genericVnf = new GenericVnf(); genericVnf.setModelCustomizationId(vnfCustomizationUUID); - doReturn(vnfResourceCustomizations).when(catalogDbClient) - .getVnfResourceCustomizationByModelUuid(serviceInstanceId); + doReturn(vnfResourceCustomizations).when(catalogDbClient).getVnfResourceCustomizationByModelUuid(modelUuid); doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations); -- cgit 1.2.3-korg From ce75c2660be79e0ec72669b4dd5e62172d89c028 Mon Sep 17 00:00:00 2001 From: "Bonkur, Venkat (vb8416)" Date: Tue, 4 Jun 2019 22:46:14 -0400 Subject: Add SO exclude ConfigurationScaleOutBB Updated the WorkflowAction.isConfiguration() to exclude ConfigurationScaleOutBB problem- VF module check failure during scale out Issue-ID: SO-1982 Signed-off-by: Bonkur, Venkat (vb8416) Change-Id: I5caa6f1c5ff21131ea1c42a63b441a39f77a6e62 --- .../org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 2fc301f9d7..70726f2014 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -415,7 +415,7 @@ public class WorkflowAction { protected boolean isConfiguration(List orchFlows) { for (OrchestrationFlow flow : orchFlows) { - if (flow.getFlowName().contains("Configuration")) { + if (flow.getFlowName().contains("Configuration") && !flow.getFlowName().equals("ConfigurationScaleOutBB")) { return true; } } -- cgit 1.2.3-korg