Switch starting method and device, switch equipment and storage medium

The switch startup method addresses the lack of an interrupt mechanism by controlling switches to enter level modes based on abnormal reset times, ensuring stable and reliable operation through appropriate system startup.

CN119232686APending Publication Date: 2024-12-31深圳市三旺通信股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411330266.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Existing switches lack an interrupt mechanism during startup, relying on management application software for key functions, leading to crashes and continuous restarts due to hardware failures or software anomalies, affecting stability and reliability.

Method used

A method that reads abnormal reset times to control the switch to enter different level modes based on preset ranges, starting appropriate systems corresponding to these modes, including first, secondary, and third-level modes with specific operating systems and modules.

Benefits of technology

Ensures flexible control and management, allowing appropriate system startup in different situations, enhancing stability and reliability by preventing crashes and enabling manageability and upgradeability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119232686A_ABST
    Figure CN119232686A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of switches, and discloses a switch starting method and device, switch equipment and a storage medium, and the switch starting method comprises the steps: obtaining the number of abnormal reset times, and controlling a switch to enter a level mode of a corresponding range according to the range of the number of abnormal reset times; and starting according to the currently entered level mode and a starting mechanism corresponding to the current level mode. According to the switch starting method, flexible control and management maintenance of a switch system are realized, so that the switch can start a proper system according to a level mode under different conditions, proper management and upgrading operations under different levels are ensured, and the stability and reliability of the switch are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of switches, and in particular to a switch startup method, device, switch equipment and storage medium. Background Art

[0002] As the core device of the network architecture, the switch undertakes the key tasks of efficient data packet forwarding and network connection. Its stability and reliability are important cornerstones to ensure the smooth operation of the network. However, in the context of the high complexity of the field of network equipment technology, the switches on the market currently generally adopt a three-layer startup mode of boot program + operating system + switch management application system software, which starts automatically and the process cannot be interrupted. During this startup process, most functions of the switch actually rely on the management application software. More importantly, once the device hardware fails or the software is abnormal, the management application software often crashes and falls into a vicious cycle of continuous restarts. This not only makes the switch unable to be managed normally, but may even paralyze the entire switch, seriously affecting the stability and reliability of the network.

[0003] Therefore, how to ensure the integrity of the switch's key functions while improving the ability to deal with hardware failures and software anomalies and ensuring the basic manageability and upgradeability of switch equipment has become an important issue that needs to be solved urgently. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a switch startup method, device, switch equipment and storage medium, which can effectively solve the problems of the existing switch lacking an interrupt mechanism when starting, relying on management application software to execute key functions, and causing the management system software to crash and restart when encountering hardware failure or software anomaly, thereby making the switch unable to operate normally.

[0005] In a first aspect, an embodiment of the present application provides a method for starting a switch, including:

[0006] Read the currently stored abnormal reset times;

[0007] According to the range to which the number of abnormal resets belongs, controlling the switch to enter a level mode corresponding to the range;

[0008] According to the level mode currently entered, start according to the start mechanism corresponding to the current level mode.

[0009] In some embodiments, controlling the switch to enter a level mode corresponding to the range to which the number of abnormal resets belongs includes:

[0010] When the number of abnormal resets is within a first preset range, controlling the switch to enter a first-level mode;

[0011] When the number of abnormal resets is within a second preset range, controlling the switch to enter a secondary mode;

[0012] When the number of abnormal reset times is within a third preset range, the switch is controlled to enter a three-level mode; wherein the number of abnormal reset times within the first preset range, the second preset range, and the third preset range increases in sequence.

[0013] In some embodiments, starting according to the currently entered level mode and according to the starting mechanism corresponding to the current level mode includes:

[0014] If the current level mode is the first level mode, start and run the first operating system according to the first level mode; the first operating system is configured with a timer, and the timer is triggered to run after the first operating system is started;

[0015] If the current level mode is the secondary mode, the core module is started and operated according to the secondary mode, and the core module is triggered to run by calling the startup script;

[0016] If the current level mode is the third level mode, the second operating system is started and run according to the third level mode, and the second operating system is an embedded system.

[0017] In some embodiments, after starting the first operating system according to the primary mode, the method further includes:

