move all 3.0 files to 4.1 as the first step

Change-Id: Iab7810a02bfdf25bffca4e144fcae994f72e0048
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
new file mode 100644
index 0000000..18e8c19
--- /dev/null
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -0,0 +1,53 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+
+# 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/manifest b/xos/synchronizer/manifest
deleted file mode 100644
index c6a7454..0000000
--- a/xos/synchronizer/manifest
+++ /dev/null
@@ -1,8 +0,0 @@
-manifest
-model-deps
-run.sh
-steps/sync_vmmetenant.py
-steps/vmmetenant_playbook.yaml
-stop.sh
-vmme-synchronizer.py
-vmmeservice_config
diff --git a/xos/synchronizer/run.sh b/xos/synchronizer/run-from-api.sh
old mode 100644
new mode 100755
similarity index 90%
rename from xos/synchronizer/run.sh
rename to xos/synchronizer/run-from-api.sh
index c532ac3..6196692
--- a/xos/synchronizer/run.sh
+++ b/xos/synchronizer/run-from-api.sh
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
-# Runs the XOS observer using vmmeservice_config
 export XOS_DIR=/opt/xos
-python vmme-synchronizer.py  -C $XOS_DIR/synchronizers/vmme/vmmeservice_config
+python vmme-synchronizer.py  -C $XOS_DIR/synchronizers/vmme/vmme_from_api_config
diff --git a/xos/synchronizer/steps/sync_vmmetenant.py b/xos/synchronizer/steps/sync_vmmetenant.py
index 91d4380..b8a704f 100644
--- a/xos/synchronizer/steps/sync_vmmetenant.py
+++ b/xos/synchronizer/steps/sync_vmmetenant.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,12 +12,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 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)
@@ -33,7 +32,7 @@
 
     template_name = "vmmetenant_playbook.yaml"
 
-    service_key_name = "/opt/xos/synchronizers/vmme/vmme_private_key"
+    service_key_name = "/opt/xos/configurations/mcord/mcord_private_key"
 
     def __init__(self, *args, **kwargs):
         super(SyncVMMETenant, self).__init__(*args, **kwargs)
@@ -49,22 +48,3 @@
 
         return objs
 
-    def get_vmmeservice(self, o):
-        if not o.provider_service:
-            return None
-
-        vmmeservice = VMMEService.get_service_objects().filter(id=o.provider_service.id)
-
-        if not vmmeservice:
-            return None
-
-        return vmmeservice[0]
-
-    # Gets the attributes that are used by the Ansible template but are not
-    # part of the set of default attributes.
-    def get_extra_attributes(self, o):
-        fields = {}
-        fields['tenant_message'] = o.tenant_message
-        fields['image_name'] = o.image_name
-        return fields
-
diff --git a/xos/synchronizer/steps/vmmetenant_playbook.yaml b/xos/synchronizer/steps/vmmetenant_playbook.yaml
index 6828701..05c13c1 100644
--- a/xos/synchronizer/steps/vmmetenant_playbook.yaml
+++ b/xos/synchronizer/steps/vmmetenant_playbook.yaml
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,14 +12,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
---- 
+---
 - hosts: {{ instance_name }} 
   gather_facts: False 
   connection: ssh 
   user: ubuntu 
   sudo: yes 
   tasks: 
+  vars:
  
- # - name: write message
- #   shell: echo "{{ tenant_message }}" > /var/tmp/index.html
diff --git a/xos/synchronizer/stop.sh b/xos/synchronizer/stop.sh
deleted file mode 100644
index a39ed46..0000000
--- a/xos/synchronizer/stop.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# 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.
-
-
-# Kill the observer
-pkill -9 -f vmme-synchronizer.py
diff --git a/xos/synchronizer/vmme-synchronizer.py b/xos/synchronizer/vmme-synchronizer.py
old mode 100644
new mode 100755
index 9c09a71..7f94bc7
--- a/xos/synchronizer/vmme-synchronizer.py
+++ b/xos/synchronizer/vmme-synchronizer.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,17 +12,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 #!/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