Software Development Kit (SDK) and API Discussions

Python NMSDK, non utf8 zapi reply breaking api

rsimac
2,611 Views

Question for Python nmsdk maintainers...

 

I have reproducible case of failing registry-get zapi, where return payload is non utf8, and python nmsdk fails as described below...

It can be reproduced inhouse, see below vsim test credentials...

 

Any help appreciated, the problem is somewhat critical....

 

R.

 

This is the unix apitest for problematic case:

bash-4.1$ apitest -s -X 10.238.18.9 root netapp123 registry-get registry-key options.ldap.passwd

INPUT:

<?xml version='1.0' encoding='utf-8' ?>

<!DOCTYPE netapp SYSTEM 'file:/etc/netapp_filer.dtd'>

<netapp version="1.0" xmlns="http://www.netapp.com/filer/admin"><registry-get><registry-key>options.ldap.passwd</registry-key></registry-get></netapp>

 

OUTPUT:

<?xml version='1.0' encoding='UTF-8' ?>

<!DOCTYPE netapp SYSTEM '/na_admin/netapp_filer.dtd'>

<netapp version='1.1' xmlns='http://www.netapp.com/filer/admin'>

<results status="passed"><registry-value>{enc}ÿ</registry-value></results></netapp>

 

And this is failing NMSDK 5.2.1 python unit test for reference:

>>> from NaServer import *

>>> filer="10.238.18.9"

>>> user="root"

>>> password="netapp123"

>>> s=NaServer(filer,1,1)

>>> s.set_server_type("Filer")

>>> s.set_admin_user(user,password)

>>> s.set_transport_type("HTTPS")

>>> elem=NaElement("registry-get")

>>> elem.child_add_string("registry-key","options.ldap.passwd")

>>> output=s.invoke_elem(elem)

Traceback (most recent call last):

  File "<pyshell#39>", line 1, in <module>

    output=s.invoke_elem(elem)

  File "NaServer.py", line 511, in invoke_elem

    return self.parse_xml(xml_response)

  File "NaServer.py", line 708, in parse_xml

    p.Parse(xmlresponse, 1)

ExpatError: not well-formed (invalid token): line 4, column 46

 

>>> elem.sprintf()

'<registry-get>\n\t<registry-key>options.ldap.passwd</registry-key>\n</registry-get>\n'

>>>

0 REPLIES 0
Public