aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpom.xml36
-rw-r--r--src/main/java/org/onap/aai/audit/AuditGraphson2Sql.java40
-rw-r--r--src/main/java/org/onap/aai/datacleanup/DataCleanupTasks.java2
-rw-r--r--src/main/java/org/onap/aai/datagrooming/DataGrooming.java70
-rw-r--r--src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java2
-rw-r--r--src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java2
-rw-r--r--src/main/java/org/onap/aai/datasnapshot/PartialVertexLoader.java8
-rw-r--r--src/main/java/org/onap/aai/dbgen/DupeTool.java42
-rw-r--r--src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java2
-rw-r--r--src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java2
-rw-r--r--src/main/java/org/onap/aai/migration/MigrationController.java7
-rw-r--r--src/main/java/org/onap/aai/migration/Migrator.java74
-rw-r--r--src/main/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigration.java13
-rw-r--r--src/main/java/org/onap/aai/migration/v12/MigrateHUBEvcInventory.java10
-rw-r--r--src/main/java/org/onap/aai/migration/v12/MigrateINVEvcInventory.java9
-rw-r--r--src/main/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventory.java6
-rw-r--r--src/main/java/org/onap/aai/migration/v12/MigratePATHEvcInventory.java27
-rw-r--r--src/main/java/org/onap/aai/migration/v12/MigrateSAREvcInventory.java47
-rw-r--r--src/main/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigration.java1
-rw-r--r--src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java6
-rw-r--r--src/main/java/org/onap/aai/migration/v12/UriMigration.java31
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java1
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwo.java10
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitId.java37
-rw-r--r--src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java16
-rw-r--r--src/main/java/org/onap/aai/migration/v14/MigrateSdnaIvlanData.java3
-rw-r--r--src/main/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycle.java8
-rw-r--r--src/main/java/org/onap/aai/migration/v15/MigrateRadcomChanges.java38
-rw-r--r--src/main/java/org/onap/aai/migration/v20/MigrateVlanTag.java1
-rw-r--r--src/main/java/org/onap/aai/util/SendDeleteMigrationNotificationsMain.java2
-rw-r--r--src/main/java/org/onap/aai/util/SendMigrationNotificationsMain.java2
-rw-r--r--src/main/resources/application.properties8
-rw-r--r--src/test/java/org/onap/aai/MetricsConfigurationTest.java136
-rw-r--r--src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java39
-rw-r--r--src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java2
-rw-r--r--src/test/resources/application-test.properties6
36 files changed, 450 insertions, 296 deletions
diff --git a/pom.xml b/pom.xml
index 74c774d..13700ca 100755
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,13 @@
<schema.version.list>v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21,v22,v23,v24</schema.version.list>
<schema.uri.base.path>/aai</schema.uri.base.path>
<!-- End of Default ONAP Schema Properties -->
+
+ <!-- Start of graphadmin metric collection Properties -->
+ <micrometer.core.version>1.8.1</micrometer.core.version>
+ <micrometer.registry.prometheus.version>1.8.1</micrometer.registry.prometheus.version>
+ <micrometer.jersey2.version>1.8.1</micrometer.jersey2.version>
+ <spring.boot.starter.actuator.version>2.1.12.RELEASE</spring.boot.starter.actuator.version>
+ <!-- End of graphadmin metric collection Properties -->
</properties>
<profiles>
@@ -336,6 +343,24 @@
</profiles>
<dependencies>
+ <!-- Start of graphadmin metric collection dependencies -->
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-core</artifactId>
+ <version>${micrometer.core.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-registry-prometheus</artifactId>
+ <version>${micrometer.registry.prometheus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-jersey2</artifactId>
+ <version>${micrometer.jersey2.version}</version>
+ </dependency>
+ <!-- End of graphadmin metric collection dependencies -->
+
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
@@ -571,6 +596,17 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ <version>${spring.boot.starter.actuator.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
diff --git a/src/main/java/org/onap/aai/audit/AuditGraphson2Sql.java b/src/main/java/org/onap/aai/audit/AuditGraphson2Sql.java
index ff29157..73c07b8 100644
--- a/src/main/java/org/onap/aai/audit/AuditGraphson2Sql.java
+++ b/src/main/java/org/onap/aai/audit/AuditGraphson2Sql.java
@@ -22,39 +22,38 @@ package org.onap.aai.audit;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
-import org.apache.tinkerpop.gremlin.structure.Direction;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.javatuples.Triplet;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.EdgeRule;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
-import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
-import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.rest.client.ApertureService;
import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.util.AAIConfig;
-import org.onap.aai.util.AAIConstants;
-import org.onap.aai.util.ExceptionTranslator;
import org.onap.aai.util.FormatDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-
-import java.io.*;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import com.att.eelf.configuration.Configuration;
import org.springframework.stereotype.Component;
@Component
@@ -515,7 +514,6 @@ public class AuditGraphson2Sql {
String msg = "DEBUG -- Error while processing nodes ------";
LOGGER.debug(msg);
System.out.println(msg);
- e.printStackTrace();
}
}// End of looping over all files
diff --git a/src/main/java/org/onap/aai/datacleanup/DataCleanupTasks.java b/src/main/java/org/onap/aai/datacleanup/DataCleanupTasks.java
index 99b1619..df79335 100644
--- a/src/main/java/org/onap/aai/datacleanup/DataCleanupTasks.java
+++ b/src/main/java/org/onap/aai/datacleanup/DataCleanupTasks.java
@@ -193,7 +193,7 @@ public class DataCleanupTasks {
if(!flag)
logger.debug("Failed to create ARCHIVE folder");
}
- try(FileOutputStream outputstream = new FileOutputStream(zipFile + ".gz");
+ try(FileOutputStream outputstream = new FileOutputStream(zipFile + ".zip");
ZipOutputStream zoutputstream = new ZipOutputStream(outputstream);
FileInputStream inputstream = new FileInputStream(file)) {
ZipEntry ze = new ZipEntry(file.getName());
diff --git a/src/main/java/org/onap/aai/datagrooming/DataGrooming.java b/src/main/java/org/onap/aai/datagrooming/DataGrooming.java
index 3884a01..0718dff 100644
--- a/src/main/java/org/onap/aai/datagrooming/DataGrooming.java
+++ b/src/main/java/org/onap/aai/datagrooming/DataGrooming.java
@@ -19,6 +19,9 @@
*/
package org.onap.aai.datagrooming;
+import com.att.eelf.configuration.Configuration;
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -36,7 +39,6 @@ import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.UUID;
-
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -46,11 +48,10 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.onap.aai.GraphAdminApp;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
-import org.onap.aai.util.GraphAdminConstants;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.janusgraph.core.JanusGraph;
import org.onap.aai.dbmap.AAIGraph;
+import org.onap.aai.edges.enums.AAIDirection;
+import org.onap.aai.edges.enums.EdgeProperty;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
@@ -59,19 +60,16 @@ import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.LogFormatTools;
-import org.onap.aai.edges.enums.AAIDirection;
-import org.onap.aai.edges.enums.EdgeProperty;
+import org.onap.aai.restclient.PropertyPasswordConfiguration;
import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.util.*;
-
-import com.att.eelf.configuration.Configuration;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
+import org.onap.aai.util.AAISystemExitUtil;
+import org.onap.aai.util.ExceptionTranslator;
+import org.onap.aai.util.FormatDate;
+import org.onap.aai.util.GraphAdminConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.beust.jcommander.JCommander;
-import com.beust.jcommander.Parameter;
-
-import org.janusgraph.core.JanusGraph;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@@ -2159,32 +2157,31 @@ public class DataGrooming {
// uniqueness, and we
// found more than one node using its key -- record the found
// vertices as duplicates.
- String dupesStr = "";
- for (int i = 0; i < checkVertList.size(); i++) {
- dupesStr = dupesStr
- + ((checkVertList.get(i))).id()
- .toString() + "|";
+ StringBuilder dupesStr = new StringBuilder();
+ for (Vertex vertex : checkVertList) {
+ dupesStr.append(vertex.id()
+ .toString()).append("|");
}
- if (dupesStr != "") {
+ if (dupesStr.length() > 0) {
Vertex prefV = getPreferredDupe(transId, fromAppId,
source, checkVertList, version, loader);
if (prefV == null) {
// We could not determine which duplicate to keep
- dupesStr = dupesStr + "KeepVid=UNDETERMINED";
- returnList.add(dupesStr);
+ dupesStr.append("KeepVid=UNDETERMINED");
+ returnList.add(dupesStr.toString());
} else {
- dupesStr = dupesStr + "KeepVid=" + prefV.id();
+ dupesStr.append("KeepVid=").append(prefV.id());
Boolean didRemove = false;
if (dupeFixOn) {
didRemove = deleteNonKeepersIfAppropriate(g,
- dupesStr, prefV.id().toString(),
+ dupesStr.toString(), prefV.id().toString(),
deleteCandidateList);
}
if (didRemove) {
dupeGrpsDeleted++;
} else {
// keep them on our list
- returnList.add(dupesStr);
+ returnList.add(dupesStr.toString());
}
}
}
@@ -2206,13 +2203,11 @@ public class DataGrooming {
if (thisParentsVertList.size() > 1) {
// More than one vertex found with the same key info
// hanging off the same parent/dependent node
- String dupesStr = "";
- for (int i = 0; i < thisParentsVertList.size(); i++) {
- dupesStr = dupesStr
- + ((thisParentsVertList
- .get(i))).id() + "|";
+ StringBuilder dupesStr = new StringBuilder();
+ for (Vertex vertex : thisParentsVertList) {
+ dupesStr.append(vertex.id()).append("|");
}
- if (dupesStr != "") {
+ if (dupesStr.length() > 0) {
Vertex prefV = getPreferredDupe(transId,
fromAppId, source, thisParentsVertList,
version, loader);
@@ -2220,15 +2215,14 @@ public class DataGrooming {
if (prefV == null) {
// We could not determine which duplicate to
// keep
- dupesStr = dupesStr + "KeepVid=UNDETERMINED";
- returnList.add(dupesStr);
+ dupesStr.append("KeepVid=UNDETERMINED");
+ returnList.add(dupesStr.toString());
} else {
Boolean didRemove = false;
- dupesStr = dupesStr + "KeepVid="
- + prefV.id().toString();
+ dupesStr.append("KeepVid=").append(prefV.id().toString());
if (dupeFixOn) {
didRemove = deleteNonKeepersIfAppropriate(
- g, dupesStr, prefV.id()
+ g, dupesStr.toString(), prefV.id()
.toString(),
deleteCandidateList );
}
@@ -2236,7 +2230,7 @@ public class DataGrooming {
dupeGrpsDeleted++;
} else {
// keep them on our list
- returnList.add(dupesStr);
+ returnList.add(dupesStr.toString());
}
}
}
diff --git a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java
index 946489b..a9312b2 100644
--- a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java
+++ b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java
@@ -564,7 +564,7 @@ public class DataSnapshot {
//
LOGGER.debug(" Command = " + command );
- if (cArgs.oldFileDir != null && cArgs.oldFileDir != ""){
+ if (cArgs.oldFileDir != null && !cArgs.oldFileDir.isEmpty()){
targetDir = cArgs.oldFileDir;
}
ArrayList <File> snapFilesArr = getFilesToProcess(targetDir, oldSnapshotFileName, false);
diff --git a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java
index 9aba8cf..35448e4 100644
--- a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java
+++ b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java
@@ -582,7 +582,7 @@ public class DataSnapshot4HistInit {
//
LOGGER.debug(" Command = " + command );
- if (cArgs.oldFileDir != null && cArgs.oldFileDir != ""){
+ if (cArgs.oldFileDir != null && !cArgs.oldFileDir.isEmpty()){
targetDir = cArgs.oldFileDir;
}
ArrayList <File> snapFilesArr = getFilesToProcess(targetDir, oldSnapshotFileName, false);
diff --git a/src/main/java/org/onap/aai/datasnapshot/PartialVertexLoader.java b/src/main/java/org/onap/aai/datasnapshot/PartialVertexLoader.java
index 22ca0a2..8ed8087 100644
--- a/src/main/java/org/onap/aai/datasnapshot/PartialVertexLoader.java
+++ b/src/main/java/org/onap/aai/datasnapshot/PartialVertexLoader.java
@@ -19,19 +19,17 @@
*/
package org.onap.aai.datasnapshot;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashMap;
import java.util.concurrent.Callable;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
import org.janusgraph.core.JanusGraph;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
@@ -96,7 +94,6 @@ public class PartialVertexLoader implements Callable<HashMap<String,String>>{
Thread.sleep(failurePauseMs); // Slow down if things are failing
LOGGER.debug(" >> addVertex FAILED for vtxId = " + oldVtxIdStr + ", label = ["
+ vtxLabelStr + "]. ErrorMsg = [" + e.getMessage() + "]" );
- //e.printStackTrace();
failedAttemptHash.put(oldVtxIdStr, vtxLabelStr);
if( failureCount > maxAllowedErrors ) {
LOGGER.debug(" >>> Abandoning PartialVertexLoader() because " +
@@ -116,7 +113,6 @@ public class PartialVertexLoader implements Callable<HashMap<String,String>>{
Thread.sleep(failurePauseMs); // Slow down if things are failing
LOGGER.debug(" -- COMMIT FAILED for Vtx ADD for vtxId = " + oldVtxIdStr + ", label = ["
+ vtxLabelStr + "]. ErrorMsg = [" +e.getMessage() + "]" );
- //e.printStackTrace();
failedAttemptHash.put(oldVtxIdStr, vtxLabelStr);
if( failureCount > maxAllowedErrors ) {
LOGGER.debug(">>> Abandoning PartialVertexLoader() because " +
diff --git a/src/main/java/org/onap/aai/dbgen/DupeTool.java b/src/main/java/org/onap/aai/dbgen/DupeTool.java
index 0532e2e..43b1e8e 100644
--- a/src/main/java/org/onap/aai/dbgen/DupeTool.java
+++ b/src/main/java/org/onap/aai/dbgen/DupeTool.java
@@ -558,24 +558,23 @@ public class DupeTool {
try {
if (!vidList.isEmpty() && vidList.size() > 1) {
// There are more than one vertex id's using the same key info
- String dupesStr = "";
+ StringBuilder dupesStr = new StringBuilder();
ArrayList<Vertex> vertList = new ArrayList<>();
- for (int i = 0; i < vidList.size(); i++) {
- String tmpVid = vidList.get(i);
- dupesStr = dupesStr + tmpVid + "|";
+ for (String tmpVid : vidList) {
+ dupesStr.append(tmpVid).append("|");
vertList.add(vtxHash.get(tmpVid));
}
- if (dupesStr != "") {
+ if (dupesStr.length() > 0) {
Vertex prefV = getPreferredDupe(transId, fromAppId,
g, vertList, version, specialTenantRule, loader, logger);
if (prefV == null) {
// We could not determine which duplicate to keep
- dupesStr = dupesStr + "KeepVid=UNDETERMINED";
- returnList.add(dupesStr);
+ dupesStr.append("KeepVid=UNDETERMINED");
+ returnList.add(dupesStr.toString());
} else {
- dupesStr = dupesStr + "KeepVid=" + prefV.id();
- returnList.add(dupesStr);
+ dupesStr.append("KeepVid=").append(prefV.id());
+ returnList.add(dupesStr.toString());
}
}
}
@@ -689,25 +688,22 @@ public class DupeTool {
if (thisParentsVertList.size() > 1) {
// More than one vertex found with the same key info
// hanging off the same parent/dependent node
- String dupesStr = "";
- for (int i = 0; i < thisParentsVertList.size(); i++) {
- dupesStr = dupesStr
- + ((thisParentsVertList
- .get(i))).id() + "|";
+ StringBuilder dupesStr = new StringBuilder();
+ for (Vertex vertex : thisParentsVertList) {
+ dupesStr.append(vertex.id()).append("|");
}
- if (dupesStr != "") {
+ if (dupesStr.toString().length() > 0) {
Vertex prefV = getPreferredDupe(transId,
fromAppId, g, thisParentsVertList,
version, specialTenantRule, loader, logger);
if (prefV == null) {
// We could not determine which duplicate to keep
- dupesStr = dupesStr + "KeepVid=UNDETERMINED";
- returnList.add(dupesStr);
+ dupesStr.append("KeepVid=UNDETERMINED");
+ returnList.add(dupesStr.toString());
} else {
- dupesStr = dupesStr + "KeepVid="
- + prefV.id().toString();
- returnList.add(dupesStr);
+ dupesStr.append("KeepVid=").append(prefV.id().toString());
+ returnList.add(dupesStr.toString());
}
}
}
@@ -1422,10 +1418,8 @@ public class DupeTool {
// ie. "3456|9880|keepVid=3456"
boolean didADelFlag = false;
- for (int n = 0; n < dupeInfoList.size(); n++) {
- String dupeInfoString = dupeInfoList.get(n);
- boolean tmpFlag = deleteNonKeeperForOneSet(g, dupeInfoString, logger);
- didADelFlag = tmpFlag | didADelFlag;
+ for (String dupeInfoString : dupeInfoList) {
+ didADelFlag |= deleteNonKeeperForOneSet(g, dupeInfoString, logger);
}
return didADelFlag;
diff --git a/src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java b/src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java
index 032fc9e..9a6094b 100644
--- a/src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java
+++ b/src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java
@@ -68,7 +68,7 @@ public class UpdatePropertyTool {
try {
EXIT_VM_STATUS_CODE = updatePropertyToolInternal.run(graph, args) ? EXIT_VM_STATUS_CODE_SUCCESS : EXIT_VM_STATUS_CODE_FAILURE;
} catch (Exception e) {
- e.printStackTrace();
+ System.out.println("Exception : " + e.getMessage());
EXIT_VM_STATUS_CODE = EXIT_VM_STATUS_CODE_FAILURE;
} finally {
updatePropertyToolInternal.closeGraph(graph);
diff --git a/src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java b/src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java
index e0adec0..8d7114e 100644
--- a/src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java
+++ b/src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java
@@ -203,12 +203,10 @@ public class HistoryTruncate {
} catch (AAIException e) {
ErrorLogHelper.logError("AAI_6128", e.getMessage());
LOGGER.error("Encountered an exception during the historyTruncate: ", e);
- e.printStackTrace();
successStatus = false;
} catch (Exception ex) {
ErrorLogHelper.logError("AAI_6128", ex.getMessage());
LOGGER.error("Encountered an exception during the historyTruncate: ", ex);
- ex.printStackTrace();
successStatus = false;
} finally {
if (jgraph != null ) {
diff --git a/src/main/java/org/onap/aai/migration/MigrationController.java b/src/main/java/org/onap/aai/migration/MigrationController.java
index 5e969bf..8cecad4 100644
--- a/src/main/java/org/onap/aai/migration/MigrationController.java
+++ b/src/main/java/org/onap/aai/migration/MigrationController.java
@@ -19,20 +19,17 @@
*/
package org.onap.aai.migration;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.restclient.PropertyPasswordConfiguration;
import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.util.AAIConstants;
import org.onap.aai.util.ExceptionTranslator;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import java.util.UUID;
-
/**
* Wrapper class to allow {@link org.onap.aai.migration.MigrationControllerInternal MigrationControllerInternal}
* to be run from a shell script
@@ -72,7 +69,7 @@ public class MigrationController {
try {
internal.run(args);
} catch (Exception e) {
- e.printStackTrace();
+ System.out.println("Exception : " + e.getMessage());
}
AAIGraph.getInstance().graphShutdown();
System.exit(0);
diff --git a/src/main/java/org/onap/aai/migration/Migrator.java b/src/main/java/org/onap/aai/migration/Migrator.java
index 9498cd1..57291e0 100644
--- a/src/main/java/org/onap/aai/migration/Migrator.java
+++ b/src/main/java/org/onap/aai/migration/Migrator.java
@@ -29,7 +29,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
-
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -154,47 +153,52 @@ public abstract class Migrator implements Runnable {
/**
* Create files containing data for dmaap delete Event Generation
- * @param dmaapVertexList
+ * @param dmaapDeleteIntrospectorList
*/
- public void createDmaapFilesForDelete(List<Introspector> dmaapDeleteIntrospectorList) {try {
- System.out.println("dmaapDeleteIntrospectorList :: " + dmaapDeleteIntrospectorList.size());
- String fileName = "DELETE-"+ getMigrationName() + "-" + UUID.randomUUID();
- String logDirectory = System.getProperty("AJSC_HOME") + "/logs/data/dmaapEvents/";
- File f = new File(logDirectory);
- f.mkdirs();
-
- try{
- Files.createFile(Paths.get(logDirectory + "/" + fileName));
- }catch(Exception e) {
- e.printStackTrace();
- }
-
- if (dmaapDeleteIntrospectorList.size() > 0) {
- dmaapDeleteIntrospectorList.stream().forEach(svIntr-> {
- try {
- String str = svIntr.marshal(false);
- String finalStr="";
+ public void createDmaapFilesForDelete(List<Introspector> dmaapDeleteIntrospectorList) {
+ try {
+ System.out.println("dmaapDeleteIntrospectorList :: " + dmaapDeleteIntrospectorList.size());
+ String fileName = "DELETE-" + getMigrationName() + "-" + UUID.randomUUID();
+ String logDirectory = System.getProperty("AJSC_HOME") + "/logs/data/dmaapEvents/";
+ File f = new File(logDirectory);
+ f.mkdirs();
+
+ try {
+ Files.createFile(Paths.get(logDirectory + "/" + fileName));
+ } catch (Exception e) {
+ logger.error("Unable to create file", e);
+ }
+
+ if (dmaapDeleteIntrospectorList.size() > 0) {
+ dmaapDeleteIntrospectorList.stream().forEach(svIntr -> {
try {
- finalStr=svIntr.getName() + "#@#" + svIntr.getURI() + "#@#" + str+"\n";
- Files.write(Paths.get(logDirectory + "/" + fileName),finalStr.getBytes(),StandardOpenOption.APPEND);
- } catch (IOException e) {
- System.out.println("Unable to generate file with dmaap msgs for " + getMigrationName() +
- " Exception is: " + e.getMessage());
- logger.error("Unable to generate file with dmaap msgs for "+getMigrationName(), e);
- }
+ String str = svIntr.marshal(false);
+ String finalStr = "";
+ try {
+ finalStr =
+ svIntr.getName() + "#@#" + svIntr.getURI() + "#@#" + str + "\n";
+ Files.write(Paths.get(logDirectory + "/" + fileName),
+ finalStr.getBytes(), StandardOpenOption.APPEND);
+ } catch (IOException e) {
+ System.out.println("Unable to generate file with dmaap msgs for " +
+ getMigrationName() +
+ " Exception is: " + e.getMessage());
+ logger.error("Unable to generate file with dmaap msgs for " +
+ getMigrationName(), e);
+ }
- }catch (Exception e) {
+ } catch (Exception e) {
// TODO Auto-generated catch block
- e.printStackTrace();
+ System.out.println("Exception : " + e.getMessage());
}
});
-
+
//Files.write(Paths.get(logDirectory+"/"+fileName), (Iterable<Vertex>)dmaapVertexList.stream()::iterator);
- }
- }catch (Exception e) {
- e.printStackTrace();
- logger.error("Unable to generate file with dmaap msgs for "+getMigrationName(), e);
- }}
+ }
+ } catch (Exception e) {
+ logger.error("Unable to generate file with dmaap msgs for " + getMigrationName(), e);
+ }
+ }
/**
* As string.
diff --git a/src/main/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigration.java b/src/main/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigration.java
index ef45209..135685c 100644
--- a/src/main/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigration.java
+++ b/src/main/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigration.java
@@ -82,15 +82,15 @@ public class ALTSLicenseEntitlementMigration extends Migrator{
logger.info("\n");
if (!vnfLine.isEmpty()) {
if (fileLineCounter != 0) {
- String[] fields = vnfLine.split("\\s*,\\s*", -1);
+ String[] fields = vnfLine.split(",", -1);
if (fields.length != this.headerLength) {
logger.info("ERROR: Vnf line should contain " + this.headerLength + " columns, contains " + fields.length + " instead.");
success = false;
continue;
}
- String newResourceUuid = fields[0];
- String groupUuid = fields[1];
- String vnfId = fields[19];
+ String newResourceUuid = fields[0].trim();
+ String groupUuid = fields[1].trim();
+ String vnfId = fields[19].trim();
logger.info("---------- Processing Line " + vnfLine + "----------");
logger.info("newResourceUuid = " + newResourceUuid + " vnfId = " + vnfId + " group uuid = " + groupUuid);
if (history.containsKey(vnfId)){
@@ -104,7 +104,7 @@ public class ALTSLicenseEntitlementMigration extends Migrator{
}
}
else {
- Set newSet = new HashSet();
+ Set<String> newSet = new HashSet<>();
newSet.add(groupUuid);
history.put(vnfId, newSet);
}
@@ -120,7 +120,7 @@ public class ALTSLicenseEntitlementMigration extends Migrator{
this.ChangeResourceUuid(licenses, newResourceUuid, "license", vnfId, groupUuid);
} else {
- this.headerLength = vnfLine.split("\\s*,\\s*", -1).length;
+ this.headerLength = vnfLine.split(",", -1).length;
logger.info("headerLength: " + headerLength);
if (this.headerLength < 22){
logger.info("ERROR: Input file should have 22 columns");
@@ -139,7 +139,6 @@ public class ALTSLicenseEntitlementMigration extends Migrator{
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
diff --git a/src/main/java/org/onap/aai/migration/v12/MigrateHUBEvcInventory.java b/src/main/java/org/onap/aai/migration/v12/MigrateHUBEvcInventory.java
index 0b3103b..97936d7 100644
--- a/src/main/java/org/onap/aai/migration/v12/MigrateHUBEvcInventory.java
+++ b/src/main/java/org/onap/aai/migration/v12/MigrateHUBEvcInventory.java
@@ -120,16 +120,16 @@ public class MigrateHUBEvcInventory extends Migrator {
logger.info("\n");
if (!line.isEmpty()) {
if (fileLineCounter != 0) {
- String[] colList = line.split("\\s*,\\s*", -1);
+ String[] colList = line.split(",", -1);
// if (colList.length != headerLength) {
// logger.info("ERROR: HUB line entry should contain " + headerLength + " columns, contains " + colList.length + " instead.");
// success = false;
// continue;
// }
Map<String, String> hubColValues = new HashMap<String, String>();
- hubColValues.put("ivlan", colList[1]);
- hubColValues.put("nniSvlan", colList[3]);
- hubColValues.put("evcName", colList[4]);
+ hubColValues.put("ivlan", colList[1].trim());
+ hubColValues.put("nniSvlan", colList[3].trim());
+ hubColValues.put("evcName", colList[4].trim());
String evcName = hubColValues.get("evcName");
String ivlan = hubColValues.get("ivlan");
@@ -169,7 +169,7 @@ public class MigrateHUBEvcInventory extends Migrator {
}
}
} else {
- this.headerLength = line.split("\\s*,\\s*", -1).length;
+ this.headerLength = line.split(",", -1).length;
logger.info("headerLength: " + headerLength);
if (this.headerLength < 5){
logger.info("ERROR: Input file should have 5 columns");
diff --git a/src/main/java/org/onap/aai/migration/v12/MigrateINVEvcInventory.java b/src/main/java/org/onap/aai/migration/v12/MigrateINVEvcInventory.java
index a9fce6a..de97408 100644
--- a/src/main/java/org/onap/aai/migration/v12/MigrateINVEvcInventory.java
+++ b/src/main/java/org/onap/aai/migration/v12/MigrateINVEvcInventory.java
@@ -112,14 +112,14 @@ public class MigrateINVEvcInventory extends Migrator {
logger.info("\n");
if (!line.isEmpty()) {
if (fileLineCounter != 0) {
- String[] colList = line.split("\\s*,\\s*", -1);
+ String[] colList = line.split(",", -1);
if (colList.length != headerLength) {
logger.info("ERROR: INV line should contain " + headerLength + " columns, contains " + colList.length + " instead.");
continue;
}
Map<String, String> invColValues = new HashMap<String, String>();
- invColValues.put("evcName", colList[22]);
- invColValues.put("collectorInterconnectType", colList[17]);
+ invColValues.put("evcName", colList[22].trim());
+ invColValues.put("collectorInterconnectType", colList[17].trim());
String evcName = invColValues.get("evcName");
String interconnectType = invColValues.get("collectorInterconnectType");
@@ -152,7 +152,7 @@ public class MigrateINVEvcInventory extends Migrator {
continue;
}
} else {
- this.headerLength = line.split("\\s*,\\s*", -1).length;
+ this.headerLength = line.split(",", -1).length;
logger.info("headerLength: " + headerLength);
if (this.headerLength < 23){
logger.info("ERROR: Input file should have 23 columns");
@@ -183,7 +183,6 @@ public class MigrateINVEvcInventory extends Migrator {
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
diff --git a/src/main/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventory.java b/src/main/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventory.java
index 0c85481..ade7ec3 100644
--- a/src/main/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventory.java
+++ b/src/main/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventory.java
@@ -39,6 +39,7 @@ package org.onap.aai.migration.v12;
*/
+import java.util.stream.Collectors;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.javatuples.Pair;
@@ -125,7 +126,6 @@ public class MigrateINVPhysicalInventory extends Migrator {
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
@@ -231,7 +231,7 @@ public class MigrateINVPhysicalInventory extends Migrator {
lines.stream()
.filter(line -> !line.isEmpty())
- .map(line -> Arrays.asList(line.split("\\s*,\\s*", -1)))
+ .map(line -> Arrays.stream(line.split(",", -1)).map(String::trim).collect(Collectors.toList()))
// .filter(this::verifyLine)
.map(this::processLine)
.filter(Optional::isPresent)
@@ -316,7 +316,7 @@ public class MigrateINVPhysicalInventory extends Migrator {
firstLine = lines.get(0);
}
- this.headerLength = firstLine.split("\\s*,\\s*", -1).length;
+ this.headerLength = firstLine.split(",", -1).length;
logger.info("headerLength: " + headerLength);
if (this.headerLength < 21){
String msg = "ERROR: Input file should have 21 columns";
diff --git a/src/main/java/org/onap/aai/migration/v12/MigratePATHEvcInventory.java b/src/main/java/org/onap/aai/migration/v12/MigratePATHEvcInventory.java
index b0bacde..28b5b7b 100644
--- a/src/main/java/org/onap/aai/migration/v12/MigratePATHEvcInventory.java
+++ b/src/main/java/org/onap/aai/migration/v12/MigratePATHEvcInventory.java
@@ -136,25 +136,25 @@ public class MigratePATHEvcInventory extends Migrator {
logger.info("\n");
if (!line.isEmpty()) {
if (fileLineCounter != 0) {
- String[] colList = line.split("\\s*,\\s*", -1);
+ String[] colList = line.split(",", -1);
if (colList.length != headerLength) {
logger.info("ERROR: PATH line should contain " + headerLength + " columns, contains " + colList.length + " instead.");
// success = false;
continue;
}
Map<String, String> pathColValues = new HashMap<String, String>();
- pathColValues.put("evcName", colList[1]);
- pathColValues.put("bearerFacingCircuit", colList[4]);
- pathColValues.put("bearerCvlan", colList[6]);
- pathColValues.put("bearerSvlan", colList[7]);
- pathColValues.put("bearerPtniiName", colList[8]);
- String bearerPortAid = colList[12].replaceAll("^\"|\"$", "").replaceAll("\\s+","");
+ pathColValues.put("evcName", colList[1].trim());
+ pathColValues.put("bearerFacingCircuit", colList[4].trim());
+ pathColValues.put("bearerCvlan", colList[6].trim());
+ pathColValues.put("bearerSvlan", colList[7].trim());
+ pathColValues.put("bearerPtniiName", colList[8].trim());
+ String bearerPortAid = colList[12].trim().replaceAll("^\"|\"$", "").replaceAll("\\s+","");
pathColValues.put("bearerPortAid", bearerPortAid);
- pathColValues.put("collectorFacingCircuit", colList[14]);
- pathColValues.put("collectorCvlan", colList[16]);
- pathColValues.put("collectorSvlan", colList[17]);
- pathColValues.put("collectorPtniiName", colList[18]);
- String collectorPortAid = colList[22].replaceAll("^\"|\"$", "").replaceAll("\\s+","");
+ pathColValues.put("collectorFacingCircuit", colList[14].trim());
+ pathColValues.put("collectorCvlan", colList[16].trim());
+ pathColValues.put("collectorSvlan", colList[17].trim());
+ pathColValues.put("collectorPtniiName", colList[18].trim());
+ String collectorPortAid = colList[22].trim().replaceAll("^\"|\"$", "").replaceAll("\\s+","");
pathColValues.put("collectorPortAid", collectorPortAid);
@@ -202,7 +202,7 @@ public class MigratePATHEvcInventory extends Migrator {
}
}
} else {
- this.headerLength = line.split("\\s*,\\s*", -1).length;
+ this.headerLength = line.split(",", -1).length;
logger.info("headerLength: " + headerLength);
if (this.headerLength < 24){
logger.info("ERROR: Input file should have 24 columns");
@@ -232,7 +232,6 @@ public class MigratePATHEvcInventory extends Migrator {
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
diff --git a/src/main/java/org/onap/aai/migration/v12/MigrateSAREvcInventory.java b/src/main/java/org/onap/aai/migration/v12/MigrateSAREvcInventory.java
index a24d21a..2894883 100644
--- a/src/main/java/org/onap/aai/migration/v12/MigrateSAREvcInventory.java
+++ b/src/main/java/org/onap/aai/migration/v12/MigrateSAREvcInventory.java
@@ -131,36 +131,36 @@ public class MigrateSAREvcInventory extends Migrator {
logger.info("\n");
if (!line.isEmpty()) {
if (fileLineCounter != 0) {
- String[] colList = line.split("\\s*,\\s*", -1);
+ String[] colList = line.split(",", -1);
// if (colList.length != headerLength) {
// logger.info("ERROR: SAR line should contain " + headerLength + " columns, contains " + colList.length + " instead.");
// success = false;
// continue;
// }
Map<String, String> sarColValues = new HashMap<String, String>();
- sarColValues.put("evcName", colList[0]);
- sarColValues.put("subscriberName", colList[1]);
- sarColValues.put("espName", colList[2]);
- sarColValues.put("bearerCircuitId", colList[3]);
- sarColValues.put("bearerTagMode", colList[4]);
- sarColValues.put("bearerCvlan", colList[5]);
- sarColValues.put("bearerSvlan", colList[6]);
- sarColValues.put("bearerPtniiName", colList[7]);
- sarColValues.put("bearerSlotName", colList[8]);
- String bearerPortAid = colList[9].replaceAll("^\"|\"$", "").replaceAll("\\s+","");
+ sarColValues.put("evcName", colList[0].trim());
+ sarColValues.put("subscriberName", colList[1].trim());
+ sarColValues.put("espName", colList[2].trim());
+ sarColValues.put("bearerCircuitId", colList[3].trim());
+ sarColValues.put("bearerTagMode", colList[4].trim());
+ sarColValues.put("bearerCvlan", colList[5].trim());
+ sarColValues.put("bearerSvlan", colList[6].trim());
+ sarColValues.put("bearerPtniiName", colList[7].trim());
+ sarColValues.put("bearerSlotName", colList[8].trim());
+ String bearerPortAid = colList[9].trim().replaceAll("^\"|\"$", "").replaceAll("\\s+","");
sarColValues.put("bearerPortAid", bearerPortAid);
- sarColValues.put("bearerPortType", colList[10]);
- sarColValues.put("collectorCircuitId", colList[11]);
- sarColValues.put("collectorTagMode", colList[12]);
- sarColValues.put("collectorCvlan", colList[13]);
- sarColValues.put("collectorSvlan", colList[14]);
- sarColValues.put("collectorPtniiName", colList[15]);
- sarColValues.put("collectorSlotName", colList[16]);
- String collectorPortAid = colList[17].replaceAll("^\"|\"$", "").replaceAll("\\s+","");
+ sarColValues.put("bearerPortType", colList[10].trim());
+ sarColValues.put("collectorCircuitId", colList[11].trim());
+ sarColValues.put("collectorTagMode", colList[12].trim());
+ sarColValues.put("collectorCvlan", colList[13].trim());
+ sarColValues.put("collectorSvlan", colList[14].trim());
+ sarColValues.put("collectorPtniiName", colList[15].trim());
+ sarColValues.put("collectorSlotName", colList[16].trim());
+ String collectorPortAid = colList[17].trim().replaceAll("^\"|\"$", "").replaceAll("\\s+","");
sarColValues.put("collectorPortAid", collectorPortAid);
- sarColValues.put("collectorPortType", colList[18]);
- sarColValues.put("espEvcCircuitId", colList[19]);
- sarColValues.put("evcAccessCIR", colList[20]);
+ sarColValues.put("collectorPortType", colList[18].trim());
+ sarColValues.put("espEvcCircuitId", colList[19].trim());
+ sarColValues.put("evcAccessCIR", colList[20].trim());
String evcName = sarColValues.get("evcName");
if (!AAIConfig.isEmpty(evcName)) {
@@ -181,7 +181,7 @@ public class MigrateSAREvcInventory extends Migrator {
}
} else {
- this.headerLength = line.split("\\s*,\\s*", -1).length;
+ this.headerLength = line.split(",", -1).length;
logger.info("headerLength: " + headerLength);
if (this.headerLength < 21){
logger.info("ERROR: Input file should have 21 columns");
@@ -211,7 +211,6 @@ public class MigrateSAREvcInventory extends Migrator {
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
diff --git a/src/main/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigration.java b/src/main/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigration.java
index b420c57..d102f99 100644
--- a/src/main/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigration.java
+++ b/src/main/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigration.java
@@ -111,7 +111,6 @@ public class SDWANSpeedChangeMigration extends Migrator {
}
} catch (AAIException e) {
- e.printStackTrace();
success = false;
}
diff --git a/src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java b/src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java
index 6273f84..dbb892d 100644
--- a/src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java
+++ b/src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java
@@ -192,7 +192,7 @@ public class UpdateAaiUriIndexMigration extends Migrator {
.status(SchemaStatus.DISABLED)
.call();
} catch (Exception e) {
- e.printStackTrace();
+ logger.info("AwaitGraphIndexStatus error: " + e.getMessage());
}
}
@@ -260,7 +260,7 @@ public class UpdateAaiUriIndexMigration extends Migrator {
.status(SchemaStatus.REGISTERED)
.call();
} catch (Exception e) {
- e.printStackTrace();
+ logger.info("AwaitGraphIndexStatus error: " + e.getMessage());
}
}
@@ -279,7 +279,7 @@ public class UpdateAaiUriIndexMigration extends Migrator {
.status(SchemaStatus.ENABLED)
.call();
} catch (Exception e) {
- e.printStackTrace();
+ logger.info("AwaitGraphIndexStatus error: " + e.getMessage());
}
}
diff --git a/src/main/java/org/onap/aai/migration/v12/UriMigration.java b/src/main/java/org/onap/aai/migration/v12/UriMigration.java
index ed3b84d..4a55f71 100644
--- a/src/main/java/org/onap/aai/migration/v12/UriMigration.java
+++ b/src/main/java/org/onap/aai/migration/v12/UriMigration.java
@@ -19,31 +19,36 @@
*/
package org.onap.aai.migration.v12;
+import java.io.UnsupportedEncodingException;
import java.nio.charset.UnsupportedCharsetException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import javax.ws.rs.core.UriBuilder;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.edges.EdgeIngestor;
+import org.onap.aai.edges.enums.AAIDirection;
import org.onap.aai.edges.enums.EdgeProperty;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
-import org.onap.aai.serialization.db.EdgeSerializer;
-import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
-import org.onap.aai.migration.*;
-import org.onap.aai.edges.enums.AAIDirection;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Migrator;
+import org.onap.aai.migration.Status;
import org.onap.aai.serialization.db.DBSerializer;
+import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
import org.springframework.web.util.UriUtils;
-import javax.ws.rs.core.UriBuilder;
-import java.io.UnsupportedEncodingException;
-import java.util.*;
-import java.util.stream.Collectors;
-
//@Enabled
@MigrationPriority(1000)
@@ -99,12 +104,8 @@ public class UriMigration extends Migrator {
logger.info(topLevelNodeType + " : " + parentSet.size());
try {
this.verifyOrAddUri("", parentSet);
- } catch (AAIUnknownObjectException e) {
- e.printStackTrace();
- } catch (AAIException e) {
- e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
+ } catch (UnsupportedEncodingException | AAIException e) {
+ logger.info("VerifyOrAddUri error: " + e.getMessage());
}
});
logger.info("RUNTIME: " + (System.currentTimeMillis() - start));
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java b/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java
index 1d5843e..15649e1 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java
@@ -254,7 +254,6 @@ public class MigrateBadWidgetModelsPartOne extends EdgeSwingMigrator {
success = false;
} catch (Exception e) {
logger.error("encountered exception", e);
- e.printStackTrace();
success = false;
}
return fileLines;
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwo.java b/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwo.java
index 7363d3c..d127c9e 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwo.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwo.java
@@ -25,13 +25,9 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
-import java.util.Set;
-
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Direction;
@@ -41,7 +37,10 @@ import org.javatuples.Pair;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.EdgeSwingMigrator;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Status;
import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import org.onap.aai.setup.SchemaVersions;
@@ -420,7 +419,6 @@ public class MigrateBadWidgetModelsPartTwo extends EdgeSwingMigrator {
success = false;
} catch (Exception e) {
logger.error("encountered exception", e);
- e.printStackTrace();
success = false;
}
return fileLines;
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitId.java b/src/main/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitId.java
index 0edff80..6c2b795 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitId.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitId.java
@@ -47,14 +47,12 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
-
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.Enabled;
import org.onap.aai.migration.MigrationDangerRating;
import org.onap.aai.migration.MigrationPriority;
import org.onap.aai.migration.Migrator;
@@ -156,20 +154,20 @@ public class MigrateForwarderEvcCircuitId extends Migrator {
String line = lineItr.next().replace("\n", "").replace("\r", "");
if (!line.isEmpty()) {
if (fileLineCounter != 0) {
- String[] colList = line.split("\\s*,\\s*", -1);
+ String[] colList = line.split(",", -1);
CircuitIdFileData lineData = new CircuitIdFileData();
- lineData.setPnfName(colList[0].replaceAll("^\"|\"$", "")
+ lineData.setPnfName(colList[0].trim().replaceAll("^\"|\"$", "")
.replaceAll("[\t\n\r]+", "").trim());
- lineData.setInterfaceName(colList[1].replaceAll("^\"|\"$", "")
+ lineData.setInterfaceName(colList[1].trim().replaceAll("^\"|\"$", "")
.replaceAll("[\t\n\r]+", "").trim());
- lineData.setOldCircuitId(colList[2].replaceAll("^\"|\"$", "")
+ lineData.setOldCircuitId(colList[2].trim().replaceAll("^\"|\"$", "")
.replaceAll("[\t\n\r]+", "").trim());
- lineData.setNewCircuitId(colList[4].replaceAll("^\"|\"$", "")
+ lineData.setNewCircuitId(colList[4].trim().replaceAll("^\"|\"$", "")
.replaceAll("[\t\n\r]+", "").trim());
circuitIdList.add(lineData);
} else {
- this.headerLength = line.split("\\s*,\\s*", -1).length;
+ this.headerLength = line.split(",", -1).length;
logger.info("headerLength: " + headerLength + "\n");
if (this.headerLength != 6){
logger.info(this.MIGRATION_ERROR + "ERROR: Input file should have 6 columns");
@@ -195,7 +193,6 @@ public class MigrateForwarderEvcCircuitId extends Migrator {
success = false;
} catch (Exception e) {
logger.info(this.MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
success = false;
}
}
@@ -209,7 +206,7 @@ public class MigrateForwarderEvcCircuitId extends Migrator {
.has(this.PROPERTY_FORWARDER_ROLE, this.VALUE_INGRESS).has(this.PROPERTY_SEQUENCE, this.VALUE_EXPECTED_SEQUENCE)
.out("org.onap.relationships.inventory.Uses").in("org.onap.relationships.inventory.BelongsTo");
if(!nodeList.hasNext()) {
- logger.info(this.MIGRATION_ERROR + "ERROR: Failure to update Circuit Id " + circuitIdList.get(i).getOldCircuitId() +
+ logger.info(this.MIGRATION_ERROR + "ERROR: Failure to update Circuit Id " + circuitIdList.get(i).getOldCircuitId() +
" to " + circuitIdList.get(i).getNewCircuitId() + " Graph Traversal failed \n");
migrationFailure++;
}
@@ -218,30 +215,30 @@ public class MigrateForwarderEvcCircuitId extends Migrator {
boolean updateSuccess = false;
if (forwarderEvcVtx != null) {
logger.info("forwarder-evc-id is " + forwarderEvcVtx.value("forwarder-evc-id"));
- if(forwarderEvcVtx.property(PROPERTY_CIRCUIT_ID).isPresent() &&
+ if(forwarderEvcVtx.property(PROPERTY_CIRCUIT_ID).isPresent() &&
forwarderEvcVtx.value(PROPERTY_CIRCUIT_ID).equals(circuitIdList.get(i).getNewCircuitId())) {
- logger.info("Skipping Record: Old Collector CircuitId " + forwarderEvcVtx.value(PROPERTY_CIRCUIT_ID) +
+ logger.info("Skipping Record: Old Collector CircuitId " + forwarderEvcVtx.value(PROPERTY_CIRCUIT_ID) +
" is the same as New Collector CircuitId " + circuitIdList.get(i).getNewCircuitId() + "\n");
migrationFailure++;
}
else if(!circuitIdList.get(i).getNewCircuitId().isEmpty() &&
- forwarderEvcVtx.property(PROPERTY_CIRCUIT_ID).isPresent() &&
+ forwarderEvcVtx.property(PROPERTY_CIRCUIT_ID).isPresent() &&
circuitIdList.get(i).getOldCircuitId().equals(forwarderEvcVtx.value(PROPERTY_CIRCUIT_ID)))
{
try {
forwarderEvcVtx.property(PROPERTY_CIRCUIT_ID, circuitIdList.get(i).getNewCircuitId());
this.touchVertexProperties(forwarderEvcVtx, false);
updateSuccess = true;
-
+
} catch (Exception e) {
logger.info(e.toString());
- logger.info(this.MIGRATION_ERROR + "ERROR: Failure to update Circuit Id " + circuitIdList.get(i).getOldCircuitId() +
+ logger.info(this.MIGRATION_ERROR + "ERROR: Failure to update Circuit Id " + circuitIdList.get(i).getOldCircuitId() +
" to " + circuitIdList.get(i).getNewCircuitId() + "\n");
migrationFailure++;
-
+
}
if(updateSuccess) {
- String dmaapMsg = System.nanoTime() + "_" + forwarderEvcVtx.id().toString() + "_" +
+ String dmaapMsg = System.nanoTime() + "_" + forwarderEvcVtx.id().toString() + "_" +
forwarderEvcVtx.value("resource-version").toString();
dmaapMsgList.add(dmaapMsg);
logger.info("Update of Circuit Id " + circuitIdList.get(i).getOldCircuitId() + " to " +
@@ -249,14 +246,14 @@ public class MigrateForwarderEvcCircuitId extends Migrator {
migrationSuccess++;
}
}
- else if(!forwarderEvcVtx.property(PROPERTY_CIRCUIT_ID).isPresent())
+ else if(!forwarderEvcVtx.property(PROPERTY_CIRCUIT_ID).isPresent())
{
- logger.info(this.MIGRATION_ERROR + "ERROR: Old Collector Circuit Id not found " + circuitIdList.get(i).getOldCircuitId() +
+ logger.info(this.MIGRATION_ERROR + "ERROR: Old Collector Circuit Id not found " + circuitIdList.get(i).getOldCircuitId() +
" was not updated to " + circuitIdList.get(i).getNewCircuitId() + "\n");
migrationFailure++;
}
else {
- logger.info(this.MIGRATION_ERROR + "ERROR: Failure to update Circuit Id " + circuitIdList.get(i).getOldCircuitId() +
+ logger.info(this.MIGRATION_ERROR + "ERROR: Failure to update Circuit Id " + circuitIdList.get(i).getOldCircuitId() +
" to " + circuitIdList.get(i).getNewCircuitId() + "\n");
migrationFailure++;
}
diff --git a/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java b/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java
index a3085c9..ffe7266 100644
--- a/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java
+++ b/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java
@@ -145,24 +145,20 @@ public class MigrateSameSourcedRCTROPserverData extends EdgeSwingMigrator {
try {
logger.info("RCT pserver count: "+rctCount);
updateToLatestRCT(pserverTraversalRCT);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- } catch (AAIException e) {
- e.printStackTrace();
+ } catch (UnsupportedEncodingException | AAIException e) {
+ logger.info("UpdateToLatestRCT error: " + e.getMessage());
}
- List<Vertex> pserverTraversalRO = graphTraversalSource().V().has("aai-node-type", "pserver").has("source-of-truth", P.within("RO", "AAI-EXTENSIONS")).toList();
+ List<Vertex> pserverTraversalRO = graphTraversalSource().V().has("aai-node-type", "pserver").has("source-of-truth", P.within("RO", "AAI-EXTENSIONS")).toList();
int roCount = pserverTraversalRO.size();
try {
logger.info("RO pserver count: "+roCount);
updateToLatestRO(pserverTraversalRO);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- } catch (AAIException e) {
- e.printStackTrace();
+ } catch (UnsupportedEncodingException | AAIException e) {
+ logger.info("UpdateToLatestRO error: " + e.getMessage());
}
- logger.info ("\n \n ******* Migration Summary Counts for RCT and RO sourced pservers in A&AI ********* \n");
+ logger.info ("\n \n ******* Migration Summary Counts for RCT and RO sourced pservers in A&AI ********* \n");
logger.info(this.MIGRATION_SUMMARY_COUNT + "Total number of RCT pservers: " +rctCount);
logger.info(this.MIGRATION_SUMMARY_COUNT + "Duplicate RCT pserver count: "+ dupRctCount);
logger.info(this.MIGRATION_SUMMARY_COUNT + "Number of RCT updated: "+ rctPserversUpdatedCount);
diff --git a/src/main/java/org/onap/aai/migration/v14/MigrateSdnaIvlanData.java b/src/main/java/org/onap/aai/migration/v14/MigrateSdnaIvlanData.java
index 3c10ab6..a8c2f72 100644
--- a/src/main/java/org/onap/aai/migration/v14/MigrateSdnaIvlanData.java
+++ b/src/main/java/org/onap/aai/migration/v14/MigrateSdnaIvlanData.java
@@ -30,7 +30,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -38,7 +37,6 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.Enabled;
import org.onap.aai.migration.MigrationDangerRating;
import org.onap.aai.migration.MigrationPriority;
import org.onap.aai.migration.Migrator;
@@ -212,7 +210,6 @@ public class MigrateSdnaIvlanData extends Migrator {
success = false;
} catch (Exception e) {
logger.info(this.MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
success = false;
}
diff --git a/src/main/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycle.java b/src/main/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycle.java
index 6104d9d..fd8bf5b 100644
--- a/src/main/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycle.java
+++ b/src/main/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycle.java
@@ -32,6 +32,7 @@ import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.javatuples.Pair;
@@ -174,7 +175,6 @@ public class MigrateCloudRegionUpgradeCycle extends Migrator {
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
@@ -208,7 +208,7 @@ public class MigrateCloudRegionUpgradeCycle extends Migrator {
logger.info("Total rows count excluding header: " + lines.size());
- lines.stream().filter(line -> !line.isEmpty()).map(line -> Arrays.asList(line.split("\\s*,\\s*", -1)))
+ lines.stream().filter(line -> !line.isEmpty()).map(line -> Arrays.stream(line.split(",", -1)).map(String::trim).collect(Collectors.toList()))
.map(this::processRegionUpgradeCycle).filter(Optional::isPresent).map(Optional::get).forEach(p -> {
processedRowsCount.getAndIncrement();
String pnfName = p.getValue0();
@@ -219,7 +219,7 @@ public class MigrateCloudRegionUpgradeCycle extends Migrator {
fileContent.add(regionMap);
- lines.stream().filter(line -> !line.isEmpty()).map(line -> Arrays.asList(line.split("\\s*,\\s*", -1)))
+ lines.stream().filter(line -> !line.isEmpty()).map(line -> Arrays.stream(line.split(",", -1)).map(String::trim).collect(Collectors.toList()))
.map(this::processRegionAlias).filter(Optional::isPresent).map(Optional::get).forEach(p -> {
processedRowsCount.getAndIncrement();
String pnfName = p.getValue0();
@@ -319,7 +319,7 @@ public class MigrateCloudRegionUpgradeCycle extends Migrator {
firstLine = lines.get(0);
}
- this.headerLength = firstLine.split("\\s*,\\s*", -1).length;
+ this.headerLength = firstLine.split(",", -1).length;
logger.info("headerLength: " + headerLength);
if (this.headerLength < 4) {
String msg = "ERROR: Input file should have 4 columns";
diff --git a/src/main/java/org/onap/aai/migration/v15/MigrateRadcomChanges.java b/src/main/java/org/onap/aai/migration/v15/MigrateRadcomChanges.java
index 3ae17bd..db523cd 100644
--- a/src/main/java/org/onap/aai/migration/v15/MigrateRadcomChanges.java
+++ b/src/main/java/org/onap/aai/migration/v15/MigrateRadcomChanges.java
@@ -183,15 +183,15 @@ public class MigrateRadcomChanges extends EdgeSwingMigrator {
String line = lineItr.next().replace("\n", "").replace("\r", "");
if (!line.isEmpty()) {
if (typeFileLineCounter != 0) {
- String[] colList = line.split("\\s*,\\s*", -1);
- if(!colList[0].equalsIgnoreCase(SERVICE_MODEL_TYPE) && !colList[0].equalsIgnoreCase(RESOURCE_MODEL_TYPE)) {
- vfModuleFileLineList.add(new VfModuleFileData(colList[0], colList[5], colList[6]));
+ String[] colList = line.split(",", -1);
+ if(!colList[0].trim().equalsIgnoreCase(SERVICE_MODEL_TYPE) && !colList[0].trim().equalsIgnoreCase(RESOURCE_MODEL_TYPE)) {
+ vfModuleFileLineList.add(new VfModuleFileData(colList[0].trim(), colList[5].trim(), colList[6].trim()));
}
- if(!colList[1].isEmpty() && !fileTypeList.contains(colList[1])) {
- fileTypeList.add(colList[1]);
+ if(!colList[1].trim().isEmpty() && !fileTypeList.contains(colList[1].trim())) {
+ fileTypeList.add(colList[1].trim());
}
} else {
- this.headerLength = line.split("\\s*,\\s*", -1).length;
+ this.headerLength = line.split(",", -1).length;
logger.info("headerLength: " + headerLength + "\n");
if (this.headerLength != 7 ){
logger.info(MIGRATION_ERROR + "ERROR: Input file should have 7 columns");
@@ -211,7 +211,6 @@ public class MigrateRadcomChanges extends EdgeSwingMigrator {
success = false;
} catch (Exception e) {
logger.info(MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
success = false;
}
@@ -238,15 +237,15 @@ public class MigrateRadcomChanges extends EdgeSwingMigrator {
String line = lineItr.next().replace("\n", "").replace("\r", "");
if (!line.isEmpty()) {
if (modelFileLineCounter != 0) {
- String[] colList = line.split("\\s*,\\s*", -1);
- if(colList[1].equals(fileTypeList.get(i)) && colList[0].equalsIgnoreCase(SERVICE_MODEL_TYPE)) {
- newServiceModelInvariantId = colList[2];
- newServiceModelVersionId = colList[3];
+ String[] colList = line.split(",", -1);
+ if(colList[1].trim().equals(fileTypeList.get(i)) && colList[0].trim().equalsIgnoreCase(SERVICE_MODEL_TYPE)) {
+ newServiceModelInvariantId = colList[2].trim();
+ newServiceModelVersionId = colList[3].trim();
}
- else if(colList[1].equals(fileTypeList.get(i)) && colList[0].equalsIgnoreCase(RESOURCE_MODEL_TYPE)) {
- newResourceModelInvariantId = colList[2];
- newResourceModelVersionId = colList[3];
- newResourceModelCustomizationId = colList[4];
+ else if(colList[1].trim().equals(fileTypeList.get(i)) && colList[0].trim().equalsIgnoreCase(RESOURCE_MODEL_TYPE)) {
+ newResourceModelInvariantId = colList[2].trim();
+ newResourceModelVersionId = colList[3].trim();
+ newResourceModelCustomizationId = colList[4].trim();
}
}
}
@@ -261,12 +260,12 @@ public class MigrateRadcomChanges extends EdgeSwingMigrator {
String line = lineItr.next().replace("\n", "").replace("\r", "");
if (!line.isEmpty()) {
if (genericVnfFileLineCounter != 0) {
- String[] colList = line.split("\\s*,\\s*", -1);
- if(colList[1].equals(fileTypeList.get(i))) {
- genericVnfList.add(colList[0]);
+ String[] colList = line.split(",", -1);
+ if(colList[1].trim().equals(fileTypeList.get(i))) {
+ genericVnfList.add(colList[0].trim());
}
} else {
- this.headerLength = line.split("\\s*,\\s*", -1).length;
+ this.headerLength = line.split(",", -1).length;
logger.info("headerLength: " + headerLength + "\n");
if (this.headerLength != 2){
logger.info(MIGRATION_ERROR + "ERROR: Input file should have 2 columns");
@@ -288,7 +287,6 @@ public class MigrateRadcomChanges extends EdgeSwingMigrator {
success = false;
} catch (Exception e) {
logger.info(MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
success = false;
}
}
diff --git a/src/main/java/org/onap/aai/migration/v20/MigrateVlanTag.java b/src/main/java/org/onap/aai/migration/v20/MigrateVlanTag.java
index 0519cad..7452e2b 100644
--- a/src/main/java/org/onap/aai/migration/v20/MigrateVlanTag.java
+++ b/src/main/java/org/onap/aai/migration/v20/MigrateVlanTag.java
@@ -191,7 +191,6 @@ public class MigrateVlanTag extends EdgeSwingMigrator {
} catch (Exception e) {
logger.info("encountered exception", e.getMessage());
logger.error("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
diff --git a/src/main/java/org/onap/aai/util/SendDeleteMigrationNotificationsMain.java b/src/main/java/org/onap/aai/util/SendDeleteMigrationNotificationsMain.java
index 4297886..d846a50 100644
--- a/src/main/java/org/onap/aai/util/SendDeleteMigrationNotificationsMain.java
+++ b/src/main/java/org/onap/aai/util/SendDeleteMigrationNotificationsMain.java
@@ -70,7 +70,7 @@ public class SendDeleteMigrationNotificationsMain {
try {
internal.process(basePath);
} catch (Exception e) {
- e.printStackTrace();
+ // TODO Catch exception
}
AAIGraph.getInstance().graphShutdown();
System.exit(0);
diff --git a/src/main/java/org/onap/aai/util/SendMigrationNotificationsMain.java b/src/main/java/org/onap/aai/util/SendMigrationNotificationsMain.java
index 0eeaecd..e608284 100644
--- a/src/main/java/org/onap/aai/util/SendMigrationNotificationsMain.java
+++ b/src/main/java/org/onap/aai/util/SendMigrationNotificationsMain.java
@@ -71,7 +71,7 @@ public class SendMigrationNotificationsMain {
try {
internal.process(basePath);
} catch (Exception e) {
- e.printStackTrace();
+ System.out.println("SendMigrationNotifications process error : " + e.getMessage());
}
AAIGraph.getInstance().graphShutdown();
System.exit(0);
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 48c6de5..89f8bf7 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -86,3 +86,11 @@ aperture.service.ssl.trust-store=${server.local.startpath}etc/auth/aai_keystore
aperture.service.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
aperture.service.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
aperture.service.timeout-in-milliseconds=300000
+
+#To Expose the Prometheus scraping endpoint
+management.server.port=8448
+#To Enable Actuator Endpoint, you can override this to True in OOM charts
+management.endpoints.enabled-by-default=false
+#To Enable Actuator Endpoint, you can override this in OOM Charts
+#management.endpoints.web.exposure.include=info, health, loggers, prometheus
+management.metrics.web.server.auto-time-requests=false
diff --git a/src/test/java/org/onap/aai/MetricsConfigurationTest.java b/src/test/java/org/onap/aai/MetricsConfigurationTest.java
new file mode 100644
index 0000000..d0c0ce4
--- /dev/null
+++ b/src/test/java/org/onap/aai/MetricsConfigurationTest.java
@@ -0,0 +1,136 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+
+import java.io.UnsupportedEncodingException;
+import java.util.Base64;
+import java.util.Collections;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.onap.aai.config.SpringContextAware;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.restclient.PropertyPasswordConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.actuate.autoconfigure.web.server.LocalManagementPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.context.annotation.Import;
+import org.springframework.http.*;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.rules.SpringClassRule;
+import org.springframework.test.context.junit4.rules.SpringMethodRule;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * Test management endpoints against configuration resource.
+ */
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
+ classes = {SpringContextAware.class, GraphAdminApp.class})
+@ContextConfiguration(initializers = PropertyPasswordConfiguration.class, classes = {SpringContextAware.class})
+@Import(GraphAdminTestConfiguration.class)
+@TestPropertySource(locations = "classpath:application-test.properties")
+public class MetricsConfigurationTest {
+
+ @ClassRule
+ public static final SpringClassRule springClassRule = new SpringClassRule();
+
+ @Rule
+ public final SpringMethodRule springMethodRule = new SpringMethodRule();
+
+ @Autowired
+ RestTemplate restTemplate;
+
+ @LocalServerPort
+ int randomPort;
+
+ @LocalManagementPort
+ private long localManagementPort;
+
+ private HttpEntity<String> httpEntity;
+ private HttpEntity<String> httpEntityPut;
+ private HttpEntity<String> httpEntityPatch;
+ private String baseUrl;
+ private String actuatorUrl;
+ private HttpHeaders headers;
+
+ @BeforeClass
+ public static void setupConfig() throws AAIException {
+ System.setProperty("AJSC_HOME", "./");
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
+ }
+
+ @Before
+ public void setup() throws UnsupportedEncodingException {
+
+ headers = new HttpHeaders();
+
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.add("Real-Time", "true");
+ headers.add("X-FromAppId", "JUNIT");
+ headers.add("X-TransactionId", "JUNIT");
+
+ String authorization = Base64.getEncoder().encodeToString("AAI:AAI".getBytes("UTF-8"));
+ headers.add("Authorization", "Basic " + authorization);
+
+ httpEntity = new HttpEntity<String>(headers);
+ baseUrl = "http://localhost:" + randomPort;
+ actuatorUrl = "http://localhost:" + localManagementPort;
+ }
+
+
+ @Test
+ public void testManagementEndpointConfiguration() {
+ ResponseEntity responseEntity = null;
+ String responseBody = null;
+
+ //set Accept as text/plain in order to get access of endpoint "/actuator/prometheus"
+ headers.set("Accept", "text/plain");
+ httpEntity = new HttpEntity<String>(headers);
+ responseEntity =
+ restTemplate.exchange(actuatorUrl + "/actuator/prometheus", HttpMethod.GET, httpEntity, String.class);
+ responseBody = (String) responseEntity.getBody();
+ assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
+
+ //Set Accept as MediaType.APPLICATION_JSON in order to get access of endpoint "/actuator/info" and "/actuator/health"
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ httpEntity = new HttpEntity<String>(headers);
+ responseEntity =
+ restTemplate.exchange(actuatorUrl + "/actuator/info", HttpMethod.GET, httpEntity, String.class);
+ responseBody = (String) responseEntity.getBody();
+ assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
+
+ responseEntity =
+ restTemplate.exchange(actuatorUrl + "/actuator/health", HttpMethod.GET, httpEntity, String.class);
+ responseBody = (String) responseEntity.getBody();
+ assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
+ assertTrue(responseBody.contains("UP"));
+ }
+}
diff --git a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java
index 25d7bc7..2b2a61d 100644
--- a/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java
+++ b/src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryMethodTest.java
@@ -19,29 +19,36 @@
*/
package org.onap.aai.migration.v12;
-import org.janusgraph.core.JanusGraphFactory;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphTransaction;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphFactory;
+import org.janusgraph.core.JanusGraphTransaction;
import org.javatuples.Pair;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.onap.aai.AAISetup;
-import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.ModelType;
-import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
+import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
public class MigrateINVPhysicalInventoryMethodTest extends AAISetup {
private final static ModelType introspectorFactoryType = ModelType.MOXY;
@@ -110,12 +117,12 @@ public class MigrateINVPhysicalInventoryMethodTest extends AAISetup {
public void readLineTest() throws Exception {
MigrateINVPhysicalInventory m = new MigrateINVPhysicalInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
String line = "pnf-name-collector-1,06000D.121,5150,AED,,2001:1890:fcfe:7000:7021:0:1:2,64,,,,,\"1.7 \",SFP_1GE/Ethernet_10/100/1000M,ACCESS,N,N,M0651881_ST,SHARED,DOUBLE,SFP-1GE-LX,1000Mbps,,evc-name-1\n";
- Pair<String, String> pair = m.processLine(Arrays.asList(line.split("\\s*,\\s*", -1))).get();
+ Pair<String, String> pair = m.processLine(Arrays.asList(line.split(",", -1))).get();
assertEquals("Test 1","pnf-name-collector-1", pair.getValue0());
assertEquals("Test 1","1.7", pair.getValue1());
line = "pnf-name-1,06000D.121,5150,AED,,2001:1890:fcfe:7000:7021:0:1:2,64,,,,,1.2,SFP_1GE/Ethernet_10/100/1000M,ACCESS,N,N,M0651882_ST,SHARED,DOUBLE,SFP-1GE-LX,1000Mbps,,evc-name-3";
- pair = m.processLine(Arrays.asList(line.split("\\s*,\\s*", -1))).get();
+ pair = m.processLine(Arrays.asList(line.split(",", -1))).get();
assertEquals("Test 1","pnf-name-1", pair.getValue0());
assertEquals("Test 1","1.2", pair.getValue1());
diff --git a/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java b/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java
index f89f87d..fc7e55f 100644
--- a/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java
+++ b/src/test/java/org/onap/aai/util/SendDeleteMigrationNotificationsTest.java
@@ -101,7 +101,7 @@ public class SendDeleteMigrationNotificationsTest extends AAISetup {
try{
Files.createFile(Paths.get(FILE));
}catch(Exception e) {
- e.printStackTrace();
+ System.out.println("Create File error : " + e.getMessage());
}
String finalStr = "";
finalStr = "pserver" + "#@#" + "/cloud-infrastructure/pservers/pserver/"+SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-1" + "#@#" + "{\"hostname\":\""+ SendDeleteMigrationNotifications.class.getSimpleName()+"-pserver-1\",\"resource-version\":\"333\"}" + "\n";
diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties
index d245a53..5ac9491 100644
--- a/src/test/resources/application-test.properties
+++ b/src/test/resources/application-test.properties
@@ -73,3 +73,9 @@ schema.service.versions.endpoint=versions
# Location of the cadi properties file should be specified here
aaf.cadi.file=${server.local.startpath}/cadi.properties
+
+#To expose the Prometheus scraping endpoint in unit test
+management.server.port=0
+management.endpoints.enabled-by-default=true
+management.endpoints.web.exposure.include=info, health, loggers, prometheus
+management.metrics.web.server.auto-time-requests=false