[0018] Determine the abnormal reset state of the first operating system within a preset time period; when the abnormal reset state of the first operating system within the preset time period is a first state, reset the abnormal reset count.

[0019] In some embodiments, after starting the core module running in the first operating system according to the secondary mode, the method further includes:

[0020] Determining the abnormal reset state of the core module within the preset time period;

[0021] When the abnormal reset state of the core module within the preset time period is the first state, the abnormal reset times are reset.

[0022] In some embodiments, the determining of the abnormal reset state of the first operating system within a preset period of time further includes:

[0023] When the abnormal reset state of the first operating system is the second state within the preset time period, the abnormal reset times are accumulated and a corresponding level mode is entered according to the abnormal reset times; the corresponding level mode includes the first level mode, the second level mode and the third level mode.

[0024] In some embodiments, when determining the abnormal reset state of the core module within the preset time period, the method further includes:

[0025] When the abnormal reset state of the core module within the preset time period is the second state, the number of abnormal resets is accumulated, and the corresponding level mode is entered according to the number of abnormal resets; the corresponding level mode includes the first level mode, the second level mode and the third level mode.

[0026] In a second aspect, an embodiment of the present application provides a startup device of a switch, including:

[0027] A data acquisition module is used to read the currently stored abnormal reset times;

[0028] A control module, configured to control the switch to enter a level mode corresponding to the range to which the abnormal reset times belong according to the range to which the abnormal reset times belong;

[0029] The startup module is used to start according to the startup mechanism corresponding to the current level mode according to the level mode currently entered.

[0030] In a third aspect, an embodiment of the present application provides a switch device, the switch comprising a processor and a memory, the memory storing a computer program, and the processor being configured to execute the computer program to implement the switch startup method of the first aspect.

[0031] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, and when the computer program is executed on a processor, the method for starting a switch according to the first aspect is implemented.

[0032] The embodiments of the present application have the following beneficial effects:

[0033] The present application discloses a switch startup method, device, switch equipment and storage medium, which obtains the number of abnormal reset times, pre-sets the range to which the abnormal number of reset times belongs, controls the switch to enter a level mode corresponding to the range according to the range to which the abnormal reset times belongs, and then starts according to the startup mechanism corresponding to the current level mode according to the currently entered level mode, thereby realizing flexible control and management and maintenance of the switch system, so that the switch can start a suitable system according to the level mode in different situations, ensuring suitable management and upgrade operations at different levels, and improving the stability and reliability of the switch. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1 An application scenario diagram of a switch startup method according to an embodiment of the present application is shown;

[0036] Figure 2 A flow chart showing a method for starting a switch according to an embodiment of the present application is shown;

[0037] Figure 3 Another flow chart of a method for starting a switch according to an embodiment of the present application is shown;

[0038] Figure 4 Another flow chart of a method for starting a switch according to an embodiment of the present application is shown;

[0039] Figure 5 A schematic structural diagram of a switch startup device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0040] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0041] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0042] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.

[0043] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0044] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0045] Considering that the existing switches lack an interrupt mechanism when starting up, the key functions are actually executed by the management application software. Once a hardware failure or software anomaly occurs, the management system software will crash and restart continuously, making the switch unable to operate normally, affecting the stability and reliability of the switch. Therefore, a switch startup method is proposed. By obtaining the number of abnormal resets, the range of the abnormal reset number is pre-set, and the switch is controlled to enter the level mode corresponding to the range according to the range of the abnormal reset number. Then, according to the currently entered level mode, the system of the corresponding level mode is started, which realizes flexible control and management and maintenance of the switch system, so that the switch can start the appropriate system according to the level mode in different situations, ensuring appropriate management and upgrade operations at different levels, and improving the stability and reliability of the switch.

[0046] The present invention provides a method for starting a switch, which can be applied in the following cases: Figure 1 In the application environment, specifically, the switch startup method of the present application is applied in a switch network, the network including: Figure 1 The switch and network terminal device shown. The switch and the network terminal device communicate through the switch network. As the core part of the network device, the switch is responsible for connecting various network terminal devices. Network terminal devices (such as computers, printers, cameras, smart terminals, etc.) are connected to the switch through the switch network to achieve connection with the network and data exchange.

[0047] Figure 2 A flow chart of a method for starting a switch according to an embodiment of the present application is shown. The method for starting a switch includes the following steps:

