Maintenance is complete- We've moved from the saas.hpe.com domain to softwaregrp.com click to read more
As part of our journey to complete our separation work and our future integration with Micro Focus, we've now updated our domain for the community. This is an interim step, which will be followed by a series of future update / improvements: - Piloting Idea boards - Refreshing the entire UI. (more to come later) - and more
Server Automation Practitioners Forum
cancel

Correct syntax for device group path

Highlighted
teresa_d_riley
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.

2 REPLIES
bengland
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="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dev="http://device.opsware.com">
<soapenv:Header/>
<soapenv:Body>
<dev:getDeviceGroupByPath soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<path xsi:type="dev:ArrayOf_soapenc_string" soapenc:arrayType="soapenc:string[]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding">
<self>Public</self>
<self>200 Servers</self>
</path>
</dev:getDeviceGroupByPath>
</soapenv:Body>
</soapenv:Envelope>

And get a reply like this

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<ns1:getDeviceGroupByPathResponse xmlns:ns1="http://device.opsware.com">
<getDeviceGroupByPathReturn href="#id0"/>
</ns1:getDeviceGroupByPathResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:DeviceGroupRef" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://device.opsware.com">
<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>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>

The ID is what you are after I suspect.

RandomGuy2385
Valued Contributor.

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.