-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCUCMOperator.py
70 lines (59 loc) · 2.14 KB
/
CUCMOperator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- coding: utf-8 -*-
__author__ = "Alfonso Sandoval"
__version__ = "1.0.1"
__maintainer__ = "Alfonso Sandoval"
__status__ = "Production"
"""UCM Partition Insertion -> CUCMOperator Class
Holder class for the different AXL operations for updating the desired CSS
"""
from CUCMConnectorAXL import *
class CUCMOperator:
def __init__(self,CUCM_IP,AXL_Username,AXL_Password,debug = False):
AXL_HANDLER = CUCMConnectorAXL.connector(CUCM_IP,AXL_Username,AXL_Password,debug=debug)
self._AXL_OPERATOR = AXL_HANDLER[0]
"""
Retrieves the current Route Partitions within a Calling Search Space
Args:
CSS_NAME -> string: Name of the desired CSS
Raises:
Exception
Returns:
Dict with the partitions within the specified CSS
False, if Exception is raised
"""
def get_css_partitions(self,CSS_NAME):
pt_dic_filtered = {}
try:
response = self._AXL_OPERATOR.getCss(
name = CSS_NAME
)
for record in response['return']['css']['members']['member']:
pt_dic_filtered[record['routePartitionName']['_value_1']] = record['index']
except Exception as ex:
print(f'🔥🔥🔥 ERROR: {str(ex)}')
pt_dic_filtered = False
finally:
return pt_dic_filtered
"""
Updates all the Route Partitions of a Calling Search Space
Args:
CSS_NAME -> string: Name of the desired CSS
PT_LIST -> Dict: Dictionary with the partitions to be updated
Raises:
Exception
Returns:
True, if operation is completed successfully
False, if Exception is raised
"""
def update_css_partitions(self,CSS_NAME,PT_LIST):
result = True
try:
self._AXL_OPERATOR.updateCss(
name = CSS_NAME,
members = {"member" : PT_LIST}
)
except Exception as ex:
print(f'🔥🔥🔥 ERROR: {str(ex)}')
result = False
finally:
return result