[0048] Step S100, reading the currently stored abnormal reset times.

[0049] Exemplarily, when the switch starts running, the boot program (for example, uboot) will be loaded first. Uboot is responsible for initializing the hardware devices, and then loading the operating system (for example, Linux embedded system, etc.). Among them, the operating system is responsible for managing and controlling the hardware resources of the switch and providing basic system services. After the operating system is started, the initialization script is run to configure the network parameters of the switch, start necessary services, etc. After the initialization script is completed, the switch will load the management application system software. The application system software provides the user with an interface and functions for managing the switch, including configuring switch parameters, monitoring network status, etc. After the application system software is started, the switch enters the running state. At this time, the switch can process network data and provide network services according to the user's configuration and needs.

[0050] Furthermore, the number of abnormal resets is usually stored in the / product directory of the switch device. The startup init.sh script uses a shell command to read the number of abnormal resets in the reboot_record file. For example, a command like abnormal reset number = $(cat / product / reboot_record) can be used to read the file content. The application system software can read and write the reboot_record file by using C functions. For example, the file can be operated using standard C file I / O functions such as fopen(), fread(), and fwrite(). In other words, both the startup init.sh script and the SWOS software can directly access the file, thereby achieving unified management of the number of abnormal resets.

[0051] Step S200, according to the range to which the number of abnormal resets belongs, the switch is controlled to enter a level mode corresponding to the range.

[0052] Exemplarily, the range of abnormal reset times and the corresponding level mode are predefined. For example, the abnormal reset times can be divided into different ranges, such as 0-10 times, 11-20 times, 21-50 times, etc., and a level mode is defined for each range, such as normal mode, warning mode, emergency mode, etc. Each level mode corresponds to a different range of abnormal reset times. In the monitoring program or management interface of the switch, the occurrence of abnormal reset times is monitored in real time. When the number of abnormal reset times reaches a certain range, it switches to the corresponding level mode according to the defined rules, and takes corresponding measures to deal with the abnormal situation, thereby improving the reliability and stability of the system.

[0053] Step S300, starting according to the starting mechanism corresponding to the current level mode according to the current level mode.

[0054] Exemplarily, when the switch enters a specific level mode, the system or service corresponding to the current level mode is started according to the startup mechanism; for example, assuming that the number of abnormal resets is between 1 and 10 for a low level, between 11 and 20 for a medium level, and 21 and above for a high level. If the number of abnormal resets is 15, the switch enters the medium level mode, in which the basic core modules in the SWOS system are started with the default configuration, such as the hardware adaptation module, the network service module, the configuration interface module, the CLI module, etc. If the number of abnormal resets is 23, the switch enters the high level mode, in which only the Linux system is started, only the serial port access is retained, and only the Linux shell command line interface is operable.

[0055] It is worth noting that the values ​​of the above parameters are only examples and can be adaptively adjusted according to specific circumstances.

[0056] The startup method of the switch in the embodiment of the present application reads the number of abnormal reset times and, according to the range to which the number of abnormal reset times belongs, controls the switch to enter the level mode corresponding to the range, and then starts according to the current level mode and the startup mechanism corresponding to the current level mode, thereby realizing flexible control and management and maintenance of the switch system, so that the switch can start the appropriate system according to the level mode in different situations, ensuring appropriate management and upgrade operations at different levels, and improving the stability and reliability of the switch.

[0057] In an optional embodiment, if Figure 3 As shown, in step S200, according to the range to which the number of abnormal resets belongs, the switch is controlled to enter a level mode corresponding to the range, including:

[0058] Step S201: When the number of abnormal resets is within a first preset range, the switch is controlled to enter a first level mode.

[0059] Exemplarily, the number of abnormal resets refers to the number of abnormal restarts that occur in the switch within a certain period of time. The first preset range is a preset range of the number of abnormal resets. When the number of abnormal resets falls within the range, the switch is triggered and controlled to switch to the first-level mode. For example, the first preset range is 1-5 times. The first-level mode is the normal start-up SWOS system mode, that is, when the number of abnormal resets is within the range of 1-5 times, the switch is controlled to start the SWOS system normally.

[0060] It is worth noting that the values ​​in the above preset ranges are only examples and can be adaptively adjusted according to specific circumstances.

