cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8733
Views
0
Helpful
2
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameVM Deployment with USER IP input
Description
Prerequisites
  1. Tested on 5.2.0.1
CategoryWorkflow
ComponentsvSphere 5.x
User Inputs

Instructions for Regular Workflow Use:

  1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
  2. Unzip the file on your computer. Should end up with a .WFD file.
  3. Log in to UCS Director as a user that has "system-admin" privileges.
  4. Navigate to "Policies-->Orchestration" and click on "Import".
  5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
  6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
  7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
  8. Click "Submit".
  9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

The Request:

===========

1) User can enter IP, Mask and Gate way for VM

2) User can enter IP, Mask and Gate way for Backup Network for VM (these are optional fields)

3) Be able to name the VM (Hostname)

4) Be able to supply a comment for the VM

5) User does not select the vCenter network, but the system derives the vCenter network from the Gateway input

6) User does not select the vCenter backup network, but the system derives the vCenter backup network from the IP input

7) User selects Mask from custom LOV (list of values) field

8) User select backup Mask from custom LOV (list of values) field

9) User can select VM Memory from custom LOV (list of values) field

10) User can select VM CPU from custom LOV (list of values) field

11) User can select VM disk size from custom LOV (list of values) field

12) User can select Catalog to deploy from

13) User can select VDC to deploy into

14) Backup network requirement is selected from custom LOV (list of values) field

15) CSV File name and path is selectable

16) User can also place CSV file on UCSD and everything can be read in via CSV file and deploy VM(s) on mass scale

17) Post provisioning workflow input (currently coded for 2 inputs)

New:

The latest addition of the workflow works with the VMWARE  distributed switch (Thank you Jordan Glamann):

The Pre-requisites:

The vCenter the Networks are named in the following manner:

Production 192.168.40.0

Production 192.168.41.0

Production 192.168.42.0

Production 192.168.43.0

Production 192.168.44.0

Backup 192.168.70.0

Production 192.168.45.64

Production 192.168.45.128/28

The gateway is at network + 1 (i.e. the 192.168.40.0 GW = 192.168.40.1,  192.168.45.64 GW = 192.168.45.65)

(the calculation in the code is done GW - 1 = Search Network.

Screen Shot 2015-02-17 at 6.20.39 AM.png

Screen Shot 2015-02-17 at 6.21.01 AM.png

Display in UCSD:

Screen Shot 2015-02-17 at 6.21.51 AM.png

The Workflow needs to be set for the environment:

The current User Input (fields can be turned on and off)

Screen Shot 2015-02-17 at 6.33.23 AM.png

All the workflow inputs (if admin value is not set user will be asked that question):

Screen Shot 2015-02-17 at 6.33.50 AM.png

Screen Shot 2015-02-17 at 6.34.20 AM.png

The fields in the red circles need to be adjusted for the new UCSD environment!


Import of file is in need of improvement (I am aware!)

A trick to not see the "select..." in the LOV fields:

Screen Shot 2015-02-17 at 6.37.13 AM.png

1) Location of key for the API calls:

Select Admin

Screen Shot 2015-02-17 at 6.27.30 AM.png

Copy the key:

Screen Shot 2015-02-17 at 6.27.45 AM.png

UCSD Policy setup:

VDC

Screen Shot 2015-02-17 at 6.42.12 AM.png

Same as the VDC template:

Screen Shot 2015-02-17 at 6.42.23 AM.png

The VDC/VDC template details:

Screen Shot 2015-02-17 at 6.42.37 AM.png

The most important is the network Policy setup:

Screen Shot 2015-02-17 at 6.42.57 AM.png

Screen Shot 2015-02-17 at 6.43.07 AM.png

Screen Shot 2015-02-17 at 6.43.13 AM.png

This policy gets overlaid during execution with new IP information. Basically a IP pool of one.

Screen Shot 2015-02-17 at 6.43.19 AM.png

The Service Delivery (system) policy:

Screen Shot 2015-02-17 at 6.44.05 AM.png

The catalog is set up with post provisioning and 2 user inputs:

Screen Shot 2015-02-17 at 7.44.30 AM.png

The resulting e-mail from the workflow and the passed along user inout (right now in admin over ride or in CSV file)

Screen Shot 2015-02-17 at 7.53.18 AM.png

The CSV file setup:

-rw-r--r-- 1 root root        493 Feb 16 17:56 vmDetails2.txt

[root@localhost tmp]# cat vmDetails2.txt

vmName7,Comment7,2,2048,20,VDC_CULPEPER,LinuxApp,192.168.45.74,255.255.255.0,192.168.45.65,0,0.0.0.0,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

vmName5,Comment5,2,2048,20,VDC_CULPEPER,LinuxApp,192.168.45.73,255.255.255.0,192.168.45.65,1,192.168.70.104,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

vmName6,Comment6,2,2048,20,VDC_CULPEPER,LinuxApp,192.168.45.132,255.255.255.0,192.168.45.129,1,192.168.70.105,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

Manual Execution:

Screen Shot 2015-02-17 at 7.02.00 AM.png

Screen Shot 2015-02-17 at 7.09.15 AM.png

Screen Shot 2015-02-17 at 7.10.44 AM.png

The CSV file Execution:

[root@localhost tmp]# cat vmDetails2.txt

vmName8,Comment8,2,2048,20,VDC_CULPEPER,LinuxApp,192.168.45.75,255.255.255.0,192.168.45.65,0,0.0.0.0,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

vmName9,Comment9,2,2048,20,VDC_CULPEPER,LinuxApp,192.168.45.76,255.255.255.0,192.168.45.65,1,192.168.70.105,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

vmName0,Comment0,2,2048,20,VDC_CULPEPER,LinuxApp,192.168.45.133,255.255.255.0,192.168.45.129,1,192.168.70.106,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

[root@localhost tmp]#

There should be 2 version of the workflow for user consumption.

One for manual where the CSV file flag is set to 0.

One for CSV file oration where all fields are dummied out and there is no user interaction.

For this demonstration I just placed a few dummy entries!

Change the Flag:

Screen Shot 2015-02-17 at 7.16.02 AM.png

Enter a few dummy numbers:

Screen Shot 2015-02-17 at 7.16.23 AM.png

There are 4 SR numbers in this example

     1 - the Uber workflow

     2 - the children (3)

     3 - One died du to IP address was already in use.

Screen Shot 2015-02-17 at 7.27.38 AM.png

The user Catalog offering:

Screen Shot 2015-02-17 at 7.36.16 AM.png

Screen Shot 2015-02-17 at 7.36.23 AM.png

The user execution:

(notice the change user - due to network settings a more privileged user is required to run this section of the workflow)

Screen Shot 2015-02-17 at 7.34.11 AM.png

Screen Shot 2015-02-17 at 8.19.06 AM.png

The Code:

Several things to point out in the code.

1) it can read from file

2) it can take user input

3) it uses API calls to UCSD

4) it uses reports to derive items

     obtaining the the vCenter Cloud name from the VDC

     obtaining the VDC ID from a VDC name (CSV file)

     obtaining the VDC Name from the VDC ID (User input)

     obtaining the vCenter Network names from a report

5) generic function to call API calls

6) XML parsing

7) taking IP/GW address apart (split) and gluing them back together

8) building names like this: Dallas@vSwitch3@Virtual Machine Portgroup@Production 192.168.45.128/28

9) Looping through report out put and matching (index)

10) Counters

11) Some error checking (yes could be more, I know) (AI)

12) Creating a new VDC (temp) on the fly from the VDC template

13) dealing with the resulting policies (delete / cleanup)

          VDC_CULPEPER4264_Network Policy

          VDC_CULPEPER4264_Computing Policy

          VDC_CULPEPER4264_Storage Policy

          VDC_CULPEPER4264_System Policy

14) adding a backup network on the fly to the network policy and deleting it after the deployment

15) the API calls are derived from the REST API Browser (Enable Developer Menu)

16) the report calls are derived from the Meta Report button (Enable Developer Menu)

Screen Shot 2015-02-17 at 7.21.39 AM.png

Also what was helpful was the ability to investigate a few internal functions:

Run Java Script on the fly

Policies -> Orchestration -> Custom Workflow Tasks -> Launch Interpreter

Get Detailed VDC information

===========================================================

UCSD 5.3

========

importPackage(com.cloupia.model.cIM);

importPackage(com.cloupia.service.cIM.inframgr);

var vdc = VDCUtil.getVDC(142);

var vvm = InfraPersistenceUtil.getVMWareVMSummary(1536);

var cat = VDCUtil.getVDCCatalogItem(87);

printObj(vdc);

printObj(vvm);

printObj(cat);

5.4 Fix of printObj (non interpreter)

=============================

importPackage(com.cloupia.model.cIM);

importPackage(com.cloupia.service.cIM.inframgr);

importClass(org.apache.commons.lang3.builder.ReflectionToStringBuilder);

var vvm = InfraPersistenceUtil.getVMWareVMSummary(2);

var allProperties = ReflectionToStringBuilder.toString(vvm);

//logger.addInfo(allProperties); //print all the properties in single line but this will truncate the content based on the String size

var prop = allProperties.split(",");//split the properties using "," and print

for (var i = 0; i < prop.length; i++) {

                logger.addInfo(prop[i]);

}

Unknown.png

Option #2

  The method logger.addInfo() will accept 1024 characters string length only. If the string length is more than 1024 characters , It will truncate the characters at the end. So I print the 1024 characters in a line and remaining characters in the next line.

Sample script to print the properties in a single line

importPackage(com.cloupia.model.cIM);

importPackage(com.cloupia.service.cIM.inframgr);

importPackage(java.util);

importClass(org.apache.commons.lang3.builder.ReflectionToStringBuilder);

/**

* Split text into ‘n’ number of characters.

*

* @Param text the text to be split.

* @Param size the split size.

* @return an array of the split text.

*/

function splitToNChar(text, size) {

                var parts = new ArrayList();

                var length = text.length();

                for (var i = 0; i < length; i += size)

                {

                                parts.add(text.substring(i, Math.min(length, i + size)));

                }

                // Nashorn way!

                var Array = Java.type("java.lang.reflect.Array");

                var JString = Java.type("java.lang.String");

                // note ".class" property access to get java.lang.Class object

                var strArray = Array.newInstance(JString.class, 0);

                return parts.toArray(strArray);

}

              

var vvm = InfraPersistenceUtil.getVMWareVMSummary(2);

var allProperties = ReflectionToStringBuilder.toString(vvm);

var prop = splitToNChar(allProperties,1024);

for (var i = 0; i < prop.length; i++) {

                logger.addInfo(prop[i]);

}

Screen Shot 2015-02-12 at 6.02.33 AM.pngScreen Shot 2015-02-12 at 6.02.46 AM.png

The code in the attached workflow:

importPackage(com.cloupia.model.cIM);

importPackage(java.util);

importPackage(java.lang);

importPackage(java.io);

importPackage(com.cloupia.lib.util);

importPackage(com.cloupia.model.cIM);

importPackage(com.cloupia.service.cIM.inframgr);

importPackage(org.apache.commons.httpclient);

importPackage(org.apache.commons.httpclient.cookie);

importPackage(org.apache.commons.httpclient.methods);

importPackage(org.apache.commons.httpclient.auth);

importPackage(com.cloupia.model.cEvent.notify);

importPackage(com.cloupia.lib.util.mail);

importPackage(com.cloupia.fw.objstore);

importPackage(com.cloupia.lib.util.managedreports);

//

// User Input Parameterts

//

var VDC  = "vdc";

var vdc = ctxt.getInput(VDC);

var ID  = "ID";

var id = ctxt.getInput(ID);

var PASSWORD  = "Password";

var password = ctxt.getInput(PASSWORD);

var KEY  = "Key";

var key = ctxt.getInput(KEY);

var UCSDIP  = "UCSD_IP";

var ucsdip = ctxt.getInput(UCSDIP);

var CAT  = "Catalog";

var cat = ctxt.getInput(CAT);

var VMIP  = "VM_IP";

var vmip = ctxt.getInput(VMIP);

var VMMASK  = "VM_Mask";

var vmmask = ctxt.getInput(VMMASK);

var VMGW  = "VM_GW";

var vmgw = ctxt.getInput(VMGW);

var VMBIP  = "VMB_IP";

var vmbip = ctxt.getInput(VMBIP);

var VMBMASK  = "VMB_Mask";

var vmbmask = ctxt.getInput(VMBMASK);

var VMBGW  = "VMB_GW";

var vmbgw = ctxt.getInput(VMBGW);

var VMOWNER  = "VM_Owner";

var vmowner = ctxt.getInput(VMOWNER);

var VMNAME  = "VM_Name";

var vmname = ctxt.getInput(VMNAME);

var VMCOMMENT  = "VM_Comment";

var vmcomment = ctxt.getInput(VMCOMMENT);

var VMMEMORY  = "VM_Memory";

var vmmemory = ctxt.getInput(VMMEMORY);

var VMCPU  = "VM_CPU";

var vmcpu = ctxt.getInput(VMCPU);

var WFI1  = "WFI1";

var wfi1 = ctxt.getInput(WFI1);

var WFI2  = "WFI2";

var wfi2 = ctxt.getInput(WFI2);

var CSVFILE  = "CSV_FILE";

var csvfile = ctxt.getInput(CSVFILE);

var CloudSelector1 = [ ctxt.getInput("CloudSelector") ];

var quantity = Integer.valueOf( ctxt.getInput("PROVISION_QTY"));

var backupnetwork = Integer.valueOf( ctxt.getInput("BackupNetwork"));

var backupnetworkadaptername = [ ctxt.getInput("BackupNetworkAdapterName") ];

var NetWorkAdapterType1 = [ ctxt.getInput("NetWorkAdapterType") ];

var VDCTemplateNumber = [ ctxt.getInput("VDC_Template") ];

var disksize1 = [ ctxt.getInput("DiskSize1") ];

var csv_file_flag = [ ctxt.getInput("CSV_FILE_FLAG") ];

var delaySecondsBetweenInvocation = 30;

function CatName2ID(P1) {

  var networkPolicyReport = ctxt.getAPI().userAPIFilterTabularReport("10","null","CATALOG-T40","Catalog_Name",P1);

  logger.addInfo("vdc networkPolicyReport = " + networkPolicyReport);

  var policyList = networkPolicyReport.rows;

  logger.addInfo("policyList = " + policyList);

  if(policyList != null && policyList.size() > 0){

  var map = networkPolicyReport.getRow(0);

  logger.addInfo("Catalog_ID = " + map.get("Catalog_ID"));

  }

  return map.get("Catalog_ID");

}

function sleep()

{

              var milliseconds = delaySecondsBetweenInvocation * 1000;

              Thread.sleep(milliseconds);

}

//

// find the VDC id from the VDC name from this report

//

function VDCName2VDCid(P1) {

  var xyz = ctxt.getAPI().userAPIFilterTabularReport("10","null","VDC-T45","vDC_Name",P1);

  logger.addInfo("vdc xyz = " + xyz);

  var policyList = xyz.rows;

  logger.addInfo("policyList = " + policyList);

  if(policyList != null && policyList.size() > 0){

  var map = xyz.getRow(0);

  logger.addInfo("VDC_ID = " + map.get("vDC_ID"));

  }

  return map.get("vDC_ID");

}

//

// Standard Reporting functions to asertain information from a Report

//

function getReport(reportContext, reportName)

{

     var report = null;

      try

      {

             report = ctxt.getAPI().getConfigTableReport(reportContext, reportName);

      } catch(e)

      {

      }

      if (report == null)

      {

             return ctxt.getAPI().getTabularReport(reportName, reportContext);

      } else

     {

           var source = report.getSourceReport();

           return ctxt.getAPI().getTabularReport(source, reportContext);

     }

}

//

// Standard Reporting functions to asertain information from a Report

//

function getReportView(reportContext, reportName)

{

      var report = getReport(reportContext, reportName);

     if (report == null)

     {

           logger.addError("No such report exists for the specified context "+reportName);

          return null;

     }

     return new TableView(report);

}

//

// GENERIC HTTP Function

//

function GenericHTTPFunction(P1, P2){

var ucsdIP = ucsdip;

var ucsdUser = id;

var ucsdPassword = password;

//var apiUri = "/cloupia/api-v2/vdc";

var apiUri = P2;

//XML Body

//

// port group is drived from port group name by IP

//xmlBody = "<cuicOperationRequest><operationType>MODIFY_NETWORK_POLICY</operationType><payload><![CDATA[<ModifyVDCNetworkPolicy><!-- Accepts value from the list: vDC--><vdcId>"+vdc+"</vdcId><!-- Accepts value from the list: vmwareVmPortGroupIdentity--><portgroup>"+PortGroupAssembly+"</portgroup><isDHCP>false</isDHCP>   <!-- Set this value only when isDHCP not equals to true  --><!-- Accepts value from the list: IPPoolSourceType--><ipAddressSource>1</ipAddressSource>   <!-- Set this value only when ipAddressSource not equals to 0  --><staticIpPool>"+vmip+"</staticIpPool>   <!-- Set this value only when ipAddressSource not equals to 0  --><subnetMask>"+vmmask+"</subnetMask>   <!-- Set this value only when ipAddressSource not equals to 0  --><gateway>"+vmgw+"</gateway>   <!-- Set this value only when ipAddressSource not equals to 1  --><!-- Accepts value from the list: VMWareIPPoolPolicy--><staticIPPoolPolicy></staticIPPoolPolicy></ModifyVDCNetworkPolicy>]]></payload></cuicOperationRequest>";

xmlBody = P1;

var httpClient = new HttpClient();

httpClient.getHostConfiguration().setHost(ucsdIP, 80, "http");

httpClient.getParams().setCookiePolicy("default");

httpClient.getParams().setAuthenticationPreemptive(true);

var defaultcreds = new UsernamePasswordCredentials(ucsdUser, ucsdPassword);

httpClient.getState().setCredentials(new AuthScope(ucsdIP, -1, null), defaultcreds);

// Login to WFA.

var httpMethod = new PostMethod(apiUri);

httpMethod.setRequestEntity(new StringRequestEntity(xmlBody));

httpMethod.addRequestHeader("Content-Type", "application/xml");

//httpMethod.addRequestHeader("X-Cloupia-Request-Key", "5CF4C115F0034B189616B2B8EBA0F220");

httpMethod.addRequestHeader("X-Cloupia-Request-Key", key);

httpClient.executeMethod(httpMethod);

// Check that login is successful. If so, continue. Otherwise, fail task after logging

// the error code and response.

var statuscode = httpMethod.getStatusCode();

if (statuscode != 201 && statuscode != 200)

{

    logger.addError("Request failed. HTTP response code: "+statuscode);

    logger.addError("Response = "+httpMethod.getResponseBodyAsString());

     httpMethod.releaseConnection();

     // Set this task as failed.

     ctxt.setFailed("Request failed.");

} else {

    logger.addInfo("Request was Succcessful.");

    logger.addInfo("Response = "+httpMethod.getResponseBodyAsString());

    var x2 = httpMethod.getResponseBodyAsString();

        // All done. Release HTTP connection anyway.

    httpMethod.releaseConnection();

    return x2;

}

}

//

// generic http call end

//

//

// Function to create new VDC from Temple for this execution of VM instance

//

function CloneVDCFromTemplate(){

var ucsdIP = ucsdip;

var ucsdUser = id;

var ucsdPassword = password;

var apiUri = "/cloupia/api-v2/vdc";

//XML Body

//

xmlBody ="<cuicOperationRequest><payload><![CDATA[<VDCConfig><vdcName>"+NewTempVDCName+"</vdcName><vdcDescription></vdcDescription><!-- Accepts value from the list: vDCProfile--><vdcProfileId>"+VDCTemplateNumber+"</vdcProfileId><firstApproverUsername></firstApproverUsername><secondApproverUsername></secondApproverUsername><systemPolicyName></systemPolicyName><networkPolicyName></networkPolicyName><storagePolicyName></storagePolicyName><computingPolicyName></computingPolicyName><groupID>"+groupId+"</groupID></VDCConfig>]]></payload></cuicOperationRequest>";

var httpClient = new HttpClient();

httpClient.getHostConfiguration().setHost(ucsdIP, 80, "http");

httpClient.getParams().setCookiePolicy("default");

httpClient.getParams().setAuthenticationPreemptive(true);

var defaultcreds = new UsernamePasswordCredentials(ucsdUser, ucsdPassword);

httpClient.getState().setCredentials(new AuthScope(ucsdIP, -1, null), defaultcreds);

// Login to WFA.

var httpMethod = new PostMethod(apiUri);

httpMethod.setRequestEntity(new StringRequestEntity(xmlBody));

httpMethod.addRequestHeader("Content-Type", "application/xml");

//httpMethod.addRequestHeader("X-Cloupia-Request-Key", "5CF4C115F0034B189616B2B8EBA0F220");

httpMethod.addRequestHeader("X-Cloupia-Request-Key", key);

httpClient.executeMethod(httpMethod);

// Check that login is successful. If so, continue. Otherwise, fail task after logging

// the error code and response.

var statuscode = httpMethod.getStatusCode();

if (statuscode != 201 && statuscode != 200)

{

    logger.addError("Request failed. HTTP response code: "+statuscode);

    logger.addError("Response = "+httpMethod.getResponseBodyAsString());

     httpMethod.releaseConnection();

     // Set this task as failed.

     ctxt.setFailed("Request failed.");

} else {

    logger.addInfo("Request was Succcessful.");

    var response = httpMethod.getResponseBodyAsString();

    logger.addInfo("Response = "+response);

    // All done. Release HTTP connection anyway.

    httpMethod.releaseConnection();

//var response = post.getResponseBodyAsString();

//var response = xmlStr;

var is = new ByteArrayInputStream(response.getBytes());

var doc =XMLUtil.parseXMLDocument(is);

var element = XMLUtil.getElementByTagName(doc.getDocumentElement(),"VDC_ID");

logger.addInfo("New VDC Id : "+XMLUtil.getText(element));

NewVDCIDFromCLone = XMLUtil.getText(element);

}

}

//

//

// =========================== Master Deploy================================

//

//

function Master_Deploy()

{

//

// write to Log logger

//

logger.addInfo("----------------------------------------------------------");

var vdc2 = VDCUtil.getVDC(vdc);

var vdcName = vdc2.getVdcName();

var cat2 = VDCUtil.getVDCCatalogItem(cat);

var catName = cat2.getCatalogItemName();

var vdcCloudName = vdc2.getCloudName();

var groupId = vdc2.groupId;

var vdcNetworkPolicyName = vdc2.getNetworkPolicy();

logger.addInfo("--------------------Temp VDC info--------------------------------------");

var vdcTemp = VDCUtil.getVDC(VDCTemplateNumber);

var vdcNameTemp = vdcTemp.getVdcName();

var vdcTempNetworkPolicyName = vdcTemp.getNetworkPolicy();

var vdcTempComputingPolicyName = vdcTemp.getComputingPolicy();

var vdcTempStoragePolicyName = vdcTemp.getStoragePolicy();

var vdcTempPrimaryDeployPolicyName = vdcTemp.getPrimaryDeployPolicy();

logger.addInfo("VDC Template Number  = "+VDCTemplateNumber);

logger.addInfo("VDC Template Name  = "+vdcNameTemp);

logger.addInfo("VDC Template vdcTempNetworkPolicyName Name  = "+vdcTempNetworkPolicyName);

logger.addInfo("VDC Template vdcTempComputingPolicyName Name  = "+vdcTempComputingPolicyName);

logger.addInfo("VDC Template vdcTempStoragePolicyName Name  = "+vdcTempStoragePolicyName);

logger.addInfo("VDC Template vdcTempPrimaryDeployPolicyName Name  = "+vdcTempPrimaryDeployPolicyName);

var NewVDCIDFromCLone = 0;

logger.addInfo("----------------------------------------------------------");

logger.addInfo("My SR ID = "+ctxt.getSrId());

logger.addInfo("VDC = "+vdc);

logger.addInfo("VDC Name = "+vdcName);

logger.addInfo("Catalog = "+cat);

logger.addInfo("Catalog Name = "+catName);

logger.addInfo("vdc Network Policy Name = "+vdcNetworkPolicyName);

logger.addInfo("vdc groupId number = "+groupId);

logger.addInfo("VM IP = "+vmip);

logger.addInfo("NewVDCIDFromCLone = "+NewVDCIDFromCLone);

var mySRID = ctxt.getSrId();

var NewTempVDCName = vdcName + mySRID;

if (vmip == null) {

    logger.addError("AI test 1 - IP Not set",+vmip);

    ctxt.setFailed("Request failed.");

}

if (vmmask == null) {

    logger.addError("AI test 2 - IP Mask Not set",+vmmask);

    ctxt.setFailed("Request failed.");

}

if (backupnetwork == 1) {

if (vmgw == null) {

    logger.addError("AI test 3 - IP GW Not set",+vmgw);

    ctxt.setFailed("Request failed.");

}

if (vmbip == null) {

    logger.addError("AI test 4 - IP B Not set",+vmbip);

    ctxt.setFailed("Request failed.");

}

if (vmbmask == null) {

    logger.addError("AI test 5 - IP B Mask Not set",+vmbmask);

    ctxt.setFailed("Request failed.");

}

if (vmbgw == null) {

    logger.addError("AI test 6 - IP B GW Not set",+vmbgw);

    ctxt.setFailed("Request failed.");

}

}

//

// Decission was made to derive from GW the vCenter network name

// this will allow for networks larger then class c

// thiswill allow for networks selected from example:

// Production 192.168.40.0

// Production 192.168.41.0

// Production 192.168.41.64

// Backup 192.168.70.0

// Even vCenter network names like this should work

// Production 192.68.42.128/25

//

// Swap if split shoud happen on IF vs. GW

//

//var vmipsplit = vmip.split("\\.",4);

var vmipsplit = vmgw.split("\\.",4);

var vmipsplitarray = vmipsplit[0] + "." + vmipsplit[1] + "." + vmipsplit[2];

var forthoctet = vmipsplit[3];

logger.addInfo("4th octet = "+vmipsplit[3]);

var forthoctetint = Integer.valueOf(forthoctet);

logger.addInfo("4th octet forthoctetint = "+forthoctetint);

var forthoctetintminus1 = Integer.valueOf(forthoctet) - 1;

logger.addInfo("4th octet forthoctetintminus1= "+forthoctetintminus1);

//

// Swap if GW - 1 is used for the network calculation

// i.e GW - 192.168.40.65

// vCenter nwtwork is called Production 192.168.40.64

// GW - 1 = 192.168.40.64

//

//var vmipsplitzero = vmipsplitarray + ".0";

var vmipsplitzero = vmipsplitarray + "." + forthoctetintminus1;

logger.addInfo("VM IP Split 0 = "+vmipsplit[0]);

logger.addInfo("VM IP Split 1 = "+vmipsplit[1]);

logger.addInfo("VM IP Split 2 = "+vmipsplit[2]);

logger.addInfo("VM IP Split 3 = "+vmipsplit[3]);

logger.addInfo("VM IP Split Zero= "+vmipsplitzero);

logger.addInfo("VM Mask = "+vmmask);

logger.addInfo("VM GW = "+vmgw);

logger.addInfo("VM Backup IP = "+vmbip);

var vmbipsplit = vmbip.split("\\.",4);

var vmbipsplitarray = vmbipsplit[0] + "." + vmbipsplit[1] + "." + vmbipsplit[2];

var vmbipsplitzero = vmbipsplitarray + ".0";

logger.addInfo("VM Backup IP Split 0 = "+vmbipsplit[0]);

logger.addInfo("VM Backup IP Split 1 = "+vmbipsplit[1]);

logger.addInfo("VM Backup IP Split 2 = "+vmbipsplit[2]);

logger.addInfo("VM Backup IP Split 3 = "+vmbipsplit[3]);

logger.addInfo("VM Backup IP Split Zero= "+vmbipsplitzero);

logger.addInfo("VM Backup Mask = "+vmbmask);

logger.addInfo("VM Backup GW = "+vmbgw);

logger.addInfo("VM Owner = "+vmowner);

logger.addInfo("VM NAME = "+vmname);

logger.addInfo("VM Comment = "+vmcomment);

logger.addInfo("VM Memory = "+vmmemory);

logger.addInfo("VM CPU = "+vmcpu);

logger.addInfo("Work FLow Input 1 = "+wfi1);

logger.addInfo("Work FLow Input 2 = "+wfi2);

logger.addInfo("CSV PATH and File  = "+csvfile);

logger.addInfo("Quantity = "+quantity);

logger.addInfo("backupnetwork FLAG = "+backupnetwork);

logger.addInfo("----------------------------------------------------------");

//

// figgure out Port Group Name from given IP

// Port Group Name in vCenter  = Production 192.168.40.0

// IP input by user 192.168.40.55

// IP gets 4 the field split off and zero added for the seach in the report

//

var buffer = new StringWriter();

var printer = new PrintWriter(buffer);

// Formatter exists in multiple packages, so it needs fully qualified name

var formatter = new com.cloupia.lib.util.managedreports.Formatter(new File("."), printer);

var reportName  = "PER_CLOUD_PORTGROUP_CONFIG_REPORT";

//

// Clound selector needs to be obtained from given VDC

// things to do

//

logger.addInfo("vdcCloudName generated from the VDC input = "+vdcCloudName);

var repContext  = util.createContext("cloud", vdcCloudName , null);

var report = getReportView(repContext, reportName);

var count = 0;

var countB = 0;

for (var i=0; i<report.rowCount(); i++)

{

      var pgn = report.getColumnValue(i, "Port Group Name");

      logger.addInfo("Content in Port Group Column = "+pgn);

      logger.addInfo("Looking for this in Port Group name = "+vmipsplitzero);

      if (pgn.indexOf(vmipsplitzero) > -1)

      {

         logger.addInfo("Found in Port Group for Main eth interface");

         logger.addInfo("Found in Port Group Column = "+pgn);

         logger.addInfo("Found the Port Group name from given IP range = "+vmipsplitzero);

         logger.addInfo("Cloud Selector = "+vdcCloudName);

         var vswitchName = report.getColumnValue(i, "vSwitch Name");

         logger.addInfo("vSwitch Name = "+vswitchName);

         var portGroupType = report.getColumnValue(i, "Port Group Type");

         logger.addInfo("Port Group Type = "+portGroupType);

         var PortGroupAssembly = vdcCloudName + "@" + vswitchName + "@" + portGroupType + "@" + pgn;

         logger.addInfo("PortGroupAssembly = "+PortGroupAssembly);

         count++;

         logger.addInfo("Count = "+count);

      }

      if (backupnetwork == 1) {

      // Looking for the backup interface

      if (pgn.indexOf(vmbipsplitzero) > -1)

      {

         logger.addInfo("Found in Port Group for Backup eth interface");

         logger.addInfo("Found in Port Group Column = "+pgn);

         logger.addInfo("Found the Port Group name from given IP range = "+vmbipsplitzero);

         logger.addInfo("Cloud Selector = "+vdcCloudName);

         var vswitchNameB = report.getColumnValue(i, "vSwitch Name");

         logger.addInfo("vSwitch Name = "+vswitchName);

         var portGroupTypeB = report.getColumnValue(i, "Port Group Type");

         logger.addInfo("Port Group Type = "+portGroupType);

         var PortGroupAssemblyB = vdcCloudName + "@" + vswitchNameB + "@" + portGroupTypeB + "@" + pgn;

         logger.addInfo("PortGroupAssembly = "+PortGroupAssemblyB);

         countB++;

         logger.addInfo("Count Backup = "+countB);

      }

      }

}

//}

if (countB == 0  && backupnetwork == 1) {

  logger.addInfo("Count Backup = "+countB);

    logger.addError("AI test 7 - No back up Network found",+countB);

    ctxt.setFailed("Request failed.");

}

if (count == 0 )  {

  logger.addInfo("Count  = "+count);

    logger.addError("AI test 8 - No  Network found",+count);

    ctxt.setFailed("Request failed.");

}

//

// obtain the network policy number from the network policy name

// The number is needed for the add backup network function

//

var reportName  = "PolicyFeature.report.net.drap.config";

var repContext  = util.createContext("global_admin", null , null);

var report = getReportView(repContext, reportName);

report = report.filterRowsByColumn("Policy Name", vdcNetworkPolicyName, false);

var vdcNetworkPolicyNameNumber = report.getColumnValue(0, "Policy ID");

logger.addInfo("vdcNetworkPolicyNameNumber = "+vdcNetworkPolicyNameNumber);

formatter.printTable(report);

printer.close();

//

// call the network change function

//

logger.addInfo("-------------------change main network policy---------------------------------------");

var input1 = "<cuicOperationRequest><operationType>MODIFY_NETWORK_POLICY</operationType><payload><![CDATA[<ModifyVDCNetworkPolicy><!-- Accepts value from the list: vDC--><vdcId>"+vdc+"</vdcId><!-- Accepts value from the list: vmwareVmPortGroupIdentity--><portgroup>"+PortGroupAssembly+"</portgroup><isDHCP>false</isDHCP>   <!-- Set this value only when isDHCP not equals to true  --><!-- Accepts value from the list: IPPoolSourceType--><ipAddressSource>1</ipAddressSource>   <!-- Set this value only when ipAddressSource not equals to 0  --><staticIpPool>"+vmip+"</staticIpPool>   <!-- Set this value only when ipAddressSource not equals to 0  --><subnetMask>"+vmmask+"</subnetMask>   <!-- Set this value only when ipAddressSource not equals to 0  --><gateway>"+vmgw+"</gateway>   <!-- Set this value only when ipAddressSource not equals to 1  --><!-- Accepts value from the list: VMWareIPPoolPolicy--><staticIPPoolPolicy></staticIPPoolPolicy></ModifyVDCNetworkPolicy>]]></payload></cuicOperationRequest>";

var ret1 = GenericHTTPFunction(input1, "/cloupia/api-v2/vdc");

logger.addInfo("ret1 = "+ret1);

logger.addInfo("-------------------change main network policy done---------------------------------");

logger.addInfo("Backup network Flag (1 = add network interface) = "+backupnetwork);

if (backupnetwork == 1) {

   logger.addInfo("-------------------add backup network policy---------------------------------------");

var input11 = "<cuicOperationRequest><operationType>ADD_NETWORK_TO_NETWORK_POLICY</operationType><payload><![CDATA[<AddNetworkToNetworkPolicyConfig><policyName>"+vdcNetworkPolicyName+";"+vdcNetworkPolicyNameNumber+"</policyName><nicAlias>"+backupnetworkadaptername+"</nicAlias><isMandatory>true</isMandatory><allowToChangePortGroups>false</allowToChangePortGroups><!-- Accepts value from the list: vmwareVmPortGroupIdentity--><virtualNetworkName>"+PortGroupAssemblyB+"</virtualNetworkName><copyFromTemplate>false</copyFromTemplate><!-- Set this value only when copyFromTemplate not equals to true  --><adapterType>"+NetWorkAdapterType1+"</adapterType><DHCP>false</DHCP><!-- Set this value only when isDHCP not equals to true  --><ipAddressSource>1</ipAddressSource><staticIPPool>"+vmbip+"</staticIPPool><subnetMask>"+vmbmask+"</subnetMask><gatewayIP>"+vmbgw+"</gatewayIP><!-- Accepts value from the list: VMWareIPPoolPolicy--><staticIPPoolPolicy></staticIPPoolPolicy></AddNetworkToNetworkPolicyConfig>]]></payload></cuicOperationRequest>";

var ret11 = GenericHTTPFunction(input11, "/cloupia/api-v2/vdc");

logger.addInfo("ret11 = "+ret11);

   logger.addInfo("-------------------add backup network policy done---------------------------------");

}

//

//clone vdc from template

//

logger.addInfo("-------------------Clone VDC from Template---------------------------------------");

logger.addInfo("Before NewVDCIDFromCLone"+NewVDCIDFromCLone);

//CloneVDCFromTemplate();

input10 ="<cuicOperationRequest><payload><![CDATA[<VDCConfig><vdcName>"+NewTempVDCName+"</vdcName><vdcDescription></vdcDescription><!-- Accepts value from the list: vDCProfile--><vdcProfileId>"+VDCTemplateNumber+"</vdcProfileId><firstApproverUsername></firstApproverUsername><secondApproverUsername></secondApproverUsername><systemPolicyName></systemPolicyName><networkPolicyName></networkPolicyName><storagePolicyName></storagePolicyName><computingPolicyName></computingPolicyName><groupID>"+groupId+"</groupID></VDCConfig>]]></payload></cuicOperationRequest>";

var ret10 = GenericHTTPFunction(input10, "/cloupia/api-v2/vdc");

logger.addInfo("ret10 = "+ret10);

var is = new ByteArrayInputStream(ret10.getBytes());

var doc =XMLUtil.parseXMLDocument(is);

var element = XMLUtil.getElementByTagName(doc.getDocumentElement(),"VDC_ID");

logger.addInfo("New VDC Id : "+XMLUtil.getText(element));

NewVDCIDFromCLone = XMLUtil.getText(element);

logger.addInfo("Afger NewVDCIDFromCLone"+NewVDCIDFromCLone);

logger.addInfo("After Function call .....NewVDCIDFromCLone = "+NewVDCIDFromCLone);

logger.addInfo("--------------------Temp VDC info--------------------------------------");

var vdcTempClone = VDCUtil.getVDC(NewVDCIDFromCLone);

var vdcNameTempClone = vdcTempClone.getVdcName();

var vdcTempNetworkPolicyNameClone = vdcTempClone.getNetworkPolicy();

var vdcTempComputingPolicyNameClone = vdcTempClone.getComputingPolicy();

var vdcTempStoragePolicyNameClone = vdcTempClone.getStoragePolicy();

var vdcTempPrimaryDeployPolicyNameClone = vdcTempClone.getPrimaryDeployPolicy();

logger.addInfo("VDC Template Number  Clone = "+NewVDCIDFromCLone);

logger.addInfo("VDC Template Name  Clone = "+vdcNameTempClone);

logger.addInfo("VDC Template vdcTempNetworkPolicyName Name  Clone = "+vdcTempNetworkPolicyNameClone);

logger.addInfo("VDC Template vdcTempComputingPolicyName Name  Clone= "+vdcTempComputingPolicyNameClone);

logger.addInfo("VDC Template vdcTempStoragePolicyName Name  Clone = "+vdcTempStoragePolicyNameClone);

logger.addInfo("VDC Template vdcTempPrimaryDeployPolicyName Name  Clone = "+vdcTempPrimaryDeployPolicyNameClone);

logger.addInfo("-------------------Clone VDC from Template Done---------------------------------------");

//

// Set up the provision VM information

//

var params = new APIProvisionParams();

params.setCatalogName(catName);

logger.addInfo("params cat = "+catName);

//NewVDCIDFromCLone

//params.setVdcName(vdcName);

logger.addInfo("What is my new VDC number = "+NewVDCIDFromCLone);

logger.addInfo("What is my Origional VDC number = "+vdcName);

logger.addInfo("What is my new VDC name = "+vdcNameTempClone);

params.setVdcName(vdcNameTempClone);

logger.addInfo("params vdcNameTempClone = "+vdcNameTempClone);

params.setUserID(vmowner);

logger.addInfo("params vmowner = "+vmowner);

//params.setUserID("admin");

params.setVmName(vmname);

logger.addInfo("params vmname = "+vmname);

params.setComments(vmcomment);

logger.addInfo("params vmcomment = "+vmcomment);

params.setCores(vmcpu);

logger.addInfo("params vmcpu = "+vmcpu);

params.setMemoryMB(vmmemory);

logger.addInfo("params vmmemory = "+vmmemory);

params.setDiskGB(disksize1);

logger.addInfo("params disksize1 = "+disksize1);

//If Post Provision workflow has user inputs then the following code is required to pass user inputs to API.

//If the post provision workflow has only task inputs then skip the below code. It is not required to setPostProvWFUserInputs.

var nv1 = new APINameValue("A1",wfi1);

var nv2 = new APINameValue("A2",wfi2);

logger.addInfo("params wfi1 = "+wfi1);

logger.addInfo("params wfi2 = "+wfi2);

var list = new APINameValueList();

list.addNameValue(nv1);

list.addNameValue(nv2);

//Add this inputs list to provision params.

params.setPostProvWFUserInputs(list);

//

// Call New Service Request provision VM

//

logger.addInfo("-------------------Provsion VM---------------------------------");

var childSrId = ctxt.getAPI().userAPIProvisionRequest(params);

logger.addInfo("childSrId= "+childSrId);

logger.addInfo("-------------------Provsion VM Executing in Child Workflow---------------------------------");

logger.addInfo("-------------------Waiting for Child Workflow to Finish---------------------------------");

var status = ctxt.waitForCompletion(childSrId, 1800000);     

logger.addInfo("-------------------Done Waiting for Child Workflow to Finish---------------------------------");

if (status == 0)

{

     logger.addInfo("Provisioned SR ID  ="+ childSrId+ " successfully.");

     var vmID = ctxt.getOutput("VMProvisionEngineConfig_235.PROVISIONED_VM_ID", childSrId);

     logger.addInfo("Child VM ID = "+vmID);

} else {

     logger.addError("SR ID  ="+ childSrId+ " Failed");

}

//

// Sleep for a bit to let the system chatch up

//

logger.addInfo("Sleeping for a bit (30 sec...");

sleep();

logger.addInfo("Sleeping for a bit - Done...");

//

//Move vm to requested VDC

//

logger.addInfo("Move VM........."+vmID);

logger.addInfo("From........."+NewVDCIDFromCLone);

logger.addInfo("To........."+vdc);

var input8 = "<cuicOperationRequest><operationType>MOVE_VMS_TO_VDC</operationType><payload><![CDATA[<AssignVMstoVDC><!-- Accepts value from the list: vmwareAccountName--><accountName>"+vdcCloudName+"</accountName><!-- Accepts value from the list: multiVM--><vmId>"+vmID+"</vmId><!-- Accepts value from the list: vDC--><vdcName>"+vdc+"</vdcName></AssignVMstoVDC>]]></payload></cuicOperationRequest>";

logger.addInfo("Input = "+input8);

var ret8 = GenericHTTPFunction(input8, "/cloupia/api-v2/vmwareVM");

logger.addInfo("ret8 = "+ret8);

logger.addInfo("Clean Up Section.........");

logger.addInfo("About to delete ...VDC Template vdcTempNetworkPolicyName Name  Clone = "+vdcTempNetworkPolicyNameClone);

logger.addInfo("About to delete ...VDC Template vdcTempComputingPolicyName Name  Clone= "+vdcTempComputingPolicyNameClone);

logger.addInfo("About to delete ...VDC Template vdcTempStoragePolicyName Name  Clone = "+vdcTempStoragePolicyNameClone);

logger.addInfo("About to delete ...VDC Template vdcTempPrimaryDeployPolicyName Name  Clone = "+vdcTempPrimaryDeployPolicyNameClone);

logger.addInfo("Cloud = "+vdcCloudName);

if (backupnetwork == 1) {

   logger.addInfo("-------------------Delete backup network policy---------------------------------------");

   var input9 =  "<cuicOperationRequest><operationType>REMOVE_NETWORK_FROM_NETWORK_POLICY</operationType><payload><![CDATA[<RemoveNetworkFromNetworkPolicyConfig><policyName>"+vdcNetworkPolicyName+";"+vdcNetworkPolicyNameNumber+"</policyName><nicAlias>"+backupnetworkadaptername+"</nicAlias></RemoveNetworkFromNetworkPolicyConfig>]]></payload></cuicOperationRequest>";

   var ret1 = GenericHTTPFunction(input9, "/cloupia/api-v2/vdc");

   logger.addInfo("ret1 = "+ret1);

   logger.addInfo("-------------------Delete backup network policy done---------------------------------");

}

logger.addInfo("------------------- deleteNewTempVDC---------------------------------");

var input2 = "<cuicOperationRequest><operationType>DELETE_VDC</operationType><payload><![CDATA[<DeleteVDCConfig><vdcID>"+NewVDCIDFromCLone+"</vdcID></DeleteVDCConfig>]]></payload></cuicOperationRequest>";

logger.addInfo("Input = "+input2);

var ret2 = GenericHTTPFunction(input2, "/cloupia/api-v2/vdc");

logger.addInfo("ret2 = "+ret2);

logger.addInfo("------------------- Delete Network Policy---------------------------------");

var input3 = "<cuicOperationRequest><operationType>DELETE_VDC_POLICY</operationType><payload><![CDATA[<DeleteVDCPolicy><accountName>"+vdcCloudName+"</accountName><policyType>Network Policy</policyType><policyNames>"+vdcTempNetworkPolicyNameClone+"</policyNames></DeleteVDCPolicy>]]></payload></cuicOperationRequest>";

logger.addInfo("Input = "+input3);

var ret3 = GenericHTTPFunction(input3, "/cloupia/api-v2/vdc");

logger.addInfo("ret3 = "+ret3);

logger.addInfo("------------------- Delete Storage Policy---------------------------------");

var input4 = "<cuicOperationRequest><operationType>DELETE_VDC_POLICY</operationType><payload><![CDATA[<DeleteVDCPolicy><accountName>"+vdcCloudName+"</accountName><policyType>Storage Policy</policyType><policyNames>"+vdcTempStoragePolicyNameClone+"</policyNames></DeleteVDCPolicy>]]></payload></cuicOperationRequest>";

logger.addInfo("Input = "+input4);

var ret4 = GenericHTTPFunction(input4, "/cloupia/api-v2/vdc");

logger.addInfo("ret4 = "+ret4);

logger.addInfo("------------------- Delete Computing Policy---------------------------------");

var input5 = "<cuicOperationRequest><operationType>DELETE_VDC_POLICY</operationType><payload><![CDATA[<DeleteVDCPolicy><accountName>"+vdcCloudName+"</accountName><policyType>Computing Policy</policyType><policyNames>"+vdcTempComputingPolicyNameClone+"</policyNames></DeleteVDCPolicy>]]></payload></cuicOperationRequest>";

logger.addInfo("Input = "+input5);

var ret5 = GenericHTTPFunction(input5, "/cloupia/api-v2/vdc");

logger.addInfo("ret5 = "+ret5);

logger.addInfo("------------------- Delete Primary Deploy Policy---------------------------------");

var sysPolicy = InfraPersistenceUtil.getPrivateCloudSystemProfile(vdcTempPrimaryDeployPolicyNameClone);

if(sysPolicy != null){

     var policyId = sysPolicy.getPolicyId();

     InfraPersistenceUtil.deletePrivateCloudSystemProfile(policyId);

      logger.addInfo("vdcTempPrimaryDeployPolicyNameClone Policy deleted successfully"+vdcTempPrimaryDeployPolicyNameClone);

}else{

   logger.addError("vdcTempPrimaryDeployPolicyNameClone Policy not found : "+vdcTempPrimaryDeployPolicyNameClone);

}

// ==== Master Deploy function

}

