summaryrefslogtreecommitdiffstats
path: root/cadi
diff options
context:
space:
mode:
Diffstat (limited to 'cadi')
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java13
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java1
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java9
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java2
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java2
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java28
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java10
7 files changed, 34 insertions, 31 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
index 004c43c5..d3804743 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
@@ -142,9 +142,19 @@ public class TestConnectivity {
}
private static URI uri(PropAccess access, String ms) throws URISyntaxException {
- String aaf_root_ns = access.getProperty(Config.AAF_ROOT_NS,"AAF_NS");
+ String aaf_root_ns = access.getProperty(Config.AAF_ROOT_NS,Config.AAF_ROOT_NS_DEF);
String aaf_api_version = access.getProperty(Config.AAF_API_VERSION,Config.AAF_DEFAULT_API_VERSION);
String aaf_locate_url = access.getProperty(Config.AAF_LOCATE_URL,Defaults.AAF_LOCATE_CONST);
+ String aaf_container = access.getProperty(Config.AAF_LOCATOR_CONTAINER,null);
+ if(aaf_container!=null) {
+ String ns = access.getProperty(Config.AAF_LOCATOR_CONTAINER_NS+'.'+aaf_container,null);
+ if(ns==null) {
+ ns = access.getProperty(Config.AAF_LOCATOR_CONTAINER_NS,null);
+ }
+ if(ns!=null) {
+ aaf_root_ns=ns + '.' + aaf_root_ns;
+ }
+ }
if("cm".equals(ms) && "2.0".equals(aaf_api_version)) {
ms = "certman";
}
@@ -187,6 +197,7 @@ public class TestConnectivity {
if (tokenURL==null || (tokenURL.contains("/locate/") && locateURL!=null)) {
tokenURL=Config.OAUTH2_TOKEN_URL_DEF;
}
+
try {
HRenewingTokenSS hrtss = new HRenewingTokenSS(access, tokenURL);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
index c7a74965..e04015c4 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
@@ -50,7 +50,6 @@ import org.onap.aaf.cadi.CmdLine;
import org.onap.aaf.cadi.LocatorException;
import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.Symm;
-import org.onap.aaf.cadi.aaf.Defaults;
import org.onap.aaf.cadi.aaf.client.ErrMessage;
import org.onap.aaf.cadi.aaf.v2_0.AAFCon;
import org.onap.aaf.cadi.aaf.v2_0.AAFConHttp;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
index d066d97a..1b8b76e4 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
@@ -152,7 +152,7 @@ public class PropHolder {
pw.println(System.getProperty("user.name"));
pw.print("# on ");
pw.println(Chrono.dateStamp());
- pw.println("# @copyright 2016, AT&T");
+ pw.println("# @copyright 2019, AT&T");
for (int i=0;i<60;++i) {
pw.print('#');
}
@@ -160,16 +160,9 @@ public class PropHolder {
for (Map.Entry<String,String> me : props.entrySet()) {
String key = me.getKey();
- //if ( key.startsWith("cm_")
-// || key.startsWith(Config.HOSTNAME)
-// || key.startsWith("aaf")
-// || key.startsWith("cadi")
-// || key.startsWith("Challenge")
-// ) {
pw.print(key);
pw.print('=');
pw.println(me.getValue());
-// }
}
} finally {
pw.close();
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
index 06ef0ca5..6f3884b7 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
@@ -141,7 +141,7 @@ public class JU_RegistrationCreator {
String k8s_public_hostname="k8s.public.com";
int public_port = 30001;
- pa.setProperty(Config.AAF_LOCATOR_PUBLIC_HOSTNAME,k8s_public_hostname);
+ pa.setProperty(Config.AAF_LOCATOR_PUBLIC_FQDN,k8s_public_hostname);
pa.setProperty(Config.AAF_LOCATOR_PUBLIC_PORT+DOT_OOM,Integer.toString(public_port));
pa.setProperty(Config.AAF_LOCATOR_APP_NS, Config.AAF_ROOT_NS_DEF);
rc = new RegistrationCreator(pa);
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 3dc7f06c..07a791e8 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
@@ -180,7 +180,7 @@ public class Config {
public static final String AAF_LOCATOR_FQDN = "aaf_locator_fqdn";
public static final String AAF_LOCATOR_NAME = "aaf_locator_name";
public static final String AAF_LOCATOR_PUBLIC_PORT = "aaf_locator_public_port";
- public static final String AAF_LOCATOR_PUBLIC_HOSTNAME = "aaf_locator_public_hostname";
+ public static final String AAF_LOCATOR_PUBLIC_FQDN = "aaf_locator_public_fqdn";
public static final String AAF_APPID = "aaf_id";
public static final String AAF_APPPASS = "aaf_password";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
index 87abb963..997803bb 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
@@ -34,7 +34,7 @@ public class RegistrationPropHolder {
private final Access access;
public String hostname;
private int port;
- public String public_hostname;
+ public String public_fqdn;
private Integer public_port;
public Float latitude;
public Float longitude;
@@ -85,9 +85,9 @@ public class RegistrationPropHolder {
access.printf(Level.INIT, REGI,"hostname",hostname);
}
- public_hostname = access.getProperty(Config.AAF_LOCATOR_PUBLIC_HOSTNAME, hostname);
+ public_fqdn = access.getProperty(Config.AAF_LOCATOR_PUBLIC_FQDN, hostname);
if(firstlog) {
- access.printf(Level.INIT, REGI,"public_hostname",public_hostname);
+ access.printf(Level.INIT, REGI,"public_fqdn",public_fqdn);
}
default_name = access.getProperty(Config.AAF_LOCATOR_NAME, PUBLIC_NAME);
@@ -121,11 +121,11 @@ public class RegistrationPropHolder {
// Note: only one of the ports can be public... Therefore, only the last
for(String le : Split.splitTrim(',', lcontainer)) {
dot_le = le.isEmpty()?le :"."+le;
- str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_HOSTNAME+dot_le,null);
+ str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_FQDN+dot_le,null);
if( str != null && !str.isEmpty()) {
- public_hostname=str;
+ public_fqdn=str;
if(firstlog) {
- access.printf(Level.INIT, "RegistrationProperty: public_hostname(overloaded by %s)='%s'",dot_le,public_hostname);
+ access.printf(Level.INIT, "RegistrationProperty: public_hostname(overloaded by %s)='%s'",dot_le,public_fqdn);
}
}
}
@@ -153,8 +153,8 @@ public class RegistrationPropHolder {
public String getEntryFQDN(final String entry, final String dot_le) {
String str;
- if(public_hostname!=null && dot_le.isEmpty()) {
- str = public_hostname;
+ if(public_fqdn!=null && dot_le.isEmpty()) {
+ str = public_fqdn;
} else {
str = access.getProperty(Config.AAF_LOCATOR_FQDN+dot_le, default_fqdn);
}
@@ -164,7 +164,7 @@ public class RegistrationPropHolder {
public String getEntryName(final String entry, final String dot_le) {
String str;
if(dot_le.isEmpty()) {
- str = PUBLIC_NAME;
+ str = default_name;
} else {
str = access.getProperty(Config.AAF_LOCATOR_NAME+dot_le, default_name);
}
@@ -245,10 +245,10 @@ public class RegistrationPropHolder {
// aaf_root_ns
if(value.indexOf("AAF_NS")>=0) {
- str = access.getProperty(Config.AAF_ROOT_NS, Config.AAF_ROOT_NS_DEF);
- String temp = value.replace("%AAF_NS", str);
+ str = access.getProperty(Config.AAF_ROOT_NS, Config.AAF_ROOT_NS_DEF) + '.';
+ String temp = value.replace("%AAF_NS.", str);
if(temp.equals(value)) { // intended
- value = value.replace("AAF_NS", str); // Backward Compatibility
+ value = value.replace("AAF_NS.", str); // Backward Compatibility
} else {
value = temp;
}
@@ -263,8 +263,8 @@ public class RegistrationPropHolder {
if(default_fqdn!=null) {
value = value.replace("%DF", default_fqdn);
}
- if(public_hostname!=null) {
- value = value.replace("%PH", public_hostname);
+ if(public_fqdn!=null) {
+ value = value.replace("%PH", public_fqdn);
}
}
access.printf(Level.DEBUG,
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
index 359b3c2d..68235e1a 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
@@ -67,7 +67,7 @@ public class JU_RegistrationPropHolder {
for(String dot_le : new String[] {"",".helm"}) {
assertEquals(rph.hostname,rph.default_fqdn);
assertEquals("",rph.lcontainer);
- assertEquals(rph.hostname,rph.public_hostname);
+ assertEquals(rph.hostname,rph.public_fqdn);
assertEquals(ju_port,rph.getEntryPort(dot_le));
assertEquals(rph.hostname,rph.getEntryFQDN("",dot_le));
}
@@ -77,7 +77,7 @@ public class JU_RegistrationPropHolder {
for(String dot_le : new String[] {"",".helm"}) {
assertEquals(rph.hostname,rph.default_fqdn);
assertEquals("",rph.lcontainer);
- assertEquals(rph.hostname,rph.public_hostname);
+ assertEquals(rph.hostname,rph.public_fqdn);
assertEquals(ju_port,rph.getEntryPort(dot_le));
assertEquals(rph.hostname,rph.getEntryFQDN("",dot_le));
}
@@ -87,7 +87,7 @@ public class JU_RegistrationPropHolder {
for(String dot_le : new String[] {"",".helm"}) {
assertEquals(rph.hostname,rph.default_fqdn);
assertEquals("",rph.lcontainer);
- assertEquals(rph.hostname,rph.public_hostname);
+ assertEquals(rph.hostname,rph.public_fqdn);
assertEquals(ju_port,rph.getEntryPort(dot_le));
assertEquals(rph.hostname,rph.getEntryFQDN("",dot_le));
}
@@ -97,10 +97,10 @@ public class JU_RegistrationPropHolder {
////////////////
String public_hostname = "com.public.hostname";
int public_port = 999;
- pa.setProperty(Config.AAF_LOCATOR_PUBLIC_HOSTNAME, public_hostname);
+ pa.setProperty(Config.AAF_LOCATOR_PUBLIC_FQDN, public_hostname);
pa.setProperty(Config.AAF_LOCATOR_PUBLIC_PORT,Integer.toString(public_port));
RegistrationPropHolder pubRPH = new RegistrationPropHolder(pa,ju_port);
- assertEquals(public_hostname,pubRPH.public_hostname);
+ assertEquals(public_hostname,pubRPH.public_fqdn);
assertEquals(public_port,pubRPH.getEntryPort(""));