- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Create full DTC configuration in WAPI (v2.1 and above) from scratch in a single Request
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-19-2018 05:28 PM - edited 07-19-2018 05:45 PM
WAPI VERSION 2.1 OR HIGHER REQUIRED
Based on a customer request, I created this WAPI request which will likely be useful in the future.
This call uses the WAPI "Request" object to go through the full process of creating two DTC servers, creating a DTC Pool, one for each server, then a topology rule, one for each Pool, then finally an LBDN with all the elements previously creted:
EDIT: The rules for the topology ruleset are not in variables, but it's very likely possible to do so. I'll add a version with variable rules if I see enough interest in this, for now it should be enough to remember where they add and edit them appropriately.
Method: POST URL: https://{{gm}}/wapi/v2.1/request Body (in JSON): [ { "method": "STATE:ASSIGN", "data": { "server-1-name": "Jorge-WAPI-Web-Server-1", "server-1-ip": "88.88.88.88", "server-2-name": "Jorge-WAPI-Web-Server-2", "server-2-ip": "99.99.99.99", "pool-1-name": "Jorge-WAPI-Pool-1", "pool-2-name": "Jorge-WAPI-Pool-2", "topology-name": "Jorge-WAPI-Topology", "lbdn-name": "Jorge-WAPI-LBDN", "zone-name": "infoblox.demo" } }, { "method": "POST", "object": "dtc:server", "data": { "name": "##STATE:server-1-name:##", "host": "##STATE:server-1-ip:##" }, "assign_state": { "dtc-server-1_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "POST", "object": "dtc:pool", "enable_substitution": true, "data": { "name": "##STATE:pool-1-name:##", "lb_preferred_method": "GLOBAL_AVAILABILITY", "servers": [ { "ratio": 1, "server": "##STATE:dtc-server-1_ref:##" } ] }, "assign_state": { "dtc-pool-1_ref": "_ref" }, "discard": false }, { "method": "POST", "object": "dtc:server", "data": { "name": "##STATE:server-2-name:##", "host": "##STATE:server-2-ip:##" }, "assign_state": { "dtc-server-2_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "POST", "object": "dtc:pool", "enable_substitution": true, "data": { "name": "##STATE:pool-2-name:##", "lb_preferred_method": "GLOBAL_AVAILABILITY", "servers": [ { "ratio": 1, "server": "##STATE:dtc-server-2_ref:##" } ] }, "assign_state": { "dtc-pool-2_ref": "_ref" }, "discard": false }, { "method": "POST", "object": "dtc:topology", "enable_substitution": true, "data": { "name": "##STATE:topology-name:##", "rules": [ { "dest_type": "POOL", "destination_link": "##STATE:dtc-pool-1_ref:##", "sources": [ { "source_op": "IS", "source_type": "SUBNET", "source_value": "10.10.10.0/24" } ] }, { "dest_type": "POOL", "destination_link": "##STATE:dtc-pool-2_ref:##", "sources": [ { "source_op": "IS", "source_type": "SUBNET", "source_value": "20.20.20.0/24" } ] } ] }, "assign_state": { "topology_ref": "_ref" }, "discard": true }, { "method": "GET", "object": "zone_auth", "data": { "fqdn": "##STATE:zone-name:##" }, "enable_substitution": true, "assign_state": { "zone_ref": "_ref" } }, { "method": "POST", "object": "dtc:lbdn", "data": { "lb_method": "TOPOLOGY", "name": "##STATE:lbdn-name:##", "topology": "##STATE:topology_ref:##", "patterns": [ "wapi.dtc.infoblox.demo", "wapi2.dtc.infoblox.demo" ], "auth_zones": [ "##STATE:zone_ref:##" ] }, "enable_substitution": true, "discard": false }, { "method": "STATE:DISPLAY" } ]
The following request will delete everything as created above:
Method: POST URL: https://{{gm}}/wapi/v2.1/request Body (in JSON): [ { "method": "STATE:ASSIGN", "data": { "server-1-name": "Jorge-WAPI-Web-Server-1", "server-2-name": "Jorge-WAPI-Web-Server-2", "pool-1-name": "Jorge-WAPI-Pool-1", "pool-2-name": "Jorge-WAPI-Pool-2", "topology-name": "Jorge-WAPI-Topology", "lbdn-name": "Jorge-WAPI-LBDN" } }, { "method": "GET", "object": "dtc:lbdn", "data": { "name": "##STATE:lbdn-name:##" }, "assign_state": { "lbdn_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:lbdn_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:topology", "data": { "name": "##STATE:topology-name:##" }, "assign_state": { "dtc-topology_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-topology_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:pool", "data": { "name": "##STATE:pool-1-name:##" }, "assign_state": { "dtc-pool-1_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-pool-1_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:server", "data": { "name": "##STATE:server-1-name:##" }, "assign_state": { "dtc-server-1_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-server-1_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:pool", "data": { "name": "##STATE:pool-2-name:##" }, "assign_state": { "dtc-pool-2_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-pool-2_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:server", "data": { "name": "##STATE:server-2-name:##" }, "assign_state": { "dtc-server-2_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-server-2_ref:##", "enable_substitution": true, "discard": false }, { "method": "STATE:DISPLAY" } ]
Have fun!
Solved! Go to Solution.
Re: Create full DTC configuration in WAPI (v2.1 and above) from scratch in a single Request
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-10-2018 10:54 AM
Thank you for sharing Jorge.
Check out our new Tech docs website for latest documentation on Infoblox products.
Re: Create full DTC configuration in WAPI (v2.1 and above) from scratch in a single Request
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-14-2018 08:56 AM
OK, here is the request body, with the topology rules now as variables and at the top (I'm not sure why I couldn't get them to work originally, goes to show what a good night's sleep does!)
[ { "method": "STATE:ASSIGN", "data": { "server-1-name": "Jorge-WAPI-Web-Server-1", "server-1-ip": "88.88.88.88", "server-2-name": "Jorge-WAPI-Web-Server-2", "server-2-ip": "99.99.99.99", "pool-1-name": "Jorge-WAPI-Pool-1", "pool-2-name": "Jorge-WAPI-Pool-2", "topology-name": "Jorge-WAPI-Topology", "lbdn-name": "Jorge-WAPI-LBDN", "zone-name": "infoblox.demo", "pool-1-sources":[ { "source_op": "IS", "source_type": "SUBNET", "source_value": "10.10.10.0/24" } ], "pool-2-sources":[ { "source_op": "IS", "source_type": "SUBNET", "source_value": "20.20.20.0/24" } ] } }, { "method": "POST", "object": "dtc:server", "data": { "name": "##STATE:server-1-name:##", "host": "##STATE:server-1-ip:##" }, "assign_state": { "dtc-server-1_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "POST", "object": "dtc:pool", "enable_substitution": true, "data": { "name": "##STATE:pool-1-name:##", "lb_preferred_method": "GLOBAL_AVAILABILITY", "servers": [ { "ratio": 1, "server": "##STATE:dtc-server-1_ref:##" } ] }, "assign_state": { "dtc-pool-1_ref": "_ref" }, "discard": false }, { "method": "POST", "object": "dtc:server", "data": { "name": "##STATE:server-2-name:##", "host": "##STATE:server-2-ip:##" }, "assign_state": { "dtc-server-2_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "POST", "object": "dtc:pool", "enable_substitution": true, "data": { "name": "##STATE:pool-2-name:##", "lb_preferred_method": "GLOBAL_AVAILABILITY", "servers": [ { "ratio": 1, "server": "##STATE:dtc-server-2_ref:##" } ] }, "assign_state": { "dtc-pool-2_ref": "_ref" }, "discard": false }, { "method": "POST", "object": "dtc:topology", "enable_substitution": true, "data": { "name": "##STATE:topology-name:##", "rules": [ { "dest_type": "POOL", "destination_link": "##STATE:dtc-pool-1_ref:##", "sources": "##STATE:pool-1-sources:##" }, { "dest_type": "POOL", "destination_link": "##STATE:dtc-pool-2_ref:##", "sources": "##STATE:pool-2-sources:##" } ] }, "assign_state": { "topology_ref": "_ref" }, "discard": true }, { "method": "GET", "object": "zone_auth", "data": { "fqdn": "##STATE:zone-name:##" }, "enable_substitution": true, "assign_state": { "zone_ref": "_ref" } }, { "method": "POST", "object": "dtc:lbdn", "data": { "lb_method": "TOPOLOGY", "name": "##STATE:lbdn-name:##", "topology": "##STATE:topology_ref:##", "patterns": [ "wapi.dtc.infoblox.demo", "wapi2.dtc.infoblox.demo" ], "auth_zones": [ "##STATE:zone_ref:##" ] }, "enable_substitution": true, "discard": false }, { "method": "STATE:DISPLAY" } ]
Re: Create full DTC configuration in WAPI (v2.1 and above) from scratch in a single Request
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
09-10-2018 12:57 PM - edited 09-10-2018 02:27 PM
Final Edit: I added the LBDN patterns as variables at the top, and added an ICMP monitor to the pools as an example.
[ { "method": "STATE:ASSIGN", "data": { "server-1-name": "Jorge-WAPI-Web-Server-1", "server-1-ip": "88.88.88.88", "server-2-name": "Jorge-WAPI-Web-Server-2", "server-2-ip": "99.99.99.99", "pool-1-name": "Jorge-WAPI-Pool-1", "pool-2-name": "Jorge-WAPI-Pool-2", "topology-name": "Jorge-WAPI-Topology", "lbdn-name": "Jorge-WAPI-LBDN", "zone-name": "infoblox.demo", "pool-1-sources":[ { "source_op": "IS", "source_type": "SUBNET", "source_value": "10.10.10.0/24" } ], "pool-2-sources":[ { "source_op": "IS", "source_type": "SUBNET", "source_value": "20.20.20.0/24" } ], "lbdb-patterns": [ "wapi.dtc.infoblox.demo", "wapi2.dtc.infoblox.demo" ], "monitor-name":"icmp", "monitor-type":"dtc:monitor:icmp" } }, { "method": "GET", "object": "##STATE:monitor-type:##", "data": { "name": "##STATE:monitor-name:##" }, "assign_state": { "monitor_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "POST", "object": "dtc:server", "data": { "name": "##STATE:server-1-name:##", "host": "##STATE:server-1-ip:##" }, "assign_state": { "dtc-server-1_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "POST", "object": "dtc:server", "data": { "name": "##STATE:server-2-name:##", "host": "##STATE:server-2-ip:##" }, "assign_state": { "dtc-server-2_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "POST", "object": "dtc:pool", "enable_substitution": true, "data": { "name": "##STATE:pool-1-name:##", "lb_preferred_method": "GLOBAL_AVAILABILITY", "servers": [ { "ratio": 1, "server": "##STATE:dtc-server-1_ref:##" } ], "monitors":[ "##STATE:monitor_ref:##" ] }, "assign_state": { "dtc-pool-1_ref": "_ref" }, "discard": false }, { "method": "POST", "object": "dtc:pool", "enable_substitution": true, "data": { "name": "##STATE:pool-2-name:##", "lb_preferred_method": "GLOBAL_AVAILABILITY", "servers": [ { "ratio": 1, "server": "##STATE:dtc-server-2_ref:##" } ], "monitors":[ "##STATE:monitor_ref:##" ] }, "assign_state": { "dtc-pool-2_ref": "_ref" }, "discard": false }, { "method": "POST", "object": "dtc:topology", "enable_substitution": true, "data": { "name": "##STATE:topology-name:##", "rules": [ { "dest_type": "POOL", "destination_link": "##STATE:dtc-pool-1_ref:##", "sources": "##STATE:pool-1-sources:##" }, { "dest_type": "POOL", "destination_link": "##STATE:dtc-pool-2_ref:##", "sources": "##STATE:pool-2-sources:##" } ] }, "assign_state": { "topology_ref": "_ref" }, "discard": true }, { "method": "GET", "object": "zone_auth", "data": { "fqdn": "##STATE:zone-name:##" }, "enable_substitution": true, "assign_state": { "zone_ref": "_ref" } }, { "method": "POST", "object": "dtc:lbdn", "data": { "lb_method": "TOPOLOGY", "name": "##STATE:lbdn-name:##", "topology": "##STATE:topology_ref:##", "patterns": "##STATE:lbdb-patterns:##", "auth_zones": [ "##STATE:zone_ref:##" ] }, "enable_substitution": true, "discard": false }, { "method": "STATE:DISPLAY" } ]
Here is also the DELETE script, with a small tweak in the order of deletion (delete all servers first, then all pools) just to make it easier to re-use the calls.
[ { "method": "STATE:ASSIGN", "data": { "server-1-name": "Jorge-WAPI-Web-Server-1", "server-2-name": "Jorge-WAPI-Web-Server-2", "pool-1-name": "Jorge-WAPI-Pool-1", "pool-2-name": "Jorge-WAPI-Pool-2", "topology-name": "Jorge-WAPI-Topology", "lbdn-name": "Jorge-WAPI-LBDN" } }, { "method": "GET", "object": "dtc:lbdn", "data": { "name": "##STATE:lbdn-name:##" }, "assign_state": { "lbdn_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:lbdn_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:topology", "data": { "name": "##STATE:topology-name:##" }, "assign_state": { "dtc-topology_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-topology_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:pool", "data": { "name": "##STATE:pool-1-name:##" }, "assign_state": { "dtc-pool-1_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-pool-1_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:pool", "data": { "name": "##STATE:pool-2-name:##" }, "assign_state": { "dtc-pool-2_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-pool-2_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:server", "data": { "name": "##STATE:server-1-name:##" }, "assign_state": { "dtc-server-1_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-server-1_ref:##", "enable_substitution": true, "discard": false }, { "method": "GET", "object": "dtc:server", "data": { "name": "##STATE:server-2-name:##" }, "assign_state": { "dtc-server-2_ref": "_ref" }, "enable_substitution": true, "discard": true }, { "method": "DELETE", "object": "##STATE:dtc-server-2_ref:##", "enable_substitution": true, "discard": false }, { "method": "STATE:DISPLAY" } ]
Re: Create full DTC configuration in WAPI (v2.1 and above) from scratch in a single Request
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
09-14-2018 12:44 AM
Hi,
In the presentation yesterday (How to Leverage APIs to Automate and Optimize Infoblox DTC) i was told you don't use the PUT option.
How can i modify all records (DTCool) with a specific comment and add a health check?
So i need to do a GET to store the pool names and then modify the health checks (monitors).
Regards,
Dwight Goossens
Re: Create full DTC configuration in WAPI (v2.1 and above) from scratch in a single Request
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-01-2018 07:14 AM
Hey Dwight,
We meant in this particular demo we weren't using PUT. The REST API does support put, post, and get.
There's info on our API at https://www.infoblox.com/wp-content/uploads/infoblox-deployment-infoblox-rest-api.pdf.
Let me know if you have any other questions.
Thanks!