test_infiniband_facts.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. # Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. # Testcase OMNIA_1.1_IB_TC_002
  16. # Execute ib_facts.yml with valid IP and valid credentials
  17. - name: OMNIA_1.1_IB_TC_002
  18. hosts: infiniband
  19. gather_facts: false
  20. connection: local
  21. vars_files:
  22. - test_vars/test_infiniband_vars.yml
  23. - ../roles/webui_awx/vars/main.yml
  24. - ../input_params/base_vars.yml
  25. tasks:
  26. - name: Execute ib_facts
  27. vars:
  28. inventory_name: "{{ ib_inventory_name }}"
  29. host_name: "{{ ib_host_name }}"
  30. template_name: "{{ fact_template_value }}"
  31. job_template_name: "{{ fact_job_name }}"
  32. playbook_path: "{{ ib_facts_playbook_path }}"
  33. delete_status: true
  34. include_tasks: "{{ awx_script_path }}"
  35. - block:
  36. - name: Validate default flow with valid IP and valid credentials
  37. assert:
  38. that:
  39. - ib_success_msg in job_status.status
  40. success_msg: "{{ success_message }}"
  41. fail_msg: "{{ fail_case }}"
  42. changed_when: false
  43. # Testcase OMNIA_1.1_IB_TC_003
  44. # Execute ib_facts.yml with Invalid IP in inventory group
  45. - name: OMNIA_1.1_IB_TC_003
  46. hosts: infiniband
  47. gather_facts: false
  48. tags: TC_003
  49. connection: local
  50. vars_files:
  51. - test_vars/test_infiniband_vars.yml
  52. - ../roles/webui_awx/vars/main.yml
  53. - ../input_params/base_vars.yml
  54. tasks:
  55. - name: setting ip
  56. set_fact:
  57. ib_host_name: "{{ random_ip }}"
  58. - name: Execute ib_facts
  59. vars:
  60. inventory_name: "{{ ib_inventory_name }}"
  61. host_name: "{{ ib_host_name }}"
  62. template_name: "{{ fact_template_value }}"
  63. job_template_name: "{{ fact_job_name }}"
  64. playbook_path: "{{ ib_facts_playbook_path }}"
  65. delete_status: true
  66. include_tasks: "{{ awx_script_path }}"
  67. - block:
  68. - name: Validate invalid IP and valid credentials
  69. assert:
  70. that:
  71. - ib_fail_msg in job_status.status
  72. success_msg: "{{ success_message }}"
  73. fail_msg: "{{ fail_case }}"
  74. changed_when: false
  75. failed_when: false
  76. # Testcase OMNIA_1.1_IB_TC_001
  77. # Execute ib_facts.yml with no hosts in inventory
  78. - name: OMNIA_1.1_IB_TC_001
  79. hosts: infiniband
  80. gather_facts: false
  81. tags: TC_001
  82. connection: local
  83. vars_files:
  84. - test_vars/test_infiniband_vars.yml
  85. - ../roles/webui_awx/vars/main.yml
  86. - ../input_params/base_vars.yml
  87. tasks:
  88. - name: Execute ib_facts with no host details
  89. vars:
  90. inventory_name: "{{ ib_inventory_name }}"
  91. template_name: "{{ fact_template_value }}"
  92. job_template_name: "{{ fact_job_name }}"
  93. playbook_path: "{{ ib_facts_playbook_path }}"
  94. delete_status: true
  95. include_tasks: "{{ awx_script_path }}"
  96. - block:
  97. - name: Validate no hosts and valid credentials
  98. assert:
  99. that:
  100. - ib_success_msg in job_status.status
  101. success_msg: "{{ success_message }}"
  102. fail_msg: "{{ fail_case }}"
  103. changed_when: false
  104. # Testcase OMNIA_1.1_IB_TC_004
  105. # Execute ib_facts.yml with valid IP and incorrect credentials
  106. - name: OMNIA_1.1_IB_TC_004
  107. hosts: infiniband
  108. gather_facts: false
  109. tags: TC_004
  110. connection: local
  111. vars_files:
  112. - test_vars/test_infiniband_vars.yml
  113. - ../roles/webui_awx/vars/main.yml
  114. - ../input_params/base_vars.yml
  115. tasks:
  116. - name: Making infiniband_credentials invalid
  117. tower_credential:
  118. name: "infiniband_credential"
  119. credential_type: "Network"
  120. inputs:
  121. username: "{{ invalid_username }}"
  122. - name: Execute ib_facts
  123. vars:
  124. inventory_name: "{{ ib_inventory_name }}"
  125. host_name: "{{ ib_host_name }}"
  126. template_name: "{{ fact_template_value }}"
  127. job_template_name: "{{ fact_job_name }}"
  128. playbook_path: "{{ ib_facts_playbook_path }}"
  129. delete_status: true
  130. include_tasks: "{{ awx_script_path }}"
  131. - block:
  132. - name: Validate valid IP and invalid credentials
  133. assert:
  134. that:
  135. - ib_fail_msg in job_status.status
  136. success_msg: "{{ success_message }}"
  137. fail_msg: "{{ fail_case }}"
  138. changed_when: false
  139. - name: Set credentials back to default
  140. tower_credential:
  141. name: "infiniband_credential"
  142. credential_type: "Network"
  143. inputs:
  144. username: "{{ username }}"
  145. password: "{{ password }}"