[0061] Step S202: When the number of abnormal resets is within a second preset range, the switch is controlled to enter a secondary mode.

[0062] Exemplarily, the number of abnormal resets in the second preset range is greater than the number of abnormal resets in the first preset range. For example, the first preset range is 1-5 times, the second preset range is 6-8 times, etc. When the number of abnormal resets reaches or exceeds the second preset range of 6-8 times, the condition for entering the secondary mode is met.

[0063] For example, in other implementations, the preset range can be associated with the time window, for example, when the number of abnormal resets occurring within 24 hours reaches the preset range, the switch is controlled to enter the secondary mode, and when the number of abnormal resets occurring within 48 hours reaches the preset range, the switch is controlled to enter the tertiary mode, etc. Further, when the switch enters the secondary mode, the relevant personnel can be notified through an alarm system, such as email, SMS, application notification, etc., to inform the relevant personnel that the number of abnormal resets has reached the triggering condition of the secondary mode, so that the relevant personnel can understand the status of the switch in a timely manner.

[0064] Step S203, when the number of abnormal resets is within the third preset range, the switch is controlled to enter the three-level mode; wherein the number of abnormal resets within the first preset range, the second preset range, and the third preset range increases in sequence.

[0065] Exemplarily, when the number of abnormal resets reaches a third preset range, the switch system automatically switches to the third-level mode. In the third-level mode, the switch system will take more stringent measures to protect itself, such as shutting down all non-critical functions, shutting down all ports, stopping all services, disabling all protocols, etc.

[0066] Exemplarily, the number of abnormal resets in the first preset range, the second preset range, and the third preset range increases in sequence, that is, the threshold of each range is higher than the threshold of the previous range, the number of abnormal resets in the third preset range is greater than the second preset range, and the number of abnormal resets in the second preset range is greater than the first preset range. For example, the first-level mode is 1-5 times, the second-level mode is 6-8 times, the third-level mode is 9-13 times, etc., or the first-level mode is 1-3 times, the second-level mode is 4-6 times, and the third-level mode is 7-10 times. It is worth noting that the preset range can be adjusted according to the characteristics of the switch device and the use environment to ensure the adaptability of the switch in different situations.

[0067] Furthermore, in other implementations, after entering the third-level mode, you can wait for a while to observe whether the number of abnormal resets returns to normal. When the number of abnormal resets returns to the normal range and the system runs stably for a period of time, the switch is restored from the third-level mode to the normal mode.

[0068] The switch startup method of the embodiment of the present application, through pre-setting different levels of abnormal reset number ranges and corresponding to different working modes, can enable the switch device to take corresponding countermeasures according to the severity of the abnormal situation, which not only ensures the manageability and upgradeability of the switch device, but also improves the stability and reliability of the switch.

[0069] In an optional embodiment, if Figure 4 As shown, in step S300, according to the currently entered level mode, the startup mechanism corresponding to the current level mode is started, and the following is also included:

[0070] Step S301, if the current level mode is the first level mode, start the first operating system according to the first level mode; the first operating system is configured with a timer, and the timer is triggered to run after the first operating system is started.

[0071] Exemplarily, when the number of abnormal resets is within a first preset range, the switch is controlled to enter the first-level mode, and the SWOS system is started according to the first-level mode. The SWOS system includes a hardware adaptation module, a network service module, a configuration interface module, a layer 2 protocol module, a layer 3 protocol module, a WEB module, a network management protocol module, a CLI module, etc.

[0072] Exemplarily, when the SWOS system is successfully started, the operation timer is triggered, and the timer continuously monitors whether an abnormal reset occurs during the period, and the number of abnormal resets. It is worth noting that the time of the timer can be flexibly adjusted according to the operation of the switch.

[0073] For example, the current SWOS system startup option is to start the entire SWOS system application set by calling app.sh through the startup script init.sh. That is, when the number of abnormal resets rb_counter <= 5, the entire SWOS system can be started by calling app.sh.

[0074] Step S302: If the current level mode is the secondary mode, the core module is started and operated according to the secondary mode, and the core module is triggered to run by calling a startup script.

[0075] Exemplarily, when the number of abnormal resets is within the second preset range, the control switch enters the secondary mode. In the secondary mode, only the core module is started. It is worth noting that the core module includes: hardware adaptation module, network service module, configuration interface module, CLI module, and adopts the factory default configuration, retaining telnet, serial port access, etc.

[0076] Exemplarily, when the number of abnormal resets rb_counter>5, app_diag.sh is called to enter the secondary mode and start the core module of the SWOS system.

[0077] Step S303: if the current level mode is the third level mode, start and run the second operating system according to the third level mode, where the second operating system is an embedded system.

[0078] Exemplarily, when the number of abnormal resets is within the third preset range, the switch is controlled to enter the third-level mode, and the Linux system is started and operated according to the third-level mode, that is, in the third-level mode, only the Linux operating system is started, only the serial port access is retained, and only the Linux shell command line interface is operable. In other implementations, the second operating system can also be FreeRTOS, VxWorks, etc.

[0079] For example, when the number of abnormal resets rb_counter>8, the application startup script is not called, and the Linux shell command line interface is directly entered.

[0080] The startup method of the switch in the embodiment of the present application is realized by limiting the startup of the first operating system in the first-level mode, starting only the core module in the second-level mode, and starting only the second operating system in the third-level mode, thereby starting the appropriate system according to the level mode, thereby ensuring appropriate management and upgrade operations at different levels and improving the stability and reliability of the switch.

[0081] In an optional embodiment, in step S301, after starting the first operating system according to the first-level mode, the process further includes:

[0082] Determine the abnormal reset state of the first operating system within a preset time period; when the abnormal reset state of the first operating system within the preset time period is a first state, reset the abnormal reset count.

[0083] For example, the timer is set to run for 5 minutes. After the SWOS system is started, the 5-minute timer is triggered, and then the abnormal reset status within 5 minutes is obtained. If no abnormal reset occurs within 5 minutes, the SWOS system is considered to be in the first state, which is a normal state. Otherwise, it is considered to be in the second state, which is an abnormal state. Then, after 5 minutes, the number of abnormal resets in the reboot_record file in the flash is cleared to zero, that is, the number of abnormal resets is reset and restored to the initial state to prevent false alarms or error counts caused by multiple resets in a short period of time. It is worth noting that the time of the timer can be flexibly adjusted according to the operation of the switch.

[0084] For example, "flash" usually refers to a non-volatile storage medium used to store operating systems, applications, configuration data, etc. The "reboot_record" file is usually a log file used to store information about the reason for the system restart, timestamps, and possible abnormal bit counts. In other words, every time the abnormal reset count increases, it will be stored in the "reboot_record" file in the flash.

[0085] The switch startup method of the embodiment of the present application helps to improve the reliability and stability of the switch system by reasonably configuring the first operating system and the timer, ensuring that the switch system can execute tasks according to a predetermined plan, so that the switch can start the appropriate system according to the level mode in different situations, and ensure appropriate management and upgrade operations at different levels.

[0086] In an optional embodiment, in step S301, after starting the core module running in the first operating system according to the secondary mode, the process further includes:

[0087] Determine the abnormal reset state of the core module within a preset period of time; when the abnormal reset state of the core module within the preset period of time is a first state, reset the number of abnormal reset times.

[0088] Exemplarily, the abnormal reset state of the core module within 5 minutes is obtained. If no abnormal reset occurs within 5 minutes, it is considered to be in the first state, which is a normal state. Otherwise, it is considered to be in the second state, which is an abnormal state. If no abnormal reset occurs, the number of abnormal resets in the reboot_record file in the flash is cleared after five minutes to restore to the initial state. It is worth noting that the timer can be flexibly adjusted according to the operation of the switch.

[0089] For example, you can use the "show abnormal reboot counter command" to clear and query the number of abnormal resets; you can also use the "clear abnormal reboot counter" command to clear the number of abnormal resets without entering the second-level mode or the third-level mode.

[0090] The switch startup method of the embodiment of the present application determines whether to reset the number of abnormal reset times according to the abnormal reset state of the core module within a preset time period, so as to realize flexible control and management and maintenance of the switch system, so that the switch can start the appropriate system according to the level mode in different situations, ensure appropriate management and upgrade operations at different levels, and improve the stability and reliability of the switch.

