Added payload logging and configurable duplicate check
[sim/a1-interface.git] / near-rt-ric-simulator / src / common / utils.py
index 1ed2a7e..f0df448 100644 (file)
@@ -1,5 +1,5 @@
 #  ============LICENSE_START===============================================
-#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  Copyright (C) 2021 Nordix Foundation. 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.
 #  ============LICENSE_END=================================================
 #
 
-#Calculate a fingerprint from sorted items of a dict
-def calcFingerprint(p):
+#Calculate a fingerprint from sorted items of a dict, appending an optional id
+def calcFingerprint(p, pid=None):
   m=''
+  ext=''
+  if (pid is not None):
+    ext=pid
   if (p is dict):
     for i in sorted (p.keys()):
       m = m+str(i)+calcFingerprint(p[i])
   else:
-    return str(p)
-  return m
\ No newline at end of file
+    return str(p)+ext
+  return m+ext
\ No newline at end of file