In this post i’m going to teach you some powerful capabilities of vCAC’s Cloud Development Kit (CDK). As I see a lot of customers who do have vCAC licenses, but not CDK license, I just want to make some points first.
A CDK license will basically let you do a couple of things:
1. Lets you use the “CloudUtil” command.
2. Installs a plugin for visual studio versions 2010/2012.
While the first ability seems pretty simplistic as it doesn’t seem to do much other than let you install new “stub” workflows, it can enable some very powerful abilities that are related more to the second point – Visual Studio development.
Installing the CDK plugin in visual studio, ultimately lets you develop any kind of C# code, and integrate them into the vCAC workflows. This ultimately means, that ANYTHING with a proper SDK available for C# can be used with your machine state workflows. This ability is relevant to 5.x and 6.0. When you see the potential for this its almost too big to not know what to do with it.
Although I still highly recommend using vCO to do any integration or workflows you need vCAC to pull off, and although vCO is an awesome tool that I care dearly about, today, almost any product has some sort of SDK form, while not all IT day-2-day products have a vCO plugin. Also, this ability can be used to integrate with in-house built applications.
The use case that lead me to write this blog post is for one of my customers, who wanted to get a fully blown Oracle Server to be provided in the vCAC catalog. And by ‘fully blown’ I mean, with physical RDMs , and Snapmirror relations configured to their Netapp at the DR site.
So how do we start?
– Preferablly, some C# development ‘know how’.
– Install Visual Studio on a Dev Desktop / Server.
– Install vCAC Cloud Development Kit (CDK) which also include the vCAC designer & Visual Studio plugin on same machine.
– CDK license installed in vCAC.
Setting up a project
First, we’ll create a new visual studio project. Choose C# Workflow, activity library type. After a new project has been created, we’ll go to the Tools -> vCAC Workflow generator tool, and create a state workflow. The full process is described in a previous article of mine here.
You won’t need to follow the entire article, but only get to the point when the visual studio is configured with a workflow project. (get past the vCAC Workflow Creation Tool)
Now we will need to choose which kind of class do we want to add to our project, we will choose C# workflow “Code Activity” type.
After we have a class set up, we’re able to program any kind of SDK integration into the workflow. In order to work with 3rd party or in-house SDKs , simply reference the appropriate DLLs into the project (call the nearest programmer if this post gets a bit vague for you)
After referencing the proper SDK DLLs, for this post i’m not going to example any specific SDK since the usage varies a lot. We’ll continue by developing our class with the code we want to perform during the workflow. The next image explains the code. We’ll select our class in the right pane:
In this code section I’ll receive as an example, 2 string values for name, and data, and an integer value for a number.
I won’t actually do anything of significance with it, this is just an example. In my customer’s use case, we integrated a DLL they wrote using the NetApp SDK , to create Netapp LUNs, with replications across their Netapp systems, using the Netapp SDK, and also some activities were done with vSphere SDK.
After we’re done coding (gonna take a while … ;) ) we’ll configure our project’s item build method. Meaning, we only need to actually build the class, and create a DLL out of it. By default, the XAML file (our workflow) will also be checked. So to get this running error free, we’ll cancel the XAML workflow check (set to ‘none’), and build our class using ctrl+shift+B
After the build is done, we we’ll open the workflow , and the workflow toolbox on the left pane of the screen, and know we’ll be able to add our code activity to the workflow:
Lets say we’ve finished all of our coding and workflow building. The last pieces of the puzzle, are to run some ‘cloudutil’ command, and also, adjust the XAML workflow file a bit.
Notice that in the build output, we have a folder containing the build deliverables. This will contain the DLL for our class, and any other DLLs & dependencies we’ve referenced in our project. In order for vCloud Automation Center to run our custom workflow, we need to get it to know the DLLs we used. To our help – cloudutil – found at the vCAC Designer install path.
Install the Custome Workflow
We’ll run the next command on our deliverable DLL, and any other DLL referenced:
[code]cloudutil assembly-install -f <path to our DLL file>[/code]
After we’re done loading all assemblies to the IaaS / vCAC 52 Repository DB, we’ll modify the XAML workflow.
go to the XAML workflow file location, and open it with an editor (notepad++ etc). In the XAML text we’ll find a
Changing it to look like:
[code]xmlns:local="clr-namespace:<OurClassNameSpaceName>;assembly=<Our DLLs Name>"[/code]
Notice that the DLL name should remain without a .dll suffix. Save the file.
Lastly, we’ll register our new xaml workflow into the repository , again with cloudutil:
[code]cloudutil workflow-install -f <xaml file path> -n <workflow name>[/code]
I hope this post helped you realize the huge flexibility of vCloud Automation Center.
If you have any questions, as always, don’t hesitate! comment section is below!