refactor the vMME service to CORD 3.0 only, not master

Change-Id: I80cd92d5a11388b41de8842fa81c08edb312255b
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
new file mode 100644
index 0000000..f3a2469
--- /dev/null
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -0,0 +1,39 @@
+# xosproject/vmme-synchronizer
+FROM xosproject/xos-synchronizer-base:candidate
+
+COPY . /opt/xos/synchronizers/vmme
+
+ENTRYPOINT []
+
+WORKDIR "/opt/xos/synchronizers/vmme"
+
+# Label image
+ARG org_label_schema_schema_version=1.0
+ARG org_label_schema_name=vmme-synchronizer
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_component_chameleon_version=unknown
+ARG org_opencord_component_chameleon_vcs_url=unknown
+ARG org_opencord_component_chameleon_vcs_ref=unknown
+ARG org_opencord_component_xos_version=unknown
+ARG org_opencord_component_xos_vcs_url=unknown
+ARG org_opencord_component_xos_vcs_ref=unknown
+
+LABEL org.label-schema.schema-version=$org_label_schema_schema_version \
+      org.label-schema.name=$org_label_schema_name \
+      org.label-schema.version=$org_label_schema_version \
+      org.label-schema.vcs-url=$org_label_schema_vcs_url \
+      org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
+      org.label-schema.build-date=$org_label_schema_build_date \
+      org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date \
+      org.opencord.component.chameleon.version=$org_opencord_component_chameleon_version \
+      org.opencord.component.chameleon.vcs-url=$org_opencord_component_chameleon_vcs_url \
+      org.opencord.component.chameleon.vcs-ref=$org_opencord_component_chameleon_vcs_ref \
+      org.opencord.component.xos.version=$org_opencord_component_xos_version \
+      org.opencord.component.xos.vcs-url=$org_opencord_component_xos_vcs_url \
+      org.opencord.component.xos.vcs-ref=$org_opencord_component_xos_vcs_ref
+
+CMD bash -c "cd /opt/xos/synchronizers/vmme; ./run-from-api.sh"
diff --git a/xos/synchronizer/run-from-api.sh b/xos/synchronizer/run-from-api.sh
new file mode 100755
index 0000000..3a69ef5
--- /dev/null
+++ b/xos/synchronizer/run-from-api.sh
@@ -0,0 +1,2 @@
+export XOS_DIR=/opt/xos
+python vmme-synchronizer.py  -C $XOS_DIR/synchronizers/vmme/vmme_from_api_config
diff --git a/xos/synchronizer/run.sh b/xos/synchronizer/run.sh
deleted file mode 100644
index 44696b4..0000000
--- a/xos/synchronizer/run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-# Runs the XOS observer using vmmeservice_config
-export XOS_DIR=/opt/xos
-python vmme-synchronizer.py  -C $XOS_DIR/synchronizers/vmme/vmmeservice_config
diff --git a/xos/synchronizer/steps/sync_vmmetenant.py b/xos/synchronizer/steps/sync_vmmetenant.py
index dac6d0d..7147e3f 100644
--- a/xos/synchronizer/steps/sync_vmmetenant.py
+++ b/xos/synchronizer/steps/sync_vmmetenant.py
@@ -1,8 +1,9 @@
 import os
 import sys
 from django.db.models import Q, F
-from services.vmme.models import VMMEService, VMMETenant
-from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+#from services.vmme.models import VMMEService, VMMETenant
+from synchronizers.new_base.modelaccessor import *
+from synchronizers.new_base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
 
 parentdir = os.path.join(os.path.dirname(__file__), "..")
 sys.path.insert(0, parentdir)
diff --git a/xos/synchronizer/vmme-synchronizer.py b/xos/synchronizer/vmme-synchronizer.py
index 95f4081..e91f27a 100644
--- a/xos/synchronizer/vmme-synchronizer.py
+++ b/xos/synchronizer/vmme-synchronizer.py
@@ -1,13 +1,13 @@
 #!/usr/bin/env python
 
-# This imports and runs ../../xos-observer.py
 # Runs the standard XOS observer
 
 import importlib
 import os
 import sys
