diff options
Diffstat (limited to 'tests/integration/targets/vyos_firewall_interfaces/tests')
14 files changed, 36 insertions, 69 deletions
diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml index 3e60c41..8b3dacd 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set interfaces ethernet eth1 firewall in name 'INBOUND' \nset interfaces\ + lines: + "set interfaces ethernet eth1 firewall in name 'INBOUND' \nset interfaces\ \ ethernet eth1 firewall out name 'OUTBOUND' \nset interfaces ethernet eth1\ \ firewall local name 'LOCAL' \nset interfaces ethernet eth1 firewall local\ \ ipv6-name 'V6-LOCAL'\nset interfaces ethernet eth2 firewall in name 'INBOUND'\n\ @@ -9,4 +10,4 @@ \ ethernet eth2 firewall local name 'LOCAL' \nset interfaces ethernet eth2\ \ firewall local ipv6-name 'V6-LOCAL'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml index 40a7f4a..d2fd3ee 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set firewall name 'INBOUND'\nset firewall name 'OUTBOUND'\nset firewall\ + lines: + "set firewall name 'INBOUND'\nset firewall name 'OUTBOUND'\nset firewall\ \ name 'LOCAL'\nset firewall ipv6-name 'V6-LOCAL'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml index 38a1800..c95fc00 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml @@ -1,7 +1,8 @@ --- - name: Remove Config vars: - lines: "delete interfaces ethernet eth1 firewall\ndelete interfaces ethernet\ + lines: + "delete interfaces ethernet eth1 firewall\ndelete interfaces ethernet\ \ eth2 firewall\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml index 0844749..da1b02c 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml @@ -4,4 +4,4 @@ lines: "delete firewall name INBOUND\ndelete firewall name OUTBOUND\ndelete\ \ firewall name LOCAL\ndelete firewall ipv6-name V6-LOCAL\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml index 078dd89..f1a0a4d 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -8,12 +9,10 @@ - include_tasks: _populate.yaml - block: - - name: Delete attributes of given firewall rules. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 - name: eth2 @@ -52,7 +51,6 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml index f7db06b..b33aea8 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -8,22 +9,18 @@ - include_tasks: _populate.yaml - block: - - name: Delete firewall interfaces based on IP address type provided. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 access_rules: - - afi: ipv4 - afi: ipv6 - name: eth2 access_rules: - - afi: ipv4 - afi: ipv6 @@ -62,7 +59,6 @@ - "{{ deleted_afi['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml index d85654c..1293f6a 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete all the firewall interfaces. register: result vyos.vyos.vyos_firewall_interfaces: &id001 @@ -48,7 +48,6 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml index f7e91f8..eb42c02 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -8,18 +9,14 @@ - include_tasks: _populate.yaml - block: - - name: Delete firewall interface. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 access_rules: - - afi: ipv4 rules: - - direction: in name: INBOUND state: deleted @@ -57,7 +54,6 @@ - "{{ deleted_single['after'] | symmetric_difference(result['before'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml index 66c49bf..1b9eb34 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces empty_config integration tests on connection={{ + msg: + START vyos_firewall_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml index 01d30b6..5776718 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces overridden integration tests on connection={{ + msg: + START vyos_firewall_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,18 +13,14 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth2 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: out state: overridden @@ -60,7 +57,6 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml index c7032e1..105c647 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces parsed integration tests on connection={{ + msg: + START vyos_firewall_interfaces parsed integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,7 +13,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather firewall_interfaces facts register: firewall_interfaces_facts vyos.vyos.vyos_facts: @@ -29,7 +29,8 @@ - name: Assert that correct parsing done assert: - that: "{{ ansible_facts['network_resources']['firewall_interfaces'] | symmetric_difference(result['parsed'])\ + that: + "{{ ansible_facts['network_resources']['firewall_interfaces'] | symmetric_difference(result['parsed'])\ \ |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) @@ -41,7 +42,6 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml index 022dd50..3283ec6 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml @@ -1,21 +1,18 @@ --- - debug: - msg: START vyos_firewall_interfaces rendered integration tests on connection={{ + msg: + START vyos_firewall_interfaces rendered integration tests on connection={{ ansible_connection }} - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in @@ -27,16 +24,13 @@ - afi: ipv6 rules: - - name: V6-LOCAL direction: local - name: eth2 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in @@ -48,7 +42,6 @@ - afi: ipv6 rules: - - name: V6-LOCAL direction: local state: rendered @@ -68,5 +61,4 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml index b2b0067..d82a0f6 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces replaced integration tests on connection={{ + msg: + START vyos_firewall_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,34 +13,27 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed firewall rules with provided configurations register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 access_rules: - - afi: ipv4 rules: - - name: OUTBOUND direction: out - afi: ipv6 rules: - - name: V6-LOCAL direction: local - name: eth2 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in state: replaced @@ -77,7 +71,6 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml index 9155b7c..ff3abb1 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces round trip integration tests on connection={{ + msg: + START vyos_firewall_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,18 +11,14 @@ - include_tasks: _populate_rule_sets.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_firewall_interfaces: config: - - name: eth1 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in @@ -33,7 +30,6 @@ - afi: ipv6 rules: - - name: V6-LOCAL direction: local state: merged @@ -49,13 +45,10 @@ register: result vyos.vyos.vyos_firewall_interfaces: config: - - name: eth2 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in @@ -67,14 +60,14 @@ - afi: ipv6 rules: - - name: V6-LOCAL direction: local state: merged - name: Assert that changes were applied assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + that: + "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip @@ -85,10 +78,10 @@ - name: Assert that config was reverted assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + that: + "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml |