Skip to content

Commit

Permalink
AV-175720: Update all vRO workflows and actions to add UUID of the ob…
Browse files Browse the repository at this point in the history
…ject.
  • Loading branch information
mkhachane committed Apr 10, 2023
1 parent e8b0472 commit 82fa03d
Show file tree
Hide file tree
Showing 17 changed files with 484 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<dunes-script-module name="createHealthMonitorObj"
result-type="Avi:WorkflowRuntime" api-version="6.0.0"
id="912babe5-8cf5-4104-b5c2-b55ab69c9b5c" version="0.0.3"
id="912babe5-8cf5-4104-b5c2-b55ab69c9b5c" version="0.0.5"
allowed-operations="vfe">
<param n="healthMonitorType" t="string"><![CDATA[Health monitor type]]></param>
<param n="hm_type" t="string"><![CDATA[Health monitor type]]></param>
Expand All @@ -24,10 +24,14 @@
<param n="workflowRuntime" t="Avi:WorkflowRuntime"><![CDATA[Avi vro client]]></param>
<param n="Tenant" t="string"><![CDATA[Tenant name]]></param>
<param n="https_response_code" t="Array/string"><![CDATA[https response code]]></param>
<param n="health_monitor_uuid" t="Array/string"><![CDATA[Uuid of health monitor]]></param>
<script encoded="false"><![CDATA[try{
if(workflowRuntime.getAviVroClient() !=null){
Tenant = workflowRuntime.getAviVroClient().cred.tenant;
healthMonitorObj = new AviHealthMonitor() ;
healthMonitorObj = new AviHealthMonitor();
if (health_monitor_uuid){
healthMonitorObj.setUuid(health_monitor_uuid);
}
healthMonitorObj.setTenantRef("/api/tenant?name="+Tenant);
healthMonitorObj.setName(hm_name);
healthMonitorObj.setDescription(hm_description)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dunes-script-module name="createPoolObj"
result-type="Avi:WorkflowRuntime" api-version="6.0.0"
id="d74b12d8-5662-4da9-b7fa-29c99d84a74e" version="3.0.1"
id="d74b12d8-5662-4da9-b7fa-29c99d84a74e" version="3.0.3"
allowed-operations="vfe">
<param n="PoolServers" t="Array/string"><![CDATA[Pool servers list ]]></param>
<param n="enablePool" t="boolean"><![CDATA[Pool status]]></param>
Expand Down Expand Up @@ -51,6 +51,7 @@
]]></param>
<param n="tier1_lr" t="string"><![CDATA[
]]></param>
<param n="pool_uuid" t="string"><![CDATA[Uuid of pool]]></param>
<script encoded="false"><![CDATA[/**************************************************
* This script initializes pool properties objects *
* and creats pool object. *
Expand All @@ -60,6 +61,9 @@ try{
if(workflowRuntime.getAviVroClient() !=null){
// Check if selected healthmonitor or create new
poolObject = new AviPool();
if(pool_uuid){
poolObject.setUuid(pool_uuid);
}
if (CreateHealthMonitor == false){
var HM_refs = new Array();
if(healthMonitor!=null){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<dunes-script-module name="createVRAPoolGroup"
result-type="Avi:WorkflowRuntime" api-version="6.0.0"
id="3d491515-9cdf-437c-ae83-88142172c715" version="3.0.1"
id="3d491515-9cdf-437c-ae83-88142172c715" version="3.0.3"
allowed-operations="vfe">
<param n="workflowRuntime" t="Avi:WorkflowRuntime"><![CDATA[
]]></param>
Expand All @@ -17,6 +17,7 @@
<param n="instancePort" t="number"><![CDATA[
]]></param>
<param n="HealthMonitorName" t="string"><![CDATA[HealthMonitorName]]></param>
<param n="pool_group_uuid" t="string"><![CDATA[Uuid of PoolGroup]]></param>
<script encoded="false"><![CDATA[try{
if(workflowRuntime.getAviVroClient() !=null){
firstPoolName=poolGroupName+"_Pool1";
Expand Down Expand Up @@ -79,6 +80,9 @@
secondPoolGroupMemberObject = new AviPoolGroupMember();
secondPoolGroupMemberObject.setPoolRef("/api/pool?name="+seconPoolName);
var poolGroupObject = new AviPoolGroup() ;
if (pool_group_uuid){
poolGroupObject.setUuid(pool_group_uuid);
}
poolGroupObject.setCloudRef("/api/cloud?name="+ServerCloud);
poolGroupObject.setTenantRef("/api/tenant?name="+Tenant)
poolGroupObject.setName(poolGroupName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<dunes-script-module name="createVRAPoolObj"
result-type="Avi:WorkflowRuntime" api-version="6.0.0"
id="0cfaebed-a678-43d2-9992-1bdde8e56ecc" version="3.0.1"
id="0cfaebed-a678-43d2-9992-1bdde8e56ecc" version="3.0.2"
allowed-operations="vfe">
<param n="PoolServers" t="Array/string"><![CDATA[Pool servers list ]]></param>
<param n="poolName" t="string"><![CDATA[Pool name]]></param>
Expand All @@ -10,8 +10,8 @@
<param n="HealthMonitorName" t="string"><![CDATA[New healthmonitor name]]></param>
<param n="workflowRuntime" t="Avi:WorkflowRuntime"><![CDATA[Object of the plugin]]></param>
<param n="instance_port" t="number"><![CDATA[ ]]></param>
<param n="tier1_lr" t="string"><![CDATA[
]]></param>
<param n="tier1_lr" t="string"><![CDATA[]]></param>
<param n="pool_uuid" t="string"><![CDATA[Uuid of pool object]]></param>
<script encoded="false"><![CDATA[/**************************************************
* This script initializes pool properties objects *
* and creats pool object. *
Expand All @@ -20,6 +20,9 @@
try{
if(workflowRuntime.getAviVroClient() !=null){
poolObject = new AviPool();
if (pool_uuid){
poolObject.setUuid(pool_uuid);
}
if (HealthMonitorName == null){
}else if (null != HealthMonitorName || HealthMonitorName != "") {
var HMref ="/api/healthmonitor?name="+HealthMonitorName;
Expand Down Expand Up @@ -72,7 +75,7 @@ try{
if(ServerCloud=="" || ServerCloud==null){
ServerCloud="Default-Cloud";
}
if(tier1_lr!==null && tier1_lr!=""){
if(tier1_lr){
poolObject.setTier1Lr(tier1_lr);
}
poolObject.setCloudRef("/api/cloud?name="+ServerCloud);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dunes-script-module name="createVirtualServiceObj"
result-type="Avi:WorkflowRuntime" api-version="6.0.0"
id="d84d0b9a-93f0-4339-8db7-db20f3c43124" version="1.1.6"
id="d84d0b9a-93f0-4339-8db7-db20f3c43124" version="1.1.8"
allowed-operations="vfe">
<param n="Name" t="string"><![CDATA[Virtual service name]]></param>
<param n="poolgroupName" t="string"><![CDATA[Poolgroup name]]></param>
Expand Down Expand Up @@ -50,8 +50,8 @@
<param n="useVipAsSnat" t="boolean"><![CDATA[Use the Virtual IP as the SNAT IP for health monitoring]]></param>
<param n="vsVipName" t="string"><![CDATA[Name of the vsvip]]></param>
<param n="workflowRuntime" t="Avi:WorkflowRuntime"><![CDATA[Object of the plugin]]></param>
<param n="network_profile" t="string"><![CDATA[]]>
</param>
<param n="network_profile" t="string"><![CDATA[]]></param>
<param n="virtual_service_uuid" t="string"><![CDATA[Uuid of virtual service object]]></param>
<script encoded="false"><![CDATA[/*************************************************************
* This script initializes Virtual service properties objects *
* and puts user input into the Virtual service object *
Expand Down Expand Up @@ -187,6 +187,9 @@ try {
// virtualServiceObject = Server.findForType('Avi:VirtualService', System.getObjectId(virtualServiceObject));
virtualServiceObject = new AviVirtualService();
if (virtual_service_uuid){
virtualServiceObject.setUuid(virtual_service_uuid);
}
if (allowInvalidClientCert){
virtualServiceObject.setAllowInvalidClientCert(allowInvalidClientCert);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<dunes-script-module
name="createVirtualServiceWithIPAMObj"
result-type="Avi:WorkflowRuntime" api-version="6.0.0"
id="6c6df3ee-19dd-4edd-aee0-03c649789ef8" version="3.0.1"
id="6c6df3ee-19dd-4edd-aee0-03c649789ef8" version="3.0.3"
allowed-operations="vfe">
<param n="Name" t="string"><![CDATA[Virtual service name]]></param>
<param n="poolgroupName" t="string"><![CDATA[Poolgroup name]]></param>
Expand Down Expand Up @@ -53,6 +53,7 @@
<param n="workflowRuntime" t="Avi:WorkflowRuntime"><![CDATA[Object of the plugin]]></param>
<param n="network_security_policy_name" t="string"><![CDATA[Network Security policy name]]></param>
<param n="http_policy_set_name" t="string"><![CDATA[Http policy set name]]></param>
<param n="virtual_service_uuid" t="string"><![CDATA[Uuid of virtual service object]]></param>
<script encoded="false"><![CDATA[/*************************************************************
* This script initializes Virtual service properties objects *
* and puts user input into the Virtual service object *
Expand Down Expand Up @@ -197,6 +198,10 @@ try {
//var vsvipName="vsvip-test_vs-vmware_cloud";
// Set the configuration for virtual service.
virtualServiceObject = new AviVirtualService();
if (virtual_service_uuid){
virtualServiceObject.setUuid(virtual_service_uuid);
}
if (allowInvalidClientCert){
virtualServiceObject.setAllowInvalidClientCert(allowInvalidClientCert);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dunes-script-module name="createVsVIPObj"
result-type="Avi:WorkflowRuntime" api-version="6.0.0"
id="057cde0a-8232-4869-9094-1073d17c0587" version="3.0.1"
id="057cde0a-8232-4869-9094-1073d17c0587" version="3.0.3"
allowed-operations="vfe">
<param n="Tenant" t="string"><![CDATA[Tenant name]]></param>
<param n="name" t="string"><![CDATA[Vs vip name]]></param>
Expand All @@ -13,10 +13,9 @@
<param n="autoAllocateFloatingIp" t="boolean"><![CDATA[Auto allocate floating IP]]></param>
<param n="aviAllocatedVip" t="boolean"><![CDATA[Allocate VIP]]></param>
<param n="workflowRuntime" t="Avi:WorkflowRuntime"><![CDATA[Object of the plugin]]></param>
<param n="tier1" t="string"><![CDATA[
]]></param>
<param n="ServerCloud" t="string"><![CDATA[
]]></param>
<param n="tier1" t="string"><![CDATA[]]></param>
<param n="ServerCloud" t="string"><![CDATA[]]></param>
<param n="vsvip_uuid" t="string"><![CDATA[Uuid of vsvip object]]></param>
<script encoded="false"><![CDATA[/************************************************************
* This action initializes VS_VIP properties objects *
* and puts user input into the VS_VIP object *
Expand All @@ -25,6 +24,9 @@
try{
if(workflowRuntime.getAviVroClient() !=null){
vsVipObject = new AviVsVip() ;
if (vsvip_uuid){
vsVipObject.setUuid(vsvip_uuid);
}
// Set Configuration for create VsVip
vsVipObject.setTenantRef("/api/tenant?name="+Tenant);
if (eastWestPlacement){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>Exported from [server]</comment>
<entry key="categoryPath">com.vmware.avi</entry>
<entry key="name">fetchUuidbyName</entry>
<entry key="type">ScriptModule</entry>
<entry key="id">aab1273f-30f0-4cef-ad2b-da6832d71040</entry>
</properties>
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version='1.0' encoding='UTF-8'?>
<dunes-script-module name="fetchUuidbyName"
result-type="string" api-version="6.0.0"
id="aab1273f-30f0-4cef-ad2b-da6832d71040" version="1.0.1"
allowed-operations="vfe">
<param n="controller" t="string"><![CDATA[IP of the controller]]></param>
<param n="objectType" t="string"><![CDATA[Add object type ]]></param>
<param n="objectName" t="string"><![CDATA[Add object type ]]></param>
<script encoded="false"><![CDATA[/************************************************************
* This action fetch AVI object UUID by Name *
* and return object name. *
*************************************************************/
try{
if(controller == null){
return null;
}
var vroClientArray = Server.findAllForType('Avi:AviVroClient','');
var aviPlugin = null;
var controllerIp = controller.substring(0, controller.lastIndexOf("-"));
var clientTenant = controller.substring(controller.lastIndexOf("-") + 1).toLowerCase();
for each(aviVroClient in vroClientArray){
if(aviVroClient != null){
vroController = aviVroClient.cred.controller;
controllerTenant = aviVroClient.cred.tenant;
if((vroController == controllerIp)&&(controllerTenant == clientTenant)){
System.log("Found client with the given IP");
aviPlugin = aviVroClient;
}
}
}
if (aviPlugin != null){
if(objectType=="healthmonitor" && (objectName != "" || objectName != null)){
var healthMonitorObj = AviHealthMonitor();
healthMonitorObj = aviPlugin.getObjectByName('healthmonitor', objectName, clientTenant);
return healthMonitorObj.getUuid();
}else if(objectType=="pool" && (objectName != "" || objectName != null)){
var poolObj = AviPool();
poolObj = aviPlugin.getObjectByName('pool', objectName, clientTenant);
return poolObj.getUuid();
}else if(objectType=="poolgroup" && (objectName != "" || objectName != null)){
var poolGroupObj = AviPoolGroup();
poolGroupObj = aviPlugin.getObjectByName('poolgroup', objectName, clientTenant);
return poolGroupObj.getUuid();
}else if(objectType=="vsvip" && (objectName != "" || objectName != null)){
var vsvipObj = AviVsVip();
vsvipObj = aviPlugin.getObjectByName('vsvip', objectName, clientTenant);
return vsvipObj.getUuid();
}else if(objectType=="virtualservice" && (objectName != "" || objectName != null)){
var virtualserviceObj = AviVirtualService();
virtualserviceObj = aviPlugin.getObjectByName('virtualservice', objectName, clientTenant);
return virtualserviceObj.getUuid();
}else {
}
}
}catch(e){
System.log("Object name is not found.");
return null;
}
]]></script>
</dunes-script-module>
Loading

0 comments on commit 82fa03d

Please sign in to comment.