Tuesday, January 7, 2014

Shell script to update device user association in batch

Referring to my previous post:
http://pandaeatsbamboo.blogspot.hk/2014/01/associate-existing-phones-to-users-with.html

I have created a shell script that allow us to update the owner ID to phone in batch.


bulk-update.sh, change with your UCM ip address and credential in the curl statement.

#!/bin/sh

for i in `less user-phone-list.txt`
        do 
                #echo $i
                username=`echo $i | cut -d ',' -f1`
                devicename=`echo $i | cut -d ',' -f2`
                 

cat <<EOF1 >$username.xml

    <soapenv:Header/>

    <soapenv:Body>

        <ns:executeSQLUpdate sequence="?">

EOF1

                echo "<sql>update Device set fkenduser = ( select pkid from EndUser where userid = '$username')  where name = '$devicename'</sql>" >>$username.xml

cat <<EOF2 >>$username.xml
        </ns:executeSQLUpdate>

    </soapenv:Body>

</soapenv:Envelope>
EOF2

        curl -k -u administrator:ccievoice -H "Content-type: text/xml;" -H "SOAPAction: CUCM:DB ver=8.5" -d @$username.xml https://10.1.90.11:8443/axl/
        
        done


user-phone-list.txt, file contains username and device name pair with comma as delimiter, put them in the same directory as the script.

dannywon,SEPAABBAABBAABB
briacho,SEP00077DDFFB7E


Associate Existing Phones to Users with SQL statement

I have come across a case which is a licensing issue for the new 9.1.2.  The customer is using desk phone for extension mobility, while they have users using CSF device as the main phone.  All those desk phone are not associated with user because it doesn't make sense to do it, however all the EM desk phone and CSF devices will count as Enhanced UCL instead of CUWL, as there are no multiple device associate to single users and thus double counting the license, as those Enhanced UCL are "borrowed" from CUWL standard.

As an interim solution we need to update the phones to associate it with an "owner", although BAT can do the job, it imposes risk in overriding phone settings.


An alternative is using cURL with AXL.  So the first thing I need to do is to dig out what SQL statement I need to issue before writing the batch job.

Firstly I need to find out the PKID of a particular user.
admin:run sql select pkid from EndUser where userid = 'dannywon'
pkid                                 
==================================== 
61b76ad9-7a1b-405c-bb70-b9850397635d 

Then I can check out how many and what devices is associating to that particular user.
admin:run sql select name from Device where fkenduser = '61b76ad9-7a1b-405c-bb70-b9850397635d'
name            
=============== 
CSFDANNYWON     
TABDANNYWON     
TCTDANNYWON     
ECPDANNYWON     
SEP503DE57D87F8 
EMDANNY1        
EMDANNY2        
SEPF84F5794013A 

I also want to know all the unassociated devices.
admin:run sql select name from Device where fkenduser is NULL
name                                               
================================================== 
MTP_2                                              
CFB_2                                              
ANN_2                                              
MOH_2                                              
MTP_3                                              
CFB_3                                              
ANN_3                                              
MOH_3                                              
SEPAABBAABBAABB                                    
VCB0003D6012D4C 

OK, next thing I want to do is to update the Device table, so that the device SEPAABBAABBAABB is associated to the desired user dannywon.
admin:run sql update Device set fkenduser = '61b76ad9-7a1b-405c-bb70-b9850397635d' where name = 'SEPAABBAABBAABB'

Before the UPDATE statement it shows Anonymous under the device settings:

After the UPDATE statement it shows that this device is associated to an user:

But it will not shown in the End User page as "Controlled Device", we are just changing the Owner ID of that particular device to trick the ELM.  With all these SQL statement you should be able to develop your XML file and post the SOAP request via cURL.

Note:  An optimized SQL statement with sub-query:

admin:run sql update Device set fkenduser = ( select pkid from EndUser where userid = 'dannywon' ) where name = 'SEPAABBAABBAABB'

My next post is going to create a shell script to do it in batch:
http://pandaeatsbamboo.blogspot.hk/2014/01/shell-script-to-update-device-user.html

Monday, December 23, 2013

Jabber Video for Telepresence 4.6 - unable to recognize camera on Maverick OS X 10.9

Got an issue on Jabber Video 4.6 on Mac, it can login but can't recognize the iSight camera after I upgraded my MBP to Maverick.  You need to upgrade to 4.7 in order to fix this issue.  I have upgraded to 4.7.4 and works well on my Mac.


Wednesday, December 11, 2013

OTV - Selective Unicast Flooding

