vCAC’s CDK Development Unleashed

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?
Prerequisites:
– 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)

After we have the project configured (doesn’t matter which state we want to run of course) we’ll start in creating the code activity, by adding a class to the project:

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.

Start Coding!

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
line saying:

[code]xmlns:local="clr-namespace:<OurClassNameSpaceName>"[/code]

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]

Once completed, we can open the vCAC Designer, load our newly created workflow from the repository, and see some magic:

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!


Comments
Harvey Specter
Posted at 6:12 am February 25, 2014
d-fens GmbH
Reply
Author

Hi Omer, I have three questions regarding your blog post and CDK use. Maybe you can help me on that:
1. Why do I need a CDK license if I can create/upload/modify workflows via the metamodel.svc or via vCO without it.
2. How do you debug your Visual Studio workflows

3. Do you have an example on how to integrate into the logging system of vCAC. I saw there is a logging model that could be utilised but did not find any examples nor had time to investigate.
Thanks for your help! Ronald

    Harvey Specter
    Posted at 7:52 am March 3, 2014
    Kushmaro
    Reply
    Author

    Hi Ronald,
    sorry for the late reply.
    1. I’m defiantly not the one in charge of licensing decisions, and yes, by using the metamodel.svc (which is like writing directly to the DB to be honest) you could bypass the cloudutil cdk licensing. This however breaks the EULA, As far as I know.
    2. For code debugging I use the regular visual studio, for the actual workflow, it has to be run with test agent / linked clone vms to be tested
    3. Logging wise, you can just use the log activity from the designer once you load the visual studio workflow into the designer.

Harvey Specter
Posted at 11:53 pm December 30, 2014
Anibal Avelar
Reply
Author

Hi Omer,
In your article you said about is possible to do a “fully blown” Oracle Server to be provided in the vCAC catalog. I guess are you talking about OVM hypervisor?, aren’t you? because I need to do this task, do you have a full example of this? or at least more information.

Thank you anyway.
Regards
Anibal

    Harvey Specter
    Posted at 7:28 pm January 4, 2015
    Kushmaro
    Reply
    Author

    Hi Anibal,
    As a matter of fact I was referring to an Oracle RAC. Technically, with CDK, you might be able to write a hole new implementation of a hypervisor endpoint – but its is NOT SIMPLE to say the least…

    Also, I should also say that CDK is something that is a bit in a phase-out mod by VMware. Though i’m not sure 100% on its status in terms of road map, and obviously can’t discuss it here as well.
    You should probably ask your VMware Rep if there is one.

Leave a Reply

Navigation