diff options
author | Rohit Thakur <rohitthakur2590@outlook.com> | 2020-05-11 13:16:30 +0530 |
---|---|---|
committer | Rohit Thakur <rohitthakur2590@outlook.com> | 2020-05-11 19:29:55 +0530 |
commit | b0a8d123261afeaca84089fd51d2714ff3b088ed (patch) | |
tree | 01e052edf8ba16c228f719469164247fdcafb0ef /tests/integration | |
parent | 7e32c63e6d065062b4540b9bf467989ee86e1f2a (diff) | |
download | vyos-ansible-old-b0a8d123261afeaca84089fd51d2714ff3b088ed.tar.gz vyos-ansible-old-b0a8d123261afeaca84089fd51d2714ff3b088ed.zip |
comments ncorporated
Signed-off-by: Rohit Thakur <rohitthakur2590@outlook.com>
Diffstat (limited to 'tests/integration')
6 files changed, 198 insertions, 261 deletions
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/delete_single.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/delete_single.yaml deleted file mode 100644 index 150242a..0000000 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/delete_single.yaml +++ /dev/null @@ -1,57 +0,0 @@ ---- -- debug: - msg: Start vyos_ospfv2 deleted integration tests ansible_connection={{ - ansible_connection }} - -- include_tasks: _populate.yaml - -- block: - - - name: Delete attributes of ospfv2. - register: result - vyos.vyos.vyos_ospfv2: &id001 - config: - log_adjacency_changes: 'detail' - max_metric: - default_information: - mpls_te: - neighbor: - redistribute: - parameters: - passive_interface: - areas: - state: deleted - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate == result['before'] }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted_single['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted_single['after'] == result['after'] }}" - - - name: Delete attributes of given interfaces (IDEMPOTENT) - register: result - vyos.vyos.vyos_ospfv2: *id001 - - - name: Assert that the previous task was idempotent - assert: - that: - - result.changed == false - - result.commands|length == 0 - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted_single['after'] == result['before'] }}" - always: - - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml index 22c378b..bc5e1e2 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ospfv2/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_ospfv2: &id001 + vyos.vyos.vyos_ospfv2: config: state: gathered @@ -19,15 +19,6 @@ assert: that: - "{{ populate == result['gathered'] }}" - - - name: Gather the existing running configuration (IDEMPOTENT) - register: result - vyos.vyos.vyos_ospfv2: *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_ospfv2/tests/cli/merged_update.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml index 453dbb0..9b6823c 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml @@ -67,4 +67,4 @@ - "{{ merged_update['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml
\ No newline at end of file + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml index 6fbe2f9..cfa29f9 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml @@ -3,39 +3,13 @@ msg: START vyos_ospfv2 parsed integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - - name: Gather ospfv2 facts - register: ospfv2_facts - vyos.vyos.vyos_facts: - gather_subset: - - default - gather_network_resources: - - ospfv2 - - - name: Provide the running configuration for parsing (config to be parsed) - register: result - vyos.vyos.vyos_ospfv2: &id001 - running_config: "{{ lookup('file', '_parsed_config.cfg') }}" - state: parsed - - - name: Assert that correct parsing done - assert: - that: "{{ ansible_facts['network_resources']['ospfv2'] == result['parsed']\ - \ }}" - - - name: Gather the existing running configuration (IDEMPOTENT) - register: result - vyos.vyos.vyos_ospfv2: *id001 - - - name: Assert that the previous task was idempotent - assert: - that: - - result['changed'] == false - always: - - - include_tasks: _remove_config.yaml +- name: Parse externally provided ospfv2 config to agnostic model + register: result + vyos.vyos.vyos_ospfv2: + running_config: "{{ lookup('file', '_parsed_config.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ parsed['after'] == result['parsed'] }}" diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml index 86c07cf..8a805a6 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ospfv2/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_ospfv2: &id001 + vyos.vyos.vyos_ospfv2: config: log_adjacency_changes: 'detail' max_metric: @@ -74,15 +72,5 @@ that: - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ \ |length == 0 }}" - - - name: Structure provided configuration into device specific commands (IDEMPOTENT) - register: result - vyos.vyos.vyos_ospfv2: *id001 - - - name: Assert that the previous task was idempotent - assert: - that: - - result['changed'] == false - always: - - - include_tasks: _remove_config.yaml +- debug: + msg: END vyos_ospfv2 rendered integration tests on connection={{ ansible_connection }} diff --git a/tests/integration/targets/vyos_ospfv2/vars/main.yaml b/tests/integration/targets/vyos_ospfv2/vars/main.yaml index 76a54e3..e55da20 100644 --- a/tests/integration/targets/vyos_ospfv2/vars/main.yaml +++ b/tests/integration/targets/vyos_ospfv2/vars/main.yaml @@ -1,6 +1,6 @@ --- merged: - before: [] + before: {} commands: - set protocols ospf mpls-te enable - set protocols ospf mpls-te router-address '192.0.11.11' @@ -39,63 +39,6 @@ merged: - set protocols ospf area '4' - set protocols ospf area 4 network 192.0.2.0/24 after: - areas: - - area_id: '2' - area_type: - normal: true - authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' - area_type: - nssa: - set: true - - area_id: '4' - area_type: - stub: - default_cost: 20 - set: true - network: - - address: '192.0.2.0/24' - range: - - address: '192.0.3.0/24' - cost: 10 - - address: '192.0.4.0/24' - cost: 12 - auto_cost: - reference_bandwidth: 2 - default_information: - originate: - always: true - metric: 10 - metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' - max_metric: - router_lsa: - administrative: true - on_shutdown: 10 - on_startup: 10 - mpls_te: - enabled: true - router_address: '192.0.11.11' - neighbor: - - neighbor_id: '192.0.11.12' - poll_interval: 10 - priority: 2 - parameters: - abr_type: 'cisco' - opaque_lsa: true - rfc1583_compatibility: true - router_id: '192.0.1.1' - passive_interface: - - 'eth2' - - 'eth1' - redistribute: - - metric: 10 - metric_type: 2 - route_type: 'bgp' -merged_update: - before: areas: - area_id: '2' area_type: @@ -145,13 +88,14 @@ merged_update: rfc1583_compatibility: true router_id: '192.0.1.1' passive_interface: - - 'eth2' - 'eth1' + - 'eth2' redistribute: - metric: 10 metric_type: 2 route_type: 'bgp' - after: +merged_update: + before: areas: - area_id: '2' area_type: @@ -163,10 +107,12 @@ merged_update: nssa: set: true - area_id: '4' + area_type: + stub: + default_cost: 20 + set: true network: - address: '192.0.2.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' range: - address: '192.0.3.0/24' cost: 10 @@ -199,17 +145,13 @@ merged_update: rfc1583_compatibility: true router_id: '192.0.1.1' passive_interface: - - 'eth2' - 'eth1' + - 'eth2' redistribute: - metric: 10 metric_type: 2 route_type: 'bgp' - commands: - - delete protocols ospf area 4 area-type stub - - set protocols ospf area 4 network 192.0.22.0/24 - - set protocols ospf area 4 network 192.0.32.0/24 -populate: + after: areas: - area_id: '2' area_type: @@ -221,12 +163,10 @@ populate: nssa: set: true - area_id: '4' - area_type: - stub: - default_cost: 20 - set: true network: - address: '192.0.2.0/24' + - address: '192.0.22.0/24' + - address: '192.0.32.0/24' range: - address: '192.0.3.0/24' cost: 10 @@ -259,12 +199,72 @@ populate: rfc1583_compatibility: true router_id: '192.0.1.1' passive_interface: - - 'eth2' - 'eth1' + - 'eth2' redistribute: - metric: 10 metric_type: 2 route_type: 'bgp' + commands: + - delete protocols ospf area 4 area-type stub + - set protocols ospf area 4 network 192.0.22.0/24 + - set protocols ospf area 4 network 192.0.32.0/24 +populate: + areas: + - area_id: '2' + area_type: + normal: true + authentication: "plaintext-password" + shortcut: 'enable' + - area_id: '3' + area_type: + nssa: + set: true + - area_id: '4' + area_type: + stub: + default_cost: 20 + set: true + network: + - address: '192.0.2.0/24' + range: + - address: '192.0.3.0/24' + cost: 10 + - address: '192.0.4.0/24' + cost: 12 + auto_cost: + reference_bandwidth: 2 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: 'ingress' + log_adjacency_changes: 'detail' + max_metric: + router_lsa: + administrative: true + on_shutdown: 10 + on_startup: 10 + mpls_te: + enabled: true + router_address: '192.0.11.11' + neighbor: + - neighbor_id: '192.0.11.12' + poll_interval: 10 + priority: 2 + parameters: + abr_type: 'cisco' + opaque_lsa: true + rfc1583_compatibility: true + router_id: '192.0.1.1' + passive_interface: + - 'eth1' + - 'eth2' + redistribute: + - metric: 10 + metric_type: 2 + route_type: 'bgp' replaced: commands: - delete protocols ospf passive-interface eth2 @@ -280,57 +280,57 @@ replaced: - set protocols ospf area 4 network 192.0.22.0/24 - set protocols ospf area 4 network 192.0.32.0/24 after: - areas: - - area_id: '2' - area_type: - normal: true - authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '4' - area_type: - stub: - default_cost: 20 - set: true - network: - - address: '192.0.12.0/24' - - address: '192.0.2.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' - range: - - address: '1.1.2.0/24' - cost: 10 - auto_cost: - reference_bandwidth: 2 - default_information: - originate: - always: true - metric: 10 - metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' - max_metric: - router_lsa: - administrative: true - on_shutdown: 10 - on_startup: 10 - mpls_te: - enabled: true - router_address: '192.0.22.22' - neighbor: - - neighbor_id: '192.0.11.12' - poll_interval: 10 - priority: 2 - parameters: - abr_type: 'cisco' - opaque_lsa: true - rfc1583_compatibility: true - router_id: '192.0.1.1' - passive_interface: - - 'eth1' - redistribute: - - metric: 10 - metric_type: 2 - route_type: 'bgp' + areas: + - area_id: '2' + area_type: + normal: true + authentication: "plaintext-password" + shortcut: 'enable' + - area_id: '4' + area_type: + stub: + default_cost: 20 + set: true + network: + - address: '192.0.12.0/24' + - address: '192.0.2.0/24' + - address: '192.0.22.0/24' + - address: '192.0.32.0/24' + range: + - address: '1.1.2.0/24' + cost: 10 + auto_cost: + reference_bandwidth: 2 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: 'ingress' + log_adjacency_changes: 'detail' + max_metric: + router_lsa: + administrative: true + on_shutdown: 10 + on_startup: 10 + mpls_te: + enabled: true + router_address: '192.0.22.22' + neighbor: + - neighbor_id: '192.0.11.12' + poll_interval: 10 + priority: 2 + parameters: + abr_type: 'cisco' + opaque_lsa: true + rfc1583_compatibility: true + router_id: '192.0.1.1' + passive_interface: + - 'eth1' + redistribute: + - metric: 10 + metric_type: 2 + route_type: 'bgp' rendered: commands: - set protocols ospf mpls-te enable @@ -369,26 +369,67 @@ rendered: - set protocols ospf area 4 area-type stub default-cost 20 - set protocols ospf area '4' - set protocols ospf area 4 network 192.0.2.0/24 -deleted_single: - commands: - - delete protocols ospf mpls-te - - delete protocols ospf redistribute - - delete protocols ospf auto-cost - - delete protocols ospf passive-interface - - delete protocols ospf parameters - - delete protocols ospf default-information - - delete protocols ospf max-metric - - delete protocols ospf log-adjacency-changes - - delete protocols ospf neighbor - - delete protocols ospf area 2 - - delete protocols ospf area 3 - - delete protocols ospf area 4 - - delete protocols ospf area - after: [] +parsed: + after: + areas: + - area_id: '2' + area_type: + normal: true + authentication: "plaintext-password" + shortcut: 'enable' + - area_id: '3' + area_type: + nssa: + set: true + - area_id: '4' + area_type: + stub: + default_cost: 20 + set: true + network: + - address: '192.0.2.0/24' + range: + - address: '192.0.3.0/24' + cost: 10 + - address: '192.0.4.0/24' + cost: 12 + auto_cost: + reference_bandwidth: 2 + default_information: + originate: + always: true + metric: 10 + metric_type: 2 + route_map: 'ingress' + log_adjacency_changes: 'detail' + max_metric: + router_lsa: + administrative: true + on_shutdown: 10 + on_startup: 10 + mpls_te: + enabled: true + router_address: '192.0.11.11' + neighbor: + - neighbor_id: '192.0.11.12' + poll_interval: 10 + priority: 2 + parameters: + abr_type: 'cisco' + opaque_lsa: true + rfc1583_compatibility: true + router_id: '192.0.1.1' + passive_interface: + - 'eth1' + - 'eth2' + redistribute: + - metric: 10 + metric_type: 2 + route_type: 'bgp' deleted: commands: - 'delete protocols ospf' - after: [] + after: {} round_trip: after: areas: |