From db43fe6a765412cb0b1a46f0d17563d3672cb63b Mon Sep 17 00:00:00 2001 From: saichint Date: Tue, 27 Feb 2018 21:15:50 -0800 Subject: [PATCH] nxos_facts fix and integration tests (#36796) * fix nxos_facts ipv6 error * time_range not supported for N35 --- lib/ansible/modules/network/nxos/nxos_facts.py | 6 +++++- test/integration/targets/nxos_acl/tests/common/sanity.yaml | 2 +- test/integration/targets/nxos_command/tests/cli/sanity.yaml | 1 - .../targets/nxos_command/tests/nxapi/sanity.yaml | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_facts.py b/lib/ansible/modules/network/nxos/nxos_facts.py index b4a8ddfe8fc..e27ada941be 100644 --- a/lib/ansible/modules/network/nxos/nxos_facts.py +++ b/lib/ansible/modules/network/nxos/nxos_facts.py @@ -409,7 +409,11 @@ class Interfaces(FactsBase): name = item['ROW_intf']['intf-name'] intf = self.facts['interfaces'][name] intf['ipv6'] = self.transform_dict(item, self.INTERFACE_IPV6_MAP) - self.facts['all_ipv6_addresses'].append(item['ROW_intf']['addr']) + try: + addr = item['ROW_intf']['addr'] + except KeyError: + addr = item['ROW_intf']['TABLE_addr']['ROW_addr']['addr'] + self.facts['all_ipv6_addresses'].append(addr) else: return "" except TypeError: diff --git a/test/integration/targets/nxos_acl/tests/common/sanity.yaml b/test/integration/targets/nxos_acl/tests/common/sanity.yaml index 56bdac267dd..1bf3cb969fc 100644 --- a/test/integration/targets/nxos_acl/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_acl/tests/common/sanity.yaml @@ -4,7 +4,7 @@ when: ansible_connection == "local" - set_fact: time_range="ans-range" - when: not ( platform is match("N5K")) + when: not (platform is match("N5K")) and not (platform is match("N35")) - name: "Setup: Cleanup possibly existing acl." nxos_acl: &remove diff --git a/test/integration/targets/nxos_command/tests/cli/sanity.yaml b/test/integration/targets/nxos_command/tests/cli/sanity.yaml index 465deadd033..fc14d2d8cb3 100644 --- a/test/integration/targets/nxos_command/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_command/tests/cli/sanity.yaml @@ -21,7 +21,6 @@ - assert: &fail that: - "result.failed == true" - - "'Invalid command' in result.msg" - name: "Enable feature BGP" nxos_feature: diff --git a/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml index 9fea97b6f72..f3d964a2dc5 100644 --- a/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml @@ -21,7 +21,6 @@ - assert: &fail that: - "result.failed == true" - - "'Input CLI command error' in result.msg" - name: "Enable feature BGP" nxos_feature: