summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INFO.yaml2
-rw-r--r--pom.xml4
-rw-r--r--releases/1.0.0-container.yaml9
-rw-r--r--releases/1.0.0.yaml5
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java2
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java26
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java3
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClient.java2
-rw-r--r--src/main/resources/application.yml2
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy5
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy4
-rw-r--r--version.properties5
12 files changed, 45 insertions, 24 deletions
diff --git a/INFO.yaml b/INFO.yaml
index 6193ecf8..f7d59ca1 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -39,7 +39,7 @@ mailing_list:
realtime_discussion: ''
meetings:
- type: 'zoom'
- agenda: 'https://wiki.onap.org/pages/viewpage.action?pageId=84644224'
+ agenda: 'https://wiki.onap.org/pages/viewpage.action?pageId=111117075'
url: 'https://zoom.us/j/836561560?pwd=TTZNcFhXTWYxMmZ4SlgzcVZZQXluUT09'
server: 'n/a'
channel: 'n/a'
diff --git a/pom.xml b/pom.xml
index c63cc422..00457f44 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,13 +135,13 @@
</organization>
<groupId>org.onap.cps</groupId>
<artifactId>ncmp-dmi-plugin</artifactId>
- <version>0.0.1-SNAPSHOT</version>
+ <version>1.0.0-SNAPSHOT</version>
<name>ncmp-dmi-plugin</name>
<description>DMI Plugin Service</description>
<properties>
<app>org.onap.cps.ncmp.dmi.Application</app>
<base.image>${docker.pull.registry}/onap/integration-java11:8.0.0</base.image>
- <cps.version>1.1.0</cps.version>
+ <cps.version>2.0.0</cps.version>
<image.tag>${project.version}-${maven.build.timestamp}</image.tag>
<jacoco.minimum.coverage>0.7</jacoco.minimum.coverage>
<maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
diff --git a/releases/1.0.0-container.yaml b/releases/1.0.0-container.yaml
new file mode 100644
index 00000000..c9b7a9ab
--- /dev/null
+++ b/releases/1.0.0-container.yaml
@@ -0,0 +1,9 @@
+distribution_type: container
+container_release_tag: 1.0.0
+project: cps/ncmp-dmi-plugin
+log_dir: cps-ncmp-dmi-plugin-maven-docker-stage-master/114
+ref: 6efb16eaea03b188ccedad31f1174478faaadfbc
+tag_release: true
+containers:
+ - name: 'ncmp-dmi-plugin'
+ version: '1.0.0-20210914T120222Z' \ No newline at end of file
diff --git a/releases/1.0.0.yaml b/releases/1.0.0.yaml
new file mode 100644
index 00000000..49ce5ec8
--- /dev/null
+++ b/releases/1.0.0.yaml
@@ -0,0 +1,5 @@
+distribution_type: maven
+log_dir: cps-ncmp-dmi-plugin-maven-stage-master/114/
+project: cps/ncmp-dmi-plugin
+version: 1.0.0
+tag_release: false \ No newline at end of file
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
index 1d7abf24..4a18b067 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
@@ -58,7 +58,7 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
@Override
public ResponseEntity<ModuleSet> getModulesForCmHandle(final String cmHandle) {
final var moduleSet = dmiService.getModulesForCmHandle(cmHandle);
- return new ResponseEntity<ModuleSet>(moduleSet, HttpStatus.OK);
+ return new ResponseEntity<>(moduleSet, HttpStatus.OK);
}
@Override
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java
index 216190e3..2512ce2f 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java
@@ -62,6 +62,10 @@ public class DmiServiceImpl implements DmiService {
private DmiPluginProperties dmiPluginProperties;
private static final String CONTENT_QUERY_PASSTHROUGH_OPERATIONAL = "content=all";
private static final String CONTENT_QUERY_PASSTHROUGH_RUNNING = "content=config";
+ private static final String RESPONSE_CODE = "response code : ";
+ private static final String MESSAGE = " message : ";
+ private static final String IETF_NETCONF_MONITORING_OUTPUT = "ietf-netconf-monitoring:output";
+
/**
* Constructor.
@@ -91,7 +95,7 @@ public class DmiServiceImpl implements DmiService {
return createModuleSchema(responseBody);
} else {
throw new DmiException("SDNC is not able to process request.",
- "response code : " + responseEntity.getStatusCode() + " message : " + responseEntity.getBody());
+ RESPONSE_CODE + responseEntity.getStatusCode() + MESSAGE + responseEntity.getBody());
}
}
@@ -100,7 +104,7 @@ public class DmiServiceImpl implements DmiService {
final var getModuleResponses = new JSONArray();
for (final var moduleReference : moduleReferences) {
final var moduleRequest = createModuleRequest(moduleReference);
- final ResponseEntity responseEntity = sdncOperations.getModuleResource(cmHandle, moduleRequest);
+ final ResponseEntity<String> responseEntity = sdncOperations.getModuleResource(cmHandle, moduleRequest);
if (responseEntity.getStatusCode() == HttpStatus.OK) {
getModuleResponses.add(toJsonObject(moduleReference, responseEntity));
} else if (responseEntity.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -110,7 +114,7 @@ public class DmiServiceImpl implements DmiService {
} else {
log.error("Error occurred when getting module resources from SDNC for the given cmHandle {}", cmHandle);
throw new DmiException(cmHandle,
- "response code : " + responseEntity.getStatusCode() + " message : " + responseEntity.getBody());
+ RESPONSE_CODE + responseEntity.getStatusCode() + MESSAGE + responseEntity.getBody());
}
}
return getModuleResponses.toJSONString();
@@ -213,17 +217,17 @@ public class DmiServiceImpl implements DmiService {
jsonData = objectMapper.writeValueAsString(data);
} catch (final JsonProcessingException e) {
log.error("JSON exception occurred when processing pass through request data for the given cmHandle {}",
- cmHandle);
+ cmHandle);
throw new DmiException("Unable to process incoming JSON from the request body.",
- "JSON exception occurred when writing data for the given cmHandle " + cmHandle, e);
+ "JSON exception occurred when writing data for the given cmHandle " + cmHandle, e);
}
final ResponseEntity<String> responseEntity =
- sdncOperations.writeResourceDataPassthroughRunning(cmHandle, resourceIdentifier, dataType, jsonData);
+ sdncOperations.writeResourceDataPassthroughRunning(cmHandle, resourceIdentifier, dataType, jsonData);
if (responseEntity.getStatusCode() == HttpStatus.CREATED) {
return responseEntity.getBody();
} else {
throw new DmiException(cmHandle,
- "response code : " + responseEntity.getStatusCode() + " message : " + responseEntity.getBody());
+ RESPONSE_CODE + responseEntity.getStatusCode() + MESSAGE + responseEntity.getBody());
}
}
@@ -232,7 +236,7 @@ public class DmiServiceImpl implements DmiService {
return responseEntity.getBody();
} else {
throw new ResourceDataNotFound(cmHandle,
- "response code : " + responseEntity.getStatusCode() + " message : " + responseEntity.getBody());
+ RESPONSE_CODE + responseEntity.getStatusCode() + MESSAGE + responseEntity.getBody());
}
}
@@ -264,14 +268,14 @@ public class DmiServiceImpl implements DmiService {
private String extractYangSourceFromBody(final ResponseEntity<String> responseEntity) {
final var responseBodyAsJsonObject = new Gson().fromJson(responseEntity.getBody(), JsonObject.class);
- if (responseBodyAsJsonObject.getAsJsonObject("ietf-netconf-monitoring:output") == null
- || responseBodyAsJsonObject.getAsJsonObject("ietf-netconf-monitoring:output")
+ if (responseBodyAsJsonObject.getAsJsonObject(IETF_NETCONF_MONITORING_OUTPUT) == null
+ || responseBodyAsJsonObject.getAsJsonObject(IETF_NETCONF_MONITORING_OUTPUT)
.getAsJsonPrimitive("data") == null) {
log.error("Error occurred when trying to parse the response body from sdnc {}", responseEntity.getBody());
throw new ModuleResourceNotFoundException(responseEntity.getBody(),
"Error occurred when trying to parse the response body from sdnc.");
}
- return responseBodyAsJsonObject.getAsJsonObject("ietf-netconf-monitoring:output").getAsJsonPrimitive("data")
+ return responseBodyAsJsonObject.getAsJsonObject(IETF_NETCONF_MONITORING_OUTPUT).getAsJsonPrimitive("data")
.toString();
}
} \ No newline at end of file
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java b/src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java
index 47651346..94783f3b 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/service/client/NcmpRestClient.java
@@ -23,6 +23,7 @@ package org.onap.cps.ncmp.dmi.service.client;
import org.onap.cps.ncmp.dmi.config.DmiConfiguration.CpsProperties;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
@@ -51,7 +52,7 @@ public class NcmpRestClient {
httpHeaders.setBasicAuth(cpsProperties.getAuthUsername(), cpsProperties.getAuthPassword());
httpHeaders.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
final var httpEntity = new HttpEntity<>(jsonData, httpHeaders);
- return restTemplate.postForEntity(ncmpRegistrationUrl, httpEntity, String.class);
+ return restTemplate.exchange(ncmpRegistrationUrl, HttpMethod.POST, httpEntity, String.class);
}
private String buildNcmpRegistrationUrl() {
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClient.java b/src/main/java/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClient.java
index bbc39da5..b8e33dfc 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClient.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClient.java
@@ -79,6 +79,6 @@ public class SdncRestconfClient {
final var sdncRestconfUrl = sdncBaseUrl.concat(postResourceUrl);
httpHeaders.setBasicAuth(sdncProperties.getAuthUsername(), sdncProperties.getAuthPassword());
final var httpEntity = new HttpEntity<>(jsonData, httpHeaders);
- return restTemplate.postForEntity(sdncRestconfUrl, httpEntity, String.class);
+ return restTemplate.exchange(sdncRestconfUrl, HttpMethod.POST, httpEntity, String.class);
}
} \ No newline at end of file
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 10297e76..4383e794 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -54,7 +54,7 @@ management:
cps-core:
baseUrl: http://${CPS_CORE_HOST}:${CPS_CORE_PORT}
- dmiRegistrationUrl : /cps-ncmp/api/ncmp-dmi/v1/ch
+ dmiRegistrationUrl : /ncmp/v1/ch
auth:
username: ${CPS_CORE_USERNAME}
password: ${CPS_CORE_PASSWORD}
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy
index f5c059c7..32df97b6 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/NcmpRestClientSpec.groovy
@@ -21,6 +21,7 @@
package org.onap.cps.ncmp.dmi.service.client
import org.onap.cps.ncmp.dmi.config.DmiConfiguration
+import org.springframework.http.HttpMethod
import org.springframework.http.ResponseEntity
import org.springframework.web.client.RestTemplate
import spock.lang.Specification
@@ -48,8 +49,8 @@ class NcmpRestClientSpec extends Specification {
when: 'register cm-handle with ncmp is invoked'
def result = objectUnderTest.registerCmHandlesWithNcmp(jsonData)
then: 'the rest template is called with the correct uri and json in the body'
- 1 * mockRestTemplate.postForEntity({ it.toString() == 'http://some-uri/some-url' },
- { it.body.contains(jsonData) }, String.class) >> mockResponseEntity
+ 1 * mockRestTemplate.exchange({ it.toString() == 'http://some-uri/some-url' },
+ HttpMethod.POST, { it.body.contains(jsonData) }, String.class) >> mockResponseEntity
and: 'the output of the method is equal to the output from the test template'
result == mockResponseEntity
}
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
index b550480d..2184c7e7 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
@@ -61,8 +61,8 @@ class SdncRestconfClientSpec extends Specification {
when: 'get module resources is invoked'
def result = objectUnderTest.postOperationWithJsonData(getModuleResourceUrl, jsonData, new HttpHeaders())
then: 'the rest template is called with the correct uri and json in the body'
- 1 * mockRestTemplate.postForEntity({ it.toString() == 'http://some-uri/getModuleResourceUrl' },
- { it.body.contains(jsonData) }, String.class) >> mockResponseEntity
+ 1 * mockRestTemplate.exchange({ it.toString() == 'http://some-uri/getModuleResourceUrl' },
+ HttpMethod.POST, { it.body.contains(jsonData) }, String.class) >> mockResponseEntity
and: 'the output of the method is the same as the output from the test template'
result == mockResponseEntity
}
diff --git a/version.properties b/version.properties
index 27b958d6..b96ace0e 100644
--- a/version.properties
+++ b/version.properties
@@ -1,5 +1,6 @@
# ============LICENSE_START=======================================================
# Copyright (C) 2021 Nordix Foundation
+# Modifications Copyright (C) 2021 Bell Canada.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,9 +20,9 @@
# Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... )
# because they are used in Jenkins, whose plug-in doesn't support this
-major=0
+major=1
minor=0
-patch=1
+patch=0
base_version=${major}.${minor}.${patch}