From e1c29bf3b6e0ba4887693fcc347d8887051aa148 Mon Sep 17 00:00:00 2001 From: Rohit Thakur Date: Wed, 28 Apr 2021 17:39:24 +0530 Subject: VyOS: available_network_resources implemented in vyos_facts (#148) VyOS: available_network_resources implemented in vyos_facts Reviewed-by: https://github.com/apps/ansible-zuul --- .../targets/vyos_facts/tests/cli/basic_facts.yaml | 13 +++++++++++++ tests/unit/modules/network/vyos/test_vyos_ping.py | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml index 5802f73..ede7ca2 100644 --- a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml +++ b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml @@ -40,3 +40,16 @@ that: - result.ansible_facts.ansible_net_commits is defined - result.ansible_facts.ansible_net_config is defined + +- name: Get list of avaliable network resources for VyOS + register: result + vyos.vyos.vyos_facts: + available_network_resources: true + gather_network_resources: all + +- name: Assert that correct available_resources_list returned + assert: + that: + - result.changed == false + - "{{ result['ansible_facts']['available_network_resources'] | symmetric_difference(result['ansible_facts']['ansible_net_gather_network_resources']) |length\ + \ == 0 }}" diff --git a/tests/unit/modules/network/vyos/test_vyos_ping.py b/tests/unit/modules/network/vyos/test_vyos_ping.py index e307610..f3ba2ee 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ping.py +++ b/tests/unit/modules/network/vyos/test_vyos_ping.py @@ -56,22 +56,22 @@ class TestVyosPingModule(TestVyosModule): self.run_commands.side_effect = load_from_file def test_vyos_ping_expected_success(self): - """ Test for successful pings when destination should be reachable """ + """Test for successful pings when destination should be reachable""" set_module_args(dict(count=2, dest="10.10.10.10")) self.execute_module() def test_vyos_ping_expected_failure(self): - """ Test for unsuccessful pings when destination should not be reachable """ + """Test for unsuccessful pings when destination should not be reachable""" set_module_args(dict(count=4, dest="10.10.10.20", state="absent")) self.execute_module() def test_vyos_ping_unexpected_success(self): - """ Test for successful pings when destination should not be reachable - FAIL. """ + """Test for successful pings when destination should not be reachable - FAIL.""" set_module_args(dict(count=2, dest="10.10.10.10", state="absent")) self.execute_module(failed=True) def test_vyos_ping_unexpected_failure(self): - """ Test for unsuccessful pings when destination should be reachable - FAIL. """ + """Test for unsuccessful pings when destination should be reachable - FAIL.""" set_module_args(dict(count=4, dest="10.10.10.20")) self.execute_module(failed=True) -- cgit v1.2.3