One of the biggest reasons for using the SoftLayer Activity Library for Citrix Workflow Studio is to automate the ordering of instances in the SoftLayer CloudLayer. In the previous blog, I discussed how to obtain the pricing codes that you will need to order instances on SoftLayer using the activity library.

In this blog, we will create a workflow for ordering a new instance using the pricing codes. To download the SoftLayer activity library and get started, view the setup instructions listed here. To view the full list of blogs within this blog series, refer to the bottom of this article.

First Step – Review the pricing codes
The previous blog has you create a workflow to output the SoftLayer pricing codes within a XML file. Open this file and locate the codes that you need for Operating System, RAM, CPU, and Disk. In my example here, I want to order an instance with the following specs:

  • Windows Server 2008 R2 Standard Edition (64-bit)
  • 2 GB RAM
  • 2 x 2.0 GHz Cores CPU
  • 100 GB hard-disk

This corresponds to the following pricing codes:

Spec Pricing Code
Windows Server 2008 R2 Standard Edition (64-bit) 1857
2 GB RAM 1645
2 x 2.0 GHz Cores CPU 1641
100 GB hard-disk 1639

Second Step – Create the workflow
Open the Workflow Studio Console and create a new workflow called OrderInstance. Within the Workflow Studio Designer, drag the Connect To SoftLayer, Place Order, Message Box, and Disconnect From SoftLayer activities to the designer surface as shown below. The Message Box activity can be found within the Workflow Control activity library section. The other three activities are all part of the SoftLayer activity library section.

Configure the activities as noted in the table below. The hostname value will become the actual hostname of the virtual machine. The domain value is really just a tag used by SoftLayer for listing this instance within their management portal – this is not the true domain name of the machine. The location is the datacenter for hosting this virtual machine – possible options include DALLAS, SEATTLE, and WASHINGTON_DC. The pricing type specifies the pricing model – HOURLY or MONTHLY.

Activity Configuration
Connect To SoftLayer
  • API Key – specify the API Key from your SoftLayer account
  • Username – specify your API Username from your SoftLayer account
Place Order
  • Connection – select the output of the Connect to SoftLayer activity
  • CPU ID – 1641
  • Disk ID – 1639
  • Operating System ID – 1857
  • RAM ID – 1645
  • Domain – mydomain.local
  • Hostname – host1
  • Location – DALLAS
  • Pricing Type – HOURLY
Message Box
  • Message Text – select the outputs of the Place Order activity as shown in the screen shot below
  • Window Title – specify a title for the message box such as Order Info
Disconnect From SoftLayer
  • Connection – select the output of the Connect to SoftLayer activity

The purpose of inserting the Message Box activity into this sample workflow is to allow us to grab the Order ID from the order we are placing on SoftLayer. In a true workflow, I would definitely recommend storing this data into a SQL Server database or persisting it to a file. The SQL Server Activity Library can be used for executing commands on a SQL database for storing this data. The key point is that we need to keep the Order ID for this instance to allow us to grab information about it later on. Once we have the Order ID value, we can pretty much handle it however we like using the other activities within Workflow Studio.

Third Step – Run the workflow
Run the workflow within the Designer. Ensure that it succeeds properly. A message box should be displayed containing the Order ID. Write this ID down as it will be used in our next workflow.

Next Steps
In the next blog we will create a workflow to check on the status of the order to pull back additional details about the instance. Stay tuned!

Blogs in this series

Ed York – Architect – Worldwide Technical Readiness
Ask-the-Architect Site: http://community.citrix.com/p/product-automation#home
Follow Me on twitter: http://twitter.com/citrixedy