aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java17
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java62
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java17
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java45
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java47
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java53
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java965
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java28
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java66
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml19
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoLogger.java34
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java261
-rw-r--r--common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java135
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml70
19 files changed, 1005 insertions, 891 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
index 6b0d901cb4..63ef8e6dd0 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
@@ -24,13 +24,12 @@ package org.onap.so.adapters.catalogdb.catalogrest;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
-import org.onap.so.logger.MsoLogger;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class CatalogQuery {
- protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogQuery.class);
+ protected static Logger logger = LoggerFactory.getLogger(CatalogQuery.class);
private static final boolean IS_EMBED = true;
public abstract String JSON2(boolean isArray, boolean isEmbed);
@@ -48,21 +47,20 @@ public abstract class CatalogQuery {
}
protected String setTemplate(String template, Map<String, String> valueMap) {
- LOGGER.debug("CatalogQuery setTemplate");
StringBuffer result = new StringBuffer();
String pattern = "<.*>";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(template);
- LOGGER.debug("CatalogQuery template:" + template);
+ logger.debug("CatalogQuery template: {}", template);
while (m.find()) {
String key = template.substring(m.start() + 1, m.end() - 1);
- LOGGER.debug("CatalogQuery key:" + key + " contains key? " + valueMap.containsKey(key));
+ logger.debug("CatalogQuery key: {} contains key? {}", key , valueMap.containsKey(key));
m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""));
}
m.appendTail(result);
- LOGGER.debug("CatalogQuery return:" + result.toString());
+ logger.debug("CatalogQuery return: {}", result.toString());
return result.toString();
}
@@ -76,8 +74,7 @@ public abstract class CatalogQuery {
jsonString = mapper.writeValueAsString(this);
}
catch (Exception e) {
- LOGGER.debug("Exception:", e);
- LOGGER.debug ("jsonString exception:"+e.getMessage());
+ logger.error("Error converting to JSON" , e);
jsonString = "invalid"; //throws instead?
}
return jsonString;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
index 67f337e039..fbaf12b337 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
@@ -27,13 +27,14 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.onap.so.logger.MsoLogger;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
public abstract class CatalogQueryExceptionCommon {
private String messageId;
- protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogQueryExceptionCommon.class);
+ protected static Logger logger = LoggerFactory.getLogger(CatalogQueryExceptionCommon.class);
public CatalogQueryExceptionCommon() { messageId = null; }
public CatalogQueryExceptionCommon(String messageId) { this.messageId = messageId; }
@@ -49,7 +50,7 @@ public abstract class CatalogQueryExceptionCommon {
jsonString = mapper.writeValueAsString(this);
return jsonString;
} catch (Exception e) {
- LOGGER.debug ("Exception:", e);
+ logger.error ("Exception:", e);
return "";
}
}
@@ -63,7 +64,7 @@ public abstract class CatalogQueryExceptionCommon {
marshaller.marshal(this, bs);
return bs.toString();
} catch (Exception e) {
- LOGGER.debug ("Exception:", e);
+ logger.error ("Exception:", e);
return "";
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index 2deada5754..3dca6a395c 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -24,19 +24,17 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.xml.bind.annotation.XmlRootElement;
-
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@XmlRootElement(name = "serviceAllottedResources")
public class QueryAllottedResourceCustomization extends CatalogQuery {
- protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,QueryAllottedResourceCustomization.class);
+ protected static Logger logger = LoggerFactory.getLogger(QueryAllottedResourceCustomization.class);
private List<AllottedResourceCustomization> allottedResourceCustomization;
- private final String template =
+ private static final String TEMPLATE =
"\t{\n"+
-// "\t{ \"allottedResource\" : {\n"+
"\t\t\"modelInfo\" : {\n"+
"\t\t\t\"modelName\" : <MODEL_NAME>,\n"+
"\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+
@@ -55,14 +53,24 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
"\t\t\"nfType\" : <NF_TYPE>,\n"+
"\t\t\"nfRole\" : <NF_ROLE>,\n"+
"\t\t\"nfNamingCode\" : <NF_NAMING_CODE>\n"+
- "\t}";
-// "\t}}";
+ "\t}";
- public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<>(); }
- public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) { allottedResourceCustomization = vlist; }
+ public QueryAllottedResourceCustomization() {
+ super();
+ allottedResourceCustomization = new ArrayList<>();
+ }
+
+ public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) {
+ allottedResourceCustomization = vlist;
+ }
- public List<AllottedResourceCustomization> getServiceAllottedResources(){ return this.allottedResourceCustomization; }
- public void setServiceAllottedResources(List<AllottedResourceCustomization> v) { this.allottedResourceCustomization = v; }
+ public List<AllottedResourceCustomization> getServiceAllottedResources(){
+ return this.allottedResourceCustomization;
+ }
+
+ public void setServiceAllottedResources(List<AllottedResourceCustomization> v) {
+ this.allottedResourceCustomization = v;
+ }
@Override
public String toString () {
@@ -72,7 +80,10 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
int i = 1;
for (AllottedResourceCustomization o : allottedResourceCustomization) {
sb.append(i).append("\t");
- if (!first) sb.append("\n"); first = false;
+ if (!first)
+ sb.append("\n");
+
+ first = false;
sb.append(o);
}
return sb.toString();
@@ -81,15 +92,20 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
StringBuilder sb = new StringBuilder();
- if (!isEmbed && isArray) sb.append("{ ");
- if (isArray) sb.append("\"serviceAllottedResources\": [");
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"serviceAllottedResources\": [");
Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
if (this.allottedResourceCustomization != null) {
for (AllottedResourceCustomization o : allottedResourceCustomization) {
- if (first) sb.append("\n"); first = false;
+ if (first)
+ sb.append("\n");
+
+ first = false;
boolean arNull = o.getAllottedResource() == null ? true : false;
@@ -110,13 +126,19 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
put(valueMap, "PROVIDING_SERVICE_MODEL_UUID", o.getProvidingServiceModelUUID());
put(valueMap, "PROVIDING_SERVICE_MODEL_NAME", o.getProvidingServiceModelName());
- sb.append(sep).append(this.setTemplate(template, valueMap));
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
}
}
- if (!first) sb.append("\n");
- if (isArray) sb.append("]");
- if (!isEmbed && isArray) sb.append("}");
+ if (!first)
+ sb.append("\n");
+
+ if (isArray)
+ sb.append("]");
+
+ if (!isEmbed && isArray)
+ sb.append("}");
+
return sb.toString();
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
index e0d187500e..8670b78e15 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
@@ -23,7 +23,8 @@ import java.util.HashMap;
import java.util.Map;
import org.onap.so.db.catalog.beans.Recipe;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -38,6 +39,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
* @version ONAP Beijing Release 2018-02-28
*/
public class QueryResourceRecipe extends CatalogQuery{
+ protected static Logger logger = LoggerFactory.getLogger(QueryResourceRecipe.class);
private Recipe resourceRecipe;
@@ -66,8 +68,7 @@ public class QueryResourceRecipe extends CatalogQuery{
try {
jsonStr = mapper.writeValueAsString(valueMap);
} catch(JsonProcessingException e) {
-
- e.printStackTrace();
+ logger.error("Error creating JSON", e);
}
return jsonStr;
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java
index d49f8965fb..c7ae137759 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java
@@ -35,13 +35,7 @@ import org.onap.so.db.catalog.beans.ToscaCsar;
*/
public class QueryServiceCsar extends CatalogQuery{
- private ToscaCsar toscaCsar;
-
- public QueryServiceCsar(ToscaCsar toscaCsar){
- this.toscaCsar = toscaCsar;
- }
-
- private final String template =
+ private static final String TEMPLATE =
"\t{\n"+
"\t\t\"artifactUUID\" : <ARTIFACT_UUID>,\n"+
"\t\t\"name\" : <NAME>,\n"+
@@ -51,9 +45,14 @@ public class QueryServiceCsar extends CatalogQuery{
"\t\t\"description\" : <DESCRIPTION>\n"+
"\t}";
+ private ToscaCsar toscaCsar;
+
+ public QueryServiceCsar(ToscaCsar toscaCsar){
+ this.toscaCsar = toscaCsar;
+ }
+
@Override
public String toString() {
-
return toscaCsar.toString();
}
@@ -66,7 +65,7 @@ public class QueryServiceCsar extends CatalogQuery{
put(valueMap, "ARTIFACT_CHECK_SUM", null == toscaCsar ? null : toscaCsar.getArtifactChecksum());
put(valueMap, "URL", null == toscaCsar ? null : toscaCsar.getUrl());
put(valueMap, "DESCRIPTION", null == toscaCsar ? null : toscaCsar.getDescription());
- return this.setTemplate(template, valueMap);
+ return this.setTemplate(TEMPLATE, valueMap);
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index 12ba4c0598..b89c6275d4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -32,7 +32,7 @@ import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
public class QueryServiceMacroHolder extends CatalogQuery {
private ServiceMacroHolder serviceMacroHolder;
private static final String LINE_BEGINNING = "(?m)^";
- private static final String template =
+ private static final String TEMPLATE =
"{ \"serviceResources\" : {\n"+
"\t\"modelInfo\" : {\n"+
"\t\t\"modelName\" : <SERVICE_MODEL_NAME>,\n"+
@@ -90,7 +90,7 @@ public class QueryServiceMacroHolder extends CatalogQuery {
subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true);
valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t"));
- buf.append(this.setTemplate(template, valueMap));
+ buf.append(this.setTemplate(TEMPLATE, valueMap));
return buf.toString();
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index b213d33af0..4afc24ea10 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -29,14 +29,15 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@XmlRootElement(name = "serviceNetworks")
public class QueryServiceNetworks extends CatalogQuery {
- protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,QueryServiceNetworks.class);
+ protected static Logger logger = LoggerFactory.getLogger(QueryServiceNetworks.class);
private List<NetworkResourceCustomization> serviceNetworks;
- private final String template =
+ private static final String TEMPLATE =
"\t{\n"+
-// "\t{ \"networkResource\" : {\n"+
"\t\t\"modelInfo\" : {\n"+
"\t\t\t\"modelName\" : <MODEL_NAME>,\n"+
"\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+
@@ -51,16 +52,19 @@ public class QueryServiceNetworks extends CatalogQuery {
"\t\t\"networkRole\" : <NETWORK_ROLE>,\n"+
"\t\t\"networkScope\" : <NETWORK_SCOPE>\n"+
"\t}";
-// "\t}}";
- public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<>(); }
+ public QueryServiceNetworks() {
+ super();
+ serviceNetworks = new ArrayList<>();
+ }
+
public QueryServiceNetworks(List<NetworkResourceCustomization> vlist) {
- LOGGER.debug ("QueryServiceNetworks:");
+ logger.debug ("QueryServiceNetworks:");
serviceNetworks = new ArrayList<>();
for (NetworkResourceCustomization o : vlist) {
- LOGGER.debug (o.toString());
+ if(logger.isDebugEnabled())
+ logger.debug (o.toString());
serviceNetworks.add(o);
- LOGGER.debug ("-------------------");
}
}
@@ -75,7 +79,9 @@ public class QueryServiceNetworks extends CatalogQuery {
int i = 1;
for (NetworkResourceCustomization o : serviceNetworks) {
sb.append(i).append("\t");
- if (!first) sb.append("\n"); first = false;
+ if (!first)
+ sb.append("\n");
+ first = false;
sb.append(o);
}
return sb.toString();
@@ -84,15 +90,19 @@ public class QueryServiceNetworks extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
StringBuilder sb = new StringBuilder();
- if (!isEmbed && isArray) sb.append("{ ");
- if (isArray) sb.append("\"serviceNetworks\": [");
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"serviceNetworks\": [");
Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
for (NetworkResourceCustomization o : serviceNetworks) {
- if (first) sb.append("\n"); first = false;
+ if (first)
+ sb.append("\n");
+ first = false;
boolean nrNull = o.getNetworkResource() == null ? true : false;
put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName());
put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID());
@@ -106,12 +116,15 @@ public class QueryServiceNetworks extends CatalogQuery {
put(valueMap, "NETWORK_SCOPE", o.getNetworkScope());
put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology());
- sb.append(sep).append(this.setTemplate(template, valueMap));
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
}
- if (!first) sb.append("\n");
- if (isArray) sb.append("]");
- if (!isEmbed && isArray) sb.append("}");
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
return sb.toString();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index ff52daf880..82b6aa2aeb 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -29,11 +29,15 @@ import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@XmlRootElement(name = "serviceVnfs")
public class QueryServiceVnfs extends CatalogQuery {
+ protected static Logger logger = LoggerFactory.getLogger(QueryServiceVnfs.class);
+
private List<VnfResourceCustomization> serviceVnfs;
- private final String template =
+ private static final String TEMPLATE =
"\n"+
"\t{ \"modelInfo\" : {\n"+
"\t\t\"modelName\" : <MODEL_NAME>,\n"+
@@ -52,15 +56,17 @@ public class QueryServiceVnfs extends CatalogQuery {
"<_VFMODULES_>\n" +
"\t}";
- public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<>(); }
- public QueryServiceVnfs(List<VnfResourceCustomization> vlist) {
- LOGGER.debug ("QueryServiceVnfs:");
+ public QueryServiceVnfs() {
+ super();
+ serviceVnfs = new ArrayList<>();
+ }
+
+ public QueryServiceVnfs(List<VnfResourceCustomization> vlist) {
serviceVnfs = new ArrayList<>();
for (VnfResourceCustomization o : vlist) {
- LOGGER.debug ("-- o is a serviceVnfs ----");
- LOGGER.debug (o.toString());
- serviceVnfs.add(o);
- LOGGER.debug ("-------------------");
+ if(logger.isDebugEnabled())
+ logger.debug (o.toString());
+ serviceVnfs.add(o);
}
}
@@ -75,7 +81,9 @@ public class QueryServiceVnfs extends CatalogQuery {
int i = 1;
for (VnfResourceCustomization o : serviceVnfs) {
sb.append(i).append("\t");
- if (!first) sb.append("\n"); first = false;
+ if (!first)
+ sb.append("\n");
+ first = false;
sb.append(o);
}
return sb.toString();
@@ -84,14 +92,18 @@ public class QueryServiceVnfs extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
StringBuilder sb = new StringBuilder();
- if (!isEmbed && isArray) sb.append("{ ");
- if (isArray) sb.append("\"serviceVnfs\": [");
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"serviceVnfs\": [");
Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
for (VnfResourceCustomization o : serviceVnfs) {
- if (first) sb.append("\n"); first = false;
+ if (first)
+ sb.append("\n");
+ first = false;
boolean vrNull = o.getVnfResources() == null ? true : false;
@@ -111,12 +123,15 @@ public class QueryServiceVnfs extends CatalogQuery {
String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
- sb.append(sep).append(this.setTemplate(template, valueMap));
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
}
- if (!first) sb.append("\n");
- if (isArray) sb.append("]");
- if (!isEmbed && isArray) sb.append("}");
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
return sb.toString();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
index e5fa14376b..3680c59dca 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
@@ -33,9 +33,8 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization;
@XmlRootElement(name = "vfModules")
public class QueryVfModule extends CatalogQuery {
private List<VfModuleCustomization> vfModules;
- private final String template =
+ private static final String TEMPLATE =
"\t{\n"+
-// "\t{ \"vfModule\" : { \n"+
"\t\t\"modelInfo\" : { \n"+
"\t\t\t\"modelName\" : <MODEL_NAME>,\n"+
"\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+
@@ -48,20 +47,21 @@ public class QueryVfModule extends CatalogQuery {
"\t\t\"initialCount\" : <INITIAL_COUNT>,\n"+
"\t\t\"hasVolumeGroup\" : <HAS_VOLUME_GROUP>\n"+
"\t}";
-// "\t}}";
- public QueryVfModule() { super(); vfModules = new ArrayList<>(); }
- public QueryVfModule(List<VfModuleCustomization> vlist) {
- LOGGER.debug ("QueryVfModule:");
- vfModules = new ArrayList<>();
- if (vlist != null) {
- for (VfModuleCustomization o : vlist) {
- LOGGER.debug ("-- o is a vfModules ----");
- LOGGER.debug (o.toString());
- vfModules.add(o);
- LOGGER.debug ("-------------------");
- }
+ public QueryVfModule() {
+ super();
+ vfModules = new ArrayList<>();
}
+
+ public QueryVfModule(List<VfModuleCustomization> vlist) {
+ vfModules = new ArrayList<>();
+ if (vlist != null) {
+ for (VfModuleCustomization o : vlist) {
+ if(logger.isDebugEnabled())
+ logger.debug (o.toString());
+ vfModules.add(o);
+ }
+ }
}
public List<VfModuleCustomization> getVfModule(){ return this.vfModules; }
@@ -75,7 +75,9 @@ public class QueryVfModule extends CatalogQuery {
int i = 1;
for (VfModuleCustomization o : vfModules) {
sb.append(i).append("\t");
- if (!first) sb.append("\n"); first = false;
+ if (!first)
+ sb.append("\n");
+ first = false;
sb.append(o);
}
return sb.toString();
@@ -84,14 +86,18 @@ public class QueryVfModule extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
StringBuilder sb = new StringBuilder();
- if (!isEmbed && isArray) sb.append("{ ");
- if (isArray) sb.append("\"vfModules\": [");
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"vfModules\": [");
Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
for (VfModuleCustomization o : vfModules) {
- if (first) sb.append("\n"); first = false;
+ if (first)
+ sb.append("\n");
+ first = false;
boolean vfNull = o.getVfModule() == null ? true : false;
boolean hasVolumeGroup = false;
@@ -110,12 +116,15 @@ public class QueryVfModule extends CatalogQuery {
put(valueMap, "INITIAL_COUNT", o.getInitialCount());
put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup));
- sb.append(sep).append(this.setTemplate(template, valueMap));
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
}
- if (!first) sb.append("\n");
- if (isArray) sb.append("]");
- if (!isEmbed && isArray) sb.append("}");
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
return sb.toString();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index 0eeaa6a72c..a69e66cc69 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -49,7 +49,7 @@ We might be able to derive it's value from the current vnf-type (using the "midd
min and initial counts can be 0. max can be null to indicate no maximum.
Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table.
-*/
+ */
import java.util.ArrayList;
import java.util.List;
@@ -101,6 +101,8 @@ import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -113,488 +115,481 @@ import org.springframework.transaction.annotation.Transactional;
@Path("/{version: v[0-9]+}")
@Component
public class CatalogDbAdapterRest {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogDbAdapterRest.class);
- private static final boolean IS_ARRAY = true;
-
- @Autowired
- private VnfCustomizationRepository vnfCustomizationRepo;
-
- @Autowired
- private ServiceRepository serviceRepo;
-
- @Autowired
- private NetworkResourceCustomizationRepository networkCustomizationRepo;
-
- @Autowired
- private NetworkResourceRepository networkResourceRepo;
-
- @Autowired
- private AllottedResourceCustomizationRepository allottedCustomizationRepo;
-
- @Autowired
- private ToscaCsarRepository toscaCsarRepo;
-
- @Autowired
- private VFModuleRepository vfModuleRepo;
-
- @Autowired
- private VnfRecipeRepository vnfRecipeRepo;
-
- @Autowired
- private NetworkRecipeRepository networkRecipeRepo;
-
- @Autowired
- private ArRecipeRepository arRecipeRepo;
-
- @Autowired
- private VnfResourceRepository vnfResourceRepo;
-
- @Autowired
- private AllottedResourceRepository arResourceRepo;
-
- private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
-
- public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
- return Response
- .status(respStatus)
- //.entity(new GenericEntity<QueryServiceVnfs>(qryResp) {})
- .entity(qryResp.toJsonString(version, isArray))
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
- }
-
- @GET
- @Path("vnfResources/{vnfModelCustomizationUuid}")
- @Transactional( readOnly = true)
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response serviceVnfs (
- @PathParam("version") String version,
- @PathParam("vnfModelCustomizationUuid") String vnfUuid
- ) {
- return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null);
- }
-
- @GET
- @Path("serviceVnfs")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceVnfs(
- @PathParam("version") String version,
- @QueryParam("vnfModelCustomizationUuid") String vnfUuid,
- @QueryParam("serviceModelUuid") String smUuid,
- @QueryParam("serviceModelInvariantUuid") String smiUuid,
- @QueryParam("serviceModelVersion") String smVer,
- @QueryParam("serviceModelName") String smName
- ) {
- return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName);
- }
-
- public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID, String smiUuid, String smVer, String smName) {
- QueryServiceVnfs qryResp = null;
- int respStatus = HttpStatus.SC_OK;
- List<VnfResourceCustomization> ret = new ArrayList<>();
- Service service = null;
- try {
- if (vnfUuid != null && !"".equals(vnfUuid))
- ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid);
- else if (serviceModelUUID != null && !"".equals(serviceModelUUID))
- service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID);
- else if (smiUuid != null && !"".equals(smiUuid))
- if (smVer != null && !"".equals(smVer))
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer,smiUuid);
- else
- service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid);
- else if (smName != null && !"".equals(smName)) {
- if (smVer != null && !"".equals(smVer))
- service = serviceRepo.findByModelNameAndModelVersion(smName, smVer);
- else
- service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName);
- }
- else {
- throw(new Exception(NO_MATCHING_PARAMETERS));
- }
-
- if (service == null && ret.isEmpty()) {
- respStatus = HttpStatus.SC_NOT_FOUND;
- qryResp = new QueryServiceVnfs();
- }else if( service == null && !ret.isEmpty()){
- qryResp = new QueryServiceVnfs(ret);
- } else if (service != null) {
- qryResp = new QueryServiceVnfs(service.getVnfCustomizations());
- }
- LOGGER.debug ("serviceVnfs qryResp="+ qryResp);
- return respond(version, respStatus, isArray, qryResp);
- } catch (Exception e) {
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, "", "", "queryServiceVnfs", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceVnfs", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
- }
- }
-
- @GET
- @Path("networkResources/{networkModelCustomizationUuid}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceNetworks (
- @PathParam("version") String version,
- @PathParam("networkModelCustomizationUuid") String nUuid
- ) {
- return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null);
- }
-
- @GET
- @Path("serviceNetworks")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceNetworks (
- @PathParam("version") String version,
- @QueryParam("networkModelCustomizationUuid") String networkModelCustomizationUuid,
- @QueryParam("networkType") String networkType,
- @QueryParam("networkModelName") String networkModelName,
- @QueryParam("serviceModelUuid") String serviceModelUuid,
- @QueryParam("serviceModelInvariantUuid") String serviceModelInvariantUuid,
- @QueryParam("serviceModelVersion") String serviceModelVersion,
- @QueryParam("networkModelVersion") String networkModelVersion
- ) {
- if (networkModelName != null && !"".equals(networkModelName)) {
- networkType = networkModelName;
- }
- return serviceNetworksImpl (version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid, serviceModelInvariantUuid, serviceModelVersion);
- }
-
- public Response serviceNetworksImpl (String version, boolean isArray, String networkModelCustomizationUuid, String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) {
- QueryServiceNetworks qryResp;
- int respStatus = HttpStatus.SC_OK;
- String uuid = "";
- List<NetworkResourceCustomization> ret = new ArrayList<>();
- Service service = null;
-
- try{
- if (networkModelCustomizationUuid != null && !"".equals(networkModelCustomizationUuid)) {
- uuid = networkModelCustomizationUuid;
- ret = networkCustomizationRepo.findByModelCustomizationUUID(networkModelCustomizationUuid);
- }else if (networkType != null && !"".equals(networkType)) {
- uuid = networkType;
- NetworkResource networkResources = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
- if(networkResources != null)
- ret=networkResources.getNetworkResourceCustomization();
- }
- else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
- uuid = serviceModelInvariantUuid;
- if (serviceModelVersion != null && !"".equals(serviceModelVersion)) {
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
- }
- else {
- service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
- }
- }else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) {
- uuid = serviceModelUuid;
- service = serviceRepo.findOneByModelUUID(serviceModelUuid);
- }
- else {
- throw(new Exception(NO_MATCHING_PARAMETERS));
- }
-
- if(service != null)
- ret = service.getNetworkCustomizations();
-
- if (ret == null || ret.isEmpty()) {
- LOGGER.debug ("serviceNetworks not found");
- respStatus = HttpStatus.SC_NOT_FOUND;
- qryResp = new QueryServiceNetworks();
- } else {
- LOGGER.debug ("serviceNetworks found");
- qryResp = new QueryServiceNetworks(ret);
- LOGGER.debug ("serviceNetworks qryResp="+ qryResp);
- }
- LOGGER.debug ("Query serviceNetworks exit");
- return respond(version, respStatus, isArray, qryResp);
- } catch (Exception e) {
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceNetworks", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceNetworks", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
- }
- }
-
- @GET
- @Path("serviceResources")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional(readOnly = true)
- public Response serviceResources(
- @PathParam("version") String version,
- @QueryParam("serviceModelUuid") String modelUUID,
- @QueryParam("serviceModelInvariantUuid") String modelInvariantUUID,
- @QueryParam("serviceModelVersion") String modelVersion) {
- QueryServiceMacroHolder qryResp;
- int respStatus = HttpStatus.SC_OK;
- String uuid = "";
- ServiceMacroHolder ret = new ServiceMacroHolder();
-
- try{
- if (modelUUID != null && !"".equals(modelUUID)) {
- uuid = modelUUID;
- LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: " + uuid);
- Service serv =serviceRepo.findOneByModelUUID(uuid);
- ret.setService(serv);
- }
- else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) {
- uuid = modelInvariantUUID;
- if (modelVersion != null && !"".equals(modelVersion)) {
- LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ modelVersion);
- Service serv = serviceRepo.findByModelVersionAndModelInvariantUUID(modelVersion, uuid);
- ret.setService(serv);
- }
- else {
- LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid);
- Service serv = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
- ret.setService(serv);
- }
- }
- else {
- throw(new Exception(NO_MATCHING_PARAMETERS));
- }
-
- if (ret.getService() == null) {
- LOGGER.debug ("serviceMacroHolder not found");
- respStatus = HttpStatus.SC_NOT_FOUND;
- qryResp = new QueryServiceMacroHolder();
- } else {
- LOGGER.debug ("serviceMacroHolder found");
- qryResp = new QueryServiceMacroHolder(ret);
- LOGGER.debug ("serviceMacroHolder qryResp="+ qryResp);
- }
- LOGGER.debug ("Query serviceMacroHolder exit");
- return respond(version, respStatus, IS_ARRAY, qryResp);
- } catch (Exception e) {
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceMacroHolder", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceMacroHolder", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp){} )
- .build();
- }
- }
-
-
- @GET
- @Path("allottedResources/{arModelCustomizationUuid}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceAllottedResources (
- @PathParam("version") String version,
- @PathParam("arModelCustomizationUuid") String aUuid
- ) {
- return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null);
- }
-
- @GET
- @Path("serviceAllottedResources")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceAllottedResources(
- @PathParam("version") String version,
- @QueryParam("serviceModelUuid") String smUuid,
- @QueryParam("serviceModelInvariantUuid") String smiUuid,
- @QueryParam("serviceModelVersion") String smVer,
- @QueryParam("arModelCustomizationUuid") String aUuid
- ) {
- return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer);
- }
-
- public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String serviceModelInvariantUuid, String smVer) {
- QueryAllottedResourceCustomization qryResp;
- int respStatus = HttpStatus.SC_OK;
- String uuid = "";
- List<AllottedResourceCustomization> ret = new ArrayList<>();
- Service service = null;
- try{
- if (smUuid != null && !"".equals(smUuid)) {
- uuid = smUuid;
- service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid);
- }
- else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
- uuid = serviceModelInvariantUuid;
- if (smVer != null && !"".equals(smVer)) {
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer, uuid);
- }
- else {
- service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
- }
- }
- else if (aUuid != null && !"".equals(aUuid)) {
- uuid = aUuid;
- ret = allottedCustomizationRepo.findByModelCustomizationUUID(uuid);
- }
- else {
- throw(new Exception(NO_MATCHING_PARAMETERS));
- }
-
- if(service != null)
- ret=service.getAllottedCustomizations();
-
- if (ret == null || ret.isEmpty()) {
- LOGGER.debug ("AllottedResourceCustomization not found");
- respStatus = HttpStatus.SC_NOT_FOUND;
- qryResp = new QueryAllottedResourceCustomization();
- } else {
- qryResp = new QueryAllottedResourceCustomization(ret);
- LOGGER.debug ("AllottedResourceCustomization qryResp="+ qryResp);
- }
- return respond(version, respStatus, isArray, qryResp);
- } catch (Exception e) {
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryAllottedResourceCustomization", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryAllottedResourceCustomization", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
- }
- }
-
- @GET
- @Path("vfModules")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) {
- QueryVfModule qryResp;
- int respStatus = HttpStatus.SC_OK;
- List<VfModuleCustomization> ret = null;
- try{
- if(vfModuleModelName != null && !"".equals(vfModuleModelName)){
- VfModule vfModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc(vfModuleModelName);
- if(vfModule != null)
- ret = vfModule.getVfModuleCustomization();
- }else{
- throw(new Exception(NO_MATCHING_PARAMETERS));
- }
-
- if(ret == null || ret.isEmpty()){
- LOGGER.debug ("vfModules not found");
- respStatus = HttpStatus.SC_NOT_FOUND;
- qryResp = new QueryVfModule();
- }else{
- qryResp = new QueryVfModule(ret);
- LOGGER.debug ("vfModules tojsonstring is: "+ qryResp.JSON2(false, false));
- }
- return Response
- .status(respStatus)
- .entity(qryResp.JSON2(false, false))
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
- }catch(Exception e){
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleModelName, "", "queryVfModules", MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query VfModules by vfModuleModuleName: ", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
- }
- }
- /**
- * Get the tosca csar info from catalog
- * <br>
- *
- * @param smUuid service model uuid
- * @return the tosca csar information of the serivce.
- * @since ONAP Beijing Release
- */
- @GET
- @Path("serviceToscaCsar")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) {
- int respStatus = HttpStatus.SC_OK;
- String entity = "";
- try {
- if (smUuid != null && !"".equals(smUuid)) {
- LOGGER.debug("Query Csar by service model uuid: " + smUuid);
- ToscaCsar toscaCsar = toscaCsarRepo.findOne(smUuid);
- if (toscaCsar != null) {
- QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar);
- entity = serviceCsar.JSON2(false, false);
- } else {
- respStatus = HttpStatus.SC_NOT_FOUND;
- }
- } else {
- throw (new Exception("Incoming parameter is null or blank"));
- }
- LOGGER.debug("Query Csar exit");
- return Response
- .status(respStatus)
- .entity(entity)
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
- } catch (Exception e) {
- LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, smUuid, "", "ServiceToscaCsar",
- MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query csar by service model uuid: ", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
- CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {
- })
- .build();
- }
- }
-
- /**
- * Get the resource recipe info from catalog
- * <br>
- *
- * @param rmUuid resource model uuid
- * @return the recipe information of the resource.
- * @since ONAP Beijing Release
- */
- @GET
- @Path("resourceRecipe")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) {
- int respStatus = HttpStatus.SC_OK;
- String entity = "";
- try {
- if (rmUuid != null && !"".equals(rmUuid)) {
- LOGGER.debug("Query recipe by resource model uuid: " + rmUuid);
- //check vnf and network and ar, the resource could be any resource.
- VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid);
- Recipe recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
- if (null == recipe) {
- NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
- recipe = networkRecipeRepo.findByModelNameAndAction(nResource.getModelName(), action);
- }
- if (null == recipe) {
- AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid);
- recipe = arRecipeRepo.findByModelNameAndAction(arResource.getModelName(), action);
- }
- if (recipe != null) {
- QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
- entity = resourceRecipe.JSON2(false, false);
- } else {
- respStatus = HttpStatus.SC_NOT_FOUND;
- }
- } else {
- throw (new Exception("Incoming parameter is null or blank"));
- }
- LOGGER.debug("Query recipe exit");
- return Response
- .status(respStatus)
- .entity(entity)
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
- } catch (Exception e) {
- LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe",
- MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
- CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {
- })
- .build();
- }
- }
+ protected static Logger logger = LoggerFactory.getLogger(CatalogDbAdapterRest.class);
+ private static final boolean IS_ARRAY = true;
+
+ @Autowired
+ private VnfCustomizationRepository vnfCustomizationRepo;
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private NetworkResourceCustomizationRepository networkCustomizationRepo;
+
+ @Autowired
+ private NetworkResourceRepository networkResourceRepo;
+
+ @Autowired
+ private AllottedResourceCustomizationRepository allottedCustomizationRepo;
+
+ @Autowired
+ private ToscaCsarRepository toscaCsarRepo;
+
+ @Autowired
+ private VFModuleRepository vfModuleRepo;
+
+ @Autowired
+ private VnfRecipeRepository vnfRecipeRepo;
+
+ @Autowired
+ private NetworkRecipeRepository networkRecipeRepo;
+
+ @Autowired
+ private ArRecipeRepository arRecipeRepo;
+
+ @Autowired
+ private VnfResourceRepository vnfResourceRepo;
+
+ @Autowired
+ private AllottedResourceRepository arResourceRepo;
+
+ private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
+
+ public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
+ return Response
+ .status(respStatus)
+ //.entity(new GenericEntity<QueryServiceVnfs>(qryResp) {})
+ .entity(qryResp.toJsonString(version, isArray))
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+ }
+
+ @GET
+ @Path("vnfResources/{vnfModelCustomizationUuid}")
+ @Transactional( readOnly = true)
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public Response serviceVnfs (
+ @PathParam("version") String version,
+ @PathParam("vnfModelCustomizationUuid") String vnfUuid
+ ) {
+ return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null);
+ }
+
+ @GET
+ @Path("serviceVnfs")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Transactional( readOnly = true)
+ public Response serviceVnfs(
+ @PathParam("version") String version,
+ @QueryParam("vnfModelCustomizationUuid") String vnfUuid,
+ @QueryParam("serviceModelUuid") String smUuid,
+ @QueryParam("serviceModelInvariantUuid") String smiUuid,
+ @QueryParam("serviceModelVersion") String smVer,
+ @QueryParam("serviceModelName") String smName
+ ) {
+ return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName);
+ }
+
+ public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID, String smiUuid, String smVer, String smName) {
+ QueryServiceVnfs qryResp = null;
+ int respStatus = HttpStatus.SC_OK;
+ List<VnfResourceCustomization> ret = new ArrayList<>();
+ Service service = null;
+ try {
+ if (vnfUuid != null && !"".equals(vnfUuid))
+ ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid);
+ else if (serviceModelUUID != null && !"".equals(serviceModelUUID))
+ service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID);
+ else if (smiUuid != null && !"".equals(smiUuid))
+ if (smVer != null && !"".equals(smVer))
+ service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer,smiUuid);
+ else
+ service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid);
+ else if (smName != null && !"".equals(smName)) {
+ if (smVer != null && !"".equals(smVer))
+ service = serviceRepo.findByModelNameAndModelVersion(smName, smVer);
+ else
+ service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName);
+ }
+ else {
+ throw(new Exception(NO_MATCHING_PARAMETERS));
+ }
+
+ if (service == null && ret.isEmpty()) {
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ qryResp = new QueryServiceVnfs();
+ }else if( service == null && !ret.isEmpty()){
+ qryResp = new QueryServiceVnfs(ret);
+ } else if (service != null) {
+ qryResp = new QueryServiceVnfs(service.getVnfCustomizations());
+ }
+ logger.debug ("serviceVnfs qryResp= {}", qryResp);
+ return respond(version, respStatus, isArray, qryResp);
+ } catch (Exception e) {
+ logger.error("Exception - queryServiceVnfs", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {})
+ .build();
+ }
+ }
+
+ @GET
+ @Path("networkResources/{networkModelCustomizationUuid}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Transactional( readOnly = true)
+ public Response serviceNetworks (
+ @PathParam("version") String version,
+ @PathParam("networkModelCustomizationUuid") String nUuid
+ ) {
+ return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null);
+ }
+
+ @GET
+ @Path("serviceNetworks")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Transactional( readOnly = true)
+ public Response serviceNetworks (
+ @PathParam("version") String version,
+ @QueryParam("networkModelCustomizationUuid") String networkModelCustomizationUuid,
+ @QueryParam("networkType") String networkType,
+ @QueryParam("networkModelName") String networkModelName,
+ @QueryParam("serviceModelUuid") String serviceModelUuid,
+ @QueryParam("serviceModelInvariantUuid") String serviceModelInvariantUuid,
+ @QueryParam("serviceModelVersion") String serviceModelVersion,
+ @QueryParam("networkModelVersion") String networkModelVersion
+ ) {
+ if (networkModelName != null && !"".equals(networkModelName)) {
+ networkType = networkModelName;
+ }
+ return serviceNetworksImpl (version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid, serviceModelInvariantUuid, serviceModelVersion);
+ }
+
+ public Response serviceNetworksImpl (String version, boolean isArray, String networkModelCustomizationUuid, String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) {
+ QueryServiceNetworks qryResp;
+ int respStatus = HttpStatus.SC_OK;
+ String uuid = "";
+ List<NetworkResourceCustomization> ret = new ArrayList<>();
+ Service service = null;
+
+ try{
+ if (networkModelCustomizationUuid != null && !"".equals(networkModelCustomizationUuid)) {
+ uuid = networkModelCustomizationUuid;
+ ret = networkCustomizationRepo.findByModelCustomizationUUID(networkModelCustomizationUuid);
+ }else if (networkType != null && !"".equals(networkType)) {
+ uuid = networkType;
+ NetworkResource networkResources = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
+ if(networkResources != null)
+ ret=networkResources.getNetworkResourceCustomization();
+ }
+ else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
+ uuid = serviceModelInvariantUuid;
+ if (serviceModelVersion != null && !"".equals(serviceModelVersion)) {
+ service = serviceRepo.findByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
+ }
+ else {
+ service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
+ }
+ }else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) {
+ uuid = serviceModelUuid;
+ service = serviceRepo.findOneByModelUUID(serviceModelUuid);
+ }
+ else {
+ throw(new Exception(NO_MATCHING_PARAMETERS));
+ }
+
+ if(service != null)
+ ret = service.getNetworkCustomizations();
+
+ if (ret == null || ret.isEmpty()) {
+ logger.debug ("serviceNetworks not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ qryResp = new QueryServiceNetworks();
+ } else {
+ qryResp = new QueryServiceNetworks(ret);
+ logger.debug ("serviceNetworks found qryResp= {}", qryResp);
+ }
+ return respond(version, respStatus, isArray, qryResp);
+ } catch (Exception e) {
+ logger.error ("Exception - queryServiceNetworks", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {})
+ .build();
+ }
+ }
+
+ @GET
+ @Path("serviceResources")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Transactional(readOnly = true)
+ public Response serviceResources(
+ @PathParam("version") String version,
+ @QueryParam("serviceModelUuid") String modelUUID,
+ @QueryParam("serviceModelInvariantUuid") String modelInvariantUUID,
+ @QueryParam("serviceModelVersion") String modelVersion) {
+ QueryServiceMacroHolder qryResp;
+ int respStatus = HttpStatus.SC_OK;
+ String uuid = "";
+ ServiceMacroHolder ret = new ServiceMacroHolder();
+
+ try{
+ if (modelUUID != null && !"".equals(modelUUID)) {
+ uuid = modelUUID;
+ logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: {}" , uuid);
+ Service serv =serviceRepo.findOneByModelUUID(uuid);
+ ret.setService(serv);
+ }
+ else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) {
+ uuid = modelInvariantUUID;
+ if (modelVersion != null && !"".equals(modelVersion)) {
+ logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",uuid, modelVersion);
+ Service serv = serviceRepo.findByModelVersionAndModelInvariantUUID(modelVersion, uuid);
+ ret.setService(serv);
+ }
+ else {
+ logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: {}" , uuid);
+ Service serv = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
+ ret.setService(serv);
+ }
+ }
+ else {
+ throw(new Exception(NO_MATCHING_PARAMETERS));
+ }
+
+ if (ret.getService() == null) {
+ logger.debug ("serviceMacroHolder not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ qryResp = new QueryServiceMacroHolder();
+ } else {
+ qryResp = new QueryServiceMacroHolder(ret);
+ logger.debug ("serviceMacroHolder qryResp= {}", qryResp);
+ }
+ return respond(version, respStatus, IS_ARRAY, qryResp);
+ } catch (Exception e) {
+ logger.error ("Exception - queryServiceMacroHolder", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp){} )
+ .build();
+ }
+ }
+
+
+ @GET
+ @Path("allottedResources/{arModelCustomizationUuid}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Transactional( readOnly = true)
+ public Response serviceAllottedResources (
+ @PathParam("version") String version,
+ @PathParam("arModelCustomizationUuid") String aUuid
+ ) {
+ return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null);
+ }
+
+ @GET
+ @Path("serviceAllottedResources")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Transactional( readOnly = true)
+ public Response serviceAllottedResources(
+ @PathParam("version") String version,
+ @QueryParam("serviceModelUuid") String smUuid,
+ @QueryParam("serviceModelInvariantUuid") String smiUuid,
+ @QueryParam("serviceModelVersion") String smVer,
+ @QueryParam("arModelCustomizationUuid") String aUuid
+ ) {
+ return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer);
+ }
+
+ public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String serviceModelInvariantUuid, String smVer) {
+ QueryAllottedResourceCustomization qryResp;
+ int respStatus = HttpStatus.SC_OK;
+ String uuid = "";
+ List<AllottedResourceCustomization> ret = new ArrayList<>();
+ Service service = null;
+ try{
+ if (smUuid != null && !"".equals(smUuid)) {
+ uuid = smUuid;
+ service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid);
+ }
+ else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
+ uuid = serviceModelInvariantUuid;
+ if (smVer != null && !"".equals(smVer)) {
+ service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer, uuid);
+ }
+ else {
+ service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
+ }
+ }
+ else if (aUuid != null && !"".equals(aUuid)) {
+ uuid = aUuid;
+ ret = allottedCustomizationRepo.findByModelCustomizationUUID(uuid);
+ }
+ else {
+ throw(new Exception(NO_MATCHING_PARAMETERS));
+ }
+
+ if(service != null)
+ ret=service.getAllottedCustomizations();
+
+ if (ret == null || ret.isEmpty()) {
+ logger.debug ("AllottedResourceCustomization not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ qryResp = new QueryAllottedResourceCustomization();
+ } else {
+ qryResp = new QueryAllottedResourceCustomization(ret);
+ logger.debug ("AllottedResourceCustomization qryResp= {}", qryResp);
+ }
+ return respond(version, respStatus, isArray, qryResp);
+ } catch (Exception e) {
+ logger.error ("Exception - queryAllottedResourceCustomization", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {})
+ .build();
+ }
+ }
+
+ @GET
+ @Path("vfModules")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Transactional( readOnly = true)
+ public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) {
+ QueryVfModule qryResp;
+ int respStatus = HttpStatus.SC_OK;
+ List<VfModuleCustomization> ret = null;
+ try{
+ if(vfModuleModelName != null && !"".equals(vfModuleModelName)){
+ VfModule vfModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc(vfModuleModelName);
+ if(vfModule != null)
+ ret = vfModule.getVfModuleCustomization();
+ }else{
+ throw(new Exception(NO_MATCHING_PARAMETERS));
+ }
+
+ if(ret == null || ret.isEmpty()){
+ logger.debug ("vfModules not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ qryResp = new QueryVfModule();
+ }else{
+ qryResp = new QueryVfModule(ret);
+ if(logger.isDebugEnabled())
+ logger.debug ("vfModules tojsonstring is: {}", qryResp.JSON2(false, false));
+ }
+ return Response
+ .status(respStatus)
+ .entity(qryResp.JSON2(false, false))
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+ }catch(Exception e){
+ logger.error ("Exception during query VfModules by vfModuleModuleName: ", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {})
+ .build();
+ }
+ }
+ /**
+ * Get the tosca csar info from catalog
+ * <br>
+ *
+ * @param smUuid service model uuid
+ * @return the tosca csar information of the serivce.
+ * @since ONAP Beijing Release
+ */
+ @GET
+ @Path("serviceToscaCsar")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) {
+ int respStatus = HttpStatus.SC_OK;
+ String entity = "";
+ try {
+ if (smUuid != null && !"".equals(smUuid)) {
+ logger.debug("Query Csar by service model uuid: {}",smUuid);
+ ToscaCsar toscaCsar = toscaCsarRepo.findOne(smUuid);
+ if (toscaCsar != null) {
+ QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar);
+ entity = serviceCsar.JSON2(false, false);
+ } else {
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ }
+ } else {
+ throw (new Exception("Incoming parameter is null or blank"));
+ }
+ return Response
+ .status(respStatus)
+ .entity(entity)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+ } catch (Exception e) {
+ logger.error("Exception during query csar by service model uuid: ", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {
+ })
+ .build();
+ }
+ }
+
+ /**
+ * Get the resource recipe info from catalog
+ * <br>
+ *
+ * @param rmUuid resource model uuid
+ * @return the recipe information of the resource.
+ * @since ONAP Beijing Release
+ */
+ @GET
+ @Path("resourceRecipe")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) {
+ int respStatus = HttpStatus.SC_OK;
+ String entity = "";
+ try {
+ if (rmUuid != null && !"".equals(rmUuid)) {
+ logger.debug("Query recipe by resource model uuid: {}", rmUuid);
+ //check vnf and network and ar, the resource could be any resource.
+ VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid);
+ Recipe recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
+ if (null == recipe) {
+ NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
+ recipe = networkRecipeRepo.findByModelNameAndAction(nResource.getModelName(), action);
+ }
+ if (null == recipe) {
+ AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid);
+ recipe = arRecipeRepo.findByModelNameAndAction(arResource.getModelName(), action);
+ }
+ if (recipe != null) {
+ QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
+ entity = resourceRecipe.JSON2(false, false);
+ } else {
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ }
+ } else {
+ throw new Exception("Incoming parameter is null or blank");
+ }
+ return Response
+ .status(respStatus)
+ .entity(entity)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+ } catch (Exception e) {
+ logger.error("Exception during query recipe by resource model uuid: ", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {
+ })
+ .build();
+ }
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java
deleted file mode 100644
index 8f75008aef..0000000000
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*-
- * ============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.adapters.catalogdb.rest;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index f3315b57eb..c3159f0e3b 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -58,7 +58,6 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
-
public class CatalogDBRestTest {
private static final String ECOMP_MSO_CATALOG_V2_VF_MODULES = "ecomp/mso/catalog/v2/vfModules";
@@ -748,32 +747,45 @@ public class CatalogDBRestTest {
@Test
public void testGetVFModulesBadQueryParam() throws JSONException, IOException {
- TestAppender.events.clear();
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
- .queryParam("ADASD", "NEUTRON_BASIC");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
-
-
- ILoggingEvent logEvent = TestAppender.events.get(0);
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
- assertNotNull(mdc.get(MsoLogger.ENDTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.TIMER));
- assertEquals("500",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("ERROR",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ TestAppender.events.clear();
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
+ .queryParam("ADASD", "NEUTRON_BASIC");
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+
+
+ for(ILoggingEvent logEvent : TestAppender.events)
+ if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
+ logEvent.getMarker().getName().equals("ENTRY")
+ ){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
+ logEvent.getMarker().getName().equals("EXIT")){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
+ assertEquals("500",mdc.get(MsoLogger.RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME));
+ assertEquals("ERROR",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ }
}
private String createURLWithPort(String uri) {
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml
index aceeda408b..715cef8db1 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml
@@ -1,12 +1,18 @@
<configuration>
-
+ <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
+ <property name="p_lvl" value="%level"/>
+ <property name="p_log" value="%logger"/>
+ <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>
+ <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_thr" value="%thread"/>
+ <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
- %logger{1024} - %msg%n
- </pattern>
+ <pattern>${pattern}</pattern>
</encoder>
</appender>
@@ -27,6 +33,7 @@
<logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
</logger>
<logger name="org.flywaydb" level="DEBUG" additivity="false">
@@ -38,12 +45,10 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="AUDIT" level="info" additivity="true">
- <appender-ref ref="test" />
- </logger>
<root level="WARN">
<appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
</root>
diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java
index 10f572e772..e4cac067ba 100644
--- a/common/src/main/java/org/onap/so/logger/MsoLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java
@@ -35,6 +35,8 @@ import org.onap.so.entity.MsoRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
/**
@@ -49,15 +51,23 @@ import org.slf4j.MDC;
*/
public class MsoLogger {
- // MDC parameters
- public static final String REQUEST_ID = "RequestId";
- public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ // Required MDC parameters
+ public static final String REQUEST_ID = "RequestID";
+ public static final String INVOCATION_ID = "InvocationID";
+ public static final String INSTANCE_UUID = "InstanceUUID";
public static final String SERVICE_NAME = "ServiceName";
+ public static final String STATUSCODE = "StatusCode";
+ public static final String RESPONSECODE = "ResponseCode";
+ public static final String RESPONSEDESC = "ResponseDesc";
+ public static final String FQDN = "ServerFQDN";
+
+
+ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
+
public static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName";
- public static final String INSTANCE_UUID = "InstanceUUID";
public static final String SERVER_IP = "ServerIPAddress";
- public static final String FQDN = "ServerFQDN";
+
public static final String REMOTE_HOST = "RemoteHost";
public static final String ALERT_SEVERITY = "AlertSeverity";
public static final String TIMER = "Timer";
@@ -73,16 +83,17 @@ public class MsoLogger {
public static final String HEADER_REQUEST_ID = "X-RequestId";
public static final String TRANSACTION_ID = "X-TransactionID";
public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
+ public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID";
+
public static final String CLIENT_ID = "X-ClientID";
+ public static final String INVOCATION_ID_HEADER = "X-InvocationID";
// Audit/Metric log specific
public static final String BEGINTIME = "BeginTimestamp";
public static final String STARTTIME = "StartTimeMilis";
public static final String ENDTIME = "EndTimestamp";
public static final String PARTNERNAME = "PartnerName";
- public static final String STATUSCODE = "StatusCode";
- public static final String RESPONSECODE = "ResponseCode";
- public static final String RESPONSEDESC = "ResponseDesc";
+
// Metric log specific
@@ -103,8 +114,10 @@ public class MsoLogger {
public static final String ERRORCODE = "ErrorCode";
public static final String ERRORDESC = "ErrorDesc";
+ //Status Codes
public static final String COMPLETE = "COMPLETE";
-
+ public static final String INPROGRESS = "INPROGRESS";
+
public enum Catalog {
APIH, BPEL, RA, ASDC, GENERAL
}
@@ -157,6 +170,9 @@ public class MsoLogger {
this.value = value;
}
}
+
+ public static final Marker ENTRY = MarkerFactory.getMarker("ENTRY");
+ public static final Marker EXIT = MarkerFactory.getMarker("EXIT");
private Logger logger;
private Logger metricsLogger;
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java
index 9fab4ff0df..d278a5f761 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java
@@ -44,137 +44,152 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.Providers;
-
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.databind.ObjectMapper;
@Priority(1)
@Provider
@Component
public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerResponseFilter {
-
- private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,JaxRsFilterLogging.class);
-
- @Context
- private HttpServletRequest httpServletRequest;
-
- @Context
- private Providers providers;
-
- @Autowired
- ObjectMapper objectMapper;
-
- @Override
- public void filter(ContainerRequestContext containerRequest) {
-
- try {
- String clientID = null;
- //check headers for request id
- MultivaluedMap<String, String> headers = containerRequest.getHeaders();
- String requestId = (String) headers.getFirst(MsoLogger.HEADER_REQUEST_ID );
- if(requestId == null || requestId.isEmpty()){
- if(headers.containsKey(MsoLogger.TRANSACTION_ID)){
- requestId = headers.getFirst(MsoLogger.TRANSACTION_ID);
- }else if(headers.containsKey(MsoLogger.ECOMP_REQUEST_ID)){
- requestId = headers.getFirst(MsoLogger.ECOMP_REQUEST_ID);
- }else{
- requestId = UUID.randomUUID().toString();
- logger.warnSimple(containerRequest.getUriInfo().getPath(),"Generating RequestId for Request");
- }
- }
- containerRequest.setProperty("requestId", requestId);
- if(headers.containsKey(MsoLogger.CLIENT_ID)){
- clientID = headers.getFirst(MsoLogger.CLIENT_ID);
- }else{
- clientID = "UNKNOWN";
- headers.add(MsoLogger.CLIENT_ID, clientID);
- }
- String remoteIpAddress = "";
- if (httpServletRequest != null) {
- remoteIpAddress = httpServletRequest.getRemoteAddr();
- }
- Instant instant = Instant.now();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
- .withLocale( Locale.US )
- .withZone( ZoneId.systemDefault() );
-
- String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID );
- if(partnerName == null || partnerName.isEmpty())
- partnerName="UNKNOWN";
-
- MDC.put(MsoLogger.FROM_APP_ID,partnerName);
- MDC.put(MsoLogger.SERVICE_NAME, containerRequest.getUriInfo().getPath());
- MDC.put(MsoLogger.BEGINTIME, formatter.format(instant));
- MDC.put(MsoLogger.REQUEST_ID,requestId);
- MDC.put(MsoLogger.PARTNERNAME,partnerName);
- MDC.put(MsoLogger.REMOTE_HOST, String.valueOf(remoteIpAddress));
- MDC.put(MsoLogger.STARTTIME, String.valueOf(System.currentTimeMillis()));
- MDC.put(MsoLogger.CLIENT_ID, clientID);
- } catch (Exception e) {
- logger.warnSimple("Error in incoming JAX-RS Inteceptor", e);
- }
- }
-
-
- @Override
- public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
- throws IOException {
- try {
- Instant instant = Instant.now();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
- .withLocale( Locale.US )
- .withZone( ZoneId.systemDefault() );
- String startTime= MDC.get(MsoLogger.STARTTIME);
- long elapsedTime;
- try {
- elapsedTime = System.currentTimeMillis() - Long.parseLong(startTime);
- }catch(NumberFormatException e){
- elapsedTime = 0;
- }
- String statusCode;
- if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
- statusCode=MsoLogger.COMPLETE;
- }else{
- statusCode= MsoLogger.StatusCode.ERROR.toString();
- }
-
- MDC.put(MsoLogger.RESPONSEDESC,payloadMessage(responseContext));
- MDC.put(MsoLogger.STATUSCODE, statusCode);
- MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus()));
- MDC.put(MsoLogger.TIMER, String.valueOf(elapsedTime));
- MDC.put(MsoLogger.ENDTIME,formatter.format(instant));
- logger.recordAuditEvent();
- } catch ( Exception e) {
- logger.warnSimple("Error in outgoing JAX-RS Inteceptor", e);
- }
- }
-
- private String payloadMessage(ContainerResponseContext responseContext) throws IOException {
- String message = new String();
- if (responseContext.hasEntity()) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- Class<?> entityClass = responseContext.getEntityClass();
- Type entityType = responseContext.getEntityType();
- Annotation[] entityAnnotations = responseContext.getEntityAnnotations();
- MediaType mediaType = responseContext.getMediaType();
- @SuppressWarnings("unchecked")
- MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers.getMessageBodyWriter(entityClass,
- entityType,
- entityAnnotations,
- mediaType);
- bodyWriter.writeTo(responseContext.getEntity(),
- entityClass,
- entityType,
- entityAnnotations,
- mediaType,
- responseContext.getHeaders(),
- baos);
- message = message.concat(new String(baos.toByteArray()));
- }
- return message;
- }
+
+ protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class);
+
+ @Context
+ private HttpServletRequest httpServletRequest;
+
+ @Context
+ private Providers providers;
+
+ @Autowired
+ ObjectMapper objectMapper;
+
+ @Override
+ public void filter(ContainerRequestContext containerRequest) {
+
+ try {
+ String clientID = null;
+ //check headers for request id
+ MultivaluedMap<String, String> headers = containerRequest.getHeaders();
+ String requestId = findRequestId(headers);
+ containerRequest.setProperty("requestId", requestId);
+ if(headers.containsKey(MsoLogger.CLIENT_ID)){
+ clientID = headers.getFirst(MsoLogger.CLIENT_ID);
+ }else{
+ clientID = "UNKNOWN";
+ headers.add(MsoLogger.CLIENT_ID, clientID);
+ }
+
+ String remoteIpAddress = "";
+ if (httpServletRequest != null) {
+ remoteIpAddress = httpServletRequest.getRemoteAddr();
+ }
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+
+ String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID );
+ if(partnerName == null || partnerName.isEmpty())
+ partnerName="UNKNOWN";
+
+ MDC.put(MsoLogger.REQUEST_ID,requestId);
+ MDC.put(MsoLogger.INVOCATION_ID,requestId);
+ MDC.put(MsoLogger.FROM_APP_ID,partnerName);
+ MDC.put(MsoLogger.SERVICE_NAME, containerRequest.getUriInfo().getPath());
+ MDC.put(MsoLogger.INVOCATION_ID, findInvocationId(headers));
+ MDC.put(MsoLogger.STATUSCODE, MsoLogger.INPROGRESS);
+ MDC.put(MsoLogger.BEGINTIME, formatter.format(instant));
+ MDC.put(MsoLogger.PARTNERNAME,partnerName);
+ MDC.put(MsoLogger.REMOTE_HOST, String.valueOf(remoteIpAddress));
+ MDC.put(MsoLogger.STARTTIME, String.valueOf(System.currentTimeMillis()));
+ logger.debug(MsoLogger.ENTRY, "Entering.");
+ } catch (Exception e) {
+ logger.warn("Error in incoming JAX-RS Inteceptor", e);
+ }
+ }
+
+
+ private String findRequestId(MultivaluedMap<String, String> headers) {
+ String requestId = (String) headers.getFirst(MsoLogger.HEADER_REQUEST_ID );
+ if(requestId == null || requestId.isEmpty()){
+ if(headers.containsKey(MsoLogger.ONAP_REQUEST_ID)){
+ requestId = headers.getFirst(MsoLogger.ONAP_REQUEST_ID);
+ }else if(headers.containsKey(MsoLogger.ECOMP_REQUEST_ID)){
+ requestId = headers.getFirst(MsoLogger.ECOMP_REQUEST_ID);
+ }else{
+ requestId = UUID.randomUUID().toString();
+ }
+ }
+ return requestId;
+ }
+
+ private String findInvocationId(MultivaluedMap<String, String> headers) {
+ String invocationId = (String) headers.getFirst(MsoLogger.INVOCATION_ID_HEADER );
+ if(invocationId == null || invocationId.isEmpty())
+ invocationId =UUID.randomUUID().toString();
+ return invocationId;
+ }
+
+ @Override
+ public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
+ throws IOException {
+ try {
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+ String startTime= MDC.get(MsoLogger.STARTTIME);
+ long elapsedTime;
+ try {
+ elapsedTime = System.currentTimeMillis() - Long.parseLong(startTime);
+ }catch(NumberFormatException e){
+ elapsedTime = 0;
+ }
+ String statusCode;
+ if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
+ statusCode=MsoLogger.COMPLETE;
+ }else{
+ statusCode= MsoLogger.StatusCode.ERROR.toString();
+ }
+
+ MDC.put(MsoLogger.RESPONSEDESC,payloadMessage(responseContext));
+ MDC.put(MsoLogger.STATUSCODE, statusCode);
+ MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus()));
+ MDC.put(MsoLogger.TIMER, String.valueOf(elapsedTime));
+ MDC.put(MsoLogger.ENDTIME,formatter.format(instant));
+ logger.debug(MsoLogger.EXIT, "Exiting.");
+ } catch ( Exception e) {
+ logger.warn("Error in outgoing JAX-RS Inteceptor", e);
+ }
+ }
+
+ private String payloadMessage(ContainerResponseContext responseContext) throws IOException {
+ String message = new String();
+ if (responseContext.hasEntity()) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Class<?> entityClass = responseContext.getEntityClass();
+ Type entityType = responseContext.getEntityType();
+ Annotation[] entityAnnotations = responseContext.getEntityAnnotations();
+ MediaType mediaType = responseContext.getMediaType();
+ @SuppressWarnings("unchecked")
+ MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers.getMessageBodyWriter(entityClass,
+ entityType,
+ entityAnnotations,
+ mediaType);
+ bodyWriter.writeTo(responseContext.getEntity(),
+ entityClass,
+ entityType,
+ entityAnnotations,
+ mediaType,
+ responseContext.getHeaders(),
+ baos);
+ message = message.concat(new String(baos.toByteArray()));
+ }
+ return message;
+ }
}
diff --git a/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java b/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java
index 15368f9966..587e4841d7 100644
--- a/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java
+++ b/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java
@@ -78,6 +78,8 @@ public class CryptoTest {
encodeString = CryptoUtils.encryptCloudConfigPassword(testData);
assertEquals(testData, CryptoUtils.decryptCloudConfigPassword(encodeString));
+
+ System.out.println(CryptoUtils.encrypt("poBpmn:password1$", "aa3871669d893c7fb8abbcda31b88b4f"));
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
index c9d83efced..5d6aa43a9b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
@@ -26,6 +26,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
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.assertThat;
import java.io.IOException;
@@ -57,62 +58,80 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
public class ManualTasksTest extends BaseTest{
- private final String basePath = "/tasks/v1/";
-
-
-
- @Test
- public void testCreateOpEnvObjectMapperError() throws IOException {
- TestAppender.events.clear();
- stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
-
- String taskId = "55";
- TasksRequest taskReq = new TasksRequest();
- RequestDetails reqDetail = new RequestDetails();
- RequestInfo reqInfo = new RequestInfo();
- reqInfo.setRequestorId("testId");
- reqInfo.setSource("testSource");
- reqInfo.setResponseValue(ValidResponses.skip);
- reqDetail.setRequestInfo(reqInfo);
- taskReq.setRequestDetails(reqDetail);
-
- //expected response
- TaskRequestReference expectedResponse = new TaskRequestReference();
- expectedResponse.setTaskId(taskId);
-
- headers.set("Accept", MediaType.APPLICATION_JSON);
- headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
- HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.POST, entity, String.class);
-
-
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
- TaskRequestReference realResponse = mapper.readValue(response.getBody(), TaskRequestReference.class);
-
-
- //then
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- assertThat(realResponse, sameBeanAs(expectedResponse));
- ILoggingEvent logEvent = TestAppender.events.get(0);
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertEquals("987654321", mdc.get(MsoLogger.REQUEST_ID));
- assertEquals("VID", mdc.get(MsoLogger.CLIENT_ID));
- assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
- assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
- assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
- assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- assertEquals("987654321", response.getHeaders().get("X-TransactionID").get(0));
- MDC.remove(MsoLogger.CLIENT_ID);
-
- }
+ private final String basePath = "/tasks/v1/";
+
+
+
+ @Test
+ public void testCreateOpEnvObjectMapperError() throws IOException {
+ TestAppender.events.clear();
+ stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+
+ String taskId = "55";
+ TasksRequest taskReq = new TasksRequest();
+ RequestDetails reqDetail = new RequestDetails();
+ RequestInfo reqInfo = new RequestInfo();
+ reqInfo.setRequestorId("testId");
+ reqInfo.setSource("testSource");
+ reqInfo.setResponseValue(ValidResponses.skip);
+ reqDetail.setRequestInfo(reqInfo);
+ taskReq.setRequestDetails(reqDetail);
+
+ //expected response
+ TaskRequestReference expectedResponse = new TaskRequestReference();
+ expectedResponse.setTaskId(taskId);
+
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
+ headers.set(MsoLogger.CLIENT_ID, "VID");
+ HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
+ ResponseEntity<String> response = restTemplate.exchange(
+ builder.toUriString(),
+ HttpMethod.POST, entity, String.class);
+
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ TaskRequestReference realResponse = mapper.readValue(response.getBody(), TaskRequestReference.class);
+
+
+ //then
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ assertThat(realResponse, sameBeanAs(expectedResponse));
+
+ for(ILoggingEvent logEvent : TestAppender.events)
+ if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
+ logEvent.getMarker().getName().equals("ENTRY")
+ ){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
+ logEvent.getMarker().getName().equals("EXIT")){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
+ assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index fbe720a07d..ef318513fc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -124,7 +124,7 @@ public class ServiceInstancesTest extends BaseTest{
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
- headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(MsoLogger.CLIENT_ID, "VID");
//expect
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
@@ -141,18 +141,37 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
- ILoggingEvent logEvent = TestAppender.events.get(0);
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(MsoLogger.REQUEST_ID));
- assertEquals("VID", mdc.get(MsoLogger.CLIENT_ID));
- MDC.remove(MsoLogger.CLIENT_ID);
- assertTrue(response.getBody().contains("1882939"));
- assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
- assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
- assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
- assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", response.getHeaders().get("X-TransactionID").get(0));
-
+
+
+
+ for(ILoggingEvent logEvent : TestAppender.events)
+ if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
+ logEvent.getMarker().getName().equals("ENTRY")
+ ){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
+ logEvent.getMarker().getName().equals("EXIT")){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
+ assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ }
+
//ExpectedRecord
InfraActiveRequests expectedRecord = new InfraActiveRequests();
expectedRecord.setRequestStatus("IN_PROGRESS");
@@ -575,7 +594,7 @@ public class ServiceInstancesTest extends BaseTest{
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c3";
- headers.set(MsoLogger.TRANSACTION_ID, requestId);
+ headers.set(MsoLogger.ONAP_REQUEST_ID, requestId);
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -684,7 +703,7 @@ public class ServiceInstancesTest extends BaseTest{
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c5";
- headers.set(MsoLogger.TRANSACTION_ID, requestId);
+ headers.set(MsoLogger.ONAP_REQUEST_ID, requestId);
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -838,7 +857,7 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
public void createVfModuleNoModelType() throws JsonParseException, JsonMappingException, IOException{
- headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
InfraActiveRequests expectedRecord = new InfraActiveRequests();
expectedRecord.setRequestStatus("FAILED");
expectedRecord.setAction("createInstance");
@@ -1039,7 +1058,7 @@ public class ServiceInstancesTest extends BaseTest{
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c4";
- headers.set(MsoLogger.TRANSACTION_ID, requestId);
+ headers.set(MsoLogger.ONAP_REQUEST_ID, requestId);
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1123,7 +1142,7 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
public void convertJsonToServiceInstanceRequestFail() throws JsonParseException, JsonMappingException, IOException {
- headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
//ExpectedRecord
InfraActiveRequests expectedRecord = new InfraActiveRequests();
expectedRecord.setRequestStatus("FAILED");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml
index 1b3a7cc6da..4da57a15f9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml
@@ -1,39 +1,41 @@
-<configuration >
-
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+<configuration>
+
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
</pattern>
- </encoder>
- </appender>
- <appender name="test" class="org.onap.so.apihandlerinfra.TestAppender"/>
-
-
- <logger name="AUDIT" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- <appender-ref ref = "test" />
- </logger>
-
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.error" level="ERROR" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ </encoder>
+ </appender>
+ <appender name="test" class="org.onap.so.apihandlerinfra.TestAppender" />
+
+
+ <logger name="AUDIT" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.error" level="ERROR" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
-
- <logger name="com.att" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
- <root level="WARN">
- <appender-ref ref="STDOUT" />
- </root>
-
- <logger name="wiremock.org" level="ERROR" />
+
+ <logger name="org.onap" level="${so.log.level:-DEBUG}"
+ additivity="false">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </logger>
+
+ <logger name="com.att" level="${so.log.level:-DEBUG}"
+ additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+ <logger name="wiremock.org" level="ERROR" />
</configuration> \ No newline at end of file