aboutsummaryrefslogtreecommitdiffstats
path: root/utils/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'utils/src/main/java/org')
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/network/NetworkUtil.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/network/NetworkUtil.java b/utils/src/main/java/org/onap/policy/common/utils/network/NetworkUtil.java
index e3539fb7..6698d7cf 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/network/NetworkUtil.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/network/NetworkUtil.java
@@ -26,6 +26,7 @@ import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
+import java.util.UUID;
import javax.net.ssl.TrustManager;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -170,4 +171,15 @@ public final class NetworkUtil {
return "127.0.0.1";
}
+
+ /**
+ * Generates a globally unique name, typically for use in PDP messages, to uniquely
+ * identify a PDP (or PAP), regardless on what cluster it resides.
+ *
+ * @param prefix text to be prepended to the generated value
+ * @return a globally unique name
+ */
+ public static String genUniqueName(String prefix) {
+ return prefix + "-" + UUID.randomUUID();
+ }
}