Switch firmware upgrading method and device, equipment and medium
By obtaining the switch device version information and identifier for verification, compatibility issues during firmware upgrades were resolved, ensuring the normal operation of the upgraded devices, reducing the probability of upgrade failures, and guaranteeing network stability.
Patent Information
- Application Number
- CN202511295175.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2025-11-18
AI Technical Summary
During the firmware upgrade process of existing switches, hash verification can only verify the integrity of the firmware, ignoring the compatibility issues between the firmware and the switch's supporting components. This can lead to the upgraded device failing to start or malfunctioning, affecting network stability.
By obtaining the device version information and device identifier of the firmware to be upgraded, and comparing and verifying the version number, we can ensure the compatibility between the firmware and the device, proactively intercept the risks of version incompatibility and device mismatch, and ensure the accuracy of the upgrade operation.
This reduces the probability of upgrade failure, ensures the continuity and stability of device operation, and achieves standardization and security in the firmware upgrade process.
Smart Images

Figure CN120979938A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of switch technology, and in particular to a switch firmware upgrade method, apparatus, device, and medium. Background Technology
[0002] In the field of network communication, switches, as core hardware for enabling data forwarding between devices and ensuring stable network operation, rely on firmware (a software collection containing core programs and control logic) for their functionality. As network demands upgrade, switch firmware needs to be updated regularly to fix vulnerabilities, add new features, or optimize performance. The stability of the firmware upgrade process directly affects the continuity of network services—if an upgraded device fails to start or malfunctions, it can lead to anything from a single device going offline to partial or even complete network paralysis. Therefore, risk assessment before firmware upgrades is a crucial step in ensuring reliable network operation.
[0003] In traditional switch firmware upgrade processes, the core mechanism used is hash checking to ensure firmware integrity. Specifically, before the firmware (existing as an image file) is released, technicians calculate the hash value of the image file using a specific hash algorithm (such as SHA-256) and pre-set this hash value inside the switch device or in the accompanying upgrade tool. When a user performs an upgrade operation, the switch recalculates the hash value of the image file to be upgraded. If the calculated result matches the pre-set hash value, the firmware is determined to be intact, and the upgrade is allowed to continue. If the result does not match, the firmware is determined to be corrupted, the upgrade is immediately interrupted, and an error message such as "firmware corrupted" is output.
[0004] Existing hash verification schemes can only verify the integrity of the firmware image file itself (i.e. whether it is damaged or tampered with), but completely ignore the compatibility issues between the firmware and the switch's supporting components. Even if the firmware is upgraded through hash verification, problems such as the device failing to start or malfunctioning may still occur, ultimately rendering the device temporarily unusable. Summary of the Invention
[0005] This application provides a method, apparatus, device, and medium for upgrading switch firmware, which enables the device to operate normally after the upgrade.
[0006] To achieve the above objectives, this application adopts the following technical solution: Firstly, this application provides a method for upgrading switch firmware, including: Obtain the device version information corresponding to the firmware to be upgraded, as well as the first device identifier and first version number information corresponding to the switch; Based on the device version information, the first device identifier and first version number information corresponding to the switch are verified to determine the verification result; Based on the verification results, determine the firmware upgrade operation for the switch.
[0007] In one embodiment, based on device version information, the first device identifier and first version number information corresponding to the switch are verified to determine the verification result, including: The first device identifier is compared with each of the second device identifiers. If a matching identifier is found, the second version number information corresponding to the matching second device identifier is compared with the first version number information, and the verification result is determined based on the comparison result. If no matching identifier is found, the verification result is passed.
[0008] In one embodiment, the second version number information corresponding to the second device identifier with the same identifier is compared with the first version number information, and the verification result is determined based on the comparison result, including: For any version number, if the version number of that type in the second version number information is greater than the version number of that type in the first version number information, the verification result is failed; otherwise, the verification result is passed.
[0009] In one embodiment, determining the firmware upgrade operation for the switch based on the verification result includes: If the verification result is successful, the switch will proceed with the firmware upgrade; if the verification result is unsuccessful, the switch will pause the firmware upgrade.
[0010] In one embodiment, if the verification result is unsuccessful, the switch's firmware upgrade operation is to pause the firmware upgrade, including: If the verification result is unsuccessful, the firmware upgrade operation of the switch will be paused, and the first error message will be output; the first error message includes "version not supported".
[0011] In one embodiment, the first version number information includes at least one of the following: CPLD (Complex Programmable Logic Device) version number, bootloader version number, and hardware version number.
[0012] In one embodiment, before obtaining the device version information corresponding to the firmware to be upgraded, the method further includes: A hash verification is performed on the firmware to be upgraded. If the hash verification fails, the firmware upgrade operation of the switch is paused and a second error message is output. The second error message includes the possibility that the firmware to be upgraded is corrupted.
[0013] Secondly, this application provides a switch firmware upgrade device, comprising: The acquisition module is used to acquire the device version information corresponding to the firmware to be upgraded, as well as the first device identifier and first version number information corresponding to the switch; The information verification module is used to verify the first device identifier and first version number information corresponding to the switch based on the device version information, and determine the verification result; The firmware upgrade module is used to determine the firmware upgrade operation for the switch based on the verification results.
[0014] Thirdly, this application provides a computing device, including a memory and a processor; The memory stores one or more computer programs, the one or more computer programs including instructions; when the instructions are executed by the processor, the computing device performs the method as described in any one of the first aspects.
[0015] Fourthly, this application provides a computer-readable storage medium for storing a computer program for performing the method as described in any one of the first aspects.
[0016] Fifthly, this application provides a computer program product comprising one or more computer instructions, wherein when the computer instructions are executed by a computer, the computer performs the method as described in any one of the first aspects.
[0017] As can be seen from the above technical solution, this application has at least the following beneficial effects: In this application, by obtaining the device version information corresponding to the firmware to be upgraded, as well as the first device identifier and first version number information corresponding to the switch, the accuracy and completeness of the data source are ensured, and the initial association between the firmware and the device is achieved, providing important data support for subsequent verification. Furthermore, based on the device version information, the first device identifier and first version number information corresponding to the switch can be verified to determine the verification result, proactively intercepting the risks of version incompatibility and device mismatch, reducing the probability of upgrade failure, and providing a decision-making basis for subsequent upgrade operations. Finally, based on the verification results, the firmware upgrade operation of the switch is determined, ultimately achieving a precise mapping between the verification result and the operation, ensuring the standardization and security of the upgrade process, and guaranteeing the continuity of device operation. This solution provides accurate data by introducing device version information, providing data for subsequent verification; furthermore, by performing verification, risks are filtered out in advance, ultimately ensuring the normal operation of the upgraded device.
[0018] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description
[0019] Figure 1 This is an application environment diagram of a switch firmware upgrade method provided in the embodiments of this application; Figure 2 This is a flowchart illustrating a switch firmware upgrade method provided in an embodiment of this application; Figure 3 This is a structural block diagram of a switch firmware upgrade device provided in the embodiments of this application; Figure 4 This is an internal structural diagram of a computer device provided in the embodiments of the application. Detailed Implementation
[0020] The terms "first," "second," and "third," etc., used in this application specification and accompanying drawings are used to distinguish different objects, not to limit a specific order.
[0021] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0022] To ensure clarity and conciseness in the description of the following embodiments, a brief introduction to the related technologies is given first: In the field of network communication, switches, as core hardware for enabling data forwarding between devices and ensuring stable network operation, rely on firmware (a software collection containing core programs and control logic) for their functionality. As network demands upgrade, switch firmware needs to be updated regularly to fix vulnerabilities, add new features, or optimize performance. The stability of the firmware upgrade process directly affects the continuity of network services—if an upgraded device fails to start or malfunctions, it can lead to anything from a single device going offline to partial or even complete network paralysis. Therefore, risk assessment before firmware upgrades is a crucial step in ensuring reliable network operation.
[0023] In traditional switch firmware upgrade processes, the core mechanism used is hash checking to ensure firmware integrity. Specifically, before the firmware (existing as an image file) is released, technicians calculate the hash value of the image file using a specific hash algorithm (such as SHA-256) and pre-set this hash value inside the switch device or in the accompanying upgrade tool. When a user performs an upgrade operation, the switch recalculates the hash value of the image file to be upgraded. If the calculated result matches the pre-set hash value, the firmware is determined to be intact, and the upgrade is allowed to continue. If the result does not match, the firmware is determined to be corrupted, the upgrade is immediately interrupted, and an error message such as "firmware corrupted" is output.
[0024] Existing hash verification schemes can only verify the integrity of the firmware image file itself (i.e. whether it is damaged or tampered with), but completely ignore the compatibility issues between the firmware and the switch's supporting components. Even if the firmware is upgraded through hash verification, problems such as the device failing to start or malfunctioning may still occur, ultimately rendering the device temporarily unusable.
[0025] To make the technical solution of this application clearer and easier to understand, the application scenarios of the technical solution of this application are described below with reference to the accompanying drawings. Figure 1 As shown in the figure, this figure is a schematic diagram of an application scenario provided by an embodiment of this application.
[0026] In this application scenario, server 104 verifies the information based on the device version information, as well as the first device identifier and first version number information corresponding to the switch, determines the device upgrade operation, and can display the corresponding upgrade operation results through terminal 102 for relevant technical personnel to view.
[0027] To make the technical solution of this application clearer and easier to understand, the following describes a switch firmware upgrade method provided by an embodiment of this application, in conjunction with the above application scenarios. Figure 2 As shown in the figure, this figure is a flowchart of a switch firmware upgrade method provided in an embodiment of this application.
[0028] S201. Obtain the device version information corresponding to the firmware to be upgraded, as well as the first device identifier and first version number information corresponding to the switch.
[0029] The firmware to be upgraded refers to the device's built-in software that needs to fix vulnerabilities, optimize functions, or adapt to new requirements through firmware files (i.e., update programs). The first device identifier is the unique identifier of the switch in the management system, which is of the same type as the "second device identifier." Each device is named by the identifier to distinguish it from another device. The device version information includes the second device identifier and the second version number information corresponding to each second device identifier. It is a data set that can describe the basic version status of the device to be upgraded, such as including the identifier-version number mapping relationship. The first version number information includes at least one of the following: CPLD (Complex Programmable Logic Device) version number, bootloader version number, and hardware version number. It is a set of versions of the switch hardware and underlying programs and is an important pre-check data for switch firmware upgrades.
[0030] Optionally, the second device identifier refers to the unique identifier of the device to be upgraded in the management system, such as Type ID, MAC address, or custom device number; the second version number information refers to the target firmware version number currently running on the device to be upgraded, such as at least one of the following: CPLD (Complex Programmable Logic Device) version number, bootloader version number, or hardware version number. The Type ID is a code used to identify and distinguish the device type; each switch model has a unique Type ID.
[0031] For example, a device management platform can be used to filter devices that meet the upgrade criteria (e.g., versions lower than the latest, vulnerabilities requiring patching), generating a list of devices to be upgraded. This list should include information such as the device's basic type (e.g., switch, router) and its network region. Furthermore, remote login tools, device management platforms, and SNMP (Simple Network Management) can be used. Information is collected using protocol tools (Simple Network Management Protocol), console connection cables, etc., such as collecting corresponding identifiers and version information for two types of objects: the firmware device to be upgraded and the switch. Furthermore, to ensure the accuracy and usability of the information, after collection, erroneous data is eliminated through verification to avoid affecting subsequent upgrade actions. This includes verifying the uniqueness of identifiers (e.g., checking for duplicates between "second device identifier" and "first device identifier"), verifying the version format (confirming that the version number format conforms to the standard and eliminating garbled or invalid characters), pre-verifying compatibility (e.g., comparing the switch's "first version number information" with the target upgrade package's "minimum supported version" and marking switches that do not meet the conditions), and verifying communication status. Finally, the verified information is organized into clear documents, such as generating two types of tables: "Firmware Device Version Information Table to be Upgraded" and "Switch Version Details Table." Upon receiving an instruction to retrieve information, the relevant tables are directly output.
[0032] It should be noted that before obtaining the device version information corresponding to the firmware to be upgraded, the process also includes: performing a hash verification on the firmware to be upgraded. If the hash verification fails, the firmware upgrade operation of the switch will be paused, and a second error message will be output.
[0033] The hash verification process calculates a unique hash value for the firmware to be upgraded and compares it with a standard hash value, which is an operation to verify file integrity. The second error message, "The firmware to be upgraded is corrupted," refers to the error message output when the hash verification of the firmware to be upgraded fails. It should clearly include the core information "The firmware to be upgraded is corrupted," and may also include supplementary guidance such as "It is recommended to download the firmware again" or "Check the firmware version."
[0034] For example, before obtaining device version information, a basic integrity verification of the firmware to be upgraded needs to be completed. This can be achieved by obtaining the standard hash value corresponding to the firmware from the device manufacturer's official website, firmware download page, etc. Furthermore, a hash verification tool can be used to calculate the hash value of the firmware file to be upgraded, obtaining the actual hash value. If the actual hash value matches the standard hash value, it indicates that the firmware is intact and undamaged, and the next step, TTLV (Type-Tag-Length-Value) data processing, can proceed. If the hash values do not match (i.e., verification fails), the switch firmware upgrade operation is immediately paused, and a second error message is output (e.g., "[Error] Firmware upgrade is corrupted, hash verification failed. Recommendations: 1. Re-download the corresponding model firmware from the manufacturer's official website; 2. Verify that the downloaded firmware version matches the device model").
[0035] Furthermore, after the hash verification passes, the TTLV data in the firmware can be read and its integrity verified. For example, a firmware parsing tool can be used to open the firmware to be upgraded, locate the firmware header area, and extract key information of the TTLV data, such as the offset (determining the starting byte position of the TTLV data in the firmware file) and size (determining the total number of bytes of the TTLV data). Then, based on the obtained offset and size, the TTLV data block can be accurately extracted from the firmware file and loaded into memory (avoiding repeated reading of disk files and improving the efficiency of subsequent verification), while recording the storage path and memory address of the data block. Further, the "standard checksum" corresponding to the TTLV data can be read from the firmware (usually stored after the TTLV data or in the checksum field of the firmware header), and the "actual checksum" of the TTLV data block in memory can be calculated using a checksum algorithm consistent with the manufacturer. If the actual checksum matches the standard checksum, the TTLV data is complete, and the next step of TTLV verification can be performed. If the checksum does not match, an error is immediately reported and the upgrade is paused, such as "Error: TTLV data checksum failed, data may be corrupted." Recommendation: Re-download the firmware and verify again, then terminate the process and obtain the complete firmware again.
[0036] Furthermore, after the verification and check are passed, the content of the TTLV data can also be verified to ensure that the firmware is compatible with the switch and to avoid upgrade failure due to compatibility issues. For example, the TTLV data content can be parsed to extract key compatibility information and compared with the switch information for verification: the compatibility information parsed from the TTLV data is compared with the first device identifier (such as Type ID) and first version number information (such as hardware version, boot version, CPLD version) of the switch obtained earlier to determine whether the firmware is compatible with the switch.
[0037] S202. Based on the device version information, verify the first device identifier and first version number information corresponding to the switch, and determine the verification result.
[0038] One possible approach is to compare the first device identifier with each of the second device identifiers. If a matching identifier is found, the second version number information corresponding to the matching second device identifier is compared with the first version number information, and the verification result is determined based on the comparison result. If no matching identifier is found, the verification result is passed.
[0039] The second version number information and the first version number information both include at least one type of version number; the verification result is the final conclusion output after comparing the identifier with the version number, which is divided into two categories: pass (upgrade can be performed) and fail (the problem needs to be dealt with before upgrading), and specific reasons must be attached, such as identifier mismatch, a certain type of version number being too high, etc.
[0040] Optionally, if all values in the first device identifier are 0, it means that all devices need to be verified, and all devices are verified directly. Devices that pass the verification will be upgraded with firmware, and devices that fail the verification will generate corresponding error messages to prompt relevant technical personnel to adjust the device so that it can pass the verification and be upgraded with firmware.
[0041] Optionally, for any type of version number, if the version number of that type in the second version number information is greater than the version number of that type in the first version number information, then the verification result is failed; otherwise, the verification result is passed.
[0042] For example, the first device identifier of the switch is compared one by one with the second device identifier of the firmware to be upgraded to determine whether there is a match. If a matching identifier exists, such as the first device identifier "380" existing in the list of second device identifiers, the second version number information corresponding to the identifier is recorded, and the next step of version number comparison is performed. If no matching identifier exists, such as the first device identifier "380" not existing in the list of second device identifiers, "verification result = passed" is directly generated, and the conclusion is recorded in the verification report. Furthermore, for scenarios where the identifiers match, the second version number is judged to meet the requirements according to the principle of "comparing version numbers of the same type one by one". If any second version number of the same type is greater than the first version number, the verification fails; otherwise, it passes.
[0043] Optionally, to ensure information clarity and traceability, and to facilitate subsequent decision-making and review, the process and results of identifier comparison and version number comparison can be compiled into a device version verification report. For example, the device version verification report may include the device identifier (i.e., the first device identifier corresponding to the switch), the current version of the device (i.e., the first version number information), the target version (i.e., the second version number information), and the verification results.
[0044] S203. Based on the verification results, determine the firmware upgrade operation for the switch.
[0045] One possible approach is to perform a firmware upgrade if the verification result is successful, and to pause the firmware upgrade if the verification result is unsuccessful.
[0046] Optionally, if the verification result is unsuccessful, the firmware upgrade operation of the switch will be paused and the first error message will be output.
[0047] The first error message includes "Version Not Supported," specifically referring to the error message output when the device version information verification fails. It must include the core reason for the version incompatibility, along with details of the incompatible version type (e.g., CPLD version, hardware version), and suggested solutions (e.g., upgrading the underlying version, replacing with compatible firmware). The first and second error messages differentiate the scenarios, helping administrators accurately pinpoint version incompatibility issues, avoiding repeated firmware integrity checks, and shortening problem-solving time. Firmware upgrade is the formal firmware update action performed on the switch when the verification result is successful. It can include the entire process of issuing upgrade commands, transmitting firmware, writing to device storage, and restarting to take effect. It is the core execution step of the firmware upgrade process and must be initiated based on the previous verification results (firmware integrity, version compatibility) to ensure operational security and success rate. Pausing firmware upgrade is the action to terminate the subsequent firmware update process when the verification result fails. This can include stopping upgrade command generation, blocking firmware transmission channels, and maintaining the device's current operating state.
[0048] For example, the verification results can be checked for completeness. This includes ensuring the verification result includes a conclusion and a reason, such as "Passed, compatible with all version types" or "Failed, hardware version V1.0 < V1.2, version not supported," avoiding displaying only the conclusion without a reason. If the result is missing, such as only displaying "Failed" without a reason, the previous step must be returned to re-execute the verification, and the reason information added before proceeding to the next step to prevent blind operation. Furthermore, for completeness verification results that pass, subsequent actions are determined based on two scenarios: "Passed" and "Failed." If the verification result is "Passed," a firmware upgrade operation is performed (e.g., confirming the switch's current operating status, selecting the upgrade method, issuing upgrade commands and transmitting firmware, performing firmware writing and restarting, and post-upgrade verification). If the verification result is "Failed," the firmware upgrade operation is paused (e.g., terminating the task, blocking the firmware transmission channel, and outputting the first error message), and the first error message is also output.
[0049] It should be noted that regardless of whether a firmware upgrade operation is performed or paused, the results must be recorded and feedback generated for subsequent traceability and optimization. This includes recording basic operation information such as the first device identifier, operation time, operator, and verification result type; operation details: for upgrade operations, record the firmware version (source version → target version), upgrade time, restart time, and post-upgrade status (success / failure); for paused operations, record the complete content of the first error message and the task progress at the time of pause (e.g., no firmware transferred / 50% transferred, etc.). Recording can be done manually, such as filling out a "Switch Firmware Upgrade Operation Record Form," or automatically, such as the management platform automatically synchronizing the operation results to the upgrade log database, supporting retrieval by Type ID, time, and operation type. Furthermore, if there are batches of "failed" devices (e.g., a batch of switches all reporting errors due to low CPLD versions), the issues can be summarized and reported. If the upgrade operation fails (e.g., verification passes but the device restarts abnormally after the upgrade), the verification process needs to be reviewed to confirm whether there are any omissions in version comparison (e.g., failure to verify the Boot version), and subsequent verification rules should be optimized.
[0050] The aforementioned switch firmware upgrade method, by obtaining the device version information corresponding to the firmware to be upgraded, as well as the first device identifier and first version number information corresponding to the switch, ensures the accuracy and integrity of the data source, achieves the initial association between the firmware and the device, and provides important data support for subsequent verification. Furthermore, based on the device version information, the first device identifier and first version number information corresponding to the switch can be verified to determine the verification result, proactively intercepting the risks of version incompatibility and device mismatch, reducing the probability of upgrade failure, and providing a decision-making basis for subsequent upgrade operations. Finally, based on the verification results, the firmware upgrade operation of the switch is determined, ultimately achieving a precise mapping between the verification result and the operation, ensuring the standardization and security of the upgrade process, and guaranteeing the continuity of device operation. This solution provides accurate data by introducing device version information, providing data for subsequent verification; furthermore, by performing verification, risks are filtered out in advance, ultimately ensuring the normal operation of the upgraded device.
[0051] The above text combined Figures 1 to 2 The switch firmware upgrade method provided in the embodiments of this application has been described in detail. The apparatus and device provided in the embodiments of this application will be described below with reference to the accompanying drawings.
[0052] like Figure 3 As shown in the figure, this is a schematic diagram of a switch firmware upgrade device provided in an embodiment of this application. The device 600 includes: an acquisition module 601, an information verification module 602, and a firmware upgrade module 603, wherein: The acquisition module 601 is used to acquire the device version information corresponding to the firmware to be upgraded, as well as the first device identifier and first version number information corresponding to the switch.
[0053] The information verification module 602 is used to verify the first device identifier and first version number information corresponding to the switch based on the device version information, and determine the verification result.
[0054] Firmware upgrade module 603 is used to determine the firmware upgrade operation of the switch based on the verification results.
[0055] In one embodiment, the information verification module 602 is specifically used for: The first device identifier is compared with each of the second device identifiers. If a matching identifier is found, the second version number information corresponding to the matching second device identifier is compared with the first version number information, and the verification result is determined based on the comparison result. If no matching identifier is found, the verification result is passed.
[0056] In one embodiment, the information verification module 602 is specifically used for: For any version number, if the version number of that type in the second version number information is greater than the version number of that type in the first version number information, the verification result is failed; otherwise, the verification result is passed.
[0057] In one embodiment, the firmware upgrade module 603 is specifically used for: If the verification result is successful, the switch will proceed with the firmware upgrade; if the verification result is unsuccessful, the switch will pause the firmware upgrade.
[0058] In one embodiment, the firmware upgrade module 603 is specifically used for: If the verification result is unsuccessful, the firmware upgrade operation of the switch will be paused, and the first error message will be output; the first error message includes "version not supported".
[0059] In one embodiment, the first version number information includes at least one of the following: CPLD (Complex Programmable Logic Device) version number, bootloader version number, and hardware version number.
[0060] In one embodiment, the switch firmware upgrade device 600 further includes: The hash verification module is used to perform hash verification on the firmware to be upgraded. If the hash verification fails, the firmware upgrade operation of the switch will be paused and a second error message will be output. The second error message includes the firmware to be upgraded being corrupted.
[0061] The switch firmware upgrade apparatus 600 according to the embodiments of this application can correspondingly execute the method described in the embodiments of this application, and the other operations and / or functions of each module / unit of the switch firmware upgrade apparatus 600 are respectively for implementing Figure 2 For the sake of brevity, the corresponding processes of each method in the illustrated embodiments will not be described in detail here.
[0062] This application also provides a computing device. This computing device can be a local computing device or an application server.
[0063] like Figure 4 As shown in the figure, this is a schematic diagram of a computing device provided in an embodiment of this application. The computing device 700 includes a bus 701, a processor 702, a communication interface 703, and a memory 704. The processor 702, the memory 704, and the communication interface 703 communicate with each other via the bus 701.
[0064] The 701 bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0065] The processor 702 can be any one or more of the following processors: central processing unit (CPU), graphics processing unit (GPU), microprocessor (MP), or digital signal processor (DSP).
[0066] Communication interface 703 is used for external communication. For example, communication interface 703 can be used to communicate with terminal 102. Communication interface 703 is used to send error messages to terminal 102 so that terminal 102 can display error messages.
[0067] Memory 704 may include volatile memory, such as random access memory (RAM). Memory 704 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0068] The memory 704 stores executable code, and the processor 702 executes the executable code to perform the aforementioned switch firmware upgrade method.
[0069] Specifically, in achieving Figure 3 In the case of the illustrated embodiment, and Figure 3 When the modules or units of the switch firmware upgrade device described in the embodiment are implemented in software, the following steps are performed: Figure 3 The software or program code required for the functions of each module / unit can be partially or wholly stored in the memory 704. The processor 702 executes the program code corresponding to each unit stored in the memory 704 to perform the aforementioned switch firmware upgrade method.
[0070] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the aforementioned switch firmware upgrade method.
[0071] This application also provides a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this application are generated.
[0072] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another website, computer, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0073] When the computer program product is executed by a computer, the computer performs any of the aforementioned methods of the switch firmware upgrade method. The computer program product can be a software installation package; when any of the aforementioned methods of the switch firmware upgrade method is required, the computer program product can be downloaded and executed on the computer.
[0074] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0075] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the scope of protection of this application.
Claims
1. A method for upgrading switch firmware, characterized in that, The method includes: Obtain the device version information corresponding to the firmware to be upgraded, as well as the first device identifier and first version number information corresponding to the switch; Based on the device version information, the first device identifier and the first version number information corresponding to the switch are verified, and the verification result is determined. Based on the verification results, the firmware upgrade operation of the switch is determined.
2. The method according to claim 1, characterized in that, The device version information includes a second device identifier and a second version number corresponding to each second device identifier. The step of verifying the first device identifier and first version number information corresponding to the switch based on the device version information and determining the verification result includes: The first device identifier is compared with each of the second device identifiers. If there is a matching identifier, the second version number information corresponding to the matching second device identifier is compared with the first version number information, and the verification result is determined based on the comparison result. If no matching identifier is found, the verification result is passed.
3. The method according to claim 2, characterized in that, Both the second version number information and the first version number information include at least one type of version number. The step of comparing the second version number information corresponding to the identical second device identifier with the first version number information, and determining the verification result based on the comparison result, includes: For any type of version number, if the version number of that type in the second version number information is greater than the version number of that type in the first version number information, then the verification result is failed. Otherwise, the verification result is passed.
4. The method according to claim 1, characterized in that, The step of determining the firmware upgrade operation of the switch based on the verification result includes: If the verification result is passed, the firmware upgrade operation of the switch is a firmware upgrade. If the verification result is unsuccessful, the firmware upgrade operation of the switch will be paused.
5. The method according to claim 4, characterized in that, If the verification result is unsuccessful, the firmware upgrade operation of the switch is to pause the firmware upgrade, including: If the verification result is unsuccessful, the firmware upgrade operation of the switch is to pause the firmware upgrade and output a first error message; wherein, the first error message includes version not supported.
6. The method according to claim 1, characterized in that, The first version number information includes at least one of the following: CPLD (Complex Programmable Logic Device) version number, bootloader version number, and hardware version number.
7. The method according to claim 1, characterized in that, Before obtaining the device version information corresponding to the firmware to be upgraded, the process also includes: A hash verification is performed on the firmware to be upgraded. If the hash verification fails, the firmware upgrade operation of the switch is paused and a second error message is output. The second error message includes the condition that the firmware to be upgraded is corrupted.
8. A switch firmware upgrade device, characterized in that, The device includes: The acquisition module is used to acquire the device version information corresponding to the firmware to be upgraded, as well as the first device identifier and first version number information corresponding to the switch; The information verification module is used to verify the first device identifier and the first version number information corresponding to the switch based on the device version information, and determine the verification result; The firmware upgrade module is used to determine the firmware upgrade operation of the switch based on the verification result.
9. A computing device, characterized in that, Including memory and processor; The memory stores one or more computer programs, the one or more computer programs including instructions; when the instructions are executed by the processor, the computing device performs the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the method as described in any one of claims 1 to 7.