//

// ============= Main ===============

//

if (csv_file_flag == 1) {

//

// Read from file

//

//Example:

//vmName1,Comment1,2,2048,20,VDC_CULPEPER2,LinuxApp,192.168.45.67,255.255.255.0,192.168.45.65,0,0.0.0.0,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

//vmName2,Comment2,2,2048,20,VDC_CULPEPER2,LinuxApp,192.168.45.68,255.255.255.0,192.168.45.65,1,192.168.70.100,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

//vmName3,Comment3,2,2048,20,VDC_CULPEPER2,LinuxApp,192.168.45.130,255.255.255.0,192.168.45.129,1,192.168.70.102,255.255.255.0,127.0.0.1,orf,Workflowinout1,workflowinput2

//

//

  var br = new BufferedReader(new FileReader(csvfile));

  var tokens;

  var vmDetails = new ArrayList();

  while(true){

    var line = br.readLine();

     if(line == null)break;

     logger.addInfo(line);

     tokens = line.split(",");

     if(tokens != null && tokens.length > 16){

       vmDetails.add(tokens);

      }

  }

  br.close();

  var vmListSize = vmDetails.size();

  logger.addInfo("VM Details from file (size)......"+vmListSize);

  var details = vmDetails.iterator();

  while(details.hasNext()){

    var arr = details.next();

    logger.addInfo("VM Name : "+arr[0]);

    logger.addInfo("VM Comment : "+arr[1]);

    logger.addInfo("VM CPUs : "+arr[2]);

    logger.addInfo("VM Memory : "+arr[3]);

    logger.addInfo("VM Disk Size : "+arr[4]);

    logger.addInfo("VM VDC: "+arr[5]);

    logger.addInfo("VM Catalog: "+arr[6]);

    logger.addInfo("VM IP : "+arr[7]);

    logger.addInfo("VM Mask : "+arr[8]);

    logger.addInfo("VM Gateway: "+arr[9]);

    logger.addInfo("VM Backup Network FLAG: "+arr[10]);

    logger.addInfo("VM Backup IP : "+arr[11]);

    logger.addInfo("VM Backup Mask : "+arr[12]);

    logger.addInfo("VM Backup Gateway: "+arr[13]);

    logger.addInfo("VM Owner: "+arr[14]);

    logger.addInfo("VM Workflow Input1 : "+arr[15]);

    logger.addInfo("VM Workflow Input2 : "+arr[16]);

    logger.addInfo("-------------------------------------");

    logger.addInfo("Assigning Variables");

    vmname = arr[0];

    vmcomment = arr[1];

    vmcpu = arr[2];

    vmmemory = arr[3];

    disksize1 = arr[4];

    vdc = VDCName2VDCid(arr[5]);

    logger.addInfo("vdc : "+vdc);

    catname = arr[6];

    var cat = CatName2ID(catname);

    vmip = arr[7];

    vmmask = arr[8];

    vmgw = arr[9];

    backupnetwork = Integer.valueOf(arr[10]);

    vmbip = arr[11];

    vmbmask = arr[12];

    vmbgw = arr[13];

    vmowner = arr[14];

    wfi1 = arr[15];

    wfi2 = arr[16];

  logger.addInfo("------------------Call for Multiple delpoy-------------------");

  Master_Deploy();

  logger.addInfo("------------------Call for Multiple delpoy - done-------------------");

  }

} else {

  logger.addInfo("------------------Call for single delpoy-------------------");

  Master_Deploy();

  logger.addInfo("------------------Call for single delpoy - done-------------------");

}

Sample Log File:

Service Request ID: 4275

Workflow Inputs:

- vdc

- ID

- Password

- Key

- UCSD_IP

- Catalog

- VM_IP

- VM_Mask

- VM_GW

- VM_Owner

- VM_Name

- VM_Comment

- VM_Memory

- VM_CPU

- WFI1

- WFI2

- CSV_FILE

- PROVISION_QTY

- DiskSize1

- BackupNetwork

- VMB_IP

- VMB_GW

- BackupNetworkAdapterName

- NetWorkAdapterType

- VMB_Mask

- VDC_Template

- CSV_FILE_FLAG

Feb 17, 2015 07:26:51 CST Request submitted

Feb 17, 2015 07:26:53 CST Executing workflow item number 1

Feb 17, 2015 07:26:53 CST Completed workflow item number 1, with status Completed

Feb 17, 2015 07:26:59 CST Executing workflow item number 2

Feb 17, 2015 07:26:59 CST Trigger context executeWorkFlowStep called

Feb 17, 2015 07:26:59 CST Executing custom action V1-Super-Mod3-all-functions (custom_Change_User)

Feb 17, 2015 07:26:59 CST Executing custom action V1-Super-Mod3-all-functions (custom_Change_User)

Feb 17, 2015 07:26:59 CST Executing custom script for Change_User

