diff options
Diffstat (limited to 'laas/actions/workflows')
30 files changed, 2007 insertions, 0 deletions
diff --git a/laas/actions/workflows/access_master_workflow.yaml b/laas/actions/workflows/access_master_workflow.yaml new file mode 100644 index 0000000..bccb7a2 --- /dev/null +++ b/laas/actions/workflows/access_master_workflow.yaml @@ -0,0 +1,61 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.access_master_workflow: + description: fulfills all access tasks from the dashboard + input: + - job_id + + tasks: + + get_tasks: + action: laas.get_task_list job_id=<% $.job_id %> type="access" + publish: + tasklist: <% task(get_tasks).result.result %> + on-success: + - get_start_index + + get_start_index: + action: core.local cmd="echo 0" + publish: + index: <% int(task(get_start_index).result.stdout) %> + on-success: + - finish: <% $.index >= len($.tasklist) %> + - access_task: <% $.index < len($.tasklist) %> + + loop: + action: core.local + input: + cmd: 'echo $((<% $.index %>+1))' + publish: + index: <% task(loop).result.stdout %> + on-success: + - finish: <% $.index >= len($.tasklist) %> + - access_task: <% $.index < len($.tasklist) %> + + access_task: + action: laas.access_workflow + input: + task_id: <% $.tasklist[$.index] %> + job_id: <% $.job_id %> + on-success: + - loop + + finish: + action: core.local cmd="exit 0" + on-success: succeed diff --git a/laas/actions/workflows/access_workflow.yaml b/laas/actions/workflows/access_workflow.yaml new file mode 100644 index 0000000..0563750 --- /dev/null +++ b/laas/actions/workflows/access_workflow.yaml @@ -0,0 +1,116 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.access_workflow: + description: fulfills a single access task from the dashboard + input: + - task_id + - job_id + + tasks: + + start_task: + action: laas.start_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + on-success: get_task + + get_task: + action: laas.get_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + type: "access" + publish: + task_data: <% task(get_task).result.result %> + lab_token: "null" + on-success: + - create_access: <% not $.task_data.get("revoke", false) %> + - remove_access: <% $.task_data.get("revoke", false) %> + + remove_access: + action: core.local cmd="exit 0" + on-success: + - delete_vpn_user: <% not $.task_data.get("lab_token") = "null" %> + + create_access: + action: core.local cmd="exit 0" + on-success: + - make_vpn_user: <% $.task_data.access_type = "vpn" %> + - make_ssh_access: <% $.task_data.access_type = "ssh" %> + + delete_vpn_user: + action: laas.vpn_delete_user key=<% $.task_data.lab_token %> + on-success: finish + on-error: task-error + + make_vpn_user: + action: laas.vpn_make_user + input: + job_id: <% str($.job_id) %> + publish: + vpn_key: <% task(make_vpn_user).result.result %> + lab_token: <% task(make_vpn_user).result.result %> + on-success: notify_vpn + on-error: task-error + + notify_vpn: + action: laas.notify_vpn_user + input: + vpn_key: <% $.vpn_key %> + job_id: <% str($.job_id) %> + task_id: <% $.task_id %> + on-success: finish + on-error: task-error + + make_ssh_access: + action: laas.copy_user_keys + input: + key: <% $.task_data.context.key %> + hosts: <% $.task_data.context.hosts.join(",") %> + publish: + lab_token: "null" + on-success: notify_ssh + on-error: task-error + + notify_ssh: + action: laas.notify_ssh_access + input: + hosts: <% $.task_data.context.hosts %> + user: "opnfv" + job_id: <% str($.job_id) %> + task_id: <% $.task_id %> + on-success: finish + on-error: task-error + + + finish: + action: laas.finish_task + input: + job_id: <% $.job_id %> + task_id: <% $.task_id %> + lab_token: <% $.lab_token %> + + task-error: + action: laas.error_task + input: + job_id: <% $.job_id %> + task_id: <% $.task_id %> + on-complete: + - fail diff --git a/laas/actions/workflows/apex_gambia_workflow.yaml b/laas/actions/workflows/apex_gambia_workflow.yaml new file mode 100644 index 0000000..967440b --- /dev/null +++ b/laas/actions/workflows/apex_gambia_workflow.yaml @@ -0,0 +1,45 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.apex_gambia_workflow: + description: the workflow to deploy apex version Gambia + input: + - hosts + - scenario + - virtual + + tasks: + check_virtual: + action: core.local cmd="exit 0" + on-success: + - virt_deploy: <% $.virtual %> + - hardware_deploy: <% not $.virtual %> + + virt_deploy: + action: laas.apex_gambia_virtual_deploy + input: + hosts: <% $.hosts[0].keys().first() %> + scenario: <% $.scenario %> + timeout: 7200 + retry: + count: 2 + on-success: + - succeed + + hardware_deploy: + action: core.local cmd="echo 'not implemented'" diff --git a/laas/actions/workflows/apex_master_workflow.yaml b/laas/actions/workflows/apex_master_workflow.yaml new file mode 100644 index 0000000..2878b4e --- /dev/null +++ b/laas/actions/workflows/apex_master_workflow.yaml @@ -0,0 +1,41 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.apex_master_workflow: + description: the workflow to install apex + input: + - hosts + - scenario + - virtual + - version + - jumphost + + tasks: + check_version: + action: core.local cmd="exit 0" + on-success: + - gambia: <% $.version = 7 %> + # More versions to come + # default? + + gambia: + action: laas.apex_gambia_workflow + input: + hosts: <% $.hosts %> + scenario: <% $.scenario %> + virtual: <% $.virtual %> diff --git a/laas/actions/workflows/bootBookedHostsWorkflow.yaml b/laas/actions/workflows/bootBookedHostsWorkflow.yaml new file mode 100644 index 0000000..63e872b --- /dev/null +++ b/laas/actions/workflows/bootBookedHostsWorkflow.yaml @@ -0,0 +1,46 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: "2.0" +laas.bootBookedHostsWorkflow: + description: "boots all booked hosts" + tasks: + detectHosts: + action: laas.detectHostsToBoot + on-success: getNextHost + + getNextHost: + action: laas.getNextHost + publish: + host: <% task(getNextHost).result.result %> + on-success: bootHost + on-error: exit + + bootHost: + action: laas.restart_workflow + input: + host: <% $.host %> + cmd: 'on' + ipmi: true + on-success: sleep + + sleep: + action: core.local cmd="sleep 45" + on-success: getNextHost + + exit: + action: core.local cmd="exit 0" diff --git a/laas/actions/workflows/check_power_workflow.yaml b/laas/actions/workflows/check_power_workflow.yaml new file mode 100644 index 0000000..52cdcf6 --- /dev/null +++ b/laas/actions/workflows/check_power_workflow.yaml @@ -0,0 +1,51 @@ +--- +############################################################################## +# Copyright 2019 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' + +laas.check_power_workflow: + description: "Will use the ipmi to check power" + type: direct + input: + - host + + tasks: + + get_ipmi_hostname: + action: laas.get_ipmi_hostname host=<% $.host %> + publish: + ipmi_name: <% task(get_ipmi_hostname).result.result %> + on-success: get_ipmi_password + + get_ipmi_password: + action: laas.get_ipmi_password host=<% $.ipmi_name %> + publish: + password: <% task(get_ipmi_password).result.result %> + on-success: get_ipmi_username + + get_ipmi_username: + action: laas.get_ipmi_username host=<% $.ipmi_name %> + publish: + ipmi_user: <% task(get_ipmi_username).result.result %> + on-success: check_power_status + + check_power_status: + action: laas.check_ipmi_power + input: + host: <% $.ipmi_name %> + user: <% $.ipmi_user %> + pass: <% $.password %> diff --git a/laas/actions/workflows/compass_gambia_workflow.yaml b/laas/actions/workflows/compass_gambia_workflow.yaml new file mode 100644 index 0000000..3576739 --- /dev/null +++ b/laas/actions/workflows/compass_gambia_workflow.yaml @@ -0,0 +1,44 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.compass_gambia_workflow: + description: the workflow to deploy compass version Gambia + input: + - hosts + - scenario + - virtual + - subversion + + tasks: + check_virtual: + action: core.local cmd="exit 0" + on-success: + - hardware_deploy: <% not $.virtual %> + + virt_deploy: + action: laas.compass_gambia_virtual_deploy + input: + hosts: <% $.hosts[0].keys().first() %> + scenario: <% $.scenario %> + subversion: <% $.subversion %> + timeout: 7200 + on-success: + - succeed + + hardware_deploy: + action: core.local cmd="echo 'not implemented'" diff --git a/laas/actions/workflows/compass_master_workflow.yaml b/laas/actions/workflows/compass_master_workflow.yaml new file mode 100644 index 0000000..6dc06a1 --- /dev/null +++ b/laas/actions/workflows/compass_master_workflow.yaml @@ -0,0 +1,43 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.compass_master_workflow: + description: the workflow to install compass + input: + - hosts + - jumphost + - scenario + - virtual + - version + - subversion + + tasks: + check_version: + action: core.local cmd="exit 0" + on-success: + - gambia: <% $.version = 7 %> + # More versions to come + # default? + + gambia: + action: laas.compass_gambia_workflow + input: + hosts: <% $.hosts %> + scenario: <% $.scenario %> + virtual: <% $.virtual %> + subversion: <% $.subversion %> diff --git a/laas/actions/workflows/fog_snapshotWorkflow.yaml b/laas/actions/workflows/fog_snapshotWorkflow.yaml new file mode 100644 index 0000000..5f6d1ee --- /dev/null +++ b/laas/actions/workflows/fog_snapshotWorkflow.yaml @@ -0,0 +1,36 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +chain: + - + name: "createSnapshot" + ref: "laas.fog_createSnapshot" + parameters: + host: "{{host}}" + name: "{{name}}" + + - + name: "changeImage" + ref: "laas.fog_changeImage" + parameters: + host: "{{host}}" + snapshot: "{{name}}" + - + name: "startCapture" + ref: "laas.fog_captureWorkflow" + parameters: + host: "{{host}}" diff --git a/laas/actions/workflows/fuel_gambia_workflow.yaml b/laas/actions/workflows/fuel_gambia_workflow.yaml new file mode 100644 index 0000000..b7a758a --- /dev/null +++ b/laas/actions/workflows/fuel_gambia_workflow.yaml @@ -0,0 +1,77 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.fuel_gambia_workflow: + description: the workflow to deploy fuel version Gambia + input: + - hosts + - jumphost + - scenario + - virtual + - subversion + - pdf + - idf + + tasks: + check_virtual: + action: core.local cmd="exit 0" + on-success: + - prepare_virt_deploy: <% $.virtual %> + - start_hardware_deploy: <% not $.virtual %> + + prepare_virt_deploy: + action: laas.fuel_gambia_virtual_prepare + input: + host: <% $.hosts[0].keys().first() %> + on-success: virt_deploy + + virt_deploy: + action: laas.fuel_gambia_virtual_deploy + input: + roles: <% $.hosts[0].keys().first() %> + scenario: <% $.scenario %> + subversion: <% $.subversion %> + timeout: 7200 + on-success: + - succeed + + start_hardware_deploy: + action: laas.get_fuel_bridges + input: + hosts: <% $.hosts %> + publish: + bridges: <% task(start_hardware_deploy).result.result %> + on-success: + - prepare_hardware_deploy + + prepare_hardware_deploy: + action: laas.prepare_fuel_gambia_baremetal + input: + hosts: <% $.jumphost %> + mapping: <% $.bridges %> + timeout: 300 + on-success: + - hardware_deploy + + hardware_deploy: + action: laas.deploy_fuel_gambia_baremetal + input: + pdf: <% $.pdf %> + idf: <% $.idf %> + on-success: + - succeed diff --git a/laas/actions/workflows/fuel_master_workflow.yaml b/laas/actions/workflows/fuel_master_workflow.yaml new file mode 100644 index 0000000..aed839b --- /dev/null +++ b/laas/actions/workflows/fuel_master_workflow.yaml @@ -0,0 +1,44 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.fuel_master_workflow: + description: the workflow to install fuel + input: + - hosts + - jumphost + - scenario + - virtual + - version + - subversion + + tasks: + check_version: + action: core.local cmd="exit 0" + on-success: + - gambia: <% $.version = 7 %> + # More versions to come + # default? + + gambia: + action: laas.fuel_gambia_workflow + input: + hosts: <% $.hosts %> + jumphost: <% $.jumphost %> + scenario: <% $.scenario %> + virtual: <% $.virtual %> + subversion: <% $.subversion %> diff --git a/laas/actions/workflows/hardware_master_workflow.yaml b/laas/actions/workflows/hardware_master_workflow.yaml new file mode 100644 index 0000000..06b4bf9 --- /dev/null +++ b/laas/actions/workflows/hardware_master_workflow.yaml @@ -0,0 +1,42 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.hardware_master_workflow: + description: fulfills all hardware tasks from the dashboard + type: direct + input: + - job_id + + tasks: + + get_tasks: + action: laas.get_task_list + input: + job_id: <% $.job_id %> + type: "hardware" + publish: + tasklist: <% task(get_tasks).result.result %> + on-success: + - hardware_task + + hardware_task: + with-items: task_id in <% $.tasklist %> + action: laas.hardware_workflow + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> diff --git a/laas/actions/workflows/hardware_workflow.yaml b/laas/actions/workflows/hardware_workflow.yaml new file mode 100644 index 0000000..93feb3b --- /dev/null +++ b/laas/actions/workflows/hardware_workflow.yaml @@ -0,0 +1,170 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.hardware_workflow: + description: fulfills a single hardware task from the dashboard + input: + - task_id + - job_id + + tasks: + + start_task: + action: laas.start_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + publish: + retry_count: <% int(0) %> + retry_max: <% int(1) %> + on-success: get_task + + get_task: + action: laas.get_task + input: + task_id: <% $.task_id %> + type: "hardware" + job_id: <% $.job_id %> + publish: + task_data: <% task(get_task).result.result %> + on-success: + - detect_tasks + + detect_tasks: + action: laas.detect_hardware_tasks + input: + job_id: <% $.job_id %> + task_id: <% $.task_id %> + publish: + todo_tasks: <% task(detect_tasks).result.result %> + on-success: prepare_host + + prepare_host: + action: laas.add_management_vlan + input: + hosts: <% list($.task_data.id) %> + on-complete: wait_for_ipmi + + wait_for_ipmi: + action: laas.get_ipmi_hostname host=<% $.task_data.id %> + publish: + ipmi_name: <% task(wait_for_ipmi).result.result %> + on-complete: ping_ipmi + + ping_ipmi: + action: laas.wait_for_host + input: + hostname: <% $.ipmi_name %> + timeout: 200 + on-complete: do_image + on-error: task_error + + do_image: + action: core.local cmd="exit 0" + on-success: + - set_boot: <% $.todo_tasks.get(image, false) %> + - do_hostname: <% not $.todo_tasks.get(image, false) %> + + set_boot: + action: laas.set_boot_workflow + input: + host: <% $.task_data.get(id) %> + on-success: image_host + on-error: task_error + + image_host: + action: laas.fog_imageWorkflow + input: + host: <% $.task_data.get(id) %> + image: <% str($.task_data.get(image)) %> + on-success: do_hostname + on-error: retry + + do_hostname: + action: core.local cmd="exit 0" + on-success: + - set_hostname: <% $.todo_tasks.get(hostname, false) %> + - do_ipmi: <% not $.todo_tasks.get(hostname, false) %> + + set_hostname: + action: laas.set_hostname + input: + hostname: <% $.task_data.get(hostname) %> + host: <% $.task_data.get(id) %> + on-error: task_error + on-success: do_ipmi + + do_ipmi: + action: core.local cmd="exit 0" + on-success: + - ipmi_create: <% $.todo_tasks.get(ipmi_create, false) %> + - do_power: <% not $.todo_tasks.get(ipmi_create, false) %> + + ipmi_create: + action: laas.set_ipmi_account_workflow + input: + host: <% $.task_data.get(id) %> + on-error: task_error + on-success: notify_ipmi + + notify_ipmi: + action: laas.notify_ipmi_workflow + input: + ipmi_key: "ipmiuser_<% $.task_data.get(id) %>" + job_id: <% $.job_id %> + task_id: <% $.task_id %> + ipmi_name: <% $.ipmi_name %> + host: <% $.task_data.get(id) %> + on-success: do_power + + do_power: + action: core.local cmd="exit 0" + on-success: + - power: <% $.todo_tasks.get(power, false) %> + - finish: <% not $.todo_tasks.get(power, false) %> + + power: + action: laas.restart_workflow + input: + host: <% $.task_data.get(id) %> + ipmi: true + cmd: <% $.task_data.get(power) %> + on-success: finish + on-error: task_error + + retry: + action: core.local cmd="exit 0" + publish: + retry_count: <% $.retry_count + 1 %> + on-success: + - set_boot: <% $.retry_count <= $.retry_max %> + - task_error: <% $.retry_count > $.retry_max %> + + finish: + action: laas.finish_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + + task_error: + action: laas.error_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + on-complete: + - fail diff --git a/laas/actions/workflows/jenkins_workflow.yaml b/laas/actions/workflows/jenkins_workflow.yaml new file mode 100644 index 0000000..77d32e5 --- /dev/null +++ b/laas/actions/workflows/jenkins_workflow.yaml @@ -0,0 +1,40 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.jenkins_workflow: + description: "workflow to send jenkins sandbox script to remote host" + input: + - host + + tasks: + gather_info: + action: laas.jenkins_info host=<% $.host %> + publish: + destination: <% task(gather_info).result.result.get(destination) %> + hostname: <% task(gather_info).result.result.get(hostname) %> + secret: <% task(gather_info).result.result.get(secret) %> + script: <% task(gather_info).result.result.get(script) %> + on-success: send_script + + send_script: + action: laas.send_jenkins_script + input: + destination: <% $.destination %> + hostname: <% $.hostname %> + secret: <% $.secret %> + script: <% $.script %> diff --git a/laas/actions/workflows/master_workflow.yaml b/laas/actions/workflows/master_workflow.yaml new file mode 100644 index 0000000..821cfb8 --- /dev/null +++ b/laas/actions/workflows/master_workflow.yaml @@ -0,0 +1,74 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.master_workflow: + description: master workflow to fulfill a job + input: + - job_id + + tasks: + start_job: + action: laas.start_job job_id=<% $.job_id %> + on-success: + - hardware_master_workflow + on-error: + - fail_job + + hardware_master_workflow: + action: laas.hardware_master_workflow job_id=<% $.job_id %> + on-success: + - network_master_workflow + on-error: + - fail_job + + network_master_workflow: + action: laas.network_master_workflow job_id=<% $.job_id %> + on-success: + - access_master_workflow + on-error: + - fail_job + + access_master_workflow: + action: laas.access_master_workflow job_id=<% $.job_id %> + on-success: + - software_master_workflow + on-error: + - fail_job + + software_master_workflow: + action: laas.software_master_workflow job_id=<% $.job_id %> + on-success: + - snapshot_master_workflow + on-error: + - fail_job + + snapshot_master_workflow: + action: laas.snapshot_master_workflow job_id=<% $.job_id %> + on-success: + - finish_job + on-error: + - fail_job + + fail_job: + action: laas.send_bot_failure + input: + job_id: <% $.job_id %> + execution_id: <% env().st2_execution_id %> + + finish_job: + action: laas.finish_job job_id=<% $.job_id %> diff --git a/laas/actions/workflows/network_master_workflow.yaml b/laas/actions/workflows/network_master_workflow.yaml new file mode 100644 index 0000000..819759c --- /dev/null +++ b/laas/actions/workflows/network_master_workflow.yaml @@ -0,0 +1,74 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.network_master_workflow: + description: fulfills all network tasks from the dashboard + input: + - job_id + + tasks: + + get_tasks: + action: laas.get_task_list + input: + job_id: <% $.job_id %> + type: "network" + publish: + tasklist: <% task(get_tasks).result.result %> + on-success: + - get_start_index + + get_start_index: + action: core.local cmd="echo 0" + publish: + index: <% int(task(get_start_index).result.stdout) %> + on-success: + - finish: <% $.index >= len($.tasklist) %> + - network_task: <% $.index < len($.tasklist) %> + + loop: + action: core.local + input: + cmd: 'echo $((<% $.index %>+1))' + publish: + index: <% int(task(loop).result.stdout) %> + on-success: + - finish: <% $.index >= len($.tasklist) %> + - network_task: <% $.index < len($.tasklist) %> + + network_task: + action: laas.network_workflow + input: + task_id: <% $.tasklist[$.index] %> + job_id: <% $.job_id %> + on-success: + - loop + on-error: + - retry_network_task + + retry_network_task: + action: laas.network_workflow + input: + task_id: <% $.tasklist[$.index] %> + job_id: <% $.job_id %> + on-success: + - loop + + finish: + action: core.local cmd="exit 0" + on-success: succeed diff --git a/laas/actions/workflows/network_workflow.yaml b/laas/actions/workflows/network_workflow.yaml new file mode 100644 index 0000000..db24fcf --- /dev/null +++ b/laas/actions/workflows/network_workflow.yaml @@ -0,0 +1,157 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.network_workflow: + input: + - task_id + - job_id + - to_configure_host + + tasks: + + start_task: + action: laas.start_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + on-success: get_task + + get_task: + action: laas.get_task + input: + task_id: <% $.task_id %> + type: "network" + job_id: <% $.job_id %> + publish: + task_data: <% task(get_task).result.result %> + on-success: + - parse_data: <% to_configure_host %> + - configure_switch: <% not to_configure_host %> + + parse_data: + action: laas.parse_network_data task_data=<% $.task_data %> + publish: + mappings: <% task(parse_data).result.result.mappings %> + default: <% task(parse_data).result.result.default %> + host: <% task(parse_data).result.result.host %> + empty: <% task(parse_data).result.result.empty %> + on-success: + - prepare_host: <% not bool($.empty) %> + - configure_switch: <% bool($.empty) %> + on-error: task_error + + prepare_host: + action: laas.add_management_vlan + input: + hosts: <% $.task_data.keys() %> + on-success: wait_for_host + on-error: task_error + + wait_for_host: + action: laas.waitForBoot host=<% $.host %> timeout=1200 + on-success: configure_host + on-error: task_error + + configure_host: + action: laas.configure_host_networking + input: + mapping: <% $.mappings %> + default: <% $.default %> + hosts: <% $.host %> + on-success: configure_switch + on-error: task_error + + configure_switch: + action: laas.network_task network_data=<% $.task_data %> + on-success: + - wait_for_ipmi: <% not bool($.empty) %> + - finish: <% bool($.empty) %> + on-error: task_error + + wait_for_ipmi: + action: laas.get_ipmi_hostname host=<% $.host %> + publish: + ipmi_name: <% task(wait_for_ipmi).result.result %> + on-success: wait_for_ipmi_connection + + wait_for_ipmi_connection: + action: laas.wait_for_host + input: + hostname: <% $.ipmi_name %> + timeout: 300 + on-success: restart_host + + restart_host: + action: laas.restart_workflow + input: + host: <% $.host %> + on-success: second_wait_for_host + on-error: task_error + + second_wait_for_host: + action: laas.waitForBoot host=<% $.host %> timeout=1200 + on-success: find_address + on-error: task_error + + find_address: + action: laas.get_dhcp_address + input: + host: <% $.host %> + publish: + address: <% task(find_address).result.stdout %> + on-success: notify_ip + on-error: retry_find_address + + retry_find_address: + action: core.local + input: + cmd: sleep 30 + on-complete: second_find_address + + second_find_address: + action: laas.get_dhcp_address + input: + host: <% $.host %> + publish: + address: <% task(second_find_address).result.stdout %> + on-success: notify_ip + on-error: task_error + + notify_ip: + action: laas.notify_ip_address + input: + addresses: <% $.address %> + hostname: <% $.host %> + job_id: <% $.job_id %> + task_id: <% $.task_id %> + on-success: finish + on-error: task_error + + finish: + action: laas.finish_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + + task_error: + action: laas.error_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + on-complete: + - fail diff --git a/laas/actions/workflows/notify_ipmi_workflow.yaml b/laas/actions/workflows/notify_ipmi_workflow.yaml new file mode 100644 index 0000000..42d3a66 --- /dev/null +++ b/laas/actions/workflows/notify_ipmi_workflow.yaml @@ -0,0 +1,61 @@ +--- +############################################################################## +# Copyright 2019 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.notify_ipmi_workflow: + description: ipmi notification workflow + input: + - ipmi_key + - job_id + - task_id + - ipmi_name + - host + + tasks: + resolve_ipmi: + action: laas.resolve_host hostname=<% $.ipmi_name %> + publish: + ipmi_ip: <% task(resolve_ipmi).result.stdout %> + on-success: notify_ipmi_user + + notify_ipmi_user: + action: laas.notify_ipmi_user + input: + ipmi_key: <% $.ipmi_key %> + job_id: <% $.job_id %> + task_id: <% $.task_id %> + hostname: <% $.ipmi_name %> + addr: <% $.ipmi_ip %> + on-success: get_ipmi_mac + + get_ipmi_mac: + action: laas.get_mac_from_ip + input: + host: <% $.ipmi_ip %> + gateway: "10.10.29.1" + user: "st2" + publish: + ipmi_mac: <% task(get_ipmi_mac).result.stdout %> + on-success: notify_ipmi_api + + notify_ipmi_api: + action: laas.notify_ipmi_api + input: + ipmi_key: <% $.ipmi_key %> + addr: <% $.ipmi_ip %> + mac: <% $.ipmi_mac %> + host: <% $.host %> diff --git a/laas/actions/workflows/opnfv_master_workflow.yaml b/laas/actions/workflows/opnfv_master_workflow.yaml new file mode 100644 index 0000000..f25f087 --- /dev/null +++ b/laas/actions/workflows/opnfv_master_workflow.yaml @@ -0,0 +1,72 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.opnfv_master_workflow: + description: The master workflow to provision, install, deploy hosts + input: + - hosts + - installer + - scenario + - virtual + - version + - subversion + - pdf + - idf + tasks: + find_jumphost: + action: laas.get_jumphost hosts=<% $.hosts %> + publish: + jumphost: <% task(find_jumphost).result.result %> + on-success: + - install_fuel: <% $.installer.toLower() = 'fuel' %> + - install_apex: <% $.installer.toLower() = 'apex' %> + - install_compass: <% $.installer.toLower() = 'compass' %> + + install_fuel: + action: laas.fuel_master_workflow + input: + hosts: <% $.hosts %> + jumphost: <% $.jumphost %> + scenario: <% $.scenario %> + virtual: <% $.virtual %> + version: <% $.version %> + subversion: <% $.subversion %> + pdf: <% $.pdf %> + idf: <% $.idf %> + on-success: succeed + + install_apex: + action: laas.apex_master_workflow + input: + hosts: <% $.hosts %> + jumphost: <% $.jumphost %> + scenario: <% $.scenario %> + virtual: <% $.virtual %> + version: <% $.version %> + on-success: succeed + + install_compass: + action: laas.compass_master_workflow + input: + hosts: <% $.hosts %> + jumphost: <% $.jumphost %> + scenario: <% $.scenario %> + virtual: <% $.virtual %> + version: <% $.version %> + subversion: <% $.subversion %> + on-success: succeed diff --git a/laas/actions/workflows/provision_workflow.yaml b/laas/actions/workflows/provision_workflow.yaml new file mode 100644 index 0000000..e51facb --- /dev/null +++ b/laas/actions/workflows/provision_workflow.yaml @@ -0,0 +1,37 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.provision_workflow: + description: Prepares and images a host + input: + - host + - os + - image + - hostname + tasks: + set_boot: + action: laas.set_boot_workflow host=<% $.host %> + on-success: set_ipmi + + image_host: + action: laas.fog_imageWorkflow + input: + host: <% $.host %> + os: <% $.os %> + image: <% $.image %> + on-success: inject_ssh_keys diff --git a/laas/actions/workflows/restart_workflow.yaml b/laas/actions/workflows/restart_workflow.yaml new file mode 100644 index 0000000..bd30b1c --- /dev/null +++ b/laas/actions/workflows/restart_workflow.yaml @@ -0,0 +1,59 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.restart_workflow: + description: restarts given host, using ipmi if asked + input: + - host + - ipmi + - cmd + tasks: + branch: + action: core.local cmd="exit 0" + on-success: + - get_ipmi_hostname: <% $.ipmi = true %> + - restart: <% $.ipmi = false %> + + get_ipmi_hostname: + action: laas.get_ipmi_hostname host=<% $.host %> + publish: + ipmi_name: <% task(get_ipmi_hostname).result.result %> + on-success: get_ipmi_password + + get_ipmi_password: + action: laas.get_ipmi_password host=<% $.ipmi_name %> + publish: + password: <% task(get_ipmi_password).result.result %> + on-success: get_ipmi_username + + get_ipmi_username: + action: laas.get_ipmi_username host=<% $.ipmi_name %> + publish: + username: <% task(get_ipmi_username).result.result %> + on-success: ipmi_restart + + ipmi_restart: + action: laas.ipmi_restartHost + input: + host: <% $.ipmi_name %> + user: <% $.username %> + password: <% $.password %> + cmd: <% $.cmd %> + + restart: + action: laas.restartHost host=<% $.host %> diff --git a/laas/actions/workflows/set_boot_workflow.yaml b/laas/actions/workflows/set_boot_workflow.yaml new file mode 100644 index 0000000..53529b6 --- /dev/null +++ b/laas/actions/workflows/set_boot_workflow.yaml @@ -0,0 +1,60 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' + +laas.set_boot_workflow: + description: "Will set the host's boot option to the correct pxe option" + type: direct + input: + - host + + tasks: + + get_ipmi_hostname: + action: laas.get_ipmi_hostname host=<% $.host %> + publish: + ipmi_name: <% task(get_ipmi_hostname).result.result %> + on-success: get_ipmi_password + + get_ipmi_password: + action: laas.get_ipmi_password host=<% $.ipmi_name %> + publish: + password: <% task(get_ipmi_password).result.result %> + on-success: get_host_type + + get_host_type: + action: laas.get_host_type host=<% $.host %> + publish: + type: <% task(get_host_type).result.result %> + on-success: + - hpe: <% $.type = "hpe" %> + - arm: <% $.type = "arm" %> + + hpe: + action: laas.set_hpe_boot + input: + user: "Administrator" + passwd: <% $.password %> + host: <% $.ipmi_name %> + + arm: + action: laas.set_arm_boot + input: + user: "ADMIN" + passwd: <% $.password %> + host: <% $.ipmi_name %> diff --git a/laas/actions/workflows/set_hpe_bios_pass_workflow.yaml b/laas/actions/workflows/set_hpe_bios_pass_workflow.yaml new file mode 100644 index 0000000..d17413e --- /dev/null +++ b/laas/actions/workflows/set_hpe_bios_pass_workflow.yaml @@ -0,0 +1,68 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' + +laas.set_hpe_bios_pass_workflow: + description: "Will set the password for the bios" + type: direct + input: + - host + - password + + tasks: + + get_ipmi_hostname: + action: laas.get_ipmi_hostname host=<% $.host %> + publish: + ipmi_name: <% task(get_ipmi_hostname).result.result %> + on-success: get_ipmi_password + + get_ipmi_password: + action: laas.get_ipmi_password host=<% $.ipmi_name %> + publish: + ipmi_password: <% task(get_ipmi_password).result.result %> + on-success: get_ipmi_username + + get_ipmi_username: + action: laas.get_ipmi_username host=<% $.ipmi_name %> + publish: + ipmi_user: <% task(get_ipmi_username).result.result %> + on-success: get_bios_password + + get_bios_password: + action: laas.get_bios_password host=<% $.ipmi_name %> + publish: + bios_password: <% task(get_bios_password).result.result %> + on-success: set_hpe_bios_pass + + + set_hpe_bios_pass: + action: laas.set_hpe_bios_pass + input: + host: <% $.ipmi_name %> + user: <% $.ipmi_user %> + adminPass: <% $.ipmi_password %> + oldPass: <% $.bios_password %> + newPass: <% $.password %> + on-success: update_db + + update_db: + action: laas.update_bios_password + input: + host: <% $.host %> + password: <% $.password %> diff --git a/laas/actions/workflows/set_ipmi_account_workflow.yaml b/laas/actions/workflows/set_ipmi_account_workflow.yaml new file mode 100644 index 0000000..0c5c0f1 --- /dev/null +++ b/laas/actions/workflows/set_ipmi_account_workflow.yaml @@ -0,0 +1,61 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' + +laas.set_ipmi_account_workflow: + description: "Will set the password for the ipmi account on the host" + type: direct + input: + - host + - notify_user + - url + + tasks: + + get_ipmi_hostname: + action: laas.get_ipmi_hostname host=<% $.host %> + publish: + ipmi_name: <% task(get_ipmi_hostname).result.result %> + on-success: get_ipmi_password + + get_ipmi_password: + action: laas.get_ipmi_password host=<% $.ipmi_name %> + publish: + password: <% task(get_ipmi_password).result.result %> + on-success: get_ipmi_username + + get_ipmi_username: + action: laas.get_ipmi_username host=<% $.ipmi_name %> + publish: + ipmi_user: <% task(get_ipmi_username).result.result %> + on-success: gen_pass + + gen_pass: + action: laas.genPass + input: + key: "ipmiuser_<% $.host %>" + length: 15 + on-success: set_ipmi_pass + + set_ipmi_pass: + action: laas.set_ipmi_pass + input: + user: <% $.ipmi_user %> + pass: <% $.password %> + host: <% $.ipmi_name %> + pass_key: "ipmiuser_<% $.host %>" diff --git a/laas/actions/workflows/snapshot_master_workflow.yaml b/laas/actions/workflows/snapshot_master_workflow.yaml new file mode 100644 index 0000000..4964003 --- /dev/null +++ b/laas/actions/workflows/snapshot_master_workflow.yaml @@ -0,0 +1,64 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.snapshot_master_workflow: + description: fulfills all snapshot tasks from the dashboard + input: + - job_id + + tasks: + + get_tasks: + action: laas.get_task_list + input: + job_id: <% $.job_id %> + type: "snapshot" + publish: + tasklist: <% task(get_tasks).result.result %> + on-success: + - get_start_index + + get_start_index: + action: core.local cmd="echo 0" + publish: + index: <% int(task(get_start_index).result.stdout) %> + on-success: + - finish: <% $.index >= len($.tasklist) %> + - snapshot_task: <% $.index < len($.tasklist) %> + + loop: + action: core.local + input: + cmd: 'echo $((<% $.index %>+1))' + publish: + index: <% task(loop).result.stdout %> + on-success: + - finish: <% $.index >= len($.tasklist) %> + - snapshot_task: <% $.index < len($.tasklist) %> + + snapshot_task: + action: laas.snapshot_workflow + input: + task_id: <% $.tasklist[$.index] %> + job_id: <% $.job_id %> + on-success: + - loop + + finish: + action: core.local cmd="exit 0" + on-success: succeed diff --git a/laas/actions/workflows/snapshot_workflow.yaml b/laas/actions/workflows/snapshot_workflow.yaml new file mode 100644 index 0000000..0babf84 --- /dev/null +++ b/laas/actions/workflows/snapshot_workflow.yaml @@ -0,0 +1,71 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.snapshot_workflow: + input: + - task_id + - job_id + + tasks: + + start_task: + action: laas.start_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + on-success: get_task + + get_task: + action: laas.get_task + input: + task_id: <% $.task_id %> + type: "snapshot" + job_id: <% $.job_id %> + publish: + task_data: <% task(get_task).result.result %> + on-success: snapshot_task + + snapshot_task: + action: laas.fog_snapshotWorkflow + input: + name: <% concat("snapshot_", str($.task_data.dashboard_id) + host: <% $.task_data.host %> + publish: + snapshot_id: <% task(snapshot_task).result.result.snapshot_id %> + host: <% task(snapshot_task).result.result.host %> + on-success: finish + on-error: retry + + finish: + action: laas.finish_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + + retry: + action: core.local cmd="exit 0" + on-success: finish + on-error: task_error + + task_error: + action: laas.error_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + on-complete: + - fail diff --git a/laas/actions/workflows/software_master_workflow.yaml b/laas/actions/workflows/software_master_workflow.yaml new file mode 100644 index 0000000..51c63b4 --- /dev/null +++ b/laas/actions/workflows/software_master_workflow.yaml @@ -0,0 +1,70 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.software_master_workflow: + description: fulfills all software tasks from the dashboard + input: + - job_id + + tasks: + + jenkins: + action: core.local + input: + cmd: "echo 'use laas.jenkins_workflow'" + on-complete: get_tasks + + get_tasks: + action: laas.get_task_list + input: + job_id: <% $.job_id %> + type: "software" + publish: + tasklist: <% task(get_tasks).result.result %> + on-success: + - get_start_index + + get_start_index: + action: core.local cmd="echo 0" + publish: + index: <% int(task(get_start_index).result.stdout) %> + on-success: + - finish: <% $.index >= len($.tasklist) %> + - software_task: <% $.index < len($.tasklist) %> + + loop: + action: core.local + input: + cmd: 'echo $((<% $.index %>+1))' + publish: + index: <% task(loop).result.stdout %> + on-success: + - finish: <% $.index >= len($.tasklist) %> + - software_task: <% $.index < len($.tasklist) %> + + software_task: + action: laas.software_workflow + input: + task_id: <% $.tasklist[$.index] %> + job_id: <% $.job_id %> + on-complete: + - loop + + finish: + action: core.local cmd="exit 0" + on-success: succeed diff --git a/laas/actions/workflows/software_workflow.yaml b/laas/actions/workflows/software_workflow.yaml new file mode 100644 index 0000000..4f22117 --- /dev/null +++ b/laas/actions/workflows/software_workflow.yaml @@ -0,0 +1,90 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.software_workflow: + description: fulfills a software install job + input: + - task_id + - job_id + + tasks: + + start_task: + action: laas.start_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + on-success: get_task + + get_task: + action: laas.get_task + input: + job_id: <% $.job_id %> + task_id: <% $.task_id %> + type: "software" + publish: + task_data: <% task(get_task).result.result %> + on-success: + - software_task + + software_task: + action: core.local cmd="exit 0" + on-success: + - opnfv_install: <% $.task_data.containsKey("opnfv") + and $.task_data.opnfv.containsKey("installer") %> + on-error: retry + + opnfv_install: + action: laas.get_xdf + input: + task_data: <% $.task_data %> + publish: + pdf: <% task(opnfv_install).result.result.pdf %> + idf: <% task(opnfv_install).result.result.idf %> + on-success: + start_opnfv_install + + start_opnfv_install: + action: laas.opnfv_master_workflow + input: + hosts: <% $.task_data.opnfv.get("roles") %> + installer: <% $.task_data.opnfv.get("installer") %> + scenario: <% $.task_data.opnfv.get("scenario") %> + virtual: <% len($.task_data.opnfv.get("roles", [])) = 1 %> + pdf: <% $.pdf %> + idf: <% $.idf %> + on-complete: finish + + finish: + action: laas.finish_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + + retry: + action: core.local cmd="exit 0" + on-success: software_task + on-error: task_error + + task_error: + action: laas.error_task + input: + task_id: <% $.task_id %> + job_id: <% $.job_id %> + on-complete: + - fail diff --git a/laas/actions/workflows/ssh_key_workflow.yaml b/laas/actions/workflows/ssh_key_workflow.yaml new file mode 100644 index 0000000..b8f5255 --- /dev/null +++ b/laas/actions/workflows/ssh_key_workflow.yaml @@ -0,0 +1,33 @@ +--- +############################################################################## +# Copyright 2018 Parker Berberian and Others # +# # +# 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. # +############################################################################## + +version: '2.0' +laas.ssh_key_workflow: + description: "workflow to inject user's keys from the dashboard" + input: + - booking + - host + + tasks: + get_key: + action: laas.find_user_keys booking=<% $.booking %> + publish: + url: <% task(get_key).result.result %> + on-success: inject_key + + inject_key: + action: laas.copy_user_keys url=<% $.url %> host=<% $.host %> diff --git a/laas/actions/workflows/update_image_workflow.yaml b/laas/actions/workflows/update_image_workflow.yaml new file mode 100644 index 0000000..812b829 --- /dev/null +++ b/laas/actions/workflows/update_image_workflow.yaml @@ -0,0 +1,100 @@ +--- +############################################################################## +# Copyright 2019 Sawyer Bergeron and Others # +# # +# 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. # +############################################################################## + +version: 1.0 + +description: "Updates the given image using the given host for scratch space" +input: + - host # stackstorm recognized host handle + - update_from_image # image to apply to the host and update + - update_from_os # os to apply to the host and update + - update_into_image # image to save the updated image into + - update_into_os # os to save the updated image into +tasks: + get_target_image: # primary entry point + action: laas.fog_getTargetImage + input: + host: <% ctx().host %> + from_image: <% ctx().update_from_image %> + from_os: <% ctx().update_from_os %> + target_image: <% ctx().update_into_image %> + target_os: <% ctx().update_into_os %> + next: + - when: <% succeeded() %> + publish: + - target_image: <% result().result %> + do: prepare_host + + prepare_host: + action: laas.add_management_vlan + input: + hosts: <% list(ctx().host) %> + next: + - when: <% succeeded() %> + do: get_ipmi_name + + get_ipmi_name: + action: laas.get_ipmi_hostname + input: + host: <% ctx().host %> + next: + - when: <% succeeded() %> + publish: + - ipmi_name: <% result().result %> + do: ping_ipmi + + ping_ipmi: + action: laas.wait_for_host + input: + hostname: <% ctx().ipmi_name %> + timeout: 200 + next: + - when: <% succeeded() %> + do: set_boot + + set_boot: + action: laas.set_boot_workflow + input: + host: <% ctx().host %> + next: + - when: <% succeeded %> + do: image_host + + image_host: + action: laas.fog_imageWorkflow + input: + host: <% ctx().host %> + image: <% ctx().update_from_image %> + os: <% ctx().update_from_os %> + next: + - when: <% succeeded() %> + do: run_updates + + run_updates: + action: laas.update + input: + hosts: <% ctx().host %> + timeout: 900 + next: + - when: <% succeeded() %> + do: capture_image + + capture_image: # exit node + action: laas.fog_captureWorkflow + input: + host: <% ctx().host %> + image: <% ctx().target_image %> |