aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorLaMont, William (wl2432) <wl2432@att.com>2019-04-09 16:12:27 -0400
committerJames Forsyth <jf2512@att.com>2019-04-10 14:45:20 +0000
commit6d241004a7f7d2f2eafb434be9398d9fa4cb4a52 (patch)
treeccd251a83721b0d561e44f8fc905c8732a9bd11e /src/main/java/org/onap
parent16035c14ffc43f1a08c6d8578fa30dd1176b21f9 (diff)
add v16 to local config for graphadmin
Issue-ID: AAI-2323 Change-Id: Ia2c01dc7b72e54194821a1c2e92b2eb0d497ead7 Signed-off-by: LaMont, William (wl2432) <wl2432@att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/aai/GraphAdminApp.java5
-rw-r--r--src/main/java/org/onap/aai/datagrooming/DataGrooming.java128
-rw-r--r--src/main/java/org/onap/aai/datagrooming/DataGroomingTasks.java4
-rw-r--r--src/main/java/org/onap/aai/dbgen/DupeTool.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v12/UriMigration.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwo.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateEdgesBetweenVnfcAndVfModule.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitId.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantId.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionId.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubType.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupType.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigratePserverAndPnfEquipType.java314
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantId.java20
-rw-r--r--src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionId.java22
-rw-r--r--src/main/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptions.java206
-rw-r--r--src/main/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegion.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java2
-rw-r--r--src/main/java/org/onap/aai/migration/v14/MigrateSdnaIvlanData.java886
-rw-r--r--src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java2
-rw-r--r--src/main/java/org/onap/aai/schema/GenTester.java40
23 files changed, 859 insertions, 794 deletions
diff --git a/src/main/java/org/onap/aai/GraphAdminApp.java b/src/main/java/org/onap/aai/GraphAdminApp.java
index 554a014..3b4a377 100644
--- a/src/main/java/org/onap/aai/GraphAdminApp.java
+++ b/src/main/java/org/onap/aai/GraphAdminApp.java
@@ -137,7 +137,6 @@ public class GraphAdminApp {
// to the SchemaGenerator needs the bean and during the constructor
// the Spring Context is not yet initialized
-
AAIGraph.getInstance();
System.setProperty("org.onap.aai.graphadmin.started", "true");
@@ -151,6 +150,10 @@ public class GraphAdminApp {
public static void loadDefaultProps(){
+ /*
+ * Required for DB connection name
+ */
+ System.setProperty("aai.service.name", GraphAdminApp.class.getSimpleName());
if(System.getProperty("AJSC_HOME") == null){
System.setProperty("AJSC_HOME", ".");
}
diff --git a/src/main/java/org/onap/aai/datagrooming/DataGrooming.java b/src/main/java/org/onap/aai/datagrooming/DataGrooming.java
index 7e667f4..167ec21 100644
--- a/src/main/java/org/onap/aai/datagrooming/DataGrooming.java
+++ b/src/main/java/org/onap/aai/datagrooming/DataGrooming.java
@@ -91,6 +91,8 @@ public class DataGrooming {
HashMap<String, Vertex> orphanNodeHash ;
HashMap<String, Vertex> missingAaiNtNodeHash ;
+ HashMap<String, Vertex> badUriNodeHash ;
+ HashMap<String, Vertex> badIndexNodeHash ;
HashMap<String, Edge> oneArmedEdgeHash ;
HashMap<String, Vertex> ghostNodeHash ;
ArrayList<String> dupeGroups;
@@ -356,6 +358,7 @@ public class DataGrooming {
JanusGraph graph2 = null;
deleteCount = 0;
int dummyUpdCount = 0;
+ int indexUpdCount = 0;
boolean executeFinalCommit = false;
deleteCandidateList = new LinkedHashSet<>();
Set<String> processedVertices = new LinkedHashSet<>();
@@ -445,6 +448,8 @@ public class DataGrooming {
HashMap<String, String> misMatchedHash = new HashMap<String, String>();
orphanNodeHash = new HashMap<String, Vertex>();
missingAaiNtNodeHash = new HashMap<String, Vertex>();
+ badUriNodeHash = new HashMap<String, Vertex>();
+ badIndexNodeHash = new HashMap<String, Vertex>();
oneArmedEdgeHash = new HashMap<String, Edge>();
HashMap<String, String> emptyVertexHash = new HashMap<String, String>();
ghostNodeHash = new HashMap<String, Vertex>();
@@ -696,19 +701,24 @@ public class DataGrooming {
&& depNodeOk){
aaiKeysOk = false;
}
-
- if( (!aaiKeysOk || !aaiUriOk)
- && !deleteCandidateList.contains(thisVid)
- && !skipIndexUpdateFix ){
- // Either the aaiKeys or aaiUri was bad. This may
- // be a problem with the indexes so we'll try to reset
- // them since this node is not on the delete list from
- // a previous run.
- tryToReSetIndexedProps(thisVtx, thisVid, indexedProps);
- }
-
- if( !aaiKeysOk || !aaiUriOk ){
- // We could not get the node back using it's own key info or aai-uri.
+
+ boolean bothKeysAreBad = false;
+ if( !aaiKeysOk && !aaiUriOk ) {
+ bothKeysAreBad = true;
+ }
+ else if ( !aaiKeysOk ){
+ // Just the key-index is bad
+ // We will not be putting this on the Auto-Delete list, just logging it (AAI-16252)
+ badIndexNodeHash.put(thisVid, thisVtx);
+ }
+ else if ( !aaiUriOk ){
+ // Just the aai-uri is bad
+ // We will not be putting this on the Auto-Delete list, just logging it (AAI-16252)
+ badUriNodeHash.put(thisVid, thisVtx);
+ }
+
+ if( bothKeysAreBad ){
+ // Neither the aai-uri nor key info could retrieve this node - BOTH are bad.
// So, it's a PHANTOM
if (deleteCandidateList.contains(thisVid)) {
@@ -854,7 +864,7 @@ public class DataGrooming {
ArrayList<Vertex> vertList = new ArrayList<>();
Iterator<Vertex> vItor3 = g.traversal().V();
- // Gotta hold these in a List - or else HBase times out as you cycle
+ // Gotta hold these in a List - or else the DB times out as you cycle
// through these
while (vItor3.hasNext()) {
Vertex v = vItor3.next();
@@ -888,7 +898,7 @@ public class DataGrooming {
continue;
}
if (ghostNodeHash.containsKey(thisVertId)) {
- // This is a phantom node, so don't try to use it
+ // We already know that this is a phantom node, so don't bother checking it
LOGGER.info(" >> Skipping edge check for edges from vertexId = "
+ thisVertId
+ ", since that guy is a Phantom Node");
@@ -1168,7 +1178,7 @@ public class DataGrooming {
deleteCount = deleteCount + dupeGrpsDeleted;
- if (deleteCount > 0 || dummyUpdCount > 0){
+ if (deleteCount > 0 || dummyUpdCount > 0 || indexUpdCount > 0){
executeFinalCommit = true;
}
@@ -1176,6 +1186,8 @@ public class DataGrooming {
int orphanNodeCount = orphanNodeHash.size();
int oneArmedEdgeCount = oneArmedEdgeHash.size();
int missingAaiNtNodeCount = missingAaiNtNodeHash.size();
+ int badUriNodeCount = badUriNodeHash.size();
+ int badIndexNodeCount = badIndexNodeHash.size();
int dupeCount = dupeGroups.size();
deleteCount = deleteCount + dupeGrpsDeleted;
@@ -1198,12 +1210,16 @@ public class DataGrooming {
+ "\n");
bw.write("Dummy-index-update to delete candidates = " + dummyUpdCount
+ "\n");
+ bw.write("index-update-Fix Attempts to phantom nodes = " + indexUpdCount
+ + "\n");
bw.write("Total number of nodes looked at = " + totalNodeCount
+ "\n");
bw.write("Ghost Nodes identified = " + ghostNodeCount + "\n");
bw.write("Orphan Nodes identified = " + orphanNodeCount + "\n");
bw.write("Missing aai-node-type Nodes identified = " + missingAaiNtNodeCount + "\n");
bw.write("Bad Edges identified = " + oneArmedEdgeCount + "\n");
+ bw.write("Bad aai-uri property Nodes identified = " + badUriNodeCount + "\n");
+ bw.write("Bad index property Nodes identified = " + badIndexNodeCount + "\n");
bw.write("Duplicate Groups count = " + dupeCount + "\n");
bw.write("MisMatching Label/aai-node-type count = "
+ misMatchedHash.size() + "\n");
@@ -1234,6 +1250,8 @@ public class DataGrooming {
bw.write("DeleteCandidate: Bad EDGE Edge-id = [" + eid + "]\n");
cleanupCandidateCount++;
}
+
+
bw.write("\n-- NOTE - To see DeleteCandidates for Duplicates, you need to look in the Duplicates Detail section below.\n");
@@ -1260,7 +1278,7 @@ public class DataGrooming {
}
}
- bw.write("\n ------------- Missing aai-node-type NODES - detail: ");
+ bw.write("\n ------------- Missing aai-node-type NODES - detail ");
for (Map.Entry<String, Vertex> entry : missingAaiNtNodeHash
.entrySet()) {
try {
@@ -1283,6 +1301,54 @@ public class DataGrooming {
LOGGER.error("error trying to print detail info for a node missing its aai-node-type " + LogFormatTools.getStackTop(dex));
}
}
+
+ bw.write("\n ------------- Nodes where aai-uri property is bad - detail ");
+ for (Map.Entry<String, Vertex> entry : badUriNodeHash
+ .entrySet()) {
+ try {
+ String vid = entry.getKey();
+ bw.write("\n> Has Bad aai-uri - Vid = " + vid + "\n");
+ ArrayList<String> retArr = showPropertiesForNode(
+ TRANSID, FROMAPPID, entry.getValue());
+ for (String info : retArr) {
+ bw.write(info + "\n");
+ }
+
+ retArr = showAllEdgesForNode(TRANSID, FROMAPPID,
+ entry.getValue());
+ for (String info : retArr) {
+ bw.write(info + "\n");
+ }
+ } catch (Exception dex) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ LOGGER.error("error trying to print detail info for a node with a bad aai-uri " + LogFormatTools.getStackTop(dex));
+ }
+ }
+
+ bw.write("\n ------------- Nodes where an indexed property is bad - detail: ");
+ for (Map.Entry<String, Vertex> entry : badIndexNodeHash
+ .entrySet()) {
+ try {
+ String vid = entry.getKey();
+ bw.write("\n> Node with bad index - Vid = " + vid + "\n");
+ ArrayList<String> retArr = showPropertiesForNode(
+ TRANSID, FROMAPPID, entry.getValue());
+ for (String info : retArr) {
+ bw.write(info + "\n");
+ }
+
+ retArr = showAllEdgesForNode(TRANSID, FROMAPPID,
+ entry.getValue());
+ for (String info : retArr) {
+ bw.write(info + "\n");
+ }
+ } catch (Exception dex) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ LOGGER.error("error trying to print detail info for a node with bad index " + LogFormatTools.getStackTop(dex));
+ }
+ }
bw.write("\n ------------- Missing Dependent Edge ORPHAN NODES - detail: ");
for (Map.Entry<String, Vertex> entry : orphanNodeHash
@@ -1430,7 +1496,7 @@ public class DataGrooming {
LOGGER.info("\n ------------- Done doing all the checks ------------ ");
LOGGER.info("Output will be written to " + fullOutputFileName);
- if (cleanupCandidateCount > 0) {
+ if (cleanupCandidateCount > 0 || badUriNodeCount > 0 || badIndexNodeCount > 0) {
// Technically, this is not an error -- but we're throwing this
// error so that hopefully a
// monitoring system will pick it up and do something with it.
@@ -1560,6 +1626,8 @@ public class DataGrooming {
// We will only deal with properties that are indexed and have a value - and for those,
// we will re-set them to the same value they already have, so that hopefully if their
// index was broken, it may get re-set.
+
+ // NOTE -- as of 1902-P2, this is deprecated --------------
LOGGER.info(" We will try to re-set the indexed properties for this node without changing any property values. VID = " + thisVidStr );
// These reserved-prop-names are all indexed for all nodes
@@ -3011,7 +3079,31 @@ class CommandLineArgs {
public int getMissingAaiNtNodeCount(){
return getMissingAaiNtNodeHash().size();
}
+
+ public HashMap<String, Vertex> getBadUriNodeHash() {
+ return badUriNodeHash;
+ }
+ public void setBadUriNodeHash(HashMap<String, Vertex> badUriNodeHash) {
+ this.badUriNodeHash = badUriNodeHash;
+ }
+
+ public int getBadUriNodeCount(){
+ return getBadUriNodeHash().size();
+ }
+
+ public HashMap<String, Vertex> getBadIndexNodeHash() {
+ return badIndexNodeHash;
+ }
+
+ public void setBadIndexNodeHash(HashMap<String, Vertex> badIndexNodeHash) {
+ this.badIndexNodeHash = badIndexNodeHash;
+ }
+
+ public int getBadIndexNodeCount(){
+ return getBadIndexNodeHash().size();
+ }
+
public HashMap<String, Edge> getOneArmedEdgeHash() {
return oneArmedEdgeHash;
}
diff --git a/src/main/java/org/onap/aai/datagrooming/DataGroomingTasks.java b/src/main/java/org/onap/aai/datagrooming/DataGroomingTasks.java
index ff3a6d7..749a264 100644
--- a/src/main/java/org/onap/aai/datagrooming/DataGroomingTasks.java
+++ b/src/main/java/org/onap/aai/datagrooming/DataGroomingTasks.java
@@ -88,6 +88,7 @@ public class DataGroomingTasks {
append("enabledupecheckoff" , AAIConfig.get("aai.datagrooming.enabledupecheckoff"), dataGroomingFlagMap);
append("enableghost2checkoff" , AAIConfig.get("aai.datagrooming.enableghost2checkoff"), dataGroomingFlagMap);
append("enableghost2fixon" , AAIConfig.get("aai.datagrooming.enableghost2fixon"), dataGroomingFlagMap);
+ append("enableskipindexupdatefix" , AAIConfig.get("aai.datagrooming.enableskipindexupdatefix"), dataGroomingFlagMap);
append("enablef" , AAIConfig.get("aai.datagrooming.enablef"), dataGroomingFlagMap);
append("fvalue" , AAIConfig.get("aai.datagrooming.fvalue"), dataGroomingFlagMap);
append("timewindowminutesvalue" , AAIConfig.get("aai.datagrooming.timewindowminutesvalue"), dataGroomingFlagMap);
@@ -144,6 +145,9 @@ public class DataGroomingTasks {
if("true".equals(dataGroomingFlagMap.get("enableghost2fixon"))){
paramsArray.add("-ghost2FixOn");
}
+ if("true".equals(dataGroomingFlagMap.get("enableskipindexupdatefix"))){
+ paramsArray.add("-skipIndexUpdateFix");
+ }
if("true".equals(dataGroomingFlagMap.get("enablef"))) {
paramsArray.add("-f");
diff --git a/src/main/java/org/onap/aai/dbgen/DupeTool.java b/src/main/java/org/onap/aai/dbgen/DupeTool.java
index fd5ae00..17f4405 100644
--- a/src/main/java/org/onap/aai/dbgen/DupeTool.java
+++ b/src/main/java/org/onap/aai/dbgen/DupeTool.java
@@ -87,7 +87,7 @@ public class DupeTool {
public void execute(String[] args){
- String defVersion = "v15";
+ String defVersion = "v16";
try {
defVersion = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP);
} catch (AAIException ae) {
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 33689b5..6273f84 100644
--- a/src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java
+++ b/src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java
@@ -48,7 +48,7 @@ import java.util.*;
* https://github.com/JanusGraph/janusgraph/wiki/Indexing
*/
-@Enabled
+//@Enabled
@MigrationPriority(500)
@MigrationDangerRating(1000)
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 cb0926e..cc8ba55 100644
--- a/src/main/java/org/onap/aai/migration/v12/UriMigration.java
+++ b/src/main/java/org/onap/aai/migration/v12/UriMigration.java
@@ -43,7 +43,7 @@ import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.stream.Collectors;
-@Enabled
+//@Enabled
@MigrationPriority(1000)
@MigrationDangerRating(1000)
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 5f74835..1d5843e 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java
@@ -42,7 +42,7 @@ import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import org.onap.aai.setup.SchemaVersions;
-@Enabled
+//@Enabled
@MigrationPriority(20)
@MigrationDangerRating(100)
public class MigrateBadWidgetModelsPartOne extends EdgeSwingMigrator {
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 bb525c3..7363d3c 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwo.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwo.java
@@ -47,7 +47,7 @@ import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import org.onap.aai.setup.SchemaVersions;
-@Enabled
+//@Enabled
@MigrationPriority(21)
@MigrationDangerRating(100)
public class MigrateBadWidgetModelsPartTwo extends EdgeSwingMigrator {
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateEdgesBetweenVnfcAndVfModule.java b/src/main/java/org/onap/aai/migration/v13/MigrateEdgesBetweenVnfcAndVfModule.java
index 3e09c51..c1498a6 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateEdgesBetweenVnfcAndVfModule.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateEdgesBetweenVnfcAndVfModule.java
@@ -56,7 +56,7 @@ import org.onap.aai.setup.SchemaVersions;
@MigrationPriority(10)
@MigrationDangerRating(100)
-@Enabled
+//@Enabled
public class MigrateEdgesBetweenVnfcAndVfModule extends EdgeMigrator {
public MigrateEdgesBetweenVnfcAndVfModule(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
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 3f90934..0edff80 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitId.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitId.java
@@ -66,7 +66,7 @@ import org.onap.aai.setup.SchemaVersions;
@MigrationPriority(26)
@MigrationDangerRating(100)
-@Enabled
+//@Enabled
public class MigrateForwarderEvcCircuitId extends Migrator {
private final String PNF_NODE_TYPE = "pnf";
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantId.java b/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantId.java
index 1244c59..9f7cf19 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantId.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelInvariantId.java
@@ -55,7 +55,7 @@ import java.util.Optional;
@MigrationPriority(19)
@MigrationDangerRating(2)
-@Enabled
+//@Enabled
public class MigrateInstanceGroupModelInvariantId extends PropertyMigrator {
private static final String INSTANCE_GROUP_NODE_TYPE = "instance-group";
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionId.java b/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionId.java
index 64341ba..3687c3d 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionId.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionId.java
@@ -54,7 +54,7 @@ import org.onap.aai.setup.SchemaVersions;
@MigrationPriority(19)
@MigrationDangerRating(2)
-@Enabled
+//@Enabled
public class MigrateInstanceGroupModelVersionId extends PropertyMigrator {
private static final String INSTANCE_GROUP_NODE_TYPE = "instance-group";
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubType.java b/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubType.java
index 6823da8..a98159a 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubType.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubType.java
@@ -34,7 +34,7 @@ import org.onap.aai.setup.SchemaVersions;
@MigrationPriority(20)
@MigrationDangerRating(2)
-@Enabled
+//@Enabled
public class MigrateInstanceGroupSubType extends PropertyMigrator{
protected static final String SUB_TYPE_PROPERTY = "sub-type";
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupType.java b/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupType.java
index f3cd669..abab0e2 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupType.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateInstanceGroupType.java
@@ -34,7 +34,7 @@ import org.onap.aai.setup.SchemaVersions;
@MigrationPriority(20)
@MigrationDangerRating(2)
-@Enabled
+//@Enabled
public class MigrateInstanceGroupType extends PropertyMigrator{
protected static final String TYPE_PROPERTY = "type";
diff --git a/src/main/java/org/onap/aai/migration/v13/MigratePserverAndPnfEquipType.java b/src/main/java/org/onap/aai/migration/v13/MigratePserverAndPnfEquipType.java
index 6788d7f..61c488c 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigratePserverAndPnfEquipType.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigratePserverAndPnfEquipType.java
@@ -1,157 +1,157 @@
-/**
- * ============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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.aai.migration.v13;
-import java.util.List;
-import java.util.Optional;
-
-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;
-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;
-
-@MigrationPriority(20)
-@MigrationDangerRating(2)
-@Enabled
-public class MigratePserverAndPnfEquipType extends Migrator{
-
- protected static final String EQUIP_TYPE_PROPERTY = "equip-type";
- protected static final String HOSTNAME_PROPERTY = "hostname";
- protected static final String PNF_NAME_PROPERTY = "pnf-name";
- protected static final String PNF_NODE_TYPE = "pnf";
- protected static final String PSERVER_NODE_TYPE = "pserver";
- private boolean success = true;
-
- public MigratePserverAndPnfEquipType(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
- super(engine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
- }
-
-
-
- @Override
- public void run() {
- int pserverCount = 0;
- int pnfCount = 0;
- int pserverErrorCount = 0;
- int pnfErrorCount = 0;
- logger.info("---------- Start Updating equip-type for Pserver and Pnf ----------");
-
- List<Vertex> pserverList = this.engine.asAdmin().getTraversalSource().V().has(AAIProperties.NODE_TYPE, PSERVER_NODE_TYPE).toList();
- List<Vertex> pnfList = this.engine.asAdmin().getTraversalSource().V().has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).toList();
-
- for (Vertex vertex : pserverList) {
- String currentValueOfEquipType = null;
- String hostName = null;
- try {
- currentValueOfEquipType = getEquipTypeNodeValue(vertex);
- hostName = getHostNameNodeValue(vertex);
- if("Server".equals(currentValueOfEquipType) ||"server".equals(currentValueOfEquipType) ){
- vertex.property(EQUIP_TYPE_PROPERTY, "SERVER");
- this.touchVertexProperties(vertex, false);
- logger.info("changed Pserver equip-type from " + currentValueOfEquipType + " to SERVER having hostname : " + hostName);
- pserverCount++;
- }
- } catch (Exception e) {
- success = false;
- pserverErrorCount++;
- logger.error(MIGRATION_ERROR + "encountered exception for equip-type:" + currentValueOfEquipType + " having hostName :" + hostName, e);
- }
- }
-
- for (Vertex vertex : pnfList) {
- String currentValueOfEquipType = null;
- String pnfName = null;
- try {
- currentValueOfEquipType = getEquipTypeNodeValue(vertex);
- pnfName = getPnfNameNodeValue(vertex);
- if("Switch".equals(currentValueOfEquipType)||"switch".equals(currentValueOfEquipType)){
- vertex.property(EQUIP_TYPE_PROPERTY, "SWITCH");
- this.touchVertexProperties(vertex, false);
- logger.info("changed Pnf equip-type from "+ currentValueOfEquipType +" to SWITCH having pnf-name :" + pnfName);
- pnfCount++;
- }
-
- } catch (Exception e) {
- success = false;
- pnfErrorCount++;
- logger.error(MIGRATION_ERROR + "encountered exception for equip-type:" + currentValueOfEquipType +" having pnf-name : "+ pnfName , e);
- }
- }
-
- logger.info ("\n \n ******* Final Summary Updated equip-type for Pserver and Pnf Migration ********* \n");
- logger.info(MIGRATION_SUMMARY_COUNT+"Number of Pservers updated: "+ pserverCount +"\n");
- logger.info(MIGRATION_SUMMARY_COUNT+"Number of Pservers failed to update due to error : "+ pserverErrorCount +"\n");
-
- logger.info(MIGRATION_SUMMARY_COUNT+"Number of Pnf updated: "+ pnfCount +"\n");
- logger.info(MIGRATION_SUMMARY_COUNT+"Number of Pnf failed to update due to error : "+ pnfErrorCount +"\n");
-
- }
-
- private String getEquipTypeNodeValue(Vertex vertex) {
- String propertyValue = "";
- if(vertex != null && vertex.property(EQUIP_TYPE_PROPERTY).isPresent()){
- propertyValue = vertex.property(EQUIP_TYPE_PROPERTY).value().toString();
- }
- return propertyValue;
- }
-
- private String getHostNameNodeValue(Vertex vertex) {
- String propertyValue = "";
- if(vertex != null && vertex.property(HOSTNAME_PROPERTY).isPresent()){
- propertyValue = vertex.property(HOSTNAME_PROPERTY).value().toString();
- }
- return propertyValue;
- }
-
- private String getPnfNameNodeValue(Vertex vertex) {
- String propertyValue = "";
- if(vertex != null && vertex.property(PNF_NAME_PROPERTY).isPresent()){
- propertyValue = vertex.property(PNF_NAME_PROPERTY).value().toString();
- }
- return propertyValue;
- }
-
- @Override
- public Status getStatus() {
- if (success) {
- return Status.SUCCESS;
- } else {
- return Status.FAILURE;
- }
- }
-
- @Override
- public Optional<String[]> getAffectedNodeTypes() {
- return Optional.of(new String[]{PSERVER_NODE_TYPE,PNF_NODE_TYPE});
- }
-
- @Override
- public String getMigrationName() {
- return "MigratePserverAndPnfEquipType";
- }
-
-}
+/**
+ * ============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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.migration.v13;
+import java.util.List;
+import java.util.Optional;
+
+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;
+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;
+
+@MigrationPriority(20)
+@MigrationDangerRating(2)
+//@Enabled
+public class MigratePserverAndPnfEquipType extends Migrator{
+
+ protected static final String EQUIP_TYPE_PROPERTY = "equip-type";
+ protected static final String HOSTNAME_PROPERTY = "hostname";
+ protected static final String PNF_NAME_PROPERTY = "pnf-name";
+ protected static final String PNF_NODE_TYPE = "pnf";
+ protected static final String PSERVER_NODE_TYPE = "pserver";
+ private boolean success = true;
+
+ public MigratePserverAndPnfEquipType(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
+ super(engine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
+ }
+
+
+
+ @Override
+ public void run() {
+ int pserverCount = 0;
+ int pnfCount = 0;
+ int pserverErrorCount = 0;
+ int pnfErrorCount = 0;
+ logger.info("---------- Start Updating equip-type for Pserver and Pnf ----------");
+
+ List<Vertex> pserverList = this.engine.asAdmin().getTraversalSource().V().has(AAIProperties.NODE_TYPE, PSERVER_NODE_TYPE).toList();
+ List<Vertex> pnfList = this.engine.asAdmin().getTraversalSource().V().has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE).toList();
+
+ for (Vertex vertex : pserverList) {
+ String currentValueOfEquipType = null;
+ String hostName = null;
+ try {
+ currentValueOfEquipType = getEquipTypeNodeValue(vertex);
+ hostName = getHostNameNodeValue(vertex);
+ if("Server".equals(currentValueOfEquipType) ||"server".equals(currentValueOfEquipType) ){
+ vertex.property(EQUIP_TYPE_PROPERTY, "SERVER");
+ this.touchVertexProperties(vertex, false);
+ logger.info("changed Pserver equip-type from " + currentValueOfEquipType + " to SERVER having hostname : " + hostName);
+ pserverCount++;
+ }
+ } catch (Exception e) {
+ success = false;
+ pserverErrorCount++;
+ logger.error(MIGRATION_ERROR + "encountered exception for equip-type:" + currentValueOfEquipType + " having hostName :" + hostName, e);
+ }
+ }
+
+ for (Vertex vertex : pnfList) {
+ String currentValueOfEquipType = null;
+ String pnfName = null;
+ try {
+ currentValueOfEquipType = getEquipTypeNodeValue(vertex);
+ pnfName = getPnfNameNodeValue(vertex);
+ if("Switch".equals(currentValueOfEquipType)||"switch".equals(currentValueOfEquipType)){
+ vertex.property(EQUIP_TYPE_PROPERTY, "SWITCH");
+ this.touchVertexProperties(vertex, false);
+ logger.info("changed Pnf equip-type from "+ currentValueOfEquipType +" to SWITCH having pnf-name :" + pnfName);
+ pnfCount++;
+ }
+
+ } catch (Exception e) {
+ success = false;
+ pnfErrorCount++;
+ logger.error(MIGRATION_ERROR + "encountered exception for equip-type:" + currentValueOfEquipType +" having pnf-name : "+ pnfName , e);
+ }
+ }
+
+ logger.info ("\n \n ******* Final Summary Updated equip-type for Pserver and Pnf Migration ********* \n");
+ logger.info(MIGRATION_SUMMARY_COUNT+"Number of Pservers updated: "+ pserverCount +"\n");
+ logger.info(MIGRATION_SUMMARY_COUNT+"Number of Pservers failed to update due to error : "+ pserverErrorCount +"\n");
+
+ logger.info(MIGRATION_SUMMARY_COUNT+"Number of Pnf updated: "+ pnfCount +"\n");
+ logger.info(MIGRATION_SUMMARY_COUNT+"Number of Pnf failed to update due to error : "+ pnfErrorCount +"\n");
+
+ }
+
+ private String getEquipTypeNodeValue(Vertex vertex) {
+ String propertyValue = "";
+ if(vertex != null && vertex.property(EQUIP_TYPE_PROPERTY).isPresent()){
+ propertyValue = vertex.property(EQUIP_TYPE_PROPERTY).value().toString();
+ }
+ return propertyValue;
+ }
+
+ private String getHostNameNodeValue(Vertex vertex) {
+ String propertyValue = "";
+ if(vertex != null && vertex.property(HOSTNAME_PROPERTY).isPresent()){
+ propertyValue = vertex.property(HOSTNAME_PROPERTY).value().toString();
+ }
+ return propertyValue;
+ }
+
+ private String getPnfNameNodeValue(Vertex vertex) {
+ String propertyValue = "";
+ if(vertex != null && vertex.property(PNF_NAME_PROPERTY).isPresent()){
+ propertyValue = vertex.property(PNF_NAME_PROPERTY).value().toString();
+ }
+ return propertyValue;
+ }
+
+ @Override
+ public Status getStatus() {
+ if (success) {
+ return Status.SUCCESS;
+ } else {
+ return Status.FAILURE;
+ }
+ }
+
+ @Override
+ public Optional<String[]> getAffectedNodeTypes() {
+ return Optional.of(new String[]{PSERVER_NODE_TYPE,PNF_NODE_TYPE});
+ }
+
+ @Override
+ public String getMigrationName() {
+ return "MigratePserverAndPnfEquipType";
+ }
+
+}
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantId.java b/src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantId.java
index a643842..54b3ba3 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantId.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelInvariantId.java
@@ -18,26 +18,6 @@
* ============LICENSE_END=========================================================
*/
package org.onap.aai.migration.v13;
-/*-
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
import org.janusgraph.core.Cardinality;
import org.onap.aai.edges.EdgeIngestor;
diff --git a/src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionId.java b/src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionId.java
index 13cdb80..b8edea5 100644
--- a/src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionId.java
+++ b/src/main/java/org/onap/aai/migration/v13/MigrateVnfcModelVersionId.java
@@ -18,26 +18,6 @@
* ============LICENSE_END=========================================================
*/
package org.onap.aai.migration.v13;
-/*-
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
import java.util.Optional;
import org.janusgraph.core.Cardinality;
@@ -54,7 +34,7 @@ import org.onap.aai.setup.SchemaVersions;
@MigrationPriority(19)
@MigrationDangerRating(2)
-@Enabled
+//@Enabled
public class MigrateVnfcModelVersionId extends PropertyMigrator {
private static final String VNFC_NODE_TYPE = "vnfc";
diff --git a/src/main/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptions.java b/src/main/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptions.java
index d32ce81..b378420 100644
--- a/src/main/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptions.java
+++ b/src/main/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptions.java
@@ -1,103 +1,103 @@
-/**
- * ============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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.aai.migration.v14;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-import org.onap.aai.edges.EdgeIngestor;
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.MigrationDangerRating;
-import org.onap.aai.migration.MigrationPriority;
-import org.onap.aai.migration.Status;
-import org.onap.aai.migration.ValueMigrator;
-import org.onap.aai.migration.Enabled;
-import org.onap.aai.serialization.db.EdgeSerializer;
-import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import org.onap.aai.setup.SchemaVersions;
-
-
-@MigrationPriority(1)
-@MigrationDangerRating(1)
-@Enabled
-public class MigrateGenericVnfMgmtOptions extends ValueMigrator {
-
- protected static final String VNF_NODE_TYPE = "generic-vnf";
-
-
- private static Map<String, Map> map;
- private static Map<String, String> pair1;
- private static Map<String, List<String>> conditionsMap;
-
- public MigrateGenericVnfMgmtOptions(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
- super(engine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions, setMgmtOptions(), setConditionsMap(), false);
-
- }
-
- private static Map<String, Map> setMgmtOptions(){
- map = new HashMap<>();
- pair1 = new HashMap<>();
-
- pair1.put("management-option", "AT&T Managed-Basic");
- map.put("generic-vnf", pair1);
-
- return map;
- }
-
-
-
- public static Map<String, List<String>> setConditionsMap() {
- List<String> conditionsList = new ArrayList<String>();
- conditionsMap = new HashMap<>();
-
- conditionsList.add("HN");
- conditionsList.add("HP");
- conditionsList.add("HG");
-
- conditionsMap.put("vnf-type", conditionsList);
-
- return conditionsMap;
- }
-
- @Override
- public Status getStatus() {
- return Status.SUCCESS;
- }
-
- @Override
- public Optional<String[]> getAffectedNodeTypes() {
- return Optional.of(new String[]{VNF_NODE_TYPE});
- }
-
- @Override
- public String getMigrationName() {
- return "MigrateGenericVnfMgmtOptions";
- }
-
- @Override
- public boolean isUpdateDmaap(){
- return true;
- }
-
-
-}
+/**
+ * ============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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.migration.v14;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.aai.edges.EdgeIngestor;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Status;
+import org.onap.aai.migration.ValueMigrator;
+import org.onap.aai.migration.Enabled;
+import org.onap.aai.serialization.db.EdgeSerializer;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.setup.SchemaVersions;
+
+
+@MigrationPriority(1)
+@MigrationDangerRating(1)
+//@Enabled
+public class MigrateGenericVnfMgmtOptions extends ValueMigrator {
+
+ protected static final String VNF_NODE_TYPE = "generic-vnf";
+
+
+ private static Map<String, Map> map;
+ private static Map<String, String> pair1;
+ private static Map<String, List<String>> conditionsMap;
+
+ public MigrateGenericVnfMgmtOptions(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
+ super(engine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions, setMgmtOptions(), setConditionsMap(), false);
+
+ }
+
+ private static Map<String, Map> setMgmtOptions(){
+ map = new HashMap<>();
+ pair1 = new HashMap<>();
+
+ pair1.put("management-option", "AT&T Managed-Basic");
+ map.put("generic-vnf", pair1);
+
+ return map;
+ }
+
+
+
+ public static Map<String, List<String>> setConditionsMap() {
+ List<String> conditionsList = new ArrayList<String>();
+ conditionsMap = new HashMap<>();
+
+ conditionsList.add("HN");
+ conditionsList.add("HP");
+ conditionsList.add("HG");
+
+ conditionsMap.put("vnf-type", conditionsList);
+
+ return conditionsMap;
+ }
+
+ @Override
+ public Status getStatus() {
+ return Status.SUCCESS;
+ }
+
+ @Override
+ public Optional<String[]> getAffectedNodeTypes() {
+ return Optional.of(new String[]{VNF_NODE_TYPE});
+ }
+
+ @Override
+ public String getMigrationName() {
+ return "MigrateGenericVnfMgmtOptions";
+ }
+
+ @Override
+ public boolean isUpdateDmaap(){
+ return true;
+ }
+
+
+}
diff --git a/src/main/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegion.java b/src/main/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegion.java
index afdea57..cdec87b 100644
--- a/src/main/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegion.java
+++ b/src/main/java/org/onap/aai/migration/v14/MigrateNetworkTechToCloudRegion.java
@@ -40,7 +40,7 @@ import org.onap.aai.setup.SchemaVersions;
@MigrationPriority(20)
@MigrationDangerRating(2)
-@Enabled
+//@Enabled
public class MigrateNetworkTechToCloudRegion extends Migrator{
protected static final String CLOUDREGION_NODETYPE = "cloud-region";
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 d0c1e15..cfc8c74 100644
--- a/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java
+++ b/src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java
@@ -43,7 +43,7 @@ import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.stream.Collectors;
-@Enabled
+//@Enabled
@MigrationPriority(5)
@MigrationDangerRating(100)
public class MigrateSameSourcedRCTROPserverData extends EdgeSwingMigrator {
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 6f759fb..3c10ab6 100644
--- a/src/main/java/org/onap/aai/migration/v14/MigrateSdnaIvlanData.java
+++ b/src/main/java/org/onap/aai/migration/v14/MigrateSdnaIvlanData.java
@@ -1,443 +1,443 @@
-/**
- * ============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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.aai.migration.v14;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashMap;
-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.__;
-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;
-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;
-
-@MigrationPriority(100)
-@MigrationDangerRating(1)
-@Enabled
-public class MigrateSdnaIvlanData extends Migrator {
-
- private final String CONFIGURATION_NODE_TYPE = "configuration";
- private final String EVC_NODE_TYPE = "evc";
- private final String FORWARDER_NODE_TYPE = "forwarder";
- private final String FORWRDER_EVC_NODE_TYPE = "forwarder-evc";
- private final String FORWARDING_PATH_NODE_TYPE = "forwarding-path";
- private final String PNF_NODE_TYPE = "pnf";
- private final String P_INTERFACE_NODE_TYPE = "p-interface";
- private final String LAG_INTERFACE_NODE_TYPE = "lag-interface";
- private final String SAREA_GLOBAL_CUSTOMER_ID = "8a00890a-e6ae-446b-9dbe-b828dbeb38bd";
-
- GraphTraversal<Vertex, Vertex> serviceSubscriptionGt;
-
- private static GraphTraversalSource g = null;
- private static boolean success = true;
- private static boolean checkLog = false;
- private int headerLength;
- private int migrationSuccess = 0;
- private int migrationFailure = 0;
- private int invalidPInterfaceCount = 0;
- private int invalidLagInterfaceCount = 0;
-
-
- private static List<String> dmaapMsgList = new ArrayList<String>();
- private static final String homeDir = System.getProperty("AJSC_HOME");
-
- private static List<String> validPnfList = new ArrayList<String>();
- private static List<String> invalidPnfList = new ArrayList<String>();
-
- private static Map<String, List<String>> validInterfaceMap = new HashMap<String, List<String>>();
- private static Map<String, List<String>> invalidInterfaceMap = new HashMap<String, List<String>>();
-
- protected class SdnaIvlanFileData{
- String evcName;
- String pnfName;
- String interfaceAID;
- int ivlanValue;
-
- public String getEvcName() {
- return evcName;
- }
- public void setEvcName(String evcName) {
- this.evcName = evcName;
- }
-
- public String getPnfName() {
- return pnfName;
- }
- public void setPnfName(String pnfName) {
- this.pnfName = pnfName;
- }
- public String getInterfaceAID() {
- return interfaceAID;
- }
- public void setInterfaceAID(String interfaceAID) {
- this.interfaceAID = interfaceAID;
- }
-
- public int getIvlanValue() {
- return ivlanValue;
- }
- public void setIvlanValue(int ivlanValue) {
- this.ivlanValue = ivlanValue;
- }
-
- }
-
- private static ArrayList<SdnaIvlanFileData> ivlanList = new ArrayList<SdnaIvlanFileData>();
-
- public MigrateSdnaIvlanData(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
- super(engine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
-
- this.g = this.engine.asAdmin().getTraversalSource();
- this.serviceSubscriptionGt = g.V().has("global-customer-id", SAREA_GLOBAL_CUSTOMER_ID).in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA");
- }
-
- @Override
- public void run() {
- logger.info("---------- Start migration ----------");
- String configDir = System.getProperty("BUNDLECONFIG_DIR");
- if (homeDir == null) {
- logger.info(this.MIGRATION_ERROR + "ERROR: Could not find sys prop AJSC_HOME");
- success = false;
- return;
- }
- if (configDir == null) {
- success = false;
- return;
- }
-
- String feedDir = homeDir + "/" + configDir + "/" + "migration-input-files/sarea-inventory/";
-
- int fileLineCounter = 0;
-
- String fileName = feedDir+ "ivlanData.csv";
- logger.info(fileName);
- logger.info("---------- Processing Entries from file ----------");
-
-
- try {
- List<String> lines = Files.readAllLines(Paths.get(fileName));
- Iterator<String> lineItr = lines.iterator();
- while (lineItr.hasNext()){
- String line = lineItr.next().trim();
- if (!line.isEmpty()) {
- if (fileLineCounter != 0) {
-
- try{
- String[] colList = line.split(",", -1);
- SdnaIvlanFileData lineData = new SdnaIvlanFileData();
- lineData.setEvcName(colList[0].trim());
- lineData.setPnfName(colList[1].trim());
- lineData.setInterfaceAID(colList[2].trim());
- lineData.setIvlanValue(Integer.valueOf(colList[3].trim()));
- ivlanList.add(lineData);
-
- } catch (Exception e){
- logger.info(this.MIGRATION_ERROR + " ERROR: Record Format is invalid. Expecting Numeric value for Forwarder_Id and Ivlan_Value. Skipping Record: " + line);
- this.migrationFailure++;
- }
-
- } else {
- this.headerLength = line.split(",", -1).length;
- if (this.headerLength < 4){
- logger.info(this.MIGRATION_ERROR + "ERROR: Input file should have atleast 4 columns");
- this.success = false;
- return;
- }
- }
- }
- fileLineCounter++;
- }
-
- processSdnaIvlan();
-
- int invalidInterfacesCount = getInvalidInterfaceCount();
-
- logger.info ("\n \n ******* Final Summary for SDN-A IVLAN Migration ********* \n");
- logger.info(this.MIGRATION_SUMMARY_COUNT + "SDN-A forward-evcs: IVLANs updated: "+ migrationSuccess);
- logger.info(this.MIGRATION_SUMMARY_COUNT + "Total File Record Count: "+(fileLineCounter - 1));
- logger.info(this.MIGRATION_SUMMARY_COUNT + "Unprocessed SDNA File Records : "+ migrationFailure);
- logger.info(this.MIGRATION_SUMMARY_COUNT + "PNFs from Input File not found : "+ Integer.toString(invalidPnfList.size()) + "\n");
-
-
- logger.info(this.MIGRATION_SUMMARY_COUNT + "Total PNF + P-INTERFACEs from Input File not found : " + Integer.toString(invalidPInterfaceCount));
- logger.info(this.MIGRATION_SUMMARY_COUNT + "Total PNF + LAG-INTERFACEs from Input File not found : " + Integer.toString(invalidLagInterfaceCount));
- logger.info(this.MIGRATION_SUMMARY_COUNT + "Total PNF/INTERFACEs from Input File not found : " + Integer.toString(invalidInterfacesCount));
-
- } catch (FileNotFoundException e) {
- logger.info(this.MIGRATION_ERROR + "ERROR: Could not find file " + fileName, e.getMessage());
- success = false;
- checkLog = true;
- } catch (NoSuchFileException e) {
- logger.info(this.MIGRATION_ERROR + "ERROR: Could not find file " + fileName, e.getMessage());
- success = false;
- checkLog = true;
- } catch (IOException e) {
- logger.info(this.MIGRATION_ERROR + "ERROR: Issue reading file " + fileName, e);
- success = false;
- } catch (Exception e) {
- logger.info(this.MIGRATION_ERROR + "encountered exception", e);
- e.printStackTrace();
- success = false;
- }
-
- }
- private void processSdnaIvlan() {
-
- for(int i = 0; i < ivlanList.size(); i ++) {
- String evc = ivlanList.get(i).getEvcName();
- String pnf = ivlanList.get(i).getPnfName();
- String interfaceId = ivlanList.get(i).getInterfaceAID();
- String ivlanValue = Integer.toString(ivlanList.get(i).getIvlanValue());
-
- Boolean pnfExists = pnfExists(pnf);
- GraphTraversal<Vertex, Vertex> forwarderEvcGT;
- Vertex forwarderEvcVtx = null;
- String interfaceNodeType;
- String forwarderEvcId = null;
-
- if (!pnfExists){
- migrationFailure++;
- }else{
-
- if (interfaceId.contains(".")){
- interfaceNodeType = P_INTERFACE_NODE_TYPE;
- }else{
- interfaceNodeType = LAG_INTERFACE_NODE_TYPE;
- }
-
- validateInterface(pnf, interfaceNodeType, interfaceId);
-
- forwarderEvcGT = g.V()
- .has("pnf-name", pnf).has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE)
- .in("tosca.relationships.network.BindsTo")
- .has(AAIProperties.NODE_TYPE, interfaceNodeType).has("interface-name", interfaceId)
- .in("org.onap.relationships.inventory.ForwardsTo")
- .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", evc))
- .out("org.onap.relationships.inventory.Uses")
- .in("org.onap.relationships.inventory.BelongsTo");
-
- // fwd-evc not found for pnf + interface
- if(!forwarderEvcGT.hasNext()){
- forwarderEvcId = pnf + " " + evc;
- migrationError(PNF_NODE_TYPE + "/" + EVC_NODE_TYPE, forwarderEvcId, "ivlan", ivlanValue);
-
- }
-
- while(forwarderEvcGT.hasNext()){
- forwarderEvcVtx = forwarderEvcGT.next();
-
- // fwd-evc vertex is null
- if(forwarderEvcVtx == null){
- forwarderEvcId = pnf + " " + evc;
- migrationError(PNF_NODE_TYPE + "/" + EVC_NODE_TYPE, forwarderEvcId, "ivlan", ivlanValue);
- }
- // update fwd-evc with ivlan value
- else{
-
- forwarderEvcId = forwarderEvcVtx.property("forwarder-evc-id").value().toString();
- try{
- forwarderEvcVtx.property("ivlan", ivlanValue);
- logger.info(String.format("Updating Node Type forwarder-evc Property ivlan value %s", ivlanValue.toString()));
- this.touchVertexProperties(forwarderEvcVtx, false);
- updateDmaapList(forwarderEvcVtx);
- migrationSuccess++;
-
- }catch (Exception e){
- logger.info(e.toString());
- migrationError(FORWRDER_EVC_NODE_TYPE, forwarderEvcId, "ivlan", ivlanValue);
- }
- }
- }
- }
-
- }
- }
-
- /**
- * Description: Validate if pnf node exists in Graph
- * @param pnf
- * @return boolean
- */
- private boolean pnfExists(String pnf){
- if (invalidPnfList.contains(pnf)){
- logger.info(this.MIGRATION_ERROR + "ERROR: PNF value " + pnf + " does not exist.");
- return false;
- }
- if (validPnfList.contains(pnf)){
- return true;
- }
-
- GraphTraversal<Vertex, Vertex> pnfGT = g.V()
- .has("pnf-name", pnf).has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE);
-
- if(pnfGT.hasNext()){
- validPnfList.add(pnf);
- return true;
- }
- else{
- logger.info(this.MIGRATION_ERROR + "ERROR: PNF value " + pnf + " does not exist.");
- invalidPnfList.add(pnf);
- return false;
- }
-
- }
-
- /**
- * Description: Validate if p-interface or lag-interface node exists in Graph
- * @param pnf
- * @param interfaceNodeType
- * @param interfaceName
- */
- private void validateInterface(String pnf, String interfaceNodeType, String interfaceName){
-
- List <String> validInterfaceList;
- List <String> invalidInterfaceList;
-
- if(!validInterfaceMap.containsKey(pnf) ){
- validInterfaceList = new ArrayList<String>();
- }else{
- validInterfaceList = validInterfaceMap.get(pnf);
- }
-
- if(!invalidInterfaceMap.containsKey(pnf)){
- invalidInterfaceList = new ArrayList<String>();
- }else{
- invalidInterfaceList = invalidInterfaceMap.get(pnf);
- }
-
- if(invalidInterfaceList.contains(interfaceName)){
- logger.info(this.MIGRATION_ERROR + "ERROR PNF " + pnf + " with a " + interfaceNodeType + " of " + interfaceName + " does not exist.");
- return;
- }
- if(validInterfaceList.contains(interfaceName)){
- return;
- }
-
- GraphTraversal<Vertex, Vertex> interfaceGT = g.V()
- .has("pnf-name", pnf).has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE)
- .in("tosca.relationships.network.BindsTo")
- .has("interface-name", interfaceName).has(AAIProperties.NODE_TYPE, interfaceNodeType);
-
- if(interfaceGT.hasNext()){
- validInterfaceList.add(interfaceName);
- validInterfaceMap.put(pnf, validInterfaceList);
- }
- else{
- logger.info(this.MIGRATION_ERROR + "ERROR PNF " + pnf + " with a " + interfaceNodeType + " of " + interfaceName + " does not exist.");
- invalidInterfaceList.add(interfaceName);
- invalidInterfaceMap.put(pnf, invalidInterfaceList);
- }
- }
-
-
- /**
- * Description: Error Routine if graph is not updated by input file record
- * @param nodeType
- * @param nodeId
- * @param property
- * @param propertyValue
- */
- private void migrationError(String nodeType, String nodeId, String property, String propertyValue){
- logger.info(this.MIGRATION_ERROR + "ERROR: Failure to update "
- + nodeType + " ID " + nodeId + ", " + property + " to value " + propertyValue
- + ". Node Not Found \n");
- migrationFailure++;
- }
-
- private int getInvalidInterfaceCount(){
- int interfaceCount = 0;
-
- for (Map.Entry<String, List<String>> entry: invalidInterfaceMap.entrySet()){
- String key = entry.getKey();
- List <String> invalidList = invalidInterfaceMap.get(key);
-
- for (int i = 0; i < invalidList.size(); i++){
- if(invalidList.get(i).contains(".")){
- invalidPInterfaceCount++;
- }else{
- invalidLagInterfaceCount++;
- }
-
- }
- interfaceCount = interfaceCount + invalidInterfaceMap.get(key).size();
- }
- return interfaceCount;
- }
-
- /**
- * Description: Dmaap Routine
- * @param v
- */
- private void updateDmaapList(Vertex v){
- String dmaapMsg = System.nanoTime() + "_" + v.id().toString() + "_" + v.value("resource-version").toString();
- dmaapMsgList.add(dmaapMsg);
- logger.info("\tAdding Updated Vertex " + v.id().toString() + " to dmaapMsgList....");
- }
-
- @Override
- public Status getStatus() {
- if (checkLog) {
- return Status.CHECK_LOGS;
- }
- else if (success) {
- return Status.SUCCESS;
- }
- else {
- return Status.FAILURE;
- }
- }
-
- @Override
- public void commit() {
- engine.commit();
- createDmaapFiles(dmaapMsgList);
- }
-
- @Override
- public Optional<String[]> getAffectedNodeTypes() {
- return Optional.of(new String[]{this.FORWRDER_EVC_NODE_TYPE});
- }
-
-
- @Override
- public String getMigrationName() {
- return "MigrateSdnaIvlanData";
- }
-
-}
+/**
+ * ============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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.migration.v14;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+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.__;
+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;
+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;
+
+@MigrationPriority(100)
+@MigrationDangerRating(1)
+//@Enabled
+public class MigrateSdnaIvlanData extends Migrator {
+
+ private final String CONFIGURATION_NODE_TYPE = "configuration";
+ private final String EVC_NODE_TYPE = "evc";
+ private final String FORWARDER_NODE_TYPE = "forwarder";
+ private final String FORWRDER_EVC_NODE_TYPE = "forwarder-evc";
+ private final String FORWARDING_PATH_NODE_TYPE = "forwarding-path";
+ private final String PNF_NODE_TYPE = "pnf";
+ private final String P_INTERFACE_NODE_TYPE = "p-interface";
+ private final String LAG_INTERFACE_NODE_TYPE = "lag-interface";
+ private final String SAREA_GLOBAL_CUSTOMER_ID = "8a00890a-e6ae-446b-9dbe-b828dbeb38bd";
+
+ GraphTraversal<Vertex, Vertex> serviceSubscriptionGt;
+
+ private static GraphTraversalSource g = null;
+ private static boolean success = true;
+ private static boolean checkLog = false;
+ private int headerLength;
+ private int migrationSuccess = 0;
+ private int migrationFailure = 0;
+ private int invalidPInterfaceCount = 0;
+ private int invalidLagInterfaceCount = 0;
+
+
+ private static List<String> dmaapMsgList = new ArrayList<String>();
+ private static final String homeDir = System.getProperty("AJSC_HOME");
+
+ private static List<String> validPnfList = new ArrayList<String>();
+ private static List<String> invalidPnfList = new ArrayList<String>();
+
+ private static Map<String, List<String>> validInterfaceMap = new HashMap<String, List<String>>();
+ private static Map<String, List<String>> invalidInterfaceMap = new HashMap<String, List<String>>();
+
+ protected class SdnaIvlanFileData{
+ String evcName;
+ String pnfName;
+ String interfaceAID;
+ int ivlanValue;
+
+ public String getEvcName() {
+ return evcName;
+ }
+ public void setEvcName(String evcName) {
+ this.evcName = evcName;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+ public String getInterfaceAID() {
+ return interfaceAID;
+ }
+ public void setInterfaceAID(String interfaceAID) {
+ this.interfaceAID = interfaceAID;
+ }
+
+ public int getIvlanValue() {
+ return ivlanValue;
+ }
+ public void setIvlanValue(int ivlanValue) {
+ this.ivlanValue = ivlanValue;
+ }
+
+ }
+
+ private static ArrayList<SdnaIvlanFileData> ivlanList = new ArrayList<SdnaIvlanFileData>();
+
+ public MigrateSdnaIvlanData(TransactionalGraphEngine engine, LoaderFactory loaderFactory, EdgeIngestor edgeIngestor, EdgeSerializer edgeSerializer, SchemaVersions schemaVersions) {
+ super(engine, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
+
+ this.g = this.engine.asAdmin().getTraversalSource();
+ this.serviceSubscriptionGt = g.V().has("global-customer-id", SAREA_GLOBAL_CUSTOMER_ID).in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA");
+ }
+
+ @Override
+ public void run() {
+ logger.info("---------- Start migration ----------");
+ String configDir = System.getProperty("BUNDLECONFIG_DIR");
+ if (homeDir == null) {
+ logger.info(this.MIGRATION_ERROR + "ERROR: Could not find sys prop AJSC_HOME");
+ success = false;
+ return;
+ }
+ if (configDir == null) {
+ success = false;
+ return;
+ }
+
+ String feedDir = homeDir + "/" + configDir + "/" + "migration-input-files/sarea-inventory/";
+
+ int fileLineCounter = 0;
+
+ String fileName = feedDir+ "ivlanData.csv";
+ logger.info(fileName);
+ logger.info("---------- Processing Entries from file ----------");
+
+
+ try {
+ List<String> lines = Files.readAllLines(Paths.get(fileName));
+ Iterator<String> lineItr = lines.iterator();
+ while (lineItr.hasNext()){
+ String line = lineItr.next().trim();
+ if (!line.isEmpty()) {
+ if (fileLineCounter != 0) {
+
+ try{
+ String[] colList = line.split(",", -1);
+ SdnaIvlanFileData lineData = new SdnaIvlanFileData();
+ lineData.setEvcName(colList[0].trim());
+ lineData.setPnfName(colList[1].trim());
+ lineData.setInterfaceAID(colList[2].trim());
+ lineData.setIvlanValue(Integer.valueOf(colList[3].trim()));
+ ivlanList.add(lineData);
+
+ } catch (Exception e){
+ logger.info(this.MIGRATION_ERROR + " ERROR: Record Format is invalid. Expecting Numeric value for Forwarder_Id and Ivlan_Value. Skipping Record: " + line);
+ this.migrationFailure++;
+ }
+
+ } else {
+ this.headerLength = line.split(",", -1).length;
+ if (this.headerLength < 4){
+ logger.info(this.MIGRATION_ERROR + "ERROR: Input file should have atleast 4 columns");
+ this.success = false;
+ return;
+ }
+ }
+ }
+ fileLineCounter++;
+ }
+
+ processSdnaIvlan();
+
+ int invalidInterfacesCount = getInvalidInterfaceCount();
+
+ logger.info ("\n \n ******* Final Summary for SDN-A IVLAN Migration ********* \n");
+ logger.info(this.MIGRATION_SUMMARY_COUNT + "SDN-A forward-evcs: IVLANs updated: "+ migrationSuccess);
+ logger.info(this.MIGRATION_SUMMARY_COUNT + "Total File Record Count: "+(fileLineCounter - 1));
+ logger.info(this.MIGRATION_SUMMARY_COUNT + "Unprocessed SDNA File Records : "+ migrationFailure);
+ logger.info(this.MIGRATION_SUMMARY_COUNT + "PNFs from Input File not found : "+ Integer.toString(invalidPnfList.size()) + "\n");
+
+
+ logger.info(this.MIGRATION_SUMMARY_COUNT + "Total PNF + P-INTERFACEs from Input File not found : " + Integer.toString(invalidPInterfaceCount));
+ logger.info(this.MIGRATION_SUMMARY_COUNT + "Total PNF + LAG-INTERFACEs from Input File not found : " + Integer.toString(invalidLagInterfaceCount));
+ logger.info(this.MIGRATION_SUMMARY_COUNT + "Total PNF/INTERFACEs from Input File not found : " + Integer.toString(invalidInterfacesCount));
+
+ } catch (FileNotFoundException e) {
+ logger.info(this.MIGRATION_ERROR + "ERROR: Could not find file " + fileName, e.getMessage());
+ success = false;
+ checkLog = true;
+ } catch (NoSuchFileException e) {
+ logger.info(this.MIGRATION_ERROR + "ERROR: Could not find file " + fileName, e.getMessage());
+ success = false;
+ checkLog = true;
+ } catch (IOException e) {
+ logger.info(this.MIGRATION_ERROR + "ERROR: Issue reading file " + fileName, e);
+ success = false;
+ } catch (Exception e) {
+ logger.info(this.MIGRATION_ERROR + "encountered exception", e);
+ e.printStackTrace();
+ success = false;
+ }
+
+ }
+ private void processSdnaIvlan() {
+
+ for(int i = 0; i < ivlanList.size(); i ++) {
+ String evc = ivlanList.get(i).getEvcName();
+ String pnf = ivlanList.get(i).getPnfName();
+ String interfaceId = ivlanList.get(i).getInterfaceAID();
+ String ivlanValue = Integer.toString(ivlanList.get(i).getIvlanValue());
+
+ Boolean pnfExists = pnfExists(pnf);
+ GraphTraversal<Vertex, Vertex> forwarderEvcGT;
+ Vertex forwarderEvcVtx = null;
+ String interfaceNodeType;
+ String forwarderEvcId = null;
+
+ if (!pnfExists){
+ migrationFailure++;
+ }else{
+
+ if (interfaceId.contains(".")){
+ interfaceNodeType = P_INTERFACE_NODE_TYPE;
+ }else{
+ interfaceNodeType = LAG_INTERFACE_NODE_TYPE;
+ }
+
+ validateInterface(pnf, interfaceNodeType, interfaceId);
+
+ forwarderEvcGT = g.V()
+ .has("pnf-name", pnf).has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE)
+ .in("tosca.relationships.network.BindsTo")
+ .has(AAIProperties.NODE_TYPE, interfaceNodeType).has("interface-name", interfaceId)
+ .in("org.onap.relationships.inventory.ForwardsTo")
+ .where(__.out("org.onap.relationships.inventory.BelongsTo").has("forwarding-path-id", evc))
+ .out("org.onap.relationships.inventory.Uses")
+ .in("org.onap.relationships.inventory.BelongsTo");
+
+ // fwd-evc not found for pnf + interface
+ if(!forwarderEvcGT.hasNext()){
+ forwarderEvcId = pnf + " " + evc;
+ migrationError(PNF_NODE_TYPE + "/" + EVC_NODE_TYPE, forwarderEvcId, "ivlan", ivlanValue);
+
+ }
+
+ while(forwarderEvcGT.hasNext()){
+ forwarderEvcVtx = forwarderEvcGT.next();
+
+ // fwd-evc vertex is null
+ if(forwarderEvcVtx == null){
+ forwarderEvcId = pnf + " " + evc;
+ migrationError(PNF_NODE_TYPE + "/" + EVC_NODE_TYPE, forwarderEvcId, "ivlan", ivlanValue);
+ }
+ // update fwd-evc with ivlan value
+ else{
+
+ forwarderEvcId = forwarderEvcVtx.property("forwarder-evc-id").value().toString();
+ try{
+ forwarderEvcVtx.property("ivlan", ivlanValue);
+ logger.info(String.format("Updating Node Type forwarder-evc Property ivlan value %s", ivlanValue.toString()));
+ this.touchVertexProperties(forwarderEvcVtx, false);
+ updateDmaapList(forwarderEvcVtx);
+ migrationSuccess++;
+
+ }catch (Exception e){
+ logger.info(e.toString());
+ migrationError(FORWRDER_EVC_NODE_TYPE, forwarderEvcId, "ivlan", ivlanValue);
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+ /**
+ * Description: Validate if pnf node exists in Graph
+ * @param pnf
+ * @return boolean
+ */
+ private boolean pnfExists(String pnf){
+ if (invalidPnfList.contains(pnf)){
+ logger.info(this.MIGRATION_ERROR + "ERROR: PNF value " + pnf + " does not exist.");
+ return false;
+ }
+ if (validPnfList.contains(pnf)){
+ return true;
+ }
+
+ GraphTraversal<Vertex, Vertex> pnfGT = g.V()
+ .has("pnf-name", pnf).has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE);
+
+ if(pnfGT.hasNext()){
+ validPnfList.add(pnf);
+ return true;
+ }
+ else{
+ logger.info(this.MIGRATION_ERROR + "ERROR: PNF value " + pnf + " does not exist.");
+ invalidPnfList.add(pnf);
+ return false;
+ }
+
+ }
+
+ /**
+ * Description: Validate if p-interface or lag-interface node exists in Graph
+ * @param pnf
+ * @param interfaceNodeType
+ * @param interfaceName
+ */
+ private void validateInterface(String pnf, String interfaceNodeType, String interfaceName){
+
+ List <String> validInterfaceList;
+ List <String> invalidInterfaceList;
+
+ if(!validInterfaceMap.containsKey(pnf) ){
+ validInterfaceList = new ArrayList<String>();
+ }else{
+ validInterfaceList = validInterfaceMap.get(pnf);
+ }
+
+ if(!invalidInterfaceMap.containsKey(pnf)){
+ invalidInterfaceList = new ArrayList<String>();
+ }else{
+ invalidInterfaceList = invalidInterfaceMap.get(pnf);
+ }
+
+ if(invalidInterfaceList.contains(interfaceName)){
+ logger.info(this.MIGRATION_ERROR + "ERROR PNF " + pnf + " with a " + interfaceNodeType + " of " + interfaceName + " does not exist.");
+ return;
+ }
+ if(validInterfaceList.contains(interfaceName)){
+ return;
+ }
+
+ GraphTraversal<Vertex, Vertex> interfaceGT = g.V()
+ .has("pnf-name", pnf).has(AAIProperties.NODE_TYPE, PNF_NODE_TYPE)
+ .in("tosca.relationships.network.BindsTo")
+ .has("interface-name", interfaceName).has(AAIProperties.NODE_TYPE, interfaceNodeType);
+
+ if(interfaceGT.hasNext()){
+ validInterfaceList.add(interfaceName);
+ validInterfaceMap.put(pnf, validInterfaceList);
+ }
+ else{
+ logger.info(this.MIGRATION_ERROR + "ERROR PNF " + pnf + " with a " + interfaceNodeType + " of " + interfaceName + " does not exist.");
+ invalidInterfaceList.add(interfaceName);
+ invalidInterfaceMap.put(pnf, invalidInterfaceList);
+ }
+ }
+
+
+ /**
+ * Description: Error Routine if graph is not updated by input file record
+ * @param nodeType
+ * @param nodeId
+ * @param property
+ * @param propertyValue
+ */
+ private void migrationError(String nodeType, String nodeId, String property, String propertyValue){
+ logger.info(this.MIGRATION_ERROR + "ERROR: Failure to update "
+ + nodeType + " ID " + nodeId + ", " + property + " to value " + propertyValue
+ + ". Node Not Found \n");
+ migrationFailure++;
+ }
+
+ private int getInvalidInterfaceCount(){
+ int interfaceCount = 0;
+
+ for (Map.Entry<String, List<String>> entry: invalidInterfaceMap.entrySet()){
+ String key = entry.getKey();
+ List <String> invalidList = invalidInterfaceMap.get(key);
+
+ for (int i = 0; i < invalidList.size(); i++){
+ if(invalidList.get(i).contains(".")){
+ invalidPInterfaceCount++;
+ }else{
+ invalidLagInterfaceCount++;
+ }
+
+ }
+ interfaceCount = interfaceCount + invalidInterfaceMap.get(key).size();
+ }
+ return interfaceCount;
+ }
+
+ /**
+ * Description: Dmaap Routine
+ * @param v
+ */
+ private void updateDmaapList(Vertex v){
+ String dmaapMsg = System.nanoTime() + "_" + v.id().toString() + "_" + v.value("resource-version").toString();
+ dmaapMsgList.add(dmaapMsg);
+ logger.info("\tAdding Updated Vertex " + v.id().toString() + " to dmaapMsgList....");
+ }
+
+ @Override
+ public Status getStatus() {
+ if (checkLog) {
+ return Status.CHECK_LOGS;
+ }
+ else if (success) {
+ return Status.SUCCESS;
+ }
+ else {
+ return Status.FAILURE;
+ }
+ }
+
+ @Override
+ public void commit() {
+ engine.commit();
+ createDmaapFiles(dmaapMsgList);
+ }
+
+ @Override
+ public Optional<String[]> getAffectedNodeTypes() {
+ return Optional.of(new String[]{this.FORWRDER_EVC_NODE_TYPE});
+ }
+
+
+ @Override
+ public String getMigrationName() {
+ return "MigrateSdnaIvlanData";
+ }
+
+}
diff --git a/src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java b/src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java
index 80944ff..54ed12c 100644
--- a/src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java
+++ b/src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java
@@ -46,7 +46,7 @@ import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.introspection.Introspector;
-@Enabled
+//@Enabled
@MigrationPriority(10)
@MigrationDangerRating(100)
public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
diff --git a/src/main/java/org/onap/aai/schema/GenTester.java b/src/main/java/org/onap/aai/schema/GenTester.java
index f35cece..78bb4af 100644
--- a/src/main/java/org/onap/aai/schema/GenTester.java
+++ b/src/main/java/org/onap/aai/schema/GenTester.java
@@ -145,31 +145,37 @@ public class GenTester {
return;
}
+ GraphAdminDBUtils.logConfigs(graph.configuration());
+
// Load the propertyKeys, indexes and edge-Labels into the DB
JanusGraphManagement graphMgt = graph.openManagement();
- imsg = "-- Loading new schema elements into JanusGraph --";
- System.out.println(imsg);
- LOGGER.info(imsg);
- SchemaGenerator.loadSchemaIntoJanusGraph(graph, graphMgt, null);
- if( graph != null ){
- imsg = "-- graph commit";
- System.out.println(imsg);
- LOGGER.info(imsg);
- graph.tx().commit();
-
- imsg = "-- graph shutdown ";
- System.out.println(imsg);
- LOGGER.info(imsg);
- graph.close();
- }
+ imsg = "-- Loading new schema elements into JanusGraph --";
+ System.out.println(imsg);
+ LOGGER.info(imsg);
+ SchemaGenerator.loadSchemaIntoJanusGraph(graph, graphMgt, null);
} catch(Exception ex) {
- ErrorLogHelper.logError("AAI_4000", ex.getMessage());
- System.exit(1);
+ ErrorLogHelper.logError("AAI_4000", ex.getMessage());
}
+
+
+ if( graph != null ){
+ String imsg = "-- graph commit";
+ System.out.println(imsg);
+ LOGGER.info(imsg);
+ graph.tx().commit();
+ imsg = "-- graph shutdown ";
+ System.out.println(imsg);
+ LOGGER.info(imsg);
+ graph.close();
+ }
+
LOGGER.auditEvent("-- all done, if program does not exit, please kill.");
System.exit(0);
}
+
+
+
}