UCSD - Manual IP Input and VM Deployment with Post Provisioning and user approval for more then 8 CPU option (Rollback)

Version 6
    Task Name

    Manual IP Input and VM deployment with Post provisioning and roll back.

    Creates a IP pool of size = One IP address

    if more then 8 CPUs is chosen the user approval is required.

    Description

     

    Prerequisites

    Minimum UCSD version: 5.4.0.2

    CategoryCustom task
    Components
    User Inputs

     

    User Output

    Instructions for Regular Workflow Use:

    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.

     

    Inspired by Ryan Criss and Abhishek Bhardwaj

     

    The workflow:

     

         Note if 8 CPU's is chosen then USER approval is required.

         Creates a new IP pool of size = one IP address

         Updated the VDC the VM is deployed into

         Deletes the IP pool

    Screen Shot 2016-02-24 at 7.06.24 AM.png

     

    Workflow Execution with out approval:

     

    Input:

     

    Screen Shot 2016-02-24 at 7.04.40 AM.png

     

    Screen Shot 2016-02-24 at 7.05.57 AM.png

     

    Subsequent workflow for VM creation:

     

    Screen Shot 2016-02-24 at 7.06.09 AM.png

     

    Workflow execution when CPU = 8 is chosen and user approval is required:

     

    Input:

     

    Screen Shot 2016-02-24 at 7.04.53 AM.png

    Screen Shot 2016-02-24 at 7.05.30 AM.png

     

    User Approval E-mail:

     

    Screen Shot 2016-02-24 at 7.08.04 AM.png

     

    Workflow input and changes marked for customer environment:

     

    Screen Shot 2016-02-24 at 7.12.06 AM.png

     

    Workflow run:

     

    Screen Shot 2016-02-24 at 7.00.47 AM.png

     

    The VDC set up:

     

    Screen Shot 2016-02-24 at 7.01.11 AM.png

     

    The network policy in the VDC:

     

    Screen Shot 2016-02-24 at 7.01.28 AM.png

     

    The Network Policy:

     

    Screen Shot 2016-02-24 at 7.02.17 AM.png

     

    The VM network:

     

    Screen Shot 2016-02-24 at 7.02.27 AM.png

     

    The Nic:

     

    Screen Shot 2016-02-24 at 7.02.37 AM.png

     

    The result after a workflow run:

     

    Screen Shot 2016-02-24 at 7.02.43 AM.png

     

    Resulting Policy creation:

    Screen Shot 2016-02-24 at 7.02.43 AM.png

     

    Screen Shot 2016-02-24 at 7.03.11 AM.png

     

    Screen Shot 2016-02-24 at 7.03.24 AM.png

     

    How to find all the IP Pool Methods:

     

         In the custom task click the Show Doc button:

     

    Screen Shot 2016-02-23 at 8.41.37 AM.png

     

         The links get turned on:

     

    Screen Shot 2016-02-23 at 8.41.46 AM.png

     

         Select from the new browser tab document the Private Cloud Static IP Pool:

     

    Screen Shot 2016-02-23 at 8.42.07 AM.png

     

    The Methods will be displayed:

     

         In this case all the set commands were needed.

     

    Screen Shot 2016-02-23 at 8.42.31 AM.png

     

     

    Create IP Pool Code:

     

    importPackage(java.util);

    importPackage(java.lang);

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

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

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

    importPackage(com.cloupia.lib.cIaaS.vmware);

     

     

    var ipAddress = input.IPAddress;

    var subnetMask = input.SubnetMask;

    var GW = input.Gateway;

    var vlan = input.VLAN;

     

     

    // Create IP Pool

     

     

    var policyName = "Pool_" + ipAddress;

    var policyDescription = "Pool policy for " + ipAddress;

    var staticIPPool = ipAddress;

     

     

    var pools = new PrivateCloudStaticIPPool();

    pools.setStaticIpPool(staticIPPool);

    pools.setSubnetMask(subnetMask);

    pools.setVlanID(vlan);

    pools.setGatewayIP(GW);

     

     

     

     

     

     

    //> var policyObj = InfraPersistenceUtil.getPrivateCloudStaticIPPoolPolicy(6);

    //

    //> printObj(policyObj);

    //properties = com.cloupia.service.cIM.inframgr.profiles.PrivateCloudStaticIPPoolPolicy@3a53152a

    //[policyId=6,policyName=Coke,

    //policyDescription=Coke,

    //staticIPPools=com.cloupia.service.cIM.inframgr.forms.wizard.FormManagedList@27d33d49,

    //ipPoolInfoStr=eCIsInNsInZsYW5JRCI6IjEwIiwidW2tlIn1dfQ==,dn

    //DetachedState={18[OID]com.cloupia.service.cIM.inframgr.profiles.PrivateCloudStaticIPPoolPolicy,,

    //{0, 1, 2, 3},{}}]

    //methods = setPolicyName getPolicyName getPolicyId setPolicyId

    //getPolicyDescription setPolicyDescription setIpPoolInfoStr

    //getIpPoolInfoStr setPoolDef getPoolDef getStaticIPPools setStaticIPPools

     

     

     

    Delete IP Pool Code:

     

    importPackage(java.util);

    importPackage(java.lang);

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

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

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

    importPackage(com.cloupia.lib.cIaaS.vmware);

     

     

    var policyId = input.IPPoolPolicyID;

     

     

    // Delete IP Pool

     

     

     

     

     

     

     

     

    try{

      InfraPersistenceUtil.deletePrivateCloudStaticIPPoolPolicy(policyId);

    } catch(e){

      logger.addError("Error occurred while deleting the static ip pool policy with id: "+policyId);

      logger.addError(e);

    }

     

     

     

     

     

     

    var poolsList = new FormManagedList();

    poolsList.getList().add(pools);

     

     

    var policy = new PrivateCloudStaticIPPoolPolicy();

    policy.setPolicyName(policyName);

    policy.setPolicyDescription(policyDescription);

    policy.setStaticIPPools(poolsList);

    var def= new StaticIPPoolDef();

    def.setIpPools(policy.getStaticIPPools().getList());

    var defStr = VMWareUtils.getPrivateCloudStaticIPPoolDefStr(def);

    policy.setIpPoolInfoStr(defStr);

     

     

    var result = InfraPersistenceUtil.persistPrivateCloudStaticIPPoolPolicy(policy);

     

     

    if(result){

      logger.addInfo("Static IP Pool Policy  "+policyName+"  created successfully.");

      var policyObj = InfraPersistenceUtil.getPrivateCloudStaticIPPoolPolicy(policyName);

      var policyId = policyObj.getPolicyId();

      logger.addInfo("Policy Id: "+policyId);

      var staticIpPolicyIdentity = policyId + "@" + policyName;

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

    } else {

      throw new Exception("Static IP Pool policy "+policyName+"  not created.");

    }

     

     

    output.PoolName = policyName;

    output.PoolID = policyId;

    output.IPPoolPolicySelector = staticIpPolicyIdentity;

     

     

    This workflow was inspired by these posting:

         IP Pool Creation

         UCSD - Add VM Kernel Port Group to DvSwitch with Static IP

         My Application

         UCSD - Application Stack with Custom Button

         Vm Deployment with Post Provisioning and Rollback

         UCSD - Multi VM Provisioning with Post Provisioning and Rollback Example (Swiss Army Knife)

     

    Possible enhancements

         A loop could be wrapped around this workflow to provision many VM's

         UCSD Power off many VM's via Loop and possible schedule

         Reading IP's from a CSV file and feeing them to the loop

         UCSD - Random Read CSV file / Create VLAN(s) from CSV file Example