cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4285
Views
0
Helpful
4
Replies

get a TopRoot managed object in Cisco UCS Manager Plugin for vCenter Orchestrator 0.9(2)

leahysean
Level 1
Level 1

I am trying to extract some OrganizationHierarchy objects via the plugin to set the destination org for deploying a service profile from a template once the user selects a UCS System. I am unable to retrieve the TopRoot object to use as a parent managed object for the UCSM:UCSSystem and give that I only have a UCSM:Hnadle and not a managed object I am unable to call getManagedObjects in the UcsmActionUtils that requires a parent managed object. Is there an alternative way to get a list of org’s (UCSM:OrganizationHierarchy) from the UCS Plugin ?

When will the next version of the Cisco UCS Manager Plugin for vCenter Orchestrator be released, there are some references to a 1.0(1e) version in the VCO API explorer.

Thanks

1 Accepted Solution

Accepted Solutions

Hi Sean,


I got the context now.

  1. You do not need to get a reference to topRoot to get organization.
  2. It is always better to use actions (like getManagedObjects action) instead of calling methods on utility objects.
  3. Not all objects are exposed in inventory. UcsmTopSystem scripting object is not exposed in inventory. We may expose more objects in inventory as per requirement in future releases.


I have tried to create a workflow to immitate your requirement. Please see if it helps.ScriptSnapshot1.jpg

ScriptSnapshot3.jpg

ScriptSnapshot2.jpg

Please find below the text of the script:-

var spTmplList = System.getModule("com.cisco.ucs.vcoplugin.basic").getManagedObjects(handle, null, "serviceProfile", "dn="+templateDn, false, false, false);
var template = null;
if(spTmplList!=null && spTmplList.length==1)
template = spTmplList[0];

if(template == null)
throw new Error("No template selected");
else if(template.getType()=="instance")
throw new Error("Please select a valid Service Profile Template");

var orgList = System.getModule("com.cisco.ucs.vcoplugin.basic").getManagedObjects(handle, null, "org", "dn="+orgDn, false, false, false);
var destOrg = null;
if(orgList!=null && orgList.length==1){
destOrg = orgList[0];
}

if(destOrg == null)
throw new Error("No Destination Organization selected");

createdSp = System.getModule("com.cisco.ucs.vcoplugin.serviceprofile").createServiceProfileFromTemplate(template, null, destOrg, "testSp", 3);

View solution in original post

4 Replies 4

sumtyagi
Level 1
Level 1

Hi Sean,

Your question is not clear. But it seems you are trying to run Create Service Profile From Template workflow and want to select a destination organization where the Service Profile will be created by the workflow.

You will need to navigate to the proper organization where you want to create the service profile. Please see the attached snapshot for reference. If this is not what you are asking, then please give more context about your problem statement.

Snapshot.jpg

The versions in the API Explorer about Managed Objects in UCSM are about when those Managed Objects were introduced (or last modified) in UCSM. Current UCSM plugin for VCO supports UCSM version 2.1(2a).

Best Regards,

Sumit Tyagi

Hi Sumit

Thanks for your reply. I will try explain in a bit more detail what I am trying to do.

I am trying to create a service profile from template and that is the workflow that I am using. What I am trying to do is have the user select a system from a drop down menu and then I would like to search for objects in that particular system and select the Destination Organization programmatically.

I initially thought that once I got the system from a call to UcsmActionUtils.getAllUcsDomains() that I could go from there and get all children of the system until I found the organization I want to use.

After attempting severl different combinations of calls I am unable to programmatically get a root managed object for the system. I was attempted to use UcsmActionUtils.getManageObject to return all object of type UCSM:OrganizationHierarchy for the UCSM:System but this requires a parent managed object.

I am unsure how to retrieve this object to use for searching, I am looking to use the TopRoot object which from what I understand is the parent of all objects in the system. However when I review the list of objects that are part of the plugin the UCSM:TopRoot is not on the list. Is this object included in the plugin? Should it be? How can I retrieve this object?

See collection of screenshots below which highlight the classes and objects I have referenced above.

Thanks.

Sean

Hi Sean,


I got the context now.

  1. You do not need to get a reference to topRoot to get organization.
  2. It is always better to use actions (like getManagedObjects action) instead of calling methods on utility objects.
  3. Not all objects are exposed in inventory. UcsmTopSystem scripting object is not exposed in inventory. We may expose more objects in inventory as per requirement in future releases.


I have tried to create a workflow to immitate your requirement. Please see if it helps.ScriptSnapshot1.jpg

ScriptSnapshot3.jpg

ScriptSnapshot2.jpg

Please find below the text of the script:-

var spTmplList = System.getModule("com.cisco.ucs.vcoplugin.basic").getManagedObjects(handle, null, "serviceProfile", "dn="+templateDn, false, false, false);
var template = null;
if(spTmplList!=null && spTmplList.length==1)
template = spTmplList[0];

if(template == null)
throw new Error("No template selected");
else if(template.getType()=="instance")
throw new Error("Please select a valid Service Profile Template");

var orgList = System.getModule("com.cisco.ucs.vcoplugin.basic").getManagedObjects(handle, null, "org", "dn="+orgDn, false, false, false);
var destOrg = null;
if(orgList!=null && orgList.length==1){
destOrg = orgList[0];
}

if(destOrg == null)
throw new Error("No Destination Organization selected");

createdSp = System.getModule("com.cisco.ucs.vcoplugin.serviceprofile").createServiceProfileFromTemplate(template, null, destOrg, "testSp", 3);

Thanks Sumit that was exactly what I was looking for. Didn’t realise that you did not have to provide a managed object for searching. Thanks again.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: