This is going to be a quick post around how to execute NSX Central CLI commands from APIs. I’m a big fan of RTFM so I did. I’m using 6.3 so this is the doc http://pubs.vmware.com/nsx-63/topic/com.vmware.ICbase/PDF/nsx_63_api.pdf
Also note pag. 12 where it says
“some methods, for example, the central CLI method, POST /1.0/nsx/cli might required a different Accept header”
Problem is: what Accept method shall I be using? Very useful ah? RTFM isn’t enough this time!
If you don’t configure an Accept header any nsxcli call will miserably fail with the status “406 Not Acceptable” error message “The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request “accept” headers”.
A quick Google search returned this blog post from my friend Romain Decker http://cloudmaniac.net/nsx-central-cli-operations-troubleshooting and it seems to suggest he had it working without any Accept header
So I got it touch with Romain who found where the problem is: you actually need the Accept header and it must be text/plain. Thanks dude! So here’s the working call, The body is
<nsxcli><command>show edge edge-10 ip bgp</command></nsxcli>
I thought something changed on NSX 6.3 so I fired up and HOL and tested an NSX 6.2.3 build 3979471 and I can confirm it still needs the Accept header.
Hey VMware, it would be nice if you could fix the documentation accordingly 😉
1 Trackback