Skip to content

Commit d5a40cc

Browse files
committed
updates
1 parent 26deee0 commit d5a40cc

File tree

5 files changed

+68
-572
lines changed

5 files changed

+68
-572
lines changed

.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cucm = 10.254.11.204
1+
cucm = 10.52.200.217
22
username = administrator
3-
password = ToyotaTaxi633*
4-
version = 11.5
3+
password = Dev@1998
4+
version = 12.5

ciscoaxl/axl.py

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import sys
1313
from pathlib import Path
1414
import os
15-
15+
import json
1616
from requests import Session
1717
from requests.auth import HTTPBasicAuth
1818
import re
@@ -94,14 +94,42 @@ def get_locations(
9494
except Fault as e:
9595
return e
9696

97+
def run_sql_query(self, query):
98+
result = {'num_rows': 0,
99+
'query': query}
100+
101+
try:
102+
sql_result = self.client.executeSQLQuery(sql=query)
103+
print(sql_result)
104+
except Exception as fault:
105+
sql_result = None
106+
self.last_exception = fault
107+
108+
num_rows = 0
109+
result_rows = []
110+
111+
if sql_result is not None:
112+
if sql_result['return'] is not None:
113+
for row in sql_result['return']['row']:
114+
result_rows.append({})
115+
for column in row:
116+
result_rows[num_rows][column.tag] = column.text
117+
num_rows += 1
118+
119+
result['num_rows'] = num_rows
120+
if num_rows > 0:
121+
result['rows'] = result_rows
122+
123+
return result
124+
97125
def sql_query(self, query):
98126
"""
99127
Execute SQL query
100128
:param query: SQL Query to execute
101129
:return: result dictionary
102130
"""
103131
try:
104-
return self.client.executeSQLQuery(query)["return"]
132+
return self.client.executeSQLQuery(query)['return']
105133
except Fault as e:
106134
return e
107135

@@ -1854,7 +1882,7 @@ def update_cti_route_point(self, **args):
18541882
except Fault as e:
18551883
return e
18561884

1857-
def get_phones(self, tagfilter={
1885+
def get_phones(self, query={"name": "%"}, tagfilter={
18581886
"name": "",
18591887
"product": "",
18601888
"description": "",
@@ -1867,7 +1895,7 @@ def get_phones(self, tagfilter={
18671895
def inner(skip):
18681896
while True:
18691897
res = self.client.listPhone(
1870-
{"name": "%"}, returnedTags=tagfilter, first=1000, skip=skip
1898+
searchCriteria=query, returnedTags=tagfilter, first=1000, skip=skip
18711899
)["return"]
18721900
skip=skip+1000
18731901
if res is not None and 'phone' in res:
@@ -2644,7 +2672,7 @@ def add_called_party_xform(
26442672
description="",
26452673
partition="",
26462674
calledPartyPrefixDigits="",
2647-
calledPartyTransformationmask="",
2675+
calledPartyTransformationMask="",
26482676
digitDiscardInstructionName="",
26492677
):
26502678
"""
@@ -2669,7 +2697,7 @@ def add_called_party_xform(
26692697
"description": description,
26702698
"routePartitionName": partition,
26712699
"calledPartyPrefixDigits": calledPartyPrefixDigits,
2672-
"calledPartyTransformationmask": calledPartyTransformationmask,
2700+
"calledPartyTransformationMask": calledPartyTransformationMask,
26732701
"digitDiscardInstructionName": digitDiscardInstructionName,
26742702
}
26752703
)
@@ -2745,7 +2773,7 @@ def add_calling_party_xform(
27452773
description="",
27462774
partition="",
27472775
callingPartyPrefixDigits="",
2748-
callingPartyTransformationmask="",
2776+
callingPartyTransformationMask="",
27492777
digitDiscardInstructionName="",
27502778
):
27512779
"""
@@ -2770,7 +2798,7 @@ def add_calling_party_xform(
27702798
"description": description,
27712799
"routePartitionName": partition,
27722800
"callingPartyPrefixDigits": callingPartyPrefixDigits,
2773-
"callingPartyTransformationmask": callingPartyTransformationmask,
2801+
"callingPartyTransformationMask": callingPartyTransformationMask,
27742802
"digitDiscardInstructionName": digitDiscardInstructionName,
27752803
}
27762804
)
@@ -2797,7 +2825,7 @@ def update_calling_party_xform(self, **args):
27972825
:param pattern: pattern - required
27982826
:param routePartitionName: partition required
27992827
:param description: Route pattern description
2800-
:param calledPartyTransformationmask:
2828+
:param callingPartyTransformationMask:
28012829
:param dialPlanName:
28022830
:param digitDiscardInstructionName:
28032831
:param routeFilterName:

example.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from ciscoaxl import axl
2+
from lxml import etree
3+
cucm = '10.129.225.201'
4+
username = 'administrator'
5+
password = 'Pr3sid10!'
6+
version = '11.5'
7+
ucm = axl(username=username,password=password,cucm=cucm,cucm_version=version)
8+
9+
# query = {"product": "Cisco Unified Client Services Framework"}
10+
# phones = ucm.get_phones(query=query)
11+
# for phone in phones:
12+
# print(phone.name)
13+
14+
css = ucm.update_calling_search_space(
15+
name="WOB-HQ-CSS",
16+
addMembers=[
17+
{
18+
"member": {
19+
"routePartitionName": "DUBLIN_PT",
20+
"index": "0"
21+
},
22+
"member": {
23+
"routePartitionName": "IPMA-PT",
24+
"index": "1"
25+
}
26+
}
27+
])

0 commit comments

Comments
 (0)