jedelman8 / nxos-ansible

Ansible modules to automate Cisco NX-OS switches
Other
169 stars 106 forks source link

nxos_feature module not working for Nexus 3k #5

Closed ghost closed 9 years ago

ghost commented 9 years ago

I am getting the following error when testing this module on N3k running the following software version: version 6.0(2)U4(3) "{"failed": true, "features_currently_supported": [], "invalid_feature": "lacp"} msg: Invalid feature name."

Note: Same error for all the features. i.e ospf, vpc, bgp etc

nxos-ansible ronnilekani$ cat test_nxos_feature.yml


nxos-ansible ronnilekani$ sudo ansible-playbook -i hosts test_nxos_feature.yml Password:

PLAY [feature testing] ****

TASK: [nxos_feature feature=lacp state=enabled host={{ inventory_hostname }}] *\ failed: [nexus3k1] => {"failed": true, "features_currently_supported": [], "invalid_feature": "lacp"} msg: Invalid feature name.

FATAL: all hosts have already failed -- aborting

PLAY RECAP **** to retry, use: --limit @/Users/ronnilekani/test_nxos_feature.retry

nexus3k1 : ok=0 changed=0 unreachable=0 failed=1

ghost commented 9 years ago

Here is the snapshot

ghost commented 9 years ago

1

jedelman8 commented 9 years ago

Can you do me a favor and send me the output you see from the NX-API sandbox response window when executing the show feature command? Please use message format xml and type as cli_show

For example, this is a SNIPPET of what I see:

<?xml version="1.0"?>
<ins_api>
  <type>cli_show</type>
  <version>1.0</version>
  <sid>eoc</sid>
  <outputs>
    <output>
      <body>
      <TABLE_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>bash-shell</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>1</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>bfd</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>1</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>bfd_app</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>1</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>bgp</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>1</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>     
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>eigrp</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>16</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>evmed</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>1</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>

        <cfcFeatureCtrlName2>isis</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>2</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>isis</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>3</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>isis</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>4</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>lacp</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>1</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>enabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
       <ROW_cfcFeatureCtrlTable>
        <cfcFeatureCtrlName2>ldap</cfcFeatureCtrlName2>
        <cfcFeatureCtrlInstanceNum2>1</cfcFeatureCtrlInstanceNum2>
        <cfcFeatureCtrlOpStatus2>disabled</cfcFeatureCtrlOpStatus2>
       </ROW_cfcFeatureCtrlTable>
      </TABLE_cfcFeatureCtrlTable>
     </body>
      <input>show feature</input>
      <msg>Success</msg>
      <code>200</code>
    </output>
  </outputs>
</ins_api>
```.
ghost commented 9 years ago

Please find the requested data below.

<?xml version="1.0" encoding="UTF-8"?>

cli_show 1.0 eoc Feature Name Instance State --- bash-shell 1 disabled bfd 1 disabled bgp 1 disabled dhcp 1 disabled eigrp 1 disabled eigrp 2 disabled eigrp 3 disabled eigrp 4 disabled evmed 1 disabled hsrp_engine 1 enabled interface-vlan 1 enabled lacp 1 enabled lldp 1 enabled msdp 1 disabled ntp 1 enabled nve 1 disabled nxapi 1 enabled ospf 1 enabled (not-running) ospf 2 enabled (not-running) ospf 3 enabled (not-running) ospf 4 enabled (not-running) ospfv3 1 disabled ospfv3 2 disabled ospfv3 3 disabled ospfv3 4 disabled pbr 1 enabled pim 1 disabled private-vlan 1 disabled privilege 1 disabled rip 1 disabled rip 2 disabled rip 3 disabled rip 4 disabled scheduler 1 disabled scpServer 1 enabled sflow 1 enabled sshServer 1 enabled tacacs 1 enabled telnetServer 1 enabled tunnel 1 disabled udld 1 enabled vmtracker 1 disabled vnseg_vlan 1 disabled vpc 1 enabled vrrp 1 disabled vtp 1 disabled show feature Structured output unsupported 501
ghost commented 9 years ago

CLI output:

nexus3k1# show feature Feature Name Instance State


bash-shell 1 disabled bfd 1 disabled bgp 1 disabled dhcp 1 disabled eigrp 1 disabled eigrp 2 disabled eigrp 3 disabled eigrp 4 disabled evmed 1 disabled hsrp_engine 1 enabled interface-vlan 1 enabled lacp 1 enabled lldp 1 enabled msdp 1 disabled ntp 1 enabled nve 1 disabled nxapi 1 enabled ospf 1 enabled (not-running) ospf 2 enabled (not-running) ospf 3 enabled (not-running) ospf 4 enabled (not-running) ospfv3 1 disabled ospfv3 2 disabled ospfv3 3 disabled ospfv3 4 disabled pbr 1 enabled pim 1 disabled private-vlan 1 disabled privilege 1 disabled rip 1 disabled rip 2 disabled rip 3 disabled rip 4 disabled scheduler 1 disabled scpServer 1 enabled sflow 1 enabled sshServer 1 enabled tacacs 1 enabled telnetServer 1 enabled tunnel 1 disabled udld 1 enabled vmtracker 1 disabled vnseg_vlan 1 disabled vpc 1 enabled vrrp 1 disabled vtp 1 disabled

jedelman8 commented 9 years ago

Hi Ron, as you can probably tell when you compare our outputs, the Nexus 3K does NOT yet support structured output for this command, which is odd, but because it's an important module, I added in some "manual" parsing to make this work.

You will need to update pycsco and also pull down the latest nxos_feature module.

sudo pip install pycsco --upgrade will update the lib. And then you also need to clone or copy the module.

Thanks for finding this one!

Please let me know how it goes so we can close this out.

ghost commented 9 years ago

Hi Jason,

The issue was resolved after following the steps listed in your last update. Although, I was able to achieve the same result using the command module but i am glad to see you providing a very quick workaround.

Thanks a lot for sharing your Ansible modules. This means a great deal to Networking community. Hope to run into you at one of the conferences this year and thank you in person. :)

Regards, Ron