summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRohit Thakur <rohitthakur2590@outlook.com>2020-05-06 20:20:08 +0530
committerRohit Thakur <rohitthakur2590@outlook.com>2020-05-06 20:20:08 +0530
commit3ab82e0e018bf0ca02f14391d03e15b3c259da0a (patch)
tree2181da8342fbe2d47b46ff78b4ca532ed68c3f34 /tests
parent77e8b041b2983415ac36eb6264f6e385ac87b074 (diff)
downloadvyos.vyos-3ab82e0e018bf0ca02f14391d03e15b3c259da0a.tar.gz
vyos.vyos-3ab82e0e018bf0ca02f14391d03e15b3c259da0a.zip
linters fix
Signed-off-by: Rohit Thakur <rohitthakur2590@outlook.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/targets/vyos_static_routes/tests/cli/deleted.yaml62
-rw-r--r--tests/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml68
-rw-r--r--tests/integration/targets/vyos_static_routes/vars/main.yaml26
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_static_routes.py12
4 files changed, 3 insertions, 165 deletions
diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/deleted.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/deleted.yaml
deleted file mode 100644
index 7f098f5..0000000
--- a/tests/integration/targets/vyos_static_routes/tests/cli/deleted.yaml
+++ /dev/null
@@ -1,62 +0,0 @@
----
-- debug:
- msg: Start vyos_static_routes deleted integration tests ansible_connection={{
- ansible_connection }}
-
-- include_tasks: _populate.yaml
-
-- block:
-
- - name: Delete static route based on destiation.
- register: result
- vyos.vyos.vyos_static_routes: &id001
- config:
-
- - address_families:
-
- - afi: ipv4
- routes:
-
- - dest: 192.0.2.32/28
-
- - afi: ipv6
- routes:
-
- - dest: 2001:db8:1000::/36
- state: deleted
-
- - name: Assert that the before dicts were correctly generated
- assert:
- that:
- - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
-
- - name: Assert that the correct set of commands were generated
- assert:
- that:
- - "{{ deleted_dest['commands'] | symmetric_difference(result['commands'])\
- \ |length == 0 }}"
-
- - name: Assert that the after dicts were correctly generated
- assert:
- that:
- - "{{ deleted_dest['after'] | symmetric_difference(result['after']) |length\
- \ == 0 }}"
-
- - name: Delete attributes of given interfaces (IDEMPOTENT)
- register: result
- vyos.vyos.vyos_static_routes: *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_dest['after'] | symmetric_difference(result['before']) |length\
- \ == 0 }}"
- always:
-
- - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml
deleted file mode 100644
index f6075d2..0000000
--- a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml
+++ /dev/null
@@ -1,68 +0,0 @@
----
-- debug:
- msg: Start vyos_static_routes deleted integration tests ansible_connection={{
- ansible_connection }}
-
-- include_tasks: _populate.yaml
-
-- block:
-
- - name: Delete static route based on next_hop.
- register: result
- vyos.vyos.vyos_static_routes: &id001
- config:
-
- - address_families:
-
- - afi: ipv4
- routes:
-
- - dest: 192.0.2.32/28
- next_hops:
-
- - forward_router_address: 192.0.2.9
-
- - afi: ipv6
- routes:
-
- - dest: 2001:db8:1000::/36
- next_hops:
-
- - forward_router_address: 2001:db8:2000:2::1
- state: deleted
-
- - name: Assert that the before dicts were correctly generated
- assert:
- that:
- - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
-
- - name: Assert that the correct set of commands were generated
- assert:
- that:
- - "{{ deleted_nh['commands'] | symmetric_difference(result['commands'])\
- \ |length == 0 }}"
-
- - name: Assert that the after dicts were correctly generated
- assert:
- that:
- - "{{ deleted_nh['after'] | symmetric_difference(result['after']) |length\
- \ == 0 }}"
-
- - name: Delete attributes of given interfaces (IDEMPOTENT)
- register: result
- vyos.vyos.vyos_static_routes: *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_nh['after'] | symmetric_difference(result['before']) |length\
- \ == 0 }}"
- always:
-
- - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_static_routes/vars/main.yaml b/tests/integration/targets/vyos_static_routes/vars/main.yaml
index 93b875f..6ce4cea 100644
--- a/tests/integration/targets/vyos_static_routes/vars/main.yaml
+++ b/tests/integration/targets/vyos_static_routes/vars/main.yaml
@@ -94,31 +94,7 @@ rendered:
- set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
- set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
- set protocols static route6 2001:db8:1000::/36
-deleted_dest:
- commands:
- - delete protocols static route 192.0.2.32/28
- - delete protocols static route6 2001:db8:1000::/36
- after: []
-deleted_nh:
- commands:
- - delete protocols static route 192.0.2.32/28 next-hop '192.0.2.9'
- - delete protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
- after:
- - address_families:
- - afi: ipv4
- routes:
- - dest: 192.0.2.32/28
- blackhole_config:
- type: blackhole
- next_hops:
- - forward_router_address: 192.0.2.10
- - afi: ipv6
- routes:
- - dest: 2001:db8:1000::/36
- blackhole_config:
- distance: 2
- next_hops:
- - forward_router_address: 2001:db8:2000:2::2
+
deleted_afi_all:
commands:
- delete protocols static route
diff --git a/tests/unit/modules/network/vyos/test_vyos_static_routes.py b/tests/unit/modules/network/vyos/test_vyos_static_routes.py
index 3646d61..85c0842 100644
--- a/tests/unit/modules/network/vyos/test_vyos_static_routes.py
+++ b/tests/unit/modules/network/vyos/test_vyos_static_routes.py
@@ -277,17 +277,9 @@ class TestVyosStaticRoutesModule(TestVyosModule):
def test_vyos_static_routes_deleted(self):
set_module_args(
dict(
- config=[
- dict(
- address_families=[
- dict(
- afi="ipv4", routes=[dict(dest="192.0.2.32/28")]
- )
- ]
- )
- ],
+ config=[dict(address_families=[dict(afi="ipv4")])],
state="deleted",
)
)
- commands = ["delete protocols static route 192.0.2.32/28"]
+ commands = ["delete protocols static route"]
self.execute_module(changed=True, commands=commands)