From 679f142a91b165a958b5739808d6409d6960b6f4 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Fri, 6 Apr 2018 14:59:36 -0500 Subject: Make cross-container access work Issue-ID: AAF-218 Change-Id: Ib31646e3ce6e38c2ef0a02fe1d2f57cf963a5a4a Signed-off-by: Instrumental --- .../java/org/onap/aaf/cadi/register/RemoteRegistrant.java | 14 +++++++++++--- .../src/main/java/org/onap/aaf/cadi/config/Config.java | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'cadi') 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 implements Registrant { 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 implements Registrant { 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); } -- cgit 1.2.3-korg