--- /dev/null
+---\r
+- hosts: all\r
+ tasks:\r
+\r
+ - name: parameter neIdentifier\r
+ set_fact:\r
+ ne_identifier: "{{neIdentifier}}"\r
+ when: neIdentifier is defined\r
+\r
+ - name: parameter swToBeDownloaded\r
+ set_fact:\r
+ sw_to_be_downloaded: "{{swToBeDownloaded}}"\r
+ when: swToBeDownloaded is defined\r
+\r
+ - name: compatible with parameter pnfId\r
+ set_fact:\r
+ ne_identifier: "{{pnfId}}"\r
+ when: neIdentifier is not defined and pnfId is defined\r
+\r
+ - name: execute downloadNESw operation\r
+ shell: ./swm/downloadNESw --neIdentifier {{ne_identifier}} --swToBeDownloaded {{sw_to_be_downloaded}}\r
+ ignore_errors: yes\r
+ register: download_result\r
+\r
+ - name: parse response of downloadNESw\r
+ set_fact:\r
+ download_response: "{{ download_result.stdout | from_json }}"\r
+\r
+ - name: build failure message\r
+ set_fact:\r
+ download_failure_msg: "{{ download_result.stdout }}"\r
+ when: download_result is failed\r
+\r
+ - name: write failure message to file\r
+ local_action: copy content="{{download_failure_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"\r
+ when: download_result is failed\r
+\r
+ - name: use result of downloadNESw as the result of Playbook\r
+ fail:\r
+ msg: "{{download_failure_msg}}"\r
+ when: download_result is failed\r
+\r
+ - name: fetch file of Notification notifyDownloadNESwStatusChanged\r
+ fetch:\r
+ dest: "{{inventory_dir}}"\r
+ src: "/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}"\r
+\r
+ - name: read contents of Notification notifyDownloadNESwStatusChanged\r
+ set_fact:\r
+ download_notification: "{{ lookup('file', '{{inventory_dir}}/{{inventory_hostname}}/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}') | from_json }}"\r
+\r
+ - name: delete file of Notification notifyDownloadNESwStatusChanged\r
+ local_action: file path="{{inventory_dir}}/{{inventory_hostname}}/tmp/notifyDownloadNESwStatusChanged-{{download_response.downloadProcessId}}" state=absent\r
+\r
+ - name: build success message\r
+ set_fact:\r
+ download_success_msg:\r
+ "result": "Success"\r
+ when: download_notification.downloadOperationStatus == "NE_SWDOWNLOAD_SUCCESSFUL"\r
+\r
+ - name: write success message to file\r
+ local_action: copy content="{{download_success_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"\r
+ when: download_notification.downloadOperationStatus == "NE_SWDOWNLOAD_SUCCESSFUL"\r
+\r