Lately I have been working for a Service Provider (SP) helping them migrating several vCloud Director (vCD) 5.x instances from vCloud Networking and Security (vCNS) 5.5 to NSX. In case you missed the news, vCNS 5.5 went EOGS (End of Global Support) 19 September 2016 hence the reason many customers have rushed (or are still rushing) to get their environment in a supportable state.
Upgrading from vCNS to NSX in a vCloud Director scenario means you have to take into account a lot of products; it isn’t just vCNS and vCD that need upgrading; to name just a few there are vShield Edges, vCenter, ESXi hosts, vShield vApp, vShield Data Security and ChargeBack Manager. You then have to check that any 3rd party product (or plugins) your environment is using will be supported and will work across the full stack.
The SP I’m currently working for has quite a lot of vCD instances and hundreds of vShield Edges; as part of the upgrade process to NSX it is required to redeploy all the Edges, vApp Networks and Isolated Org VDC Networks to make sure everything it’s working as expected after the upgrade. You can imagine that the desire was to automate as much as possible of this process. One could argue that the SP should not be responsible for vApp Networks and Org VDC Networks but in reality this is very much down to the type of service (and agreements) the SP is providing to its customers, for instance fully managed services as opposed to self-managed, so it depends.
Turns out the simplest and quickest solution to automate the redeployment of those networks was a PowerShell script doing direct vCD APIs calls.
I could have spent many pages in this post explaining the script I came up with, pros and cons but instead I’m simply going to leave here the link to the GitHub repo I created 🙂
NOTE: I’m not a PowerShell expert and I am fully aware that there’s a lot of code that can be optimised; first of all breaking that big file into smaller function files and assemble a module. However as it’s doing the job I wanted and someone else might find it useful I decided to publish it anyway and I will optimise it as time goes by. Needless to say, feel free to clone it and improve it 😉