cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4381
Views
0
Helpful
10
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
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 / Multi VM shutdown

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

Comments
tad.smith
Level 1
Level 1

Is there a concern with multiple users modifying a network policy simultaneously? If I have two users request server builds at nearly the same time, will both VMs be provisioned with the second network policy?

Orf Gelbrich
Cisco Employee
Cisco Employee

Yes that could be a problem. Then you have to go to to example #123 on the community site. I build them VDC's with a $ attached to all policy names to avoid the described situation.

-

Orf Gelbrich

Check out UCS Director Workflow INDEX<https://communities.cisco.com/docs/DOC-56419> on Cisco Communities Site

phirobin
Community Member

Hi Orf,

Regarding this workflow - I keep getting "Cannot allocate IP Address - Static pool exhausted" - If I set the pool to allow IP Overlap and restart the workflow it goes through although I get a Mismatch in the IP Address for the nic(s) warning in the VM Provision Engine Config part of the build - the portgroup is an ACI generated one.  Any ideas?

Regards

Phil

Orf Gelbrich
Cisco Employee
Cisco Employee

Do you roll back you workflow in order for the IP to be released?

under Policies -> virtual -> Network -> Global IP usage do you see the IP there allocated?

How long to do you keep deleted VM info? 

Administration -> system -> system parameters?

phirobin
Community Member

Ahh yes I see them in there and the System params were the default 60 days.  I see that there is a built in remove reserved IP task - I will look into that to use as a clean up before the provisioning - look for it and execute so that I can be sure that it's not been reserved - thanks a lot Orf as always! (been pulling my hair out on that one)

Orf Gelbrich
Cisco Employee
Cisco Employee

Orderly roll back cleans up the IP reservation as well.

Orf Gelbrich

Check out UCS Director Workflow INDEX<https://communities.cisco.com/docs/DOC-56419> on Cisco Communities Site (Twitter @UCSDGURU)

phirobin
Community Member

eek - there are all sorts of problems with this - the built in task to remove the reservation has a table you select from - this concatenates a series of variables into a string e.g. 626@StaticIPPool/11/10.85.32.6/3@Group - looking up the metadata report there is no way to get all of that info from it.

I tried cloning this workflow task but it only has an ipaddress input and there is no way to work out how to build that string.

I rolled back an old workflow and it said that it undoes the reservation but I guess I have deleted the static pool now as I am creating it and then deleting it in the workflow and so the number for that (626 I expect in my example above) is no longer there and so the rollback doesn't work.

I can run the built in task - but as the type of the input is set to Gen Text (when actually it is a table called RESERVED_IPADDRESS_LIST) which when selected produces the string 626@StaticIPPool/11/10.85.32.6/3@Group there is no way to reproduce this and map a master task input to this sub task.

I have to edit the task each time, not map it and then click the select button to show the table - to clear out all of the reservations made.

phirobin
Community Member

Actually - I realise that perhaps the data for Reservations is retrievable from Organizations -> Reservations as that has more columns and a combination of those columns may enable me to build up the string - rolling back works well though so I may be ok for now.

Orf Gelbrich
Cisco Employee
Cisco Employee

I am not sure what the issues are here. Usually in custom tasks you can build variables like this

Var b=”I am here”;

Var a= “hello ” + b + “ and you are there”;

Would result in a having as values = “hello I am here and you are there”

Orf Gelbrich

Check out UCS Director Workflow INDEX<https://communities.cisco.com/docs/DOC-56419> on Cisco Communities Site (Twitter @UCSDGURU)

Orf Gelbrich
Cisco Employee
Cisco Employee

Make sure this is set in the catalog

Screen Shot 2017-05-12 at 7.23.47 AM.png

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