Server Automation Practitioners Forum

Correct syntax for device group path

Frequent Visitor.

Correct syntax for device group path

I am trying to issue a SOAP call in python for the getDeviceGroupByPath method. I am unable to determine the correct way of formatting the path search string. I need to be able to identify a device group by path since the shortname may be duplicated. I have tried several derivations and have not been able to get a match even though I know the path.

Any help would be appreciated.

Honored Contributor.

Re: Correct syntax for device group path

If you are looking along the path  "Public/200 Servers" you would build an XML SOAP request like this:

<soapenv:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soapenv="" xmlns:dev="">
<dev:getDeviceGroupByPath soapenv:encodingStyle="">
<path xsi:type="dev:ArrayOf_soapenc_string" soapenc:arrayType="soapenc:string[]" xmlns:soapenc="">
<self>200 Servers</self>

And get a reply like this

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
<soapenv:Body soapenv:encodingStyle="">
<ns1:getDeviceGroupByPathResponse xmlns:ns1="">
<getDeviceGroupByPathReturn href="#id0"/>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="" xsi:type="ns2:DeviceGroupRef" xmlns:soapenc="" xmlns:ns2="">
<id xsi:type="xsd:long">6140001</id>
<idAsLong xsi:type="xsd:long">6140001</idAsLong>
<name xsi:type="xsd:string">200 Servers</name>
<secureResourceTypeName xsi:type="xsd:string">device_group</secureResourceTypeName>

The ID is what you are after I suspect.


Re: Correct syntax for device group path

In the HPSA Java GUI application, if you open the device group to see the properties, membership, etc in its own window, it will show you the "Location" which has the path need.  Unfortunately, it's wrong but it does show it.  The trick is to not include the "Device Groups /" prefix and instead use the path that starts with "Public /".

For example, if the GUI shows Location:
Device Groups / Public / Root Folder / Next Level Folder / DevGrp1

You would use:
Public / Root Folder / Next Level Folder / DevGrp1

For the purposes of getDeviceGroupByPath(), the pseudocode would be something like this:
devgrppath = new Array ( "Public", "Root Folder", "Next Level Folder", "DevGrp1" )

The same approach applies to private device groups.

It's surprising that they added the extra text, as it's very confusing.