Feb 17, 2015 07:27:02 CST User ID successfully changed to admin

Feb 17, 2015 07:27:02 CST Task #1 (V1-Super-Mod3-all-functions (custom_Change_User)) completed successfully in 3 seconds

Feb 17, 2015 07:27:02 CST Input/Output values for Task #1 (V1-Super-Mod3-all-functions (custom_Change_User)):

Feb 17, 2015 07:27:02 CST [Local Input: User ID = admin]

Feb 17, 2015 07:27:02 CST Completed workflow item number 2, with status Completed

Feb 17, 2015 07:27:05 CST Executing workflow item number 3

Feb 17, 2015 07:27:05 CST Trigger context executeWorkFlowStep called

Feb 17, 2015 07:27:05 CST Executing custom action V1-Super-Mod3-all-functions (ExecuteCloupiaScript)

Feb 17, 2015 07:27:05 CST Executing custom action V1-Super-Mod3-all-functions (ExecuteCloupiaScript)

Feb 17, 2015 07:27:08 CST Executing cloupia script: VM Provision+Post Provision

Feb 17, 2015 07:27:08 CST ------------------Call for single delpoy-------------------

Feb 17, 2015 07:27:08 CST ----------------------------------------------------------

Feb 17, 2015 07:27:08 CST --------------------Temp VDC info--------------------------------------

Feb 17, 2015 07:27:08 CST VDC Template Number = 144

Feb 17, 2015 07:27:08 CST VDC Template Name = Verizon_VDC_Template

Feb 17, 2015 07:27:08 CST VDC Template vdcTempNetworkPolicyName Name = CulpeperNetDummy

Feb 17, 2015 07:27:08 CST VDC Template vdcTempComputingPolicyName Name = Dallas Prod1

Feb 17, 2015 07:27:08 CST VDC Template vdcTempStoragePolicyName Name = DallasProd1

Feb 17, 2015 07:27:08 CST VDC Template vdcTempPrimaryDeployPolicyName Name = LinuxColpeper

Feb 17, 2015 07:27:08 CST ----------------------------------------------------------

Feb 17, 2015 07:27:08 CST My SR ID = 4275

Feb 17, 2015 07:27:08 CST VDC = 142

Feb 17, 2015 07:27:08 CST VDC Name = VDC_CULPEPER

Feb 17, 2015 07:27:08 CST Catalog = 157

Feb 17, 2015 07:27:08 CST Catalog Name = LinuxApp

Feb 17, 2015 07:27:08 CST vdc Network Policy Name = CulpeperNetDummy

Feb 17, 2015 07:27:08 CST vdc groupId number = 2

Feb 17, 2015 07:27:08 CST VM IP = 192.168.41.199

Feb 17, 2015 07:27:08 CST NewVDCIDFromCLone = 0

Feb 17, 2015 07:27:08 CST 4th octet = 1

Feb 17, 2015 07:27:08 CST 4th octet forthoctetint = 1

Feb 17, 2015 07:27:08 CST 4th octet forthoctetintminus1= 0

Feb 17, 2015 07:27:08 CST VM IP Split 0 = 192

Feb 17, 2015 07:27:08 CST VM IP Split 1 = 168

Feb 17, 2015 07:27:08 CST VM IP Split 2 = 41

Feb 17, 2015 07:27:08 CST VM IP Split 3 = 1

Feb 17, 2015 07:27:08 CST VM IP Split Zero= 192.168.41.0

Feb 17, 2015 07:27:08 CST VM Mask = 255.255.255.0

Feb 17, 2015 07:27:08 CST VM GW = 192.168.41.1

Feb 17, 2015 07:27:08 CST VM Backup IP =

Feb 17, 2015 07:27:08 CST VM Backup IP Split 0 =

Feb 17, 2015 07:27:08 CST VM Backup IP Split 1 = undefined

Feb 17, 2015 07:27:08 CST VM Backup IP Split 2 = undefined

Feb 17, 2015 07:27:08 CST VM Backup IP Split 3 = undefined

Feb 17, 2015 07:27:08 CST VM Backup IP Split Zero= .undefined.undefined.0

Feb 17, 2015 07:27:08 CST VM Backup Mask = 255.255.255.0

Feb 17, 2015 07:27:08 CST VM Backup GW = 127.0.0.1

Feb 17, 2015 07:27:08 CST VM Owner = orf

Feb 17, 2015 07:27:08 CST VM NAME = orf_41_199

Feb 17, 2015 07:27:08 CST VM Comment = orf_41_199user

Feb 17, 2015 07:27:08 CST VM Memory = 1024

Feb 17, 2015 07:27:08 CST VM CPU = 1

Feb 17, 2015 07:27:08 CST Work FLow Input 1 = WorkFlowInput1

Feb 17, 2015 07:27:08 CST Work FLow Input 2 = WorkFLowInput2

Feb 17, 2015 07:27:08 CST CSV PATH and File = /tmp/vmDetails2.txt

Feb 17, 2015 07:27:08 CST Quantity = 1

Feb 17, 2015 07:27:08 CST backupnetwork FLAG = 0

Feb 17, 2015 07:27:08 CST ----------------------------------------------------------

Feb 17, 2015 07:27:08 CST vdcCloudName generated from the VDC input = Dallas

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.40.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.42.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.41.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Found in Port Group for Main eth interface

Feb 17, 2015 07:27:09 CST Found in Port Group Column = Production 192.168.41.0

Feb 17, 2015 07:27:09 CST Found the Port Group name from given IP range = 192.168.41.0

Feb 17, 2015 07:27:09 CST Cloud Selector = Dallas

Feb 17, 2015 07:27:09 CST vSwitch Name = vSwitch0

Feb 17, 2015 07:27:09 CST Port Group Type = Virtual Machine Portgroup

Feb 17, 2015 07:27:09 CST PortGroupAssembly = Dallas@vSwitch0@Virtual Machine Portgroup@Production 192.168.41.0

Feb 17, 2015 07:27:09 CST Count = 1

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.43.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.44.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMProvision

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM Network

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMkernel

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Management Network

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Backup 192.168.70.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.45.64

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = CloupiaNet

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.45.128/28

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMNetProjectSilver3

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMNetProjectSilver2

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMNetProjectSilver1

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD44

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD43

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD42

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD41

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD34

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD33

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD32

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD31

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD24

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD23

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD22

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD21

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD14

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD13

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD12

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD11

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMTestjeff

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.42.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.41.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Found in Port Group for Main eth interface

Feb 17, 2015 07:27:09 CST Found in Port Group Column = Production 192.168.41.0

Feb 17, 2015 07:27:09 CST Found the Port Group name from given IP range = 192.168.41.0

Feb 17, 2015 07:27:09 CST Cloud Selector = Dallas

Feb 17, 2015 07:27:09 CST vSwitch Name = vSwitch0

Feb 17, 2015 07:27:09 CST Port Group Type = Virtual Machine Portgroup

Feb 17, 2015 07:27:09 CST PortGroupAssembly = Dallas@vSwitch0@Virtual Machine Portgroup@Production 192.168.41.0

Feb 17, 2015 07:27:09 CST Count = 2

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.43.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.44.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.40.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMProvision

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM Network

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMkernel

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Management Network

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Backup 192.168.70.0

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.45.64

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = Production 192.168.45.128/28

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMNetProjectSilver3

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMNetProjectSilver2

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMNetProjectSilver1

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD44

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD43

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD42

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD41

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD34

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD33

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD32

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD31

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD24

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD23

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD22

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD21

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD14

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD13

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD12

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VMTestjeff

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:09 CST Content in Port Group Column = VM POD11

Feb 17, 2015 07:27:09 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Production 192.168.43.0

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Production 192.168.41.0

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Found in Port Group for Main eth interface

Feb 17, 2015 07:27:10 CST Found in Port Group Column = Production 192.168.41.0

Feb 17, 2015 07:27:10 CST Found the Port Group name from given IP range = 192.168.41.0

Feb 17, 2015 07:27:10 CST Cloud Selector = Dallas

Feb 17, 2015 07:27:10 CST vSwitch Name = vSwitch0

Feb 17, 2015 07:27:10 CST Port Group Type = Virtual Machine Portgroup

Feb 17, 2015 07:27:10 CST PortGroupAssembly = Dallas@vSwitch0@Virtual Machine Portgroup@Production 192.168.41.0

Feb 17, 2015 07:27:10 CST Count = 3

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Production 192.168.42.0

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Production 192.168.44.0

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VMProvision

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Production 192.168.40.0

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM Network

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VMkernel

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Management Network

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Backup 192.168.70.0

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Production 192.168.45.64

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = Production 192.168.45.128/28

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VMNetProjectSilver3

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VMNetProjectSilver2

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VMNetProjectSilver1

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD44

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VMPOD43

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD42

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD41

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD34

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD33

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD32

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD31

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD24

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD23

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD22

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD21

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD14

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD13

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD12

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VM POD11

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST Content in Port Group Column = VMTestjeff

Feb 17, 2015 07:27:10 CST Looking for this in Port Group name = 192.168.41.0

Feb 17, 2015 07:27:10 CST vdcNetworkPolicyNameNumber = 23

Feb 17, 2015 07:27:10 CST -------------------change main network policy---------------------------------------

Feb 17, 2015 07:27:10 CST Request was Succcessful.

Feb 17, 2015 07:27:10 CST Response = <?xml version='1.0' encoding='UTF-8' standalone='yes'?><cuicOperationResponse><Log><Messages>3</Messages><Message><TimeStamp>2015-02-17 07:27:10.495</TimeStamp><Severity>INFO</Severity><Text>Selected Port Group: Dallas@vSwitch0@Virtual Machine Portgroup@Production 192.168.41.0</Text></Message><Message><TimeStamp>2015-02-17 07:27:10.495</TimeStamp><Severity>INFO</Severity><Text>IP Pool Policies: </Text></Message><Message><TimeStamp>2015-02-17 07:27:10.499</TimeStamp><Severity>INFO</Severity><Text>Modified port group in the network policy successfully.</Text></Message></Log><operationStatus>0</operationStatus><response><ModifyVDCNetworkPolicyResponse><VDC_ID>142</VDC_ID></ModifyVDCNetworkPolicyResponse></response><responseMap><entry><key>VDC_ID</key><value>142</value></entry></responseMap></cuicOperationResponse>

Feb 17, 2015 07:27:10 CST ret1 = <?xml version='1.0' encoding='UTF-8' standalone='yes'?><cuicOperationResponse><Log><Messages>3</Messages><Message><TimeStamp>2015-02-17 07:27:10.495</TimeStamp><Severity>INFO</Severity><Text>Selected Port Group: Dallas@vSwitch0@Virtual Machine Portgroup@Production 192.168.41.0</Text></Message><Message><TimeStamp>2015-02-17 07:27:10.495</TimeStamp><Severity>INFO</Severity><Text>IP Pool Policies: </Text></Message><Message><TimeStamp>2015-02-17 07:27:10.499</TimeStamp><Severity>INFO</Severity><Text>Modified port group in the network policy successfully.</Text></Message></Log><operationStatus>0</operationStatus><response><ModifyVDCNetworkPolicyResponse><VDC_ID>142</VDC_ID></ModifyVDCNetworkPolicyResponse></response><responseMap><entry><key>VDC_ID</key><value>142</value></entry></responseMap></cuicOperationResponse>

Feb 17, 2015 07:27:10 CST -------------------change main network policy done---------------------------------

Feb 17, 2015 07:27:10 CST Backup network Flag (1 = add network interface) = 0

Feb 17, 2015 07:27:10 CST -------------------Clone VDC from Template---------------------------------------

Feb 17, 2015 07:27:10 CST Before NewVDCIDFromCLone0

Feb 17, 2015 07:27:10 CST Request was Succcessful.

Feb 17, 2015 07:27:10 CST Response = <?xml version='1.0' encoding='UTF-8' standalone='yes'?><cuicOperationResponse><Log><Messages>4</Messages><Message><TimeStamp>2015-02-17 07:27:10.618</TimeStamp><Severity>INFO</Severity><Text>Cloning The vDC Profile Verizon_VDC_Template</Text></Message><Message><TimeStamp>2015-02-17 07:27:10.732</TimeStamp><Severity>INFO</Severity><Text>The vDC VDC_CULPEPER4275 created successfully with id 201</Text></Message><Message><TimeStamp>2015-02-17 07:27:10.732</TimeStamp><Severity>INFO</Severity><Text>The computation policy host scope list are: 172.17.32.111@Dallas,172.17.32.113@Dallas,172.17.32.112@Dallas</Text></Message><Message><TimeStamp>2015-02-17 07:27:10.732</TimeStamp><Severity>INFO</Severity><Text>The computation policy cluster scope list are: Dallas Cluster1@Dallas</Text></Message></Log><operationStatus>0</operationStatus><response><VDCConfigResponse><VDC_ID>201</VDC_ID><VDC_CLOUD_NAME>Dallas</VDC_CLOUD_NAME><VDC_SYSTEM_POLICY>VDC_CULPEPER4275_System Policy</VDC_SYSTEM_POLICY><VDC_STORAGE_POLICY>

Feb 17, 2015 07:27:10 CST ret10 = <?xml version='1.0' encoding='UTF-8' standalone='yes'?><cuicOperationResponse><Log><Messages>4</Messages><Message><TimeStamp>2015-02-17 07:27:10.618</TimeStamp><Severity>INFO</Severity><Text>Cloning The vDC Profile Verizon_VDC_Template</Text></Message><Message><TimeStamp>2015-02-17 07:27:10.732</TimeStamp><Severity>INFO</Severity><Text>The vDC VDC_CULPEPER4275 created successfully with id 201</Text></Message><Message><TimeStamp>2015-02-17 07:27:10.732</TimeStamp><Severity>INFO</Severity><Text>The computation policy host scope list are: 172.17.32.111@Dallas,172.17.32.113@Dallas,172.17.32.112@Dallas</Text></Message><Message><TimeStamp>2015-02-17 07:27:10.732</TimeStamp><Severity>INFO</Severity><Text>The computation policy cluster scope list are: Dallas Cluster1@Dallas</Text></Message></Log><operationStatus>0</operationStatus><response><VDCConfigResponse><VDC_ID>201</VDC_ID><VDC_CLOUD_NAME>Dallas</VDC_CLOUD_NAME><VDC_SYSTEM_POLICY>VDC_CULPEPER4275_System Policy</VDC_SYSTEM_POLICY><VDC_STORAGE_POLICY>VDC

Feb 17, 2015 07:27:10 CST New VDC Id : 201

Feb 17, 2015 07:27:10 CST Afger NewVDCIDFromCLone201

Feb 17, 2015 07:27:10 CST After Function call .....NewVDCIDFromCLone = 201

Feb 17, 2015 07:27:10 CST --------------------Temp VDC info--------------------------------------

Feb 17, 2015 07:27:10 CST VDC Template Number Clone = 201

Feb 17, 2015 07:27:10 CST VDC Template Name Clone = VDC_CULPEPER4275

Feb 17, 2015 07:27:10 CST VDC Template vdcTempNetworkPolicyName Name Clone = VDC_CULPEPER4275_Network Policy

Feb 17, 2015 07:27:10 CST VDC Template vdcTempComputingPolicyName Name Clone= VDC_CULPEPER4275_Computing Policy

Feb 17, 2015 07:27:10 CST VDC Template vdcTempStoragePolicyName Name Clone = VDC_CULPEPER4275_Storage Policy

Feb 17, 2015 07:27:10 CST VDC Template vdcTempPrimaryDeployPolicyName Name Clone = VDC_CULPEPER4275_System Policy

Feb 17, 2015 07:27:10 CST -------------------Clone VDC from Template Done---------------------------------------

Feb 17, 2015 07:27:10 CST What is my new VDC number = 201

Feb 17, 2015 07:27:10 CST What is my Origional VDC number = VDC_CULPEPER

Feb 17, 2015 07:27:10 CST What is my new VDC name = VDC_CULPEPER4275

Feb 17, 2015 07:27:10 CST -------------------Provsion VM---------------------------------

Feb 17, 2015 07:27:19 CST childSrId= 4276

Feb 17, 2015 07:27:19 CST -------------------Provsion VM Executing in Child Workflow---------------------------------

Feb 17, 2015 07:27:19 CST -------------------Waiting for Child Workflow to Finish---------------------------------

The same workflow as a script module:

Screen Shot 2015-05-05 at 6.12.16 PM.png

The latest addition of the workflow works with the VMWARE  distributed switch (Thank you Jordan Glamann):

Unknown.png

Comments
szehnder
Level 1
Level 1

Hi Orf

Great work! But seriously... we do need to clone a temporary VDC just to get our custom IP configured on a VM? This has to change and become easier..

Regards

Orf Gelbrich
Cisco Employee
Cisco Employee

Since UCSD is policy driven I am forced to update/create a policy for one IP address.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links

Review Cisco Networking for a $25 gift card