Avi Vantage Integration With vRealize Automation (vRA)

Using a combination of custom alerts and ControlScripts, Avi Vantage’s vRA integration enables vRA to appear to be in charge of the automation and resource allocation and tracking of Avi SE virtual machines. Without it, the actions vCenter on behalf of the Avi Controller would not be seen as managed by vRA.

vRA Configurations

Login to vRA with a tenant admin user account and configure the following:

Create Avi SE custom resource

  • Navigate to Design > XaaS > Custom Resources.
  • Click on New and fill details as shown.
Avi Vantage Service Engine icon
Figure 1. vRA Avi-SE resource editor.


  • Click on Next and Finish to save the configuration.

Create XaaS Blueprint to search and register SE VM:

  • Navigate to Design > XaaS > XaaS Blueprints

Avi Vantage Service Engine icon
Figure 2. Creating an XaaS blueprint in vRA.


  • Click on New
  • In the Workflow tab navigate and select the required vRO workflow. In this example we select “Orchestrator > Library > vCenter > Virtual Machine management > Basic > Get virtual machines by name.” This returns an array of VC:VirtualMachine object.

Avi Vantage Service Engine icon
Figure 3. Selecting a workflow in vRA.


  • In the General tab name the blueprint ‘Get Avi SE by name’ and set the initial version to 1.0.0.

Avi Vantage Service Engine icon
Figure 4. Selecting a workflow in vRA.


  • No changes are required in the Blueprint Form tab. Click Next.

  • On the Provisioned Resource tab, select the previously created custom Avi-SE resource in dropdown.

  • No changes are required in the Component Lifecycle tab. Click Finish to complete the configuration.

  • Once it is saved, select the new blueprint and click on Avi Vantage Service Engine icon in the toolbar.

Create Avi Vantage Service

  • Navigate to Administration > Catalog Management > Services.
  • Click on New.
  • Configure as shown.

Avi Vantage Service Engine icon
Figure 5. Administration > Catalog Management > Services.


  • Click OK to save the configuration.

Add Catalog Item

  • Select the newly created Avi Vantage service.
  • Click on Manage Catalog Items on the toolbar.

Avi Vantage Service Engine icon
Figure 6. Creating, editing, publish, and managing services.


  • Click on the + add ‘Get Avi SE by name’ XaaS blueprint earlier created.
  • Click on Close.

Add Entitlements

  • Navigate to Administration > Catalog Management > Entitlements
  • Click on New
  • Configure a name and set status to Active.

Avi Vantage Service Engine icon
Figure 7. Editing an entitlement.


  • Add Service, items and permissions as shown

  • Click Finish to save

Validate configuration

If everything is configured correctly the Catalog tab should look as shown:

Avi Vantage Service Engine icon
Figure 8. Validating the configuration.



Requesting the ‘Get Avi SE by name’ catalog item should ask for the SE VM name and result in the SE getting added as a managed VM under items.

Avi Configuration

Log into the Avi Controller as admin and configure the following:

Create a ControlScript

  • Navigate to Templates > Scripts > ControlScripts
  • Click on Create.
  • Name it “Update_vRA_Catalog_Item.”
  • Enter below text in the ControlScript box.

#!/usr/bin/python
import sys
import json
from avi.sdk.samples.vra.update_vra import register_se, destroy_se

#print sys.argv
event = json.loads(sys.argv[1])['events'][0]
event_id = event['event_id']

vra_ip = '10.10.10.10'
username = 'demouser'
password = 'demopassword'
tenant = 'vsphere.local'
catalog_name = 'Get Avi SE by name'


if event_id == 'CREATED_SE':
    se_name = event['event_details']['spawn_se_details']['se_name']
    register_se(se_name, catalog_name, vra_ip, username, password, tenant)
elif event_id == 'DELETED_SE':
    se_name = event['event_details']['delete_se_details']['se_name']
    destroy_se(se_name, vra_ip, username, password, tenant, force=False)

Note: Change the vra_ip, username, password and tenant to correct values for your setup.

  • Save the configuration.

Create Alert Action

  • Navigate to Operations > Alerts > Alert Actions
  • Click on Create.
  • Name it ‘Update vRA’
  • Set Alert Level to Medium.
  • Select “Update_vRA_Catalog_Item” in ControlScript dropdown.

Avi Vantage Service Engine icon
Figure 9. Editing the alert action.



Create Alert Config

  • Navigate to Operations > Alerts > Alert Config
  • Click on Create.
  • Configure the Alert as shown below.

Avi Vantage Service Engine icon
Figure 10. Editing the alert configuration.



  • Save the configuration.

Working

The below flowchart shows the steps involved in creating an Avi SE.

Updating vRA on SE creation
Figure 11. Updating vRA on SE creation.



SE creation may be due to creation of a new VS or scale out/migration of existing VS. The ControlScript will request the new SE VM to be registered on vRA and will alert if the request is denied. When an SE is created, the CREATED_SE event is triggered after the SE VM deployment is successful and vRA is updated by the ControlScript. Successful update should show an alert log as below:

Avi Vantage Service Engine icon
Figure 12. Editing the alert configuration.



The below flowchart shows the steps involved in deleting an Avi SE.

Updating vRA on SE deletion
Figure 13. Updating vRA on SE deletion.



The SE can be deleted if unused for more than a set timeout or due to manual deletion request from a user. The ControlScript will request deletion of SE VM item on vRA and will alert if the request is denied. When an SE is deleted, the DELETED_SE event is triggered after SE VM deletion is successful and vRA is updated by the ControlScript. Successful update should show an alert log as below:

Avi Vantage Service Engine icon
Figure 14. Alert log entry shows a successful update.