summaryrefslogtreecommitdiffstats
path: root/cadi
diff options
context:
space:
mode:
authorInstrumental <jcgmisc@stl.gathman.org>2018-04-06 14:59:36 -0500
committerInstrumental <jcgmisc@stl.gathman.org>2018-04-06 15:00:23 -0500
commit679f142a91b165a958b5739808d6409d6960b6f4 (patch)
treec8aa0834337d13b54307c462ae7182728176d065 /cadi
parent103d3ca78423b8c90be7ab3ce76c7144f31476d7 (diff)
Make cross-container access work
Issue-ID: AAF-218 Change-Id: Ib31646e3ce6e38c2ef0a02fe1d2f57cf963a5a4a Signed-off-by: Instrumental <jcgmisc@stl.gathman.org>
Diffstat (limited to 'cadi')
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java3
2 files changed, 13 insertions, 4 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
index 6c1d6682..e9a80dda 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
@@ -27,10 +27,10 @@ import java.net.URI;
import java.net.UnknownHostException;
import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.Access.Level;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
-import org.onap.aaf.cadi.Access.Level;
import org.onap.aaf.cadi.aaf.v2_0.AAFCon;
import org.onap.aaf.cadi.client.Future;
import org.onap.aaf.cadi.client.Rcli;
@@ -75,8 +75,17 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
mep = new MgmtEndpoint();
mep.setName(name);
mep.setPort(port);
-
+
try {
+ String hostnameToRegister = access.getProperty(Config.CADI_REGISTRATION_HOSTNAME, null);
+ if(hostnameToRegister==null) {
+ hostnameToRegister = access.getProperty(Config.HOSTNAME, null);
+ }
+ if(hostnameToRegister==null) {
+ hostnameToRegister = Inet4Address.getLocalHost().getHostName();
+ }
+ mep.setHostname(hostnameToRegister);
+
String latitude = access.getProperty(Config.CADI_LATITUDE, null);
if(latitude==null) {
latitude = access.getProperty("AFT_LATITUDE", null);
@@ -97,7 +106,6 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
mep.setMinor(split.length>1?Integer.parseInt(split[1]):0);
mep.setMajor(split.length>0?Integer.parseInt(split[0]):0);
- mep.setHostname(access.getProperty(Config.HOSTNAME, Inet4Address.getLocalHost().getHostName()));
String subprotocols = access.getProperty(Config.CADI_PROTOCOLS, null);
if(subprotocols==null) {
mep.setProtocol("http");
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
index 0871a205..26ad758f 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
@@ -71,6 +71,7 @@ public class Config {
// As of 1.0.2, these have had the dots removed so as to be compatible with JavaBean style
// configurations as well as property list style.
public static final String HOSTNAME = "hostname";
+ public static final String CADI_REGISTRATION_HOSTNAME = "cadi_registration_hostname";
public static final String CADI_PROP_FILES = "cadi_prop_files"; // Additional Properties files (separate with ;)
public static final String CADI_LOGLEVEL = "cadi_loglevel";
public static final String CADI_LOGDIR = "cadi_log_dir";
@@ -476,7 +477,7 @@ public class Config {
public static String logProp(Access access,String tag, String def) {
String rv = access.getProperty(tag, def);
if(rv == null) {
- access.log(Level.INIT,tag,"is not set");
+ access.log(Level.INIT,tag,"is not explicitly set");
} else {
access.log(Level.INIT,tag,"is set to",rv);
}