aboutsummaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
Diffstat (limited to 'common/src')
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java11
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIVersion.java8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java2
-rw-r--r--common/src/main/java/org/onap/so/logger/LogConstants.java1
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java2
-rw-r--r--common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java9
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java9
7 files changed, 20 insertions, 22 deletions
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
index 813421ff80..c11b297e97 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
@@ -39,14 +39,13 @@ import org.onap.so.client.graphinventory.Format;
public class AAIRestClientImpl implements AAIRestClientI {
- private static final AAIVersion ENDPOINT_VERSION = AAIVersion.V10;
private static final String PSERVER_VNF_QUERY = "pservers-fromVnf";
@Override
public List<Pserver> getPhysicalServerByVnfId(String vnfId) throws IOException {
List<AAIResourceUri> startNodes = new ArrayList<>();
startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
- String jsonInput = new AAIQueryClient(ENDPOINT_VERSION)
+ String jsonInput = new AAIQueryClient()
.query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY));
return this.getListOfPservers(jsonInput);
@@ -69,20 +68,20 @@ public class AAIRestClientImpl implements AAIRestClientI {
public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) {
GenericVnf genericVnf = new GenericVnf();
genericVnf.setInMaint(inMaint);
- new AAIResourcesClient(ENDPOINT_VERSION)
+ new AAIResourcesClient()
.update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
}
@Override
public GenericVnf getVnfByName(String vnfId) {
- return new AAIResourcesClient(ENDPOINT_VERSION)
+ return new AAIResourcesClient()
.get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null);
}
@Override
public Optional<Pnf> getPnfByName(String pnfId, String transactionLoggingUuid) {
- Response response = new AAIResourcesClient(ENDPOINT_VERSION)
+ Response response = new AAIResourcesClient()
.getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId));
if (response.getStatus() != 200) {
return Optional.empty();
@@ -93,7 +92,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
@Override
public void createPnf(String pnfId, String transactionLoggingUuid, Pnf pnf) {
- new AAIResourcesClient(ENDPOINT_VERSION)
+ new AAIResourcesClient()
.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), Optional.of(pnf));
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
index de418f32c0..d93d656403 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
@@ -23,13 +23,9 @@ package org.onap.so.client.aai;
import org.onap.so.client.graphinventory.GraphInventoryVersion;
public enum AAIVersion implements GraphInventoryVersion {
- V8("v8"),
- V9("v9"),
- V10("v10"),
- V11("v11"),
- V12("v12"),
V13("v13"),
- V14("v14");
+ V14("v14"),
+ V15("v15");
public final static AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
private final String value;
diff --git a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
index b11003ed1e..5951928bf4 100644
--- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
@@ -53,7 +53,7 @@ public class SDNOValidatorImpl implements SDNOValidator {
public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- AAIResourcesClient client = new AAIResourcesClient(AAIVersion.V10);
+ AAIResourcesClient client = new AAIResourcesClient();
GenericVnf vnf = client.get(GenericVnf.class, uri).orElseThrow(() -> new NotFoundException(vnfId + " not found in A&AI"));
SDNO requestDiagnostic = buildRequestDiagnostic(vnf, uuid, requestingUserId);
diff --git a/common/src/main/java/org/onap/so/logger/LogConstants.java b/common/src/main/java/org/onap/so/logger/LogConstants.java
index 2639adf304..3c8b7f7d56 100644
--- a/common/src/main/java/org/onap/so/logger/LogConstants.java
+++ b/common/src/main/java/org/onap/so/logger/LogConstants.java
@@ -24,4 +24,5 @@ public class LogConstants {
public static final String TARGET_ENTITY_HEADER="X-Target-Entity";
public static final String UNKNOWN_TARGET_ENTITY="Unknown-Target-Entity";
public static final String HTTP_URL="Http-Url";
+ public static final String URI_BASE="Uri-Base";
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
index 85a6498748..7a99594d19 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
@@ -40,6 +40,7 @@ import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.Providers;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.LogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -77,6 +78,7 @@ public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerRespo
mdcSetup.setInstanceUUID();
mdcSetup.setEntryTimeStamp();
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString());
logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
} catch (Exception e) {
logger.warn("Error in incoming JAX-RS Inteceptor", e);
diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
index eeb8593725..9aa4e4c9b5 100644
--- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
+++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
@@ -61,7 +61,6 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter {
setRequestId(headers);
setInvocationId(headers);
setServiceName(request);
- setHttpUrl(request);
setMDCPartnerName(headers);
mdcSetup.setClientIPAddress(request);
mdcSetup.setEntryTimeStamp();
@@ -112,14 +111,6 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
}
- protected void setHttpUrl(HttpServletRequest request) {
- String queryParams = "";
- if (request.getQueryString() != null) {
- queryParams = "?" + request.getQueryString();
- }
- MDC.put(LogConstants.HTTP_URL, request.getRequestURL() + queryParams);
- }
-
protected void setRequestId(Map<String, String> headers) {
String requestId=headers.get(ONAPLogConstants.Headers.REQUEST_ID.toLowerCase());
if(requestId == null || requestId.isEmpty())
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java b/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java
index 0cee366679..0d4490f51d 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java
@@ -68,6 +68,15 @@ public class AAIPatchConverterTest {
}
@Test
+ public void convertStringToPatchFormatNull_Test() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
+ AAIPatchConverter validator = new AAIPatchConverter();
+ String payload = "{\"ipv4-loopback0-address\": null}";
+ String result = validator.marshallObjectToPatchFormat(payload);
+ System.out.println(result);
+ assertEquals("expect no change", payload, result);
+ }
+
+ @Test
public void convertMapToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
AAIPatchConverter validator = new AAIPatchConverter();
HashMap<String, String> map = new HashMap<>();