This is going to be a short one! I received an interesting question from Sander Martijn about retrieving all IP routes from an NSX Edge. There is no API endpoint available in NSX to get the current routes and the only way this information can get retrieved is using the NSX Central CLI. You can easily see all routes on the Central CLI by using the command: show edge edge-id ip route.

PowerNSX has an Invoke-NsxCli cmdlet which executes the Central CLI with a specific query. Because of this, you can retrieve the routes with a PowerShell script and do things with the output.

I put together a quick example that can be used to iterate through all NSX Edges and then use the NSX Central CLI to retrieve the IP routes from it. Check out the GitHub Git below for the code:



Share the wealth!