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
String msg = "DEBUG -- Error while processing nodes ------";
LOGGER.debug(msg);
System.out.println(msg);
- e.printStackTrace();
}
}// End of looping over all files
*/
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;
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.__;
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;
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;
// 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());
}
}
}
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);
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 );
}
dupeGrpsDeleted++;
} else {
// keep them on our list
- returnList.add(dupesStr);
+ returnList.add(dupesStr.toString());
}
}
}
//
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);
//
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);
*/
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;
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 " +
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 " +
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());
}
}
}
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());
}
}
}
// 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;
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);
} 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 ) {
*/
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
try {
internal.run(args);
} catch (Exception e) {
- e.printStackTrace();
+ System.out.println("Exception : " + e.getMessage());
}
AAIGraph.getInstance().graphShutdown();
System.exit(0);
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;
/**
* 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.
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)){
}
}
else {
- Set newSet = new HashSet();
+ Set<String> newSet = new HashSet<>();
newSet.add(groupUuid);
history.put(vnfId, newSet);
}
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");
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
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");
}
}
} 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");
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");
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");
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
*/
+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;
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
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)
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";
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);
}
}
} 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");
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
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)) {
}
} 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");
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
}
} catch (AAIException e) {
- e.printStackTrace();
success = false;
}
.status(SchemaStatus.DISABLED)
.call();
} catch (Exception e) {
- e.printStackTrace();
+ logger.info("AwaitGraphIndexStatus error: " + e.getMessage());
}
}
.status(SchemaStatus.REGISTERED)
.call();
} catch (Exception e) {
- e.printStackTrace();
+ logger.info("AwaitGraphIndexStatus error: " + e.getMessage());
}
}
.status(SchemaStatus.ENABLED)
.call();
} catch (Exception e) {
- e.printStackTrace();
+ logger.info("AwaitGraphIndexStatus error: " + e.getMessage());
}
}
*/
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)
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));
success = false;
} catch (Exception e) {
logger.error("encountered exception", e);
- e.printStackTrace();
success = false;
}
return fileLines;
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;
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;
success = false;
} catch (Exception e) {
logger.error("encountered exception", e);
- e.printStackTrace();
success = false;
}
return fileLines;
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;
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");
success = false;
} catch (Exception e) {
logger.info(this.MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
success = false;
}
}
.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++;
}
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 " +
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++;
}
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);
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.__;
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;
success = false;
} catch (Exception e) {
logger.info(this.MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
success = false;
}
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;
success = false;
} catch (Exception e) {
logger.info("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
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();
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();
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";
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");
success = false;
} catch (Exception e) {
logger.info(MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
success = false;
}
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();
}
}
}
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");
success = false;
} catch (Exception e) {
logger.info(MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
success = false;
}
}
} catch (Exception e) {
logger.info("encountered exception", e.getMessage());
logger.error("encountered exception", e);
- e.printStackTrace();
success = false;
}
}
try {
internal.process(basePath);
} catch (Exception e) {
- e.printStackTrace();
+ // TODO Catch exception
}
AAIGraph.getInstance().graphShutdown();
System.exit(0);
try {
internal.process(basePath);
} catch (Exception e) {
- e.printStackTrace();
+ System.out.println("SendMigrationNotifications process error : " + e.getMessage());
}
AAIGraph.getInstance().graphShutdown();
System.exit(0);
*/
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;
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());
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";