Developer Community

Reply
Occasional Contributor I

Issue with “arubaos_switch_ssh_cli” module

This module seems working with only some show commands(such as ‘show version” and “show flash” ) but not all. Here is an example that does not work.

 

Aruba-3810M-24G-PoEP-1-slot# show cdp

Global CDP information

 

  Enable CDP [Yes] : Yes

  CDP mode [rxonly] : pre-standard-voice

  CDP Hold Time [180] : 180

  CDP Transmit Interval [60] : 60

 

  Port   CDP      Admin status

  ------ -------- ------------

  1      enabled  tx_rx

  2      enabled  rxonly

  3      enabled  rxonly

  4      enabled  rxonly

…..

 

I was trying to use below task to get the same information as above:

 

    - name: show cdp

      arubaos_switch_ssh_cli:

        ip: xxxxxx

        user: xxxx

        password: xxxx

        timeout: 180

        command_list:  [ "show cdp" ]

      register: cdp_result

 

However, the result returned is cli_output": []

 

Occasional Contributor I

Re: Issue with “arubaos_switch_ssh_cli” module

I haven't seen this myself but I spotted that the output of "show cdp" contains the [ symbol. Could the code be intollerent to this special character?

 

If you have other commands that don't work, do they contain this or other escape characters?

 

Does " show cdp traffic " produce an error (no [ character on my switches although we don't use CDP).

 

Ian.

Ian Nightingale - University of York, UK
MVP Expert

Re: Issue with “arubaos_switch_ssh_cli” module

Hi,

 

It is not always a good idea to try to launch a cli command

it will be better to launch API call

there is a /rest/vX/cdp for CDP configuration




PowerArubaSW: Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP... More info


PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...) More info


PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)


PowerArubaIAP: Powershell Module to use Aruba Instant AP




ACMP 6.4 / ACMX #107 / ACCP 6.5
Occasional Contributor I

Re: Issue with “arubaos_switch_ssh_cli” module

Thanks for your reply, Ian!

I just tried and it does not look like caused by escape character, since "show cdp traffic" does not work either. See below:

---- Aruba output ---

Aruba-3810M-24G-PoEP-1-slot# show cdp traffic

CDP frame Statistics:

Port Transmitted Received Discarded Error
No. Frames Frames Frames Frames
-------- ------------ ----------- ----------- --------
24 0 46448 0 0
24 0 46448 0 0

------- Ansible output ----

changed: [localhost] => {
"changed": true,
"cli_output": [],
"invocation": {
"module_args": {
"allow_agent": false,
"boot_image": "primary",
"command_list": [
"show cdp traffic"
],
"enable_sftp": false,
"ip": "xxxxxxxx",
"key_filename": null,
"look_for_keys": false,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"path_to_swi": null,
"port": 22,
"show_command": null,
"state": "upgrade",
"timeout": 180,
"user": "admin"
}
},
"message": ""
}

 

Occasional Contributor I

Re: Issue with “arubaos_switch_ssh_cli” module

@alagoutte, thanks for your reply and I agree REST is better.

however using REST does require enable it on the Aruba switch.  We try not to make configuration change on the switch unless it is absolutely necessary. If CLI module works as expected, we would prefer to stick to it at this time. 

Aruba Employee

Re: Issue with “arubaos_switch_ssh_cli” module

Hi!!

 

The parameter should actually be "show_command_list" instead of "command_list", that should give you the result back. Could you try and let me know the result?

 

    - name: show cdp

      arubaos_switch_ssh_cli:

        ip: xxxxxx

        user: xxxx

        password: xxxx

        timeout: 180

        show_command:  [ "show cdp" ]

      register: cdp_result

Occasional Contributor I

Re: Issue with “arubaos_switch_ssh_cli” module

@Tiffany, thanks for you reply. 

I actually tried both and none of them are working for “show cdp”, using “show_command” would be no response until timeout, while using “command_list” would just return nothing.

I tried a few show command so far, looks like only “show version” and “show flask” work.

Aruba Employee

Re: Issue with “arubaos_switch_ssh_cli” module

Hmm okay so show version and show flash work but not that particular command, do you have paging enabled? It could be since that command runs over multiple pages the module isn’t matching on the prompt. Are you able to disable paging with “no page” before the command?

Aruba Employee

Re: Issue with “arubaos_switch_ssh_cli” module

@jxia I think this is the solution... let me know if this works or not:

 

    - name: show cdp
      arubaos_switch_ssh_cli:
        ip: xxxxx
        user: xxxxx
        password: xxxxx
        show_command: ["no page", "show cdp"]
      register: cdp_result

    - debug:
        var: cdp_result.cli_output[1]
Occasional Contributor I

Re: Issue with “arubaos_switch_ssh_cli” module

hmmm...I'm not sure it is caused by "paging", the output from "show cdp traffic" is pretty small and it does not work either :(

 

Aruba-3810M-24G-PoEP-1-slot# show cdp traffic

CDP frame Statistics:

Port Transmitted Received Discarded Error
No. Frames Frames Frames Frames
-------- ------------ ----------- ----------- --------
24 0 46448 0 0
24 0 46448 0 0

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: