summaryrefslogtreecommitdiffstats
path: root/asdctool/src/main/resources/scripts/python/duplicates.py
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 10:28:42 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 10:51:01 +0200
commit451a3400b76511393c62a444f588a4ed15f4a549 (patch)
treee4f5873a863d1d3e55618eab48b83262f874719d /asdctool/src/main/resources/scripts/python/duplicates.py
parent5abfe4e1fb5fae4bbd5fbc340519f52075aff3ff (diff)
Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'asdctool/src/main/resources/scripts/python/duplicates.py')
-rw-r--r--asdctool/src/main/resources/scripts/python/duplicates.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/asdctool/src/main/resources/scripts/python/duplicates.py b/asdctool/src/main/resources/scripts/python/duplicates.py
new file mode 100644
index 0000000000..be60b05909
--- /dev/null
+++ b/asdctool/src/main/resources/scripts/python/duplicates.py
@@ -0,0 +1,47 @@
+import json
+import sys
+
+dict = {}
+dupliacteUid = {}
+#debugFlag = True
+debugFlag = False
+
+def debug(str1, str2=""):
+ 'print only if debug enabled'
+ if (debugFlag == True): print str1, str2
+
+print 'Number of arguments:', len(sys.argv), 'arguments.'
+
+
+with open(sys.argv[1]) as json_file:
+ json_data = json.load(json_file)
+ for x in json_data['vertices']:
+ uid = None
+ nodeLabel=x.get('nodeLabel')
+ debug(nodeLabel)
+ if ( nodeLabel == 'user' ):
+ uid = x['userId']
+ elif ( nodeLabel == 'tag' ):
+ uid = x['name']
+ elif ( nodeLabel == None ):
+ pass
+ elif ( nodeLabel == 'lockNode' ):
+ uid = x.get('uid')
+ else: uid = x['uid']
+
+ debug(nodeLabel, uid)
+
+ existId = dict.get(uid)
+ if (existId == None):
+ dict[uid] = x.get('_id')
+ else:
+ dupliacteUid[uid] = existId
+
+ print dupliacteUid
+
+# with open('data.txt', 'w') as outfile:
+# json.dump(json_data, outfile)
+
+
+
+# print x['uid']