I'd like to use some of the actions that come with the UCS Plugin library, but I don't understand the functions, input parameters, or output parameters. Can you point me to where these might be documented?
A bit late but it could be helpful for somebody else looking for the same..
So, this should be valid for every plugin:
1.
var arrayOfObjectsFromThatType = Server.findAllForType("NameSpace:Type");
// returns array of all of objects from this type.
2.
var specificObject = Server.findForType("NameSpace:Type", id);
//Return an object by id and type
3. All UCS Objects has the following properties:
id
name
dn
multiUcsmDn
The most important of all of those properites is multiUcsmDn . This is the unique id that has the hierarchy encoded. So, for this plugin the id = multiUcsmDn. Examples.
"System" will have multiUcsmDn = "http://10.23.34.34/" - not sure for the exact system but you can figure it out.
"Chassis" will have multiUcsmDn = "http://10.23.34.34/sys/chassis-1"
"Blade" will have multiUcsmDn = ""http://10.23.34.34/sys/chassis-1/blade34"
So having all of this in mind, you can do the following
1.
var systems = Server.findAllForType("UCSM:System");
// returns array of all of the registered UCS systems
2.
Not straightforward here but you can filter the chassis based on a selected UCS system.
var allChassis = Server.findAllForType("UCSM:Chassis");
you can filter the chassis by multiUcsmDn. Something like
if (chassis.getMultiUcsmDn().indexOf(system.getMultiUcsmDn()) != -1)
//then add this chassis to the list so that you can filter only the chassis that are related to the UCS systems you chose.
3.
The next step is easy since chassis has method getBlades(). The two properties that might be helpful here "status" and "assignedToDn". It will identify if the state of the blade has been provissioned and so on.
4.
In case, you are looking for blades that are not provission in the previous steps, there is a workflow to assing service profile to a blade - "Assign a service profile to a blade"
Hope, it is helpful.
Thanks,
Igor.
Most of the actions in the Cisco UCS Manager plug-in are similar to the workflow. There are additional ones as well. You can find action and parameter descriptions in Tools/API Explorer under com.vmware.library.ucsm. Please, take a look at the screenshot attached.
Thanks,
Igor.
Thanks for the above answer, but I still need more information. What is a "resultClass" string supposed to contain? Where do I find the possible string values for "type"? Is there any documentation available besides the Users Guide?
I am afraid that the API explorer and the user guide are the only place documenting the Cisco UCS Manager plug-in API. As I said before, the actions should be one to one with the corresponding workflows so if something is not documented fully (like type) you can take a look at the related workflow and find out the related type. Also, the Cisco UCS API documentation could be helpful to understand some of the concepts since the UCS plug-in expose that API.
Further, we can try to provide additional information if you have concrete question about some of the actions.
Thanks,
Igor.
A list of possible "type" values can be found by browsing the API Explorer. When expanding any plugin, the first set of items listed are the Types that the plug-in has made available.
For example, here is a screenshot of the vCloud Director plugin from the API Explorer:
The format of the Types is: Plugin:TypeName
For instance: vCloud:AdminCatalog.
The "Types" are always the grey icons as shown in the above screenshot. Also, selecting a Type will give details in the bottom, including the Scripting Object if applicable.
Hope this info helps
I am specifically interested in finding blades and Service Profiles from inside the hierarchy. I want to create an array of Service Profiles, for instance, to get information about them one by one. I don’t want the user or myself to have to select them by hand.
They “type” and “resultClass” parameters are typed as “string”, which give me little information as to how to format them. I am currently looking at the “loadElementsByType” method, which doesn’t say what it does, and doesn’t seem to exist in the UCSM docs.
Did Cisco help write this plugin? Did they provide any docs on how the underlying elements were supposed to work?
Thanks,
John Kennedy
Hi John,
This method is not really public, so you will hardly find documentation.
But with vCO client you can take a look at what is inside, or query where is it used (right-click / Find elements that use this element).
So, the actual code, executed by this method is:
var result = UcsmObjectManager.loadTypeElements(type, resultClass, "getName");
The resulClass parameter is the class name of the result object from your search, and the type is the name of the object you query, the last one is the name of a property getter method.
The list of properties for each type, that you can query, you can get from the API Explorer in the vCO client.
For example, ServiceProfile type has:
description
displayName
dn
id
multiUcsmDn
name
.....
For example, for the 2 cases you mentioned, you need make calls like this:
loadElementsByType("Blade", "java.lang.String");
and
loadElementsByType("ServiceProfile", "java.lang.String");
As a result you will recieve array with the names of these objects. If this is not what you wanted, for example, you need a dn list, or a list of some other property, you should use the already mentioned inner code, by creating your own Action or scripting element inside a workflow.
Like this:
var result = UcsmObjectManager.loadTypeElements("ServiceProfile", "java.lang.String", "getDn");
Hope that helps,
Ivan
That is somewhat helpful. What I really need is a way to enumerate the Blades and Service profiles at runtime. Perhaps I'm choosing the wrong actions/workflows. What workflows are there for that?
A bit late but it could be helpful for somebody else looking for the same..
So, this should be valid for every plugin:
1.
var arrayOfObjectsFromThatType = Server.findAllForType("NameSpace:Type");
// returns array of all of objects from this type.
2.
var specificObject = Server.findForType("NameSpace:Type", id);
//Return an object by id and type
3. All UCS Objects has the following properties:
id
name
dn
multiUcsmDn
The most important of all of those properites is multiUcsmDn . This is the unique id that has the hierarchy encoded. So, for this plugin the id = multiUcsmDn. Examples.
"System" will have multiUcsmDn = "http://10.23.34.34/" - not sure for the exact system but you can figure it out.
"Chassis" will have multiUcsmDn = "http://10.23.34.34/sys/chassis-1"
"Blade" will have multiUcsmDn = ""http://10.23.34.34/sys/chassis-1/blade34"
So having all of this in mind, you can do the following
1.
var systems = Server.findAllForType("UCSM:System");
// returns array of all of the registered UCS systems
2.
Not straightforward here but you can filter the chassis based on a selected UCS system.
var allChassis = Server.findAllForType("UCSM:Chassis");
you can filter the chassis by multiUcsmDn. Something like
if (chassis.getMultiUcsmDn().indexOf(system.getMultiUcsmDn()) != -1)
//then add this chassis to the list so that you can filter only the chassis that are related to the UCS systems you chose.
3.
The next step is easy since chassis has method getBlades(). The two properties that might be helpful here "status" and "assignedToDn". It will identify if the state of the blade has been provissioned and so on.
4.
In case, you are looking for blades that are not provission in the previous steps, there is a workflow to assing service profile to a blade - "Assign a service profile to a blade"
Hope, it is helpful.
Thanks,
Igor.