[0091] In an optional embodiment, when determining the abnormal reset state of the first operating system within a preset period of time, the method further includes:

[0092] When the abnormal reset state of the first operating system is the second state within a preset period of time, the number of abnormal resets is accumulated, and a corresponding level mode is entered according to the number of abnormal resets; the corresponding level modes include a first level mode, a second level mode and a third level mode.

[0093] For example, if an abnormal reset occurs within 5 minutes after the SWOS system is started, and it occurs multiple times, it may be a reset command issued by the user, or the SWOS system is abnormal. At this time, the SWOS system is considered to be in the second state, and the second state is an abnormal state. In the abnormal state, the number of abnormal resets is not cleared, and the count continues to increase, and it automatically enters the first mode, the second mode, or the third mode according to the number of abnormal resets.

[0094] The startup method of the switch in the embodiment of the present application stipulates that when the first operating system is in the abnormal reset state and the second state, the number of abnormal resets needs to be accumulated to control the switch to enter the corresponding first-level mode, second-level mode or third-level mode according to the number of abnormal resets, so that the switch can start the appropriate system according to the level mode in different situations, ensuring appropriate management and upgrade operations at different levels, and improving the stability and reliability of the switch.

[0095] In an optional embodiment, when determining the abnormal reset state of the core module within a preset period of time, the method further includes:

[0096] When the abnormal reset state of the core module within the preset time period is the second state, the number of abnormal resets is accumulated, and the corresponding level mode is entered according to the number of abnormal resets; the corresponding level modes include the first level mode, the second level mode and the third level mode.

[0097] For example, when the core module of the SWOS system has 12 abnormal resets within 5 minutes, the SWOS system is considered to be in the second state, which is an abnormal state. The switch is controlled to enter the third-level mode based on the number of abnormal resets, only the Linux system is started, serial port access is retained, and only the Linux shell command line interface is operable.

[0098] The startup method of the switch in the embodiment of the present application stipulates that when the core module is started, when the number of abnormal resets is in the second state, the number of abnormal resets needs to be accumulated to control the switch to enter the corresponding first-level mode, second-level mode or third-level mode according to the number of abnormal resets, so that the switch can start the appropriate system according to the level mode in different situations, ensure appropriate management and upgrade operations at different levels, and improve the stability and reliability of the switch.

[0099] The present application also proposes a switch startup device, such as Figure 5 As shown, the starting device includes:

[0100] The data acquisition module 51 is used to read the currently stored abnormal reset times;

[0101] A control module 52, configured to control the switch to enter a level mode corresponding to the range according to the range to which the number of abnormal resets belongs;

[0102] The starting module 53 is used to start according to the starting mechanism corresponding to the current level mode according to the level mode currently entered.

[0103] Optionally, the control module includes:

[0104] A primary mode control unit, configured to control the switch to enter a primary mode when the number of abnormal resets is within a first preset range;

[0105] A secondary mode control unit, configured to control the switch to enter the secondary mode when the number of abnormal resets is within a second preset range;

[0106] The three-level mode control unit is used to control the switch to enter the three-level mode when the number of abnormal reset times is within a third preset range; wherein the number of abnormal reset times within the first preset range, the second preset range, and the third preset range increases in sequence.

[0107] Optionally, the startup module includes:

[0108] A first level mode starting unit, configured to start and run a first operating system according to the first level mode if the current level mode is the first level mode; the first operating system is configured with a timer, and the timer is triggered to run after the first operating system is started;

[0109] A secondary mode start unit is used to start the core module according to the secondary mode if the current level mode is the secondary mode, and the core module is triggered to run by calling a startup script;

[0110] The third-level mode starting unit is used to start and run a second operating system according to the third-level mode if the current level mode is the third-level mode, and the second operating system is an embedded system.

[0111] Optionally, the startup module further includes:

[0112] The abnormal reset state judgment unit is used to judge the abnormal reset state of the first operating system within a preset time period; when the abnormal reset state of the first operating system within the preset time period is the first state, the abnormal reset number is reset.

[0113] Optionally, the startup module further includes:

[0114] The abnormal reset times resetting unit is used to determine the abnormal reset state of the core module within the preset time period; when the abnormal reset state of the core module within the preset time period is the first state, reset the abnormal reset times.

