Repository: ansible/ansible

Issue:
default value for ping count wrong in nxos_ping
<!---
Verify first that your issue/request is not already reported on GitHub.
THIS FORM WILL BE READ BY A MACHINE, COMPLETE ALL SECTIONS AS DESCRIBED.
Also test if the latest release, and devel branch are affected too.
ALWAYS add information AFTER (OUTSIDE) these html comments.
Otherwise it may end up being automatically closed by our bot. -->

##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
<!--- Insert, BELOW THIS COMMENT, the name of the module, plugin, task or feature.
Do not include extra details here, e.g. "vyos_command" not "the network module vyos_command" or the full path-->
nxos_ping
##### ANSIBLE VERSION
<!--- Paste, BELOW THIS COMMENT, verbatim output from "ansible --version" between quotes below -->
```
ansible 2.6.0 (devel fed20b825f) last updated 2018/02/15 12:51:12 (GMT -400)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /root/agents-ci/ansible/lib/ansible
  executable location = /root/agents-ci/ansible/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
```

##### OS / ENVIRONMENT
<!--- Mention, BELOW THIS COMMENT, the OS you are running Ansible from, and the OS you are
managing, or say "N/A" for anything that is not platform-specific.
Also mention the specific version of what you are trying to control,
e.g. if this is a network bug the version of firmware on the network device.-->
Ansible Server : Ubuntu 14.04
Device: N7K running 7.0(3)D1(1)

##### SUMMARY
<!--- Explain the problem briefly -->
There is a minor issue with nxos_ping module.
The default value for count parameter is given as 2. Instead it is 5 on all platforms.

Note: I will open a PR shortly to address this issue.



Discussion:

Resolving patch:
diff --git a/lib/ansible/modules/network/nxos/nxos_ping.py b/lib/ansible/modules/network/nxos/nxos_ping.py
--- a/lib/ansible/modules/network/nxos/nxos_ping.py
+++ b/lib/ansible/modules/network/nxos/nxos_ping.py
@@ -43,10 +43,10 @@
     count:
         description:
             - Number of packets to send.
-        default: 2
+        default: 5
     source:
         description:
-            - Source IP Address.
+            - Source IP Address or hostname (resolvable by switch)
     vrf:
         description:
             - Outgoing VRF.
@@ -178,7 +178,7 @@ def get_ping_results(command, module):
 def main():
     argument_spec = dict(
         dest=dict(required=True),
-        count=dict(required=False, default=2),
+        count=dict(required=False, default=5),
         vrf=dict(required=False),
         source=dict(required=False),
         state=dict(required=False, choices=['present', 'absent'], default='present'),
@@ -195,9 +195,6 @@ def main():
     count = module.params['count']
     state = module.params['state']
 
-    if count and not 1 <= int(count) <= 655350:
-        module.fail_json(msg="'count' must be an integer between 1 and 655350.", count=count)
-
     ping_command = 'ping {0}'.format(destination)
     for command in ['count', 'source', 'vrf']:
         arg = module.params[command]


Test patch: