tag:blogger.com,1999:blog-31472242646857217652024-03-13T05:16:43.026-05:00The Dietze HausYour home for a better networkAnonymoushttp://www.blogger.com/profile/06296907853443555063noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-3147224264685721765.post-83484127818880064282018-05-16T19:06:00.003-05:002018-05-16T19:25:49.107-05:00Suppressing Fault Code "F2543" in Cisco ACI/APIC (3.1+) with the Cobra SDKSometimes in the ACI environment you would like to suppress a fault that either isn't typically suppress-able or one that is hard to find to suppress.<br />
<br />
I recently encountered CSCvi72804 which will cause unsuppress-able faults that are auto-generated if you have used a fabric id value other than "1". Apparently, I need mental help and couldn't just let it go so I ended up writing a script to help me suppress these faults. According to TAC, my only other options were to upgrade my ACI fabric to 3.2 or wipe the whole production datacenter and build it with a fabric id value of "1". No thanks for those other options.<br />
<br />
This script will put your fault suppression inside the Fabric tab's monitoring policy. If you want it elsewhere, you will need to modify the script to reference/create a "FaultTarget" object that lives under the other type of policy.<br />
<br />
The only other things you might need to change if you are attempting to suppress another fault are in the static variable section of the script. These values affect where the GUI will store the fault suppression policies.<br />
<br />
<script src="https://gist.github.com/kdietze3/0b96f3044c41919a52566aa58184689b.js"></script>
<script src="https://gist.github.com/kdietze3/4779eaed8332a5956e0aa017eec664e0.js"></script>Anonymoushttp://www.blogger.com/profile/06296907853443555063noreply@blogger.com0tag:blogger.com,1999:blog-3147224264685721765.post-48577199458262089562017-10-16T21:48:00.000-05:002017-10-16T21:49:30.375-05:00Adding FEX Static Ports to Cisco ACI with Cobra SDK (Network-Centric Approach)OK, now lets really get going. Lets talk about how you could possibly start migrating FEXs to ACI.<br />
<br />
Firstly, we need to discuss the basics of the application-centric approach and the network-centric approach. In the network centric model, you can connect ACI to a legacy network that is still running significant vlans. This is a decent strategy if you don't want to re-ip as you move to ACI and have a significant 7k-5k-2k deployment today.<br />
<br />
Read more <a href="https://www.cisco.com/c/en/us/solutions/collateral/data-center-virtualization/application-centric-infrastructure/white-paper-c11-737361.html">HERE</a><br />
<br />
Although ACI is capable of handling this type of infrastructure, it was obviously not designed to maintain a deployment this way from the GUI so we will need to compensate with a significant amount of scripting.<br />
<br />
This example was actually created to support some B22 migrations. For each of these migrations every one of the ports was configured identically and as a trunk.<br />
<br />
I created a .txt file that I could read from for the vlans that needed to get added to the trunk. You can create your own with a "show vlan b | i active" on an existing 5k/7k that you are migrating from. I will include an example of what that looks like after the script.<br />
<br />
<script src="https://gist.github.com/kdietze3/1ab1e9af331a6e7d64493203e69f1379.js"></script>
<script src="https://gist.github.com/kdietze3/a3c34eefb9aabcd8f0c471eefffb7c6c.js"></script>Anonymoushttp://www.blogger.com/profile/06296907853443555063noreply@blogger.com0tag:blogger.com,1999:blog-3147224264685721765.post-50080680663179535702017-10-16T21:28:00.000-05:002017-10-16T21:28:46.716-05:00Getting Started with the Cisco Cobra SDK and ACIWe should talk about Cisco ACI and the Python Cobra SDK. Cisco's ACI platform is one of those hot new topics and we are always looking for fresh new examples of how to automate basic tasks inside the ACI platform.<br />
<br />
I will not provide examples of how to install the Cobra SDK or any of the Python modules you need. There are plenty of other places on the internet that you can get those instructions from.<br />
<br />
First off, lets start off with the absolute basics. Authentication is obviously the first step as we begin out discussion of Cisco ACI.<br />
<br />
I have provided a basic auth module that can be imported into any Python SDK program. Its not really all that useful, but it will be easier for me to include code later as these posts will build on each other.<br />
<br />
<br />
<script src="https://gist.github.com/kdietze3/4779eaed8332a5956e0aa017eec664e0.js"></script>Anonymoushttp://www.blogger.com/profile/06296907853443555063noreply@blogger.com0tag:blogger.com,1999:blog-3147224264685721765.post-11327073075836978172016-12-04T09:10:00.001-06:002016-12-04T09:10:18.336-06:00Enable Web Admin Interface on Cisco 8861 IP Phone on a 10.5 Call Manager with Python 2.7If you happen to have the fortune of needing to deploy Cisco 8861 Wi-Fi phones on an EAP-TLS network with User Installed Certificates on a 10.5 Call Manager then this script will help you out.<br />
<br />
Call Manager 10.5 has the capability to enable the Web Admin interface on the 8861, but the Call Manager GUI doesn't support enabling it. Without the Web Admin interface, there is no way to actually install your user installed certificate.<br />
<br />
- Dietze<br />
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #888888;">#!/Python27/python</span>
<span style="color: #888888;">#Environment</span>
<span style="color: #888888;">#OSX/UCM10.5/Python2.7/</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">os</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">requests</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">json</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">smtplib</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">urllib</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">sys</span>
<span style="color: #888888;">#####GET INFO FROM CALL MANAGER########</span>
cmserver <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'YOUR_CALL_MANAGER_IP_OR_HOSTNAME'</span>
cmport <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'8443'</span>
wsdl <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"file:"</span> <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"/AXLAPI.wsdl"</span>
location <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'https://'</span> <span style="color: #333333;">+</span> cmserver <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">':'</span> <span style="color: #333333;">+</span> cmport <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'/axl/'</span>
tns <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'http://schemas.cisco.com/ast/soap/'</span>
imp <span style="color: #333333;">=</span> Import(<span style="background-color: #fff0f0;">'http://schemas.xmlsoap.org/soap/encoding/'</span>, <span style="background-color: #fff0f0;">'http://schemas.xmlsoap.org/soap/encoding/'</span>)
imp<span style="color: #333333;">.</span>filter<span style="color: #333333;">.</span>add(tns)
<span style="color: #888888;">##LOCATIONS FOR REALTIME STATUS</span>
<span style="color: #888888;">##THIS IS FOR RISPORT</span>
RTDS_wsdl <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'https://'</span> <span style="color: #333333;">+</span> cmserver <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">':8443/realtimeservice/services/RisPort?wsdl'</span>
RTDS_location <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'https://'</span> <span style="color: #333333;">+</span> cmserver <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">':'</span> <span style="color: #333333;">+</span> cmport <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'/realtimeservice/services/RisPort'</span>
<span style="color: #888888;">#SET USER INFO</span>
<span style="color: #888888;">#MIGHT BE A GOOD IDEA TO ADD READ THIS FROM A FILE OR SOMETHING</span>
username <span style="color: #333333;">=</span> user_file<span style="color: #333333;">.</span>readline()<span style="color: #333333;">.</span>strip()
password <span style="color: #333333;">=</span> user_file<span style="color: #333333;">.</span>readline()<span style="color: #333333;">.</span>strip()
<span style="color: #008800; font-weight: bold;">try</span>:
<span style="color: #888888;">#LOG INTO CALL MANAGER AND CREATE CLIENT OBJECT</span>
client <span style="color: #333333;">=</span> Client(wsdl,location<span style="color: #333333;">=</span>location, username<span style="color: #333333;">=</span>username, password<span style="color: #333333;">=</span>password, plugins<span style="color: #333333;">=</span>[ImportDoctor(imp)])
<span style="color: #888888;">#SETUP REAL TIME DEVICE STATUS CLIENT (NEEDED TO SEARCH BY IP)</span>
RTDS_client <span style="color: #333333;">=</span> Client(RTDS_wsdl,location<span style="color: #333333;">=</span>RTDS_location, username<span style="color: #333333;">=</span>username, password<span style="color: #333333;">=</span>password, plugins<span style="color: #333333;">=</span>[ImportDoctor(imp)])
<span style="color: #888888;">#PHONE NAME TO SEARCH FOR</span>
phone_name <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'SEPXXXXXXXXXXXX'</span>
<span style="color: #888888;">#SET ADMIN PASSWORD FOR THIS PHONE</span>
phone_admin_password <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'ciscocisco'</span>
<span style="color: #888888;">#CREATE RESULT OBJECT AFTER A GET PHONE REQUEST</span>
result <span style="color: #333333;">=</span> client<span style="color: #333333;">.</span>service<span style="color: #333333;">.</span>getPhone(name<span style="color: #333333;">=</span>phone_name)
<span style="color: #888888;">#GET MODEL FROM RESULT OBJECT</span>
model <span style="color: #333333;">=</span> <span style="color: #007020;">str</span>(result[<span style="background-color: #fff0f0;">'return'</span>][<span style="background-color: #fff0f0;">'phone'</span>][<span style="background-color: #fff0f0;">'model'</span>])
<span style="color: #008800; font-weight: bold;">print</span> model
<span style="color: #888888;">#IF THE MODEL IS AN 8861 THEN UPDATE THE PHONE WITH THE VENDOR CONFIG THAT ISNT IN THE CUCM 10.5 GUI</span>
<span style="color: #008800; font-weight: bold;">if</span> model <span style="color: #333333;">==</span> <span style="background-color: #fff0f0;">"Cisco 8861"</span>:
client<span style="color: #333333;">.</span>service<span style="color: #333333;">.</span>updatePhone(name<span style="color: #333333;">=</span>phone_name,vendorConfig<span style="color: #333333;">=</span>{
<span style="background-color: #fff0f0;">'disableSpeaker'</span>:<span style="background-color: #fff0f0;">"false"</span>,
<span style="background-color: #fff0f0;">'disableSpeakerAndHeadset'</span>:<span style="background-color: #fff0f0;">"false"</span>,
<span style="background-color: #fff0f0;">'pcPort'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'voiceVlanAccess'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'webAccess'</span>:<span style="background-color: #fff0f0;">"1"</span>,
<span style="background-color: #fff0f0;">'spanToPCPort'</span>:<span style="background-color: #fff0f0;">"1"</span>,
<span style="background-color: #fff0f0;">'recordingTone'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'recordingToneLocalVolume'</span>:<span style="background-color: #fff0f0;">"100"</span>,
<span style="background-color: #fff0f0;">'recordingToneRemoteVolume'</span>:<span style="background-color: #fff0f0;">"50"</span>,
<span style="background-color: #fff0f0;">'powerPriority'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'minimumRingVolume'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'ehookEnable'</span>:<span style="background-color: #fff0f0;">"1"</span>,
<span style="background-color: #fff0f0;">'headsetWidebandUIControl'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'headsetWidebandEnable'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'garp'</span>:<span style="background-color: #fff0f0;">"1"</span>,
<span style="background-color: #fff0f0;">'allCallsOnPrimary'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'g722CodecSupport'</span>:<span style="background-color: #fff0f0;">"0"</span>,
<span style="background-color: #fff0f0;">'webAdmin'</span>:<span style="background-color: #fff0f0;">"1"</span>,
<span style="background-color: #fff0f0;">'adminPassword'</span>:phone_admin_password,
})
<span style="color: #008800; font-weight: bold;">else</span>:
<span style="color: #008800; font-weight: bold;">raise</span> <span style="color: red; font-weight: bold;">ValueError</span>(<span style="background-color: #fff0f0;">"Not a Cisco 8861"</span>)
<span style="color: #888888;">#RUN SELECT CM DEVICE TO GET THE IP OF THE PHONE WE JUST UPDATED</span>
RTDS_result <span style="color: #333333;">=</span> RTDS_client<span style="color: #333333;">.</span>service<span style="color: #333333;">.</span>SelectCmDevice(<span style="background-color: #fff0f0;">''</span>,{<span style="background-color: #fff0f0;">'SelectBy'</span>:<span style="background-color: #fff0f0;">'Name'</span>, <span style="background-color: #fff0f0;">'Status'</span>:<span style="background-color: #fff0f0;">'Registered'</span>, <span style="background-color: #fff0f0;">'Class'</span>:<span style="background-color: #fff0f0;">'Phone'</span>, <span style="background-color: #fff0f0;">'SelectItems'</span>:{<span style="background-color: #fff0f0;">'SelectItem'</span>:{<span style="background-color: #fff0f0;">'Item'</span>:phone_name}}})
<span style="color: #008800; font-weight: bold;">for</span> i <span style="color: black; font-weight: bold;">in</span> <span style="color: #007020;">range</span>(<span style="color: #0000dd; font-weight: bold;">0</span>,<span style="color: #007020;">len</span>(RTDS_result[<span style="background-color: #fff0f0;">'SelectCmDeviceResult'</span>][<span style="background-color: #fff0f0;">'CmNodes'</span>])):
output <span style="color: #333333;">=</span> <span style="color: #007020;">str</span>(RTDS_result[<span style="background-color: #fff0f0;">'SelectCmDeviceResult'</span>][<span style="background-color: #fff0f0;">'CmNodes'</span>][i][<span style="background-color: #fff0f0;">'CmDevices'</span>])
<span style="color: #008800; font-weight: bold;">if</span> (output <span style="color: #333333;">!=</span> <span style="background-color: #fff0f0;">'[]'</span>):
phone <span style="color: #333333;">=</span> RTDS_result[<span style="background-color: #fff0f0;">'SelectCmDeviceResult'</span>][<span style="background-color: #fff0f0;">'CmNodes'</span>][i][<span style="background-color: #fff0f0;">'CmDevices'</span>]
<span style="color: #888888;">##print output</span>
<span style="color: #888888;">##PRINT PHONES IP</span>
phone_ipaddress <span style="color: #333333;">=</span> phone[<span style="color: #0000dd; font-weight: bold;">0</span>][<span style="background-color: #fff0f0;">'IpAddress'</span>]
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"Phone IP Address: "</span> <span style="color: #333333;">+</span> phone_ipaddress
<span style="color: #888888;">##RESTART PHONE</span>
client<span style="color: #333333;">.</span>service<span style="color: #333333;">.</span>restartPhone(name<span style="color: #333333;">=</span>phone_name)
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"RESETTING PHONE"</span>
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"SUCCESS"</span>
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"Login @: https://"</span><span style="color: #333333;">+</span>phone_ipaddress<span style="color: #333333;">+</span><span style="background-color: #fff0f0;">":8443</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span>
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"admin | "</span><span style="color: #333333;">+</span>phone_admin_password
<span style="color: #008800; font-weight: bold;">except</span> <span style="color: red; font-weight: bold;">Exception</span> <span style="color: #008800; font-weight: bold;">as</span> e:
<span style="color: #008800; font-weight: bold;">print</span> e
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">'Done'</span>
<span style="color: #888888;">###</span>
</pre>
</div>
Anonymoushttp://www.blogger.com/profile/06296907853443555063noreply@blogger.com0tag:blogger.com,1999:blog-3147224264685721765.post-82627840626659001272016-12-03T21:07:00.001-06:002016-12-03T21:07:20.208-06:00Getting Started with Cisco AXL and PythonLets talk about getting started with Python and Cisco AXL.<br />
<br />
AXL is an API that we can use to interact with Call Manager. I was able to get some basic scripts going to automate some more complicated tasks like setting up RDPs or creating route patterns. I won't provide examples of those on this post, but I will in the future.<br />
<br />
Firstly, the important part of these scripts is using the WSDL file for your version of CUCM. There are plenty of resources available to find these so I won't include those instructions here. My examples will be on 10.5 unless otherwise noted.<br />
<br />
Below is an example of how to get started with AXL and Python. You will need to fill out your Call Manager IP, WSDL file location, CUCM username, password, and an example IP Phone name.<!-- HTML generated using hilite.me --><br />
<br />
<div style="background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #888888;">#!/Python27/python</span>
<span style="color: #888888;">#Environment</span>
<span style="color: #888888;">#OSX/UCM10.5/Python2.7/</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">cgi</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">os</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">requests</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">json</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">smtplib</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">urllib</span>
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">sys</span>
<span style="color: #888888;">#####GET INFO FROM CALL MANAGER########</span>
cmserver <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'YOUR_CALL_MANAGER_IP_OR_HOSTNAME'</span>
cmport <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'8443'</span>
wsdl <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"file:"</span> <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"/AXLAPI.wsdl"</span>
location <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'https://'</span> <span style="color: #333333;">+</span> cmserver <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">':'</span> <span style="color: #333333;">+</span> cmport <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'/axl/'</span>
tns <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'http://schemas.cisco.com/ast/soap/'</span>
imp <span style="color: #333333;">=</span> Import(<span style="background-color: #fff0f0;">'http://schemas.xmlsoap.org/soap/encoding/'</span>, <span style="background-color: #fff0f0;">'http://schemas.xmlsoap.org/soap/encoding/'</span>)
imp<span style="color: #333333;">.</span>filter<span style="color: #333333;">.</span>add(tns)
<span style="color: #888888;">##LOCATIONS FOR REALTIME STATUS</span>
<span style="color: #888888;">##THIS IS FOR RISPORT</span>
RTDS_wsdl <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'https://'</span> <span style="color: #333333;">+</span> cmserver <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">':8443/realtimeservice/services/RisPort?wsdl'</span>
RTDS_location <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'https://'</span> <span style="color: #333333;">+</span> cmserver <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">':'</span> <span style="color: #333333;">+</span> cmport <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">'/realtimeservice/services/RisPort'</span>
<span style="color: #888888;">#SET USER INFO</span>
<span style="color: #888888;">#MIGHT BE A GOOD IDEA TO ADD READ THIS FROM A FILE OR SOMETHING</span>
username <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'CUCM_USERNAME'</span>
password <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'PASSWORD'</span>
<span style="color: #008800; font-weight: bold;">try</span>:
<span style="color: #888888;">#LOG INTO CALL MANAGER AND CREATE CLIENT OBJECT</span>
client <span style="color: #333333;">=</span> Client(wsdl,location<span style="color: #333333;">=</span>location, username<span style="color: #333333;">=</span>username, password<span style="color: #333333;">=</span>password, plugins<span style="color: #333333;">=</span>[ImportDoctor(imp)])
<span style="color: #888888;">#SETUP REAL TIME DEVICE STATUS CLIENT (NEEDED TO SEARCH BY IP)</span>
RTDS_client <span style="color: #333333;">=</span> Client(RTDS_wsdl,location<span style="color: #333333;">=</span>RTDS_location, username<span style="color: #333333;">=</span>username, password<span style="color: #333333;">=</span>password, plugins<span style="color: #333333;">=</span>[ImportDoctor(imp)])
<span style="color: #888888;">#PHONE NAME TO SEARCH FOR</span>
phone_name <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'SEPXXXXXXXXXXXX'</span>
<span style="color: #888888;">#CREATE RESULT OBJECT AFTER A GET PHONE REQUEST</span>
result <span style="color: #333333;">=</span> client<span style="color: #333333;">.</span>service<span style="color: #333333;">.</span>getPhone(name<span style="color: #333333;">=</span>phone_name)
<span style="color: #888888;">#GET MODEL FROM RESULT OBJECT</span>
model <span style="color: #333333;">=</span> <span style="color: #007020;">str</span>(result[<span style="background-color: #fff0f0;">'return'</span>][<span style="background-color: #fff0f0;">'phone'</span>][<span style="background-color: #fff0f0;">'model'</span>])
<span style="color: #008800; font-weight: bold;">print</span> model
<span style="color: #888888;">#RUN SELECT CM DEVICE TO GET THE IP OF THE PHONE WE JUST UPDATED</span>
RTDS_result <span style="color: #333333;">=</span> RTDS_client<span style="color: #333333;">.</span>service<span style="color: #333333;">.</span>SelectCmDevice(<span style="background-color: #fff0f0;">''</span>,{<span style="background-color: #fff0f0;">'SelectBy'</span>:<span style="background-color: #fff0f0;">'Name'</span>, <span style="background-color: #fff0f0;">'Status'</span>:<span style="background-color: #fff0f0;">'Registered'</span>, <span style="background-color: #fff0f0;">'Class'</span>:<span style="background-color: #fff0f0;">'Phone'</span>, <span style="background-color: #fff0f0;">'SelectItems'</span>:{<span style="background-color: #fff0f0;">'SelectItem'</span>:{<span style="background-color: #fff0f0;">'Item'</span>:phone_name}}})
<span style="color: #008800; font-weight: bold;">for</span> i <span style="color: black; font-weight: bold;">in</span> <span style="color: #007020;">range</span>(<span style="color: #0000dd; font-weight: bold;">0</span>,<span style="color: #007020;">len</span>(RTDS_result[<span style="background-color: #fff0f0;">'SelectCmDeviceResult'</span>][<span style="background-color: #fff0f0;">'CmNodes'</span>])):
output <span style="color: #333333;">=</span> <span style="color: #007020;">str</span>(RTDS_result[<span style="background-color: #fff0f0;">'SelectCmDeviceResult'</span>][<span style="background-color: #fff0f0;">'CmNodes'</span>][i][<span style="background-color: #fff0f0;">'CmDevices'</span>])
<span style="color: #008800; font-weight: bold;">if</span> (output <span style="color: #333333;">!=</span> <span style="background-color: #fff0f0;">'[]'</span>):
phone <span style="color: #333333;">=</span> RTDS_result[<span style="background-color: #fff0f0;">'SelectCmDeviceResult'</span>][<span style="background-color: #fff0f0;">'CmNodes'</span>][i][<span style="background-color: #fff0f0;">'CmDevices'</span>]
<span style="color: #888888;">##print output</span>
<span style="color: #888888;">##PRINT PHONES IP</span>
phone_ipaddress <span style="color: #333333;">=</span> phone[<span style="color: #0000dd; font-weight: bold;">0</span>][<span style="background-color: #fff0f0;">'IpAddress'</span>]
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"Phone IP Address: "</span> <span style="color: #333333;">+</span> phone_ipaddress
<span style="color: #888888;">##RESTART PHONE</span>
client<span style="color: #333333;">.</span>service<span style="color: #333333;">.</span>restartPhone(name<span style="color: #333333;">=</span>phone_name)
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"RESETTING PHONE"</span>
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"SUCCESS"</span>
<span style="color: #008800; font-weight: bold;">except</span> <span style="color: red; font-weight: bold;">Exception</span> <span style="color: #008800; font-weight: bold;">as</span> e:
<span style="color: #008800; font-weight: bold;">print</span> e
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">'Done'</span>
</pre>
</div>
Anonymoushttp://www.blogger.com/profile/06296907853443555063noreply@blogger.com0tag:blogger.com,1999:blog-3147224264685721765.post-19952024128984079782016-12-02T21:15:00.000-06:002016-12-02T21:15:01.496-06:00And thus it beginsAs with anything new, this will be a work in progress. I plan on this to be a place where I can post code snippets and labs to help others where I have struggled.<br />
<br />
DietzeAnonymoushttp://www.blogger.com/profile/06296907853443555063noreply@blogger.com0