[CORD-1942] Define M-CORD Subscriber

Change-Id: Icc5288530c6e45ead09b99a211f53da566098050
diff --git a/roles/cord-profile/defaults/main.yml b/roles/cord-profile/defaults/main.yml
index 4a3af66..4fb3b8f 100644
--- a/roles/cord-profile/defaults/main.yml
+++ b/roles/cord-profile/defaults/main.yml
@@ -65,6 +65,8 @@
 
 xos_tosca_config_templates: []
 
+xos_new_tosca_config_templates: []
+
 xos_other_templates: []
 
 # XOS Config (xos_config.yaml)
diff --git a/roles/cord-profile/tasks/main.yml b/roles/cord-profile/tasks/main.yml
index a3c38ab..92bdbd2 100644
--- a/roles/cord-profile/tasks/main.yml
+++ b/roles/cord-profile/tasks/main.yml
@@ -120,6 +120,12 @@
     dest: "{{ config_cord_profile_dir }}/{{ item }}"
   with_items: "{{ xos_tosca_config_templates }}"
 
+- name: Create profile specific templated TOSCA config files (new Engine)
+  template:
+    src: "{{ item }}.j2"
+    dest: "{{ config_cord_profile_dir }}/{{ item }}"
+  with_items: "{{ xos_new_tosca_config_templates }}"
+
 - name: Create profile specific templated non-TOSCA files
   template:
     src: "{{ item }}.j2"
diff --git a/roles/cord-profile/templates/mcord-services.yaml.j2 b/roles/cord-profile/templates/mcord-services.yml.j2
similarity index 100%
rename from roles/cord-profile/templates/mcord-services.yaml.j2
rename to roles/cord-profile/templates/mcord-services.yml.j2
diff --git a/roles/cord-profile/templates/mcord-subscriber.yml.j2 b/roles/cord-profile/templates/mcord-subscriber.yml.j2
new file mode 100644
index 0000000..06dd8e1
--- /dev/null
+++ b/roles/cord-profile/templates/mcord-subscriber.yml.j2
@@ -0,0 +1,30 @@
+# 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: Persist M-CORD Subscriber
+
+imports:
+   - custom_types/mcordsubscriberservice.yaml
+
+topology_template:
+  node_templates:
+
+    # M-CORD Subscriber
+    mcord:
+      type: tosca.nodes.MCordSubscriberService
+      properties:
+        name: mcord
\ No newline at end of file
diff --git a/roles/xos-config-new-tosca/defaults/main.yml b/roles/xos-config-new-tosca/defaults/main.yml
new file mode 100644
index 0000000..5b6a39a
--- /dev/null
+++ b/roles/xos-config-new-tosca/defaults/main.yml
@@ -0,0 +1,29 @@
+---
+
+# 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.
+
+
+# xos-config/defaults/main.yml
+
+credentials_dir: "{{ playbook_dir }}/credentials"
+
+xos_admin_user: "xosadmin@opencord.org"
+xos_admin_pass: "{{ lookup('password', credentials_dir ~ '/xosadmin@opencord.org chars=ascii_letters,digits') }}"
+
+xos_tosca_config_templates: []
+
+xos_new_tosca_config_templates: []
+
+use_openstack: True
diff --git a/roles/xos-config-new-tosca/tasks/main.yml b/roles/xos-config-new-tosca/tasks/main.yml
new file mode 100644
index 0000000..b2534dc
--- /dev/null
+++ b/roles/xos-config-new-tosca/tasks/main.yml
@@ -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.
+
+
+---
+# xos-config-new-tosca/tasks/main.yml
+
+- name: Configure XOS with profile specific TOSCA (new Engine)
+  uri:
+    url: "http://{{headnode}}/xos-tosca/run"
+    method: POST
+    headers:
+      xos-username: "{{ xos_admin_user }}"
+      xos-password: "{{ xos_admin_pass }}"
+    body: "{{ lookup('file','/opt/cord_profile/' + item ) }}"
+    status_code: 200
+  with_items: "{{ xos_new_tosca_config_templates }}"
+  tags:
+    - skip_ansible_lint # TOSCA loading should be idempotent
+