Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

BGP Neighbor API

thuyngnhu
Altostratus
Altostratus

Hi guys,

Is there any way that I can retrieve output of this command "imish -e "show ip bgp neighbors" via API? Or if not, do you know how I can parse the output of this command from netmiko to something (for example: dictionary) that can be processed further? Thanks

6 REPLIES 6

Is it possible for a imish call, not tmsh call?

If it is in Linux (using imish but not entering it, like in linux when you run tmsh list /sys .. for example ) I don't see why not and testing will give you answer you seek.

Thanks a lot. I tried with Postman but it returned 400 error with message ""\"bash\" unexpected argument",". Is there anything I can do to pass this error?

Other than that you can use the Ansible module "bigip_command" to do something like:

 

  - name: BGP show

    bigip_command:

       commands: run util bash -c " xxxxx"

       provider "{{ provider }}"

    delegate_to: localhost

 

 

If you see issues add the commands in a bash script on the F5 and then trigger the script.

Not having right a F5 with a licensed routing module, so I am interested in your tests and if it worked 😀

Here is a working example:

 

curl -sku admin:xxxx https://xxxx/mgmt/tm/util/bash -X POST -H "Content-Type: application/json" -d "{\"command\":\"run\", \"utilCmdArgs\":\"-c 'ls -alt /var/log'\"}"

 

but better trigger a bash script file

 

curl -sku admin:xxxx https://xxxx/mgmt/tm/util/bash -X POST -H "Content-Type: application/json" -d "{\"command\":\"run\", \"utilCmdArgs\":\"-c 'bash /shared/niki.sh'\"}"

 

Also as I mentioned Ansible can be added with its commands module :

 

https://docs.ansible.com/ansible/latest/collections/f5networks/f5_modules/bigip_command_module.html#...