I have two APIs related to CA Spectrum. The first API puts network devices
in maintenance mode, and the second API is used to find the model MH value
based on a device name.



*API Details:*

1. Maintenance Mode API:

   URL: `http://CAserver:portnumber
/spectrum/restful/model/0xa0000fa0?attr=0x1295d&val=false`

   *Issue: I need to find the correct value (e.g., `0xa0000fa0`) to replace
in the URL.*

2. Find Model API:

    URL: `http://CAserver:portnumber/spectrum/restful/models/`

    Body:

                      <rs:model-request throttlesize="5"

              xmlns:rs="http://www.ca.com/spectrum/restful/schema/request";

              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

              xsi:schemaLocation="
http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd
">

                <rs:target-models>

                  <rs:models-search>

                    <rs:search-criteria

                      xmlns="
http://www.ca.com/spectrum/restful/schema/filter";>

                      <devices-only-search/>

                      <filtered-models>

                        <equals>

                          <attribute id="0x1006e">

                            <value>YourActualDeviceName</value>

                          </attribute>

                        </equals>

                      </filtered-models>

                    </rs:search-criteria>

                  </rs:models-search>

                </rs:target-models>

                <rs:requested-attribute id="0x1006e" />

                <rs:requested-attribute id="0x129fa" />

            </rs:model-request>



*Issue: I've received an XML response, and I need to extract the 'mh' value
from it to use in the Maintenance Mode API.*



*XML Response:*

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>



<model-response-list xmlns=http://www.ca.com/spectrum/restful/schema/response
total-models="156" throttle="156" error="EndOfResults">



<model-responses>

    <model mh="0x19206c00">



        <attribute id="0x19206e">192.168.74.63</attribute>



        <attribute id="0x12d7f">192.168.74.63</attribute>



    </model>

</model-responses>

</model-responses-list>



*Request for Help:*

1. How can I extract the 'mh' value from the XML response using Ansible?

2. Once I have the 'mh' value, how can I dynamically replace it in the
Maintenance Mode API URL?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFPtCb2es39S%2Btrp7jJXKP0WKh%3D0BEWLDfv5htgLfwcP6Q5wwA%40mail.gmail.com.

Reply via email to