cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2651
Views
5
Helpful
1
Replies

Python CUCM 10.5 AXL updateLine

glen.cobby
Level 1
Level 1

Hi All,

I am using Python with suds-jerko. I can add a new DN ok, however I need to add an Enterprise Alternate number, looking at the element for update line, I can see I either need the uuid of the line or use pattern and route partition. I have tried both, and I either get Type not found: 'uuid' or Type not found 'pattern'.

Here is the code I am sending for the UUID -

result = cucm_server.service.updateLine({'UUID':addedlinepkid,

                                           'enterpriseAltNum' : [{'numMask':shortdial,'addLocalRoutePartition':'t','routePartition':routepartitionpkid}]

                                           })

I have also tried

result = cucm_server.service.updateLine({'pattern':e164dn,'routePartitionName':routepartitionname,

                                           'enterpriseAltNum' : [{'numMask':shortdial,'addLocalRoutePartition':'t','routePartition':routepartitionpkid}]

                                           })

Has anyone get a working example of a line update using Python? Or can see anything wrong with my code above?

Thanks

Glen

1 Reply 1

dstaudt
Cisco Employee
Cisco Employee

This took entirely too long for a "helper" library   This is what I came up with:

ean = {

    "numMask": "8XXXX",

    "isUrgent": True,

    "addLocalRoutePartition": True,

    "routePartition": "testPartition"

}

result = client.service.updateLine(

    pattern = "5555",

    routePartitionName = "",

    description = "test description",

    useEnterpriseAltNum = True,

    enterpriseAltNum = ean

)

Full running script below:

# Installing a root/CA Certificate

# (Tested on Ubuntu 16.10)

# Retrieve certificate from CUCM

#    - openssl s_client -showcerts -connect cucm-node.example.com:443 </dev/null 2>/dev/null|openssl x509 >cucm-node.example.com.crt

# Store certificate on the client

#    - Create a directory for extra CA certificates in /usr/share/ca-certificates:

#        sudo mkdir /usr/share/ca-certificates/extra

#    - Copy the CA .crt file to this directory:

#        sudo cp foo.crt /usr/share/ca-certificates/extra/foo.crt

#    - Append the certificate path (relative to /usr/share/ca-certificates) to /etc/ca-certificates.conf

#        sudo dpkg-reconfigure ca-certificates

# In case of a .pem file, it must first be converted to a .crt file:

#    openssl x509 -in foo.pem -inform PEM -out foo.crt

from suds.client import Client

# import logging

# logging.basicConfig(level=logging.INFO)

# logging.getLogger("suds.transport").setLevel(logging.DEBUG)

client = Client("file:///home/dstaudt/Documents/AXL/v10.5(1)/axlsqltoolkit/schema/10.5/AXLAPI.wsdl",

    location="https://ds-ucm105.cisco.com/axl/",

    username="Administrator",

    password="ciscopsdt")

newLine = {

        "pattern" : "5555",

        "routePartitionName": ""

}

result = client.service.addLine(newLine)

ean = {

    "numMask": "8XXXX",

    "isUrgent": True,

    "addLocalRoutePartition": True,

    "routePartition": "testPartition"

}

result = client.service.updateLine(

    pattern = "5555",

    routePartitionName = "",

    description = "test description",

    useEnterpriseAltNum = True,

    enterpriseAltNum = ean

)

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: