Hello, I've seen several examples around accessing results from get-iter but I'm struggling to access a single result and the examples in the 9.4 API seem to rely on deprecated api calls.
<results status="passed">
<attributes>
<snapmirror-info>
<destination-location>vsm01:vsm01_my_volume</destination-location>
<destination-volume>vsm01_my_volume</destination-volume>
<destination-vserver>vsm01</destination-vserver>
<lag-time>1143</lag-time>
<source-location>vsm01:my_volume</source-location>
<source-volume>my_volume</source-volume>
<source-vserver>vsm01</source-vserver>
</snapmirror-info>
</attributes>
</results>
My code snippet is as follows, my functions returns the ZExplore generated 'xo' object as 'XMLObject', how can I access the lat-time key/value please, thanks.
def getLagTime(strCluster, strUser, strPassword, strDestVserver, strDestVolume):
s = NaServer(strCluster, 1 , ONTAPI_VERSION)
s.set_server_type("FILER")
s.set_transport_type("HTTPS")
s.set_port(443)
s.set_style("LOGIN")
s.set_admin_user(strUser, strPassword)
api = NaElement("snapmirror-get")
xi = NaElement("desired-attributes")
api.child_add(xi)
xi1 = NaElement("snapmirror-info")
xi.child_add(xi1)
xi1.child_add_string("lag-time","<lag-time>")
api.child_add_string("destination-volume",strDestVolume)
api.child_add_string("destination-vserver",strDestVserver)
xo = s.invoke_elem(api)
if (xo.results_status() != "passed") :
print ("Error:\n")
print (xo.sprintf())
# If the check fails, we exit with 'UNKNOWN' according to the nagios spec.
sys.exit (UNKNOWN)
#print ("Received:\n")
#print (xo.sprintf())
return xo
# Call the function
XMLObject = getLagTime(strCluster, strUser, strPassword, strDestVserver, strDestVolume)
print ("Received SnapMirror Lag Time Data:")
print (XMLObject.sprintf())