mirror of https://github.com/ansible/ansible.git
Fortios file only mode + integration tests (#23275)
* WIP file_mode * WIP * Add file_mode + integration tests * fix pep8 * Update doc fragments Create mutualy_exclusive param Fix yamllint problem in tests * Add aliases file + main playbook for fortios * Install pyfg before running tests * Install pyfg before running tests in role * Remove pre_task as it's done in roles * Force pyFG minimal version for python3 * role_path not role_dir :( * Change requirements * Specify Error type when error on import * Bug in pygf library with python 2.5 (PR is waiting https://github.com/spotify/pyfg/pull/19) * Bad requirement format * still bad format -_-' * remove test/integration/fortios.py (auto generated by tests) missing new lines at end of file * pyFG is now fixed in 0.50pull/24410/head
parent
e342b281d8
commit
e99815e9f5
@ -0,0 +1 @@
|
||||
posix/ci/group1
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
pyfg>=0.50
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: install required libraries
|
||||
pip:
|
||||
requirements: "{{ role_path }}/files/requirements.txt"
|
||||
|
||||
- { include: test_indempotency.yml }
|
||||
- { include: test_params.yml }
|
@ -0,0 +1,68 @@
|
||||
---
|
||||
- name: Add policy
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
id: 42
|
||||
src_addr: all
|
||||
dst_addr: all
|
||||
policy_action: accept
|
||||
service: ALL
|
||||
state: present
|
||||
register: add_policy
|
||||
|
||||
- name: Assert
|
||||
assert:
|
||||
that:
|
||||
- "add_policy.changed == true"
|
||||
|
||||
- name: Add existing policy
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
id: 42
|
||||
src_addr: all
|
||||
dst_addr: all
|
||||
policy_action: accept
|
||||
service: ALL
|
||||
state: present
|
||||
register: add_policy
|
||||
|
||||
- name: Assert
|
||||
assert:
|
||||
that:
|
||||
- "add_policy.changed == false"
|
||||
|
||||
- name: Delete existing policy
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
id: 42
|
||||
src_addr: all
|
||||
dst_addr: all
|
||||
policy_action: accept
|
||||
service: ALL
|
||||
state: absent
|
||||
register: del_policy
|
||||
|
||||
- name: Assert
|
||||
assert:
|
||||
that:
|
||||
- "del_policy.changed == true"
|
||||
|
||||
- name: Delete not-existing policy
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
id: 42
|
||||
src_addr: all
|
||||
dst_addr: all
|
||||
policy_action: accept
|
||||
service: ALL
|
||||
state: absent
|
||||
register: del_policy
|
||||
|
||||
- name: Assert
|
||||
assert:
|
||||
that:
|
||||
- "del_policy.changed == false"
|
@ -0,0 +1,74 @@
|
||||
---
|
||||
- name: Forget id
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
# id: 42
|
||||
src_addr: all
|
||||
dst_addr: all
|
||||
policy_action: accept
|
||||
service: ALL
|
||||
state: present
|
||||
register: forget_id
|
||||
ignore_errors: True
|
||||
|
||||
- name: Forget src_addr
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
id: 42
|
||||
# src_addr: all
|
||||
dst_addr: all
|
||||
policy_action: accept
|
||||
service: ALL
|
||||
state: present
|
||||
register: forget_src_addr
|
||||
ignore_errors: True
|
||||
|
||||
- name: Forget dst_addr
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
id: 42
|
||||
src_addr: all
|
||||
# dst_addr: all
|
||||
policy_action: accept
|
||||
service: ALL
|
||||
state: present
|
||||
register: forget_dst_addr
|
||||
ignore_errors: True
|
||||
|
||||
- name: Forget policy_action
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
id: 42
|
||||
src_addr: all
|
||||
dst_addr: all
|
||||
# policy_action: accept
|
||||
service: ALL
|
||||
state: present
|
||||
register: forget_policy_action
|
||||
ignore_errors: True
|
||||
|
||||
- name: Forget service
|
||||
fortios_ipv4_policy:
|
||||
file_mode: true
|
||||
config_file: "{{role_path}}/files/default_config.conf"
|
||||
id: 42
|
||||
src_addr: all
|
||||
dst_addr: all
|
||||
policy_action: accept
|
||||
# service: ALL
|
||||
state: present
|
||||
register: forget_service
|
||||
ignore_errors: True
|
||||
|
||||
- name: Verify that all previous test have failed
|
||||
assert:
|
||||
that:
|
||||
- "forget_id.failed == True"
|
||||
- "forget_src_addr.failed == True"
|
||||
- "forget_dst_addr.failed == True"
|
||||
- "forget_policy_action.failed == True"
|
||||
- "forget_service.failed == True"
|
Loading…
Reference in New Issue