easy-utils-dev 2.162__tar.gz → 2.164__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/PKG-INFO +1 -1
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/ne1830PSS.py +33 -28
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/uiserver.py +61 -15
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev.egg-info/PKG-INFO +1 -1
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/setup.py +1 -1
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/MANIFEST.in +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/EasySsh.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/Events.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/FastQueue.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/NameObject.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/__init__.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/abortable.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/brevosmtp.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/check_license.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/cplib.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/custom_env.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/debugger.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/easy_oracle.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/encryptor.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/ept.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/ept_sql/create_dirs.sql +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/ept_sql/create_ept_tables.sql +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/exceptions.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/filescompressor.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/generate_license.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/keycloakapi.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/lralib.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/nsp_kafka.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/openid_server.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/optics_utils.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/require_auth.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/simple_sqlite.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/temp_memory.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/utils.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/winserviceapi.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/wsnoclib.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev/wsselib.py +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev.egg-info/SOURCES.txt +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev.egg-info/dependency_links.txt +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev.egg-info/requires.txt +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/easy_utils_dev.egg-info/top_level.txt +0 -0
- {easy_utils_dev-2.162 → easy_utils_dev-2.164}/setup.cfg +0 -0
|
@@ -9,7 +9,7 @@ from easy_utils_dev.debugger import DEBUGGER
|
|
|
9
9
|
from easy_utils_dev.encryptor import initCryptor
|
|
10
10
|
from easy_utils_dev.utils import pingAddress , lget , getTimestamp
|
|
11
11
|
from easy_utils_dev import exceptions
|
|
12
|
-
|
|
12
|
+
from typing import Optional
|
|
13
13
|
|
|
14
14
|
class PSS1830 :
|
|
15
15
|
def __init__(self ,
|
|
@@ -19,7 +19,7 @@ class PSS1830 :
|
|
|
19
19
|
file_name=None,
|
|
20
20
|
debug_home_path=None,
|
|
21
21
|
trust_env_log_path=True,
|
|
22
|
-
debugger_kwargs={}
|
|
22
|
+
debugger_kwargs: Optional[DEBUGGER] = {}
|
|
23
23
|
) -> None:
|
|
24
24
|
self.port = None
|
|
25
25
|
self.trust_env_log_path = trust_env_log_path
|
|
@@ -215,7 +215,7 @@ class PSS1830 :
|
|
|
215
215
|
if ("authentication failed") in str(new_data).lower() :
|
|
216
216
|
raise exceptions.CliAuthenticationFailure(str(new_data))
|
|
217
217
|
if not isPasswordOk :
|
|
218
|
-
raise exceptions.CliAuthenticationFailure(f"
|
|
218
|
+
raise exceptions.CliAuthenticationFailure(f"Invalid expected password Prompt")
|
|
219
219
|
if self.resetRequired:
|
|
220
220
|
self.newUserPwdReset()
|
|
221
221
|
sleep(1)
|
|
@@ -337,6 +337,7 @@ class PSS1830 :
|
|
|
337
337
|
return result
|
|
338
338
|
|
|
339
339
|
def newUserPwdReset(self):
|
|
340
|
+
self.logger.info(f"Changing Password from tmp password {self.tmpPassword} to user password ..." , source=self.neip)
|
|
340
341
|
self.logger.debug(f'Changing Password for the Newely Created User')
|
|
341
342
|
for i in range(30) :
|
|
342
343
|
self.logger.debug(f"Try {i}/30 to change the password on login ..")
|
|
@@ -507,6 +508,7 @@ class PSS1830 :
|
|
|
507
508
|
local_addr = ( current_ec_ip , 5122 ) # dummy source addre ss
|
|
508
509
|
channel = jump_transport.open_channel('direct-tcpip', dest_addr, local_addr)
|
|
509
510
|
client = self.createClient()
|
|
511
|
+
self.logger.debug(f"Trying to connect to remote controller root@{self.neip}::{remote_ec_ip}:5122:pw:{self.rootPw}")
|
|
510
512
|
client.connect( self.neip , 5122 , "root" , self.rootPw , sock=channel )
|
|
511
513
|
self.client = client
|
|
512
514
|
self.logger.debug(f"switching to standby EC {remote_ec_ip} completed")
|
|
@@ -592,6 +594,7 @@ class PSS1830 :
|
|
|
592
594
|
self.logger.censor.add_censored_string(str(rootpw))
|
|
593
595
|
self.logger.censor.add_censored_string(str(neip))
|
|
594
596
|
self.logger.censor.add_censored_string(str(pw))
|
|
597
|
+
|
|
595
598
|
self.logger.debug(f'Opening SSH connection to NE {mode}::{neip} -resetRequired={resetRequired}')
|
|
596
599
|
self.cliUser = user
|
|
597
600
|
self.mode = mode
|
|
@@ -1006,33 +1009,36 @@ class PSS1830 :
|
|
|
1006
1009
|
xcs = self.cli_execute('show xc *')
|
|
1007
1010
|
xcs = xcs.splitlines()
|
|
1008
1011
|
xcsList = []
|
|
1009
|
-
for
|
|
1010
|
-
|
|
1012
|
+
for line in xcs.splitlines():
|
|
1013
|
+
line = line.rstrip()
|
|
1014
|
+
# Skip ONLY clear header/separator lines
|
|
1015
|
+
if not line.strip():
|
|
1011
1016
|
continue
|
|
1012
|
-
|
|
1013
|
-
details = [ i for i in details if i != "" ]
|
|
1014
|
-
if len(details) == 0 :
|
|
1017
|
+
if line.strip().startswith("A-End"):
|
|
1015
1018
|
continue
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
channel = details[2]
|
|
1020
|
-
connectionId = details[3]
|
|
1021
|
-
label = details[4]
|
|
1022
|
-
width = details[5]
|
|
1023
|
-
type = details[6]
|
|
1024
|
-
adminState = details[7]
|
|
1025
|
-
oper = details[8]
|
|
1026
|
-
dir = details[9]
|
|
1027
|
-
except :
|
|
1019
|
+
if line.strip().startswith("---"):
|
|
1020
|
+
continue
|
|
1021
|
+
if "entries" in line:
|
|
1028
1022
|
continue
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1023
|
+
# Split by 2+ spaces
|
|
1024
|
+
details = re.split(r"\s{2,}", line.strip())
|
|
1025
|
+
if len(details) < 10:
|
|
1026
|
+
print("SKIPPED:", details)
|
|
1027
|
+
continue
|
|
1028
|
+
aEnd, zEnd, channel, connectionId, label, width, type_, adminState, oper, direction = details[:10]
|
|
1029
|
+
xcsList.append({
|
|
1030
|
+
"aEnd": aEnd,
|
|
1031
|
+
"zEnd": zEnd,
|
|
1032
|
+
"channel": channel,
|
|
1033
|
+
"id": connectionId,
|
|
1034
|
+
"label": label,
|
|
1035
|
+
"width": width,
|
|
1036
|
+
"type": type_,
|
|
1037
|
+
"admin": adminState,
|
|
1038
|
+
"operation": oper,
|
|
1039
|
+
"dir": direction,
|
|
1040
|
+
})
|
|
1041
|
+
|
|
1036
1042
|
def showShelf(self , shelfId=1) :
|
|
1037
1043
|
self.logger.debug(f'show shelf for shelfId={shelfId}')
|
|
1038
1044
|
cli= f'show shelf {shelfId}'
|
|
@@ -1094,7 +1100,6 @@ class PSS1830 :
|
|
|
1094
1100
|
})
|
|
1095
1101
|
return result
|
|
1096
1102
|
|
|
1097
|
-
|
|
1098
1103
|
def get_cards(self) :
|
|
1099
1104
|
cards = self.cli_execute('show card inven *')
|
|
1100
1105
|
raw_return = cards
|
|
@@ -19,11 +19,15 @@ from multiprocessing import Process
|
|
|
19
19
|
import traceback
|
|
20
20
|
from werkzeug.serving import make_ssl_devcert
|
|
21
21
|
from time import sleep
|
|
22
|
-
from easy_utils_dev.utils import start_thread , getRandomKeysAndStr , mkdirs
|
|
22
|
+
from easy_utils_dev.utils import start_thread , getRandomKeysAndStr , mkdirs , lget
|
|
23
23
|
from easy_utils_dev.temp_memory import TemporaryMemory
|
|
24
24
|
from easy_utils_dev.debugger import DEBUGGER
|
|
25
25
|
import signal
|
|
26
|
-
import sys
|
|
26
|
+
import sys
|
|
27
|
+
from tempfile import gettempdir
|
|
28
|
+
from urllib.parse import parse_qs
|
|
29
|
+
|
|
30
|
+
TMP_PATH = gettempdir()
|
|
27
31
|
|
|
28
32
|
def getClassById( id ) :
|
|
29
33
|
return cenv[id]
|
|
@@ -51,6 +55,33 @@ def clone_request(request):
|
|
|
51
55
|
"cookies": request.cookies,
|
|
52
56
|
}
|
|
53
57
|
|
|
58
|
+
class Stream :
|
|
59
|
+
def __init__(self) :
|
|
60
|
+
self.rows = []
|
|
61
|
+
|
|
62
|
+
def register_row(self , row , options={}) :
|
|
63
|
+
_row_stream_id = getRandomKeysAndStr(n=20)
|
|
64
|
+
row['_row_stream_id'] = _row_stream_id
|
|
65
|
+
for key , value in options.items() :
|
|
66
|
+
if not key.startswith('_') :
|
|
67
|
+
raise ValueError(f"Option key '{key}' must start with '_'")
|
|
68
|
+
row[key] = value
|
|
69
|
+
return row
|
|
70
|
+
|
|
71
|
+
def send_cell_update(self , row , cell , value , sid=None ) :
|
|
72
|
+
_row_stream_id = row['_row_stream_id']
|
|
73
|
+
self.socketio.emit(f'/stream/{_row_stream_id}/{cell}' , value , to=sid)
|
|
74
|
+
|
|
75
|
+
def send_new_row(self , tid , row , sid=None , insert_ontop=False ) :
|
|
76
|
+
if not row.get('_row_stream_id') :
|
|
77
|
+
row = self.register_table_row_stream(row)
|
|
78
|
+
self.socketio.emit(f'/stream/table/{tid}/row' , {
|
|
79
|
+
'row' : row,
|
|
80
|
+
'options' : {
|
|
81
|
+
'insert_ontop' : insert_ontop
|
|
82
|
+
}
|
|
83
|
+
} , to=sid )
|
|
84
|
+
|
|
54
85
|
class Response :
|
|
55
86
|
def __init__(self) :
|
|
56
87
|
self.success = self.ok
|
|
@@ -118,7 +149,9 @@ class SocketClientObject :
|
|
|
118
149
|
self.client : SocketIO
|
|
119
150
|
self.internalid : str = None
|
|
120
151
|
self.request = {}
|
|
152
|
+
self.sid = None
|
|
121
153
|
self.rooms = None
|
|
154
|
+
self.csid = None
|
|
122
155
|
|
|
123
156
|
class UISERVER :
|
|
124
157
|
def __init__(self ,
|
|
@@ -154,6 +187,7 @@ class UISERVER :
|
|
|
154
187
|
self.abort_base_url = '/request/abort'
|
|
155
188
|
self.return_exception_as_code_400 = True
|
|
156
189
|
self.request_reply_base_url= '/request/result'
|
|
190
|
+
self.sessions = {}
|
|
157
191
|
if https :
|
|
158
192
|
self.httpProtocol = 'https'
|
|
159
193
|
else :
|
|
@@ -167,9 +201,13 @@ class UISERVER :
|
|
|
167
201
|
self.socketio_rooms = {}
|
|
168
202
|
self.log_url_requests = True
|
|
169
203
|
self.logger = logger
|
|
204
|
+
self.stream = Stream()
|
|
170
205
|
self.simulate_network_delay = False
|
|
171
|
-
|
|
172
|
-
|
|
206
|
+
if not self.logger :
|
|
207
|
+
self.logger = DEBUGGER(
|
|
208
|
+
name='easy_utils_dev_uiserver',
|
|
209
|
+
homePath=TMP_PATH
|
|
210
|
+
)
|
|
173
211
|
def update_cert(self , crt, ssl ) :
|
|
174
212
|
self.ssl_crt=crt
|
|
175
213
|
self.ssl_key=ssl
|
|
@@ -290,9 +328,14 @@ class UISERVER :
|
|
|
290
328
|
abort.delete_async_request_ts = getTimestamp(after_seconds=3600)
|
|
291
329
|
|
|
292
330
|
|
|
331
|
+
request.sid = ''
|
|
293
332
|
abortable = request.headers.get('abortable')
|
|
294
333
|
requestId = getRandomKeysAndStr(n=10)
|
|
295
334
|
request.start_ts = getTimestamp()
|
|
335
|
+
client : SocketClientObject = self.sessions.get(request.headers.get('csid'))
|
|
336
|
+
request.sid = client.sid
|
|
337
|
+
request.client = client
|
|
338
|
+
request.csid = request.headers.get('csid')
|
|
296
339
|
request.internalid = requestId
|
|
297
340
|
if abortable :
|
|
298
341
|
abort = self.register_abortable_request(request)
|
|
@@ -356,12 +399,12 @@ class UISERVER :
|
|
|
356
399
|
|
|
357
400
|
if self.simulate_network_delay :
|
|
358
401
|
time.sleep(self.simulate_network_delay)
|
|
402
|
+
now = getTimestamp()
|
|
403
|
+
x = round(now - request.start_ts, 2)
|
|
359
404
|
try :
|
|
360
|
-
now = getTimestamp()
|
|
361
405
|
response.headers['internalid'] = request.internalid
|
|
362
406
|
response.headers['start_ts'] = request.start_ts
|
|
363
407
|
response.headers['end_ts'] = now
|
|
364
|
-
x = round(now - request.start_ts, 2)
|
|
365
408
|
response.headers['execution'] = x
|
|
366
409
|
if request.abortable :
|
|
367
410
|
response.headers['abortid'] = request.abort_id
|
|
@@ -372,6 +415,7 @@ class UISERVER :
|
|
|
372
415
|
self.logger.info(f'[{request.method}]: {request.url} - [{response.status_code}] [secs:{x}]' , source='WebServer')
|
|
373
416
|
return response
|
|
374
417
|
|
|
418
|
+
|
|
375
419
|
# socketio client connected.
|
|
376
420
|
@self.socketio.on('connect')
|
|
377
421
|
def handle_client_connect():
|
|
@@ -380,6 +424,9 @@ class UISERVER :
|
|
|
380
424
|
client.internalid = getRandomKeysAndStr(n=20)
|
|
381
425
|
client.sid = sid
|
|
382
426
|
client.request = request
|
|
427
|
+
query = parse_qs(request.query_string.decode('utf-8'))
|
|
428
|
+
csid = lget(query.get('csid') , 0 , None )
|
|
429
|
+
client.csid = csid
|
|
383
430
|
client.rooms = self.socketio_rooms
|
|
384
431
|
self.socketio_clients.append(client)
|
|
385
432
|
self.socketio.emit('/internal/connect', {
|
|
@@ -390,7 +437,9 @@ class UISERVER :
|
|
|
390
437
|
},
|
|
391
438
|
to=sid
|
|
392
439
|
)
|
|
393
|
-
|
|
440
|
+
if csid :
|
|
441
|
+
self.sessions[csid] = client
|
|
442
|
+
print(f'client connected : csid={csid} | SID={sid} | Clients : {len(self.socketio_clients)}')
|
|
394
443
|
|
|
395
444
|
# socketio client connected.
|
|
396
445
|
@self.socketio.on('disconnect')
|
|
@@ -398,22 +447,19 @@ class UISERVER :
|
|
|
398
447
|
for i , c in enumerate(list(self.socketio_clients)) :
|
|
399
448
|
print(f'c.sid : {c.sid} | request.sid : {request.sid}')
|
|
400
449
|
if c.sid == request.sid :
|
|
401
|
-
|
|
402
|
-
|
|
450
|
+
try :
|
|
451
|
+
del self.socketio_clients[i]
|
|
452
|
+
except :
|
|
453
|
+
pass
|
|
454
|
+
print(f'client disconnected : csid={c.csid} | SID={request.sid} | Clients : {len(self.socketio_clients)}')
|
|
403
455
|
break
|
|
404
456
|
|
|
405
|
-
def getInstance(self) :
|
|
406
|
-
return self.getFlask() , self.getSocketio() , self.getWsgi()
|
|
407
|
-
|
|
408
457
|
def getSocketio( self ):
|
|
409
458
|
return self.socketio
|
|
410
459
|
|
|
411
460
|
def getFlask( self ):
|
|
412
461
|
return self.app
|
|
413
462
|
|
|
414
|
-
def getWsgi(self) :
|
|
415
|
-
return self.wsgi_server
|
|
416
|
-
|
|
417
463
|
def shutdownUi(self) :
|
|
418
464
|
if hasattr(self, 'wsgi_server') and self.wsgi_server:
|
|
419
465
|
try:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|