Normally in OTV, unknown unicast frames are not flooded between OTV sites and MAC addresses are not learned across the overlay interface.  Any unknown unicast messages that reach the OTV edge device are blocked to prevent layer 2 errors spreading to remote sites.  It is assumed the end points are not silent or unidirectional.  If there is any silent hosts or Microsoft unicast mode NLB is used in your data center, your host will be "disappeared" from the view of other OTV sites.  In 6.2(2) and later, a new feature called selective unicast flooding is introduced and you can issue the command on the OTV VDCs at the site where the server / silent host exists, in result the specified destination MAC address is flooded to all other edge devices in the OTV overlay network with that unknown unicast traffic.


 otv flood mac 0011.2233.4455 vlan 66

RBAC - san-admin on Nexus 5500

Starting from NX-OS 5.2(1)N1(1), Nexus 5500 has a new predefined role "san-admin" which allows you to provide clear demarcation on what SAN and LAN team can do on the Nexus 5500.  You can use this for your DCNM for SAN too.  I have tried it on my DCNM 6.2(3) in lab and it works fine.  User with this right can do most of the things on DCNM for SAN but not DCNM for LAN.  Here is the detail on what a predefined san-admin role can do:

POC-N5K# sh role name san-admin

Role: san-admin
  Description: Predefined system role for san administrators. This role
  cannot be modified.
  vsan policy: permit(default)
  Vlan policy: permit(default)
  Interface policy: permit(default)
  Vrf policy: permit(default)
  -------------------------------------------------------------------
  Rule    Perm    Type        Scope               Entity                  
  -------------------------------------------------------------------
  27      permit  read        
  26      permit  read-write  feature             fcdomain                
  25      permit  read-write  feature             rdl                     
  24      permit  read-write  feature             trunk                   
  23      permit  read-write  feature             fcmgmt                  
  22      permit  read-write  feature             fcfe                    
  21      permit  read-write  feature             port-track              
  20      permit  read-write  feature             fcoe                    
  19      permit  read-write  feature             port-security           
  18      permit  read-write  feature             copy                    
  17      permit  read-write  feature             rmon                    
  16      permit  read-write  feature             rscn                    
  15      permit  read-write  feature             fspf                    
  14      permit  read-write  feature             fdmi                    
  13      permit  read-write  feature             fcsp                    
  12      permit  read-write  feature             fcns                    
  11      permit  read-write  feature             span                    
  10      permit  read-write  feature             zone                    
  9       permit  read-write  feature             wwnm                    
  8       permit  read-write  feature             vsan                    
  7       permit  read-write  feature             vsanIfvsan              
  6       permit  read-write  feature             fabric-binding          
  5       permit  read-write  feature             interface               
  4       permit  read-write  feature             trapRegEntry            
  3       permit  read-write  feature             snmpTargetAddrEntry     
  2       permit  read-write  feature             snmpTargetParamsEntry   
  1       permit  read-write  feature             snmp                

10GBase-LRM SFP+ support on Nexus

A quick note to bear in mind is 10GBase-LRM SFP+ is not supported on Nexus 5500 and Nexus 2000.  It only supports on Nexus 7000 in the Nexus family.

For detail compatibility information please check out here:

Monday, December 2, 2013

UCSM 2.1.3a - Login Error: java.io.IOException: Server returned HTTP response code: 400

Recently I have run into an issue in a customer PoC and encountered a weird issue.  Everything looks fine except I cannot login UCSM.  The UCSM code I am running is 2.1.3a, and I have got the error message:

"Login Error: java.io.IOException: Server returned HTTP response code: 400 for URL: http://ucsm_ip:443/nuova"

Eventually I've found out the JRE 7u45 update breaks this, after lowering the version it works fine now.

Maverick - No Java runtime present, requesting install

After upgrading to Maverick (OS X 10.9), when I try to run java –version in terminal, it showed the error "No Java runtime present, requesting install", however nothing happens except showing this error message.  The solution is to download the official java package from apple website:

Sunday, October 13, 2013

Free app today

I have made my app Remote Call Forward and Ring Ring Ring free today!  Download it and give me some feedback!

Wednesday, October 9, 2013

Apps update - Ring Ring Ring 1.2

Another apps that got update is Ring Ring Ring, this is an application that allow you to use your iPhone address book, click to dial using your IP phone.  So it reduces the hassle to sync your iPhone contact list with your UCM personal directory.  You simply use your iPhone contact list as your personal directory.

I haven't made much change to this app, for sure you can give me idea what feature should I add.  Basically I have just optimise it for the 4-inch Retina display.

You can get the entry from your address book by clicking the address book icon on the right.  Then the contact will show up.


Simply click on the phone number, then it will ask your IP phone to make phone calls.


Alternatively you can use the number pad instead of phone book entry to make calls.

App store:

Youtube: