summaryrefslogtreecommitdiffstats
path: root/appc-dg/appc-dg-shared
diff options
context:
space:
mode:
Diffstat (limited to 'appc-dg/appc-dg-shared')
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-dependency-model/pom.xml4
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/impl/Constants.java3
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperation.java23
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperationRequestFormatter.java3
4 files changed, 18 insertions, 15 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-dependency-model/pom.xml b/appc-dg/appc-dg-shared/appc-dg-dependency-model/pom.xml
index 52a3d5fcf..b4fa2d47d 100644
--- a/appc-dg/appc-dg-shared/appc-dg-dependency-model/pom.xml
+++ b/appc-dg/appc-dg-shared/appc-dg-dependency-model/pom.xml
@@ -14,6 +14,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <jackson-yaml-version>2.8.1</jackson-yaml-version>
+ <snakeyaml.version>1.15</snakeyaml.version>
</properties>
<dependencies>
@@ -51,7 +53,7 @@
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/impl/Constants.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/impl/Constants.java
index 711ec1d4e..949f6ffa3 100644
--- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/impl/Constants.java
+++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/impl/Constants.java
@@ -26,7 +26,7 @@ package org.openecomp.appc.mdsal.impl;
/**
* This class contains the definitions of all constant values used in the appc-dg-mdsal-store
* These properties are used for creating osgi bundle zip file. It also defines contents for Blueprint.xml file of bundle
-*/
+ */
public class Constants {
private Constants(){}
@@ -79,7 +79,6 @@ public class Constants {
* Base URL for config actions exposed by RESTCONF API
*/
- public static final String CONFIG_URL = "https://localhost:8443/restconf/config";
public static final String CONFIG_URL_DEFAULT = "https://localhost:8443/restconf/config";
public static final String CONFIG_URL_PROPERTY = "appc.LCM.provider.url";
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperation.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperation.java
index dbb82468c..5c5a1bb34 100644
--- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperation.java
+++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperation.java
@@ -67,7 +67,7 @@ import org.apache.commons.io.IOUtils;
/**
* Provides method to store configuration to MD-SAL store. It also exposes doPut operation which can be used to invoke REST Put operation.
-*/
+ */
public class ConfigOperation {
private static final EELFLogger LOG = EELFManager.getInstance().getLogger(ConfigOperation.class);
@@ -100,7 +100,7 @@ public class ConfigOperation {
int httpCode;
String respBody ;
try {
- String path = requestFormatter.buildPath(url, module, containerName, subModules);
+ String path = requestFormatter.buildPath(module, containerName, subModules);
LOG.debug("Configuration Path : " + path);
URL serviceUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(), path);
HttpResponse response = doPut(serviceUrl , configJson);
@@ -111,22 +111,25 @@ public class ConfigOperation {
throw new APPCException(e);
}
- if (httpCode != 200 ) {
+ if (httpCode < 200 || httpCode >= 300 ) {
try {
+ LOG.debug("Config operation Error response code: " + httpCode);
ArrayList<String> errorMessage = new ArrayList<>();
JsonNode responseJson = toJsonNodeFromJsonString(respBody);
if(responseJson!=null && responseJson.get("errors")!=null) {
JsonNode errors = responseJson.get("errors").get("error");
- for (Iterator<JsonNode> i = errors.elements();i.hasNext();){
- JsonNode error = i.next();
- errorMessage.add(error.get("error-message").textValue());
- }
+ for (Iterator<JsonNode> i = errors.elements();i.hasNext();){
+ JsonNode error = i.next();
+ errorMessage.add(error.get("error-message").textValue());
+ }
}
- throw new APPCException("Failed to load config JSON to MD SAL store. Error Message:" + errorMessage.toString());
+ throw new APPCException("Failed to load config JSON to MD SAL store. Error code:" + httpCode +" Error Message:" + errorMessage.toString());
} catch (Exception e) {
- LOG.error("Error while loading config JSON to MD SAL store. "+e.getMessage(), e);
- throw new APPCException("Error while loading config JSON to MD SAL store. "+ e.getMessage(),e);
+ LOG.error("Error while loading config JSON to MD SAL store. Error code:" + httpCode +" Error Message:" + e.getMessage(), e);
+ throw new APPCException("Error while loading config JSON to MD SAL store. Error code:" + httpCode +" Error Message:" + e.getMessage(),e);
}
+ }else{
+ LOG.debug("Config operation successful. Response code: " + httpCode);
}
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperationRequestFormatter.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperationRequestFormatter.java
index 94e120faf..26e7669e2 100644
--- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperationRequestFormatter.java
+++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/src/main/java/org/openecomp/appc/mdsal/operation/ConfigOperationRequestFormatter.java
@@ -34,13 +34,12 @@ import java.net.URL;
public class ConfigOperationRequestFormatter {
/**
* Build a request url path for config actions
- * @param url - base url
* @param module - yang module name
* @param containerName - yang container name
* @param subModules - sub module /container names as string in varargs ( String ) format
* @return - resultant path in String format
*/
- public String buildPath(URL url,String module, String containerName , String... subModules ) {
+ public String buildPath(String module, String containerName , String... subModules ) {
StringBuilder path = new StringBuilder( Constants.CONFIG_PATH + Constants.URL_BACKSLASH + module + ":"+containerName + Constants.URL_BACKSLASH);
if(subModules.length >0){