cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2967
Views
0
Helpful
9
Replies

AXL Response (python dict) does not match zeep XML output

goliver
Level 1
Level 1

Hi, I am very new to this, so it may be something simple, but here goes.  I am using 10.5 AXL with the current xsd and wsdl loaded and the axl-python-zeep-samples-master/axl_update_Service_Parameter.py example file (on Linux).  I created the environment variables and the connection works, but I do not understand why when I add more tags, the XML Debug output is still correct, but the dict is not.

 

Example Working (I added 1 criteria and 2 tags):

criteria = {
    'name': '%',
    'processNodeRole': 'CUCM Voice/Video',
    'description': 'UCM%'
}

tags = {
    'name': '',
    'description': '',
    'nodeUsage': ''
}

  Output:

Request
-------
Headers:
{'SOAPAction': '"CUCM:DB ver=10.5 listProcessNode"', 'Content-Type': 'text/xml; charset=utf-8'}

Body:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Body>
    <ns0:listProcessNode xmlns:ns0="http://www.cisco.com/AXL/API/10.5">
      <searchCriteria>
        <name>%</name>
        <description>UCM%</description>
        <processNodeRole>CUCM Voice/Video</processNodeRole>
      </searchCriteria>
      <returnedTags>
        <name></name>
        <description></description>
        <nodeUsage></nodeUsage>
      </returnedTags>
    </ns0:listProcessNode>
  </soap-env:Body>
</soap-env:Envelope>


