Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nx-feature module uses incorrect feature name for "port-security" #25608

Closed
ghost opened this issue Jun 12, 2017 · 8 comments
Closed

nx-feature module uses incorrect feature name for "port-security" #25608

ghost opened this issue Jun 12, 2017 · 8 comments
Assignees
Labels
affects_2.3 This issue/PR affects Ansible v2.3 cisco Cisco technologies feature This issue/PR relates to a feature request. networking Network category nxos Cisco NXOS community support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
Milestone

Comments

@ghost
Copy link

ghost commented Jun 12, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

nx-feature

ANSIBLE VERSION
ansible 2.3.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
CONFIGURATION
OS / ENVIRONMENT
SUMMARY
STEPS TO REPRODUCE
  tasks:
  - name: Disable Port Security
    nxos_feature:
      feature: port-security
      state: disabled
      transport: cli
EXPECTED RESULTS

I expected to get something similar to below, confirming that the settings was completed successfully. Example below is for "sftp-server" feature.

ACTUAL RESULTS

Received a failed message along with a list of available features that can be enabled/disabled on the device. "port-security" is listed as one of the features, and it can be enabled/disabled on the device via command line. Error indicates that the features is interpreted and sent as "eth_port_sec" instead of "port-security".

Looking at /usr/lib/python2.7/dist-packages/ansible/modules/network/nxos/nxos_feature.py, it looks like "port-security" gets mapped to "eth_port_sec" for some reason. This may have changed names in nx-os, but it should be literally interpreted as "port-security".

open_shell() returned 0 ok
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/network/nxos/nxos_feature.py
<IP> ESTABLISH LOCAL CONNECTION FOR USER: <user>
<IP> EXEC /bin/sh -c 'echo ~ && sleep 0'
<IP> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/<user>/.ansible/tmp/ansible-tmp-1497281535.61-130722979343259 `" && echo ansible-tmp-1497281535.61-1307229793432
59="` echo /home/<user>/.ansible/tmp/ansible-tmp-1497281535.61-130722979343259 `" ) && sleep 0'
<IP> PUT /tmp/tmplqA8oS TO /home/<user>/.ansible/tmp/ansible-tmp-1497281535.61-130722979343259/nxos_feature.py
<IP> EXEC /bin/sh -c 'chmod u+x /home/<user>/.ansible/tmp/ansible-tmp-1497281535.61-130722979343259/ /home/<user>/.ansible/tmp/ansible-tmp-1497281535.61-130722979343259/n
xos_feature.py && sleep 0'
<IP> EXEC /bin/sh -c '/usr/bin/python /home/<user>/.ansible/tmp/ansible-tmp-1497281535.61-130722979343259/nxos_feature.py; rm -rf "/home/<user>/.ansible/tmp/ansible-tmp-1
497281535.61-130722979343259/" > /dev/null 2>&1 && sleep 0'
fatal: [<hostename]: FAILED! => {
    "changed": false,
    "failed": true,
    "features_currently_supported": {
        "bulkstat": "disabled",
        "cimserver": "disabled",
        "cluster": "disabled",
        "congestion-isolation": "disabled",
        "dpvm": "disabled",
        "elo": "disabled",
        "evmed": "disabled",
        "fabric-access": "disabled",
        "fabric-binding": "disabled",
        "fcsp": "disabled",
        "fport-channel-trunk": "enabled",
        "http-server": "enabled",
        "isapi": "disabled",
        "ivr": "disabled",
        "ldap": "disabled",
        "license-smart": "disabled",
        "npiv": "enabled",
        "npv": "disabled",
        "nxapi": "enabled",
        "onep": "disabled",
        "poap": "disabled",
        "port-security": "disabled",
        "port_track": "disabled",
        "privilege": "disabled",
        "qos-manager": "disabled",
        "scheduler": "disabled",
        "scpServer": "disabled",
        "sdv": "disabled",
        "sfm": "disabled",
        "sftpServer": "enabled",
        "sshServer": "enabled",
        "tacacs": "disabled",
        "telnetServer": "disabled",
        "tpc": "disabled"
    },
    "invalid_feature": "eth_port_sec",
    "invocation": {
        "module_args": {
            "config": null,
            "feature": "port-security",
            "host": null,
            "include_defaults": null,
            "password": null,
            "port": null,
            "provider": null,
            "save": null,
            "ssh_keyfile": null,
            "state": "disabled",
            "timeout": null,
            "transport": "cli",
            "use_ssl": null,
            "username": null,
            "validate_certs": null
        }
    },
    "msg": "Invalid feature name."
@ghost
Copy link
Author

ghost commented Jun 12, 2017

Verified this behavior by commenting out 2 lines with "eth_port_sec" in them in file /usr/lib/python2.7/dist-packages/ansible/modules/network/nxos/nxos_feature.py and re-running playbook, which completes successfully.

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 bug_report module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Jun 12, 2017
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Jun 12, 2017
@ghost
Copy link
Author

ghost commented Jun 13, 2017

other option is to switch the order of the mapping so both "eth_port_sec" and "port-security" both get mapped to "port-security" when the command is actually sent to the device. That may have been the original intent.

@trishnaguha trishnaguha added the networking Network category label Jun 13, 2017
@trishnaguha trishnaguha self-assigned this Jun 16, 2017
@trishnaguha
Copy link
Member

@patbdti I am unable to reproduce the issue.

@ghost
Copy link
Author

ghost commented Jun 28, 2017

@trishnaguha - I have verified the issue this morning using a Cisco MDS9148S switch running NX-OS 8.1(1) and ansible 2.3.1.0. If I try to enable feature "port-security" using the nxos_feature module, ansible tries to enable the "eth_port_sec" feature, which doesn't exist on the switch. I don't know if that feature exists on other nx-os devices, but if definitely does not on my switches.

@ansibot ansibot added the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Jun 29, 2017
@ansibot
Copy link
Contributor

ansibot commented Jul 18, 2017

@calfonso calfonso added this to the 2.4.0 milestone Jul 21, 2017
@trishnaguha
Copy link
Member

trishnaguha commented Jul 28, 2017

@patbdti
On the version(7K) of NX-OS port-security is mapped to eth_port_sec.
Removing port-security mapping would make feature port-security an invalid command.

nxos01(config)# show feature | i port
eth_port_sec         1        disabled
nxos01(config)# feature port-security
nxos01(config)# show feature | i port
eth_port_sec         1        enabled

Maybe the Documentation needs to updated in this case.

@trishnaguha trishnaguha modified the milestones: 2.5.0, 2.4.0 Aug 1, 2017
@calfonso calfonso added this to 2.5 To Do in Networking Oct 2, 2017
@gundalow gundalow added the nxos Cisco NXOS community label Nov 2, 2017
@ansibot ansibot removed the module This issue/PR relates to a module. label Nov 18, 2017
@trishnaguha
Copy link
Member

Target Date: 02/01/2018

@trishnaguha
Copy link
Member

resolved_by_pr #34020

@trishnaguha trishnaguha moved this from In Progress to In Review in Networking Dec 19, 2017
@trishnaguha trishnaguha moved this from In Review to Done in Networking Dec 20, 2017
@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_idea labels Mar 2, 2018
@dagwieers dagwieers added the cisco Cisco technologies label Feb 23, 2019
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 cisco Cisco technologies feature This issue/PR relates to a feature request. networking Network category nxos Cisco NXOS community support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
No open projects
Networking
  
Done
Development

Successfully merging a pull request may close this issue.

6 participants