CORD-2509 migrate mcord profile from static to dynamic load

Change-Id: I69a56875db0ec13ad61d9fbc3261da0735adcb9b
diff --git a/mcord-cavium.yml b/mcord-cavium.yml
index fd577f3..6b3d43c 100644
--- a/mcord-cavium.yml
+++ b/mcord-cavium.yml
@@ -48,6 +48,8 @@
 
 # paths defined in manifest/default.xml
 xos_services:
+  - name: mcord
+    path: orchestration/profiles/mcord
   - name: vtn
     path: orchestration/xos_services/vtn-service
     keypair: vsg_rsa
@@ -134,8 +136,6 @@
     template: private_template
     owner: vhss
 
-profile_library: "mcord"
-
 # Juju config
 charm_versions:
   ceilometer: "cs:trusty/ceilometer-17"
diff --git a/mcord-ng40.yml b/mcord-ng40.yml
index 3168dd1..4805155 100644
--- a/mcord-ng40.yml
+++ b/mcord-ng40.yml
@@ -48,6 +48,8 @@
 
 # paths defined in manifest/default.xml
 xos_services:
+  - name: mcord
+    path: orchestration/profiles/mcord
   - name: vtn
     path: orchestration/xos_services/vtn-service
     keypair: vsg_rsa
@@ -99,8 +101,6 @@
     template: private_template
     owner: vspgwu
 
-profile_library: "mcord"
-
 # Juju config
 charm_versions:
   ceilometer: "cs:trusty/ceilometer-17"
diff --git a/xos/mcord-onboard.yaml b/xos/mcord-onboard.yaml
deleted file mode 100644
index ef6985d..0000000
--- a/xos/mcord-onboard.yaml
+++ /dev/null
@@ -1,32 +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.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Onboard rcord models
-
-imports:
-   - custom_types/xos.yaml
-
-topology_template:
-  node_templates:
-    library#mcord:
-      type: tosca.nodes.ServiceController
-      properties:
-          base_url: file:///opt/cord/orchestration/profiles/mcord/xos/
-          # The following will concatenate with base_url automatically, if
-          # base_url is non-null.
-          xproto: models/
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
new file mode 100644
index 0000000..c407a81
--- /dev/null
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -0,0 +1,55 @@
+
+# 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/mcord-synchronizer
+FROM xosproject/xos-synchronizer-base:candidate
+
+COPY . /opt/xos/synchronizers/mcord
+
+ENTRYPOINT []
+
+WORKDIR "/opt/xos/synchronizers/mcord"
+
+# Label image
+ARG org_label_schema_schema_version=1.0
+ARG org_label_schema_name=mcord-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/mcord; ./run-from-api.sh"
diff --git a/xos/synchronizer/mcord-synchronizer.py b/xos/synchronizer/mcord-synchronizer.py
new file mode 100644
index 0000000..57dc508
--- /dev/null
+++ b/xos/synchronizer/mcord-synchronizer.py
@@ -0,0 +1,32 @@
+
+# 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.
+
+
+#!/usr/bin/env python
+
+# This imports and runs ../../xos-observer.py
+
+import importlib
+import os
+import sys
+from xosconfig import Config
+
+config_file = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/mcord_config.yaml')
+Config.init(config_file, 'synchronizer-config-schema.yaml')
+
+observer_path = os.path.join(os.path.dirname(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/mcord_config.yaml b/xos/synchronizer/mcord_config.yaml
new file mode 100644
index 0000000..373ef97
--- /dev/null
+++ b/xos/synchronizer/mcord_config.yaml
@@ -0,0 +1,24 @@
+
+# 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.
+
+
+name: mcord
+accessor:
+  username: xosadmin@opencord.org
+  password: "@/opt/xos/services/mcord/credentials/xosadmin@opencord.org"
+dependency_graph: "/opt/xos/synchronizers/mcord/model-deps"
+sys_dir: "/opt/xos/synchronizers/mcord/sys"
+models_dir: "/opt/xos/synchronizers/mcord/models"
+
diff --git a/xos/synchronizer/model-deps b/xos/synchronizer/model-deps
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/xos/synchronizer/model-deps
@@ -0,0 +1 @@
+{}
diff --git a/xos/models/mcord.xproto b/xos/synchronizer/models/mcord.xproto
similarity index 100%
rename from xos/models/mcord.xproto
rename to xos/synchronizer/models/mcord.xproto
diff --git a/xos/models/models.py b/xos/synchronizer/models/models.py
similarity index 100%
rename from xos/models/models.py
rename to xos/synchronizer/models/models.py
diff --git a/xos/synchronizer/run-from-api.sh b/xos/synchronizer/run-from-api.sh
new file mode 100755
index 0000000..8623ab3
--- /dev/null
+++ b/xos/synchronizer/run-from-api.sh
@@ -0,0 +1,17 @@
+
+# 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.
+
+
+python mcord-synchronizer.py