cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
198
Views
0
Helpful
2
Replies
Highlighted
Beginner

RisPort70 WSDL by Devicepoolname

Hi Guys,

 

I would like to export the phone status selected by device pool name from  RisPort70 WSDL in python. But the documents shows:

SelectBySearch by:
  • Name
  • IPV4Address
  • IPV6Address
  • DirNumber (directory number)
  • Description
  • SIPStatus

 

There is no device pool name.

 

Does anyone have any ideal about it?

 

Thanks a lot.

 

Regards,

 

Yang

2 REPLIES 2
Cisco Employee

Re: RisPort70 WSDL by Devicepoolname

As noted the Risport API (and underlying service) does not have info on the device pool of the devices and you can't query that way directly.

What you can do is use the AXL API to query for a list of all device names belonging to a particular device pool, then use Risport <selectCmDevice> providing all of the individual device names (up to 1000 in each request).

For example, this AXL <executeSqlQuery> request will return the device names of all devices (and note, not just 'phones' but including gateways and other esoteric device) for the 'Default' device pool:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/11.5">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:executeSQLQuery sequence="1">
         <sql>select device.name from device, devicepool where
         	        device.fkdevicepool = devicepool.pkid and
         	        devicepool.name = "Default"
         	        </sql>
      </ns:executeSQLQuery>
   </soapenv:Body>
</soapenv:Envelope>

Example of a <selectCmDevice> request using multiple names:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.cisco.com/ast/soap">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:selectCmDevice>
         <soap:StateInfo/>
         <soap:CmSelectionCriteria>
            <soap:MaxReturnedDevices>80</soap:MaxReturnedDevices>
            <soap:DeviceClass>Phone</soap:DeviceClass>
            <soap:Model>255</soap:Model>
            <soap:Status>Any</soap:Status>
            <soap:NodeName></soap:NodeName>
            <soap:SelectBy>Name</soap:SelectBy>
            <soap:SelectItems>
            	<soap:item><soap:Item>SEP000000000001</soap:Item></soap:item>
            	<soap:item><soap:Item>SEP000000000002</soap:Item></soap:item>
            </soap:SelectItems>
            <soap:Protocol>Any</soap:Protocol>
            <soap:DownloadStatus>Any</soap:DownloadStatus>
         </soap:CmSelectionCriteria>
      </soap:selectCmDevice>
   </soapenv:Body>
</soapenv:Envelope>
Beginner

Re: RisPort70 WSDL by Devicepoolname

Hi dstaudt,
I am using python to export the phone report. The requirement is list all phones select by device pool and show phones status (registered, unregistered and None).
Now I can export the all devices (including CTI, CIPC phones, SEPXXXXXXXXXXXX phones, etc) select by device pool and write data to excel file. The code is below:
# -*- coding: utf-8 -*-

from zeep import Client
from zeep.cache import SqliteCache
from zeep.transports import Transport
from zeep.exceptions import Fault
from zeep.plugins import HistoryPlugin
from requests import Session
from requests.auth import HTTPBasicAuth
from urllib3 import disable_warnings
from urllib3.exceptions import InsecureRequestWarning
from lxml import etree

import pandas as pd
import time

disable_warnings(InsecureRequestWarning)

username = 'username'
password = 'password'
# If you're not disabling SSL verification, host should be the FQDN of the server rather than IP
host = 'IP addresses'

wsdl = 'file://C:/Users/lzqy/code/toolkit/schema/current/AXLAPI.wsdl'
location = 'https:// IP addresses:8443/axl/'.format(host=host)
binding = "{http://www.cisco.com/AXLAPIService/}AXLAPIBinding"

# Create a custom session to disable Certificate verification.
# In production you shouldn't do this,
# but for testing it saves having to have the certificate in the trusted store.
session = Session()
session.verify = False
session.auth = HTTPBasicAuth(username, password)

transport = Transport(cache=SqliteCache(), session=session, timeout=20)
history = HistoryPlugin()
client = Client(wsdl=wsdl, transport=transport, plugins=[history])
service = client.create_service(binding, location)


def show_history():
for item in [history.last_sent, history.last_received]:
print(etree.tostring(item["envelope"], encoding="unicode", pretty_print=True))


try:
resp = service.listPhone(searchCriteria={'devicePoolName': '%users%'},
returnedTags={'model': '', 'name': '', 'description': '', 'devicePoolName': '',
'protocol': ''})

phone_list = resp['return'].phone

result = pd.DataFrame()
for phone in phone_list:
raw_data = {
"model": [phone.model],
"name": [phone.name] ,
"description": [phone.description],
"devicePoolName": [phone.devicePoolName['_value_1']],
"protocol": [phone.protocol],

}



result = pd.concat([result, (pd.DataFrame.from_dict(raw_data))])
result.to_excel(time.strftime("Report-allphone %Y-%m-%d.xlsx"), index=False)

except Fault:
show_history()

What I need is filter this list and only keep name like CIPC% and SEP% data and find them in Risport API to get phones with status are registered and unregistered.
After that, write the status to "None"for rest of phones.

Do you have any idea about this?

Thanks.

Regards,

Yang
CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards
This widget could not be displayed.