diff --git a/pnp/images.toml b/pnp/images.toml index 9979a33342dd8f675878b3dc0bdd3ab3cb0bea5b..3bc032f91e29ae270888ac6d0823e497f626a8a8 100644 --- a/pnp/images.toml +++ b/pnp/images.toml @@ -2,7 +2,7 @@ version = "15.2(7)E7" md5 = "1e6f508499c36434f7035b83a4018390" size = 16499712 -models = ["C1000-8T-2G-L", "C1000-24P-4G-L", "C1000-24T-4G-L", "C1000-24T-4X-L", "C1000-48P-4G-L", "C1000-48T-4X-L"] +models = ["C1000-8T-2G-L", "C1000-24P-4G-L", "C1000-24T-4G-L", "C1000-24T-4X-L", "C1000-48P-4G-L", "C1000-48T-4X-L", "C1000-48P-4X-L"] ["c1100-universalk9.16.12.01a.SPA.bin"] version = "16.12.1a" @@ -50,4 +50,11 @@ models = ["ASR1002-X"] version = "17.6.4" md5 = "ba879a944ecc61236a994a24420d5382" size = 726791342 -models = ["ASR1001-X"] \ No newline at end of file +models = ["ASR1001-X"] + +["c2960l-universalk9-mz.152-7.E7.bin"] +version = "15.2(7)E7" +md5 = "11f9750e99be42792eddef7268e58e54" +size = 16260096 +models = ["WS-C2960L-24TS-LL"] + \ No newline at end of file diff --git a/pnp/open_pnp_classes.py b/pnp/open_pnp_classes.py index febbe640a8954379d0652cbaa8f925ccb74764e2..4f2fe0e50d7ec2020a496248e66488d135e86714 100644 --- a/pnp/open_pnp_classes.py +++ b/pnp/open_pnp_classes.py @@ -14,6 +14,89 @@ from tomli import load as toml_load from tomli import TOMLDecodeError +class ErrorCodes: + __readable = { + 0: 'No error', + 100: 'unknown platform', + 101: 'no free space for update', + 102: 'unknown image', + 103: 'config file not found', + 104: 'image file not found', + + 1412: 'Invalid input detected (config)', + 1413: 'Invalid input detected', + 1609: 'Error while retrieving device filesystem info', + 1816: 'Error verifying checksum for Image', + 1829: 'Image copy was unsuccessful', + 1803: 'Source file not found', + } + + def __init__(self): + self.ERROR_NO_ERROR = 0 + + self.ERROR_NO_PLATFORM = 100 + self.ERROR_NO_FREE_SPACE = 101 + self.ERROR_NO_IMAGE = 102 + self.ERROR_NO_CFG_FILE = 103 + self.ERROR_NO_IMAGE_FILE = 104 + + self.PNP_ERROR_INVALID_CONFIG = 1412 + self.PNP_ERROR_INVALID_INPUT = 1413 + self.PNP_ERROR_NO_FILESYSTEM_INFO = 1609 + self.PNP_ERROR_BAD_CHECKSUM = 1816 + self.PNP_ERROR_IMAGE_COPY_UNSUCCESSFUL = 1829 + self.PNP_ERROR_FILE_NOT_FOUND = 1803 + + def readable(self, error_code: int): + return self.__readable.get(error_code, f'unknown: {error_code}') + + +class PnpFlow: + __readable = { + 0: 'None', + 1: 'new device', + 2: 'info', + + 10: 'update required', + 11: 'update started', + 12: 'no update required/done', + 13: 'update done -> reloading', + + 21: 'config start', + 22: 'config down -> reloading', + 23: 'reload for config update', + + 30: 'cleanup required', + 31: 'cleanup started', + 32: 'no cleanup required/done', + + 99: 'finished', + } + + def __init__(self): + self.NONE = 0 + self.NEW = 1 + self.INFO = 2 + + self.UPDATE_NEEDED = 10 + self.UPDATE_START = 11 + self.UPDATE_DOWN = 12 + self.UPDATE_RELOAD = 13 + + self.CONFIG_START = 21 + self.CONFIG_DOWN = 22 + self.CONFIG_RELOAD = 23 + + self.CLEANUP_NEEDED = 30 + self.CLEANUP_START = 31 + self.CLEANUP_DOWN = 32 + + self.FINISHED = 99 + + def readable(self, state: int): + return self.__readable.get(state, 'unknown') + + class Settings: def __init__( self, @@ -45,7 +128,7 @@ class Settings: 'log_file': log_file, 'image_url': image_url, 'config_url': config_url, - 'default_cfg_file': default_cfg, + 'default_cfg': default_cfg, } self.__args = {} self.__set_cli_args(cli_args) @@ -62,7 +145,8 @@ class Settings: print(f'ERROR: Data file {cfg_file} not found! ({e})') exit(1) except TOMLDecodeError as e: - print(f'ERROR: Data file {cfg_file} is not in valid toml format! ({e})') + print( + f'ERROR: Data file {cfg_file} is not in valid toml format! ({e})') exit(2) self.__settings.update(self.__args) @@ -105,7 +189,7 @@ class Settings: @property def log_file(self) -> str: - return self.__settings['log-file'] + return self.__settings['log_file'] @property def image_url(self) -> str: @@ -117,7 +201,7 @@ class Settings: @property def default_cfg(self) -> str: - return self.__settings['default-cfg'] + return self.__settings['default_cfg'] class SoftwareImage: @@ -128,89 +212,6 @@ class SoftwareImage: self.size: int = size -class ErrorCodes: - __readable = { - 0: 'No error', - 100: 'unknown platform', - 101: 'no free space for update', - 102: 'unknown image', - 103: 'config file not found', - 104: 'image file not found', - - 1412: 'Invalid input detected (config)', - 1413: 'Invalid input detected', - 1609: 'Error while retrieving device filesystem info', - 1816: 'Error verifying checksum for Image', - 1829: 'Image copy was unsuccessful', - 1803: 'Source file not found', - } - - def __init__(self): - self.ERROR_NO_ERROR = 0 - - self.ERROR_NO_PLATFORM = 100 - self.ERROR_NO_FREE_SPACE = 101 - self.ERROR_NO_IMAGE = 102 - self.ERROR_NO_CFG_FILE = 103 - self.ERROR_NO_IMAGE_FILE = 104 - - self.PNP_ERROR_INVALID_CONFIG = 1412 - self.PNP_ERROR_INVALID_INPUT = 1413 - self.PNP_ERROR_NO_FILESYSTEM_INFO = 1609 - self.PNP_ERROR_BAD_CHECKSUM = 1816 - self.PNP_ERROR_IMAGE_COPY_UNSUCCESSFUL = 1829 - self.PNP_ERROR_FILE_NOT_FOUND = 1803 - - def readable(self, error_code: int): - return self.__readable.get(error_code, f'unknown: {error_code}') - - -class PnpFlow: - __readable = { - 0: 'None', - 1: 'new device', - 2: 'info', - - 10: 'update required', - 11: 'update started', - 12: 'no update required/done', - 13: 'update done -> reloading', - - 21: 'config start', - 22: 'config down -> reloading', - 23: 'reload for config update', - - 30: 'cleanup required', - 31: 'cleanup started', - 32: 'no cleanup required/done', - - 99: 'finished', - } - - def __init__(self): - self.NONE = 0 - self.NEW = 1 - self.INFO = 2 - - self.UPDATE_NEEDED = 10 - self.UPDATE_START = 11 - self.UPDATE_DOWN = 12 - self.UPDATE_RELOAD = 13 - - self.CONFIG_START = 21 - self.CONFIG_DOWN = 22 - self.CONFIG_RELOAD = 23 - - self.CLEANUP_NEEDED = 30 - self.CLEANUP_START = 31 - self.CLEANUP_DOWN = 32 - - self.FINISHED = 99 - - def readable(self, state: int): - return self.__readable.get(state, 'unknown') - - class Device: def __init__(self, udi: str, platform: str, hw_rev: str, serial: str, first_seen: str, last_contact: str, src_address: str, current_job: str): diff --git a/pnp/templates/status.html b/pnp/templates/status.html index 5d43f8087cc5d2ff1d902bc4a48279f3fbc395a1..5c777a617e97f300c13ba98ddc1682046acaabaa 100644 --- a/pnp/templates/status.html +++ b/pnp/templates/status.html @@ -20,11 +20,11 @@ <th>Free space</th> <th>Destination</th> {% endif %} - <th>Error code</th> - <th>Last error</th> - <th>Last message</th> - <th>Error count</th> - <th>Hard error</th> + <!-- <th>Error code</th> --> + <!-- <th>Last error</th> --> + <!-- <th>Last message</th> --> + <!-- <th>Error count</th> --> + <!-- <th>Hard error</th> --> {% if debug %} <th>Backoff</th> {% endif %} @@ -195,11 +195,11 @@ <td>{{ device.destination_free }}</td> <td>{{ device.destination_name }}</td> {% endif %} - <td>{{ device.error_code }}</td> - <td>{{ device.error_code_readable }}</td> - <td>{{ device.error_message }}</td> - <td>{{ device.error_count }}</td> - <td>{{ device.hard_error }}</td> + <!-- <td>{{ device.error_code }}</td> --> + <!-- <td>{{ device.error_code_readable }}</td> --> + <!-- <td>{{ device.error_message }}</td> --> + <!-- <td>{{ device.error_count }}</td> --> + <!-- <td>{{ device.hard_error }}</td> --> {% if debug %} <td>{{ device.backoff }}</td> {% endif %}