Skip to content

Commit a5bd9c8

Browse files
KB-perBytepre-commit-ci[bot]nickbhasin
authored
Fix nxos integration tests (#1014)
* Fix nxos_facts and update delegate_to * chore: auto fixes from pre-commit.com hooks * temporary disable file copy tests * check again: fix l3_intf * fix for snmp and nxos_user * chore: auto fixes from pre-commit.com hooks * Remove debugpy * make it to lower case * fix bgp_global sanity * nxos tests config fix * Fix nxos tests * increased timeout * fix_snmp_server tc for network_cli * chore: auto fixes from pre-commit.com hooks * remove timeout * fix ospfv2, ospfv3 and snmp tcs * chore: auto fixes from pre-commit.com hooks * Update conn timeout * fix l3 and add snmp assertions * removed command length assertion * nxapi and l3 tc fix * l3 tc fix * fix tc * increasing timeout for httpapi due to connection failures * increasing timeout * enable nxapi check * asserting if port 80 is enabled after nxapi got disabled is previous test * changed removal strategy for httpapi * simplify snmp tests * chore: auto fixes from pre-commit.com hooks * Disable snmp temp * chore: auto fixes from pre-commit.com hooks * Handle ospf tests --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nikhil Bhasin <nikhilbhasin7@gmail.com>
1 parent 1c3ab70 commit a5bd9c8

File tree

172 files changed

+760
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+760
-510
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bugfixes:
2+
- cisco.nxos.nxos_facts - Fix handling of facts for httapi type connection.
3+
trivial:
4+
- Fix integration tests.

plugins/cliconf/nxos.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ def pull_file(self, command, remotepassword=None):
377377
re.compile(rb"(?i)Too many authentication failures"),
378378
re.compile(rb"Access Denied"),
379379
re.compile(rb"(?i)Copying to\/from this server name is not permitted"),
380+
re.compile(rb"Could not resolve hostname"),
380381
]
381382

382383
# set error regex for copy command

plugins/module_utils/network/nxos/facts/legacy/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def populate(self):
3636

3737
def run(self, command, output="text"):
3838
command_string = command
39-
if output == "json":
39+
if output == "json" and self.capabilities.get("network_api") != "nxapi":
4040
# Not all devices support | json-pretty but is a workaround for
4141
# libssh issue https://github.com/ansible/pylibssh/issues/208
4242
output = "json-pretty"

plugins/module_utils/network/nxos/rm_templates/l3_interfaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __init__(self, lines=None, module=None):
120120
"setval": "ip address"
121121
"{{ ' ' + ipv4.address.address if ipv4.address.address is defined else '' }}"
122122
"{{ ' ' + ipv4.address.ip_network_mask if ipv4.address.ip_network_mask is defined else '' }}"
123-
"{{ ' secondary' if ipv4.address.secondary is defined else '' }}"
123+
"{{ ' secondary' if ipv4.address.secondary | default(False) else '' }}"
124124
"{{ ' route-preference ' + ipv4.address.route_preference|string"
125125
" if ipv4.address.route_preference is defined else '' }}"
126126
"{{ ' tag ' + ipv4.address.tag|string if ipv4.address.tag is defined else '' }}",

tests/integration/labs/inventory.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ ansible_httpapi_port={{ ansible_http_port }}
1313
ansible_become={{ ansible_become | default(true) }}
1414
ansible_become_password={{ ansible_become_password | default('cisco') }}
1515
ansible_command_timeout=200
16+
ansible_connect_timeout=200

tests/integration/targets/nxos_aaa_server/tasks/cli.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
ansible.builtin.find:
44
paths: "{{ role_path }}/tests/common"
55
patterns: "{{ testcase }}.yaml"
6-
connection: local
6+
delegate_to: localhost
77
register: test_cases
88

99
- name: Collect CLI test cases
1010
ansible.builtin.find:
1111
paths: "{{ role_path }}/tests/cli"
1212
patterns: "{{ testcase }}.yaml"
13-
connection: local
13+
delegate_to: localhost
1414
register: cli_cases
1515

1616
- name: Set a fact for 'test_cases'

tests/integration/targets/nxos_aaa_server/tasks/nxapi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
ansible.builtin.find:
44
paths: "{{ role_path }}/tests/common"
55
patterns: "{{ testcase }}.yaml"
6-
connection: local
6+
delegate_to: localhost
77
register: test_cases
88

99
- name: Collect NX-API test cases
1010
ansible.builtin.find:
1111
paths: "{{ role_path }}/tests/nxapi"
1212
patterns: "{{ testcase }}.yaml"
13-
connection: local
13+
delegate_to: localhost
1414
register: nxapi_cases
1515

1616
- name: Set a fact for 'test_cases'

tests/integration/targets/nxos_aaa_server_host/tasks/cli.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
ansible.builtin.find:
44
paths: "{{ role_path }}/tests/common"
55
patterns: "{{ testcase }}.yaml"
6-
connection: local
6+
delegate_to: localhost
77
register: test_cases
88

99
- name: Collect CLI test cases
1010
ansible.builtin.find:
1111
paths: "{{ role_path }}/tests/cli"
1212
patterns: "{{ testcase }}.yaml"
13-
connection: local
13+
delegate_to: localhost
1414
register: cli_cases
1515

1616
- name: Set a fact for 'test_cases'

tests/integration/targets/nxos_aaa_server_host/tasks/nxapi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
ansible.builtin.find:
44
paths: "{{ role_path }}/tests/common"
55
patterns: "{{ testcase }}.yaml"
6-
connection: local
6+
delegate_to: localhost
77
register: test_cases
88

99
- name: Collect NX-API test cases
1010
ansible.builtin.find:
1111
paths: "{{ role_path }}/tests/nxapi"
1212
patterns: "{{ testcase }}.yaml"
13-
connection: local
13+
delegate_to: localhost
1414
register: nxapi_cases
1515

1616
- name: Set a fact for 'test_cases'

tests/integration/targets/nxos_acl_interfaces/tasks/cli.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
ansible.builtin.find:
44
paths: "{{ role_path }}/tests/common"
55
patterns: "{{ testcase }}.yml"
6-
connection: local
6+
delegate_to: localhost
77
register: test_cases
88

99
- name: Collect CLI test cases
1010
ansible.builtin.find:
1111
paths: "{{ role_path }}/tests/cli"
1212
patterns: "{{ testcase }}.yml"
13-
connection: local
13+
delegate_to: localhost
1414
register: cli_cases
1515

1616
- name: Set a fact for 'test_cases'

0 commit comments

Comments
 (0)