|
| 1 | +# Copyright (c) IBM Corporation 2020 |
| 2 | +# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) |
| 3 | +--- |
| 4 | +- name: CMCI Integration Test |
| 5 | + collections: |
| 6 | + - ibm.ibm_zos_cics |
| 7 | + hosts: 'localhost' |
| 8 | + gather_facts: 'false' |
| 9 | + vars: |
| 10 | + csdgroup: 'ANSITEST' |
| 11 | + bunddef: 'ANSIBUND' |
| 12 | + |
| 13 | + module_defaults: |
| 14 | + ibm.ibm_zos_cics.cmci_delete: |
| 15 | + cmci_host: '{{ cmci_host }}' |
| 16 | + cmci_port: '{{ cmci_port }}' |
| 17 | + cmci_user: '{{ cmci_user }}' |
| 18 | + cmci_password: '{{ cmci_password }}' |
| 19 | + context: '{{ context }}' |
| 20 | + scope: '{{ scope }}' |
| 21 | + insecure: true |
| 22 | + |
| 23 | + ibm.ibm_zos_cics.cmci_action: |
| 24 | + cmci_host: '{{ cmci_host }}' |
| 25 | + cmci_port: '{{ cmci_port }}' |
| 26 | + cmci_user: '{{ cmci_user }}' |
| 27 | + cmci_password: '{{ cmci_password }}' |
| 28 | + context: '{{ context }}' |
| 29 | + scope: '{{ scope }}' |
| 30 | + insecure: true |
| 31 | + |
| 32 | + ibm.ibm_zos_cics.cmci_create: |
| 33 | + cmci_host: '{{ cmci_host }}' |
| 34 | + cmci_port: '{{ cmci_port }}' |
| 35 | + cmci_user: '{{ cmci_user }}' |
| 36 | + cmci_password: '{{ cmci_password }}' |
| 37 | + context: '{{ context }}' |
| 38 | + scope: '{{ scope }}' |
| 39 | + insecure: true |
| 40 | + |
| 41 | + |
| 42 | + tasks: |
| 43 | + - name: 'delete bundle def' |
| 44 | + delegate_to: 'localhost' |
| 45 | + ibm.ibm_zos_cics.cmci_delete: |
| 46 | + type: 'CICSDefinitionBundle' |
| 47 | + resources: |
| 48 | + complex_filter: |
| 49 | + and: |
| 50 | + - attribute: NAME |
| 51 | + value: '{{ bunddef }}' |
| 52 | + - attribute: CSDGROUP |
| 53 | + value: '{{ csdgroup }}' |
| 54 | + get_parameters: |
| 55 | + - name: 'CSDGROUP' |
| 56 | + value: '{{ csdgroup }}' |
| 57 | + register: result |
| 58 | + failed_when: > |
| 59 | + 'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA'] |
| 60 | +
|
| 61 | +
|
| 62 | + - name: 'create bundle def' |
| 63 | + delegate_to: 'localhost' |
| 64 | + ibm.ibm_zos_cics.cmci_create: |
| 65 | + type: 'CICSDefinitionBundle' |
| 66 | + create_parameters: |
| 67 | + - name: 'CSD' |
| 68 | + attributes: |
| 69 | + name: '{{ bunddef }}' |
| 70 | + csdgroup: '{{ csdgroup }}' |
| 71 | + bundledir: "/invalid" |
| 72 | + register: result |
| 73 | + |
| 74 | + - name: assert created |
| 75 | + assert: |
| 76 | + that: |
| 77 | + - result is changed |
| 78 | + - result.cpsm_response == 'OK' |
| 79 | + - result.record_count == 1 |
| 80 | + - result.records[0].name == bunddef |
| 81 | + |
| 82 | + - name: 'install bundle def' |
| 83 | + delegate_to: 'localhost' |
| 84 | + ibm.ibm_zos_cics.cmci_action: |
| 85 | + type: 'CICSDefinitionBundle' |
| 86 | + action_name: 'CSDINSTALL' |
| 87 | + resources: |
| 88 | + filter: |
| 89 | + NAME: '{{ bunddef }}' |
| 90 | + get_parameters: |
| 91 | + - name: 'CSDGROUP' |
| 92 | + value: '{{ csdgroup }}' |
| 93 | + failed_when: false |
| 94 | + register: result |
| 95 | + |
| 96 | + - name: debug |
| 97 | + debug: |
| 98 | + msg: '{{ result }}' |
| 99 | + |
| 100 | + - name: assert installed |
| 101 | + assert: |
| 102 | + that: |
| 103 | + - result.failed is false |
| 104 | + # This will need updating when we pull out more specific error messages from the CMCI response. |
| 105 | + # Expecting the error to contain 'EXEC CICS command(CSD INSTALL) RESP(INVREQ) RESP2(633)' |
| 106 | + # Where RESP2(633) is 'Installation of BUNDLE resource resource failed because the resource had no manifest' |
| 107 | + - result.msg == "CMCI request failed with response \"TABLEERROR\" reason \"DATAERROR\"" |
| 108 | + |
| 109 | + |
| 110 | + - name: 'delete bundle def' |
| 111 | + delegate_to: 'localhost' |
| 112 | + ibm.ibm_zos_cics.cmci_delete: |
| 113 | + type: 'CICSDefinitionBundle' |
| 114 | + resources: |
| 115 | + filter: |
| 116 | + NAME: '{{ bunddef }}' |
| 117 | + get_parameters: |
| 118 | + - name: 'CSDGROUP' |
| 119 | + value: '{{ csdgroup }}' |
| 120 | + register: result |
| 121 | + |
| 122 | + - name: assert deleted |
| 123 | + assert: |
| 124 | + that: |
| 125 | + - result is changed |
| 126 | + - result.cpsm_response == 'OK' |
| 127 | + - result.record_count == 1 |
| 128 | + - result.success_count == 1 |
0 commit comments