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.50
This commit is contained in:
Benjamin Jolivot 2017-05-09 14:51:19 +02:00 committed by John R Barker
commit e99815e9f5
8 changed files with 3368 additions and 42 deletions

View file

@ -0,0 +1 @@
posix/ci/group1

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
pyfg>=0.50

View file

@ -0,0 +1,7 @@
---
- name: install required libraries
pip:
requirements: "{{ role_path }}/files/requirements.txt"
- { include: test_indempotency.yml }
- { include: test_params.yml }

View file

@ -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"

View file

@ -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"