diff options
Diffstat (limited to 'tests')
4 files changed, 59 insertions, 60 deletions
| diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml index cdc8e51c..59c81aad 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml @@ -9,9 +9,9 @@  - block: -    - name: Merge the provided configuration with the exisiting running configuration +    - name: Gather the provided configuration with the exisiting running configuration        register: result -      vyos.vyos.vyos_firewall_rules: &id001 +      vyos.vyos.vyos_firewall_rules:          config:          state: gathered @@ -21,14 +21,6 @@            - "{{ populate | symmetric_difference(result['gathered']) |length == 0\              \ }}" -    - name: Gather the existing running configuration (IDEMPOTENT) -      register: result -      vyos.vyos.vyos_firewall_rules: *id001 - -    - name: Assert that the previous task was idempotent -      assert: -        that: -          - result['changed'] == false    always:      - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml index a793ac58..bc955249 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml @@ -3,39 +3,14 @@      msg: START vyos_firewall_rules parsed integration tests on connection={{ ansible_connection        }} -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - -    - name: Gather firewall_rules facts -      register: firewall_rules_facts -      vyos.vyos.vyos_facts: -        gather_subset: -          - default -        gather_network_resources: -          - firewall_rules - -    - name: Provide the running configuration for parsing (config to be parsed) -      register: result -      vyos.vyos.vyos_firewall_rules: &id001 -        running_config: "{{ lookup('file', '_parsed_config.cfg') }}" -        state: parsed - -    - name: Assert that correct parsing done -      assert: -        that: "{{ ansible_facts['network_resources']['firewall_rules'] | symmetric_difference(result['parsed'])\ -          \ |length == 0 }}" - -    - name: Gather the existing running configuration (IDEMPOTENT) -      register: result -      vyos.vyos.vyos_firewall_rules: *id001 - -    - name: Assert that the previous task was idempotent -      assert: -        that: -          - result['changed'] == false -  always: - -    - include_tasks: _remove_config.yaml +- name: Parse externally provided Firewall rules config to agnostic model +  register: result +  vyos.vyos.vyos_firewall_rules: +    running_config: "{{ lookup('file', '_parsed_config.cfg') }}" +    state: parsed + +- name: Assert that config was correctly parsed +  assert: +    that: +      - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ +        \ 0 }}" diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml index f000998e..6670fd7b 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml @@ -5,13 +5,11 @@  - include_tasks: _remove_config.yaml -- include_tasks: _populate.yaml -  - block:      - name: Structure provided configuration into device specific commands        register: result -      vyos.vyos.vyos_firewall_rules: &id001 +      vyos.vyos.vyos_firewall_rules:          config:            - afi: ipv6 @@ -60,14 +58,5 @@            - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\              \ |length == 0 }}" -    - name: Structure provided configuration into device specific commands (IDEMPOTENT) -      register: result -      vyos.vyos.vyos_firewall_rules: *id001 - -    - name: Assert that the previous task was idempotent -      assert: -        that: -          - result['changed'] == false -  always: - -    - include_tasks: _remove_config.yaml +- debug: +    msg: END vyos_firewall_rules rendered integration tests on connection={{ ansible_connection }} diff --git a/tests/integration/targets/vyos_firewall_rules/vars/main.yaml b/tests/integration/targets/vyos_firewall_rules/vars/main.yaml index adfc48af..88323bae 100644 --- a/tests/integration/targets/vyos_firewall_rules/vars/main.yaml +++ b/tests/integration/targets/vyos_firewall_rules/vars/main.yaml @@ -196,6 +196,49 @@ overridden:                action: reject                description: Rule 502 is configured by Ansible                ipsec: match-ipsec +parsed: +  after: +    - afi: ipv6 +      rule_sets: +        - name: UPLINK +          description: This is ipv6 specific rule-set +          default_action: accept +          rules: +            - number: 1 +              action: accept +              description: Fwipv6-Rule 1 is configured by Ansible +              ipsec: match-ipsec +            - number: 2 +              action: accept +              description: Fwipv6-Rule 2 is configured by Ansible +              ipsec: match-ipsec +    - afi: ipv4 +      rule_sets: +        - name: INBOUND +          description: IPv4 INBOUND rule set +          default_action: accept +          rules: +            - number: 101 +              action: accept +              description: Rule 101 is configured by Ansible +              ipsec: match-ipsec +            - number: 102 +              action: reject +              description: Rule 102 is configured by Ansible +              ipsec: match-ipsec +            - number: 103 +              action: accept +              description: Rule 103 is configured by Ansible +              destination: +                group: +                  address_group: inbound +              source: +                address: 192.0.2.0 +              state: +                established: true +                new: false +                invalid: false +                related: true  rendered:    commands:      - set firewall ipv6-name UPLINK default-action 'accept' | 
