Repository: ansible/ansible

Issue:
nxos_pim_interface: 'border' and 'isauth' properties are not idempotent for N1 images.
<!---
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release, and master branch are affected too.
-->

##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
 - Bug Report

##### COMPONENT NAME
<!--- Name of the module/plugin/task/feature -->
- nxos_pim_interface

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes below -->
```
ansible 2.4.0.0 (detached HEAD d14467b029) last updated 2017/09/28 13:41:53 (GMT -400)
  config file = None
  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 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.
-->
Ubuntu 14.04

##### SUMMARY
<!--- Explain the problem briefly -->
on N1 images these properties return 'TRUE' and 'FALSE' in caps and hence fail string equality and hence are not idempotent.

##### STEPS TO REPRODUCE
<!---
For bugs, show exactly how to reproduce the problem, using a minimal test-case.
For new features, show how the feature would be used.
-->

<!--- Paste example playbooks or commands between quotes below -->
```yaml
  - name: configure state default
    nxos_pim_interface: &configdefault
      interface: "{{ testint }}"
      state: default
      provider: "{{ connection }}"
    register: result

  - assert: *true

  - name: Check idempotence
    nxos_pim_interface: *configdefault
    register: result

  - assert: *false
```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- What did you expect to happen when running the steps above? -->
Playbook to pass.

##### ACTUAL RESULTS
<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes below -->
```
TASK [nxos_pim_interface : Check idempotence] *************************************************************************************************************
task path: /root/agents-ci/ansible/test/integration/targets/nxos_pim_interface/tests/common/sanity.yaml:89
<n5k-xxx.example.com> connection transport is cli
<n5k-xxx.example.com> using connection plugin network_cli
<n5k-xxx.example.com> socket_path: /root/.ansible/pc/1b4e3e6315
Using module file /root/agents-ci/ansible/lib/ansible/modules/network/nxos/nxos_pim_interface.py
<n5k-xxx.example.com> ESTABLISH LOCAL CONNECTION FOR USER: root
<n5k-xxx.example.com> EXEC /bin/sh -c 'echo ~ && sleep 0'
<n5k-xxx.example.com> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1506021593.01-245428798708229 `" && echo ansible-tmp-1506021593.01-245428798708229="` echo /root/.ansible/tmp/ansible-tmp-1506021593.01-245428798708229 `" ) && sleep 0'
<n5k-xxx.example.com> PUT /tmp/tmppFThNr TO /root/.ansible/tmp/ansible-tmp-1506021593.01-245428798708229/nxos_pim_interface.py
<n5k-xxx.example.com> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1506021593.01-245428798708229/ /root/.ansible/tmp/ansible-tmp-1506021593.01-245428798708229/nxos_pim_interface.py && sleep 0'
<n5k-xxx.example.com> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1506021593.01-245428798708229/nxos_pim_interface.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1506021593.01-245428798708229/" > /dev/null 2>&1 && sleep 0'
changed: [n5k-xxx.example.com] => {
    "changed": true,
    "commands": [
        "interface Ethernet1/2",
        "no ip pim border"
    ],
    "failed": false,
    "invocation": {
        "module_args": {
            "border": null,
            "dr_prio": null,
            "hello_auth_key": null,
            "hello_interval": null,
            "host": "n5k-xxx.example.com",
            "interface": "Ethernet1/2",
            "jp_policy_in": null,
            "jp_policy_out": null,
            "jp_type_in": null,
            "jp_type_out": null,
            "neighbor_policy": null,
            "neighbor_type": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": null,
            "provider": {
                "host": "n5k-xxx.example.com",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "cli",
                "use_ssl": null,
                "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "validate_certs": null
            },
            "sparse": true,
            "ssh_keyfile": null,
            "state": "default",
            "timeout": null,
            "transport": "cli",
            "use_ssl": null,
            "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "validate_certs": null
        }
    }
}

TASK [nxos_pim_interface : assert] ************************************************************************************************************************
task path: /root/agents-ci/ansible/test/integration/targets/nxos_pim_interface/tests/common/sanity.yaml:93
FAILED! => {
    "assertion": "result.changed == false",
    "changed": false,
    "evaluated_to": false,
    "failed": true
}
```



Discussion:
cc @GGabriele @jedelman8 @mikewiebe @privateip @rcarrillocruz @trishnaguha
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/modules/network/nxos/nxos_config.py b/lib/ansible/modules/network/nxos/nxos_config.py
--- a/lib/ansible/modules/network/nxos/nxos_config.py
+++ b/lib/ansible/modules/network/nxos/nxos_config.py
@@ -227,7 +227,7 @@
 - name: diff the running-config against a provided config
   nxos_config:
     diff_against: intended
-    intended: "{{ lookup('file', 'master.cfg') }}"
+    intended_config: "{{ lookup('file', 'master.cfg') }}"
 
 - nxos_config:
     lines:
diff --git a/lib/ansible/modules/network/nxos/nxos_pim_interface.py b/lib/ansible/modules/network/nxos/nxos_pim_interface.py
--- a/lib/ansible/modules/network/nxos/nxos_pim_interface.py
+++ b/lib/ansible/modules/network/nxos/nxos_pim_interface.py
@@ -298,12 +298,14 @@ def get_pim_interface(module, interface):
         pim_interface['hello_interval'] = str(hello_interval_msec)
 
     border = get_data.get('is-border')
+    border = border.lower() if border else border
     if border == 'true':
         pim_interface['border'] = True
     elif border == 'false':
         pim_interface['border'] = False
 
     isauth = get_data.get('isauth-config')
+    isauth = isauth.lower() if isauth else isauth
     if isauth == 'true':
         pim_interface['isauth'] = True
     elif isauth == 'false':


Test patch: