diff --git a/auth/auth-cass/cass_init/cmd.sh b/auth/auth-cass/cass_init/cmd.sh
index 98194e0..ffaf182 100644
--- a/auth/auth-cass/cass_init/cmd.sh
+++ b/auth/auth-cass/cass_init/cmd.sh
@@ -37,7 +37,7 @@
 
 function status {
      echo "$@"
-     echo "$@" > $DIR/aaf_cass
+     echo "$@" > $DIR/aaf-cass
 }
 
 function wait_start {
@@ -69,7 +69,7 @@
 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 @@
     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 83fb060..e6da5e4 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 a412296..778947e 100644
--- a/auth/auth-cass/docker/drun.sh
+++ b/auth/auth-cass/docker/drun.sh
@@ -35,11 +35,11 @@
 
 # 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 @@
     $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 cfff8f7..c43a696 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 4813186..6fe9bde 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 @@
             }
     
             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 757efa5..085f419 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 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 9eea77e..ec5449d 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 @@
      */
     @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());
+    	}
     }
 
 }
