[CORD-2460]
Update and fix build documentation, fix variables with new TOSCA engine

Change-Id: I21b5e3aa2abda0111a72d1a994140ab2894296ce
diff --git a/cord-compute-maas-playbook.yml b/compute-node-enable-playbook.yml
similarity index 81%
rename from cord-compute-maas-playbook.yml
rename to compute-node-enable-playbook.yml
index 468fe07..27c00f7 100644
--- a/cord-compute-maas-playbook.yml
+++ b/compute-node-enable-playbook.yml
@@ -1,4 +1,4 @@
-
+---
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,16 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
----
-# cord-compute-maas-playbook.yml
-# Installs and configures compute nodes when using MaaS
+# compute-node-enable-playbook.yml
+# Installs and configures compute nodes
 
 - include: prep-computenode-playbook.yml
 - include: deploy-computenode-playbook.yml
 
-- name:  Enable Compute Node (MaaS)
+- name:  Enable Compute Node
   hosts: head
   roles:
-    - compute-node-enable-maas
+    - compute-node-enable
 
diff --git a/onboard-profile-playbook.yml b/onboard-profile-playbook.yml
index 4c527a6..e8387c8 100644
--- a/onboard-profile-playbook.yml
+++ b/onboard-profile-playbook.yml
@@ -1,4 +1,4 @@
-
+---
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,16 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
----
 # onboard-profile-playbook.yml
 # Configure XOS with profile-specific config
 
-- include: add-onboard-containers-playbook.yml
-
 - name: Check XOS Ready
   hosts: head
-  connection: docker
   roles:
     - xos-ready
 
@@ -31,8 +26,3 @@
   roles:
     - xos-config-new-tosca
 
