From c216473c82a0b0fbd62cff1b05ab45b1b9803063 Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Thu, 25 Jan 2018 12:26:17 +0530 Subject: [PATCH] Fix ios integration test failures (#35333) --- lib/ansible/modules/network/ios/ios_interface.py | 2 +- .../targets/ios_l3_interface/tests/cli/basic.yaml | 10 ++++++++++ .../targets/ios_static_route/tests/cli/basic.yaml | 14 ++++++++++++++ .../tests/cli/net_static_route.yaml | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/ios/ios_interface.py b/lib/ansible/modules/network/ios/ios_interface.py index 34ad10ee8f6..1af44f489b2 100644 --- a/lib/ansible/modules/network/ios/ios_interface.py +++ b/lib/ansible/modules/network/ios/ios_interface.py @@ -184,7 +184,7 @@ def validate_param_values(module, obj, param=None): def parse_shutdown(configobj, name): cfg = configobj['interface %s' % name] cfg = '\n'.join(cfg.children) - match = re.search(r'shutdown', cfg, re.M) + match = re.search(r'^shutdown', cfg, re.M) if match: return True else: diff --git a/test/integration/targets/ios_l3_interface/tests/cli/basic.yaml b/test/integration/targets/ios_l3_interface/tests/cli/basic.yaml index cb8f22a3f47..a2d9708168b 100644 --- a/test/integration/targets/ios_l3_interface/tests/cli/basic.yaml +++ b/test/integration/targets/ios_l3_interface/tests/cli/basic.yaml @@ -8,6 +8,16 @@ authorize: yes register: result +- name: Setup - Ensure interfaces are switchport + ios_config: + lines: + - no shutdown + parents: + - "interface {{ item }}" + loop: + - "{{ test_interface }}" + - "{{ test_interface2 }}" + - name: Configure interface ipv4 address ios_l3_interface: name: "{{ test_interface }}" diff --git a/test/integration/targets/ios_static_route/tests/cli/basic.yaml b/test/integration/targets/ios_static_route/tests/cli/basic.yaml index 5de2c626f53..a39a98b04a3 100644 --- a/test/integration/targets/ios_static_route/tests/cli/basic.yaml +++ b/test/integration/targets/ios_static_route/tests/cli/basic.yaml @@ -1,4 +1,16 @@ --- +- debug: msg="START ios cli/ios_static_route.yaml on connection={{ ansible_connection }}" + +- name: delete static route - setup + net_static_route: + prefix: 172.16.31.0 + mask: 255.255.255.0 + next_hop: 10.0.0.8 + admin_distance: 1 + state: absent + authorize: yes + register: result + - name: create static route ios_static_route: prefix: 172.16.31.0 @@ -127,3 +139,5 @@ that: - 'result.changed == true' - 'result.commands == ["no ip route 172.16.32.0 255.255.255.0 10.0.0.8", "no ip route 172.16.34.0 255.255.255.0 10.0.0.8"]' + +- debug: msg="END ios cli/ios_static_route.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/ios_static_route/tests/cli/net_static_route.yaml b/test/integration/targets/ios_static_route/tests/cli/net_static_route.yaml index 0311f5bf469..1ae5fa30955 100644 --- a/test/integration/targets/ios_static_route/tests/cli/net_static_route.yaml +++ b/test/integration/targets/ios_static_route/tests/cli/net_static_route.yaml @@ -9,7 +9,7 @@ prefix: 172.16.31.0 mask: 255.255.255.0 next_hop: 10.0.0.8 - admin_distance: 2 + admin_distance: 1 state: absent authorize: yes register: result