Hi,
I'm trying to learn python and SOAP to work with our HP NNMi system - but I
am only a beginner in python & SOAP, so apologies in advance. I'm sure this
is an easy request, I just not sure where to start.
Based on this blog post -
http://24x7x0.wordpress.com/2011/07/07/use-python-to-talk-to-nnmi/ - I am
able to get the python script to connect to NNMi and get the details of
some nodes. The problem is that by default only 1,000 nodes are collected.
Based on some troubleshooting, I've found that I need to set the maxObjects
filter to > 1,000 as my system has approx 7,000 nodes.
#!/usr/bin/python
from suds.client import Client
from suds.transport.http import HttpAuthenticated
t = HttpAuthenticated(username='admin', password='admin')
url = 'http://netmon/NodeBeanService/NodeBean?wsdl'
client = Client(url, transport=t)
# Retrieve full node list
allNodes = client.service.getNodes('*')
print "Nodes in topology:", len(allNodes.item)
for i in allNodes.item[:]:
print i.name,i.deviceModel
I've also discovered that by default the suds module will send the
following SOAP request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="
http://node.sdk.nms.ov.hp.com/" xmlns:ns2="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header/>
<ns2:Body>
<ns1:getNodes>
<arg0>*</arg0>
</ns1:getNodes>
</ns2:Body>
</SOAP-ENV:Envelope>
By testing in a SOAP debugger I've found that the following SOAP request
will adjust the maxObjects and work as required. The issue I'm facing is
that I can't figure out how to construct the code in the suds module to
generate the following request... if anyone could provide some assistance
about how to add the constraint in suds it would be much appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="
http://node.sdk.nms.ov.hp.com/" xmlns:ns2="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header/>
<ns2:Body>
<ns1:getNodes>
<arg0
xmlns:ns3="http://filter.sdk.nms.ov.hp.com/"
xsi:type="ns3:constraint">
<name>maxObjects</name>
<value>7000</value></arg0>
</ns1:getNodes>
</ns2:Body>
</SOAP-ENV:Envelope>
Thanks
Steve