Set Edge Default Route / Default Gateway using vRealize Orchestrator

Scenario

As part of some workflow I am building for a customer, I need to automate assigning the default route (default gateway) for an vCNS Edge appliance, using vRealize Orchestrator.

Problem

The provided NSXDefaultRoute, which can be used with NSXEdgeManager.setDefaultRoute() per the documentation, has read-only properties and the NSX Orchestrator Plugin 1.0.4 provides no further documentation to my knowledge on how to use this scripting object:

Solution

There are two accessors available as part of the NSXDefaultRoute scripting object.  To my knowledge, these are not documented.

  • NSXDefaultRoute.setvNicIndex(string vnicindex)
  • NSXDefaultRoute.setGatewayIpAddress(string ip)

Note, there is no accessor for MTU, although as shown below that is an option in the default gateway config.

This example code works with vRealize Automation 7.1 and the embedded Orchestrator service.

Setup a new workflow with these variables as input, and the below code in a scripting task, and it should work for you too.

Input Parameters

  • Variable nsx is a NSX:Connection object specifying my vCNS Manager in vRO inventory
  • Variable edgeId is a string object specifying the edge objectId, such as edge-28

Here’s the results after running this code

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

Categories

Archives

GiottoPress by Enrique Chavez