summaryrefslogtreecommitdiffstats
path: root/ansible_collections/ibm/qradar/tests/integration
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:03:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:03:42 +0000
commit66cec45960ce1d9c794e9399de15c138acb18aed (patch)
tree59cd19d69e9d56b7989b080da7c20ef1a3fe2a5a /ansible_collections/ibm/qradar/tests/integration
parentInitial commit. (diff)
downloadansible-66cec45960ce1d9c794e9399de15c138acb18aed.tar.xz
ansible-66cec45960ce1d9c794e9399de15c138acb18aed.zip
Adding upstream version 7.3.0+dfsg.upstream/7.3.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/ibm/qradar/tests/integration')
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/target-prefixes.network1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml0
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml60
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml19
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml2
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/meta/main.yaml2
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml18
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml7
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml6
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml14
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml7
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml38
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml27
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml69
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml45
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml62
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml136
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml55
26 files changed, 576 insertions, 0 deletions
diff --git a/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network b/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network
new file mode 100644
index 00000000..f26802f6
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network
@@ -0,0 +1 @@
+qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases
new file mode 100644
index 00000000..d7e4f1e4
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases
new file mode 100644
index 00000000..d7e4f1e4
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml
new file mode 100644
index 00000000..cf547abc
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml
@@ -0,0 +1,60 @@
+---
+- name: Create Testing Apache HTTP Server log source
+ log_source_management:
+ name: "Testing Collections PB - 192.168.1.112"
+ type_name: "Apache HTTP Server"
+ state: present
+ description: "Testing Collection PB Description"
+ identifier: "192.168.1.112"
+ register: snort_log_source_create
+
+- name: Assert Create Test Apache HTTP Server log source changed
+ assert:
+ that:
+ - snort_log_source_create is changed
+ - snort_log_source_create is not failed
+
+- name: Create Testing Apache HTTP Server log source RERUN
+ log_source_management:
+ name: "Testing Collections PB - 192.168.1.112"
+ type_name: "Apache HTTP Server"
+ state: present
+ description: "Testing Collection PB Description"
+ identifier: "192.168.1.112"
+ register: snort_log_source_create_rerun
+
+- name: Assert Create Test Apache HTTP Server log source is not changed on RERUN
+ assert:
+ that:
+ - snort_log_source_create_rerun is not changed
+ - snort_log_source_create_rerun is not failed
+
+- name: Delete Testing Apache HTTP Server log source
+ log_source_management:
+ name: "Testing Collections PB - 192.168.1.112"
+ type_name: "Apache HTTP Server"
+ state: absent
+ description: "Testing Collection PB Description"
+ identifier: "192.168.1.112"
+ register: snort_log_source_delete
+
+- name: Assert Delete Test Apache HTTP Server log source changed
+ assert:
+ that:
+ - snort_log_source_delete is changed
+ - snort_log_source_delete is not failed
+
+- name: Delete Testing Apache HTTP Server log source RERUN
+ log_source_management:
+ name: "Testing Collections PB - 192.168.1.112"
+ type_name: "Apache HTTP Server"
+ state: absent
+ description: "Testing Collection PB Description"
+ identifier: "192.168.1.112"
+ register: snort_log_source_delete_rerun
+
+- name: Assert Delete Test Apache HTTP Server log source is not changed on RERUN
+ assert:
+ that:
+ - snort_log_source_delete_rerun is not changed
+ - snort_log_source_delete_rerun is not failed
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases
new file mode 100644
index 00000000..d7e4f1e4
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml
new file mode 100644
index 00000000..7495ec9b
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml
@@ -0,0 +1,19 @@
+---
+
+#- qradar_offense_action:
+# id: 1
+# status: "hidden"
+# assigned_to: "admin"
+# protected: false
+#
+#- qradar_offense_note:
+# offense_id: 2
+# note_text: "testing note text from playbook - modified"
+#
+#- name: get info about qradar offense
+# qradar_offense_info:
+# protected: true
+# status: "HIDDEN"
+# register: offense_info
+#
+#- debug: var=offense_info
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases
new file mode 100644
index 00000000..d7e4f1e4
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases
new file mode 100644
index 00000000..d7e4f1e4
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml
new file mode 100644
index 00000000..10c0fabc
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+testcase: '*'
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/meta/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/meta/main.yaml
new file mode 100644
index 00000000..23d65c7e
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/meta/main.yaml
@@ -0,0 +1,2 @@
+---
+dependencies: []
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml
new file mode 100644
index 00000000..dc4768b5
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml
@@ -0,0 +1,18 @@
+---
+- name: collect all cli test cases
+ find:
+ paths: '{{ role_path }}/tests/cli'
+ patterns: '{{ testcase }}.yaml'
+ register: test_cases
+
+- name: set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: Run test case (connection=ansible.netcommon.httpapi)
+ include: '{{ test_case_to_run }}'
+ vars:
+ ansible_connection: ansible.netcommon.httpapi
+ with_items: '{{ test_items }}'
+ loop_control:
+ loop_var: test_case_to_run
+ tags: connection_httpapi
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml
new file mode 100644
index 00000000..62cc1ae1
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml
@@ -0,0 +1,7 @@
+---
+- include: cli.yaml
+ tags:
+ - cli
+
+- include: redirection.yaml
+ when: ansible_version.full is version('2.10.0', '>=')
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml
new file mode 100644
index 00000000..a57054c7
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml
@@ -0,0 +1,6 @@
+---
+- name: collect all cli test cases
+ find:
+ paths: '{{ role_path }}/tests/redirection'
+ patterns: '{{ testcase }}.yaml'
+ register: test_cases
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml
new file mode 100644
index 00000000..0b8e6b8f
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml
@@ -0,0 +1,14 @@
+---
+- name: Populate Log Sources Management for tests
+ tags: merged
+ ibm.qradar.qradar_log_sources_management: &id001
+ state: merged
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.0.2.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "Apache HTTP Server remote logs from rsyslog"
+ identifier: "198.51.100.1" \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml
new file mode 100644
index 00000000..e7f5896b
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml
@@ -0,0 +1,7 @@
+---
+- name: Remove already configured Log Sources Management by Name
+ ibm.qradar.qradar_log_sources_management:
+ state: deleted
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs" \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml
new file mode 100644
index 00000000..f5c70826
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml
@@ -0,0 +1,38 @@
+---
+- debug:
+ msg: Start Deleted integration state for qradar_log_sources_management ansible_connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_log_sources_config.yaml
+
+- include_tasks: _populate_log_sources_config.yaml
+
+- block:
+
+ - name: Delete attributes of provided configured Log Sources Management
+ register: result
+ ibm.qradar.qradar_log_sources_management: &id001
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: deleted
+
+ - assert:
+ that:
+ - result.changed == true
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
+ \ length == 4 }}"
+ - merged['before'] == result['qradar_log_sources_management']['after']
+
+ - name: Delete attributes of all configured Log Sources Management (IDEMPOTENT)
+ register: result
+ ibm.qradar.qradar_log_sources_management: *id001
+
+ - name: Assert that the previous delete task was idempotent
+ assert:
+ that:
+ - result.changed == false
+
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml
new file mode 100644
index 00000000..c30ad164
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml
@@ -0,0 +1,27 @@
+---
+- debug:
+ msg: START qradar_log_sources_management gathered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_log_sources_config.yaml
+
+- include_tasks: _populate_log_sources_config.yaml
+
+- block:
+
+ - name: Gather the provided configuration with the exisiting running configuration
+ register: result
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: gathered
+
+ - assert:
+ that:
+ - "{{ merged['after'] | symmetric_difference(result['gathered']) |\
+ \ length == 4 }}"
+ - result['changed'] == false
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml
new file mode 100644
index 00000000..224671ed
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml
@@ -0,0 +1,69 @@
+---
+- debug:
+ msg: START Merged qradar_log_sources_management state for integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_log_sources_config.yaml
+
+- block:
+
+ - name: Merge and Create new Log Sources Management
+ tags: merged
+ register: result
+ ibm.qradar.qradar_log_sources_management: &id001
+ state: merged
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.0.2.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "Apache HTTP Server remote logs from rsyslog"
+ identifier: "198.51.100.1"
+
+ - name: To remove creation_date from the after dict
+ set_fact:
+ after: "{{ after | default([]) | combine({ item.key : item.value }) }}"
+ when: "{{item.key not in ['creation_date']}}"
+ with_dict: "{{ dict }}"
+ loop: "{{ result['qradar_log_sources_management']['after'] }}"
+
+ - name: To remove modified_date from the after dict
+ set_fact:
+ after: "{{ after | default([]) | combine({ item.key : item.value }) }}"
+ when: "{{item.key not in ['modified_date']}}"
+ with_dict: "{{ dict }}"
+ loop: "{{ result['qradar_log_sources_management']['after'] }}"
+
+ - name: To remove ID from the after dict
+ set_fact:
+ after: "{{ after | default([]) | combine({ item.key : item.value }) }}"
+ when: "{{item.key not in ['id']}}"
+ with_dict: "{{ dict }}"
+ loop: "{{ result['qradar_log_sources_management']['after'] }}"
+
+ - name: Assert that task reports change and after dict is correctly generated
+ assert:
+ that:
+ - result['changed'] == true
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
+ \ length == 4 }}"
+
+ - name: Assert that before dicts are correctly generated
+ assert:
+ that:
+ - merged['before'] == result['qradar_log_sources_management']['before']
+
+ - name: Merge provided configuration with Log Sources Management (IDEMPOTENT)
+ register: result
+ ibm.qradar.qradar_log_sources_management: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml
new file mode 100644
index 00000000..d8dfd737
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml
@@ -0,0 +1,45 @@
+---
+- debug:
+ msg: START Replaced qradar_log_sources_management state for integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_log_sources_config.yaml
+- include_tasks: _populate_log_sources_config.yaml
+
+- block:
+
+ - name: Replace existing Log Sources Management
+ register: result
+ ibm.qradar.qradar_log_sources_management: &id001
+ state: replaced
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "REPLACED Snort IDS remote logs from rsyslog"
+ identifier: "198.51.100.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "REPLACED Apache HTTP Server remote logs from rsyslog"
+ identifier: "192.0.2.1"
+
+ - assert:
+ that:
+ - result.changed == true
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
+ \ length == 4 }}"
+ - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
+ \ length == 4 }}"
+
+ - name: Replaces device configuration of listed Log Sources Management with provided configuration
+ (IDEMPOTENT)
+ register: result
+ ibm.qradar.qradar_log_sources_management: *id001
+
+ - name: Assert that task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml
new file mode 100644
index 00000000..0536a6a7
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml
@@ -0,0 +1,62 @@
+---
+- debug:
+ msg: START qradar_log_sources_management round trip integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_log_sources_config.yaml
+
+- block:
+
+ - name: Apply the provided configuration (base config)
+ register: base_config
+ ibm.qradar.qradar_log_sources_management: &id001
+ state: merged
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.0.2.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "Apache HTTP Server remote logs from rsyslog"
+ identifier: "198.51.100.1"
+
+ - name: Gather Qradar Log Sources Management facts
+ register: gather_result
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: gathered
+
+ - name: Apply the configuration which need to be reverted
+ register: result
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "REPLACED Snort IDS remote logs from rsyslog"
+ identifier: "198.51.100.1"
+ state: replaced
+
+ - assert:
+ that:
+ - result.changed == true
+ - "{{ merged['before'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
+ \ length == 1 }}"
+ - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
+ \ length == 3 }}"
+
+ - name: Revert back to base config using facts round trip
+ register: revert
+ ibm.qradar.qradar_log_sources_management:
+ config: "{{ gather_result['gathered'] }}"
+ state: replaced
+
+ - assert:
+ that:
+ - revert['changed'] == true
+
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml
new file mode 100644
index 00000000..7e7c63c5
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml
@@ -0,0 +1,136 @@
+---
+merged:
+ before: []
+
+ after:
+ - auto_discovered: false
+ average_eps: 0
+ coalesce_events: true
+ credibility: 5
+ description: Snort IDS remote logs from rsyslog
+ enabled: true
+ gateway: false
+ group_ids:
+ - 0
+ internal: false
+ language_id: 1
+ last_event_time: 0
+ log_source_extension_id: null
+ name: Snort logs
+ protocol_parameters:
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 192.0.2.1
+ protocol_type_id: 0
+ requires_deploy: true
+ status:
+ last_updated: 0
+ messages: null
+ status: NA
+ store_event_payload: true
+ target_event_collector_id: 7
+ type_id: 2
+ wincollect_external_destination_ids: null
+ wincollect_internal_destination_id: null
+ - auto_discovered: false
+ average_eps: 0
+ coalesce_events: true
+ credibility: 5
+ description: Apache HTTP Server remote logs from rsyslog
+ enabled: true
+ gateway: false
+ group_ids:
+ - 0
+ internal: false
+ language_id: 1
+ last_event_time: 0
+ log_source_extension_id: null
+ name: Apache HTTP Server logs
+ protocol_parameters:
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 198.51.100.1
+ protocol_type_id: 0
+ requires_deploy: true
+ status:
+ last_updated: 0
+ messages: null
+ status: NA
+ store_event_payload: true
+ target_event_collector_id: 7
+ type_id: 10
+ wincollect_external_destination_ids: null
+ wincollect_internal_destination_id: null
+
+replaced:
+ after:
+ - auto_discovered: false
+ average_eps: 0
+ coalesce_events: true
+ credibility: 5
+ description: REPLACED Snort IDS remote logs from rsyslog
+ enabled: true
+ gateway: false
+ group_ids:
+ - 0
+ internal: false
+ language_id: 1
+ last_event_time: 0
+ log_source_extension_id: null
+ name: Snort logs
+ protocol_parameters:
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 198.51.100.1
+ protocol_type_id: 0
+ requires_deploy: true
+ status:
+ last_updated: 0
+ messages: null
+ status: NA
+ store_event_payload: true
+ target_event_collector_id: 7
+ type_id: 2
+ wincollect_external_destination_ids: null
+ wincollect_internal_destination_id: null
+ - auto_discovered: false
+ average_eps: 0
+ coalesce_events: true
+ credibility: 5
+ description: REPLACED Apache HTTP Server remote logs from rsyslog
+ enabled: true
+ gateway: false
+ group_ids:
+ - 0
+ internal: false
+ language_id: 1
+ last_event_time: 0
+ log_source_extension_id: null
+ name: Apache HTTP Server logs
+ protocol_parameters:
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 192.0.2.1
+ protocol_type_id: 0
+ requires_deploy: true
+ status:
+ last_updated: 0
+ messages: null
+ status: NA
+ store_event_payload: true
+ target_event_collector_id: 7
+ type_id: 10
+ wincollect_external_destination_ids: null
+ wincollect_internal_destination_id: null
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases
new file mode 100644
index 00000000..d7e4f1e4
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases
new file mode 100644
index 00000000..d7e4f1e4
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases
new file mode 100644
index 00000000..d7e4f1e4
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml
new file mode 100644
index 00000000..142fd613
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml
@@ -0,0 +1,55 @@
+---
+- name: get info about qradar offense
+ rule_info:
+ name: "Service DoS Attack Detected"
+ register: rule_info
+
+- debug: var=rule_info
+
+- name: enable rule by id
+ rule:
+ state: enabled
+ id: "{{ rule_info['rules'][0]['id']|int }}"
+ register: enable_rule_by_id
+
+- name: ensure enable rule by id
+ assert:
+ that:
+ - enable_rule_by_id is changed
+ - enable_rule_by_id is not failed
+
+- name: enable rule by id again
+ rule:
+ state: enabled
+ id: "{{ rule_info['rules'][0]['id']|int }}"
+ register: enable_rule_by_id_again
+
+- name: ensure enable rule by id again
+ assert:
+ that:
+ - enable_rule_by_id_again is not changed
+ - enable_rule_by_id_again is not failed
+
+- name: disable rule by id
+ rule:
+ state: disabled
+ id: "{{ rule_info['rules'][0]['id']|int }}"
+ register: disable_rule_by_id
+
+- name: ensure disable rule by id
+ assert:
+ that:
+ - disable_rule_by_id is changed
+ - disable_rule_by_id is not failed
+
+- name: disable rule by id again
+ rule:
+ state: disabled
+ id: "{{ rule_info['rules'][0]['id']|int }}"
+ register: disable_rule_by_id_again
+
+- name: ensure disable rule by id again
+ assert:
+ that:
+ - disable_rule_by_id_again is not changed
+ - disable_rule_by_id_again is not failed