[CORD-2453] Remove the old TOSCA engine (and obsolete roles/playbooks)
Change-Id: I769303b5ddfa6e2a6ffd5bcc08e6e7f3285e7bba
diff --git a/api-test-playbook.yml b/api-test-playbook.yml
deleted file mode 100644
index f6e6bf3..0000000
--- a/api-test-playbook.yml
+++ /dev/null
@@ -1,53 +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.
-
-
----
-# api-test-playbook.yml
-
-- include: deploy-xos-playbook.yml
-
-- name: Prep for the API tests
- hosts: xos_ui
- connection: docker
- roles:
- - api-test-prep
-
-- name: Clear the XOS database
- hosts: xos_db
- connection: docker
- roles:
- - xos-clear-db
-
-- name: Run API tests
- hosts: xos_ui
- connection: docker
- roles:
- - xos-test-restore-db
- - api-tests
-
-- name: Clear the XOS database (again)
- hosts: xos_db
- connection: docker
- roles:
- - xos-clear-db
-
-- name: Run TOSCA tests
- hosts: xos_ui
- connection: docker
- roles:
- - xos-test-restore-db
- - tosca-tests
-
diff --git a/docs/bootstrap_models_in_xos.md b/docs/bootstrap_models_in_xos.md
index 593a674..0b6fdb1 100644
--- a/docs/bootstrap_models_in_xos.md
+++ b/docs/bootstrap_models_in_xos.md
@@ -3,7 +3,7 @@
All the data model bootstrapping in XOS is done via TOSCA in platform install.
There two ansible roles involved in that:
- `cord-profile` responsible to generate the recipes
-- `xos-config-new-tosca` responsible for onboarding the recipes
+- `xos-config` responsible for onboarding the recipes
Here is a list of changes you'll need to make in order to add a new recipe to your profiles:
@@ -34,10 +34,10 @@
In `platform-install/profile_manifests` locate the profile that your using and open it.
-Locate a section called `xos_new_tosca_config_templates` (if it's missing create it),
+Locate a section called `xos_tosca_config_templates` (if it's missing create it),
and add there the list of templates you want to be generated and onboarded, eg:
```
-xos_new_tosca_config_templates:
+xos_tosca_config_templates:
- site.yml
```
diff --git a/onboard-profile-playbook.yml b/onboard-profile-playbook.yml
index e8387c8..ecb45d6 100644
--- a/onboard-profile-playbook.yml
+++ b/onboard-profile-playbook.yml
@@ -21,8 +21,7 @@
roles:
- xos-ready
-- name: Apply profile config (new engine)
+- name: Apply profile config
hosts: head
roles:
- - xos-config-new-tosca
-
+ - xos-config
diff --git a/pod-test-playbook.yml b/pod-test-playbook.yml
index 5d5ad15..2561001 100644
--- a/pod-test-playbook.yml
+++ b/pod-test-playbook.yml
@@ -29,11 +29,8 @@
roles:
- test-subscriber-config
-- include: add-onboard-containers-playbook.yml
-
- name: Enable the test subscriber
- hosts: xos_ui
- connection: docker
+ hosts: head
roles:
- test-subscriber-enable
diff --git a/roles/api-test-prep/tasks/main.yml b/roles/api-test-prep/tasks/main.yml
deleted file mode 100644
index 7f0e40d..0000000
--- a/roles/api-test-prep/tasks/main.yml
+++ /dev/null
@@ -1,30 +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.
-
-
----
-# api-test-prep/tasks/main.yml
-
-- name: Install node packages for api tests with npm
- command: "npm install --production"
- args:
- chdir: "/opt/xos/tests/api"
- tags:
- - skip_ansible_lint # run during testing only
-
-- name: Install dredd-hooks with pip
- pip:
- name: dredd-hooks
-
diff --git a/roles/api-tests/defaults/main.yml b/roles/api-tests/defaults/main.yml
deleted file mode 100644
index 024807a..0000000
--- a/roles/api-tests/defaults/main.yml
+++ /dev/null
@@ -1,20 +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.
-
-
----
-# api-tests/defaults/main.yml
-
-config_cord_dir: "/opt/cord"
diff --git a/roles/api-tests/tasks/main.yml b/roles/api-tests/tasks/main.yml
deleted file mode 100644
index f944dbf..0000000
--- a/roles/api-tests/tasks/main.yml
+++ /dev/null
@@ -1,41 +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.
-
-
----
-# api-tests/tasks/main.yml
-
-- name: Copy apiary.apib to target location
- copy:
- src: "{{ config_cord_dir }}/orchestration/xos/apiary.apib"
- dest: "/opt/xos/tests/api/apiary.apib"
-
-- name: Run API tests
- command: "npm test"
- args:
- chdir: "/opt/xos/tests/api"
- register: api_tests_out
- ignore_errors: yes
- tags:
- - skip_ansible_lint # run during testing only
-
-- name: Save output from API tests
- copy:
- content: "{{ api_tests_out.stdout_lines }}"
- dest: "/tmp/api-tests.out"
-
-- name: Print output from API test
- debug: var=api_tests_out.stdout_lines
-
diff --git a/roles/cord-profile/defaults/main.yml b/roles/cord-profile/defaults/main.yml
index e94f4cf..c773663 100644
--- a/roles/cord-profile/defaults/main.yml
+++ b/roles/cord-profile/defaults/main.yml
@@ -66,8 +66,6 @@
xos_tosca_config_templates: []
-xos_new_tosca_config_templates: []
-
xos_other_templates: []
# XOS Config (xos_config.yaml)
@@ -102,6 +100,7 @@
# used in deployment.yaml.j2
xos_admin_user: "xosadmin@opencord.org"
xos_admin_pass: "{{ lookup('password', credentials_dir ~ '/xosadmin@opencord.org chars=ascii_letters,digits') }}"
+head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
xos_admin_first: XOS
xos_admin_last: Admin
diff --git a/roles/cord-profile/templates/xos.yaml.j2 b/roles/cord-profile/templates/xos.yaml.j2
index 25728f2..2613830 100644
--- a/roles/cord-profile/templates/xos.yaml.j2
+++ b/roles/cord-profile/templates/xos.yaml.j2
@@ -28,4 +28,3 @@
xos:
type: tosca.nodes.XOS
-
diff --git a/roles/test-subscriber-config/templates/test-subscriber.yaml.j2 b/roles/test-subscriber-config/templates/test-subscriber.yaml.j2
index 4a6d5f5..b2b85c1 100644
--- a/roles/test-subscriber-config/templates/test-subscriber.yaml.j2
+++ b/roles/test-subscriber-config/templates/test-subscriber.yaml.j2
@@ -21,7 +21,13 @@
description: Creates a CORD test subscriber, created by platform-install
imports:
- - custom_types/xos.yaml
+ - custom_types/cordsubscriberroot.yaml
+ - custom_types/site.yaml
+ - custom_types/slice.yaml
+ - custom_types/user.yaml
+ - custom_types/voltservice.yaml
+ - custom_types/volttenant.yaml
+ - custom_types/serviceinstancelink.yaml
topology_template:
node_templates:
@@ -30,24 +36,21 @@
{{ site_name }}:
type: tosca.nodes.Site
properties:
- no-delete: true
- no-create: true
- no-update: true
+ name: {{ site_name }}
+ must-exist: true
# vsg slice, volt service, fully created in cord-services.yaml
{{ site_name }}_vsg:
type: tosca.nodes.Slice
properties:
- no-delete: true
- no-create: true
- no-update: true
+ name: {{ site_name }}_vsg
+ must-exist: true
service#volt:
type: tosca.nodes.VOLTService
properties:
- no-delete: true
- no-create: true
- no-update: true
+ name: volt
+ must-exist: true
# Test subscriber
@@ -58,82 +61,98 @@
password: letmein
firstname: john
lastname: doe
+ username: johndoe@myhouse.com
+ email: johndoe@myhouse.com
requirements:
- site:
node: {{ site_name }}
- relationship: tosca.relationships.MemberOfSite
- - dependency:
- node: {{ site_name }}_vsg
- relationship: tosca.relationships.DependsOn
+ relationship: tosca.relationships.BelongsToOne
+ # NOTE: is this useful? can't find this relation in the old TOSCA
+ # - dependency:
+ # node: {{ site_name }}_vsg
+ # relationship: tosca.relationships.DependsOn
# A subscriber
- My House:
- type: tosca.nodes.CORDSubscriber
+ my_house:
+ type: tosca.nodes.CordSubscriberRoot
properties:
- service_specific_id: 123
+ name: My House
+ service_specific_id: "123"
firewall_enable: false
cdn_enable: false
url_filter_enable: false
url_filter_level: R
- requirements:
- - house_admin:
- node: johndoe@myhouse.com
- relationship: tosca.relationships.AdminPrivilege
+ # NOTE this appears not to be used
+ # requirements:
+ # - house_admin:
+ # node: johndoe@myhouse.com
+ # relationship: tosca.relationships.AdminPrivilege
- Mom's PC:
- type: tosca.nodes.CORDUser
- properties:
- mac: 01:02:03:04:05:06
- level: PG_13
- requirements:
- - household:
- node: My House
- relationship: tosca.relationships.SubscriberDevice
+ # NOTE needs to be moved to a new model (now they are JSON encoded)
+ # Mom's PC:
+ # type: tosca.nodes.CORDUser
+ # properties:
+ # mac: 01:02:03:04:05:06
+ # level: PG_13
+ # requirements:
+ # - household:
+ # node: My House
+ # relationship: tosca.relationships.SubscriberDevice
- Dad's PC:
- type: tosca.nodes.CORDUser
- properties:
- mac: 90:E2:BA:82:F9:75
- level: PG_13
- requirements:
- - household:
- node: My House
- relationship: tosca.relationships.SubscriberDevice
+ # Dad's PC:
+ # type: tosca.nodes.CORDUser
+ # properties:
+ # mac: 90:E2:BA:82:F9:75
+ # level: PG_13
+ # requirements:
+ # - household:
+ # node: My House
+ # relationship: tosca.relationships.SubscriberDevice
- Jack's Laptop:
- type: tosca.nodes.CORDUser
- properties:
- mac: 68:5B:35:9D:91:D5
- level: PG_13
- requirements:
- - household:
- node: My House
- relationship: tosca.relationships.SubscriberDevice
+ # Jack's Laptop:
+ # type: tosca.nodes.CORDUser
+ # properties:
+ # mac: 68:5B:35:9D:91:D5
+ # level: PG_13
+ # requirements:
+ # - household:
+ # node: My House
+ # relationship: tosca.relationships.SubscriberDevice
- Jill's Laptop:
- type: tosca.nodes.CORDUser
- properties:
- mac: 34:36:3B:C9:B6:A6
- level: PG_13
- requirements:
- - household:
- node: My House
- relationship: tosca.relationships.SubscriberDevice
+ # Jill's Laptop:
+ # type: tosca.nodes.CORDUser
+ # properties:
+ # mac: 34:36:3B:C9:B6:A6
+ # level: PG_13
+ # requirements:
+ # - household:
+ # node: My House
+ # relationship: tosca.relationships.SubscriberDevice
- My Volt:
+ si#volt:
type: tosca.nodes.VOLTTenant
properties:
- service_specific_id: 123
+ name: My Volt
+ service_specific_id: "123"
s_tag: 222
c_tag: 111
requirements:
- - provider_service:
+ - owner:
node: service#volt
- relationship: tosca.relationships.MemberOfService
- - subscriber:
- node: My House
- relationship: tosca.relationships.BelongsToSubscriber
- - dependency:
- node: {{ site_name }}_vsg
- relationship: tosca.relationships.DependsOn
+ relationship: tosca.relationships.BelongsToOne
+ # - subscriber:
+ # node: my_house
+ # relationship: tosca.relationships.BelongsToSubscriber
+ # - dependency:
+ # node: {{ site_name }}_vsg
+ # relationship: tosca.relationships.DependsOn
+ My_Volt_My_House:
+ type: tosca.nodes.ServiceInstanceLink
+ requirements:
+ - provider_service_instance:
+ node: si#volt
+ relationship: tosca.relationships.BelongsToOne
+ - subscriber_service_instance:
+ node: my_house
+ relationship: tosca.relationships.BelongsToOne
diff --git a/roles/test-subscriber-enable/defaults/main.yml b/roles/test-subscriber-enable/defaults/main.yml
index dd18150..a17a3c7 100644
--- a/roles/test-subscriber-enable/defaults/main.yml
+++ b/roles/test-subscriber-enable/defaults/main.yml
@@ -17,5 +17,11 @@
---
# test-subscriber-enable/defaults/main.yml
-xos_admin_user: "xosadmin@opencord.org"
+xos_tosca_url: "http://xos-tosca/xos-tosca"
+head_credentials_dir: "/opt/credentials"
+
+head_cord_profile_dir: "/opt/cord_profile"
+
+xos_admin_user: "xosadmin@opencord.org"
+head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
\ No newline at end of file
diff --git a/roles/test-subscriber-enable/tasks/main.yml b/roles/test-subscriber-enable/tasks/main.yml
index 84d698b..f7c8c67 100644
--- a/roles/test-subscriber-enable/tasks/main.yml
+++ b/roles/test-subscriber-enable/tasks/main.yml
@@ -18,7 +18,15 @@
# test-subscriber-enable/tasks/main.yml
- name: Run TOSCA to add test-subscriber
- command: "python /opt/xos/tosca/run.py {{ xos_admin_user }} /opt/cord_profile/test-subscriber.yaml"
+ uri:
+ url: "{{ xos_tosca_url }}/run"
+ method: POST
+ headers:
+ xos-username: "{{ xos_admin_user }}"
+ xos-password: "{{ head_xos_admin_pass }}"
+ body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
+ status_code: 200
+ with_items:
+ - "test-subscriber.yaml"
tags:
- skip_ansible_lint # TOSCA loading should be idempotent
-
diff --git a/roles/tosca-tests/tasks/main.yml b/roles/tosca-tests/tasks/main.yml
deleted file mode 100644
index b3107b5..0000000
--- a/roles/tosca-tests/tasks/main.yml
+++ /dev/null
@@ -1,35 +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-tests/tasks/main.yml
-
-- name: Run TOSCA tests
- command: "python ./alltests.py"
- args:
- chdir: "/opt/xos/tosca/tests"
- register: tosca_tests_out
- ignore_errors: yes
- tags:
- - skip_ansible_lint # run during testing only
-
-- name: Save output from TOSCA tests
- copy:
- content: "{{ tosca_tests_out.stdout_lines }}"
- dest: "/tmp/tosca-tests.out"
-
-- name: Print output from TOSCA test
- debug: var=tosca_tests_out.stdout_lines
diff --git a/roles/xos-clear-db/files/xos_clear_db.sql b/roles/xos-clear-db/files/xos_clear_db.sql
deleted file mode 100644
index bae9638..0000000
--- a/roles/xos-clear-db/files/xos_clear_db.sql
+++ /dev/null
@@ -1,40 +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.
-
-
--- Clear the XOS database (used for testing)
-
-CREATE OR REPLACE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$
-DECLARE
- statements CURSOR FOR
- SELECT tablename FROM pg_tables
- WHERE tableowner = username AND schemaname = 'public';
-BEGIN
- FOR stmt IN statements LOOP
- EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
- END LOOP;
-END;
-$$ LANGUAGE plpgsql;
-
-SELECT truncate_tables('postgres');
-
-SELECT setval('core_tenant_id_seq', 1);
-
-SELECT setval('core_deployment_id_seq', 1);
-
-SELECT setval('core_flavor_id_seq', 1);
-
-SELECT setval('core_service_id_seq', 1);
-
diff --git a/roles/xos-clear-db/tasks/main.yml b/roles/xos-clear-db/tasks/main.yml
deleted file mode 100644
index bd2a753..0000000
--- a/roles/xos-clear-db/tasks/main.yml
+++ /dev/null
@@ -1,29 +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.
-
-
----
-# xos-clear-db/tasks/main.yml
-
-- name: Copy over database cleanup script
- copy:
- src: xos_clear_db.sql
- dest: /tmp/xos_clear_db.sql
-
-- name: Run database cleanup script
- command: "su postgres -c 'psql -U postgres -d xos -f /tmp/xos_clear_db.sql'"
- tags:
- - skip_ansible_lint # test scenario destructive script
-
diff --git a/roles/xos-config-new-tosca/defaults/main.yml b/roles/xos-config-new-tosca/defaults/main.yml
deleted file mode 100644
index afe9481..0000000
--- a/roles/xos-config-new-tosca/defaults/main.yml
+++ /dev/null
@@ -1,31 +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.
-
-# xos-config/defaults/main.yml
-
-xos_tosca_url: "http://xos-tosca/xos-tosca"
-
-head_credentials_dir: "/opt/credentials"
-
-head_cord_profile_dir: "/opt/cord_profile"
-
-xos_admin_user: "xosadmin@opencord.org"
-head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
-
-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
deleted file mode 100644
index b11cef0..0000000
--- a/roles/xos-config-new-tosca/tasks/main.yml
+++ /dev/null
@@ -1,64 +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.
-
-# xos-config-new-tosca/tasks/main.yml
-
-- name: Bootstrap XOS database - create site, deployment, admin user
- uri:
- url: "{{ xos_tosca_url }}/run"
- method: POST
- headers:
- xos-username: "{{ xos_admin_user }}"
- xos-password: "{{ head_xos_admin_pass }}"
- body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
- status_code: 200
- register: result
- until: result | success
- retries: 40
- delay: 2
- with_items:
- - "fixtures.yaml"
- - "deployment.yaml"
-
-- name: Configure XOS with OpenStack config
- uri:
- url: "{{ xos_tosca_url }}/run"
- method: POST
- headers:
- xos-username: "{{ xos_admin_user }}"
- xos-password: "{{ head_xos_admin_pass }}"
- body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
- status_code: 200
- register: result
- until: result | success
- retries: 40
- delay: 2
- with_items:
- - openstack.yaml
-
-- name: Configure XOS with profile specific TOSCA (new Engine)
- uri:
- url: "{{ xos_tosca_url }}/run"
- method: POST
- headers:
- xos-username: "{{ xos_admin_user }}"
- xos-password: "{{ head_xos_admin_pass }}"
- body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
- status_code: 200
- register: result
- until: result | success
- retries: 40
- delay: 2
- with_items: "{{ xos_new_tosca_config_templates }}"
diff --git a/roles/xos-config/defaults/main.yml b/roles/xos-config/defaults/main.yml
index 087ad78..afe9481 100644
--- a/roles/xos-config/defaults/main.yml
+++ b/roles/xos-config/defaults/main.yml
@@ -1,4 +1,4 @@
-
+---
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,12 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
----
# xos-config/defaults/main.yml
+xos_tosca_url: "http://xos-tosca/xos-tosca"
+
+head_credentials_dir: "/opt/credentials"
+
+head_cord_profile_dir: "/opt/cord_profile"
+
xos_admin_user: "xosadmin@opencord.org"
+head_xos_admin_pass: "{{ lookup('file', head_credentials_dir ~ '/' ~ xos_admin_user) }}"
xos_tosca_config_templates: []
+xos_new_tosca_config_templates: []
+
use_openstack: True
diff --git a/roles/xos-config/tasks/main.yml b/roles/xos-config/tasks/main.yml
index d05e034..cc56304 100644
--- a/roles/xos-config/tasks/main.yml
+++ b/roles/xos-config/tasks/main.yml
@@ -1,4 +1,4 @@
-
+---
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,30 +13,52 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
----
# xos-config/tasks/main.yml
-# TODO move this to the TOSCA container
+- name: Bootstrap XOS database - create site, deployment, admin user
+ uri:
+ url: "{{ xos_tosca_url }}/run"
+ method: POST
+ headers:
+ xos-username: "{{ xos_admin_user }}"
+ xos-password: "{{ head_xos_admin_pass }}"
+ body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
+ status_code: 200
+ register: result
+ until: result | success
+ retries: 40
+ delay: 2
+ with_items:
+ - "fixtures.yaml"
+ - "deployment.yaml"
-# - name: Bootstrap XOS database - create site, deployment, admin user
-# command: "python /opt/xos/tosca/run.py {{ xos_admin_user }} /opt/cord_profile/{{ item }}"
-# with_items:
-# - "fixtures.yaml"
-# - "deployment.yaml"
-# tags:
-# - skip_ansible_lint # TOSCA loading should be idempotent
+- name: Configure XOS with OpenStack config
+ uri:
+ url: "{{ xos_tosca_url }}/run"
+ method: POST
+ headers:
+ xos-username: "{{ xos_admin_user }}"
+ xos-password: "{{ head_xos_admin_pass }}"
+ body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
+ status_code: 200
+ register: result
+ until: result | success
+ retries: 40
+ delay: 2
+ with_items:
+ - openstack.yaml
-# - name: Configure XOS with OpenStack config
-# command: "python /opt/xos/tosca/run.py {{ xos_admin_user }} /opt/cord_profile/{{ item }}"
-# with_items:
-# - openstack.yaml
-# tags:
-# - skip_ansible_lint # TOSCA loading should be idempotent
-
-- name: Configure XOS with profile specific TOSCA
- command: "python /opt/xos/tosca/run.py {{ xos_admin_user }} /opt/cord_profile/{{ item }}"
- with_items: "{{ xos_tosca_config_templates }}"
- tags:
- - skip_ansible_lint # TOSCA loading should be idempotent
-
+- name: Configure XOS with profile specific TOSCA (new Engine)
+ uri:
+ url: "{{ xos_tosca_url }}/run"
+ method: POST
+ headers:
+ xos-username: "{{ xos_admin_user }}"
+ xos-password: "{{ head_xos_admin_pass }}"
+ body: "{{ lookup('file', head_cord_profile_dir + '/' + item ) }}"
+ status_code: 200
+ register: result
+ until: result | success
+ retries: 40
+ delay: 2
+ with_items: "{{ xos_new_tosca_config_templates }}"
diff --git a/roles/xos-test-restore-db/defaults/main.yml b/roles/xos-test-restore-db/defaults/main.yml
deleted file mode 100644
index de994e2..0000000
--- a/roles/xos-test-restore-db/defaults/main.yml
+++ /dev/null
@@ -1,21 +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.
-
-
----
-# xos-test-restore-db/defaults/main.yml
-
-xos_admin_user: "xosadmin@opencord.org"
-
diff --git a/roles/xos-test-restore-db/tasks/main.yml b/roles/xos-test-restore-db/tasks/main.yml
deleted file mode 100644
index d2cbc88..0000000
--- a/roles/xos-test-restore-db/tasks/main.yml
+++ /dev/null
@@ -1,44 +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.
-
-
----
-# xos-test-restore-db/tasks/main.yml
-
-- name: Restore core initial data from fixture
- command: python /opt/xos/manage.py --noobserver loaddata /opt/xos/core/fixtures/core_initial_data.json
- tags:
- - skip_ansible_lint # testing only
-
-
-- name: Start loading XOS config
- command: "python /opt/xos/tosca/run.py none /opt/cord_profile/{{ item }}"
- with_items:
- - "fixtures.yaml"
- - "deployment.yaml"
- tags:
- - skip_ansible_lint # TOSCA loading should be idempotent
-
-
-- name: Continue loading XOS config (as admin user)
- command: "python /opt/xos/tosca/run.py {{ xos_admin_user }} /opt/cord_profile/{{ item }}"
- with_items:
- - "sample.yaml"
- - "management-net.yaml"
- - "services.yaml"
- - "volt-devices.yaml"
- tags:
- - skip_ansible_lint # TOSCA loading should be idempotent
-