+
 observer_path = os.path.join(os.path.dirname(
-    os.path.realpath(__file__)), "../../synchronizers/base")
+    os.path.realpath(__file__)), "../../synchronizers/new_base")
 sys.path.append(observer_path)
 mod = importlib.import_module("xos-synchronizer")
 mod.main()
diff --git a/xos/synchronizer/vmme_from_api_config b/xos/synchronizer/vmme_from_api_config
new file mode 100644
index 0000000..e53d5e3
--- /dev/null
+++ b/xos/synchronizer/vmme_from_api_config
@@ -0,0 +1,20 @@
+# Sets options for the synchronizer
+[observer]
+name=vmme
+dependency_graph=/opt/xos/synchronizers/vmme/model-deps
+steps_dir=/opt/xos/synchronizers/vmme/steps
+sys_dir=/opt/xos/synchronizers/vmme/sys
+#logfile=/var/log/xos_backend.log
+log_file=console
+log_level=debug
+pretend=False
+backoff_disabled=True
+save_ansible_output=True
+proxy_ssh=True
+proxy_ssh_key=/opt/cord_profile/node_key
+proxy_ssh_user=root
+accessor_kind=api
+accessor_password=@/opt/xos/services/vmme/credentials/xosadmin@opencord.org
+
+[networking]
+use_vtn=True
diff --git a/xos/synchronizer/vmmeservice_config b/xos/synchronizer/vmmeservice_config
deleted file mode 100644
index c1c6454..0000000
--- a/xos/synchronizer/vmmeservice_config
+++ /dev/null
@@ -1,28 +0,0 @@
-# Required by XOS
-[db]
-name=xos
-user=postgres
-password=password
-host=xos_db
-port=5432
-
-# Required by XOS
-[api]
-nova_enabled=True
-
-
-# Sets options for the synchronizer
-[observer]
-name=vmmeservice
-dependency_graph=/opt/xos/synchronizers/vmme/model-deps
-steps_dir=/opt/xos/synchronizers/vmme/steps
-sys_dir=/opt/xos/synchronizers/vmme/sys
-logfile=/var/log/xos_backend.log
-pretend=False
-backoff_disabled=True
-save_ansible_output=True
-proxy_ssh=True
-proxy_ssh_key=/root/setup/id_rsa
-proxy_ssh_user=root
-[networking]
-use_vtn=True
diff --git a/xos/vmme-onboard.yaml b/xos/vmme-onboard.yaml
index d2e8fd7..214d576 100644
--- a/xos/vmme-onboard.yaml
+++ b/xos/vmme-onboard.yaml
@@ -10,7 +10,7 @@
     servicecontroller#vmme:
       type: tosca.nodes.ServiceController
       properties:
-          base_url: file:///opt/xos_services/vMME/xos/
+          base_url: file:///opt/xos_services/vmme/xos/
           # The following will concatenate with base_url automatically, if
           # base_url is non-null.
           models: models.py
@@ -19,5 +19,5 @@
           synchronizer: synchronizer/manifest  
           synchronizer_run: vmme-synchronizer.py
           tosca_resource: tosca/resources/vmmetenant.py, tosca/resources/vmmeservice.py 
-          private_key: file:///opt/xos/key_import/vMME_rsa
-          public_key: file:///opt/xos/key_import/vMME_rsa.pub
+          private_key: file:///opt/xos/key_import/mcord_rsa
+          public_key: file:///opt/xos/key_import/mcord_rsa.pub
diff --git a/xos/vmme.xproto b/xos/vmme.xproto
new file mode 100644
index 0000000..6fa136a
--- /dev/null
+++ b/xos/vmme.xproto
@@ -0,0 +1,15 @@
+option name = "vmme";
+option app_label = "vmme";
+option verbose_name = "vMME Service";
+option kind = "vEPC";
+
+message VmmeService (Service){
+    required string service_message = 1 [help_text = "Service Message to Display", max_length = 254, null = False, db_index = False, blank = False];
+}
+
+
+message VmmeTenant (TenantWithContainer){
+     option name = "vmmetenant";
+     option verbose_name = "vMME Tenant";
+     required string tenant_message = 1 [help_text = "Tenant Message to Display", max_length = 254, null = False, db_index = False, blank = False];
+}
\ No newline at end of file