-- name: Apply profile config
-  hosts: xos_ui
-  connection: docker
-  roles:
-    - xos-config
diff --git a/roles/automation-integration/templates/do-enlist-compute-node.j2 b/roles/automation-integration/templates/do-enlist-compute-node.j2
index bdd9ee5..9994064 100644
--- a/roles/automation-integration/templates/do-enlist-compute-node.j2
+++ b/roles/automation-integration/templates/do-enlist-compute-node.j2
@@ -1,3 +1,4 @@
+#!/bin/ash
 
 {#
 Copyright 2017-present Open Networking Foundation
@@ -15,9 +16,6 @@
 limitations under the License.
 #}
 
-
-#!/bin/ash
-
 ID=$1
 HOSTNAME=$2
 LOG=/etc/maas/ansible/logs/$ID.log
@@ -36,10 +34,10 @@
 cat $INV >> $LOG
 echo "END INVENTORY_FILE" >> $LOG
 
-echo "cd /opt/cord/build/platform-install; ansible-playbook --private-key=/etc/maas/ansible/id_rsa -u $COMPUTE_USER --extra-vars '@{{ head_cord_dir }}/build/genconfig/config.yml' -i $INV cord-compute-maas-playbook.yml" >> $LOG
+echo "cd /opt/cord/build/platform-install; ansible-playbook --private-key=/etc/maas/ansible/id_rsa -u $COMPUTE_USER --extra-vars '@{{ head_cord_dir }}/build/genconfig/config.yml' -i $INV compute-node-enable-playbook.yml" >> $LOG
 
 cd /opt/cord/build/platform-install
-ansible-playbook --private-key=/etc/maas/ansible/id_rsa -u $COMPUTE_USER --extra-vars '@{{ head_cord_dir }}/build/genconfig/config.yml' -i $INV cord-compute-maas-playbook.yml >> $LOG
+ansible-playbook --private-key=/etc/maas/ansible/id_rsa -u $COMPUTE_USER --extra-vars '@{{ head_cord_dir }}/build/genconfig/config.yml' -i $INV compute-node-enable-playbook.yml >> $LOG
 
 RESULT=$?
 rm $INV
diff --git a/roles/compute-node-enable-maas/defaults/main.yml b/roles/compute-node-enable-maas/defaults/main.yml
deleted file mode 100644
index fd776c2..0000000
--- a/roles/compute-node-enable-maas/defaults/main.yml
+++ /dev/null
@@ -1,23 +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.
-
-# compute-node-enable-maas/defaults/main.yml
-
-head_cord_profile_dir: "/opt/cord_profile"
-
-xos_admin_user: "xosadmin@opencord.org"
-maas_xos_admin_pass: "{{ lookup('file', '/opt/credentials/xosadmin@opencord.org') }}"
-
-xos_tosca_url: "http://xos-tosca/xos-tosca"
diff --git a/roles/compute-node-enable-maas/tasks/main.yml b/roles/compute-node-enable-maas/tasks/main.yml
deleted file mode 100644
index 8e14090..0000000
--- a/roles/compute-node-enable-maas/tasks/main.yml
+++ /dev/null
@@ -1,60 +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.
-
-
----
-# compute-node-enable-maas/tasks/main.yml
-
-- name: Fetch generated compute node onboarding TOSCA files
-  fetch:
-    src: "{{ head_cord_profile_dir + '/' + item }}"
-    dest: "/tmp/{{ item }}"
-    flat: yes
-    fail_on_missing: yes
-  with_items:
-    - openstack.yaml
-    - vtn-service.yaml
-    - openstack-compute.yaml
-    - openstack-compute-vtn.yaml
-
-- name: Load TOSCA to add OpenStack compute nodes, over REST
-  uri:
-    url: "{{ xos_tosca_url }}/run"
-    method: POST
-    headers:
-      xos-username: "{{ xos_admin_user }}"
-      xos-password: "{{ maas_xos_admin_pass }}"
-    body: "{{ lookup('file', '/tmp/' + item ) }}"
-    status_code: 200
-  with_items:
-    - openstack.yaml
-    - openstack-compute.yaml
-
-- name: Pause to work around race in VTN or ONOS synchronizers
-  pause:
-    seconds: 20
-
-- name: Load TOSCA to enable VTN on OpenStack compute nodes, over REST
-  uri:
-    url: "{{ xos_tosca_url }}/run"
-    method: POST
-    headers:
-      xos-username: "{{ xos_admin_user }}"
-      xos-password: "{{ maas_xos_admin_pass }}"
-    body: "{{ lookup('file', '/tmp/' + item ) }}"
-  with_items:
-    - vtn-service.yaml
-    - openstack-compute-vtn.yaml
-
diff --git a/roles/compute-node-enable/defaults/main.yml b/roles/compute-node-enable/defaults/main.yml
index 4123df8..f6a34ab 100644
--- a/roles/compute-node-enable/defaults/main.yml
+++ b/roles/compute-node-enable/defaults/main.yml
@@ -1,4 +1,4 @@
-
+---
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +14,6 @@
 # limitations under the License.
 
 
----
 # compute-node-enable/defaults/main.yml
 
 xos_tosca_url: "http://xos-tosca/xos-tosca"
@@ -24,5 +23,5 @@
 head_cord_profile_dir: "/opt/cord_profile"
 
 xos_admin_user: "xosadmin@opencord.org"
-xos_admin_pass: "{{ lookup('password', head_credentials_dir ~ '/xosadmin@opencord.org chars=ascii_letters,digits') }}"
+head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
 
diff --git a/roles/compute-node-enable/tasks/main.yml b/roles/compute-node-enable/tasks/main.yml
index 2644671..5862f3e 100644
--- a/roles/compute-node-enable/tasks/main.yml
+++ b/roles/compute-node-enable/tasks/main.yml
@@ -1,4 +1,4 @@
-
+---
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,8 +13,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
----
 # compute-node-enable/tasks/main.yml
 
 - name: Load TOSCA to add OpenStack compute nodes
@@ -23,7 +21,7 @@
     method: POST
     headers:
       xos-username: "{{ xos_admin_user }}"
-      xos-password: "{{ xos_admin_pass }}"
+      xos-password: "{{ head_xos_admin_pass }}"
     body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
     status_code: 200
   with_items:
@@ -42,7 +40,7 @@
     method: POST
     headers:
       xos-username: "{{ xos_admin_user }}"
-      xos-password: "{{ xos_admin_pass }}"
+      xos-password: "{{ head_xos_admin_pass }}"
     body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
     status_code: 200
   with_items:
diff --git a/roles/create-epc/defaults/main.yml b/roles/create-epc/defaults/main.yml
index 542f13d..13a4aec 100644
--- a/roles/create-epc/defaults/main.yml
+++ b/roles/create-epc/defaults/main.yml
@@ -16,6 +16,9 @@
 
 # roles/create-epc/defaults/main.yml
 
+head_credentials_dir: "/opt/credentials"
+
 xos_admin_user: "xosadmin@opencord.org"
-xos_admin_pass: "{{ lookup('password', '/opt/credentials/xosadmin@opencord.org') }}"
-epc_blueprint: "build"
\ No newline at end of file
+head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
+
+epc_blueprint: "build"
diff --git a/roles/create-epc/tasks/main.yml b/roles/create-epc/tasks/main.yml
index ddad05f..fca4c96 100644
--- a/roles/create-epc/tasks/main.yml
+++ b/roles/create-epc/tasks/main.yml
@@ -20,7 +20,7 @@
   uri:
     url: http://localhost/xosapi/v1/vepc/vepcserviceinstances
     user: "{{ xos_admin_user }}"
-    password: "{{ xos_admin_pass }}"
+    password: "{{ head_xos_admin_pass }}"
     return_content: yes
   register: result
 
@@ -28,7 +28,7 @@
   uri:
     url: http://localhost/xosapi/v1/vepc/vepcservices
     user: "{{ xos_admin_user }}"
-    password: "{{ xos_admin_pass }}"
+    password: "{{ head_xos_admin_pass }}"
     return_content: yes
   register: vepcservice
   when: not result.json["items"]
@@ -37,7 +37,7 @@
   uri:
     url: http://localhost/xosapi/v1/vepc/vepcserviceinstances
     user: "{{ xos_admin_user }}"
-    password: "{{ xos_admin_pass }}"
+    password: "{{ head_xos_admin_pass }}"
     method: POST
     body:
       blueprint: "{{ epc_blueprint }}"
diff --git a/roles/epc-synced/defaults/main.yml b/roles/epc-synced/defaults/main.yml
index c621734..3e41139 100644
--- a/roles/epc-synced/defaults/main.yml
+++ b/roles/epc-synced/defaults/main.yml
@@ -16,6 +16,9 @@
 
 # roles/epc-synced/defaults/main.yml
 
+head_credentials_dir: "/opt/credentials"
+
 xos_admin_user: "xosadmin@opencord.org"
-xos_admin_pass: "{{ lookup('password', '/opt/credentials/xosadmin@opencord.org') }}"
+head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
+
 epc_sync_objects: []
diff --git a/roles/epc-synced/tasks/main.yml b/roles/epc-synced/tasks/main.yml
index 996a069..d31a3dc 100644
--- a/roles/epc-synced/tasks/main.yml
+++ b/roles/epc-synced/tasks/main.yml
@@ -20,7 +20,7 @@
   uri:
     url: http://localhost/xosapi/v1/{{ item }}
     user: "{{ xos_admin_user }}"
-    password: "{{ xos_admin_pass }}"
+    password: "{{ head_xos_admin_pass }}"
     return_content: yes
   register: result
   until: result.json["items"] and result.json["items"][0]["backend_status"] == "OK"
diff --git a/roles/test-exampleservice/defaults/main.yml b/roles/test-exampleservice/defaults/main.yml
index 8079f10..16d838e 100644
--- a/roles/test-exampleservice/defaults/main.yml
+++ b/roles/test-exampleservice/defaults/main.yml
@@ -15,16 +15,12 @@
 
 # test-exampleservice/defaults/main.yml
 
-head_cord_profile_dir: "/opt/cord_profile"
-
-xos_ui_port: 9000
-
 xos_tosca_url: "http://xos-tosca/xos-tosca"
 
 head_credentials_dir: "/opt/credentials"
 
-xos_admin_user: "xosadmin@opencord.org"
-xos_admin_pass: "{{ lookup('password', head_credentials_dir ~ '/xosadmin@opencord.org chars=ascii_letters,digits') }}"
+head_cord_profile_dir: "/opt/cord_profile"
 
-maas_xos_admin_pass: "{{ lookup('file', '/opt/credentials/xosadmin@opencord.org') }}"
+xos_admin_user: "xosadmin@opencord.org"
+head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
 
diff --git a/roles/test-exampleservice/tasks/main.yml b/roles/test-exampleservice/tasks/main.yml
index 64f03d9..7028ae0 100644
--- a/roles/test-exampleservice/tasks/main.yml
+++ b/roles/test-exampleservice/tasks/main.yml
@@ -24,7 +24,7 @@
     method: POST
     headers:
       xos-username: "{{ xos_admin_user }}"
-      xos-password: "{{ xos_admin_pass }}"
+      xos-password: "{{ head_xos_admin_pass }}"
     body: "{{ lookup('file', head_cord_profile_dir + '/test-exampleservice.yaml' ) }}"
     status_code: 200
   tags:
diff --git a/roles/test-mcord-base/defaults/main.yml b/roles/test-mcord-base/defaults/main.yml
index 1cf905f..f4572f7 100644
--- a/roles/test-mcord-base/defaults/main.yml
+++ b/roles/test-mcord-base/defaults/main.yml
@@ -15,13 +15,6 @@
 
 # test-mcord-base/defaults/main.yml
 
-head_cord_profile_dir: "/opt/cord_profile"
-
-xos_ui_port: 9000
-
-xos_admin_user: "xosadmin@opencord.org"
-maas_xos_admin_pass: "{{ lookup('file', '/opt/credentials/xosadmin@opencord.org') }}"
-
 test_networks:
   - management
   - sgi_network
diff --git a/roles/test-mcord-base/tasks/main.yml b/roles/test-mcord-base/tasks/main.yml
index 193c4d7..aa5ae9a 100644
--- a/roles/test-mcord-base/tasks/main.yml
+++ b/roles/test-mcord-base/tasks/main.yml
@@ -1,4 +1,4 @@
-
+---
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,8 +13,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
----
 # test-mcord-base/tasks/main.yml
 # Run tests to check that the base elements of M-CORD are present
 
diff --git a/roles/xos-config-new-tosca/defaults/main.yml b/roles/xos-config-new-tosca/defaults/main.yml
index e20eff8..afe9481 100644
--- a/roles/xos-config-new-tosca/defaults/main.yml
+++ b/roles/xos-config-new-tosca/defaults/main.yml
@@ -22,7 +22,7 @@
 head_cord_profile_dir: "/opt/cord_profile"
 
 xos_admin_user: "xosadmin@opencord.org"
-xos_admin_pass: "{{ lookup('password', head_credentials_dir ~ '/xosadmin@opencord.org chars=ascii_letters,digits') }}"
+head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
 
 xos_tosca_config_templates: []
 
diff --git a/roles/xos-config-new-tosca/tasks/main.yml b/roles/xos-config-new-tosca/tasks/main.yml
index 3fbbc0f..eba6c3f 100644
--- a/roles/xos-config-new-tosca/tasks/main.yml
+++ b/roles/xos-config-new-tosca/tasks/main.yml
@@ -21,7 +21,7 @@
     method: POST
     headers:
       xos-username: "{{ xos_admin_user }}"
-      xos-password: "{{ xos_admin_pass }}"
+      xos-password: "{{ head_xos_admin_pass }}"
     body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
     status_code: 200
   with_items:
@@ -36,7 +36,7 @@
     method: POST
     headers:
       xos-username: "{{ xos_admin_user }}"
-      xos-password: "{{ xos_admin_pass }}"
+      xos-password: "{{ head_xos_admin_pass }}"
     body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
     status_code: 200
   with_items:
@@ -50,7 +50,7 @@
     method: POST
     headers:
       xos-username: "{{ xos_admin_user }}"
-      xos-password: "{{ xos_admin_pass }}"
+      xos-password: "{{ head_xos_admin_pass }}"
     body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
     status_code: 200
   with_items: "{{ xos_new_tosca_config_templates }}"
diff --git a/roles/xos-ready/defaults/main.yml b/roles/xos-ready/defaults/main.yml
index 4c35845..d7e49f7 100644
--- a/roles/xos-ready/defaults/main.yml
+++ b/roles/xos-ready/defaults/main.yml
@@ -1,4 +1,4 @@
-
+---
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,11 +13,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
----
 # xos-ready/defaults/main.yml
 
-xos_ui_port: 9000
-xos_grpc_insecure_port: 50055
-xos_grpc_secure_port: 50051
+site_name: placeholder-sitename
+site_suffix: "{{ site_name }}.test"
+
 xos_chameleon_port: 9101
+
+xos_tosca_url: "http://xos-tosca/xos-tosca"
+
diff --git a/roles/xos-ready/tasks/main.yml b/roles/xos-ready/tasks/main.yml
index 9078ccc..147367c 100644
--- a/roles/xos-ready/tasks/main.yml
+++ b/roles/xos-ready/tasks/main.yml
@@ -1,4 +1,4 @@
-
+---
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,15 +13,24 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
----
 # xos-ready/tasks/main.yml
 
-- name: Wait for XOS Chameleon to be ready after service onboarding #this means core is ready
-  shell: curl localhost:{{ xos_chameleon_port }}/xosapi/v1/modeldefs
-  register: result
-  until: result.stdout.find("items") != -1
-  retries: 30
-  delay: 20
-  tags:
-    - skip_ansible_lint # running a sub job
+- name: Wait for XOS Chameleon to be ready after service onboarding
+  uri:
+    url: "http://localhost:{{ xos_chameleon_port }}/xosapi/v1/modeldefs"
+    method: GET
+    status_code: 200
+    return_content: yes
+  register: xosready_chameleon
+  until: xosready_chameleon.content.find("items") != -1
+  retries: 40
+  delay: 15
+
+- name: Wait for XOS TOSCA engine to be ready after service onboarding
+  uri:
+    url: "{{ xos_tosca_url }}"
+    method: GET
+    status_code: 200
+  retries: 40
+  delay: 15
+