-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathent.py
104 lines (67 loc) · 2.78 KB
/
ent.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import json
def get_users_info():
with open('users.json') as users_data: #open users JSON file
udata = json.load(users_data)
for u in (udata['resources']):
uid= u['data']['username']
print ('User ID:',uid)
try:
print ('Entitlement Profile:', u['data']['ps']['entitlement_profile'])
global _EP
_EP=str(u['data']['ps']['entitlement_profile'])
global _EPlist
global _EPname
global _EPhierarchy
_EPlist=_EP.split(",")
_EPname= _EPlist[0]
_EPhierarchy=_EPlist[1]
#get_entitlment_features(_EPname)
get_subs_features(uid)
except KeyError:
print('-- No Entitlement Profile associated in the CUCDM --')
def get_subs_features(userid):
with open('subs.json') as subs_data:
data = json.load(subs_data)
nfn = 'new.json'
for r in (data['resources']):
_uid= str(r['data']['userid'])
_uname=str(userid)
#global imp
#global emcc
#global mobility
#global snr
#global _vm
if _uid==_uname:
imp = str(r['data']['imAndPresenceEnable'])
mobility = r['data']['enableMobility']
emcc = r['data']['enableEmcc']
_vm = r['data']['CUCUser'][0]['IsSetForVmEnrollment']
print('imp:',imp,'mobility:',mobility,'emcc:',emcc,'VM:',_vm)
subs_data.close()
def get_entitlment_features(ep):
with open('ent.json') as entitl: #open JSON file of Entitlement Prifile list configured in CUCDM
ent = json.load(entitl)
print (ep)
#print('')
#print ('----Entitlement list in CUCDM-----')
for e in (ent['resources']):
ename= e['data']['name']
global eprofile
global _extension_m
global _presence
global _voicemil
global _num_devices
global _voice
global _snr
if ename in ep:
_extension_m= e['data']['extension_mobility']
_presence= e['data']['presence']
_voicemil = e['data']['voicemail']
_num_devices = e['data']['num_devices']
_voice = e['data']['voice']
_snr = e['data']['snr']
eprofile = {'extension_mobility':e['data']['extension_mobility'],'presence': e['data']['presence'],'voicemail': e['data']['voicemail'],'num_devices': e['data']['num_devices'],'voice':e['data']['voice'],'snr':e['data']['snr'] }
print (eprofile)
#print ename
#print 'Features:-',eprofile
get_users_info()