summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auth-client/pom.xml2
-rw-r--r--auth/auth-batch/pom.xml2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java28
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java7
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java7
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NsRoleUserReport.java127
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyCredExpiring.java11
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java2
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java183
-rw-r--r--auth/auth-cass/cass_init/cmd.sh6
-rw-r--r--auth/auth-cass/docker/dinstall.sh4
-rw-r--r--auth/auth-cass/docker/drun.sh6
-rw-r--r--auth/auth-cass/pom.xml2
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java18
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java137
-rw-r--r--auth/auth-certman/pom.xml2
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java26
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java5
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java2
-rw-r--r--auth/auth-cmd/pom.xml2
-rw-r--r--auth/auth-core/pom.xml2
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java5
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java2
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java54
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java46
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java30
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java2
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/TestKill.java65
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java3
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java3
-rw-r--r--auth/auth-deforg/pom.xml2
-rw-r--r--auth/auth-fs/pom.xml2
-rw-r--r--auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java2
-rw-r--r--auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java3
-rw-r--r--auth/auth-gui/pom.xml2
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java2
-rw-r--r--auth/auth-hello/pom.xml2
-rw-r--r--auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java2
-rw-r--r--auth/auth-locate/pom.xml2
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java2
-rw-r--r--auth/auth-oauth/pom.xml2
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java5
-rw-r--r--auth/auth-service/pom.xml2
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java6
-rw-r--r--auth/docker/.gitignore2
-rw-r--r--auth/docker/Dockerfile.base26
-rw-r--r--auth/docker/Dockerfile.client7
-rw-r--r--auth/docker/Dockerfile.config9
-rw-r--r--auth/docker/Dockerfile.core4
-rw-r--r--auth/docker/Dockerfile.ms5
-rw-r--r--auth/docker/aaf.sh20
-rw-r--r--auth/docker/agent.sh14
-rw-r--r--auth/docker/components4
-rw-r--r--auth/docker/d.props.init12
-rw-r--r--auth/docker/dbash.sh2
-rwxr-xr-xauth/docker/dbuild.sh41
-rw-r--r--auth/docker/drun.sh112
-rw-r--r--auth/docker/dstart.sh2
-rw-r--r--auth/docker/dstop.sh2
-rw-r--r--auth/pom.xml2
-rwxr-xr-xauth/sample/bin/client.sh10
-rw-r--r--auth/sample/bin/pod_wait.sh2
-rw-r--r--auth/sample/bin/service.sh43
-rw-r--r--auth/sample/etc/org.osaaf.aaf.cm.props6
-rw-r--r--auth/sample/etc/org.osaaf.aaf.fs.props4
-rw-r--r--auth/sample/etc/org.osaaf.aaf.gui.props4
-rw-r--r--auth/sample/etc/org.osaaf.aaf.hello.props4
-rw-r--r--auth/sample/etc/org.osaaf.aaf.locate.props5
-rw-r--r--auth/sample/etc/org.osaaf.aaf.oauth.props6
-rw-r--r--auth/sample/etc/org.osaaf.aaf.service.props4
-rw-r--r--auth/sample/local/aaf.props6
-rw-r--r--auth/sample/local/initialConfig.props15
-rw-r--r--cadi/aaf/pom.xml2
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java8
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java45
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java93
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java53
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java7
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java264
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java65
-rw-r--r--cadi/client/pom.xml2
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java44
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java8
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java4
-rw-r--r--cadi/core/pom.xml2
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java64
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java61
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java2
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java2
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java66
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java153
-rw-r--r--cadi/oauth-enduser/pom.xml2
-rw-r--r--cadi/pom.xml2
-rw-r--r--cadi/servlet-sample/pom.xml2
-rw-r--r--conf/CA/bootstrap.sh4
-rw-r--r--conf/CA/san_root.aaf2
-rw-r--r--misc/env/pom.xml2
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java2
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java3
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java4
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java (renamed from misc/env/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java)10
-rw-r--r--misc/log4j/pom.xml2
-rw-r--r--misc/pom.xml2
-rw-r--r--misc/rosetta/pom.xml2
-rw-r--r--misc/xgen/pom.xml2
-rw-r--r--pom.xml2
108 files changed, 1440 insertions, 754 deletions
diff --git a/auth-client/pom.xml b/auth-client/pom.xml
index 837d6471..5c322182 100644
--- a/auth-client/pom.xml
+++ b/auth-client/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>parent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
</parent>
<artifactId>aaf-auth-client</artifactId>
diff --git a/auth/auth-batch/pom.xml b/auth/auth-batch/pom.xml
index c30a32af..1994d9e8 100644
--- a/auth/auth-batch/pom.xml
+++ b/auth/auth-batch/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
index ff605203..d49f4faf 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
@@ -81,6 +81,8 @@ public abstract class Batch {
protected static boolean dryRun;
protected static String batchEnv;
+ private static File logdir;
+
public static final String CASS_ENV = "CASS_ENV";
public static final String LOG_DIR = "LOG_DIR";
protected static final String MAX_EMAILS="MAX_EMAILS";
@@ -324,16 +326,22 @@ public abstract class Batch {
}
}
- protected static String logDir() {
- String ld = env.getProperty(LOG_DIR);
- if (ld==null) {
- if (batchEnv==null) { // Deployed Batch doesn't use different ENVs, and a common logdir
- ld = "logs/";
- } else {
- ld = "logs/"+batchEnv;
- }
- }
- return ld;
+ protected static File logDir() {
+ if(logdir == null) {
+ String ld = env.getProperty(LOG_DIR);
+ if (ld==null) {
+ if (batchEnv==null) { // Deployed Batch doesn't use different ENVs, and a common logdir
+ ld = "logs/";
+ } else {
+ ld = "logs/"+batchEnv;
+ }
+ }
+ logdir = new File(ld);
+ if(!logdir.exists()) {
+ logdir.mkdirs();
+ }
+ }
+ return logdir;
}
protected int count(String str, char c) {
if (str==null || str.isEmpty()) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java
index 7ed26ce5..e171d174 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java
@@ -63,7 +63,6 @@ public class Expiring extends Batch {
private static final String EXPIRED_OWNERS = "ExpiredOwners";
private int minOwners;
private Map<String, CSV.Writer> writerList;
- private File logDir;
private ExpireRange expireRange;
private Date deleteDate;
@@ -87,15 +86,13 @@ public class Expiring extends Batch {
// Create Intermediate Output
writerList = new HashMap<>();
- logDir = new File(logDir());
- logDir.mkdirs();
expireRange = new ExpireRange(trans.env().access());
String sdate = Chrono.dateOnlyStamp(expireRange.now);
for( List<Range> lr : expireRange.ranges.values()) {
for(Range r : lr ) {
if(writerList.get(r.name())==null) {
- File file = new File(logDir,r.name() + sdate +CSV);
+ File file = new File(logDir(),r.name() + sdate +CSV);
CSV csv = new CSV(file);
CSV.Writer cw = csv.writer(false);
cw.row(INFO,r.name(),Chrono.dateOnlyStamp(expireRange.now),r.reportingLevel());
@@ -116,7 +113,7 @@ public class Expiring extends Batch {
@Override
protected void run(AuthzTrans trans) {
try {
- File file = new File(logDir, EXPIRED_OWNERS + Chrono.dateOnlyStamp(expireRange.now) + CSV);
+ File file = new File(logDir(), EXPIRED_OWNERS + Chrono.dateOnlyStamp(expireRange.now) + CSV);
final CSV ownerCSV = new CSV(file);
Map<String, Set<UserRole>> owners = new TreeMap<String, Set<UserRole>>();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
index 2ba5d022..fe754c10 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
@@ -52,7 +52,6 @@ public class NotInOrg extends Batch {
private static final String INFO = "info";
private Map<String, CSV.Writer> writerList;
private Map<String, CSV.Writer> whichWriter;
- private File logDir;
private Date now;
private Writer notInOrgW;
private Writer notInOrgDeleteW;
@@ -76,12 +75,10 @@ public class NotInOrg extends Batch {
// Create Intermediate Output
writerList = new HashMap<>();
whichWriter = new TreeMap<>();
- logDir = new File(logDir());
- logDir.mkdirs();
now = new Date();
String sdate = Chrono.dateOnlyStamp(now);
- File file = new File(logDir,NOT_IN_ORG + sdate +CSV);
+ File file = new File(logDir(),NOT_IN_ORG + sdate +CSV);
CSV csv = new CSV(file);
notInOrgW = csv.writer(false);
notInOrgW.row(INFO,NOT_IN_ORG,Chrono.dateOnlyStamp(now),0);
@@ -89,7 +86,7 @@ public class NotInOrg extends Batch {
// These will have been double-checked by the Organization, and can be deleted immediately.
String fn = NOT_IN_ORG+"Delete";
- file = new File(logDir,fn + sdate +CSV);
+ file = new File(logDir(),fn + sdate +CSV);
CSV csvDelete = new CSV(file);
notInOrgDeleteW = csvDelete.writer(false);
notInOrgDeleteW.row(INFO,fn,Chrono.dateOnlyStamp(now),0);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
index daf51925..547b657f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
@@ -95,7 +95,7 @@ public class Notify extends Batch {
NotifyBody.load(env.access());
// Create Intermediate Output
- File logDir = new File(logDir());
+ File logDir = logDir();
notifyFile = new ArrayList<>();
if(args().length>0) {
for(int i=0;i<args().length;++i) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NsRoleUserReport.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NsRoleUserReport.java
new file mode 100644
index 00000000..8281e747
--- /dev/null
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NsRoleUserReport.java
@@ -0,0 +1,127 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.batch.reports;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.helpers.NS;
+import org.onap.aaf.auth.batch.helpers.Role;
+import org.onap.aaf.auth.batch.helpers.UserRole;
+import org.onap.aaf.auth.batch.helpers.Visitor;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.org.OrganizationException;
+import org.onap.aaf.cadi.util.CSV;
+import org.onap.aaf.cadi.util.CSV.Writer;
+import org.onap.aaf.misc.env.APIException;
+import org.onap.aaf.misc.env.Env;
+import org.onap.aaf.misc.env.TimeTaken;
+import org.onap.aaf.misc.env.util.Chrono;
+
+
+public class NsRoleUserReport extends Batch {
+
+ private static final String REPORT = NsRoleUserReport.class.getSimpleName();
+ private static final String CSV = ".csv";
+ private Date now;
+ private Writer report;
+ private Map<String,Map<String,Integer>> theMap;
+
+ public NsRoleUserReport(AuthzTrans trans) throws APIException, IOException, OrganizationException {
+ super(trans.env());
+ trans.info().log("Starting Connection Process");
+
+ TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
+ try {
+ TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
+ try {
+ session = cluster.connect();
+ } finally {
+ tt.done();
+ }
+
+ // Create Intermediate Output
+ now = new Date();
+ String sdate = Chrono.dateOnlyStamp(now);
+ File file = new File(logDir(),REPORT + sdate +CSV);
+ CSV csv = new CSV(file);
+ report = csv.writer(false);
+
+ theMap = new TreeMap<>();
+
+ NS.load(trans, session, NS.v2_0_11);
+ Role.load(trans, session);
+ } finally {
+ tt0.done();
+ }
+ }
+
+ @Override
+ protected void run(AuthzTrans trans) {
+ try {
+ trans.info().log("Create Report on Roles by NS");
+
+ final AuthzTrans transNoAvg = trans.env().newTransNoAvg();
+ UserRole.load(transNoAvg, session, UserRole.v2_0_11, new Visitor<UserRole>() {
+ @Override
+ public void visit(UserRole ur) {
+ if(ur.expires().after(now)) {
+ Map<String, Integer> roleCount = theMap.get(ur.ns());
+ Integer count;
+ if(roleCount==null) {
+ roleCount = new TreeMap<>();
+ theMap.put(ur.ns(),roleCount);
+ count = 0;
+ } else {
+ count = roleCount.get(ur.rname());
+ if(count == null) {
+ count = 0;
+ }
+ }
+ roleCount.put(ur.rname(), count+1);
+ }
+ }
+ });
+
+ for(Entry<String, Map<String, Integer>> ns_es : theMap.entrySet()) {
+ for(Entry<String, Integer> r_es : ns_es.getValue().entrySet()) {
+ report.row(ns_es.getKey(),r_es.getKey(),r_es.getValue());
+ }
+ }
+
+
+ } finally {
+ }
+ }
+
+ @Override
+ protected void _close(AuthzTrans trans) {
+ session.close();
+ report.close();
+ }
+
+}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyCredExpiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyCredExpiring.java
index ce008164..4288b2e7 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyCredExpiring.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyCredExpiring.java
@@ -29,12 +29,10 @@ import java.io.IOException;
import java.io.PrintStream;
import java.text.ParseException;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
@@ -42,19 +40,10 @@ import org.onap.aaf.auth.batch.Batch;
import org.onap.aaf.auth.batch.BatchPrincipal;
import org.onap.aaf.auth.batch.actions.Email;
import org.onap.aaf.auth.batch.actions.EmailPrint;
-import org.onap.aaf.auth.batch.actions.Message;
-import org.onap.aaf.auth.batch.helpers.Cred;
-import org.onap.aaf.auth.batch.helpers.NS;
import org.onap.aaf.auth.batch.helpers.Notification;
import org.onap.aaf.auth.batch.helpers.UserRole;
-import org.onap.aaf.auth.batch.helpers.Notification.TYPE;
-import org.onap.aaf.auth.dao.hl.Question;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.layer.Result;
-import org.onap.aaf.auth.org.Organization;
-import org.onap.aaf.auth.org.Organization.Identity;
import org.onap.aaf.auth.org.OrganizationException;
-import org.onap.aaf.auth.org.OrganizationFactory;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.util.CSV;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
index 5f6021b3..f2425f4a 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
@@ -84,7 +84,7 @@ public class Remove extends Batch {
final int maxBatch = 25;
// Create Intermediate Output
- File logDir = new File(logDir());
+ File logDir = logDir();
List<File> remove = new ArrayList<>();
if(args().length>0) {
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java
index 661105d3..6902a426 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java
@@ -45,367 +45,367 @@ public class RowCreator {
Row row = new Row() {
@Override
- public boolean isNull(String name) {
+ public boolean isNull(int i) {
// TODO Auto-generated method stub
return false;
}
@Override
- public BigInteger getVarint(String name) {
+ public boolean getBool(int i) {
// TODO Auto-generated method stub
- return null;
+ return false;
}
@Override
- public UUID getUUID(String name) {
+ public byte getByte(int i) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public UDTValue getUDTValue(String name) {
+ public short getShort(int i) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public TupleValue getTupleValue(String name) {
+ public int getInt(int i) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public Date getTimestamp(String name) {
+ public long getLong(int i) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public long getTime(String name) {
+ public Date getTimestamp(int i) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public String getString(String name) {
+ public LocalDate getDate(int i) {
// TODO Auto-generated method stub
return null;
}
@Override
- public short getShort(String name) {
+ public long getTime(int i) {
// TODO Auto-generated method stub
return 0;
}
@Override
- public <T> Set<T> getSet(String name, TypeToken<T> elementsType) {
+ public float getFloat(int i) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public <T> Set<T> getSet(String name, Class<T> elementsClass) {
+ public double getDouble(int i) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public Object getObject(String name) {
+ public ByteBuffer getBytesUnsafe(int i) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <K, V> Map<K, V> getMap(String name, TypeToken<K> keysType, TypeToken<V> valuesType) {
+ public ByteBuffer getBytes(int i) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <K, V> Map<K, V> getMap(String name, Class<K> keysClass, Class<V> valuesClass) {
+ public String getString(int i) {
// TODO Auto-generated method stub
return null;
}
@Override
- public long getLong(String name) {
+ public BigInteger getVarint(int i) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public <T> List<T> getList(String name, TypeToken<T> elementsType) {
+ public BigDecimal getDecimal(int i) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <T> List<T> getList(String name, Class<T> elementsClass) {
+ public UUID getUUID(int i) {
// TODO Auto-generated method stub
return null;
}
@Override
- public int getInt(String name) {
+ public InetAddress getInet(int i) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public InetAddress getInet(String name) {
+ public <T> List<T> getList(int i, Class<T> elementsClass) {
// TODO Auto-generated method stub
return null;
}
@Override
- public float getFloat(String name) {
+ public <T> List<T> getList(int i, TypeToken<T> elementsType) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public double getDouble(String name) {
+ public <T> Set<T> getSet(int i, Class<T> elementsClass) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public BigDecimal getDecimal(String name) {
+ public <T> Set<T> getSet(int i, TypeToken<T> elementsType) {
// TODO Auto-generated method stub
return null;
}
@Override
- public LocalDate getDate(String name) {
+ public <K, V> Map<K, V> getMap(int i, Class<K> keysClass, Class<V> valuesClass) {
// TODO Auto-generated method stub
return null;
}
@Override
- public ByteBuffer getBytesUnsafe(String name) {
+ public <K, V> Map<K, V> getMap(int i, TypeToken<K> keysType, TypeToken<V> valuesType) {
// TODO Auto-generated method stub
return null;
}
@Override
- public ByteBuffer getBytes(String name) {
+ public UDTValue getUDTValue(int i) {
// TODO Auto-generated method stub
return null;
}
@Override
- public byte getByte(String name) {
+ public TupleValue getTupleValue(int i) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public boolean getBool(String name) {
+ public Object getObject(int i) {
// TODO Auto-generated method stub
- return false;
+ return null;
}
@Override
- public <T> T get(String name, TypeCodec<T> codec) {
+ public <T> T get(int i, Class<T> targetClass) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <T> T get(String name, TypeToken<T> targetType) {
+ public <T> T get(int i, TypeToken<T> targetType) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <T> T get(String name, Class<T> targetClass) {
+ public <T> T get(int i, TypeCodec<T> codec) {
// TODO Auto-generated method stub
return null;
}
@Override
- public boolean isNull(int i) {
+ public boolean isNull(String name) {
// TODO Auto-generated method stub
return false;
}
@Override
- public BigInteger getVarint(int i) {
+ public boolean getBool(String name) {
// TODO Auto-generated method stub
- return null;
+ return false;
}
@Override
- public UUID getUUID(int i) {
+ public byte getByte(String name) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public UDTValue getUDTValue(int i) {
+ public short getShort(String name) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public TupleValue getTupleValue(int i) {
+ public int getInt(String name) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public Date getTimestamp(int i) {
+ public long getLong(String name) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public long getTime(int i) {
+ public Date getTimestamp(String name) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public String getString(int i) {
+ public LocalDate getDate(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
- public short getShort(int i) {
+ public long getTime(String name) {
// TODO Auto-generated method stub
return 0;
}
@Override
- public <T> Set<T> getSet(int i, TypeToken<T> elementsType) {
+ public float getFloat(String name) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public <T> Set<T> getSet(int i, Class<T> elementsClass) {
+ public double getDouble(String name) {
// TODO Auto-generated method stub
- return null;
+ return 0;
}
@Override
- public Object getObject(int i) {
+ public ByteBuffer getBytesUnsafe(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <K, V> Map<K, V> getMap(int i, TypeToken<K> keysType, TypeToken<V> valuesType) {
+ public ByteBuffer getBytes(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <K, V> Map<K, V> getMap(int i, Class<K> keysClass, Class<V> valuesClass) {
+ public String getString(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
- public long getLong(int i) {
+ public BigInteger getVarint(String name) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public <T> List<T> getList(int i, TypeToken<T> elementsType) {
+ public BigDecimal getDecimal(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <T> List<T> getList(int i, Class<T> elementsClass) {
+ public UUID getUUID(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
- public int getInt(int i) {
+ public InetAddress getInet(String name) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public InetAddress getInet(int i) {
+ public <T> List<T> getList(String name, Class<T> elementsClass) {
// TODO Auto-generated method stub
return null;
}
@Override
- public float getFloat(int i) {
+ public <T> List<T> getList(String name, TypeToken<T> elementsType) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public double getDouble(int i) {
+ public <T> Set<T> getSet(String name, Class<T> elementsClass) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public BigDecimal getDecimal(int i) {
+ public <T> Set<T> getSet(String name, TypeToken<T> elementsType) {
// TODO Auto-generated method stub
return null;
}
@Override
- public LocalDate getDate(int i) {
+ public <K, V> Map<K, V> getMap(String name, Class<K> keysClass, Class<V> valuesClass) {
// TODO Auto-generated method stub
return null;
}
@Override
- public ByteBuffer getBytesUnsafe(int i) {
+ public <K, V> Map<K, V> getMap(String name, TypeToken<K> keysType, TypeToken<V> valuesType) {
// TODO Auto-generated method stub
return null;
}
@Override
- public ByteBuffer getBytes(int i) {
+ public UDTValue getUDTValue(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
- public byte getByte(int i) {
+ public TupleValue getTupleValue(String name) {
// TODO Auto-generated method stub
- return 0;
+ return null;
}
@Override
- public boolean getBool(int i) {
+ public Object getObject(String name) {
// TODO Auto-generated method stub
- return false;
+ return null;
}
@Override
- public <T> T get(int i, TypeCodec<T> codec) {
+ public <T> T get(String name, Class<T> targetClass) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <T> T get(int i, TypeToken<T> targetType) {
+ public <T> T get(String name, TypeToken<T> targetType) {
// TODO Auto-generated method stub
return null;
}
@Override
- public <T> T get(int i, Class<T> targetClass) {
+ public <T> T get(String name, TypeCodec<T> codec) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Token getToken(String name) {
+ public ColumnDefinitions getColumnDefinitions() {
// TODO Auto-generated method stub
return null;
}
@@ -417,16 +417,17 @@ public class RowCreator {
}
@Override
- public Token getPartitionKeyToken() {
+ public Token getToken(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
- public ColumnDefinitions getColumnDefinitions() {
+ public Token getPartitionKeyToken() {
// TODO Auto-generated method stub
return null;
}
+
};
return row;
}
diff --git a/auth/auth-cass/cass_init/cmd.sh b/auth/auth-cass/cass_init/cmd.sh
index 98194e08..ffaf182d 100644
--- a/auth/auth-cass/cass_init/cmd.sh
+++ b/auth/auth-cass/cass_init/cmd.sh
@@ -37,7 +37,7 @@ fi
function status {
echo "$@"
- echo "$@" > $DIR/aaf_cass
+ echo "$@" > $DIR/aaf-cass
}
function wait_start {
@@ -69,7 +69,7 @@ function wait_cql {
function wait_ready {
status wait for cassandra to be fully ready
for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
- STATUS="$(cat $DIR/aaf_cass)"
+ STATUS="$(cat $DIR/aaf-cass)"
if [ "$STATUS" = "ready" ]; then
break
else
@@ -88,7 +88,7 @@ function install_cql {
if [ -z "`/usr/bin/cqlsh -e 'describe keyspaces' | grep authz`" ]; then
status install
echo "Initializing Cassandra DB"
- echo "Docker Installed Basic Cassandra on aaf_cass. Executing the following "
+ echo "Docker Installed Basic Cassandra on aaf.cass. Executing the following "
echo "NOTE: This creator provided is only a Single Instance. For more complex Cassandra, create independently"
echo ""
echo " cd /opt/app/aaf/cass_init"
diff --git a/auth/auth-cass/docker/dinstall.sh b/auth/auth-cass/docker/dinstall.sh
index 83fb060e..e6da5e4b 100644
--- a/auth/auth-cass/docker/dinstall.sh
+++ b/auth/auth-cass/docker/dinstall.sh
@@ -24,12 +24,12 @@
echo "Waiting for Cass to be initialized"
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
- $DOCKER exec -it aaf_cass bash aaf_cmd wait 2> /dev/null
+ $DOCKER exec -it aaf-cass bash aaf_cmd wait 2> /dev/null
if [ "$?" -ne "0" ]; then
echo "Container not ready... Sleep 10"
sleep 10
else
- echo "aaf_cass is ready"
+ echo "aaf-cass is ready"
break
fi
done
diff --git a/auth/auth-cass/docker/drun.sh b/auth/auth-cass/docker/drun.sh
index a412296b..778947eb 100644
--- a/auth/auth-cass/docker/drun.sh
+++ b/auth/auth-cass/docker/drun.sh
@@ -35,11 +35,11 @@ fi
# Optional mount instead of v
# --mount 'type=volume,src=aaf_cass_data,dst=/var/lib/cassandra,volume-driver=local' \
-if [ "`$DOCKER ps -a | grep aaf_cass`" == "" ]; then
+if [ "`$DOCKER ps -a | grep aaf-cass`" == "" ]; then
echo "starting Cass from 'run'"
# NOTE: These HEAP Sizes are minimal. Not set for full organizations.
$DOCKER run \
- --name aaf_cass \
+ --name aaf-cass \
-e HEAP_NEWSIZE=512M \
-e MAX_HEAP_SIZE=1024M \
-e CASSANDRA_DC=dc1 \
@@ -49,5 +49,5 @@ if [ "`$DOCKER ps -a | grep aaf_cass`" == "" ]; then
$PUBLISH \
-d ${PREFIX}${ORG}/${PROJECT}/aaf_cass:${VERSION} "onap"
else
- $DOCKER start aaf_cass
+ $DOCKER start aaf-cass
fi
diff --git a/auth/auth-cass/pom.xml b/auth/auth-cass/pom.xml
index cfff8f7c..c43a6965 100644
--- a/auth/auth-cass/pom.xml
+++ b/auth/auth-cass/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
index 48131860..6fe9bde5 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
@@ -102,9 +102,9 @@ public class CassAccess {
}
str = env.getProperty(Config.CADI_LATITUDE);
- Double lat = str!=null?Double.parseDouble(str):null;
+ Double lat = str!=null && !str.isEmpty()?Double.parseDouble(str):null;
str = env.getProperty(Config.CADI_LONGITUDE);
- Double lon = str!=null?Double.parseDouble(str):null;
+ Double lon = str!=null && !str.isEmpty()?Double.parseDouble(str):null;
if (lat == null || lon == null) {
throw new APIException(Config.CADI_LATITUDE + " and/or " + Config.CADI_LONGITUDE + " are not set");
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
index 757efa5f..085f4199 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
@@ -99,6 +99,24 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
public void reconstitute(ByteBuffer bb) throws IOException {
LocateLoader.deflt.unmarshal(this, toDIS(bb));
}
+
+ public Data copy() {
+ Data out = new Data();
+ out.name = name;
+ out.hostname = hostname;
+ out.port = port;
+ out.major = major;
+ out.minor = minor;
+ out.patch = patch;
+ out.pkg = pkg;
+ out.latitude = latitude;
+ out.longitude = longitude;
+ out.protocol = protocol;
+ out.subprotocol = new HashSet<>();
+ out.subprotocol.addAll(subprotocol);
+ out.port_key = port_key;
+ return out;
+ }
}
private static class LocateLoader extends Loader<Data> implements Streamer<Data>{
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
index 9eea77e3..ec5449df 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
@@ -21,77 +21,74 @@
package org.onap.aaf.auth.direct;
-import java.net.Inet4Address;
-import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
import org.onap.aaf.auth.dao.cass.LocateDAO;
-import org.onap.aaf.auth.dao.cass.LocateDAO.Data;
import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.cadi.Access;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.client.Result;
-import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.register.Registrant;
-import org.onap.aaf.cadi.util.Split;
+import org.onap.aaf.cadi.register.RegistrationCreator;
+
+import locate.v1_0.MgmtEndpoint;
+import locate.v1_0.MgmtEndpoints;
public class DirectRegistrar implements Registrant<AuthzEnv> {
- private Data locate;
+
private LocateDAO ldao;
- public DirectRegistrar(Access access, LocateDAO ldao, String name, String version, int port) throws CadiException {
- this.ldao = ldao;
- locate = new LocateDAO.Data();
- locate.name = name;
- locate.port = port;
-
- try {
- String latitude = access.getProperty(Config.CADI_LATITUDE, null);
- if (latitude==null) {
- latitude = access.getProperty("AFT_LATITUDE", null);
- }
- String longitude = access.getProperty(Config.CADI_LONGITUDE, null);
- if (longitude==null) {
- longitude = access.getProperty("AFT_LONGITUDE", null);
- }
- if (latitude==null || longitude==null) {
- throw new CadiException(Config.CADI_LATITUDE + " and " + Config.CADI_LONGITUDE + " is required");
- } else {
- locate.latitude = Float.parseFloat(latitude);
- locate.longitude = Float.parseFloat(longitude);
- }
- String split[] = Split.splitTrim('.', version);
- locate.pkg = split.length>3?Integer.parseInt(split[3]):0;
- locate.patch = split.length>2?Integer.parseInt(split[2]):0;
- locate.minor = split.length>1?Integer.parseInt(split[1]):0;
- locate.major = split.length>0?Integer.parseInt(split[0]):0;
- locate.hostname = access.getProperty(Config.AAF_REGISTER_AS, null);
- if (locate.hostname==null) {
- locate.hostname = access.getProperty(Config.HOSTNAME, null);
- }
- if (locate.hostname==null) {
- locate.hostname = Inet4Address.getLocalHost().getHostName();
- }
- String subprotocols = access.getProperty(Config.CADI_PROTOCOLS, null);
- if (subprotocols==null) {
- locate.protocol="http";
- } else {
- locate.protocol="https";
- for (String s : Split.split(',', subprotocols)) {
- locate.subprotocol(true).add(s);
- }
- }
- } catch (NumberFormatException | UnknownHostException e) {
- throw new CadiException("Error extracting Data from Properties for Registrar",e);
+ private List<LocateDAO.Data> ldd;
+ public DirectRegistrar(Access access, LocateDAO ldao, int port) throws CadiException {
+ this.ldao = ldao;
+ ldd = new ArrayList<>();
+ RegistrationCreator rc = new RegistrationCreator(access);
+ MgmtEndpoints mes = rc.create(port);
+ for(MgmtEndpoint me : mes.getMgmtEndpoint()) {
+ ldd.add(convert(me));
}
}
- @Override
+ private LocateDAO.Data convert(MgmtEndpoint me) {
+ LocateDAO.Data out = new LocateDAO.Data();
+ out.name=me.getName();
+ out.hostname=me.getHostname();
+ out.latitude=me.getLatitude();
+ out.longitude=me.getLongitude();
+ out.major=me.getMajor();
+ out.minor=me.getMinor();
+ out.pkg=me.getPkg();
+ out.patch=me.getPatch();
+ out.port=me.getPort();
+ out.protocol=me.getProtocol();
+ out.subprotocol(true).addAll(me.getSubprotocol());
+// out.port_key = UUID.randomUUID();
+ return out;
+ }
+
+ @Override
+
public Result<Void> update(AuthzEnv env) {
- org.onap.aaf.auth.layer.Result<Void> dr = ldao.update(env.newTransNoAvg(), locate);
- if (dr.isOK()) {
- return Result.ok(200, null);
- } else {
- return Result.err(503, dr.errorString());
- }
+ AuthzTrans trans = env.newTransNoAvg();
+ StringBuilder sb = null;
+ for(LocateDAO.Data ld : ldd) {
+ org.onap.aaf.auth.layer.Result<Void> dr = ldao.update(trans, ld);
+ if (dr.notOK()) {
+ if(sb == null) {
+ sb = new StringBuilder(dr.errorString());
+ } else {
+ sb.append(';');
+ sb.append(dr.errorString());
+ }
+ }
+ }
+
+ if(sb==null) {
+ return Result.ok(200, null);
+ } else {
+ return Result.err(503, sb.toString());
+ }
}
/* (non-Javadoc)
@@ -99,13 +96,25 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
*/
@Override
public Result<Void> cancel(AuthzEnv env) {
- org.onap.aaf.auth.layer.Result<Void> dr = ldao.delete(env.newTransNoAvg(), locate, false);
- if (dr.isOK()) {
- return Result.ok(200, null);
- } else {
- return Result.err(503, dr.errorString());
- }
-
+ AuthzTrans trans = env.newTransNoAvg();
+ StringBuilder sb = null;
+ for(LocateDAO.Data ld : ldd) {
+ org.onap.aaf.auth.layer.Result<Void> dr = ldao.delete(trans, ld, false);
+ if (dr.notOK()) {
+ if(sb == null) {
+ sb = new StringBuilder(dr.errorString());
+ } else {
+ sb.append(';');
+ sb.append(dr.errorString());
+ }
+ }
+ }
+
+ if(sb==null) {
+ return Result.ok(200, null);
+ } else {
+ return Result.err(503, sb.toString());
+ }
}
}
diff --git a/auth/auth-certman/pom.xml b/auth/auth-certman/pom.xml
index 76f26222..ba346e6f 100644
--- a/auth/auth-certman/pom.xml
+++ b/auth/auth-certman/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
index bfdb977d..3727e34d 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
@@ -23,6 +23,7 @@
package org.onap.aaf.auth.cm;
import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
@@ -139,8 +140,12 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
pinst[1]= key.substring(idx+1);
pinst[2]= aafEnv;
pinst[3] = multiParams;
- CA ca = cons.newInstance(pinst);
- certAuths.put(ca.getName(),ca);
+ try {
+ CA ca = cons.newInstance(pinst);
+ certAuths.put(ca.getName(),ca);
+ } catch (InvocationTargetException e) {
+ access.log(e, "Loading", segs[0]);
+ }
}
}
}
@@ -225,7 +230,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
@Override
public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException, LocatorException {
return new Registrant[] {
- new DirectRegistrar(access,locateDAO,app_name,app_version,port)
+ new DirectRegistrar(access,locateDAO,port)
};
}
@@ -236,16 +241,19 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
}
public static void main(final String[] args) {
-
try {
Log4JLogIt logIt = new Log4JLogIt(args, "cm");
PropAccess propAccess = new PropAccess(logIt,args);
- AAF_CM service = new AAF_CM(new AuthzEnv(propAccess));
- JettyServiceStarter<AuthzEnv,AuthzTrans> jss = new JettyServiceStarter<AuthzEnv,AuthzTrans>(service);
- jss.start();
- } catch (Exception e) {
- envLog.error().log(e);
+ try {
+ AAF_CM service = new AAF_CM(new AuthzEnv(propAccess));
+ JettyServiceStarter<AuthzEnv,AuthzTrans> jss = new JettyServiceStarter<AuthzEnv,AuthzTrans>(service);
+ jss.start();
+ } catch (Exception e) {
+ propAccess.log(e);
+ }
+ } catch (APIException e) {
+ e.printStackTrace(System.err);
}
}
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
index da634868..08c96853 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
@@ -150,7 +150,7 @@ public class LocalCA extends CA {
try {
String pass = access.decrypt(params[0][2]/*encrypted passcode*/, true);
- if (pass==null) {
+ if (pass==null || pass.isEmpty()) {
throw new CertException("Passcode for " + fileName + " cannot be decrypted.");
}
char[] ksPass = pass.toCharArray();
@@ -159,8 +159,9 @@ public class LocalCA extends CA {
keyStore.load(fis,ksPass);
} finally {
- if (fis != null)
+ if (fis != null) {
fis.close();
+ }
}
Entry entry;
if (fileName.endsWith(".pkcs11")) {
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java
index e770fec7..58efa2a0 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java
@@ -86,7 +86,7 @@ public class JU_AAF_CM {
Properties props=new Properties();
Mockito.doReturn(props).when(access).getProperties();
props.setProperty("cm_ca.props", "test");
- Mockito.doReturn("test:2.1").when(access).getProperty(Config.AAF_COMPONENT, null);
+ Mockito.doReturn("test:2.1").when(access).getProperty(Config.AAF_LOCATOR_NAMES, null);
Mockito.doReturn("test").when(access).getProperty("https.protocols","TLSv1.1,TLSv1.2");
Mockito.doReturn("test").when(env).getProperty("cm_ca.props.perm_type",null);
Mockito.doReturn("test").when(env).getProperty("cm_ca.props.baseSubject",null);
diff --git a/auth/auth-cmd/pom.xml b/auth/auth-cmd/pom.xml
index ff281d28..c0169e57 100644
--- a/auth/auth-cmd/pom.xml
+++ b/auth/auth-cmd/pom.xml
@@ -18,7 +18,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-core/pom.xml b/auth/auth-core/pom.xml
index 96153818..a4b01cd9 100644
--- a/auth/auth-core/pom.xml
+++ b/auth/auth-core/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
index 56db6f60..497c13d6 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
@@ -102,7 +102,10 @@ public class AuthzEnv extends RosettaEnv implements Access {
@Override
public void log(Throwable e, Object... msgs) {
- access.log(Level.ERROR, msgs);
+ Object[] nm = new Object[msgs.length+1];
+ System.arraycopy(msgs, 0, nm, 1, msgs.length);
+ nm[0]=e;
+ access.log(Level.ERROR, nm);
}
@Override
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
index 3e68e3ab..e064ade3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
@@ -275,8 +275,6 @@ public class Result<RV> {
* @return
*/
public boolean isOKhasData() {
- System.out.println("specialCondition:"+specialCondition);
- System.out.println("specialCondition:"+(specialCondition & EMPTY_LIST));
return status == OK && (specialCondition & EMPTY_LIST) != EMPTY_LIST;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
index 435b8845..9ece4847 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
@@ -54,42 +54,30 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
public final String app_name;
public final String app_version;
- public final String app_interface_version;
public final String ROOT_NS;
-
+
public AbsService(final Access access, final ENV env) throws CadiException {
- Define.set(access);
- ROOT_NS = Define.ROOT_NS();
+ Define.set(access);
+ ROOT_NS = Define.ROOT_NS();
this.access = access;
this.env = env;
- String component = access.getProperty(Config.AAF_COMPONENT, null);
- final String[] locator_deploy;
-
- if (component == null) {
- locator_deploy = null;
+ String str = access.getProperty(Config.AAF_LOCATOR_NAMES, null);
+ String[] scomp = Split.splitTrim(',', str);
+ if(scomp.length==0) {
+ throw new CadiException(Config.AAF_LOCATOR_NAMES + " must be defined.");
} else {
- locator_deploy = Split.splitTrim(':', component);
- if(locator_deploy.length>1 && "AAF_RELEASE".equals(locator_deploy[1])) {
- locator_deploy[1]=access.getProperty(Config.AAF_RELEASE, Defaults.AAF_VERSION);
- int snapshot = locator_deploy[1].indexOf("-SNAPSHOT");
- if(snapshot>0) {
- locator_deploy[1]=locator_deploy[1].substring(0, snapshot);
- }
- }
- }
-
- if (component == null || locator_deploy==null || locator_deploy.length<2) {
- throw new CadiException("AAF Component must include the " + Config.AAF_COMPONENT + " property, <fully qualified service name>:<full deployed version (i.e. 2.1.3.13)");
+ str = ROOT_NS + '.' + scomp[0];
}
- final String[] version = Split.splitTrim('.', locator_deploy[1]);
- if (version==null || version.length<2) {
- throw new CadiException("AAF Component Version must have at least Major.Minor version");
+ app_name = str;
+
+ str = access.getProperty(Config.AAF_LOCATOR_VERSION, null);
+ if(str==null) {
+ str = Defaults.AAF_VERSION;
+ env.setProperty(Config.AAF_LOCATOR_VERSION, str);
}
- app_name = Define.varReplace(locator_deploy[0]);
- app_version = locator_deploy[1];
- app_interface_version = version[0]+'.'+version[1];
-
+ app_version = str;
+
// Print Cipher Suites Available
if (access.willLog(Level.DEBUG)) {
SSLContext context;
@@ -111,7 +99,15 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
access.log(Level.DEBUG,sb);
}
}
+
+ public void setProtocol(String proto) {
+ env.setProperty(Config.AAF_LOCATOR_PROTOCOL, proto);
+ }
+ public void setSubprotocol(String subproto) {
+ env.setProperty(Config.AAF_LOCATOR_SUBPROTOCOL, subproto);
+ }
+
protected abstract Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException;
/**
@@ -125,7 +121,7 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
return _filters();
}
- public abstract Registrant<ENV>[] registrants(final int port) throws CadiException, LocatorException;
+ public abstract Registrant<ENV>[] registrants(final int actualPort) throws CadiException, LocatorException;
// Lazy Instantiation
public synchronized AAFConHttp aafCon() throws CadiException, LocatorException {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
index 29166b0b..8f0eb8aa 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
@@ -19,10 +19,17 @@
*
*/
package org.onap.aaf.auth.server;
+import java.io.IOException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.auth.org.OrganizationFactory;
import org.onap.aaf.auth.rserv.RServlet;
import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.Access.Level;
import org.onap.aaf.cadi.register.Registrant;
import org.onap.aaf.cadi.register.Registrar;
import org.onap.aaf.misc.env.Trans;
@@ -61,14 +68,30 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
@Override
public final void start() throws Exception {
- _start(service);
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- shutdown();
- }
- });
+ ExecutorService es = Executors.newSingleThreadExecutor();
+ Future<?> app = es.submit(this);
+ final AbsServiceStarter<?,?> absSS = this;
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ absSS.access().printf(Level.INIT, "Shutting down %s:%s\n",absSS.service.app_name, absSS.service.app_version);
+ absSS.shutdown();
+ app.cancel(true);
+ }
+ });
+ if(System.getProperty("ECLIPSE", null)!=null) {
+ Thread.sleep(2000);
+ System.out.println("Service Started in Eclipse: ");
+ System.out.print(" Hit <enter> to end:");
+ try {
+ System.in.read();
+ System.exit(0);
+ } catch (IOException e) {
+ }
+ }
+
}
+
@SafeVarargs
public final synchronized void register(final Registrant<ENV> ... registrants) {
@@ -83,6 +106,15 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
}
@Override
+ public void run() {
+ try {
+ _start(service);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
public void shutdown() {
if (registrar!=null) {
registrar.close(env());
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
index c5849d05..d29b8f26 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
@@ -56,7 +56,6 @@ import org.onap.aaf.misc.rosetta.env.RosettaEnv;
public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> extends AbsServiceStarter<ENV,TRANS> {
-
private boolean secure;
public JettyServiceStarter(final AbsService<ENV,TRANS> service) throws OrganizationException {
@@ -73,24 +72,6 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
return this;
}
-// @Override
-// public void _propertyAdjustment() {
-// Properties props = access().getProperties();
-// Object temp = null;
-// // Critical - if no Security Protocols set, then set it. We'll just get messed up if not
-// if ((temp=props.get(Config.CADI_PROTOCOLS))==null) {
-// if ((temp=props.get(Config.HTTPS_PROTOCOLS))==null) {
-// props.put(Config.CADI_PROTOCOLS, SecurityInfo.HTTPS_PROTOCOLS_DEFAULT);
-// } else {
-// props.put(Config.CADI_PROTOCOLS, temp);
-// }
-// }
-//
-// if ("1.7".equals(System.getProperty("java.specification.version"))) {
-// System.setProperty(Config.HTTPS_CIPHER_SUITES, Config.HTTPS_CIPHER_SUITES_DEFAULT);
-// }
-// System.setProperty(Config.HTTPS_CIPHER_SUITES, temp.toString());
-// }
@Override
public void _propertyAdjustment() {
@@ -129,6 +110,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
protocol = "http";
} else {
protocol = "https";
+
String keystorePassword = access().getProperty(Config.CADI_KEYSTORE_PASSWORD, null);
if (keystorePassword==null) {
@@ -151,7 +133,9 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
sslContextFactory.setTrustStorePassword(access().decrypt(truststorePassword, true));
}
// Be able to accept only certain protocols, i.e. TLSv1.1+
- final String[] protocols = Split.splitTrim(',', access().getProperty(Config.CADI_PROTOCOLS, SecurityInfo.HTTPS_PROTOCOLS_DEFAULT));
+ String subprotocols = access().getProperty(Config.CADI_PROTOCOLS, SecurityInfo.HTTPS_PROTOCOLS_DEFAULT);
+ service.setSubprotocol(subprotocols);
+ final String[] protocols = Split.splitTrim(',', subprotocols);
sslContextFactory.setIncludeProtocols(protocols);
// Want to use Client Certificates, if they exist.
@@ -178,6 +162,8 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
new HttpConnectionFactory(httpConfig)
);
}
+ service.setProtocol(protocol);
+
// Setup JMX
// TODO trying to figure out how to set up/log ports
@@ -220,7 +206,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
server.start();
access().log(Level.INIT,server.dump());
} catch (Exception e) {
- access().log(e,"Error starting " + service.app_name);
+ access().log(e,"Error starting " + hostname + ':' + port + ' ' + InetAddress.getLocalHost().getHostAddress());
String doExit = access().getProperty("cadi_exitOnFailure", "true");
if (doExit == "true") {
System.exit(1);
@@ -231,7 +217,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
try {
register(service.registrants(port));
access().printf(Level.INIT, "Starting Jetty Service for %s, version %s, on %s://%s:%d", service.app_name,service.app_version,protocol,hostname,port);
- server.join();
+ //server.join();
} catch (Exception e) {
access().log(e,"Error registering " + service.app_name);
String doExit = access().getProperty("cadi_exitOnFailure", "true");
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
index 6f2d4cb9..9004f76b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
@@ -20,7 +20,7 @@
*/
package org.onap.aaf.auth.server;
-public interface ServiceStarter {
+public interface ServiceStarter extends Runnable {
public void start() throws Exception;
public void shutdown();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/TestKill.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/TestKill.java
new file mode 100644
index 00000000..78172a22
--- /dev/null
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/TestKill.java
@@ -0,0 +1,65 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ */
+
+package org.onap.aaf.auth.server;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+public class TestKill implements Runnable {
+
+ public static void main(String[] args) {
+ ExecutorService es = Executors.newSingleThreadExecutor();
+ TestKill tk = new TestKill();
+ Future<?> app = es.submit(tk);
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ System.out.println("Shutdown Hook, thread: setting interrupt");
+ app.cancel(true);
+ tk.longProcess();
+ es.shutdown();
+ }
+ });
+ System.out.println("Service Start");
+ System.out.print("Hit <enter> to end:");
+ try {
+ System.in.read();
+ System.exit(0);
+ } catch (IOException e) {
+ }
+ }
+
+ @Override
+ public void run() {
+ }
+
+ private void longProcess() {
+ System.out.println("Starting long cleanup process");
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ System.out.println("Ending long cleanup process");
+ }
+}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
index a0ee9ef9..65f019f0 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
@@ -103,7 +103,8 @@ public class JU_AbsService {
BasicEnv bEnv = new BasicEnv();
PropAccess prop = new PropAccess();
- prop.setProperty(Config.AAF_COMPONENT, "te.st:te.st");
+ prop.setProperty(Config.AAF_LOCATOR_NAMES, "te.st");
+ prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st");
prop.setLogLevel(Level.DEBUG);
AbsServiceStub absServiceStub = new AbsServiceStub(prop, bEnv); //Testing other branches requires "fails" due to exception handling, will leave that off for now.
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
index 1f5d70ae..1fe98d84 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
@@ -131,7 +131,8 @@ public class JU_AbsServiceStarter {
BasicEnv bEnv = new BasicEnv();
PropAccess prop = new PropAccess();
- prop.setProperty(Config.AAF_COMPONENT, "te.st:te.st");
+ prop.setProperty(Config.AAF_LOCATOR_NAMES, "te.st");
+ prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st");
prop.setLogLevel(Level.DEBUG);
absServiceStub = new AbsServiceStub(prop, bEnv);
diff --git a/auth/auth-deforg/pom.xml b/auth/auth-deforg/pom.xml
index 52756638..63bcb9b5 100644
--- a/auth/auth-deforg/pom.xml
+++ b/auth/auth-deforg/pom.xml
@@ -26,7 +26,7 @@
<artifactId>authparent</artifactId>
<relativePath>../pom.xml</relativePath>
<groupId>org.onap.aaf.authz</groupId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
</parent>
<artifactId>aaf-auth-deforg</artifactId>
diff --git a/auth/auth-fs/pom.xml b/auth/auth-fs/pom.xml
index 40df8a38..5b37469a 100644
--- a/auth/auth-fs/pom.xml
+++ b/auth/auth-fs/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java b/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
index e316e015..26e49290 100644
--- a/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
+++ b/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
@@ -99,7 +99,7 @@ public class AAF_FS extends AbsService<AuthzEnv, AuthzTrans> {
@Override
public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException, LocatorException {
return new Registrant[] {
- new RemoteRegistrant<AuthzEnv>(aafCon(),app_name,app_version,port)
+ new RemoteRegistrant<AuthzEnv>(aafCon(),port)
};
}
diff --git a/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java b/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
index eef1a87b..e7e5543a 100644
--- a/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
+++ b/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
@@ -73,7 +73,8 @@ public class JU_AAF_FS {
aEnv = new AuthzEnv();
aEnv.staticSlot("test");
aEnv.access().setProperty("aaf_public_dir", "test");
- aEnv.access().setProperty(Config.AAF_COMPONENT, "aaf_com:1.1");
+ aEnv.access().setProperty(Config.AAF_LOCATOR_NAMES, "aaf_com");
+ aEnv.access().setProperty(Config.AAF_LOCATOR_VERSION, "1.1");
Server serverMock = mock(Server.class);
JettyServiceStarter<AuthzEnv, AuthzTrans> jssMock = mock(JettyServiceStarter.class);
aafFs = new AAF_FS(aEnv);
diff --git a/auth/auth-gui/pom.xml b/auth/auth-gui/pom.xml
index a0748a2f..63a652b1 100644
--- a/auth/auth-gui/pom.xml
+++ b/auth/auth-gui/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
index 2e7e5e59..d8e8914e 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
@@ -247,7 +247,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
@Override
public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException, LocatorException {
return new Registrant[] {
- new RemoteRegistrant<AuthzEnv>(aafCon(),app_name,app_version,port)
+ new RemoteRegistrant<AuthzEnv>(aafCon(),port)
};
}
diff --git a/auth/auth-hello/pom.xml b/auth/auth-hello/pom.xml
index 7c0c38eb..dfb77a39 100644
--- a/auth/auth-hello/pom.xml
+++ b/auth/auth-hello/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
index 9190c665..6aee85d3 100644
--- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
+++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
@@ -113,7 +113,7 @@ public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> {
@Override
public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException, LocatorException {
return new Registrant[] {
- new RemoteRegistrant<AuthzEnv>(aafCon(),app_name,app_version,port)
+ new RemoteRegistrant<AuthzEnv>(aafCon(),port)
};
}
diff --git a/auth/auth-locate/pom.xml b/auth/auth-locate/pom.xml
index b076981b..40457cab 100644
--- a/auth/auth-locate/pom.xml
+++ b/auth/auth-locate/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
index c8294d1f..2bc4447f 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
@@ -220,7 +220,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
@Override
public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException {
return new Registrant[] {
- new DirectRegistrar(access,locateDAO,app_name,app_version,port)
+ new DirectRegistrar(access,locateDAO,port)
};
}
diff --git a/auth/auth-oauth/pom.xml b/auth/auth-oauth/pom.xml
index ef0740c1..62fb3f76 100644
--- a/auth/auth-oauth/pom.xml
+++ b/auth/auth-oauth/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
index 4104c34b..ef0c4da5 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
@@ -165,10 +165,7 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
@Override
public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException {
return new Registrant[] {
- new DirectRegistrar(access,question.locateDAO,app_name,app_version,port),
- new DirectRegistrar(access,question.locateDAO,app_name.replace(DOT_OAUTH, ".token"),app_version,port),
- new DirectRegistrar(access,question.locateDAO,app_name.replace(DOT_OAUTH, ".introspect"),app_version,port)
-
+ new DirectRegistrar(access,question.locateDAO,port)
};
}
diff --git a/auth/auth-service/pom.xml b/auth/auth-service/pom.xml
index a0803b4e..bc7d2794 100644
--- a/auth/auth-service/pom.xml
+++ b/auth/auth-service/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>authparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
index 4f34fd56..90d4744a 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
@@ -185,9 +185,9 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
@SuppressWarnings("unchecked")
@Override
- public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException {
+ public Registrant<AuthzEnv>[] registrants(final int actualPort) throws CadiException {
return new Registrant[] {
- new DirectRegistrar(access,question.locateDAO,app_name,app_interface_version,port)
+ new DirectRegistrar(access,question.locateDAO, actualPort)
};
}
@@ -226,7 +226,7 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
Log4JLogIt logIt = new Log4JLogIt(args, "authz");
PropAccess propAccess = new PropAccess(logIt,args);
- AbsService<AuthzEnv, AuthzTrans> service = new AAF_Service(new AuthzEnv(propAccess));
+ AbsService<AuthzEnv, AuthzTrans> service = new AAF_Service(new AuthzEnv(propAccess));
JettyServiceStarter<AuthzEnv,AuthzTrans> jss = new JettyServiceStarter<AuthzEnv,AuthzTrans>(service);
jss.start();
} catch (Exception e) {
diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore
index 9e4bcf51..1c98ea37 100644
--- a/auth/docker/.gitignore
+++ b/auth/docker/.gitignore
@@ -6,3 +6,5 @@
/policy*
/*.yaml
/*.orig
+/.curl_auth
+/test.sh
diff --git a/auth/docker/Dockerfile.base b/auth/docker/Dockerfile.base
new file mode 100644
index 00000000..623d18d4
--- /dev/null
+++ b/auth/docker/Dockerfile.base
@@ -0,0 +1,26 @@
+#########
+# ============LICENSE_START====================================================
+# org.onap.aaf
+# ===========================================================================
+# Copyright (c) 2017 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END====================================================
+#
+FROM nexus3.onap.org:10001/openjdk:8-jre-alpine
+MAINTAINER AAF Team, AT&T 2018
+
+LABEL description="aaf_base"
+RUN apk add --no-cache bash
+RUN apk add --no-cache openssl
+
diff --git a/auth/docker/Dockerfile.client b/auth/docker/Dockerfile.client
index dab925b0..c2e1d787 100644
--- a/auth/docker/Dockerfile.client
+++ b/auth/docker/Dockerfile.client
@@ -17,7 +17,8 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-FROM nexus3.onap.org:10001/onap/aaf/aaf-base-xenial:latest
+FROM ${DOCKER_REPOSITORY}/onap/aaf/aaf_base:${AAF_VERSION}
+#FROM nexus3.onap.org:10001/onap/aaf/aaf-base-xenial:latest
MAINTAINER AAF Team, AT&T 2018
ENV VERSION=${AAF_VERSION}
@@ -30,6 +31,4 @@ COPY bin/aaf-auth-cmd-${AAF_VERSION}-full.jar /opt/app/aaf_config/bin/
COPY bin/aaf-cadi-servlet-sample-*-sample.jar /opt/app/aaf_config/bin/
COPY cert/*trust*.b64 /opt/app/aaf_config/cert/
-ENTRYPOINT ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"]
-CMD []
-
+CMD ["/bin/bash","-c","/opt/app/aaf_config/bin/agent.sh"]
diff --git a/auth/docker/Dockerfile.config b/auth/docker/Dockerfile.config
index 44109d65..d1b6b237 100644
--- a/auth/docker/Dockerfile.config
+++ b/auth/docker/Dockerfile.config
@@ -17,7 +17,8 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-FROM nexus3.onap.org:10001/onap/aaf/aaf-base-xenial:latest
+FROM ${DOCKER_REPOSITORY}/onap/aaf/aaf_base:${AAF_VERSION}
+#FROM nexus3.onap.org:10001/onap/aaf/aaf-base-xenial:latest
MAINTAINER AAF Team, AT&T 2018
ENV VERSION=${AAF_VERSION}
@@ -34,7 +35,7 @@ COPY logs /opt/app/aaf_config/logs
COPY bin/service.sh /opt/app/aaf_config/bin/agent.sh
COPY bin/pod_wait.sh /opt/app/aaf_config/bin/
COPY bin/aaf-auth-cmd-${AAF_VERSION}-full.jar /opt/app/aaf_config/bin/
-
-ENTRYPOINT ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"]
+
+CMD ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"]
+#CMD ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"]
CMD []
-
diff --git a/auth/docker/Dockerfile.core b/auth/docker/Dockerfile.core
index 3431ee25..a15039aa 100644
--- a/auth/docker/Dockerfile.core
+++ b/auth/docker/Dockerfile.core
@@ -17,7 +17,9 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-FROM nexus3.onap.org:10001/onap/aaf/aaf-base-xenial:latest
+FROM ${DOCKER_REPOSITORY}/onap/aaf/aaf_base:${AAF_VERSION}
+#FROM nexus3.onap.org:10001/onap/aaf/aaf_base:${AAF_VERSION}
+#FROM nexus3.onap.org:10001/onap/aaf/aaf-base-xenial:latest
MAINTAINER AAF Team, AT&T 2018
ENV VERSION=${AAF_VERSION}
diff --git a/auth/docker/Dockerfile.ms b/auth/docker/Dockerfile.ms
index 9ae40c74..99ac5fca 100644
--- a/auth/docker/Dockerfile.ms
+++ b/auth/docker/Dockerfile.ms
@@ -17,7 +17,7 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-FROM onap/aaf/aaf_core:${AAF_VERSION}
+FROM ${DOCKER_REPOSITORY}/onap/aaf/aaf_core:${AAF_VERSION}
MAINTAINER AAF Team, AT&T 2018
ENV VERSION=${AAF_VERSION}
@@ -26,7 +26,8 @@ LABEL version=${AAF_VERSION}
COPY pod/* /opt/app/aaf/pod/
-CMD ["/bin/bash","-c","cd /opt/app/aaf;bin/${AAF_COMPONENT}"]
+#CMD ["bash","-c","cd /opt/app/aaf;bin/${AAF_COMPONENT}"]
+CMD []
# For Debugging installation
# CMD ["/bin/bash","-c","pwd;cd /opt/app/osaaf;find /opt/app/osaaf -depth;df -k; cat /opt/app/aaf/${AAF_COMPONENT}/bin/${AAF_COMPONENT};cat /etc/hosts;/opt/app/aaf/${AAF_COMPONENT}/bin/${AAF_COMPONENT}"]
diff --git a/auth/docker/aaf.sh b/auth/docker/aaf.sh
index 165b0007..14166a3e 100644
--- a/auth/docker/aaf.sh
+++ b/auth/docker/aaf.sh
@@ -26,32 +26,28 @@ function run_it() {
$DOCKER run $@ \
-v "aaf_config:$CONF_ROOT_DIR" \
-v "aaf_status:/opt/app/aaf/status" \
- --add-host="$HOSTNAME:$HOST_IP" \
- --add-host="aaf.osaaf.org:$HOST_IP" \
- --env HOSTNAME=${HOSTNAME} \
+ --env aaf_locator_container=docker \
+ --env aaf_locator_fqdn=${HOSTNAME} \
+ --env aaf_locate_url=https://aaf-locate:8095 \
--env AAF_ENV=${AAF_ENV} \
- --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \
- --env AAF_LOCATOR_AS=${AAF_LOCATOR_AS} \
--env LATITUDE=${LATITUDE} \
--env LONGITUDE=${LONGITUDE} \
- --env CASS_HOST=${CASS_HOST} \
--env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \
--env CASSANDRA_USER=${CASSANDRA_USER} \
--env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \
--env CASSANDRA_PORT=${CASSANDRA_PORT} \
--name aaf_config_$USER \
$PREFIX${ORG}/${PROJECT}/aaf_config:${VERSION} \
- /bin/bash $PARAMS
+ bash -c "bash /opt/app/aaf_config/bin/agent.sh $PARAMS"
}
-PARAMS="$@"
+PARAMS=$@
case "$1" in
bash)
- run_it -it --rm
+ PARAMS="&& cd /opt/app/osaaf/local && exec bash"
+ run_it -it --rm
;;
- -it)
- shift
- PARAMS="$@"
+ taillog)
run_it -it --rm
;;
*)
diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh
index 88b8497e..86fee5f6 100644
--- a/auth/docker/agent.sh
+++ b/auth/docker/agent.sh
@@ -28,9 +28,9 @@ fi
. ./aaf.props
DOCKER=${DOCKER:=docker}
-CADI_VERSION=${CADI_VERSION:=2.1.9-SNAPSHOT}
+CADI_VERSION=${CADI_VERSION:=2.1.10-SNAPSHOT}
-for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do
+for V in VERSION DOCKER_REPOSITORY HOSTNAME AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do
if [ "$(grep $V ./aaf.props)" = "" ]; then
unset DEF
case $V in
@@ -38,6 +38,10 @@ for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_
PROMPT="Docker Repo"
DEF=""
;;
+ HOSTNAME)
+ PROMPT="HOSTNAME (blank for Default)"
+ DEF=""
+ ;;
AAF_FQDN) PROMPT="AAF's FQDN";;
DEPLOY_FQI) PROMPT="Deployer's FQI";;
AAF_FQDN_IP)
@@ -61,8 +65,10 @@ for V in VERSION DOCKER_REPOSITORY AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_
read -p "$PROMPT" VAR
if [ "$VAR" = "" ]; then
if [ "$DEF" = "" ]; then
- echo "agent.sh needs each value queried. Please start again."
- exit
+ if [ "$V" != "HOSTNAME" ]; then
+ echo "agent.sh needs each value queried. Please start again."
+ exit
+ fi
else
VAR=$DEF
fi
diff --git a/auth/docker/components b/auth/docker/components
index 0a4a66ad..7f58dc33 100644
--- a/auth/docker/components
+++ b/auth/docker/components
@@ -1,7 +1,7 @@
service
locate
oauth
-gui
-fs
cm
+gui
hello
+fs
diff --git a/auth/docker/d.props.init b/auth/docker/d.props.init
index 2a871bd8..c406b81c 100644
--- a/auth/docker/d.props.init
+++ b/auth/docker/d.props.init
@@ -21,19 +21,16 @@
ORG=onap
PROJECT=aaf
DOCKER_REPOSITORY=nexus3.onap.org:10003
-VERSION=2.1.9-SNAPSHOT
+VERSION=2.1.10-SNAPSHOT
CONF_ROOT_DIR=/opt/app/osaaf
# For local builds, set PREFIX=
PREFIX="$DOCKER_REPOSITORY/"
+NAMESPACE=onap
-# Local Env info
-HOSTNAME=aaf.osaaf.org
-HOST_IP=
+# HOSTNAME=aaf.osaaf.org
# AAF Machine info
AAF_ENV=DEV
-AAF_REGISTER_AS=$HOSTNAME
-AAF_LOCATE_AS=$AAF_REGISTER_AS
LATITUDE=
LONGITUDE=
@@ -50,7 +47,8 @@ AAF_SIGNER_PASSWORD=
AAF_SIGNER_ALIAS=
# OPTIONALLY ADD THESE CASSANDRA PROPERTIES
-# CASS_HOST=
+# Note: Setting "CASSANDRA_DOCKER" will setup the appropriate CASSANDRA_CLUSTER, etc in Docker Properties.
+CASSANDRA_DOCKER=aaf-cass
# CASSANDRA_CLUSTER=
# CASSANDRA_USER=
# CASSANDRA_PASSWORD=
diff --git a/auth/docker/dbash.sh b/auth/docker/dbash.sh
index c91c2494..f3bb26a0 100644
--- a/auth/docker/dbash.sh
+++ b/auth/docker/dbash.sh
@@ -20,4 +20,4 @@
#
. ./d.props
-${DOCKER:=docker} exec -it aaf_$1 bash
+${DOCKER:=docker} exec -it aaf-$1 bash
diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh
index 627be95d..4eb349b9 100755
--- a/auth/docker/dbuild.sh
+++ b/auth/docker/dbuild.sh
@@ -32,24 +32,39 @@ DOCKER=${DOCKER:=docker}
echo "Building Containers for aaf components, version $VERSION"
# AAF_cass now needs a version...
-cd ../auth-cass/docker
-bash ./dbuild.sh
-cd -
+#cd ../auth-cass/docker
+#bash ./dbuild.sh
+#cd -
+
+# AAF Base version - set the core image, etc
+sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
+ Dockerfile.base > Dockerfile
+$DOCKER build -t ${ORG}/${PROJECT}/aaf_base:${VERSION} .
+$DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:${VERSION}
+$DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:latest
+rm Dockerfile
# Create the AAF Config (Security) Images
cd ..
cp auth-cmd/target/aaf-auth-cmd-$VERSION-full.jar sample/bin
cp -Rf ../conf/CA sample
+
# AAF Config image (for AAF itself)
-sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' docker/Dockerfile.config > sample/Dockerfile
+sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
+ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \
+ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \
+ docker/Dockerfile.config > sample/Dockerfile
$DOCKER build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample
$DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:${VERSION}
$DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/latest
cp ../cadi/servlet-sample/target/aaf-cadi-servlet-sample-${VERSION}-sample.jar sample/bin
# AAF Agent Image (for Clients)
-sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' docker/Dockerfile.client > sample/Dockerfile
+sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
+ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \
+ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \
+ docker/Dockerfile.client > sample/Dockerfile
$DOCKER build -t ${ORG}/${PROJECT}/aaf_agent:${VERSION} sample
$DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:${VERSION}
$DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:latest
@@ -63,7 +78,10 @@ cd -
# Second, build a core Docker Image
echo Building aaf_$AAF_COMPONENT...
# Apply currrent Properties to Docker file, and put in place.
-sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.core >../aaf_${VERSION}/Dockerfile
+sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
+ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \
+ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \
+ Dockerfile.core >../aaf_${VERSION}/Dockerfile
cd ..
$DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_${VERSION}
$DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:${VERSION}
@@ -80,11 +98,13 @@ else
AAF_COMPONENTS=$1
fi
-mkdir -p ../aaf_${VERSION}/pod
-cp ../sample/bin/pod_wait.sh ../aaf_${VERSION}/pod
+cp ../sample/bin/pod_wait.sh ../aaf_${VERSION}/bin
for AAF_COMPONENT in ${AAF_COMPONENTS}; do
echo Building aaf_$AAF_COMPONENT...
- sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.ms >../aaf_${VERSION}/Dockerfile
+ sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
+ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \
+ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \
+ Dockerfile.ms >../aaf_${VERSION}/Dockerfile
cd ..
$DOCKER build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION}
$DOCKER tag ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION}
@@ -93,5 +113,4 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do
cd -
done
-rm ../aaf_${VERSION}/pod/*
-rmdir ../aaf_${VERSION}/pod
+rm ../aaf_${VERSION}/bin/pod_wait.sh
diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh
index 9f770055..ed62e573 100644
--- a/auth/docker/drun.sh
+++ b/auth/docker/drun.sh
@@ -18,29 +18,11 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-# Validate for realtime Cassandra info
-
-# check if outside Cluster defined... otherwise, set CASS_HOST for using expected Docker based Cass
-if [ -z "$(grep -e '^CASS_CLUSTER=.*' d.props)" ]; then
- if [ "$(uname)" = "Darwin" ]; then
- SED="sed -i .bak"
- else
- SED="sed -i"
- fi
-
- CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_cass)
- if [ -z "$(grep -e '^CASS_HOST.*' d.props)" ]; then
- $SED "s/# CASS_HOST=.*/CASS_HOST=cass.aaf.osaaf.org:$CASSANDRA_IP/" d.props
- else
- $SED "s/CASS_HOST=.*/CASS_HOST=cass.aaf.osaaf.org:$CASSANDRA_IP/" d.props
- fi
- echo "Updated d.props for CASSANDRA Name/IP"
- grep -e '^CASS_HOST.*' d.props
-fi
-
# Pull in Variables from d.props
. ./d.props
+CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER:=$CASSANDRA_DOCKER}
+
DOCKER=${DOCKER:=docker}
# Running without params keeps from being TTY
@@ -55,83 +37,77 @@ fi
for AAF_COMPONENT in ${AAF_COMPONENTS}; do
LINKS=""
CMD_LINE=""
- PORTMAP=""
+ PUBLISH=""
case "$AAF_COMPONENT" in
"service")
- PORTMAP="8100:8100"
- LINKS="--link aaf_cass:cassandra "
- # CASS_HOST is for Container based Cassadra
- if [ -z "$CASS_HOST" ]; then
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_service sleep 0 cd /opt/app/aaf;bin/service"
+ PUBLISH="--publish 8100:8100"
+ if [ -z "$CASSANDRA_DOCKER" ]; then
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-service && exec bin/service"
else
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_service aaf_cass cd /opt/app/aaf;bin/service"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-service aaf-cass && exec bin/service"
+ LINKS="--link $CASSANDRA_DOCKER"
+ echo $CASSANDRA_CLUSTER
fi
;;
"locate")
- PORTMAP="8095:8095"
- LINKS="--link aaf_cass:cassandra "
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_locate aaf_service cd /opt/app/aaf;bin/locate"
+ PUBLISH="--publish 8095:8095"
+ LINKS="--link aaf-cass --link aaf-service"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-locate aaf-service && exec bin/locate"
;;
"oauth")
- PORTMAP="8140:8140"
- LINKS="--link aaf_cass:cassandra "
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_oauth aaf_service cd /opt/app/aaf;bin/oauth"
- ;;
- "gui")
- PORTMAP="8200:8200"
- LINKS=""
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_gui aaf_locate cd /opt/app/aaf;bin/gui"
+ PUBLISH="--publish 8140:8140"
+ LINKS="--link aaf-cass --link aaf-service --link aaf-locate"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-oauth aaf-service && exec bin/oauth"
;;
"cm")
- PORTMAP="8150:8150"
- LINKS="--link aaf_cass:cassandra "
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_cm aaf_locate cd /opt/app/aaf;bin/cm"
+ PUBLISH="--publish 8150:8150"
+ LINKS="--link aaf-cass --link aaf-service --link aaf-locate"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-cm aaf-locate && exec bin/cm"
;;
- "hello")
- PORTMAP="8130:8130"
- LINKS=""
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_hello aaf_locate cd /opt/app/aaf;bin/hello"
+ "gui")
+ PUBLISH="--publish 8200:8200"
+ LINKS="--link aaf-service --link aaf-locate --link aaf-oauth --link aaf-cm"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-gui aaf-locate && exec bin/gui"
;;
"fs")
- PORTMAP="80:8096"
+ PUBLISH="--publish 80:8096"
LINKS=""
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_fs aaf_locate cd /opt/app/aaf;bin/fs"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-fs aaf-locate && exec bin/fs"
+ ;;
+ "hello")
+ PUBLISH="--publish 8130:8130"
+ LINKS="--link aaf-service --link aaf-locate --link aaf-oauth --link aaf-cm"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-hello aaf-locate && exec bin/hello"
;;
esac
- echo Starting aaf_$AAF_COMPONENT...
-
- if [ -n "$AAF_REGISTER_AS" ] && [ "$HOSTNAME" != "$AAF_REGISTER_AS" ]; then
- AH_ROOT="$HOSTNAME $AAF_REGISTER_AS"
- else
- AH_ROOT="$HOSTNAME"
- fi
+ echo Starting aaf-$AAF_COMPONENT...
- for A in aaf.osaaf.org $AH_ROOT; do
- ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP"
- done
+ #for A in aaf.osaaf.org $AH_ROOT; do
+ #ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP"
+ #done
- if [ ! -z "$LINKS" ] && [[ "$CASS_HOST" =~ ":" ]]; then
- ADD_HOST="$ADD_HOST --add-host=$CASS_HOST"
- fi
- $DOCKER run \
+ #if [ ! -z "$LINKS" ] && [[ "$CASS_HOST" =~ ":" ]]; then
+ #ADD_HOST="$ADD_HOST --add-host=$CASS_HOST"
+ #fi
+ #--hostname="${AAF_COMPONENT}.${NAMESPACE}" \
+ # $ADD_HOST \
+ $DOCKER run \
-d \
- --name aaf_$AAF_COMPONENT \
- --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \
- $ADD_HOST \
+ --name aaf-$AAF_COMPONENT \
${LINKS} \
--env AAF_ENV=${AAF_ENV} \
- --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \
+ --env aaf_locator_container=docker \
+ --env aaf_locator_fqdn=$HOSTNAME \
--env LATITUDE=${LATITUDE} \
--env LONGITUDE=${LONGITUDE} \
- --env CASS_HOST=${CASS_HOST} \
--env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \
--env CASSANDRA_USER=${CASSANDRA_USER} \
--env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \
--env CASSANDRA_PORT=${CASSANDRA_PORT} \
- --publish $PORTMAP \
+ $PUBLISH \
-v "aaf_config:$CONF_ROOT_DIR" \
-v "aaf_status:/opt/app/aaf/status" \
${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} \
- $CMD_LINE
+ /bin/bash -c "$CMD_LINE"
done
diff --git a/auth/docker/dstart.sh b/auth/docker/dstart.sh
index 9242e46a..1bd90d5e 100644
--- a/auth/docker/dstart.sh
+++ b/auth/docker/dstart.sh
@@ -30,5 +30,5 @@ else
fi
for AAF_COMPONENT in ${AAF_COMPONENTS}; do
- $DOCKER start aaf_$AAF_COMPONENT
+ $DOCKER start aaf-$AAF_COMPONENT
done
diff --git a/auth/docker/dstop.sh b/auth/docker/dstop.sh
index cebf4ebf..4d302bd1 100644
--- a/auth/docker/dstop.sh
+++ b/auth/docker/dstop.sh
@@ -29,5 +29,5 @@ else
fi
for AAF_COMPONENT in ${AAF_COMPONENTS}; do
- $DOCKER stop aaf_$AAF_COMPONENT
+ $DOCKER stop aaf-$AAF_COMPONENT
done
diff --git a/auth/pom.xml b/auth/pom.xml
index 4b9b6112..f8b7c122 100644
--- a/auth/pom.xml
+++ b/auth/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>parent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
</parent>
<artifactId>authparent</artifactId>
<name>AAF Auth Parent</name>
diff --git a/auth/sample/bin/client.sh b/auth/sample/bin/client.sh
index b69646df..f4048f30 100755
--- a/auth/sample/bin/client.sh
+++ b/auth/sample/bin/client.sh
@@ -49,7 +49,8 @@ JAVA_AAFCLI="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$LO
if [ ! -d $LOCAL ]; then
mkdir -p $LOCAL
for D in bin logs; do
- rsync -avzh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D
+ mkdir -p $OSAAF/$D
+ cp $CONFIG/$D/*.* $OSAAF/$D
done
fi
@@ -152,11 +153,6 @@ else
fi
fi
;;
- update)
- for D in bin logs; do
- rsync -uh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D
- done
- ;;
showpass)
echo "## Show Passwords"
$JAVA_AGENT showpass ${APP_FQI} ${APP_FQDN}
@@ -171,7 +167,7 @@ else
bash)
shift
cd $LOCAL || exit
- /bin/bash "$@"
+ exec bash "$@"
;;
setProp)
cd $LOCAL || exit
diff --git a/auth/sample/bin/pod_wait.sh b/auth/sample/bin/pod_wait.sh
index 732edffc..07ff9814 100644
--- a/auth/sample/bin/pod_wait.sh
+++ b/auth/sample/bin/pod_wait.sh
@@ -102,4 +102,4 @@ case "$OTHER" in
;;
esac
-eval "$@"
+eval "$@"
diff --git a/auth/sample/bin/service.sh b/auth/sample/bin/service.sh
index 78f6693b..20be29c4 100644
--- a/auth/sample/bin/service.sh
+++ b/auth/sample/bin/service.sh
@@ -34,7 +34,7 @@ JAVA_AGENT="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$LOC
JAVA_AAFCLI="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$LOCAL/org.osaaf.aaf.props org.onap.aaf.auth.cmd.AAFcli"
# If doesn't exist... still create
-mkdir -p /opt/app/osaaf
+mkdir -p $OSAAF
# Temp use for clarity of code
FILE=
@@ -42,7 +42,7 @@ FILE=
# Setup Bash, first time only
if [ ! -e "$HOME/.bash_aliases" ] || [ -z "$(grep cadi $HOME/.bash_aliases)" ]; then
echo "alias cadi='$JAVA_CADI \$*'" >>$HOME/.bash_aliases
- echo "alias agent='$CONFIG/bin/agent.sh EMPTY \$*'" >>$HOME/.bash_aliases
+ echo "alias agent='$CONFIG/bin/agent.sh \$*'" >>$HOME/.bash_aliases
echo "alias aafcli='$JAVA_AAFCLI \$*'" >>$HOME/.bash_aliases
chmod a+x $CONFIG/bin/agent.sh
. $HOME/.bash_aliases
@@ -114,9 +114,10 @@ fi
# Only initialize once, automatically...
if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then
- rsync -avzh --exclude=.gitignore $CONFIG/local/org.osaaf.aaf* $LOCAL
+ cp $CONFIG/local/org.osaaf.aaf* $LOCAL
for D in public etc logs; do
- rsync -avzh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D
+ mkdir -p $OSAAF/$D
+ cp $CONFIG/$D/* $OSAAF/$D
done
TMP=$(mktemp)
@@ -125,9 +126,16 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then
echo cadi_latitude=${LATITUDE} >> ${TMP}
echo cadi_longitude=${LONGITUDE} >> ${TMP}
echo cadi_x509_issuers=${CADI_X509_ISSUERS} >> ${TMP}
- echo aaf_register_as=${AAF_REGISTER_AS} >> ${TMP}
- AAF_LOCATOR_AS=${AAF_LOCATOR_AS:=$AAF_REGISTER_AS}
- echo aaf_locate_url=https://${AAF_LOCATOR_AS}:8095 >> ${TMP}
+ AAF_LOCATE_URL=${aaf_locate_url:="https://${HOSTNAME}:8095"}
+ echo aaf_locate_url=${AAF_LOCATE_URL} >> ${TMP}
+ for P in `env`; do
+ if [[ "$P" == aaf_locator* ]]; then
+ echo "$P" >> ${TMP}
+ if [[ "$P" == aaf_locator_container=* ]]; then
+ echo aaf_locator_container.hostname=${HOSTNAME} >> ${TMP}
+ fi
+ fi
+ done
cat $TMP
@@ -139,7 +147,7 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then
# Cassandra Config stuff
# Default is expect a Cassandra on same Node
- CASS_HOST=${CASS_HOST:="aaf_cass"}
+ CASS_HOST=${CASS_HOST:="aaf-cass"}
CASS_PASS=$($JAVA_CADI digest "${CASSANDRA_PASSWORD:-cassandra}" $LOCAL/org.osaaf.aaf.keyfile)
CASS_NAME=${CASS_HOST/:*/}
sed -i.backup -e "s/\\(cassandra.clusters=\\).*/\\1${CASSANDRA_CLUSTERS:=$CASS_HOST}/" \
@@ -165,7 +173,7 @@ fi
# Now run a command
-CMD=$2
+CMD=$1
if [ -z "$CMD" ]; then
if [ -n "$INITIALIZED" ]; then
echo "Initialization Complete"
@@ -174,11 +182,10 @@ if [ -z "$CMD" ]; then
fi
else
shift
- shift
case "$CMD" in
ls)
echo ls requested
- find /opt/app/osaaf -depth
+ find $OSAAF -depth
;;
cat)
if [ "$1" = "" ]; then
@@ -195,12 +202,6 @@ else
fi
fi
;;
- update)
- rsync -uh --exclude=.gitignore $CONFIG/local/org.osaaf.aaf* $LOCAL
- for D in public data etc logs; do
- rsync -uh --exclude=.gitignore $CONFIG/$D/* /opt/app/osaaf/$D
- done
- ;;
validate)
echo "## validate requested"
$JAVA_AAFCLI perm list user aaf@aaf.osaaf.org
@@ -211,7 +212,7 @@ else
bash)
shift
cd $LOCAL || exit
- /bin/bash "$@"
+ exec /bin/bash -c "$@"
;;
setProp)
cd $LOCAL || exit
@@ -226,11 +227,11 @@ else
fi
for F in $FILES; do
if [ "$ADD" = "Y" ]; then
- echo "Changing $1 to $F"
+ echo "Changing $1 for $F"
echo "$1=$2" >> $F
else
echo "Changing $1 in $F"
- sed -i.backup -e "s/\\(${1}.*=\\).*/\\1${2}/" $F
+ sed -i.backup -e "s/\\(${1}=\\).*/\\1${2}/" $F
fi
cat $F
done
@@ -265,7 +266,7 @@ else
done
;;
taillog)
- sh /opt/app/osaaf/logs/taillog
+ sh $OSAAF/logs/taillog
;;
wait)
bash $CONFIG/bin/pod_wait.sh wait $1
diff --git a/auth/sample/etc/org.osaaf.aaf.cm.props b/auth/sample/etc/org.osaaf.aaf.cm.props
index c1593e58..dc43c282 100644
--- a/auth/sample/etc/org.osaaf.aaf.cm.props
+++ b/auth/sample/etc/org.osaaf.aaf.cm.props
@@ -23,8 +23,10 @@
## Note: Link to CA Properties in "local" dir
##
cadi_prop_files=/opt/app/osaaf/local/org.osaaf.aaf.props:/opt/app/osaaf/etc/org.osaaf.aaf.log4j.props:/opt/app/osaaf/local/org.osaaf.aaf.cassandra.props:/opt/app/osaaf/etc/org.osaaf.aaf.orgs.props:/opt/app/osaaf/local/org.osaaf.aaf.cm.ca.props
-aaf_component=AAF_NS.cm:AAF_RELEASE
-port=8150
+aaf_locator_names=cm
+port=8100
+aaf_locator_public_port.helm=30084
+# aaf_locator_public_port.oom=
#Certman
cm_public_dir=/opt/app/osaaf/public
diff --git a/auth/sample/etc/org.osaaf.aaf.fs.props b/auth/sample/etc/org.osaaf.aaf.fs.props
index 7125e466..9de81af6 100644
--- a/auth/sample/etc/org.osaaf.aaf.fs.props
+++ b/auth/sample/etc/org.osaaf.aaf.fs.props
@@ -22,7 +22,9 @@
## AAF Fileserver Properties
##
cadi_prop_files=/opt/app/osaaf/local/org.osaaf.aaf.props:/opt/app/osaaf/etc/org.osaaf.aaf.log4j.props
-aaf_component=AAF_NS.fs:AAF_RELEASE
+aaf_locator_names=fs
port=8096
+aaf_locator_port.helm=30085
+# aaf_locator_port.oom=
aaf_public_dir=/opt/app/osaaf/public
diff --git a/auth/sample/etc/org.osaaf.aaf.gui.props b/auth/sample/etc/org.osaaf.aaf.gui.props
index 4228eb30..81d04ea0 100644
--- a/auth/sample/etc/org.osaaf.aaf.gui.props
+++ b/auth/sample/etc/org.osaaf.aaf.gui.props
@@ -22,8 +22,10 @@
## AAF GUI Properties
##
cadi_prop_files=/opt/app/osaaf/local/org.osaaf.aaf.props:/opt/app/osaaf/etc/org.osaaf.aaf.log4j.props:/opt/app/osaaf/etc/org.osaaf.aaf.orgs.props
-aaf_component=AAF_NS.gui:AAF_RELEASE
+aaf_locator_names=gui
port=8200
+aaf_locator_port.helm=30083
+#aaf_locator_port.oom=
aaf_gui_title=AAF
aaf_gui_copyright=(c) 2018 AT&T Intellectual Property. All rights reserved.
diff --git a/auth/sample/etc/org.osaaf.aaf.hello.props b/auth/sample/etc/org.osaaf.aaf.hello.props
index 45299140..5add3014 100644
--- a/auth/sample/etc/org.osaaf.aaf.hello.props
+++ b/auth/sample/etc/org.osaaf.aaf.hello.props
@@ -22,6 +22,8 @@
## AAF Hello Properties
##
cadi_prop_files=/opt/app/osaaf/local/org.osaaf.aaf.props:/opt/app/osaaf/etc/org.osaaf.aaf.log4j.props
-aaf_component=AAF_NS.hello:AAF_RELEASE
+aaf_locator_names=hello
port=8130
+aaf_locator_public_port.helm=30086
+#aaf_locator_public_port.oom=
diff --git a/auth/sample/etc/org.osaaf.aaf.locate.props b/auth/sample/etc/org.osaaf.aaf.locate.props
index 41474d40..1b74f654 100644
--- a/auth/sample/etc/org.osaaf.aaf.locate.props
+++ b/auth/sample/etc/org.osaaf.aaf.locate.props
@@ -22,6 +22,9 @@
## AAF Locator Properties
##
cadi_prop_files=/opt/app/osaaf/local/org.osaaf.aaf.props:/opt/app/osaaf/etc/org.osaaf.aaf.log4j.props:/opt/app/osaaf/etc/org.osaaf.aaf.orgs.props:/opt/app/osaaf/local/org.osaaf.aaf.cassandra.props
-aaf_component=AAF_NS.locator:AAF_RELEASE
+aaf_locator_names=locator
port=8095
+aaf_locator_public_port.helm=30081
+#aaf_locator_public_port.oom=
+
diff --git a/auth/sample/etc/org.osaaf.aaf.oauth.props b/auth/sample/etc/org.osaaf.aaf.oauth.props
index 19b657d5..a968b949 100644
--- a/auth/sample/etc/org.osaaf.aaf.oauth.props
+++ b/auth/sample/etc/org.osaaf.aaf.oauth.props
@@ -18,10 +18,12 @@
# ============LICENSE_END====================================================
#
##
-## org.osaaf.aaf.oauth
## AAF OAuth2 Properties
##
cadi_prop_files=/opt/app/osaaf/local/org.osaaf.aaf.props:/opt/app/osaaf/etc/org.osaaf.aaf.log4j.props:/opt/app/osaaf/local/org.osaaf.aaf.cassandra.props
-aaf_component=AAF_NS.oauth:AAF_RELEASE
+aaf_locator_names=oauth,token,introspect
port=8140
+aaf_locator_public_port.helm=30082
+#aaf_locator_public_port.oom=
+
diff --git a/auth/sample/etc/org.osaaf.aaf.service.props b/auth/sample/etc/org.osaaf.aaf.service.props
index 3f5e7c4a..5c9714c4 100644
--- a/auth/sample/etc/org.osaaf.aaf.service.props
+++ b/auth/sample/etc/org.osaaf.aaf.service.props
@@ -22,6 +22,8 @@
## AAF Service Properties
##
cadi_prop_files=/opt/app/osaaf/local/org.osaaf.aaf.props:/opt/app/osaaf/etc/org.osaaf.aaf.log4j.props:/opt/app/osaaf/local/org.osaaf.aaf.cassandra.props:/opt/app/osaaf/etc/org.osaaf.aaf.orgs.props
-aaf_component=AAF_NS.service:AAF_RELEASE
+aaf_locator_names=service
port=8100
+aaf_locator_public_port.helm=30080
+#aaf_locator_public_port.oom=
diff --git a/auth/sample/local/aaf.props b/auth/sample/local/aaf.props
index 4eb70a9b..bae24d42 100644
--- a/auth/sample/local/aaf.props
+++ b/auth/sample/local/aaf.props
@@ -35,6 +35,12 @@ cadi_truststore=/opt/app/osaaf/public/truststoreONAPall.jks
cadi_truststore_password=changeit
cadi_x509_issuers=
+# Locator info
+aaf_locator_ns=AAF_NS
+aaf_locator_fqdn.docker=aaf-%N
+aaf_locator_fqdn.oom=%CNS.aaf-%N
+aaf_locator_fqdn.helm=%CNS.aaf-%N
+
# Other
aaf_data_dir=/opt/app/osaaf/data
cadi_token_dir=/opt/app/osaaf/tokens
diff --git a/auth/sample/local/initialConfig.props b/auth/sample/local/initialConfig.props
index fa2bc174..9c7e3df0 100644
--- a/auth/sample/local/initialConfig.props
+++ b/auth/sample/local/initialConfig.props
@@ -17,11 +17,12 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-aaf_locate_url=https://localhost:8095
-aaf_oauth2_introspect_url=https://AAF_LOCATE_URL/AAF_NS.introspect:2.1/introspect
-aaf_oauth2_token_url=https://AAF_LOCATE_URL/AAF_NS.token:2.1/token
-aaf_url=https://AAF_LOCATE_URL/AAF_NS.service:2.1
cadi_protocols=TLSv1.1,TLSv1.2
-cm_url=https://AAF_LOCATE_URL/AAF_NS.cm:2.1
-fs_url=https://AAF_LOCATE_URL/AAF_NS.fs.2.1
-gui_url=https://AAF_LOCATE_URL/AAF_NS.gui.2.1
+
+aaf_locate_url=https://localhost:8095
+aaf_url=https://AAF_LOCATE_URL/%C%AAF_NS.service:2.1
+aaf_oauth2_introspect_url=https://AAF_LOCATE_URL/%C%AAF_NS.introspect:2.1/introspect
+aaf_oauth2_token_url=https://AAF_LOCATE_URL/%C%AAF_NS.token:2.1/token
+cm_url=https://AAF_LOCATE_URL/%C%AAF_NS.cm:2.1
+gui_url=https://AAF_LOCATE_URL/%C%AAF_NS.gui.2.1
+fs_url=https://AAF_LOCATE_URL/%C%AAF_NS.fs.2.1
diff --git a/cadi/aaf/pom.xml b/cadi/aaf/pom.xml
index 5ce05294..25a2d02d 100644
--- a/cadi/aaf/pom.xml
+++ b/cadi/aaf/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>cadiparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
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 08ee900f..30ea1c21 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
@@ -47,6 +47,7 @@ import org.onap.aaf.cadi.http.HBasicAuthSS;
import org.onap.aaf.cadi.http.HClient;
import org.onap.aaf.cadi.http.HX509SS;
import org.onap.aaf.cadi.oauth.HRenewingTokenSS;
+import org.onap.aaf.cadi.util.FixURIinfo;
import org.onap.aaf.misc.env.APIException;
public class TestConnectivity {
@@ -234,11 +235,12 @@ public class TestConnectivity {
} else {
socket = new Socket();
try {
+ FixURIinfo fui = new FixURIinfo(uri);
try {
- socket.connect(new InetSocketAddress(uri.getHost(), uri.getPort()),3000);
- System.out.printf("Can Connect a Socket to %s %d\n",uri.getHost(),uri.getPort());
+ socket.connect(new InetSocketAddress(fui.getHost(), fui.getPort()),3000);
+ System.out.printf("Can Connect a Socket to %s %d\n",fui.getHost(),fui.getPort());
} catch (IOException e) {
- System.out.printf("Cannot Connect a Socket to %s %d: %s\n",uri.getHost(),uri.getPort(),e.getMessage());
+ System.out.printf("Cannot Connect a Socket to %s %d: %s\n",fui.getHost(),fui.getPort(),e.getMessage());
}
} finally {
try {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
index 35ef9990..16fdb79c 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
@@ -28,6 +28,7 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
+import org.onap.aaf.cadi.Access;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.LocatorException;
import org.onap.aaf.cadi.SecuritySetter;
@@ -35,6 +36,7 @@ import org.onap.aaf.cadi.client.Future;
import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.config.SecurityInfoC;
import org.onap.aaf.cadi.http.HClient;
+import org.onap.aaf.cadi.util.FixURIinfo;
import org.onap.aaf.cadi.util.Split;
import org.onap.aaf.misc.env.APIException;
import org.onap.aaf.misc.env.Data.TYPE;
@@ -61,21 +63,9 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
int connectTimeout = Integer.parseInt(si.access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
try {
String[] path = Split.split('/',locatorURI.getPath());
- String host = locatorURI.getHost();
- if (host==null) {
- host = locatorURI.getAuthority(); // this happens when no port
- }
- if ("AAF_LOCATE_URL".equals(host)) {
- URI uri = new URI(
- locatorURI.getScheme(),
- locatorURI.getUserInfo(),
- aaf_locator_uri.getHost(),
- aaf_locator_uri.getPort(),
- "/locate"+locatorURI.getPath(),
- null,
- null
- );
- client = createClient(si.defSS, uri, connectTimeout);
+ FixURIinfo fui = new FixURIinfo(locatorURI);
+ if ("AAF_LOCATE_URL".equals(fui.getHost())) {
+ client = createClient(si.defSS, locatorURI, connectTimeout);
} else if (path.length>1 && "locate".equals(path[1])) {
StringBuilder sb = new StringBuilder();
for (int i=3;i<path.length;++i) {
@@ -83,23 +73,26 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
sb.append(path[i]);
}
setPathInfo(sb.toString());
- URI uri = new URI(
- locatorURI.getScheme(),
- locatorURI.getUserInfo(),
- locatorURI.getHost(),
- locatorURI.getPort(),
- "/locate/"+name + ':' + version,
- null,
- null
- );
- client = createClient(si.defSS, uri, connectTimeout);
+// URI uri = new URI(
+// locatorURI.getScheme(),
+// locatorURI.getAuthority(),
+// locatorURI.getPath(),
+// null,
+// null
+// );
+ client = createClient(si.defSS, locatorURI, connectTimeout);
} else {
client = new HClient(si.defSS, locatorURI, connectTimeout);
}
epsDF = env.newDataFactory(Endpoints.class);
- } catch (APIException | URISyntaxException e) {
+
+ } catch (APIException /*| URISyntaxException*/ e) {
throw new LocatorException(e);
}
+
+ if(si.access.willLog(Access.Level.DEBUG)) {
+ si.access.log(Access.Level.DEBUG, "Root URI:",client.getURI());
+ }
}
@Override
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
new file mode 100644
index 00000000..1e4e9c0f
--- /dev/null
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
@@ -0,0 +1,93 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ */
+
+package org.onap.aaf.cadi.aaf.v2_0;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.misc.env.impl.BasicTrans;
+
+/**
+ * This Locator good for using Inside Docker or K8s, where there is no real lookup,
+ * and there is conflict between external and internal host names, due to
+ * Service abstraction.
+ *
+ * @author Instrumental(Jonathan)
+ *
+ */
+public class AAFSingleLocator implements Locator<URI> {
+
+ private final URI uri;
+
+ /**
+ * NS here is "container" ns. AAF NS is assumed to be AAF_NS at this level of client code.
+ * @param cont_ns
+ * @param prefix
+ * @param version
+ * @throws URISyntaxException
+ */
+ public AAFSingleLocator(final String uri) throws URISyntaxException {
+ this.uri = new URI(uri);
+ }
+
+ @Override
+ public URI get(Item item) throws LocatorException {
+ return uri;
+ }
+
+ @Override
+ public boolean hasItems() {
+ return true;
+ }
+
+ @Override
+ public void invalidate(Item item) throws LocatorException {
+ }
+
+ @Override
+ public Item best() throws LocatorException {
+ return new SingleItem();
+ }
+
+ @Override
+ public Item first() throws LocatorException {
+ return new SingleItem();
+ }
+
+ @Override
+ public Item next(Item item) throws LocatorException {
+ return null; // only one item
+ }
+
+ @Override
+ public boolean refresh() {
+ return false;
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ private class SingleItem implements Item {
+ }
+}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
index 9f617136..9b630a76 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
@@ -87,12 +87,14 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
latitude = Double.parseDouble(lat);
longitude = Double.parseDouble(lng);
}
+
if (name.startsWith(Defaults.AAF_NS)) {
String root_ns = access.getProperty(Config.AAF_ROOT_NS, null);
- if (root_ns!=null) {
- name=name.replace(Defaults.AAF_NS, root_ns);
+ if(root_ns!=null) {
+ name=name.replace(Defaults.AAF_NS, root_ns);
}
}
+
if (name.startsWith("http")) { // simple URL
this.name = name;
this.version = access.getProperty(Config.AAF_API_VERSION,Config.AAF_DEFAULT_API_VERSION);
@@ -111,52 +113,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
public static void setCreator(LocatorCreator lc) {
locatorCreator = lc;
}
-
- /*public static Locator<URI> create(String key) throws LocatorException {
- String name = null;
- String version = Config.AAF_DEFAULT_API_VERSION;
- String pathInfo = null;
- int prev = key.indexOf("/locate");
- if (prev>0) {
- prev = key.indexOf('/',prev+6);
- if (prev>0) {
- int next = key.indexOf('/',++prev);
- if (next>0) {
- name = key.substring(prev, next);
- pathInfo=key.substring(next);
- } else {
- name = key.substring(prev);
- }
- String[] split = Split.split(':', name);
- switch(split.length) {
- case 3:
- case 2:
- version = split[1];
- name = split[0];
- break;
- default:
- break;
- }
- }
- }
-
- if (key.startsWith("http")) {
- if (name!=null) {
- if (locatorCreator != null) {
- AbsAAFLocator<?> aal = locatorCreator.create(name, version);
- if (pathInfo!=null) {
- aal.setPathInfo(pathInfo);
- }
- return aal;
- }
- } else {
- return new PropertyLocator(key);
- }
- }
- return null;
- }
- */
-
+
public static Locator<URI> create(final String name, final String version) throws LocatorException {
return locatorCreator.create(name, version);
}
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 18430ef3..aa4e5743 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
@@ -773,6 +773,13 @@ public class Agent {
}
app.add(Config.AAF_LOCATE_URL, propAccess, null);
+ for(Entry<Object, Object> aaf_loc_prop : propAccess.getProperties().entrySet()) {
+ String key = aaf_loc_prop.getKey().toString();
+ if(key.startsWith("aaf_locator")) {
+ app.add(key, aaf_loc_prop.getValue().toString());
+ }
+ }
+
app.add(Config.AAF_APPID, fqi);
app.add(Config.AAF_URL, propAccess, Defaults.AAF_URL);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
new file mode 100644
index 00000000..7e519c52
--- /dev/null
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
@@ -0,0 +1,264 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ */
+
+package org.onap.aaf.cadi.register;
+
+import java.net.Inet4Address;
+import java.net.UnknownHostException;
+import java.util.List;
+
+import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.aaf.Defaults;
+import org.onap.aaf.cadi.config.Config;
+import org.onap.aaf.cadi.util.Split;
+
+import locate.v1_0.MgmtEndpoint;
+import locate.v1_0.MgmtEndpoints;
+
+public class RegistrationCreator {
+ private static final String MUST_BE_DEFINED = " must be defined\n";
+ private Access access;
+
+ public RegistrationCreator(Access access) {
+ this.access = access;
+ }
+
+ public MgmtEndpoints create(final int port) throws CadiException {
+ MgmtEndpoints me = new MgmtEndpoints();
+ List<MgmtEndpoint> lme = me.getMgmtEndpoint();
+ MgmtEndpoint defData = null;
+ MgmtEndpoint locate = null;
+
+
+ StringBuilder errs = new StringBuilder();
+ try {
+ String hostname = access.getProperty(Config.HOSTNAME, null);
+ if (hostname==null) {
+ hostname = Inet4Address.getLocalHost().getHostName();
+ }
+ if (hostname==null) {
+ errs.append(Config.HOSTNAME);
+ errs.append(MUST_BE_DEFINED);
+ }
+
+ Float latitude=null;
+ String slatitude = access.getProperty(Config.CADI_LATITUDE, null);
+ if(slatitude == null) {
+ errs.append(Config.CADI_LATITUDE);
+ errs.append(MUST_BE_DEFINED);
+ } else {
+ latitude = Float.parseFloat(slatitude);
+ }
+
+ Float longitude=null;
+ String slongitude = access.getProperty(Config.CADI_LONGITUDE, null);
+ if(slongitude == null) {
+ errs.append(Config.CADI_LONGITUDE);
+ errs.append(MUST_BE_DEFINED);
+ } else {
+ longitude = Float.parseFloat(slongitude);
+ }
+
+ if(errs.length()>0) {
+ throw new CadiException(errs.toString());
+ }
+
+ String dot_le;
+ String ns;
+ String version=null;
+ String lentries = access.getProperty(Config.AAF_LOCATOR_CONTAINER, null);
+ if(lentries==null) {
+ lentries="";
+ } else {
+ lentries=',' + lentries; // "" makes a blank default Public Entry
+ }
+
+ String defaultName = null;
+ String str;
+ int public_port = port;
+ // Note: only one of the ports can be public... Therefore, only the la
+ for(String le : Split.splitTrim(',', lentries)) {
+ dot_le = le.isEmpty()?"":"."+le;
+ str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_PORT+dot_le, null);
+ if(str!=null) { // Get Public Port
+ public_port = Integer.decode(str);
+ }
+ }
+
+ String public_hostname = hostname;
+ for(String le : Split.splitTrim(',', lentries)) {
+ dot_le = le.isEmpty()?"":"."+le;
+ String ph = access.getProperty(Config.AAF_LOCATOR_PUBLIC_HOSTNAME+dot_le,null);
+ if( ph != null) {
+ public_hostname=ph;
+ }
+ }
+
+ String default_fqdn = access.getProperty(Config.AAF_LOCATOR_FQDN, public_hostname);
+
+
+ // Now, loop through by Container
+ for(String le : Split.splitTrim(',', lentries)) {
+ // Add variable entries
+ String names;
+ if(le.length()>0) {
+ dot_le = '.' + le;
+ names = access.getProperty(Config.AAF_LOCATOR_NAMES+dot_le,null);
+ if(names==null) {
+ // Go for Default
+ names = access.getProperty(Config.AAF_LOCATOR_NAMES,"");
+ }
+ } else {
+ dot_le = "";
+ names=access.getProperty(Config.AAF_LOCATOR_NAMES,dot_le);
+ }
+
+ for(String name : Split.splitTrim(',', names)) {
+ if(defData==null) {
+ defData = locate = new MgmtEndpoint();
+
+ defaultName = name;
+ version = access.getProperty(Config.AAF_LOCATOR_VERSION, Defaults.AAF_VERSION);
+ locate.setProtocol(access.getProperty(Config.AAF_LOCATOR_PROTOCOL,null));
+ List<String> ls = locate.getSubprotocol();
+ for(String sp : Split.splitTrim(',', access.getProperty(Config.AAF_LOCATOR_SUBPROTOCOL,""))) {
+ ls.add(sp);
+ }
+ locate.setLatitude(latitude);
+ locate.setLongitude(longitude);
+
+ } else {
+ locate = copy(defData);
+ }
+
+ str = access.getProperty(Config.HOSTNAME+dot_le, null);
+ if(str==null) {
+ str = access.getProperty(Config.HOSTNAME, hostname);
+ }
+ locate.setHostname(hostname);
+
+ ns = access.getProperty(Config.AAF_LOCATOR_NS+dot_le,null);
+ if(ns==null) {
+ ns = access.getProperty(Config.AAF_LOCATOR_NS,"");
+ }
+ switch(ns) {
+ case Defaults.AAF_NS:
+ ns = access.getProperty(Config.AAF_ROOT_NS, "");
+ // Fallthrough on purpose.
+ }
+
+ String ns_dot;
+ if(ns.isEmpty()) {
+ ns_dot = ns;
+ } else {
+ ns_dot = ns + '.';
+ }
+
+ String container_id = access.getProperty(Config.AAF_LOCATOR_CONTAINER_ID+dot_le, "");
+ if(!container_id.isEmpty()) {
+ ns_dot = container_id + '.' + ns_dot;
+ }
+
+ if(!le.isEmpty()) {
+ ns_dot = le + '.' + ns_dot;
+ }
+
+ if(name.isEmpty()) {
+ locate.setName(ns_dot + defaultName);
+ } else {
+ locate.setName(ns_dot + name);
+ }
+
+ if(dot_le.isEmpty()) {
+ locate.setHostname(access.getProperty(Config.AAF_LOCATOR_FQDN, default_fqdn));
+ } else {
+ str = access.getProperty(Config.AAF_LOCATOR_FQDN+dot_le, null);
+ if(str==null) {
+ locate.setHostname(default_fqdn);
+ } else {
+ String container_ns = access.getProperty(Config.AAF_LOCATOR_CONTAINER_NS+dot_le, "");
+ str = str.replace("%CNS", container_ns);
+ String container = access.getProperty(Config.AAF_LOCATOR_CONTAINER+dot_le, "");
+ str = str.replace("%C", container);
+ str = str.replace("%NS", ns);
+ str = str.replace("%N", name);
+ str = str.replace("%DF", default_fqdn);
+ str = str.replace("%PH", public_hostname);
+ locate.setHostname(str);
+ }
+ }
+
+ if(le.isEmpty()) {
+ locate.setPort(public_port);
+ } else {
+ locate.setPort(port);
+ }
+
+ String specificVersion = access.getProperty(Config.AAF_LOCATOR_VERSION + dot_le,null);
+ if(specificVersion == null && locate == defData) {
+ specificVersion = version;
+ }
+ if(specificVersion!=null) {
+ String split[] = Split.splitTrim('.', specificVersion);
+ locate.setPkg(split.length>3?Integer.parseInt(split[3]):0);
+ locate.setPatch(split.length>2?Integer.parseInt(split[2]):0);
+ locate.setMinor(split.length>1?Integer.parseInt(split[1]):0);
+ locate.setMajor(split.length>0?Integer.parseInt(split[0]):0);
+ }
+
+ String protocol = access.getProperty(Config.AAF_LOCATOR_PROTOCOL + dot_le, null);
+ if (protocol!=null) {
+ locate.setProtocol(protocol);
+ String subprotocols = access.getProperty(Config.AAF_LOCATOR_SUBPROTOCOL + dot_le, null);
+ if(subprotocols!=null) {
+ List<String> ls = locate.getSubprotocol();
+ for (String s : Split.split(',', subprotocols)) {
+ ls.add(s);
+ }
+ }
+ }
+ lme.add(locate);
+ }
+ }
+ } catch (NumberFormatException | UnknownHostException e) {
+ throw new CadiException("Error extracting Data from Properties for Registrar",e);
+ }
+
+ return me;
+ }
+
+ private MgmtEndpoint copy(MgmtEndpoint mep) {
+ MgmtEndpoint out = new MgmtEndpoint();
+ out.setName(mep.getName());
+ out.setHostname(mep.getHostname());
+ out.setLatitude(mep.getLatitude());
+ out.setLongitude(mep.getLongitude());
+ out.setMajor(mep.getMajor());
+ out.setMinor(mep.getMinor());
+ out.setPkg(mep.getPkg());
+ out.setPatch(mep.getPatch());
+ out.setPort(mep.getPort());
+ out.setProtocol(mep.getProtocol());
+ out.getSpecialPorts().addAll(mep.getSpecialPorts());
+ out.getSubprotocol().addAll(mep.getSubprotocol());
+ return out;
+ }
+}
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 49d40ab4..883410c0 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
@@ -22,10 +22,8 @@
package org.onap.aaf.cadi.register;
import java.net.HttpURLConnection;
-import java.net.Inet4Address;
import java.net.URI;
import java.net.URISyntaxException;
-import java.net.UnknownHostException;
import org.onap.aaf.cadi.Access;
import org.onap.aaf.cadi.Access.Level;
@@ -39,16 +37,13 @@ import org.onap.aaf.cadi.client.Result;
import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.locator.PropertyLocator;
import org.onap.aaf.cadi.locator.SingleEndpointLocator;
-import org.onap.aaf.cadi.util.Split;
import org.onap.aaf.misc.env.APIException;
import org.onap.aaf.misc.env.impl.BasicEnv;
import org.onap.aaf.misc.rosetta.env.RosettaDF;
-import locate.v1_0.MgmtEndpoint;
import locate.v1_0.MgmtEndpoints;
public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
- private final MgmtEndpoint mep;
private final MgmtEndpoints meps;
private final AAFCon<HttpURLConnection> aafcon;
private final RosettaDF<MgmtEndpoints> mgmtEndpointsDF;
@@ -56,8 +51,7 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
private final Access access;
private final int timeout;
- @SafeVarargs
- public RemoteRegistrant(AAFCon<HttpURLConnection> aafcon, String name, String version, int port, RemoteRegistrant<ENV> ... others) throws CadiException, LocatorException {
+ public RemoteRegistrant(AAFCon<HttpURLConnection> aafcon, int port) throws CadiException, LocatorException {
this.aafcon = aafcon;
access = aafcon.access;
try {
@@ -82,60 +76,13 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
}
}
- mep = new MgmtEndpoint();
- mep.setName(name);
- mep.setPort(port);
-
- try {
- String hostnameToRegister = access.getProperty(Config.AAF_REGISTER_AS, 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);
- }
- String longitude = access.getProperty(Config.CADI_LONGITUDE, null);
- if (longitude==null) {
- longitude = access.getProperty("AFT_LONGITUDE", null);
- }
- if (latitude==null || longitude==null) {
- throw new CadiException(Config.CADI_LATITUDE + " and " + Config.CADI_LONGITUDE + " is required");
- } else {
- mep.setLatitude(Float.parseFloat(latitude));
- mep.setLongitude(Float.parseFloat(longitude));
- }
- String split[] = Split.split('.', version);
- mep.setPkg(split.length>3?Integer.parseInt(split[3]):0);
- mep.setPatch(split.length>2?Integer.parseInt(split[2]):0);
- mep.setMinor(split.length>1?Integer.parseInt(split[1]):0);
- mep.setMajor(split.length>0?Integer.parseInt(split[0]):0);
-
- String subprotocols = access.getProperty(Config.CADI_PROTOCOLS, null);
- if (subprotocols==null) {
- mep.setProtocol("http");
- } else {
- mep.setProtocol("https");
- for (String s : Split.split(',', subprotocols)) {
- mep.getSubprotocol().add(s);
- }
- }
- } catch (NumberFormatException | UnknownHostException e) {
- throw new CadiException("Error extracting Data from Properties for Registrar",e);
- }
- meps = new MgmtEndpoints();
- meps.getMgmtEndpoint().add(mep);
- for (RemoteRegistrant<ENV> rr : others) {
- meps.getMgmtEndpoint().add(rr.mep);
- }
+ RegistrationCreator rcreator = new RegistrationCreator(access);
+ meps = rcreator.create(port);
}
- @Override
+
+
+ @Override
public Result<Void> update(ENV env) {
try {
Rcli<?> client = aafcon.client(locator);
diff --git a/cadi/client/pom.xml b/cadi/client/pom.xml
index 3563be7a..b27d37c4 100644
--- a/cadi/client/pom.xml
+++ b/cadi/client/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>cadiparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
index d8852834..daca47df 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
@@ -40,6 +40,7 @@ import org.onap.aaf.cadi.SecuritySetter;
import org.onap.aaf.cadi.client.EClient;
import org.onap.aaf.cadi.client.Future;
import org.onap.aaf.cadi.client.Rcli;
+import org.onap.aaf.cadi.util.FixURIinfo;
import org.onap.aaf.misc.env.APIException;
import org.onap.aaf.misc.env.Data;
import org.onap.aaf.misc.env.Data.TYPE;
@@ -109,24 +110,23 @@ public class HClient implements EClient<HttpURLConnection> {
@Override
public void send() throws APIException {
- try {
- // Build URL from given URI plus current Settings
- if (uri.getPath()==null) {
- throw new APIException("Invalid URL entered for HClient");
- }
- StringBuilder pi=null;
- if (pathinfo!=null) { // additional pathinfo
- pi = new StringBuilder(uri.getPath());
- if (!pathinfo.startsWith("/")) {
- pi.append('/');
- }
- pi.append(pathinfo);
+ // Build URL from given URI plus current Settings
+ if (uri.getPath()==null) {
+ throw new APIException("Invalid URL entered for HClient");
+ }
+ StringBuilder pi=null;
+ if (pathinfo!=null) { // additional pathinfo
+ pi = new StringBuilder(uri.getPath());
+ if (!pathinfo.startsWith("/")) {
+ pi.append('/');
}
- URI sendURI = new URI(
+ pi.append(pathinfo);
+ }
+ URI sendURI = null;
+ try {
+ sendURI = new URI(
uri.getScheme(),
- uri.getUserInfo(),
- uri.getHost(),
- uri.getPort(),
+ uri.getAuthority(),
pi==null?uri.getPath():pi.toString(),
query==null?uri.getQuery():query,
fragment==null?uri.getFragment():fragment
@@ -149,8 +149,14 @@ public class HClient implements EClient<HttpURLConnection> {
transfer.transfer(huc.getOutputStream());
}
// TODO other settings? There's a bunch here.
+ } catch (APIException e) {
+ throw e;
} catch (Exception e) {
- throw new APIException(e);
+ if(sendURI==null) {
+ throw new APIException("Cannot connect to Root URI: " + uri.toString(),e);
+ } else {
+ throw new APIException("Cannot connect to " + sendURI.toString() + "(Root URI: " + uri.toString() +')',e);
+ }
} finally { // ensure all these are reset after sends
meth=pathinfo=null;
if (headers!=null) {
@@ -171,9 +177,7 @@ public class HClient implements EClient<HttpURLConnection> {
protected HttpURLConnection getConnection(URI uri, StringBuilder pi) throws IOException, URISyntaxException {
URL url = new URI(
uri.getScheme(),
- uri.getUserInfo(),
- uri.getHost(),
- uri.getPort(),
+ uri.getAuthority(),
pi==null?uri.getPath():pi.toString(),
query,
fragment).toURL();
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
index 8e3138af..1e5c5211 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
@@ -30,14 +30,15 @@ import java.net.URISyntaxException;
import javax.net.ssl.SSLHandshakeException;
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.Locator.Item;
import org.onap.aaf.cadi.LocatorException;
import org.onap.aaf.cadi.SecuritySetter;
-import org.onap.aaf.cadi.Access.Level;
-import org.onap.aaf.cadi.Locator.Item;
import org.onap.aaf.cadi.client.Rcli;
import org.onap.aaf.cadi.client.Retryable;
+import org.onap.aaf.cadi.util.FixURIinfo;
import org.onap.aaf.misc.env.APIException;
public class HMangr {
@@ -174,7 +175,8 @@ public class HMangr {
loc.refresh();
for (Item li=loc.first();li!=null;li=loc.next(li)) {
URI uri=loc.get(li);
- if (host!=null && !host.equals(uri.getHost())) {
+ FixURIinfo fui = new FixURIinfo(uri);
+ if (host!=null && !host.equals(fui.getHost())) {
break;
}
try {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
index eb0ecf11..bccb8116 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
@@ -36,6 +36,7 @@ import java.util.TimerTask;
import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.util.FixURIinfo;
import org.onap.aaf.misc.env.util.Split;
public class PropertyLocator implements Locator<URI> {
@@ -181,7 +182,8 @@ public class PropertyLocator implements Locator<URI> {
String realname;
for (int i = 0; i < orig.length ; ++i) {
try {
- InetAddress ia[] = InetAddress.getAllByName(orig[i].getHost());
+ FixURIinfo fui = new FixURIinfo(orig[i]);
+ InetAddress ia[] = InetAddress.getAllByName(fui.getHost());
URI o,n;
for (int j=0;j<ia.length;++j) {
diff --git a/cadi/core/pom.xml b/cadi/core/pom.xml
index 51a0d09f..c02d0f84 100644
--- a/cadi/core/pom.xml
+++ b/cadi/core/pom.xml
@@ -16,7 +16,7 @@
<groupId>org.onap.aaf.authz</groupId>
<artifactId>cadiparent</artifactId>
<relativePath>..</relativePath>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
index a9d671cc..599bb984 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
@@ -26,6 +26,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -106,7 +108,7 @@ public class PropAccess implements Access {
// First, load related System Properties
for (Entry<Object,Object> es : System.getProperties().entrySet()) {
String key = es.getKey().toString();
- for (String start : new String[] {"cadi_","aaf_","cm_"}) {
+ for (String start : new String[] {"HOSTNAME","cadi_","aaf_","cm_"}) {
if (key.startsWith(start)) {
props.put(key, es.getValue());
}
@@ -274,41 +276,53 @@ public class PropAccess implements Access {
sb.append("] ");
} else {
int idx = 0;
- if (elements[idx] instanceof Integer) {
+ if(elements[idx]!=null &&
+ elements[idx] instanceof Integer) {
sb.append('-');
sb.append(elements[idx]);
++idx;
}
sb.append("] ");
- String s;
- boolean first = true;
- for (Object o : elements) {
- if (o!=null) {
- s=o.toString();
- if (first) {
- first = false;
- } else {
- int l = s.length();
- if (l>0) {
- switch(s.charAt(l-1)) {
- case ' ':
- break;
- default:
- sb.append(' ');
- }
- }
- }
- sb.append(s);
- }
- }
+ write(true,sb,elements);
}
return sb;
}
+
+ private static boolean write(boolean first, StringBuilder sb, Object[] elements) {
+ String s;
+ for (Object o : elements) {
+ if (o!=null) {
+ if(o.getClass().isArray()) {
+ first = write(first,sb,(Object[])o);
+ } else {
+ s=o.toString();
+ if (first) {
+ first = false;
+ } else {
+ int l = s.length();
+ if (l>0) {
+ switch(s.charAt(l-1)) {
+ case ' ':
+ break;
+ default:
+ sb.append(' ');
+ }
+ }
+ }
+ sb.append(s);
+ }
+ }
+ }
+ return first;
+ }
@Override
public void log(Exception e, Object... elements) {
- log(Level.ERROR,e.getMessage(),elements);
- e.printStackTrace(System.err);
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ pw.println();
+ e.printStackTrace(pw);
+ log(Level.ERROR,elements,sw.toString());
}
@Override
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 353e8e38..245b6539 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
@@ -58,6 +58,7 @@ import org.onap.aaf.cadi.taf.HttpTaf;
import org.onap.aaf.cadi.taf.basic.BasicHttpTaf;
import org.onap.aaf.cadi.taf.cert.X509Taf;
import org.onap.aaf.cadi.taf.dos.DenialOfServiceTaf;
+import org.onap.aaf.cadi.util.FixURIinfo;
import org.onap.aaf.cadi.util.Split;
/**
@@ -158,13 +159,31 @@ public class Config {
public static final String OAUTH2_TOKEN_URL = "https://AAF_LOCATE_URL/AAF_NS.token:" + AAF_DEFAULT_API_VERSION;
public static final String OAUTH2_INTROSPECT_URL = "https://AAF_LOCATE_URL/AAF_NS.introspect:" + AAF_DEFAULT_API_VERSION;
- public static final String AAF_REGISTER_AS = "aaf_register_as";
+ public static final String AAF_LOCATOR_CLASS = "aaf_locator_class";
+ // AAF Locator Entries are ADDITIONAL entries, which also gives the Property ability
+ // to set these entries manually
+ // example: adding a K8S name like "oom"
+ // this will allow Registrations to pick up
+ // locator_ns.oom for onap's "OOM" based k8s entries, etc.
+ public static final String AAF_LOCATOR_CONTAINER="aaf_locator_container";
+ // An ID for another Container, to be used to avoid picking up the wrong internal info
+ // for another container.
+ public static final String AAF_LOCATOR_CONTAINER_ID = "aaf_locator_container_id";
+ public static final String AAF_LOCATOR_CONTAINER_NS = "aaf_locator_container_ns";
+ public static final String AAF_LOCATOR_VERSION = "aaf_locator_version";
+ public static final String AAF_LOCATOR_PROTOCOL = "aaf_locator_protocol";
+ public static final String AAF_LOCATOR_SUBPROTOCOL = "aaf_locator_subprotocol";
+ public static final String AAF_LOCATOR_NS = "aaf_locator_ns";
+ public static final String AAF_LOCATOR_NAMES = "aaf_locator_names";
+ public static final String AAF_LOCATOR_FQDN = "aaf_locator_fqdn";
+ 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_APPID = "aaf_id";
public static final String AAF_APPPASS = "aaf_password";
public static final String AAF_LUR_CLASS = "aaf_lur_class";
public static final String AAF_TAF_CLASS = "aaf_taf_class";
public static final String AAF_CONNECTOR_CLASS = "aaf_connector_class";
- public static final String AAF_LOCATOR_CLASS = "aaf_locator_class";
public static final String AAF_CONN_TIMEOUT = "aaf_conn_timeout";
public static final String AAF_CONN_TIMEOUT_DEF = "3000";
public static final String AAF_CONN_IDLE_TIMEOUT = "aaf_conn_idle_timeout"; // only for Direct Jetty Access.
@@ -189,7 +208,7 @@ public class Config {
public static final String AAF_HIGH_COUNT = "aaf_high_count";
public static final String AAF_HIGH_COUNT_DEF = "1000"; // Default is 1000 entries
public static final String AAF_PERM_MAP = "aaf_perm_map";
- public static final String AAF_COMPONENT = "aaf_component";
+// public static final String AAF_COMPONENT = "aaf_component";
public static final String AAF_CERT_IDS = "aaf_cert_ids";
public static final String AAF_DEBUG_IDS = "aaf_debug_ids"; // comma delimited
public static final String AAF_DATA_DIR = "aaf_data_dir"; // AAF processes and Components only.
@@ -795,18 +814,39 @@ public class Config {
if (_url==null) {
access.log(Level.INIT,"No URL passed to 'loadLocator'. Disabled");
} else {
- String url = _url;
+ String url = _url.replace("/AAF_NS.", "/%C%CID%AAF_NS.");
+ String root_ns = access.getProperty(Config.AAF_ROOT_NS, null);
+ if(url.indexOf('%')>=0) {
+ String str = access.getProperty(Config.AAF_LOCATOR_CONTAINER_ID, null);
+ if(str==null) {
+ url = url.replace("%CID","");
+ } else {
+ url = url.replace("%CID",str+'.');
+ }
+ str = access.getProperty(Config.AAF_LOCATOR_CONTAINER, null);
+ if(str==null) {
+ url = url.replace("%C","");
+ } else {
+ url = url.replace("%C",str+'.');
+ }
+
+ if (root_ns==null) {
+ url = url.replace("%AAF_NS","");
+ } else {
+ url = url.replace("%AAF_NS",root_ns);
+ }
+ }
String replacement;
int idxAAFLocateUrl;
- if ((idxAAFLocateUrl=_url.indexOf(AAF_LOCATE_URL_TAG))>0 && ((replacement=access.getProperty(AAF_LOCATE_URL, null))!=null)) {
+ if ((idxAAFLocateUrl=url.indexOf(AAF_LOCATE_URL_TAG))>0 && ((replacement=access.getProperty(AAF_LOCATE_URL, null))!=null)) {
StringBuilder sb = new StringBuilder(replacement);
if (!replacement.endsWith("/locate")) {
sb.append("/locate");
}
- sb.append(_url,idxAAFLocateUrl+AAF_LOCATE_URL_TAG.length(),_url.length());
+ sb.append(url,idxAAFLocateUrl+AAF_LOCATE_URL_TAG.length(),url.length());
url = sb.toString();
}
-
+
try {
Class<?> lcls = loadClass(access,AAF_LOCATOR_CLASS_DEF);
if (lcls==null) {
@@ -821,12 +861,13 @@ public class Config {
}
if (locator==null) {
URI locatorURI = new URI(url);
+ FixURIinfo fui = new FixURIinfo(locatorURI);
Constructor<?> cnst = lcls.getConstructor(SecurityInfoC.class,URI.class);
locator = (Locator<URI>)cnst.newInstance(new Object[] {si,locatorURI});
- int port = locatorURI.getPort();
- String portS = port<0?"":(":"+locatorURI.getPort());
+ int port = fui.getPort();
+ String portS = port<0?"":(":"+port);
- access.log(Level.INFO, "AAFLocator enabled using " + locatorURI.getScheme() +"://"+locatorURI.getHost() + portS);
+ access.log(Level.INFO, "AAFLocator enabled using " + locatorURI.getScheme() +"://"+fui.getHost() + portS);
} else {
access.log(Level.INFO, "AAFLocator enabled using preloaded " + locator.getClass().getSimpleName());
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
index 2305eacd..cd8eff44 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
@@ -139,7 +139,7 @@ public class CadiFilter implements Filter {
@SuppressWarnings("unchecked")
- private void init(Get getter) throws ServletException {
+ protected void init(Get getter) throws ServletException {
sideChain = new SideChain();
// Start with the assumption of "Don't trust anyone".
TrustChecker tc = TrustChecker.NOTRUST; // default position
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
index cf7c922d..1805c782 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
@@ -32,7 +32,7 @@ import org.onap.aaf.cadi.config.Get;
* A private method to query the Filter config and if not exists, return the default. This
* cleans up the initialization code.
*/
-class FCGet implements Get {
+public class FCGet implements Get {
/**
*
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
new file mode 100644
index 00000000..7e3a239b
--- /dev/null
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
@@ -0,0 +1,66 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ */
+
+package org.onap.aaf.cadi.util;
+
+import java.net.URI;
+
+/**
+ * URI and URL, if the host does not have "dots", will interpret Host:port as Authority
+ *
+ * This is very problematic for Containers, which like single name entries.
+ * @author Instrumental(Jonathan)
+ *
+ */
+public class FixURIinfo {
+ private String auth;
+ private String host;
+ private int port;
+
+ public FixURIinfo(URI uri) {
+ auth = uri.getAuthority();
+ host = uri.getHost();
+ if(host==null) {
+ if(auth!=null) {
+ int colon = auth.indexOf(':');
+ if(colon >= 0 ) {
+ host = auth.substring(0, colon);
+ port = Integer.parseInt(auth.substring(colon+1));
+ } else {
+ host = auth;
+ port = uri.getPort();
+ }
+ auth=null;
+ }
+ }
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public String getUserInfo() {
+ return auth;
+ }
+}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
index 4bb1d3b8..97afa65c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
@@ -31,84 +31,93 @@ package org.onap.aaf.cadi.util;
*/
public class Split {
- public static String[] split(char c, String value) {
- return split(c,value,0,value.length());
- }
+ private static final String[] EMPTY = new String[0];
- public static String[] split(char c, String value, int start, int end) {
- if (value==null) {
- return new String[0];
- }
+ public static String[] split(char c, String value) {
+ if (value==null) {
+ return EMPTY;
+ }
- // Count items to preallocate Array (memory alloc is more expensive than counting twice)
- int count,idx;
- for (count=1,idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,++idx),++count);
- String[] rv = new String[count];
- if (count==1) {
- rv[0]=value.substring(start,end);
- } else {
- int last=0;
- count=-1;
- for (idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,idx)) {
- rv[++count]=value.substring(last,idx);
- last = ++idx;
- }
- rv[++count]=value.substring(last,end);
- }
- return rv;
- }
+ return split(c,value,0,value.length());
+ }
- public static String[] splitTrim(char c, String value, int start, int end) {
- if (value==null) {
- return new String[0];
- }
+ public static String[] split(char c, String value, int start, int end) {
+ if (value==null) {
+ return EMPTY;
+ }
- // Count items to preallocate Array (memory alloc is more expensive than counting twice)
- int count,idx;
- for (count=1,idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,++idx),++count);
- String[] rv = new String[count];
- if (count==1) {
- rv[0]=value.substring(start,end).trim();
- } else {
- int last=0;
- count=-1;
- for (idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,idx)) {
- rv[++count]=value.substring(last,idx).trim();
- last = ++idx;
- }
- rv[++count]=value.substring(last,end).trim();
- }
- return rv;
- }
+ // Count items to preallocate Array (memory alloc is more expensive than counting twice)
+ int count,idx;
+ for (count=1,idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,++idx),++count);
+ String[] rv = new String[count];
+ if (count==1) {
+ rv[0]=value.substring(start,end);
+ } else {
+ int last=0;
+ count=-1;
+ for (idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,idx)) {
+ rv[++count]=value.substring(last,idx);
+ last = ++idx;
+ }
+ rv[++count]=value.substring(last,end);
+ }
+ return rv;
+ }
- public static String[] splitTrim(char c, String value) {
- return splitTrim(c,value,0,value.length());
- }
+ public static String[] splitTrim(char c, String value, int start, int end) {
+ if (value==null) {
+ return EMPTY;
+ }
- public static String[] splitTrim(char c, String value, int size) {
- if (value==null) {
- return new String[0];
- }
+ // Count items to preallocate Array (memory alloc is more expensive than counting twice)
+ int count,idx;
+ for (count=1,idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,++idx),++count);
+ String[] rv = new String[count];
+ if (count==1) {
+ rv[0]=value.substring(start,end).trim();
+ } else {
+ int last=0;
+ count=-1;
+ for (idx=value.indexOf(c,start);idx>=0 && idx<end;idx=value.indexOf(c,idx)) {
+ rv[++count]=value.substring(last,idx).trim();
+ last = ++idx;
+ }
+ rv[++count]=value.substring(last,end).trim();
+ }
+ return rv;
+ }
- int idx;
- String[] rv = new String[size];
- if (size==1) {
- rv[0]=value.trim();
- } else {
- int last=0;
- int count=-1;
- size-=2;
- for (idx=value.indexOf(c);idx>=0 && count<size;idx=value.indexOf(c,idx)) {
- rv[++count]=value.substring(last,idx).trim();
- last = ++idx;
- }
- if (idx>0) {
- rv[++count]=value.substring(last,idx).trim();
- } else {
- rv[++count]=value.substring(last).trim();
- }
- }
- return rv;
- }
+ public static String[] splitTrim(char c, String value) {
+ if (value==null) {
+ return EMPTY;
+ }
+ return splitTrim(c,value,0,value.length());
+ }
+
+ public static String[] splitTrim(char c, String value, int size) {
+ if (value==null) {
+ return EMPTY;
+ }
+
+ int idx;
+ String[] rv = new String[size];
+ if (size==1) {
+ rv[0]=value.trim();
+ } else {
+ int last=0;
+ int count=-1;
+ size-=2;
+ for (idx=value.indexOf(c);idx>=0 && count<size;idx=value.indexOf(c,idx)) {
+ rv[++count]=value.substring(last,idx).trim();
+ last = ++idx;
+ }
+ if (idx>0) {
+ rv[++count]=value.substring(last,idx).trim();
+ } else {
+ rv[++count]=value.substring(last).trim();
+ }
+ }
+ return rv;
+ }
}
diff --git a/cadi/oauth-enduser/pom.xml b/cadi/oauth-enduser/pom.xml
index d9d52141..d04e12b5 100644
--- a/cadi/oauth-enduser/pom.xml
+++ b/cadi/oauth-enduser/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>cadiparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/cadi/pom.xml b/cadi/pom.xml
index 4b02ebef..7e7458a6 100644
--- a/cadi/pom.xml
+++ b/cadi/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>parent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
</parent>
<artifactId>cadiparent</artifactId>
<name>AAF CADI Parent (Code, Access, Data, Identity)</name>
diff --git a/cadi/servlet-sample/pom.xml b/cadi/servlet-sample/pom.xml
index ec73e2f3..ca441079 100644
--- a/cadi/servlet-sample/pom.xml
+++ b/cadi/servlet-sample/pom.xml
@@ -4,7 +4,7 @@
<groupId>org.onap.aaf.authz</groupId>
<artifactId>cadiparent</artifactId>
<relativePath>..</relativePath>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>CADI Servlet Sample (Test Only)</name>
diff --git a/conf/CA/bootstrap.sh b/conf/CA/bootstrap.sh
index e753493d..bf946782 100644
--- a/conf/CA/bootstrap.sh
+++ b/conf/CA/bootstrap.sh
@@ -90,12 +90,12 @@ fi
for ROOT in $(cat san_root.aaf); do
SANS="$SANS $ROOT"
- for C in service locate oauth gui cm hello; do
+ for C in service locate oauth token introspect gui cm hello; do
SANS="$SANS $C.$ROOT"
done
done
-for C in service locate oauth gui cm hello; do
+for C in service locate oauth token introspect gui cm hello; do
SANS="$SANS aaf-$C"
SANS="$SANS aaf-$C.onap"
done
diff --git a/conf/CA/san_root.aaf b/conf/CA/san_root.aaf
index cd3a3f3b..a77b62d2 100644
--- a/conf/CA/san_root.aaf
+++ b/conf/CA/san_root.aaf
@@ -1 +1 @@
-aaf.osaaf.org aaf.api.simpledemo.onap.org
+aaf.osaaf.org
diff --git a/misc/env/pom.xml b/misc/env/pom.xml
index 85bcdf94..2c8d4207 100644
--- a/misc/env/pom.xml
+++ b/misc/env/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>miscparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java b/misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java
index 0bff6a06..61d10ae1 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java
@@ -59,7 +59,7 @@ public final class StaticSlot {
* @param name
* The name of the StaticSlot's key.
*/
- StaticSlot(int index, String name) {
+ public StaticSlot(int index, String name) {
slot = index;
key = name;
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java
index 2617559d..d76d8828 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.misc.env.impl;
+package org.onap.aaf.misc.env;
import static org.junit.Assert.assertFalse;
import static org.mockito.MockitoAnnotations.initMocks;
@@ -31,6 +31,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.onap.aaf.misc.env.impl.JavaUtilLogTarget;
public class JU_JavaUtilLogTarget {
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java
index e685dfe6..d8e843b4 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java
@@ -19,10 +19,10 @@
*
*/
-package org.onap.aaf.misc.env.impl;
+package org.onap.aaf.misc.env;
import org.junit.Test;
-import org.onap.aaf.misc.env.APIException;
+import org.onap.aaf.misc.env.impl.NullLifeCycle;
public class JU_NullLifeCycle {
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java
index db48345c..39d43066 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java
@@ -18,15 +18,13 @@
* ============LICENSE_END====================================================
*
*/
-package org.onap.aaf.misc.env;
+package org.onap.aaf.misc.env.jaxb;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.MockitoAnnotations.initMocks;
-import java.io.File;
import java.util.List;
import java.util.Properties;
@@ -38,6 +36,12 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaf.misc.env.Env;
+import org.onap.aaf.misc.env.LogTarget;
+import org.onap.aaf.misc.env.Slot;
+import org.onap.aaf.misc.env.StaticSlot;
+import org.onap.aaf.misc.env.StoreImpl;
+import org.onap.aaf.misc.env.TimeTaken;
@RunWith(MockitoJUnitRunner.class)
public class JU_StoreImplTest {
diff --git a/misc/log4j/pom.xml b/misc/log4j/pom.xml
index 51073c01..0621305d 100644
--- a/misc/log4j/pom.xml
+++ b/misc/log4j/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>miscparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/misc/pom.xml b/misc/pom.xml
index 13f3aa7f..89e7e2b8 100644
--- a/misc/pom.xml
+++ b/misc/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>parent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
</parent>
<artifactId>miscparent</artifactId>
<name>AAF Misc Parent</name>
diff --git a/misc/rosetta/pom.xml b/misc/rosetta/pom.xml
index acf7c3dc..2cf38a34 100644
--- a/misc/rosetta/pom.xml
+++ b/misc/rosetta/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>miscparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/misc/xgen/pom.xml b/misc/xgen/pom.xml
index 355a7128..c2042cf8 100644
--- a/misc/xgen/pom.xml
+++ b/misc/xgen/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>miscparent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/pom.xml b/pom.xml
index 2ccb428c..67b1e21b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.aaf.authz</groupId>
<artifactId>parent</artifactId>
- <version>2.1.9-SNAPSHOT</version>
+ <version>2.1.10-SNAPSHOT</version>
<name>aaf-authz</name>
<packaging>pom</packaging>