Active IQ Unified Manager Discussions

ReturnWFAParamaters into attribute

mdaly1234
6,746 Views

Hello,

 

After running a workflow from VCO in WFA, I require some return Parameters (which have been set up in WFA correctly). After the VCO workflow finishes the parameters are outputted in the logs from the completed workflow in VCO, i need them in something I can reference later on for emailing out completetion email:

 

[2015-02-24 09:30:07.600] [I] Return Parameters:
[2015-02-24 09:30:07.601] [I] --qtree-name=xxxxxx
[2015-02-24 09:30:07.602] [I] --volume-name=xxxxxxx
[2015-02-24 09:30:07.603] [I] --volume-vfiler=xxxxxx
[2015-02-24 09:30:07.604] [I] --export-pathname=xxxxx

 

(I have substituted real values for x's)

 

From the output of the workflow object "NetApp WFA Workflow execution" I have set the Local Parameter "returnWFAParamters" to a Source parameter with the same name (attribute- string) but for some reason this seems to be blank when the workflow has completed. 

 

What am I missing? Has anyone had this working?

 

Thanks

1 ACCEPTED SOLUTION

asulliva
5,566 Views

There is a bug in the earlier versions of the vCO Package for WFA Integration where the returnWFAParameters is a string object instead of a properties object.  Be sure to update to the latest version of the package if you have not already.

 

Here is what the outputs should look like for the "NetApp WFA Workflow execution" vRO/vCO workflow:

 

2015-03-10 11_25_16-10.63.171.164 - Remote Desktop Connection.png

 

With the correct type for that parameter you should now be able to access the values from a scriptable task.

 

// if you know the name of the WFA return parameter
System.debug("Returned value " + returnWFAParameters.get("someProperty") + " for parameter someProperty");

// if you want to enumerate all of the returned values
for (var key in returnWFAParameters.keys) {
  System.debug("Returned parameter " + key + " equals " + returnWFAParameters.get(key));
}

 Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

12 REPLIES 12

francoisbnc
6,691 Views

Hi,

You have to play with

Add-WfaWorkflowParameter -Name namevar -Value $retVal to store value and 
$importedinitiators= Get-WfaWorkflowParameter -Name namevar -ErrorAction Continue

 

variable can even be a [array]

 

François

mdaly1234
6,687 Views

Thanks for reply.

 

Even though the variables are making it back to VCO? I need to add this powershell command to where exactly?

francoisbnc
6,684 Views

You have to create  new commands or clone exsisting ones.

Modify the code to store the needed values with  Add-WfaWorkflowParameter -Name namevar -Value $retVal.

Retrieve the values in the second command with  Get-WfaWorkflowParameter -Name namevar, namevar is the named reference.

 

François

 

 

trentino123
6,646 Views

Hi Mdaly,

 

I would clone the send mail certified command, and before sending the email I would add this code ( using the correct returned parameters variables ) :

 

$returned_parameter1 = Get-WfaWorkflowParameter -Name nameofthereturnedparam1 -ErrorAction Continue
$returned_parameter2 = Get-WfaWorkflowParameter -Name nameofthereturnedparam2 -ErrorAction Continue
$returned_parameter3 = Get-WfaWorkflowParameter -Name nameofthereturnedparam3 -ErrorAction Continue
$returned_parameter4 = Get-WfaWorkflowParameter -Name nameofthereturnedparam4 -ErrorAction Continue

$AdditionalText = $AdditionalText + $returned_parameter1 + $returned_parameter2 + $returned_parameter3 + $returned_parameter4

 

In this way you add the variables inside the additional text ( body ) of the email. If you want to separate by line you can add + '\n' + in between the $returned_parameters

 

Hope it helps.

mdaly1234
6,638 Views

Guys,

 

Thanks for your replies. I am not sure we are talking about the same things here. I am talking about how to get the return Paramters in VCO (Vcenter Orchestrator). I am able to get them printed out in the workflow log in VCO, but not into a variable which proves they are making it to VCO. I am not sure that anything more needs to be done in WFA... but could be wrong.

 

Thanks

trentino123
6,632 Views

Hi Mdaly,

 

That actually happens often, because sometimes the returned parameter did not reach the WFA database ( it needs an OCUM or VCO refresh ). I don't know if that is your case.

 

If it was your case, you might need to get that value from VCO ( via powershell ) and then create the return parameters as Francois suggested.

 

For example, to get the LUN serial number after LUN creation and add it as return parameters I use the following code:

Get-WFALogger -Info -message $("Getting LUN Serial Number: " + $LunName)

$hexSerialNumber = $(Get-NcLunSerNbrHex -LunPath $LunPath)

Get-WFALogger -Info -message $("Adding Hex LUN Serial Number as WFA Return Parameter named: lunSerNbrHex")

Add-WfaWorkflowParameter -Name "LUN_SERIAL_NUMBER_HEX" -Value $hexSerialNumber -AddAsReturnParameter $true

 

The vpshere powercli commands cmdlet reference is :

https://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/

 

Hope it helps.

 

 

 

 

 

mdaly1234
6,614 Views

I have tried both these methods today. unfortunately the email is being sent from VCO not from WFA. I am either missing something or it isnt possible to get these as variables into VCO.

 

 

trentino123
6,604 Views

Hi Mdaly,

 

Please correct me if I am wrong . You are executing a 7mode WFA workflow that involves also interaction with VCO, probably generating NAS storage and mounting the export on the VCO side. You are trying to have some return parameters, but you don't see any return parameter ( I though you did not see only the VCO returned paramaters ).

 

The returned parameters are easily filled out . If you created a volume1 for example with a command, you would start the return paramter input with volume1.  ( after the . it will automatically start giving you the options ), then following for example  volume1.name or volume1.array.ip or volume1..vfiler.root_qtree for example . Did some of the return parameters worked for you ?

 

If you can log what you want in a return parameter, you can clone the command and simply add the Francois code to create the return parameter variable and then adding the logged into to the returned parameter.

 

Hope that helps.

 

 

mdaly1234
6,594 Views

yes, it is 7m wfa workflow, which simply creates a volume and exports it, and I have set up return parameters for this workflow:

 

wfaEP.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


in VCO I have set an attribute up to "catch" these Parameters from the return of the completed workflow:

 

mapping.JPG

 

when the workflow runs, in the VCO System.log I get this:

 

[2015-02-24 09:30:07.600] [I] Return Parameters:
[2015-02-24 09:30:07.601] [I] --qtree-name=xxxxxx
[2015-02-24 09:30:07.602] [I] --volume-name=xxxxxxx
[2015-02-24 09:30:07.603] [I] --volume-vfiler=xxxxxx
[2015-02-24 09:30:07.604] [I] --export-pathname=xxxxx

 

I have removed the actual values and replaced with x's

 

and the attribute is empty once workflow is complete

empty.JPG

 

Hopefully this makes sense? As is said earlier, I can get the parameters in WFA, just not as I want them in VCO

 

Thanks

 

 

 

DavidSpano
5,332 Views

I ran into this issue and found that the Netapp Plugin package for VCO had a bug in that the variable type for "returnWFAParameters" is incorrect.  If I recall correctly it was set as type "array" or "string" but it should be type "Properties".  This allows the VCO package to correctly store the key - value pairs of the WFA return parameters.  I made the changes to the Netapp Plugin package and notified Netapp.  They told me they were aware of the bug.  Not sure if they ever release a fixed version.  My VCO administrator helped me modify the package, so I don't remember exactly how it was done.

asulliva
5,567 Views

There is a bug in the earlier versions of the vCO Package for WFA Integration where the returnWFAParameters is a string object instead of a properties object.  Be sure to update to the latest version of the package if you have not already.

 

Here is what the outputs should look like for the "NetApp WFA Workflow execution" vRO/vCO workflow:

 

2015-03-10 11_25_16-10.63.171.164 - Remote Desktop Connection.png

 

With the correct type for that parameter you should now be able to access the values from a scriptable task.

 

// if you know the name of the WFA return parameter
System.debug("Returned value " + returnWFAParameters.get("someProperty") + " for parameter someProperty");

// if you want to enumerate all of the returned values
for (var key in returnWFAParameters.keys) {
  System.debug("Returned parameter " + key + " equals " + returnWFAParameters.get(key));
}

 Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

mdaly1234
5,518 Views

Great, we had found this bug and corrected it manually. thanks for your write up of this issue.

Public