Response
-------
Headers:
{'Set-Cookie': 'JSESSIONIDSSO=05FCC2D6529FE971026834DB04E35606; Path=/; Secure; HttpOnly, JSESSIONID=C72A327E9FAAA502339D516AF3FBD974; Path=/axl; Secure; HttpOnly', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Content-Type': 'text/xml;charset=UTF-8', 'Content-Length': '678', 'Date': 'Tue, 17 Aug 2021 19:19:59 GMT', 'Server': ''}

Body:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <ns:listProcessNodeResponse xmlns:ns="http://www.cisco.com/AXL/API/10.5">
      <return>
        <processNode uuid="{272BB114-B505-4B2F-B023-ADC85B668E1A}">
          <name>ucm-10-5-pub.planolab.cistera.net</name>
          <description>UCM 10.5 Publisher</description>
          <nodeUsage>Publisher</nodeUsage>
        </processNode>
        <processNode uuid="{D04EBA5F-6F92-979F-8D6D-E3B4B231AD77}">
          <name>ucm-10-5-sub1.planolab.cistera.net</name>
          <description>UCM 10.5 Subscriber 1</description>
          <nodeUsage>Subscriber</nodeUsage>
        </processNode>
      </return>
    </ns:listProcessNodeResponse>
  </soapenv:Body>
</soapenv:Envelope>


listProcessNode response:

{
    'return': {
        'processNode': [
            {
                'name': 'ucm-10-5-pub.planolab.cistera.net',
                'description': 'UCM 10.5 Publisher',
                'mac': None,
                'ipv6Name': None,
                'nodeUsage': 'Publisher',
                'lbmHubGroup': None,
                'processNodeRole': None,
                'uuid': '{272BB114-B505-4B2F-B023-ADC85B668E1A}'
            },
            {
                'name': 'ucm-10-5-sub1.planolab.cistera.net',
                'description': 'UCM 10.5 Subscriber 1',
                'mac': None,
                'ipv6Name': None,
                'nodeUsage': 'Subscriber',
                'lbmHubGroup': None,
                'processNodeRole': None,
                'uuid': '{D04EBA5F-6F92-979F-8D6D-E3B4B231AD77}'
            }
        ]
    },
    'sequence': None
} 

You can see, the XML and python dict reflect the same data.  Now if I add one more tag, it never returns nodeValue properly again.  No matter where in the order I place it, etc.  Very strange - the XML output is always right, but the dictionary never is:

 

criteria = {
    'name': '%',
    'processNodeRole': 'CUCM Voice/Video',
    'description': 'UCM%'
}

tags = {
    'name': '',
    'description': '',
    'processNodeRole': '',
    'nodeUsage': ''
}

Output:

Request
-------
Headers:
{'SOAPAction': '"CUCM:DB ver=10.5 listProcessNode"', 'Content-Type': 'text/xml; charset=utf-8'}

Body:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Body>
    <ns0:listProcessNode xmlns:ns0="http://www.cisco.com/AXL/API/10.5">
      <searchCriteria>
        <name>%</name>
        <description>UCM%</description>
        <processNodeRole>CUCM Voice/Video</processNodeRole>
      </searchCriteria>
      <returnedTags>
        <name></name>
        <description></description>
        <nodeUsage></nodeUsage>
        <processNodeRole></processNodeRole>
      </returnedTags>
    </ns0:listProcessNode>
  </soap-env:Body>
</soap-env:Envelope>


Response
-------
Headers:
{'Set-Cookie': 'JSESSIONIDSSO=44CF3E5ABAB9C7BAAE87088555D4103C; Path=/; Secure; HttpOnly, JSESSIONID=11067D86A3CC49B5BABF6CDDCDD42717; Path=/axl; Secure; HttpOnly', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Content-Type': 'text/xml;charset=UTF-8', 'Content-Length': '780', 'Date': 'Tue, 17 Aug 2021 19:25:02 GMT', 'Server': ''}

Body:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <ns:listProcessNodeResponse xmlns:ns="http://www.cisco.com/AXL/API/10.5">
      <return>
        <processNode uuid="{272BB114-B505-4B2F-B023-ADC85B668E1A}">
          <name>ucm-10-5-pub.planolab.cistera.net</name>
          <description>UCM 10.5 Publisher</description>
          <processNodeRole>CUCM Voice/Video</processNodeRole>
          <nodeUsage>Publisher</nodeUsage>
        </processNode>
        <processNode uuid="{D04EBA5F-6F92-979F-8D6D-E3B4B231AD77}">
          <name>ucm-10-5-sub1.planolab.cistera.net</name>
          <description>UCM 10.5 Subscriber 1</description>
          <processNodeRole>CUCM Voice/Video</processNodeRole>
          <nodeUsage>Subscriber</nodeUsage>
        </processNode>
      </return>
    </ns:listProcessNodeResponse>
  </soapenv:Body>
</soapenv:Envelope>


listProcessNode response:

{
    'return': {
        'processNode': [
            {
                'name': 'ucm-10-5-pub.planolab.cistera.net',
                'description': 'UCM 10.5 Publisher',
                'mac': None,
                'ipv6Name': None,
                'nodeUsage': None,
                'lbmHubGroup': None,
                'processNodeRole': 'CUCM Voice/Video',
                'uuid': '{272BB114-B505-4B2F-B023-ADC85B668E1A}',
                '_raw_elements': deque([<Element nodeUsage at 0x7f593106ccc0>])
            },
            {
                'name': 'ucm-10-5-sub1.planolab.cistera.net',
                'description': 'UCM 10.5 Subscriber 1',
                'mac': None,
                'ipv6Name': None,
                'nodeUsage': None,
                'lbmHubGroup': None,
                'processNodeRole': 'CUCM Voice/Video',
                'uuid': '{D04EBA5F-6F92-979F-8D6D-E3B4B231AD77}',
                '_raw_elements': deque([<Element nodeUsage at 0x7f593106cc40>])
            }
        ]
    },
    'sequence': None
} 

Very odd to me -

 

Thanks for any assistance.

 

-Greg Oliver

2 Accepted Solutions

Accepted Solutions

davidn#
Cisco Employee
Cisco Employee

Hi Greg,

 

I am using AXL on 11.5 and don't see this problem. I think it may have to do with how Zeep unable to parse the XML data and put into _raw_elements. Try to exclude the fields in tags that already in the search criteria. In your case, just include 'nodeUsage' only. i.e.

 

tags = {
    'nodeUsage': ''
}

 

Regards,

 

David

View solution in original post

Hi Greg,

 

I am using this AXL package and found it really well written & easy to expand:

      https://pypi.org/project/ciscoaxl/#files

It also uses Zeep which is a very common python module for SOAP protocol.

Hope that helps.

Regards,

 

David

 

View solution in original post

9 Replies 9

davidn#
Cisco Employee
Cisco Employee

Hi Greg,

 

I am using AXL on 11.5 and don't see this problem. I think it may have to do with how Zeep unable to parse the XML data and put into _raw_elements. Try to exclude the fields in tags that already in the search criteria. In your case, just include 'nodeUsage' only. i.e.

 

tags = {
    'nodeUsage': ''
}

 

Regards,

 

David

That does solve the issue for me, but I must admit that makes reading results more complex than I was hoping.  It is like having to pre-store the SQL variables I want because I cannot have the return result included.  If you are not seeing it on 11.5, I may just upgrade my lab.  Or better yet, do you see most people parsing the xml, or the python dictionary?  I am new to xmltree/zeep and python is crude at best, but if I can parse the xml as easy as a dictionary, I will do that as the xml is always correct.

 

Thanks for the pointer.

 

-Greg

Well, take this scenario (which always succeeds) - I want to do a wildacrd on the description, but still need the individual descriptions returned as well.

 

criteria = {
    'name': '%',
    'processNodeRole': 'CUCM Voice/Video',
    'description': 'UCM%'
}

tags = {
    'name': '',
    'description': '',
    'mac': '',
    'ipv6Name': '',
    'nodeUsage': ''
}

This return correctly every time.  Could it have something to do with the WSDL for the nodeType item - possibly I am violating a constraint somehow (this is my entry into wsdl and xml, so..)

 

nodeUsage is not a string, but axlapi:XNodeUsage and XNodeUsage contains 2 xsd:strings (Publisher, Subscriber).

 

I have no clue as to whether or not that field could be causing zeep to not decipher the result by walking the tree or not, but it is the only variable different from the other tags I want returned that I can see.

 

Thanks again

 

 

Greg,

 

There are many good XML to Dict python modules out there that you can use like xml.etree if XML always return correct data. Good luck!

 

David

Thanks much for your dedication to solving issues David.  I was under the impression that Zeep was Cisco's recommened python approach, but I guess not.  Are there any other libraries you recommend since Zeep apparently does not create dictionaries appropriately?  I am not really interested in using more 3rd party libraries since (as you can see) they increase the possibility of bugs/issues, but I am willing to try something else entirely.

 

Thanks for your help.

 

-Greg

 

Hi Greg,

 

I am using this AXL package and found it really well written & easy to expand:

      https://pypi.org/project/ciscoaxl/#files

It also uses Zeep which is a very common python module for SOAP protocol.

Hope that helps.

Regards,

 

David

 

David,

 

Thanks for pointing out that project - I switched to Python3 and installed it with pip.  All of my issues are gone now.

 

Thanks again!

 

-Greg

Well, I spoke too soon.  With this version, the nodeUsage criteria is not even applied:

 

    criteria = {
                    'name': '%',
                    'nodeUsage': 'Subscriber',
                    'description': 'UCM%',
                    }
    tags = {
            'name': '',
            'description': '',
                }
    try:
            resp = service.listProcessNode( criteria, tags )

Result:

[root@1002023 configureHost]# ./axl.py 

Request
-------
Headers:
{'SOAPAction': '"CUCM:DB ver=10.5 listProcessNode"', 'Content-Type': 'text/xml; charset=utf-8'}

Body:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Body>
    <ns0:listProcessNode xmlns:ns0="http://www.cisco.com/AXL/API/10.5">
      <searchCriteria>
        <name>%</name>
        <description>UCM%</description>
      </searchCriteria>
      <returnedTags>
        <name></name>
        <description></description>
      </returnedTags>
    </ns0:listProcessNode>
  </soap-env:Body>
</soap-env:Envelope>


Response
-------
Headers:
{'Set-Cookie': 'JSESSIONIDSSO=2D70A0222091031E9B98CB25511D1829; Path=/; Secure; HttpOnly, JSESSIONID=808FD00DFF9FB3C345A07E359E930B4B; Path=/axl; Secure; HttpOnly', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Content-Type': 'text/xml;charset=UTF-8', 'Content-Length': '776', 'Date': 'Wed, 01 Sep 2021 13:48:47 GMT', 'Server': ''}

Body:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <ns:listProcessNodeResponse xmlns:ns="http://www.cisco.com/AXL/API/10.5">
      <return>
        <processNode uuid="{272BB114-B505-4B2F-B023-ADC85B668E1A}">
          <name>ucm-10-5-pub.planolab.cistera.net</name>
          <description>UCM 10.5 Publisher</description>
        </processNode>
        <processNode uuid="{D04EBA5F-6F92-979F-8D6D-E3B4B231AD77}">
          <name>ucm-10-5-sub1.planolab.cistera.net</name>
          <description>UCM 10.5 Subscriber 1</description>
        </processNode>
        <processNode uuid="{B3DB11AB-E9E3-0743-E200-918E00078D30}">
          <name>ucm-10-5-sub2.planolab.cistera.net</name>
          <description>UCM Subscriber 2</description>
        </processNode>
      </return>
    </ns:listProcessNodeResponse>
  </soapenv:Body>
</soapenv:Envelope>

{
    'return': {
        'processNode': [
            {
                'name': 'ucm-10-5-pub.planolab.cistera.net',
                'description': 'UCM 10.5 Publisher',
                'mac': None,
                'ipv6Name': None,
                'nodeUsage': None,
                'lbmHubGroup': None,
                'processNodeRole': None,
                'uuid': '{272BB114-B505-4B2F-B023-ADC85B668E1A}'
            },
            {
                'name': 'ucm-10-5-sub1.planolab.cistera.net',
                'description': 'UCM 10.5 Subscriber 1',
                'mac': None,
                'ipv6Name': None,
                'nodeUsage': None,
                'lbmHubGroup': None,
                'processNodeRole': None,
                'uuid': '{D04EBA5F-6F92-979F-8D6D-E3B4B231AD77}'
            },
            {
                'name': 'ucm-10-5-sub2.planolab.cistera.net',
                'description': 'UCM Subscriber 2',
                'mac': None,
                'ipv6Name': None,
                'nodeUsage': None,
                'lbmHubGroup': None,
                'processNodeRole': None,
                'uuid': '{B3DB11AB-E9E3-0743-E200-918E00078D30}'
            }
        ]
    },
    'sequence': None
}

 

Sorry for the nois - I see that is not a valid entry in the WSDL and schema for List ProcesNode.  Guess I need to pull it all in and then walk my dictionary.  What is very odd is that the axlsqltookit I downloaded from Cisco actually returns valid data against nodeUsage as where the pip installed version completely ignores it (as it should compared to the wsdlrestrictions).

 

Anyhow - a lot of moving parts and a lot of software discrepancies here.  Makes me re-think using this interface.  I initially started down this road because our company has for years been using AXL with RIS simply to get the IP address of devices.  Nowadays, we do not necessarily need the IP address and it was always the only column we need a direct RIS query for.  Customers with 25K plus devices on a cluster would cause 20 minutes for the quesries due to throttling, and those same customers with multiple clusters would take hours.  It seems the java interface is more refined and polished.  I was just trying to PoC this stuff with python, but I will punt it over the fence to our normal developers.

 

Thanks for your assistance with the [ython stuff, but it is apparently a tad different and over my head obviously.

 

-Greg

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: