There are no official APIs for anything VS related (management or gateway).
I know we plan to address this in the future.
Having said that, you might be able to do some scripting work to extract the various details.
This will involve use of the generic-object API and running db_tool from the gateway to get the UUID of the relevant objects as I'm not aware of a way to get them otherwise.
Since I don't have VSX set up anywhere, I hope someone can give this a try and let me know if it works or not.
Even without that, I'm sure it'll be useful for regular Security Gateway 🙂
First, use something like the following to list all the objects involved in the policy from the gateway.
Note the paths will need to be modified for your version and to the specific "state" directory for the given VS.
db_tool -p /opt/CPsuite-R81.20/fw1/state/local/FW1 get_rules |grep UUID | awk '{split($0,a,":"); print a[2]}' | uniq | awk ' { cmd="db_tool -p /opt/CPsuite-R81.20/fw1/state/local/FW1 get_object -u "$1;system(cmd)}'
What you're looking for is the UUID of the VS object, which will only show if the VS is directly used in the policy.
Once you have all the UUIDs of all the VS objects, you can get the interface names and zone information with something like this from the management server (note this is for a specific UUID):
mgmt_cli -r true --format json show generic-object uid 8414a95f-8f3d-5442-9944-9877f964d08e | jq -r '.interfaces[] | [.officialname, .securityZone ] | @csv'
This returns the information nicely in CSV format, with one small exception (the Zone is listed as a UUID)
"eth0","237a4cbc-7fb6-4d50-872a-4904468271c4"
"eth1","e8131db2-8388-42a5-924a-82de32db20f7"
Fortunately, it's easy to get the UUIDs for the Security Zones like so:
mgmt_cli -r true --format json show security-zones | jq -r '.objects[] | [.name, .uid] | @csv'
Which translates (in my case) to:
"DMZZone","8c4041ea-ff14-4e4b-a9d9-4183d18c790a"
"ExternalZone","237a4cbc-7fb6-4d50-872a-4904468271c4"
"InternalZone","e8131db2-8388-42a5-924a-82de32db20f7"
"WirelessZone","57de3848-3675-48ed-b045-41378f4babb3"
Which means we can conclude that:
- eth0 is a member of External Zone
- eth1 is a member of Internal Zone
Again, whether any of this will work with VSX objects is a separate question.