part of the key to this script is that it walks into a virtual server's configuration JSON and "finds" all dependencies; retrieves the JSON for them (appending them to a Dictionary) and lastly, it'll put the virtual server JSON into the dictionary and then when it comes time to "copy" or "write" the virtual, it'll first copy the dependencies and then copy the virtual. Essentially, because of the dependency issue, the order that the various JSON objects for underlying BIG-IP configuration objects are serialized is crucial.
Example for a virtual with a referenced pool:
serialized objects in this order:
Pool JSON
Virtual JSON
then when "copying" or "writing" that virtual to destination, you'd first post the Pool JSOn then the virtual JSON. If this isn't done, the BIG-IP's MCPD would reject the attempt to post the Virtual JSON, because it references a non-existent object.
part of the key to this script is that it walks into a virtual server's configuration JSON and "finds" all dependencies; retrieves the JSON for them (appending them to a Dictionary) and lastly, it'll put the virtual server JSON into the dictionary and then when it comes time to "copy" or "write" the virtual, it'll first copy the dependencies and then copy the virtual. Essentially, because of the dependency issue, the order that the various JSON objects for underlying BIG-IP configuration objects are serialized is crucial.
Example for a virtual with a referenced pool: serialized objects in this order: Pool JSON Virtual JSON
then when "copying" or "writing" that virtual to destination, you'd first post the Pool JSOn then the virtual JSON. If this isn't done, the BIG-IP's MCPD would reject the attempt to post the Virtual JSON, because it references a non-existent object.