easy-utils-dev 2.125__py3-none-any.whl → 2.127__py3-none-any.whl

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.

Potentially problematic release.


This version of easy-utils-dev might be problematic. Click here for more details.

@@ -116,7 +116,7 @@ class DEBUGGER:
116
116
  self.logger.error(f'EASY_UTILS_DEBUG_LEVEL ENV must be one of [info,debug,warning,error,critical] | Current Env Variable Is "{EASY_UTILS_DEBUG_LEVEL}". Skipping ')
117
117
  else :
118
118
  self.set_level(EASY_UTILS_DEBUG_LEVEL)
119
- if os.environ.get("EASY_UTILS_ENABLE_PRINT" , False ).lower() == 'true' :
119
+ if os.environ.get("EASY_UTILS_ENABLE_PRINT" , '' ).lower() == 'true' :
120
120
  self.enable_print()
121
121
 
122
122
  def switch_full_syntax(self , toggle) :
@@ -243,7 +243,7 @@ class DEBUGGER:
243
243
  else :
244
244
  self.set_level(EASY_UTILS_DEBUG_LEVEL)
245
245
  self.updateGlobalHomePath()
246
- if os.environ.get("EASY_UTILS_ENABLE_PRINT" , False ).lower() == 'true' :
246
+ if os.environ.get("EASY_UTILS_ENABLE_PRINT" , '' ).lower() == 'true' :
247
247
  self.enable_print()
248
248
  sleep(5)
249
249
 
@@ -13,7 +13,7 @@ from easy_utils_dev import exceptions
13
13
 
14
14
  class PSS1830 :
15
15
  def __init__(self , sim=False , debug_name='Auto1830PSS' , auto_enable_tcp_forward=False,file_name=None,debug_home_path=None ) -> None:
16
- self.port = 22
16
+ self.port = None
17
17
  self.logger = DEBUGGER(debug_name,file_name=file_name, homePath=debug_home_path)
18
18
  self.connected = False
19
19
  self.channel = None
@@ -45,8 +45,8 @@ class PSS1830 :
45
45
  self.tcpForwardStatus=None
46
46
  self.resetRequired = False
47
47
  self.screenBuffer = ""
48
- self.main_controller_client = None
49
- self.standby_controller_client = None
48
+ self.main_controller_client : paramiko.SSHClient = None
49
+ self.standby_controller_client : paramiko.SSHClient = None
50
50
  self.create_jumphost = self.nfmtJumpServer
51
51
  if self.auto_enable_tcp_forward :
52
52
  self.logger.info(f'***WARNING*** : Auto enable tcp forwarding is enabled. This will allow tcp fowarding in target machine then restarting sshd service agent.')
@@ -62,14 +62,14 @@ class PSS1830 :
62
62
  if level == 'debug' :
63
63
  self._change_paramiko_debug
64
64
 
65
- def nfmtJumpServer(self, ip , usr , pw ) :
65
+ def nfmtJumpServer(self, ip , usr , pw , port=22 ) :
66
66
  self.logger.info(f"""ssh to jump-host -> address={ip}""")
67
67
  # print(f"this function will be deperecated soon. use create_jumphost() instead.")
68
68
  try :
69
69
  self.jumpServerInSameInstance = True
70
70
  self.jumpserver = self.createClient()
71
71
  self.logger.info(f'connecting to jump-host with {usr}@{ip} port=[{self.port}] ..')
72
- self.jumpserver.connect(ip , self.port , usr , pw )
72
+ self.jumpserver.connect(ip , port , usr , pw )
73
73
  self.isjumpserver = True
74
74
  self.nfmtip = ip
75
75
  self.nfmtsshuser = usr
@@ -83,7 +83,7 @@ class PSS1830 :
83
83
  self.jumpserver.close()
84
84
  self.logger.debug(f"""re-establish the connection after modifying the sshd file and restarting the sshd service ..""")
85
85
  self.jumpserver = self.createClient()
86
- self.jumpserver.connect(ip , self.port , usr , pw , banner_timeout=200 , timeout=200, auth_timeout=200)
86
+ self.jumpserver.connect(ip , port , usr , pw , banner_timeout=200 , timeout=200, auth_timeout=200)
87
87
  self.logger.info(f"""connecting to jump-host [{ip}] - connected""")
88
88
  self.connected = True
89
89
  self.jumpserver.nfmtip = ip
@@ -467,10 +467,13 @@ class PSS1830 :
467
467
 
