Hello All,
I need to know if any REST API available to get list of mac-table entries for particular VNI using NSX manager or NSX controller???
Basically i need RESt API for CLI on NSX controller i.e.
"show control-cluster logical-switches mac-table 5005"
Thanks in advance,
Saurabh Jain
Hi,
If you use NSX-v 6.2 and later, central CLI can be executed by REST API.
I consider that you can get MAC table on a specified controller by using the following API.
=========
* Central CLI REST API
POST https://NSX-Manager-IP-Address/api/1.0/nsx/cli?action=execute
Request Body:
<nsxcli>
<command>CLI</command>
</nsxcli>
---
* My example
$ curl -k -u <USER>:<PASSWORD> -H "Accept: text/plain" -H "Content-Type: application/xml" https://NSXMGR-ADDR/api/1.0/nsx/cli?action=execute -d "<nsxcli><command>show logical-switch controller controller-4 vni 5000 mac</command></nsxcli>"
VNI MAC VTEP-IP Connection-ID
5000 00:50:56:xx:xx:xx 192.168.xxx.xxx 14
5000 00:50:56:yy:yy:yy 192.168.xxx.xxx 14
5000 00:50:56:zz:zz:zz 192.168.xxx.xxx 15
==========
Regards,
Mizo
Hi,
If you use NSX-v 6.2 and later, central CLI can be executed by REST API.
I consider that you can get MAC table on a specified controller by using the following API.
=========
* Central CLI REST API
POST https://NSX-Manager-IP-Address/api/1.0/nsx/cli?action=execute
Request Body:
<nsxcli>
<command>CLI</command>
</nsxcli>
---
* My example
$ curl -k -u <USER>:<PASSWORD> -H "Accept: text/plain" -H "Content-Type: application/xml" https://NSXMGR-ADDR/api/1.0/nsx/cli?action=execute -d "<nsxcli><command>show logical-switch controller controller-4 vni 5000 mac</command></nsxcli>"
VNI MAC VTEP-IP Connection-ID
5000 00:50:56:xx:xx:xx 192.168.xxx.xxx 14
5000 00:50:56:yy:yy:yy 192.168.xxx.xxx 14
5000 00:50:56:zz:zz:zz 192.168.xxx.xxx 15
==========
Regards,
Mizo
Just to add instead of specifying the controller one can use "master" keyword to facilitate automation i.e. in e.g. below
curl -k -u <USER>:<PASSWORD> -H "Accept: text/plain" -H "Content-Type: application/xml" https://NSXMGR-ADDR/api/1.0/nsx/cli?action=execute -d "<nsxcli><command>show logical-switch controller controller-4 master vni 5000 mac</command></nsxcli>"