cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1125
Views
0
Helpful
1
Replies

vRealize Orchestrator UCSC plugin addVnicInterface

Sagar Srinivasa
Level 1
Level 1

I use vRealize Orchestrator to create workflows everyday and was given a task to integrate with UCSC plugin and work on creating VLANs on our B200 M4 blades.

I see that there are only a few sample workflows but I have made my way to figuring out some of the issues I had initially. To add a VLAN there is already a workflow available. But to add that VLAN to vnic templates, I am having issues.

To add VLAN to vnic templates I used to use my Powershell script which is broken down to these steps -

1. Create VLAN in UCSC using “Add-UcsCentralVlan” cmdlet and then “Add-UcsCentralFabricVlanReq”. In vRO the included workflow did this part.
2. Add VLAN to vnic templates by using “Get-UcsCentralVnicTemplate” cmd and pipe “Add-UcsCentralVnicInterface” to it.
3. Add the port group in VMware using PowerCLI.

Step 2 is where I am stuck. When using “System.getModule(“com.cisco.ucs.central.vnic”).addVnicInterface() cmd, I have included these parameters - Ucsc handle, parent Vnic template, defaultnet, vlan name, etc.

Here is my code -

var name = "G-3490-Test";
var sID = name.split("-")[1];
var ID = parseInt(sID, 10);

//Get LanCloud
var UCSC = UcscActionUtils.getAllUcsCentral();
var ep = System.getModule("com.cisco.ucs.central.fabric").getFabricEp(UCSC[0]);
var lanCloud = System.getModule("com.cisco.ucs.central.fabric").getLanCloud(UCSC[0],ep);

//Create VLAN
var vlan = System.getModule("com.cisco.ucs.central.fabric").addVlan(UCSC[0],lanCloud,null,null,ID,null,name,null,null,null,null,null);

//Create VLAN req
var org = System.getModule("com.cisco.ucs.central.org").getOrg(UCSC[0],null,null,null,null,"root",null,null);
var vlanReq = System.getModule("com.cisco.ucs.central.fabric").addFabricVlanReq(UCSC[0],org,name,null,null);

//Create Vnic Interfaces
var vnictemplates = System.getModule("com.cisco.ucs.central.vnic").getVnicTemplate(UCSC[0]);
var vnics = [];
for each (vnictemplate in vnictemplates)
{
if (vnictemplate.name.match("-a") || vnictemplate.name.match("-b"))
vnics.push(vnictemplate);
}
for each (vnic in vnics)
{
System.getModule("com.cisco.ucs.central.vnic").addVnicInterface(UCSC[0],vnic,null,name,false,false);
} 



I get this error -

“InternalError: No Object Added. (Dynamic Script Module name : addVnicInterface#31)”.

 

What am I doing wrong?

1 Accepted Solution

Accepted Solutions

Sagar Srinivasa
Level 1
Level 1

Even though I opened up a case and Cisco replied stating they no longer support it, I got it figured out myself. It seems the second input parameter in addVnicInterface() is expecting an array instead of a variable.


I changed this -

//Add VnicInterface in each VNIC template
for each (vnic in vnics)
{
        System.getModule("com.cisco.ucs.central.vnic").addVnicInterface(Ucsc,vnic,null,name,null,null);
}

to this -

//Add VnicInterface in each VNIC template
for each (vnic in vnics)
{
	var vnicarray = [];
	vnicarray.push(vnic);
	System.getModule("com.cisco.ucs.central.vnic").addVnicInterface(Ucsc,vnicarray,null,name,null,null);
}

and it now works flawlessly!

View solution in original post

1 Reply 1

Sagar Srinivasa
Level 1
Level 1

Even though I opened up a case and Cisco replied stating they no longer support it, I got it figured out myself. It seems the second input parameter in addVnicInterface() is expecting an array instead of a variable.


I changed this -

//Add VnicInterface in each VNIC template
for each (vnic in vnics)
{
        System.getModule("com.cisco.ucs.central.vnic").addVnicInterface(Ucsc,vnic,null,name,null,null);
}

to this -

//Add VnicInterface in each VNIC template
for each (vnic in vnics)
{
	var vnicarray = [];
	vnicarray.push(vnic);
	System.getModule("com.cisco.ucs.central.vnic").addVnicInterface(Ucsc,vnicarray,null,name,null,null);
}

and it now works flawlessly!

Cisco UCS X-Series Energy Efficiency Offer