468
468
  def switch_to_standby_ec(self) :
469
469
  if self.connect_to_standby_ec :
470
- self.logger.debug(f"connecting to standby EC {self.neip} ...")
471
- response = self.ssh_execute(ssh=self.client , command=f"ifconfig ilan | awk '/inet / {{print $2}}'")
472
- if not response :
473
- raise exceptions.InvalidRemoteEcIp(f"couldn't connect to remote EC")
470
+ self.logger.info(f"connecting to standby EC {self.neip} ...")
471
+ if not self.sim :
472
+ response = self.ssh_execute(ssh=self.client , command=f"ifconfig ilan | awk '/inet / {{print $2}}'")
473
+ if not response :
474
+ raise exceptions.InvalidRemoteEcIp(f"couldn't connect to remote EC")
475
+ if self.sim :
476
+ response = "100.0.81.1"
474
477
  if response :
475
478
  current_ec_ip = response.replace('\n' , '')
476
479
  switcher = {
@@ -653,22 +656,6 @@ class PSS1830 :
653
656
  def switch_to_cli_shell(self) :
654
657
  return self.client.invoke_shell()
655
658
 
656
-
657
- def isRequireAknowledge(self , newRelease) :
658
- if '-' in str(newRelease) :
659
- newRelease = float(newRelease.split('-')[0])
660
- if int(newRelease) in range( 0 , 15 ) :
661
- return True
662
- elif int(newRelease) >= 23 :
663
- return False
664
- else :
665
- return True
666
-
667
- def getTime(self) :
668
- now = datetime.now()
669
- dt_string = now.strftime("%d-%m-%Y_%H-%M-%S")
670
- return dt_string
671
-
672
659
  def get_neversion(self,supress_error=False,cache=True) :
673
660
  """
674
661
  retreive the NE version depending on connection mode
@@ -714,7 +701,6 @@ class PSS1830 :
714
701
  self.close_cliconnection()
715
702
  except :
716
703
  pass
717
-
718
704
  try :
719
705
  self.client.close()
720
706
  except :
@@ -735,13 +721,12 @@ class PSS1830 :
735
721
  cli = f'paging status disable'
736
722
  self.cli_execute(cli)
737
723
  self.logger.debug('paging disabled.')
738
-
739
724
 
740
725
  def channels_report(self, exportCsv=False) :
741
726
  self.logger.info('Generating Channels Report .. ')
742
727
  channels = self.get_xcs()
743
728
  header = ['NE', 'shelf', 'slot', 'port' , 'powerRx' , "powerTx" , "channel" , "prefec" ,"postFec" , "shape" , "phase" , "trackMode"]
744
- csvFpath = f"channels_report_{self.host}_{self.getTime()}.csv"
729
+ csvFpath = f"channels_report_{self.host}_{getTimestamp()}.csv"
745
730
  if exportCsv :
746
731
  csvFile = open(csvFpath, 'w', encoding='UTF8' , newline='')
747
732
  csvFile = csv.writer(csvFile)
@@ -834,7 +819,7 @@ class PSS1830 :
834
819
  except :
835
820
  return ''
836
821
 
837
- def config_database(self , ip , user, password , protocol , path , backupname="BACKUP") :
822
+ def config_backup_db_server(self , ip , user, password , protocol , path , backupname="BACKUP") :
838
823
  self.cli_execute(f'config database server ip {ip}')
839
824
  self.cli_execute(f'config database server protocol {protocol}')
840
825
  self.cli_execute(f'config database path {path}{backupname}')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easy-utils-dev
3
- Version: 2.125
3
+ Version: 2.127
4
4
  Keywords: python3
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  License-File: license.dat
@@ -8,7 +8,7 @@ easy_utils_dev/brevosmtp.py,sha256=A5n13MnVQnDuSjYQ91-MLftmqfg3VQ-36Zqw9OtoTB4,3
8
8
  easy_utils_dev/check_license.py,sha256=C8vKXwaduoF3FSuDJ-J_j5jStNNyUdS-mOdLNfsCjmc,4825
9
9
  easy_utils_dev/cplib.py,sha256=TPCFNQh4jYSGsm_CrMdivmD3G5B1rprco2O4B0BSnzo,19570
10
10
  easy_utils_dev/custom_env.py,sha256=vxrjikpSNJlKfoBE-ef88UExlpXucUe-HcwHMn3gfB0,1510
11
- easy_utils_dev/debugger.py,sha256=3ENr91vsWoHKFSa2YR9P-H7GJhgZKAfOr4NQFKp0Shg,18311
11
+ easy_utils_dev/debugger.py,sha256=08lYSg9Mx0l440aCk4Z1ofNUlN9pTL9um2CL_cCyUKs,18305
12
12
  easy_utils_dev/easy_oracle.py,sha256=Jyc3HSl6eyLayjS8NoE4GOaf8otQlonR5_qOg2h1DjE,2157
13
13
  easy_utils_dev/encryptor.py,sha256=f5Zjn0DGtXCyhldpVnBtfcTb4h4Wp0eQPHusEYwIags,1512
14
14
  easy_utils_dev/exceptions.py,sha256=6eTYBa8AIXC0wI6zgkqsLreSXyPf459G-ToO7ziQuK4,1669
@@ -16,7 +16,7 @@ easy_utils_dev/filescompressor.py,sha256=iKAtLfkEXOuvvqF56jH0D9KAAeZ7iaa_sRaJnyY
16
16
  easy_utils_dev/generate_license.py,sha256=fr_eoSjKCmDmAEBc6FWFXZxGQOHx9XO6hEK8dcyVUlA,3319
17
17
  easy_utils_dev/keycloakapi.py,sha256=eHnc5fSC-YVYQU6EFs3ehutITnkHNJktx5BH_hpfxwM,7116
18
18
  easy_utils_dev/lralib.py,sha256=3IjaZbTK_hhyETNP7eALsFyQjWM-jb2rg-rjvgdDDIc,6328
19
- easy_utils_dev/ne1830PSS.py,sha256=WWfSMQLrQgjShIebwjhxovuRq30OsoH5zQkWJZcIjjo,70103
19
+ easy_utils_dev/ne1830PSS.py,sha256=tfQGEllBWynwDdsy6Fa7nbazPkV4aNXE6HHkN122RBw,69781
20
20
  easy_utils_dev/nsp_kafka.py,sha256=oPJUk8GYMLjqXP_H0EbXQwLkpBxf_uGr6l2QtZO1cc8,10725
21
21
  easy_utils_dev/openid_server.py,sha256=_odeg6omuizSUEJLtbAVn2PnG9vkcUAQ7rU3K5yXk_I,2545
22
22
  easy_utils_dev/optics_utils.py,sha256=G-hFX2iiUCSJjk7BICBRGvVoDq0IBONLZSjagoB5FMg,964
@@ -28,8 +28,8 @@ easy_utils_dev/utils.py,sha256=BmVnbxc336c6WTeDFcEHN6Mavt7fJrIEyK4GXODV3gI,13345
28
28
  easy_utils_dev/winserviceapi.py,sha256=2ZP6jaSt1-5vEJYXqwBhwX-1-eQ3V3YzntsoOoko2cw,18804
29
29
  easy_utils_dev/wsnoclib.py,sha256=tC-RmjddaLpihPCRBLGC2RnRpFJqexhvExUr1KncoQM,29063
30
30
  easy_utils_dev/wsselib.py,sha256=YweScnoAAH_t29EeIjBpkQ6HtX0Rp9mQudRsRce2SE8,7920
31
- easy_utils_dev-2.125.dist-info/METADATA,sha256=NOtO0hyknj91mVqerN1MGks8mjQWI2Evry-Qi2vSDIw,537
32
- easy_utils_dev-2.125.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
33
- easy_utils_dev-2.125.dist-info/license.dat,sha256=hTRbLnrYZdH7UOsZRYC3IntAhyUkUUXi4TuizI7gca4,74
34
- easy_utils_dev-2.125.dist-info/top_level.txt,sha256=7vBsrpq7NmilkdU3YUvfd5iVDNBaT07u_-ut4F7zc7A,15
35
- easy_utils_dev-2.125.dist-info/RECORD,,
31
+ easy_utils_dev-2.127.dist-info/METADATA,sha256=mj50JAg4vNXX0VT7PUfqCCRGazWLiP-PbKhBLgnP1R4,537
32
+ easy_utils_dev-2.127.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
33
+ easy_utils_dev-2.127.dist-info/license.dat,sha256=hTRbLnrYZdH7UOsZRYC3IntAhyUkUUXi4TuizI7gca4,74
34
+ easy_utils_dev-2.127.dist-info/top_level.txt,sha256=7vBsrpq7NmilkdU3YUvfd5iVDNBaT07u_-ut4F7zc7A,15
35
+ easy_utils_dev-2.127.dist-info/RECORD,,