Refine Helm Client Charts

Issue-ID: AAF-802
Change-Id: Ie00cd2919eeecef00aac1dae139c7ef80092589a
Signed-off-by: Instrumental <jonathan.gathman@att.com>
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
index a49fc94..a8ec826 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
@@ -210,10 +210,10 @@
 						// for users and approvers still valid
 						String user = appr.getUser();
 						
-						if(org.isRevoked(trans, appr.getApprover())) {
+						if(org.isRevoked(noAvg, appr.getApprover())) {
 							deleteCW.comment("Approver ID is revoked");
 							Approval.row(deleteCW, appr);
-						} else if(user!=null && !user.isEmpty() && org.isRevoked(trans, user)) {
+						} else if(user!=null && !user.isEmpty() && org.isRevoked(noAvg, user)) {
 							deleteCW.comment("USER ID is revoked");
 							Approval.row(deleteCW, appr);
 						} else {
@@ -491,10 +491,6 @@
 				    	if(linst!=null) {
 					    	Instance lastBath = null;
 					    	for(Instance inst : linst) {
-		//			    		if(inst.attn>0) {
-		//			    			writeAnalysis(trans, cred, inst);
-		//				    		// Special Behavior: only eval the LAST Instance
-		//			    		} else 
 					    		// All Creds go through Life Cycle
 					    		if(deleteDate!=null && inst.expires.before(deleteDate)) {
 					        		writeAnalysis(noAvg, cred, inst); // will go to Delete
@@ -551,14 +547,14 @@
 		return existing;
 	}
 
-	private Range writeAnalysis(AuthzTrans trans, UserRole ur) {
+	private Range writeAnalysis(AuthzTrans noAvg, UserRole ur) {
 		Range r = expireRange.getRange("ur", ur.expires());
 		if(r!=null) {
 			Date lnd = ln.lastNotified(LastNotified.newKey(ur));
 			// Note: lnd is NEVER null
 			Identity i;
 			try {
-				i = org.getIdentity(trans, ur.user());
+				i = org.getIdentity(noAvg, ur.user());
 			} catch (OrganizationException e) {
 				i=null;
 			}
@@ -572,7 +568,7 @@
 		return r;
 	}
     
-    private void writeAnalysis(AuthzTrans trans, Cred cred, Instance inst) {
+    private void writeAnalysis(AuthzTrans noAvg, Cred cred, Instance inst) {
     	if(cred!=null && inst!=null) {
 			Range r = expireRange.getRange("cred", inst.expires);
 			if(r!=null) {
@@ -580,7 +576,7 @@
 				// Note: lnd is NEVER null
 				Identity i;
 				try {
-					i = org.getIdentity(trans, cred.id);
+					i = org.getIdentity(noAvg, cred.id);
 				} catch (OrganizationException e) {
 					i=null;
 				}
@@ -594,14 +590,14 @@
     	}
 	}
 
-    private void writeAnalysis(AuthzTrans trans, X509 x509, X509Certificate x509Cert) throws IOException {
+    private void writeAnalysis(AuthzTrans noAvg, X509 x509, X509Certificate x509Cert) throws IOException {
 		Range r = expireRange.getRange("x509", x509Cert.getNotAfter());
 		if(r!=null) {
 			Date lnd = ln.lastNotified(LastNotified.newKey(x509,x509Cert));
 			// Note: lnd is NEVER null
 			Identity i;
 			try {
-				i = org.getIdentity(trans, x509.id);
+				i = org.getIdentity(noAvg, x509.id);
 			} catch (OrganizationException e) {
 				i=null;
 			}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
index 7bc1fdc..e9c3601 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
@@ -35,6 +35,7 @@
 
     private final static String MSG = ".set(Access access) must be called before use";
     public static final CharSequence ROOT_NS_TAG = "AAF_NS"; // use for certain Replacements in Location
+    private static final int ROOT_NS_TAG_LEN=ROOT_NS_TAG.length();
     private static final String ROOT_NS_TAG_DOT = ROOT_NS_TAG +".";
 
     public static String ROOT_NS() {
@@ -74,10 +75,15 @@
     }
 
     public static String varReplace(final String potential) {
-        if (potential.startsWith(ROOT_NS_TAG_DOT)) {
-            return ROOT_NS + potential.substring(6);
+    	int idx = potential.indexOf(ROOT_NS_TAG_DOT);
+    	if(idx<0) {
+    		return potential;
+    	} else if(idx==0) {
+    		return ROOT_NS + potential.substring(ROOT_NS_TAG_LEN);
+        } else if('.'==potential.charAt(idx)) {
+            return potential.replace(ROOT_NS_TAG, ROOT_NS);
         } else {
-            return potential;
+    		return potential;
         }
     }
 
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
index 4f3884d..747211e 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
@@ -47,7 +47,7 @@
             if (e.getName()!=null) {
                 int idx = e.getName().indexOf('.');
                 if (idx<=0) {
-                    msg("Endpoint Name must prefixed by Namespace");
+                    msg("Endpoint Name (" + e.getName() + ") must prefixed by Namespace");
                 }
             }
             nullOrBlank("Endpoint Hostname", e.getHostname());
diff --git a/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/validation/JU_LocateValidatorTest.java b/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/validation/JU_LocateValidatorTest.java
index 0339f31..44ed340 100644
--- a/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/validation/JU_LocateValidatorTest.java
+++ b/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/validation/JU_LocateValidatorTest.java
@@ -76,7 +76,7 @@
 

         validator.endpoint(endpoint);

 

-        assertEquals("Endpoint Name must prefixed by Namespace\n", validator.errs());

+        assertEquals("Endpoint Name (Endpoint1) must prefixed by Namespace\n", validator.errs());

     }

 

     @Test

diff --git a/auth/docker/aaf.sh b/auth/docker/aaf.sh
index 02d258f..656ce56 100644
--- a/auth/docker/aaf.sh
+++ b/auth/docker/aaf.sh
@@ -38,7 +38,7 @@
     --env aaf_locator_container_ns=${NAMESPACE} \
     --env aaf_locator_fqdn=${HOSTNAME} \
     --env aaf_locate_url=https://aaf-locate:8095 \
-    --env aaf_locator_public_hostname=${HOSTNAME} \
+    --env aaf_locator_public_fqdn=${HOSTNAME} \
     --env AAF_ENV=${AAF_ENV} \
     --env LATITUDE=${LATITUDE} \
     --env LONGITUDE=${LONGITUDE} \
diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh
index 931249b..eb1888c 100644
--- a/auth/docker/agent.sh
+++ b/auth/docker/agent.sh
@@ -120,6 +120,7 @@
     --env LATITUDE=${LATITUDE} \
     --env LONGITUDE=${LONGITUDE} \
     --env aaf_locator_container_ns=${CONTAINER_NS} \
+    --env aaf_locator_container=docker \
     --name aaf-agent-$USER \
     "$PREFIX"onap/aaf/aaf_agent:$VERSION \
     bash -c "bash /opt/app/aaf_config/bin/agent.sh $PARAMS"
diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh
index 1b4e5ee..fab4b15 100755
--- a/auth/docker/dbuild.sh
+++ b/auth/docker/dbuild.sh
@@ -28,8 +28,6 @@
 
 . ./d.props
 
-AAF_COMPONENTS=ALL
-
 # process input. originally, an optional positional parameter is used to designate a component.
 # A flagged parameter has been added to optionally indicate docker pull registry. Ideally, options
 # would be flagged but we're avoiding ripple effect of changing original usage
@@ -124,9 +122,7 @@
 #######
 # Do all the Containers related to AAF Services
 #######
-if [ $AAF_COMPONENTS == "ALL" ]; then
-    AAF_COMPONENTS=$(cat components)
-fi
+AAF_COMPONENTS=$(cat components)
 
 cp ../sample/bin/pod_wait.sh  ../aaf_${VERSION}/bin
 for AAF_COMPONENT in ${AAF_COMPONENTS}; do
diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh
index 994bb55..648c497 100644
--- a/auth/docker/drun.sh
+++ b/auth/docker/drun.sh
@@ -105,7 +105,7 @@
         --env aaf_locator_container=docker \
         --env aaf_locator_container_ns=${NAMESPACE} \
         --env aaf_locator_fqdn=${HOSTNAME} \
-        --env aaf_locator_public_hostname=${HOSTNAME} \
+        --env aaf_locator_public_fqdn=${HOSTNAME} \
         --env LATITUDE=${LATITUDE} \
         --env LONGITUDE=${LONGITUDE} \
         --env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \
diff --git a/auth/helm/aaf-hello/templates/aaf-hello.yaml b/auth/helm/aaf-hello/templates/aaf-hello.yaml
index c114e5e..787f32d 100644
--- a/auth/helm/aaf-hello/templates/aaf-hello.yaml
+++ b/auth/helm/aaf-hello/templates/aaf-hello.yaml
@@ -31,8 +31,8 @@
   ports:
     - name: aaf-hello
       protocol: TCP
-      port: 8130
-      nodePort: 30086
+      port: {{.Values.cadi.port}}
+      nodePort: {{ .Values.cadi.public_port}}
 ---
 apiVersion: apps/v1
 kind: Deployment
@@ -52,37 +52,49 @@
     spec:
       volumes:
         # Use this Pod Sharing dir to declare various States of starting
-      - name: hello-config-vol
+      - name: aaf-hello-vol
         emptyDir: {}
       initContainers:
-        - name: hello-config-container
+        - name: aaf-hello-config
           image: {{ .Values.image.repository }}onap/aaf/aaf_agent:{{ .Values.image.version }}
           imagePullPolicy: IfNotPresent
           volumeMounts:
             - mountPath: "/opt/app/osaaf/local"
-              name: hello-config-vol
-          command: ["bash","-c","cd /opt/app/osaaf/local && /opt/app/aaf_config/bin/agent.sh place aaf@aaf.osaaf.org aaf"]
+              name: aaf-hello-vol
+          command: ["bash","-c","cd /opt/app/osaaf/local && /opt/app/aaf_config/bin/agent.sh place aaf@aaf.osaaf.org aaf-hello "]
           env:
             - name: "AAF_ENV"
-              value: "DEV"
+              value: "{{ .Values.cadi.aaf_env }}"
             - name: "AAF_FQDN"
-              value: "aaf-locate.onap"
+              value: "aaf-locate.{{ .Release.Namespace }}"
             - name: "APP_FQDN"
-              value: "aaf"
+              value: "{{ .Values.cadi.fqdn }}"
             - name: "APP_FQI"
-              value: "aaf@aaf.osaaf.org"
-            - name: LATITUDE
+              value: "{{ .Values.cadi.fqi }}"
+            - name: "LATITUDE"
               value: "{{ .Values.cadi.cadi_latitude }}"
-            - name: LONGITUDE
+            - name: "LONGITUDE"
               value: "{{ .Values.cadi.cadi_longitude }}"
-            - name: "CONTAINER_NS"
-              valueFrom:
-                fieldRef:
-                  fieldPath: metadata.namespace
             - name: "DEPLOY_FQI"
               value: "deployer@people.osaaf.org"
             - name: "DEPLOY_PASSWORD"
               value: "demo123456!"
+            - name: "aaf_locator_container"
+              value: "helm"
+            - name: "aaf_locator_port"
+              value: "{{ .Values.cadi.port }}"
+            - name: "aaf_locator_fqdn.helm"
+              value: "{{ .Values.cadi.fqdn }}.{{.Release.Namespace}}"
+            - name: "aaf_locator_public_hostname"
+              value: "{{ .Values.cadi.public_fqdn }}"
+            - name: "aaf_locator_public_port"
+              value: "{{ .Values.cadi.public_port }}"
+            - name: "aaf_locator_container_ns"
+              value: "{{ .Release.Namespace }}"
+            - name: "aaf_locator_name"
+              value: "{{.Values.cadi.app_ns}}.hello"
+            - name: "aaf_locator_name.helm"
+              value: "{{ .Release.Namespace}}.{{.Values.cadi.app_ns}}.hello"
 
 ###
 ### AAF-HELLO
@@ -94,9 +106,8 @@
         command: ["/bin/bash","-c","cd /opt/app/aaf && exec bin/hello"]
         volumeMounts:
         -  mountPath: "/opt/app/osaaf/local"
-           name: hello-config-vol
+           name: aaf-hello-vol
         ports:
         - name: aaf-hello
           protocol: TCP
           containerPort: 8130
-
diff --git a/auth/helm/aaf-hello/values.yaml b/auth/helm/aaf-hello/values.yaml
index d5fa747..a4fd23c 100644
--- a/auth/helm/aaf-hello/values.yaml
+++ b/auth/helm/aaf-hello/values.yaml
@@ -23,32 +23,24 @@
 # Declare variables to be passed into your templates.
 
 global:
-  persistence:
-    enabled: true
   common:
     namespace: "onap"
 
 replicas:
   hello: 1
 
-ingress:
-  enabled: false
-
 cadi:
-  hostname: "aaf.onap"
+  fqdn: "aaf-hello"
+  port: 8130
+  public_fqdn: "aaf.osaaf.org"
+  public_port: 30086
+  fqi: "aaf@aaf.osaaf.org"
+  app_ns: "org.osaaf.aaf"
   cadi_latitude: "38.0"  
   cadi_longitude: "-72.0"  
   aaf_env: "DEV"
 
-persistence:
-  # Note: Minikube will persist to /data on your host machine
-  mountPath: "/data/aaf"
-  hello:
-    volumeReclaimPolicy: Retain
-    accessMode: ReadWriteOnce
-    size: 1Gi
-    mountSubPath: "config"
-    storageClass: "manual"
+persistence: {}
 
 image:
   # When using locally built Docker Container, set Repository to ""
diff --git a/auth/helm/aaf/templates/aaf-cm.yaml b/auth/helm/aaf/templates/aaf-cm.yaml
index f8bca52..cd43f7a 100644
--- a/auth/helm/aaf/templates/aaf-cm.yaml
+++ b/auth/helm/aaf/templates/aaf-cm.yaml
@@ -81,7 +81,7 @@
                   fieldPath: metadata.namespace
             - name: aaf_locate_url
               value: "https://aaf-locate.onap:8095"
-            - name: aaf_locator_public_hostname
+            - name: aaf_locator_public_fqdn
               value: "aaf.osaaf.org"
             - name: CASSANDRA_CLUSTER
               value: "aaf-cass"
diff --git a/auth/helm/aaf/templates/aaf-fs.yaml b/auth/helm/aaf/templates/aaf-fs.yaml
index d53e920..5d75bb9 100644
--- a/auth/helm/aaf/templates/aaf-fs.yaml
+++ b/auth/helm/aaf/templates/aaf-fs.yaml
@@ -115,6 +115,6 @@
                   fieldPath: metadata.namespace
             - name: aaf_locate_url
               value: "https://aaf-locate.onap:8095"
-            - name: aaf_locator_public_hostname
+            - name: aaf_locator_public_fqdn
               value: "aaf.osaaf.org"
 
diff --git a/auth/helm/aaf/templates/aaf-gui.yaml b/auth/helm/aaf/templates/aaf-gui.yaml
index dcff5e7..dcc1f7f 100644
--- a/auth/helm/aaf/templates/aaf-gui.yaml
+++ b/auth/helm/aaf/templates/aaf-gui.yaml
@@ -82,7 +82,7 @@
                   fieldPath: metadata.namespace
             - name: aaf_locate_url
               value: "https://aaf-locate.onap:8095"
-            - name: aaf_locator_public_hostname
+            - name: aaf_locator_public_fqdn
               value: "aaf.osaaf.org"
             - name: CASSANDRA_CLUSTER
               value: "aaf-cass"
diff --git a/auth/helm/aaf/templates/aaf-locate.yaml b/auth/helm/aaf/templates/aaf-locate.yaml
index b09c80b..8506d32 100644
--- a/auth/helm/aaf/templates/aaf-locate.yaml
+++ b/auth/helm/aaf/templates/aaf-locate.yaml
@@ -81,7 +81,7 @@
                   fieldPath: metadata.namespace
             - name: aaf_locate_url
               value: "https://aaf-locate.onap:8095"
-            - name: aaf_locator_public_hostname
+            - name: aaf_locator_public_fqdn
               value: "aaf.osaaf.org"
             - name: CASSANDRA_CLUSTER
               value: "aaf-cass"
diff --git a/auth/helm/aaf/templates/aaf-oauth.yaml b/auth/helm/aaf/templates/aaf-oauth.yaml
index 1a382c0..722cc63 100644
--- a/auth/helm/aaf/templates/aaf-oauth.yaml
+++ b/auth/helm/aaf/templates/aaf-oauth.yaml
@@ -81,7 +81,7 @@
                   fieldPath: metadata.namespace
             - name: aaf_locate_url
               value: "https://aaf-locate.onap:8095"
-            - name: aaf_locator_public_hostname
+            - name: aaf_locator_public_fqdn
               value: "aaf.osaaf.org"
             - name: CASSANDRA_CLUSTER
               value: "aaf-cass"
diff --git a/auth/helm/aaf/templates/aaf-service.yaml b/auth/helm/aaf/templates/aaf-service.yaml
index e6d6d09..4a8f0b3 100644
--- a/auth/helm/aaf/templates/aaf-service.yaml
+++ b/auth/helm/aaf/templates/aaf-service.yaml
@@ -81,7 +81,7 @@
                   fieldPath: metadata.namespace
             - name: aaf_locate_url
               value: "https://aaf-locate.onap:8095"
-            - name: aaf_locator_public_hostname
+            - name: aaf_locator_public_fqdn
               value: "aaf.osaaf.org"
             - name: CASSANDRA_CLUSTER
               value: "aaf-cass"
diff --git a/auth/helm/aaf/values.yaml b/auth/helm/aaf/values.yaml
index abea890..e1fce7f 100644
--- a/auth/helm/aaf/values.yaml
+++ b/auth/helm/aaf/values.yaml
@@ -40,7 +40,7 @@
   enabled: false
 
 cadi:
-  hostname: "aaf.onap"
+  public_fqdn: "aaf.osaaf.org"
   cadi_latitude: "38.0"  
   cadi_longitude: "-72.0"  
   aaf_env: "DEV"
diff --git a/auth/sample/bin/client.sh b/auth/sample/bin/client.sh
index 42fe4d9..dde1072 100755
--- a/auth/sample/bin/client.sh
+++ b/auth/sample/bin/client.sh
@@ -39,11 +39,19 @@
 LOCAL="$OSAAF/local"
 DOT_AAF="$HOME/.aaf"
 SSO="$DOT_AAF/sso.props"
- 
-JAVA_CADI="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar org.onap.aaf.cadi.CmdLine"
-JAVA_AGENT="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$SSO org.onap.aaf.cadi.configure.Agent"
-JAVA_AGENT_SELF="$JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar -Dcadi_prop_files=$LOCAL/${NS}.props org.onap.aaf.cadi.configure.Agent"
-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 [ -e "$CONFIG" ]; then
+  CONFIG_BIN="$CONFIG/bin" 
+else 
+  CONFIG_BIN="."
+fi
+
+CLPATH="$CONFIG_BIN/aaf-auth-cmd-*-full.jar"
+
+JAVA_CADI="$JAVA -cp $CLPATH org.onap.aaf.cadi.CmdLine"
+JAVA_AGENT="$JAVA -cp $CLPATH -Dcadi_prop_files=$SSO org.onap.aaf.cadi.configure.Agent"
+JAVA_AGENT_SELF="$JAVA -cp $CLPATH -Dcadi_prop_files=$LOCAL/${NS}.props org.onap.aaf.cadi.configure.Agent"
+JAVA_AAFCLI="$JAVA -cp $CLPATH -Dcadi_prop_files=$LOCAL/org.osaaf.aaf.props org.onap.aaf.auth.cmd.AAFcli"
 
 # Check for local dir
 if [ ! -d $LOCAL ]; then
@@ -57,9 +65,9 @@
 # Setup Bash, first time only
 if [ ! -e "$HOME/.bashrc" ] || [ -z "$(grep cadi $HOME/.bashrc)" ]; then
   echo "alias cadi='$JAVA_CADI \$*'" >>$HOME/.bashrc
-  echo "alias agent='$CONFIG/bin/agent.sh agent \$*'" >>$HOME/.bashrc
+  echo "alias agent='$CONFIG_BIN/agent.sh agent \$*'" >>$HOME/.bashrc
   echo "alias aafcli='$JAVA_AAFCLI \$*'" >>$HOME/.bashrc
-  chmod a+x $CONFIG/bin/agent.sh
+  chmod a+x $CONFIG_BIN/agent.sh
   . $HOME/.bashrc
 fi
 
@@ -80,14 +88,22 @@
     if [ ! "${DEPLOY_PASSWORD}" = "" ]; then
        echo aaf_password=enc:$(sso_encrypt ${DEPLOY_PASSWORD}) >> ${SSO}
     fi
-    if [ ! -z "${CONTAINER_NS}" ]; then
-       echo "aaf_locator_container_ns=${CONTAINER_NS}" >> ${SSO}
+    
+    if [ ! -z "${aaf_locator_container}" ]; then
+         echo "aaf_locator_container=${aaf_locator_container}" >> ${SSO}
+    fi
+    if [ -z "${aaf_locator_container_ns}" ]; then
+      if [ !-z "${CONTAINER_NS}" ]; then
+         echo "aaf_locator_container_ns=${CONTAINER_NS}" >> ${SSO}
+      fi
+    else 
+         echo "aaf_locator_container_ns=${aaf_locator_container_ns}" >> ${SSO}
     fi
     if [ ! -z "${AAF_ENV}" ]; then
        echo "aaf_env=${AAF_ENV}" >> ${SSO}
     fi
     echo aaf_locate_url=https://${AAF_FQDN}:8095 >> ${SSO}
-    echo aaf_url=https://AAF_LOCATE_URL/AAF_NS.service:${AAF_INTERFACE_VERSION} >> ${SSO}
+    echo aaf_url=https://AAF_LOCATE_URL/%CNS.%AAF_NS.service:${AAF_INTERFACE_VERSION} >> ${SSO}
 
     base64 -d $CONFIG/cert/truststoreONAPall.jks.b64 > $DOT_AAF/truststoreONAPall.jks
     echo "cadi_truststore=$DOT_AAF/truststoreONAPall.jks" >> ${SSO}
@@ -98,10 +114,37 @@
 
 # Only initialize once, automatically...
 if [ ! -e $LOCAL/${NS}.props ]; then
+    if [ -e '/opt/app/aaf_config/bin' ]; then
+      cp /opt/app/aaf_config/bin/*.jar $LOCAL
+      echo "#!/bin/bash" > agent
+      echo 'case "$1" in' >> agent
+      echo '  ""|-?|--help)CMD="";FQI="";FQDN="";;' >> agent
+      echo '  validate)CMD="$1";FQI="";FQDN="${2:-'"$NS.props"'}";;' >> agent
+      echo '    *)CMD="$1";FQI="${2:-'"$APP_FQI"'}";FQDN="${3:-'"$APP_FQDN"'}";;' >> agent
+      echo 'esac' >> agent
+      echo 'java -cp '$(ls aaf-auth-cmd-*-full.jar)' -Dcadi_prop_files='"$NS"'.props org.onap.aaf.cadi.configure.Agent $CMD $FQI $FQDN' >> agent
+
+      echo "#!/bin/bash" > cadi
+      echo "java -cp $(ls aaf-auth-cmd-*-full.jar) -Dcadi_prop_files=$NS.props org.onap.aaf.cadi.CmdLine " '$*' >> cadi
+      # echo "#!/bin/bash" > aafcli
+      # echo "java -cp $(ls aaf-auth-cmd-*-full.jar) -Dcadi_prop_files=$NS.props org.onap.aaf.auth.cmd.AAFcli " '$*' >> aafcli
+
+      echo "#!/bin/bash" > testConnectivity
+      echo "java -cp $(ls aaf-auth-cmd-*-full.jar) org.onap.aaf.cadi.aaf.TestConnectivity $NS.props" >> testConnectivity
+      chmod ug+x agent cadi testConnectivity
+    fi
     echo "#### Create Configuration files "
     $JAVA_AGENT config $APP_FQI \
 	aaf_url=https://AAF_LOCATE_URL/AAF_NS.locate:${AAF_INTERFACE_VERSION} \
         cadi_etc_dir=$LOCAL
+# Grab all properties passed in that start with "aaf_" or "cadi_"
+    for E in $(env); do 
+       if [[ $E == aaf_* ]] || [[ $E == cadi_* ]]; then
+         if [ -z "$(grep $E $LOCAL/$NS.props)" ]; then
+           echo "${E}" >> $LOCAL/$NS.props
+         fi
+       fi
+    done
     cat $LOCAL/$NS.props
 
     echo
@@ -119,7 +162,6 @@
             cadi_etc_dir=$LOCAL
     
         echo "#### Validate Configuration and Certificate with live call"
-        $JAVA_AGENT_SELF validate 
         echo "Obtained Certificates"
         INITIALIZED="true"
     else
@@ -236,7 +278,7 @@
 	;;
     testConnectivity|testconnectivity)
         echo "--- Test Connectivity ---"
-        $JAVA -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar org.onap.aaf.cadi.aaf.TestConnectivity $LOCAL/org.osaaf.aaf.props 
+        $JAVA -cp $CONFIG_BIN/aaf-auth-cmd-*-full.jar org.onap.aaf.cadi.aaf.TestConnectivity $LOCAL/org.osaaf.aaf.props 
 	;;
     --help | -?)
         case "$1" in
@@ -272,7 +314,7 @@
     ### Possible Dublin
     # sample)
     #    echo "--- run Sample Servlet App ---"
-    #    $JAVA -Dcadi_prop_files=$LOCAL/${NS}.props -cp $CONFIG/bin/aaf-auth-cmd-*-full.jar:$CONFIG/bin/aaf-cadi-servlet-sample-*-sample.jar org.onap.aaf.sample.cadi.jetty.JettyStandalone ${NS}.props
+    #    $JAVA -Dcadi_prop_files=$LOCAL/${NS}.props -cp $CONFIG_BIN/aaf-auth-cmd-*-full.jar:$CONFIG_BIN/aaf-cadi-servlet-sample-*-sample.jar org.onap.aaf.sample.cadi.jetty.JettyStandalone ${NS}.props
     #    ;;
     *)
         $JAVA_AGENT "$CMD" "$@"
diff --git a/auth/sample/etc/org.osaaf.aaf.oauth.props b/auth/sample/etc/org.osaaf.aaf.oauth.props
index 8c81389..a2d5fc5 100644
--- a/auth/sample/etc/org.osaaf.aaf.oauth.props
+++ b/auth/sample/etc/org.osaaf.aaf.oauth.props
@@ -22,8 +22,8 @@
 ##
 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_locator_entries=oauth,token,introspect
-aaf_locator_fqdn.helm=%CNS.aaf-oauth
-aaf_locator_fqdn.oom=%CNS.aaf-oauth
+aaf_locator_fqdn.helm=aaf-oauth.%CNS
+aaf_locator_fqdn.oom=aaf-oauth.%CNS
 port=8140
 aaf_locator_public_port.helm=30082
 aaf_locator_public_port.oom=31112
diff --git a/auth/sample/local/initialConfig.props b/auth/sample/local/initialConfig.props
index 2bcaf7c..6ea1d53 100644
--- a/auth/sample/local/initialConfig.props
+++ b/auth/sample/local/initialConfig.props
@@ -32,7 +32,7 @@
 aaf_locator_name=%NS.%N

 aaf_locator_name.docker=%CNS.%NS.%N

 aaf_locator_name.helm=%CNS.%NS.%N

-aaf_locator_name.oom=%CNS.%NS.%N

+aaf_locator_name.oom=%CNS%.%NS.%N

 aaf_locator_fqdn.docker=aaf-%N

 aaf_locator_fqdn.helm=aaf-%N.%CNS

 aaf_locator_fqdn.oom=aaf-%N.%CNS