[0115] Optionally, the abnormal reset state judgment unit further includes:

[0116] The abnormal reset times accumulation subunit is used to accumulate the abnormal reset times when the abnormal reset state of the first operating system is the second state within the preset time period, and enter the corresponding level mode according to the abnormal reset times; the corresponding level mode includes the first level mode, the second level mode and the third level mode.

[0117] Optionally, the abnormal reset number resetting unit further includes:

[0118] The mode selection subunit is used to accumulate the number of abnormal reset times when the abnormal reset state of the core module within the preset time period is the second state, and enter the corresponding level mode according to the number of abnormal reset times; the corresponding level mode includes the first level mode, the second level mode and the third level mode.

[0119] It can be understood that the device of this embodiment corresponds to a method for starting a switch in the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.

[0120] The present application also provides a switch device. Exemplarily, the switch device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the switch device to execute the above-mentioned switch startup method or the functions of each module in the above-mentioned startup device.

[0121] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0122] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.

[0123] The present application also provides a computer-readable storage medium for storing the computer program used in the above-mentioned terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0124] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0125] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0126] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.

[0127] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A method for starting a switch, characterized in that: The startup method comprises: Read the currently stored abnormal reset times; According to the range to which the number of abnormal resets belongs, controlling the switch to enter a level mode corresponding to the range; According to the level mode currently entered, start according to the start mechanism corresponding to the current level mode.

2. The switch startup method according to claim 1, characterized in that: According to the range to which the number of abnormal resets belongs, controlling the switch to enter a level mode corresponding to the range includes: When the number of abnormal resets is within a first preset range, controlling the switch to enter a first-level mode; When the number of abnormal resets is within a second preset range, controlling the switch to enter a secondary mode; When the number of abnormal reset times is within a third preset range, the switch is controlled to enter a three-level mode; wherein the number of abnormal reset times within the first preset range, the second preset range, and the third preset range increases in sequence.

3. The switch startup method according to claim 1, characterized in that: The starting according to the currently entered level mode and the starting mechanism corresponding to the current level mode also includes: If the current level mode is the first level mode, start and run the first operating system according to the first level mode; the first operating system is configured with a timer, and the timer is triggered to run after the first operating system is started; If the current level mode is the secondary mode, the core module is started and operated according to the secondary mode, and the core module is triggered to run by calling the startup script; If the current level mode is the third level mode, the second operating system is started and run according to the third level mode, and the second operating system is an embedded system.

4. The switch startup method according to claim 3, characterized in that: After starting the first operating system according to the first-level mode, the method further includes: Determine the abnormal reset state of the first operating system within a preset time period; when the abnormal reset state of the first operating system within the preset time period is a first state, reset the abnormal reset count.

5. The switch startup method according to claim 3, characterized in that: After starting the core module running in the first operating system according to the secondary mode, the method further includes: Determining the abnormal reset state of the core module within the preset time period; When the abnormal reset state of the core module within the preset time period is the first state, the abnormal reset times are reset.

6. The method for starting a switch according to claim 4, characterized in that: The determining of the abnormal reset state of the first operating system within a preset period of time further includes: When the abnormal reset state of the first operating system is the second state within the preset time period, the abnormal reset times are accumulated and a corresponding level mode is entered according to the abnormal reset times; the corresponding level mode includes the first level mode, the second level mode and the third level mode.

7. The switch startup method according to claim 5, characterized in that: When determining the abnormal reset state of the core module within the preset time period, the method further includes: When the abnormal reset state of the core module within the preset time period is the second state, the number of abnormal resets is accumulated, and the corresponding level mode is entered according to the number of abnormal resets; the corresponding level mode includes the first level mode, the second level mode and the third level mode.

8. A switch startup device, characterized in that: The starting device comprises: A data acquisition module is used to read the number of abnormal resets currently stored; A control module, configured to control the switch to enter a level mode corresponding to the range to which the abnormal reset times belong according to the range to which the abnormal reset times belong; The startup module is used to start according to the startup mechanism corresponding to the current level mode according to the level mode currently entered.

9. A switch device, characterized in that: The switch device comprises a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the switch startup method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The device stores a computer program, which, when executed on a processor, implements the method for starting a switch according to any one of claims 1 to 7.