From 99bf586a6eb9799c4f33e43976d741f2807ea287 Mon Sep 17 00:00:00 2001 From: MatthieuGeerebaert Date: Wed, 28 Mar 2018 13:36:26 +0200 Subject: Add serviceCatalog rest services - Add get and find serviceSpecification operations - Add API exceptions management - Consumes SDC apis - Add tests - Fix pom.xml conflict Change-Id: Id103d83dc8a981885100daabe868cdf18a922975 Issue-ID: EXTAPI-39 Signed-off-by: MatthieuGeerebaert --- .../resources/application-localhost.properties | 7 ++ src/main/resources/application.properties | 3 +- src/main/resources/jolt/findServiceCatalog.json | 28 ++++++++ src/main/resources/jolt/getServiceCatalog.json | 77 ++++++++++++++++++++++ 4 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/application-localhost.properties create mode 100644 src/main/resources/jolt/findServiceCatalog.json create mode 100644 src/main/resources/jolt/getServiceCatalog.json (limited to 'src/main/resources') diff --git a/src/main/resources/application-localhost.properties b/src/main/resources/application-localhost.properties new file mode 100644 index 0000000..58b13f6 --- /dev/null +++ b/src/main/resources/application-localhost.properties @@ -0,0 +1,7 @@ +# LOGGING +logging.level.org.onap.nbi=DEBUG + +# SDC +sdc.host=http://127.0.0.1:8090 +sdc.header.ecompInstanceId=Rene +sdc.header.authorization=Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU= diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 1d8ff27..10e0d7d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,4 +3,5 @@ server.contextPath=/nbi/api/v1 server.port = 8080 # LOGGING -logging.level.org.onap.nbi=WARN +logging.level.=WARN + diff --git a/src/main/resources/jolt/findServiceCatalog.json b/src/main/resources/jolt/findServiceCatalog.json new file mode 100644 index 0000000..ffe5fe3 --- /dev/null +++ b/src/main/resources/jolt/findServiceCatalog.json @@ -0,0 +1,28 @@ +[ + { + "operation": "shift", + "spec": { + "*": { + "uuid": "[&1].id", + "description": "[&1].description", + "name": "[&1].name", + "invariantUUID": "[&1].invariantUUID", + "category": "[&1].category", + "distributionStatus": "[&1].distributionStatus", + "version": "[&1].version", + "lifecycleState": "[&1].lifecycleStatus", + "lastUpdaterUserId": "[&1].relatedParty.id" + } + } + }, + { + "operation": "default", + "spec": { + "*": { + "relatedParty": { + "role": "lastUpdater" + } + } + } + } +] \ No newline at end of file diff --git a/src/main/resources/jolt/getServiceCatalog.json b/src/main/resources/jolt/getServiceCatalog.json new file mode 100644 index 0000000..cac223e --- /dev/null +++ b/src/main/resources/jolt/getServiceCatalog.json @@ -0,0 +1,77 @@ +[ + { + "operation": "shift", + "spec": { + "uuid": "id", + "name": "name", + "description": "description", + "invariantUUID": "invariantUUID", + "toscaModelURL": "toscaModelURL", + "toscaResourceName": "toscaResourceName", + "category ": "category", + "subcategory": "subcategory", + "distributionStatus": "distributionStatus", + "version": "version", + "lifecycleState":"lifecycleStatus" , + "artifacts" : { + "*": { + "artifactUUID": "attachment[&1].id", + "artifactName": "attachment[&1].name", + "artifactDescription": "attachment[&1].description", + "artifactLabel": "attachment[&1].artifactLabel", + "artifactGroupType": "attachment[&1].artifactGroupType", + "artifactTimeout": "attachment[&1].artifactTimeout", + "artifactChecksum": "attachment[&1].artifactChecksum", + "artifactVersion": "attachment[&1].artifactVersion", + "generatedFromUUID": "attachment[&1].generatedFromUUID", + "artifactURL": "attachment[&1].url", + "artifactType": "attachment[&1].mimeType" + } + + }, + "lastUpdaterUserId" : "relatedParty.id", + "lastUpdaterFullName" : "relatedParty.name", + "resources" : { + "*": { + "resourceUUID": "resourceSpecification[&1].id", + "resourceVersion": "resourceSpecification[&1].version", + "resourceName": "resourceSpecification[&1].name", + "resourceInstanceName": "resourceSpecification[&1].instanceName", + "resourceInvariantUUID": "resourceSpecification[&1].resourceInvariantUUID", + "resourceType": "resourceSpecification[&1].resourceType" + } + + } + + + + } + }, + { + "operation": "modify-overwrite-beta", + "spec": { + "href": "=concat('serviceSpecification/',@(1,id))" + } + }, + { + "operation": "default", + "spec": { + "@type": "ONAPservice", + "attachment[]" : { + "*": { + "@type": "ONAPartifact" + } + + }, + "relatedParty" : { + "role": "lastUpdater" + }, + "resourceSpecification[]" : { + "*": { + "@type": "ONAPresource" + } + + } + } + } +] \ No newline at end of file -- cgit 1.2.3-korg