aboutsummaryrefslogtreecommitdiffstats
path: root/services/services-onappf/src/main/java/org
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-06-28 16:01:47 -0400
committerJim Hahn <jrh3@att.com>2021-06-28 16:11:55 -0400
commit5085e4f6a3ca51ccd780464464b53e70f66baf50 (patch)
treeaa000c5cc595eb292ac46fcb045ac1a96c8949a3 /services/services-onappf/src/main/java/org
parent63637d939697451d3ac63216d938780a157ff895 (diff)
Use unique name in apex-pdp messages
Used name generator for apex-pdp instance id. Issue-ID: POLICY-3410 Change-Id: Ifcb216d45fba7d6b10043f39fcb299daffe86b69 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'services/services-onappf/src/main/java/org')
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java5
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java12
2 files changed, 10 insertions, 7 deletions
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
index b9424c274..abd8d4436 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
@@ -80,6 +80,9 @@ public class ApexStarterActivator {
@Getter
private List<ToscaConceptIdentifier> supportedPolicyTypes;
+ @Getter
+ private final String instanceId;
+
/**
* Instantiate the activator for onappf PDP-A.
*
@@ -93,7 +96,7 @@ public class ApexStarterActivator {
topicSources = TopicEndpointManager.getManager()
.addTopicSources(apexStarterParameterGroup.getTopicParameterGroup().getTopicSources());
- final String instanceId = NetworkUtil.getHostname();
+ instanceId = NetworkUtil.genUniqueName("apex");
LOGGER.debug("ApexStarterActivator initializing with instance id: {}", instanceId);
try {
this.apexStarterParameterGroup = apexStarterParameterGroup;
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java
index 12a34ef57..1c6b88700 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -35,7 +36,6 @@ public class HealthCheckProvider {
private static final String NOT_ALIVE = "not alive";
private static final String ALIVE = "alive";
private static final String URL = "self";
- private static final String NAME = "Policy PDP-A";
/**
* Performs the health check of PAP service.
@@ -43,13 +43,13 @@ public class HealthCheckProvider {
* @return Report containing health check status
*/
public HealthCheckReport performHealthCheck() {
+ final ApexStarterActivator activator =
+ Registry.get(ApexStarterConstants.REG_APEX_STARTER_ACTIVATOR, ApexStarterActivator.class);
+ final boolean alive = activator.isAlive();
+
final HealthCheckReport report = new HealthCheckReport();
- report.setName(NAME);
+ report.setName(activator.getInstanceId());
report.setUrl(URL);
-
- final boolean alive =
- Registry.get(ApexStarterConstants.REG_APEX_STARTER_ACTIVATOR, ApexStarterActivator.class).isAlive();
-
report.setHealthy(alive);
report.setCode(alive ? 200 : 500);
report.setMessage(alive ? ALIVE : NOT_ALIVE);