added code for saving config (might not be complete
This commit is contained in:
@@ -6,12 +6,13 @@ REQUIRES_USER = False
|
||||
REQUIRES_PW = True
|
||||
|
||||
# HOST = "localhost"
|
||||
# HOST = "129.13.51.102" # Audimax SMP 351
|
||||
HOST = "129.13.51.102" # Audimax SMP 351
|
||||
# HOST = "129.13.51.106" # Tulla SMP 351
|
||||
HOST = "172.22.246.207" # Test SMP MZ
|
||||
# HOST = "172.22.246.207" # Test SMP MZ
|
||||
|
||||
USER = "admin"
|
||||
PW = "123mzsmp"
|
||||
PW = "audimaxsmp"
|
||||
|
||||
|
||||
class SMP(TelnetAdapter, RecorderAdapter):
|
||||
@@ -144,13 +145,31 @@ class SMP(TelnetAdapter, RecorderAdapter):
|
||||
self.tn.write(self.esc_char + "CV\n")
|
||||
return TelnetAdapter._get_response_str(self.tn.read_until_non_empty_line())
|
||||
|
||||
def save_configuration(self, mode: int = 2):
|
||||
"""
|
||||
def save_configuration(self):
|
||||
pass
|
||||
Mode:
|
||||
0 = IP config
|
||||
2 = Box specific parameters
|
||||
:param mode:
|
||||
:return:
|
||||
"""
|
||||
if mode not in [0, 2]:
|
||||
raise Exception("Only values 0 and 2 are allowed!")
|
||||
self.tn.write(self.esc_char + "1*{}XF\n".format(mode))
|
||||
return TelnetAdapter._get_response_str(self.tn.read_until_non_empty_line())
|
||||
|
||||
def restore_configuration(self):
|
||||
pass
|
||||
def restore_configuration(self, mode: int = 2):
|
||||
"""
|
||||
Mode:
|
||||
0 = IP config
|
||||
2 = Box specific parameters
|
||||
:param mode:
|
||||
:return:
|
||||
"""
|
||||
if mode not in [0, 2]:
|
||||
raise Exception("Only values 0 and 2 are allowed!")
|
||||
self.tn.write(self.esc_char + "0*{}XF\n".format(mode))
|
||||
return TelnetAdapter._get_response_str(self.tn.read_until_non_empty_line())
|
||||
|
||||
def reboot(self):
|
||||
self.tn.write(self.esc_char + "1BOOT\n")
|
||||
@@ -746,7 +765,11 @@ def main():
|
||||
print(smp)
|
||||
smp._login()
|
||||
print(smp.get_version(verbose_info=False))
|
||||
print(smp.get_file_transfer_config())
|
||||
print(smp.save_configuration())
|
||||
print(smp.restore_configuration())
|
||||
|
||||
return
|
||||
print(smp.get_bootstrap_version())
|
||||
print(smp.get_part_number())
|
||||
print(smp.get_model_name())
|
||||
|
||||
Reference in New Issue
Block a user