Network device configuration loading method, apparatus, device, medium and program product
By acquiring and judging the preset configuration command set on a module-by-module basis, loading the basic command set and generating the target configuration command set, the compatibility problem during network device software version upgrades is solved, the success rate and reliability of configuration loading are improved, and the maintenance burden is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN FS COM TECHNOLOGY CO LTD
- Filing Date
- 2026-05-28
- Publication Date
- 2026-07-14
AI Technical Summary
When network devices undergo software version upgrades, differences in command-line syntax, parameters, and function support between the new and old versions can lead to incompatibility in configuration loading, resulting in configuration loss, function failure, and increased maintenance burden.
By obtaining the preset configuration command set for each functional module, assessing compatibility, loading the basic command set, and generating the target configuration command set, the core functions are ensured to be available, thus improving compatibility and reliability.
It improves the success rate and reliability of network device configuration loading, reduces the operational and maintenance burden, and ensures the stable operation of network devices.
Smart Images

Figure CN122395048A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of communications, and in particular relates to a network device configuration loading method, apparatus, device, medium and program product. Background Technology
[0002] As networks continue to expand, network devices, such as switches, play a crucial role in data forwarding and control in enterprise, data center, and carrier networks. To fix vulnerabilities, improve performance, or add new features, the software versions of these network devices need to be upgraded and updated regularly.
[0003] When upgrading network device software, a large number of existing configuration command lines are typically loaded to quickly restore services after the update. However, differences in command line syntax, parameters, and feature support between different software versions often mean that the new version is not fully compatible with all configuration command lines from the older version. For example, during the upgrade, the new version may ignore incompatible command lines, resulting in the loss of a large amount of existing configuration. Users then need to manually reconfigure each line, leading to a long recovery period and a high risk of errors. Alternatively, although some configurations may be retained in the device, incompatible command lines may not take effect, causing corresponding functions to fail. Users still need to manually find alternative commands and perform secondary configuration. Therefore, this reduces the success rate and reliability of network device configuration loading and increases the operational burden. Summary of the Invention
[0004] The purpose of this application is to provide a network device configuration loading method, apparatus, device, medium, and program product that can solve the problems of low success rate and reliability of network device configuration loading and heavy maintenance burden in related technologies.
[0005] In a first aspect, embodiments of this application provide a network device configuration loading method, wherein the network device includes at least one functional module, and the method includes: in response to a configuration loading instruction for the network device, obtaining a preset configuration command set corresponding to each functional module; for each functional module, determining whether the preset configuration command set of the functional module meets compatibility conditions based on the executable command set of the functional module; if the preset configuration command set of the functional module does not meet compatibility conditions, loading a basic command set into the functional module; determining a target configuration command set of the functional module based on the preset configuration command set and the executable command set; and loading the target configuration command set into the functional module.
[0006] In one possible implementation of the first aspect, the aforementioned preset configuration command set includes at least one preset command entry. The determination of whether the preset configuration command set of a functional module satisfies compatibility conditions for each functional module, based on the executable command set of the functional module, includes: Determine the total number of preset command entries in all preset configuration command sets; If the total number of entries is less than the entry threshold, for each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module. If the total number of entries is greater than or equal to the entry threshold, set up a timed resource monitoring task to obtain the current resource usage of network devices in real time. When the current resource usage is less than the usage threshold, for each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module.
[0007] Optionally, in another possible implementation of the first aspect, when the current resource usage is less than the usage threshold, for each functional module, determining whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module includes: Given that the current resource usage is less than the usage threshold, obtain the priority of each functional module. Based on their respective priorities, the functional modules are sorted to determine their priority order. Based on priority, for each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions according to the executable command set of the functional module.
[0008] Optionally, in another possible implementation of the first aspect, the executable command set includes at least one executable command entry, and the determination of whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module for each functional module includes: For each functional module, calculate the first matching degree between each preset command entry in the preset configuration command set and each executable command entry in the executable command set; If any preset command entry has a first matching degree less than the first matching degree threshold with each executable command entry, it is determined that the preset configuration command set of the functional module does not meet the compatibility conditions. If for each preset command entry, there exists at least one executable command entry with a first matching degree greater than or equal to the first matching degree threshold, then the preset configuration command set of the functional module is determined to meet the compatibility conditions.
[0009] Optionally, in another possible implementation of the first aspect, the aforementioned preset configuration command set includes at least one preset command entry, the aforementioned executable command set includes at least one executable command entry, the aforementioned basic command set is a subset of the executable command set, the aforementioned target configuration command set includes at least one target configuration command, and the aforementioned determination of the target configuration command set of the functional module based on the preset configuration command set and the executable command set includes: Remove the base command set from the executable command set to obtain the updated executable command set; For each preset command entry, calculate the second matching degree between the preset command entry and each executable command entry in the updated executable command set; If at least one executable command entry has a second matching degree greater than the second matching degree threshold with a preset command entry, the executable command entry with the highest second matching degree with the preset command entry will be identified as the target configuration command. Each identified target configuration command is combined into a target configuration command set.
[0010] Alternatively, in another possible implementation of the first aspect, after loading the target configuration command set into the functional module, the method further includes: Check for any abnormal logs during the operation of each functional module; If there are abnormal logs in a functional module, delete the target configuration command set of the functional module and make the functional module run based on the basic command set.
[0011] Secondly, this application also provides a network device configuration loading apparatus. The network device includes at least one functional module. The apparatus includes: an acquisition module, configured to acquire a preset configuration command set corresponding to each functional module in response to a configuration loading instruction for the network device; a first determination module, configured to determine, for each functional module, whether the preset configuration command set of the functional module meets compatibility conditions based on the executable command set of the functional module; a first loading module, configured to load a basic command set to the functional module if the preset configuration command set of the functional module does not meet compatibility conditions; a second determination module, configured to determine a target configuration command set of the functional module based on the preset configuration command set and the executable command set; and a second loading module, configured to load the target configuration command set into the functional module.
[0012] In one possible implementation of the second aspect, the aforementioned preset configuration command set includes at least one preset command entry; correspondingly, the aforementioned first determining module includes: The first determining unit is used to determine the total number of preset command entries in all preset configuration command sets; The second determining unit is used to determine, for each functional module, whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module when the total number of entries is less than the entry threshold. The acquisition unit is used to set up a timed resource monitoring task when the total number of entries is greater than or equal to the entry threshold, so as to obtain the current resource usage of network devices in real time. The third determining unit is used to determine, for each functional module, whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module, when the current resource usage is less than the usage threshold.
[0013] Alternatively, in another possible implementation of the second aspect, the third determining unit described above is specifically used for: Given that the current resource usage is less than the usage threshold, obtain the priority of each functional module. Based on their respective priorities, the functional modules are sorted to determine their priority order. Based on priority, for each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions according to the executable command set of the functional module.
[0014] Optionally, in another possible implementation of the second aspect, the executable command set includes at least one executable command entry; correspondingly, the second or third determining unit is specifically used for: For each functional module, calculate the first matching degree between each preset command entry in the preset configuration command set and each executable command entry in the executable command set; If any preset command entry has a first matching degree less than the first matching degree threshold with each executable command entry, it is determined that the preset configuration command set of the functional module does not meet the compatibility conditions. If for each preset command entry, there exists at least one executable command entry with a first matching degree greater than or equal to the first matching degree threshold, then the preset configuration command set of the functional module is determined to meet the compatibility conditions.
[0015] Optionally, in another possible implementation of the second aspect, the preset configuration command set includes at least one preset command entry, the executable command set includes at least one executable command entry, the basic command set is a subset of the executable command set, and the target configuration command set includes at least one target configuration command; correspondingly, the second determining module includes: The removal unit is used to remove the base command set from the executable command set to obtain the updated executable command set. The first calculation unit is used to calculate the second matching degree between the preset command entry and each executable command entry in the updated executable command set for each preset command entry; The fourth determining unit is used to determine the executable command entry with the highest second matching degree with the preset command entry as the target configuration command when there is at least one executable command entry whose second matching degree with the preset command entry is greater than the second matching degree threshold. The combination unit is used to combine each determined target configuration command into a target configuration command set.
[0016] Alternatively, in another possible implementation of the second aspect, the network device configuration loading device further includes: The detection module is used to detect whether there are any abnormal logs during the operation of each functional module; The delete module is used to remove the target configuration command set of a functional module when there are abnormal logs in the functional module, and make the functional module run based on the basic command set.
[0017] Thirdly, this application also provides an electronic device. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement any of the implementations of the first aspect described above.
[0018] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the method of any of the implementations of the first aspect described above.
[0019] Fifthly, this application also provides a computer program product that, when run on an electronic device, causes the electronic device to execute any of the implementation methods of the first aspect described above.
[0020] The beneficial effects of this application embodiment compared with the prior art are as follows: by responding to the configuration loading command, the preset configuration command set is obtained for each functional module, and the compatibility of the preset configuration command set is judged according to the executable command set of each functional module. When the compatibility conditions are not met, the basic command set is loaded into the functional module to ensure that the core function of the functional module is available. Then, the compatible target configuration command set is determined and loaded into the functional module, which improves the success rate and reliability of network device configuration loading and reduces the maintenance burden. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic flowchart of a network device configuration loading method provided in an embodiment of this application; Figure 2 This is a schematic diagram illustrating the process of a network device configuration loading method provided in an embodiment of this application; Figure 3 This is a schematic diagram of the network device configuration loading device provided in the embodiments of this application; Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0023] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0024] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0025] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0026] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0027] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0028] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0029] As networks continue to expand, network devices, such as switches, play a crucial role in data forwarding and control in enterprise, data center, and carrier networks. To fix vulnerabilities, improve performance, or add new features, the software versions of these network devices need to be upgraded and updated regularly.
[0030] When upgrading network device software, a large number of existing configuration command lines are typically loaded to quickly restore services after the update. However, differences in command line syntax, parameters, and feature support between different software versions often mean that the new version is not fully compatible with all configuration command lines from the older version. For example, during the upgrade, the new version may ignore incompatible command lines, resulting in the loss of a large amount of existing configuration. Users then need to manually reconfigure each line, leading to a long recovery period and a high risk of errors. Alternatively, although some configurations may be retained in the device, incompatible command lines may not take effect, causing corresponding functions to fail. Users still need to manually find alternative commands and perform secondary configuration. Therefore, this reduces the success rate and reliability of network device configuration loading and increases the operational burden.
[0031] Based on this, this application provides a network device configuration loading method, apparatus, device, medium, and program product.
[0032] The network device configuration loading method, apparatus, device, medium, and program products provided in this application will be described in detail below with reference to the accompanying drawings.
[0033] Figure 1 The illustration shows a flowchart of a network device configuration loading method provided in an embodiment of this application.
[0034] Step 101: In response to the configuration loading instruction for the network device, obtain the preset configuration command set corresponding to each functional module.
[0035] Network devices can be electronic devices such as switches, routers, firewalls, wireless controllers, load balancers, and gateways, and can support function configuration and software version upgrades via command line or configuration files. A network device may include at least one functional module. Examples include, but are not limited to, Address Resolution Protocol (ARP) modules, Spanning Tree Protocol (STP) modules, Virtual LAN (VLAN) modules, Media Access Control (MAC) address table (MAC) modules, Dynamic Host Configuration Protocol (DIP) modules, Secure Shell Protocol (SIP) modules, Network Time Protocol (NTP) modules, and Static Routing modules.
[0036] The configuration loading command is a control signal that triggers the network device to begin executing configuration loading.
[0037] The preset configuration command set can be configured and saved by the user through command line or network management tools. Each functional module corresponds to one preset configuration command set. The preset configuration command set can be stored in the Flash memory or non-volatile random access memory of the network device. This storage area is independent of software version updates and will not be lost due to network device upgrades unless the user actively deletes or formats it.
[0038] In one example, the configuration loading instruction can be generated when the network device's software version is updated. Specifically, after the network device completes the software version download, verification, and installation process and finishes hardware loading, the system can automatically generate the configuration loading instruction.
[0039] In another example, configuration loading commands can also be sent by the user. For instance, when deploying new services, or after configuration changes, users can send configuration loading commands through the network device's management interface.
[0040] As one possible implementation, when a configuration loading instruction is detected, the preset configuration command set corresponding to each functional module can be read from the storage location of the preset configuration command set (such as the Flash memory or non-volatile random access memory of the network device) in response to the configuration loading instruction.
[0041] Step 102: For each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module.
[0042] The executable command set of a functional module refers to the complete set of legal command lines supported by the current software version (i.e., the new version) running on the network device for that functional module. The executable command set can be predefined and embedded by the network device manufacturer during the development of a new software version, and can be stored in the form of a command tree or command dictionary. It describes the configuration commands that the software version can recognize and execute, such as configuration command syntax, keywords, and parameter formats. The executable command set is typically stored in the form of a command tree or command dictionary.
[0043] As one possible implementation, for each functional module, the compatibility condition of the preset configuration command set can be determined based on the first matching degree between the preset configuration command set and the executable command set (detailed below).
[0044] Optionally, as the network scales up and the number of network devices surges, the number of configurations may become very large. In this case, the configuration loading process presents the following problems: complex modules in large-scale configurations occupy CPU and memory resources for extended periods; simple core modules (such as address resolution protocol modules, virtual LAN modules, media access control address table modules, and static routing modules) cannot obtain the necessary resources, leading to prolonged network device disconnection; and the configuration loading process is time-consuming, resulting in slow service recovery and impacting network transmission. Therefore, it is advisable to first determine the number of configurations in the current preset configuration command set and then adopt differentiated loading strategies based on the number of configurations. In this case, the preset configuration command set includes at least one preset command entry, and step 102 above may include: Step 1021: Determine the total number of preset command entries in all preset configuration command sets; Step 1022: If the total number of entries is less than the entry threshold, for each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module. Step 1023: If the total number of entries is greater than or equal to the entry threshold, set up a timed resource monitoring task to obtain the current resource usage of network devices in real time. Step 1024: When the current resource usage is less than the usage threshold, for each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module.
[0045] Steps 1021-1024 are explained in detail below.
[0046] The preset configuration command set of the functional module may include one or more preset command entries, and each preset command entry may be a specific command line.
[0047] For example, if the default configuration command set of the virtual LAN module is {"vlan 10", "nameEngineering"}, then the default command entries are "vlan 10" and "name Engineering".
[0048] In step 1021, after obtaining the preset configuration command set corresponding to each functional module, the total number of preset command entries contained in the preset configuration command set can be counted. Then, the total number of preset command entries of all functional modules is added together to obtain the total number of entries.
[0049] For example, if the default command entries for a virtual LAN module are "vlan 10" and "name Engineering", then the number of default command entries for the virtual LAN module is 2.
[0050] In step 1022, an entry threshold can be preset, which is used to distinguish the size of the configuration scale.
[0051] For example, the entry threshold can be set to 100 entries.
[0052] Next, when the total number of entries is less than the threshold, it indicates that the number of configurations is small (i.e., there are few preset command entries in the preset configuration command set), and the loading time is short. Even without considering the network device resource consumption, directly loading all the preset command entries will not have a significant impact on the network device resources. Therefore, we can directly execute the steps for each functional module, based on the executable command set of the functional module, to determine whether the preset configuration command set of the functional module meets the compatibility conditions, and the various steps after judging the compatibility conditions (e.g., steps 103-105).
[0053] In one example, the aforementioned executable command set includes at least one executable command entry. The step of "for each functional module, determining whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module" may include: Step 201: For each functional module, calculate the first matching degree between each preset command entry in the preset configuration command set and each executable command entry in the executable command set; Step 202: If any preset command entry has a first matching degree less than the first matching degree threshold with each executable command entry, determine that the preset configuration command set of the functional module does not meet the compatibility conditions. Step 203: If for each preset command entry, there exists at least one executable command entry with a first matching degree greater than or equal to the first matching degree threshold, then the preset configuration command set of the functional module is determined to meet the compatibility conditions.
[0054] Steps 201-203 will be explained in detail below.
[0055] The executable command set of a functional module may include one or more executable command entries. Each executable command entry may be a specific command line supported by the current software version in that functional module, and may be released with the software version.
[0056] For example, the executable command set of the Dynamic Host Configuration Protocol (DHCP) module can be shown in Table 1:
[0057] Each line in the executable command set is an executable command entry. The content within the <> in the executable command entry represents a parameter placeholder, which is not a keyword in the executable command entry, but a specific value that needs to be filled in by the user according to the actual configuration requirements.
[0058] In step 201, for each functional module, the first matching degree between each preset command entry in the preset configuration command set and each executable command entry in the executable command set is calculated.
[0059] As one possible implementation, each preset command entry in the preset configuration command set is traversed, and for each preset command entry, the first matching degree between the preset command entry and each executable command entry in the executable command set is calculated.
[0060] The first matching degree is calculated as follows: First, extract keywords from the preset command entries, that is, extract the content excluding <> from the preset command entries, and form a first keyword sequence according to the order of the extracted keywords in the preset command entries. Then, in the same way, extract keywords from each executable command entry in the executable command set, and form a second keyword sequence corresponding to each executable command entry. Next, match the keywords in the first keyword sequence sequentially from left to right with the keywords in the same position in each second keyword sequence, and count the number of times the keywords are the same in the same position; divide this number by the total number of keywords in the first keyword sequence to obtain the first matching degree between the preset command entry and each executable command entry. For example, if the first keyword sequence contains 8 keywords, and 7 are successfully matched position by position, then the first matching degree is 7 / 8 = 87.5%.
[0061] Through the above calculations, the first matching degree between each preset command entry in each functional module and all executable command entries of that functional module is obtained.
[0062] Next, steps 202 and 203 are executed. First, a first matching threshold is preset, for example, 100%.
[0063] It should be noted that the first matching degree thresholds listed above are merely illustrative. The higher the first matching degree threshold, the stricter the compatibility conditions. In actual use, the first matching degree threshold can be determined according to actual usage needs and specific usage scenarios, and this application embodiment does not limit this.
[0064] If, in this functional module, the first matching degree between any preset command entry and all executable command entries is less than the first matching degree threshold, it can be determined that the preset configuration command set of the functional module does not meet the compatibility conditions.
[0065] If for each preset command entry in the functional module, there exists at least one executable command entry with a first matching degree greater than or equal to the first matching degree threshold, then the preset configuration command set of the functional module is determined to meet the compatibility conditions.
[0066] For example, suppose the preset configuration command set of functional module A contains two preset command entries, namely preset command entry 1 and preset command entry 2. The executable command set of functional module A contains three executable command entries, namely executable command entry 1, executable command entry 2, and executable command entry 3. The first matching degree between preset command entry 1 and executable command entry 1 is 100%; the first matching degree between preset command entry 1 and executable command entry 2 is 0%; the first matching degree between preset command entry 1 and executable command entry 3 is 0%; the first matching degree between preset command entry 2 and executable command entry 1 is 0%; the first matching degree between preset command entry 2 and executable command entry 2 is 100%; and the first matching degree between preset command entry 2 and executable command entry 3 is 0%. For preset command entry 1, there exists an executable command entry 1 whose first matching degree is greater than or equal to the first matching degree threshold (100%); for preset command entry 2, there exists an executable command entry 2 whose first matching degree is greater than or equal to the first matching degree threshold (100%). Therefore, for each preset command entry in functional module A, there is an executable command entry whose first matching degree is greater than or equal to the first matching degree threshold. Thus, it is determined that the preset configuration commands of functional module A meet the compatibility conditions.
[0067] For example, suppose the preset configuration command set of functional module B contains two preset command entries, namely preset command entry 1 and preset command entry 2. The executable command set of functional module B contains three executable command entries, namely executable command entry 1, executable command entry 2, and executable command entry 3. The first matching degree between preset command entry 1 and executable command entry 1 is 100%; the first matching degree between preset command entry 1 and executable command entry 2 is 0%; the first matching degree between preset command entry 1 and executable command entry 3 is 0%; the first matching degree between preset command entry 2 and executable command entry 1 is 0%; the first matching degree between preset command entry 2 and executable command entry 2 is 0%; and the first matching degree between preset command entry 2 and executable command entry 3 is 0%. For preset command entry 1, there exists an executable command entry 1 whose first matching degree is greater than or equal to the first matching degree threshold (100%); for preset command entry 2, its first matching degree with each executable command entry is less than the first matching degree threshold (100%). Therefore, in this functional module B, the first matching degree between the preset command entry 2 and all executable command entries is less than the first matching degree threshold. Thus, it is determined that the preset configuration command of this functional module B does not meet the compatibility conditions.
[0068] Next, execute step 1023, when the total number of entries is greater than or equal to the entry threshold, set up a timed resource monitoring task to obtain the current resource usage of network devices in real time.
[0069] As one possible approach, when the total number of entries is greater than or equal to the entry threshold, it indicates that the current configuration scale to be processed is large. If compatibility condition judgment or configuration loading is performed directly, it may significantly impact the CPU and memory resources of the network device, thereby affecting the normal operation of the network device's core functions (such as protocol keep-alive and packet forwarding). Therefore, a timed resource monitoring task can be set up, that is, a resource monitoring task triggered at fixed time intervals can be created to obtain the current resource usage of the network device in real time.
[0070] As an example, a fixed time interval of 5 seconds can be set, with resource usage measured as CPU and memory utilization. After setting up the scheduled resource monitoring task, the CPU and memory utilization of the network device will be retrieved every 5 seconds.
[0071] The CPU and memory usage obtained at the current acquisition point can be used as the current resource usage between the current acquisition point and the next acquisition point.
[0072] In step 1024, firstly, an occupancy threshold can be preset.
[0073] As an example, when resource usage is measured as CPU utilization and memory utilization, thresholds can be set for each. For instance, the first threshold for CPU utilization could be 80%, and the second threshold for memory utilization could be 75%. When resource usage is measured as either CPU utilization or memory utilization, only one threshold needs to be set.
[0074] Next, if the current resource usage is less than the usage threshold, for each functional module, based on the executable command set of the functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions.
[0075] As one possible implementation, when the resource usage is CPU utilization and memory utilization, the above "current resource usage is less than the usage threshold" can be that the CPU utilization is less than the first usage threshold corresponding to the CPU utilization and the memory utilization is less than the second usage threshold corresponding to the memory utilization.
[0076] The specific implementation of the step "For each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module" can be referred to the description in the above embodiments, and will not be repeated here.
[0077] Optionally, if the current resource usage is greater than or equal to the usage threshold, the current process of loading network device configuration (including the process of determining whether the preset configuration command set of the functional module meets the compatibility conditions and the process of steps 103-105) can be paused until the current resource usage is less than the usage threshold, and then execution can continue from the current step.
[0078] The above method first counts the total number of preset command entries in the preset configuration command set, and then starts a timed resource monitoring task when the total number of entries is large. Compatibility judgment and subsequent configuration loading process are only executed when the current resource usage of the network device is lower than the usage threshold. This avoids CPU or memory overload caused by large-scale configuration processing and prevents the interruption of core device functions (such as protocol keep-alive and packet forwarding) due to resource contention. Thus, the configuration loading process is realized under the premise of ensuring the stable operation of the network device, improving the reliability, security and adaptability of the network device upgrade and configuration loading process.
[0079] In one example, high-priority modules (such as address resolution protocol modules, virtual LAN modules, static routing modules, and other core functional modules) can be prioritized for configuration loading. This allows for the restoration of critical network device capabilities under resource-constrained conditions, shortening device downtime, reducing the risk of service interruption due to configuration processing delays, and improving the reliability of the upgrade and configuration loading process. In this case, step 1204 above may include: Step 301: If the current resource usage is less than the usage threshold, obtain the priority of each functional module. Step 302: Sort the functional modules according to their priorities to determine the priority order of the functional modules; Step 303: According to priority order, for each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module.
[0080] Steps 301-303 will be explained in detail below.
[0081] In step 301, the priority of each functional module is preset.
[0082] For example, among the various functional modules of a network device, the Address Resolution Protocol (ARP) module, Spanning Tree Protocol (STP) module, Virtual LAN (VLAN) module, Media Access Control Address Table (MAC) module, Secure Shell Protocol (SAP) module, and Static Routing module have a priority of 1; the Dynamic Host Configuration Protocol (DHCP) module and Network Time Protocol (NAT) module have a priority of 2; and the logging module has a priority of 3.
[0083] Then, the functional modules are sorted according to their priority to determine their priority order. For functional modules with the same priority, their order can be randomized.
[0084] For example, the priority order of the various functional modules listed above can be as follows: Address Resolution Protocol module, Spanning Tree Protocol module, Virtual LAN module, Media Access Control Address Table module, Secure Shell Protocol module, Static Routing module, Dynamic Host Configuration Protocol module, Network Time Protocol module, and Logging module.
[0085] Next, in order of priority, starting with the highest-ranked functional module, it is determined whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module (for details, please refer to the above embodiment, which will not be repeated here).
[0086] In one example, for each functional module, based on the executable command set of the functional module, it can be determined whether the preset configuration command set of the functional module meets the compatibility conditions according to the priority order; if the preset configuration command set of the functional module does not meet the compatibility conditions, the basic command set is loaded into the functional module (detailed below); and the target configuration command set of the functional module is determined based on the preset configuration command set and the executable command set (detailed below); and the target configuration command set is loaded into the functional module (detailed below).
[0087] Step 103: If the preset configuration command set of the functional module does not meet the compatibility conditions, load the basic command set into the functional module.
[0088] The basic command set is a subset of the executable command set and may be released along with the executable command set during software upgrades. The basic command set of a functional module contains the minimum number of command entries necessary to ensure that the functional module can perform its core basic functions in a network device.
[0089] For example, the executable command set of the Dynamic Host Configuration Protocol (DMP) module is shown in Table 1 above, and the basic command set of the DMP module can be shown in Table 2:
[0090] As one possible approach, if the preset configuration command set of a functional module does not meet the compatibility requirements, a basic command set can be loaded into the functional module to ensure that the functional module can implement its core basic functions.
[0091] Optionally, to ensure that high-priority functional modules are loaded with the basic command set first, step 103 may include: obtaining the priority of each functional module corresponding to a preset configuration command set that does not meet the compatibility conditions; sorting each functional module according to its priority to determine the priority order of each functional module; and loading the basic command set to each functional module according to the priority order.
[0092] Optionally, step 103 may further include: loading the preset configuration command set into the functional module if the preset configuration command set of the functional module meets the compatibility conditions. In this embodiment, subsequent steps 104-105 do not need to be executed.
[0093] Step 104: Determine the target configuration command set for the functional module based on the preset configuration command set and the executable command set.
[0094] The target configuration command set is a subset of the executable command set, including some command lines from the executable command set.
[0095] As one possible implementation, after loading the basic command set into a functional module, the module already possesses basic operational capabilities. However, the preset configuration command set still contains a large number of unprocessed original configuration commands. Some of these commands may be compatible with the current software version, while others may be incompatible (not meeting compatibility requirements). To restore the user's original business configuration to the greatest extent possible while ensuring system stability, the preset configuration command set and the executable command set can be combined to generate the actual effective target configuration command set.
[0096] In one example, the aforementioned preset configuration command set includes at least one preset command entry, the aforementioned executable command set includes at least one executable command entry, the aforementioned base command set is a subset of the executable command set, the aforementioned target configuration command set includes at least one target configuration command, and the aforementioned step 104 may include: Step 501: Remove the base command set from the executable command set to obtain the updated executable command set; Step 502: For each preset command entry, calculate the second matching degree between the preset command entry and each executable command entry in the updated executable command set; Step 503: If at least one executable command entry has a second matching degree greater than the second matching degree threshold with the preset command entry, the executable command entry with the highest second matching degree with the preset command entry is determined as the target configuration command. Step 504: Combine each of the identified target configuration commands into a target configuration command set.
[0097] Steps 501-504 will be explained in detail below.
[0098] The target configuration command set includes one or more target configuration commands, and each target configuration instruction belongs to the executable command set.
[0099] In step 501, since the basic command set has already been loaded into the functional module, to avoid repeatedly loading the command line, the basic command set in the executable command set can be removed to obtain the updated executable command set.
[0100] For example, the executable command set of the Dynamic Host Configuration Protocol (DMP) module is shown in Table 1 above, and the basic command set of the DMP module is shown in Table 2. Therefore, the updated executable command set of the DMP module can be shown in Table 3.
[0101] Next, step 502 is executed, whereby for each preset command entry, the second matching degree between the preset command entry and each executable command entry in the updated executable command set is calculated.
[0102] The second matching degree is calculated as follows: First, extract keywords from the preset command entries, that is, extract the content excluding <> from the preset command entries, and convert the extracted keywords into keyword vectors. Then, arrange the keyword vectors according to the order of the corresponding keywords in the preset command entries to form a first keyword vector sequence. Next, in the same way, extract keywords from each executable command entry in the updated executable command set and form a second keyword vector sequence for each executable command entry. Then, perform sequential matching between each keyword vector in the first keyword vector sequence and the keyword vectors at the same position in each second keyword vector sequence, in order of left-to-right vector position. Count the number of keyword vectors whose vector similarity (e.g., cosine distance) at the same position is greater than a similarity threshold. Divide this number by the total number of keyword vectors in the first keyword vector sequence to obtain the second matching degree between the preset command entry and each executable command entry.
[0103] For example, the similarity threshold is 0.9. The default command entry is "set protocols dhcp server pool". <pool-name>range <range-name>high <ipv4-address>The executable command entry is "set protocolsdhcp server pool". <poo-name>range <range-name>low <ipv4-address>The keywords for the default command entries are "set", "protocols", "dhcp", "server", "pool", "range", and "high". The keywords for the executable command entries are "set", "protocols", "dhcp", "server", "pool", "range", and "low". The keywords corresponding to the keyword vectors with a similarity greater than 0.9 are "set", "protocols", "dhcp", "server", "pool", and "range", totaling 6. Since the default command entries contain 7 keywords, the second matching degree is 6 / 7 = 85.7% (rounded to one decimal place).
[0104] Next, if an executable command entry has a second matching degree greater than a preset second matching degree threshold with a preset command entry, then the executable command entry with the highest second matching degree with the preset command entry is determined as the target configuration command. If no executable command entry has a second matching degree greater than the preset second matching degree threshold with a preset command entry, then the preset command entry is ignored, and a configuration failure log corresponding to the preset command entry is generated.
[0105] For example, the second matching threshold is 80%. Assume that the preset configuration command set of functional module C contains two preset command entries, preset command entry 4 and preset command entry 5. The updated executable command set of functional module C contains two executable command entries, executable command entry 6 and executable command entry 7. The second matching degree between preset command entry 4 and executable command entry 6 is 85%; the second matching degree between preset command entry 4 and executable command entry 7 is 80%; the second matching degree between preset command entry 5 and executable command entry 6 is 60%; and the second matching degree between preset command entry 5 and executable command entry 7 is 30%. For preset command entry 4, there are executable command entries 6 and 7 whose second matching degree is greater than the second matching threshold, and executable command entry 7 has the highest second matching degree with preset command entry 4. Therefore, executable command entry 7 is identified as the target configuration command. For preset command entry 5, there is no executable command entry whose second matching degree is greater than the second matching threshold. Therefore, preset command entry 5 does not have a corresponding target configuration command and is ignored.
[0106] Then, step 504 is executed, which combines each target configuration command determined based on all preset command entries of the functional module into a target configuration command set.
[0107] For example, in the example above, the target configuration command determined by the preset command entry 4 is the executable command entry 7. Since the preset command entry 5 does not have a corresponding target configuration command, the target configuration command set only includes the executable command entry 7.
[0108] Step 105: Load the target configuration command set into the functional module.
[0109] One possible implementation is to load each target configuration command from the target configuration command set into its corresponding functional module. This allows the functional module to not only possess the basic functional capabilities provided by the base command set, but also the user-customized configuration restored by the target configuration command set.
[0110] Optionally, after loading the target configuration command set, although all loaded command lines originate from executable command sets (i.e., syntactically compatible with the current software version), command lines may still cause exceptions in the actual operating environment for various reasons. For example, the target configuration command set determined based on its matching degree with preset command entries, although syntactically correct, may have semantic deviations from the user's original intent (i.e., the preset configuration command set), causing the functionality of the functional module to fail to meet expectations; or, combinations of certain command lines may produce unexpected interactive effects, such as resource conflicts or protocol oscillations caused by two originally compatible command lines taking effect simultaneously. These exceptions typically do not trigger errors instantaneously during command loading, but rather appear in the system logs after the network device has been running continuously for a period of time. Without exception handling, this may lead to poor stability of the functional module and abnormal network device configuration. Therefore, exception detection can be performed on the exception logs of the functional module to improve the stability of network device configuration loading. At this point, after step 105, the following may also be included: Step 601: Check whether there are any abnormal logs during the operation of each functional module; Step 602: If there are abnormal logs in the functional module, delete the target configuration command set of the functional module and make the functional module run based on the basic command set.
[0111] As one possible implementation, a log detection timer can be started during the operation of the functional modules. The log detection timer can periodically identify the operation logs of each functional module to detect whether there are any abnormal logs in the operation logs.
[0112] As an example, the log detection timer duration can be set to 24 hours, meaning that abnormal logs will be detected within 24 hours after the target configuration command set is loaded into the functional module and the functional module starts running. The timer interval can be set to 15 minutes. During each detection cycle within the 24-hour period, log entries in the network device's runtime log buffer are read, and log entries of the functional module containing the target configuration command set are filtered out based on the functional module identifier in the log entries.
[0113] Next, the preset error fields in the filtered log entries are checked. If a log entry contains a preset error field, it is determined to be an abnormal log. Then, based on the functional module identifier in the abnormal log, the corresponding functional module is determined, and the target configuration command set in that functional module is deleted, so that the functional module runs the core basic functions based on the basic command set.
[0114] For example, the default error field can be "error", "warning", etc. When "error" or "warning" is present in a log entry, the log entry is determined to be an abnormal log.
[0115] In addition, after deleting the target configuration command set of a functional module, a log alarm can be generated and sent to the operations and maintenance personnel to notify them to manually intervene in the configuration of the functional module.
[0116] For example, log alerts can include the identifier of the functional module corresponding to the exception log and the exception log itself.
[0117] The following is combined with Figure 2 This application describes a specific process of the network device configuration loading method provided in the embodiments. This process includes, but is not limited to, the following steps 1 to 18.
[0118] Step 1: Obtain the preset configuration command set for each functional module, then proceed to Step 2; Step 2: Determine the total number of preset command entries in the preset configuration command set of all functional modules, and proceed to Step 3; Step 3: Determine if the total number of items is less than the item threshold. If yes, proceed to step 9; otherwise, proceed to step 4. Step 4: Periodically obtain the current CPU usage and memory usage of the network device, then proceed to Step 5; Step 5: Determine if the current CPU utilization is less than the first utilization threshold and the current memory utilization is less than the second utilization threshold. If yes, proceed to step 7; otherwise, proceed to step 6. Step 6: Pause configuration loading and proceed to step 4; Step 7: Determine the priority order of each functional module, then proceed to Step 8; Step 8: Configure and load each functional module according to priority, then proceed to step 10; Step 9: Configure and load each functional module directly, then proceed to Step 10; Step 10: For each functional module, determine whether its preset configuration command set meets the compatibility conditions. If yes, proceed to step 11; otherwise, proceed to step 12. Step 11: Load the preset configuration command set into this functional module; Step 12: Load the basic command set into this functional module, then proceed to Step 13; Step 13: Determine the target configuration command set for this functional module, then proceed to Step 14; Step 14: Load the target configuration command set into the functional module, then proceed to Step 15; Step 15: Start the log detection timer and proceed to Step 16; Step 16: Determine if there are any exception logs in each functional module. If yes, proceed to step 17; otherwise, proceed to step 19. Step 17: Delete the target configuration command set of the functional module with abnormal logs and retain the basic command set, then proceed to Step 18; Step 18: Generate log alerts, proceed to step 19; Step 19: Continue testing until the timer expires.
[0119] The network device configuration loading method provided in this application embodiment obtains a preset configuration command set for each functional module in response to a configuration loading command. It then performs a compatibility judgment on the preset configuration command set based on the executable command set of each functional module. If the compatibility conditions are not met, a basic command set is loaded into the functional module to ensure that the core functions of the functional module are available. Finally, a compatible target configuration command set is determined and loaded into the functional module. This improves the success rate and reliability of network device configuration loading and reduces the maintenance burden.
[0120] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0121] Corresponding to the network device configuration loading method in the above embodiment, Figure 3 A structural block diagram of a network device configuration loading apparatus provided in an embodiment of this application is shown. For ease of explanation, only the parts related to the embodiment of this application are shown.
[0122] Reference Figure 3 The device 30 includes: The acquisition module 31 is used to acquire the preset configuration command set corresponding to each functional module in response to the configuration loading command of the network device; The first determining module 32 is used to determine, for each functional module, whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module. The first loading module 33 is used to load the basic command set into the functional module when the preset configuration command set of the functional module does not meet the compatibility conditions. The second determining module 34 is used to determine the target configuration command set of the functional module based on the preset configuration command set and the executable command set; The second loading module 35 is used to load the target configuration command set into the functional module.
[0123] The network device configuration loading device provided in this application embodiment obtains a preset configuration command set for each functional module in response to a configuration loading command. It then performs a compatibility judgment on the preset configuration command set based on the executable command set of each functional module. If the compatibility conditions are not met, it loads the basic command set into the functional module to ensure that the core functions of the functional module are available. Finally, it determines the compatible target configuration command set and loads the target configuration command set into the functional module. This improves the success rate and reliability of network device configuration loading and reduces the maintenance burden.
[0124] Optionally, the aforementioned preset configuration command set includes at least one preset command entry; correspondingly, the aforementioned first determining module 32 includes: The first determining unit is used to determine the total number of preset command entries in all preset configuration command sets; The second determining unit is used to determine, for each functional module, whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module when the total number of entries is less than the entry threshold. The acquisition unit is used to set up a timed resource monitoring task when the total number of entries is greater than or equal to the entry threshold, so as to obtain the current resource usage of network devices in real time. The third determining unit is used to determine, for each functional module, whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module, when the current resource usage is less than the usage threshold.
[0125] Optionally, the third determining unit mentioned above is specifically used for: Given that the current resource usage is less than the usage threshold, obtain the priority of each functional module. Based on their respective priorities, the functional modules are sorted to determine their priority order. Based on priority, for each functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions according to the executable command set of the functional module.
[0126] Optionally, the aforementioned set of executable commands includes at least one executable command entry; correspondingly, the aforementioned second or third determining unit is specifically used for: For each functional module, calculate the first matching degree between each preset command entry in the preset configuration command set and each executable command entry in the executable command set; If any preset command entry has a first matching degree less than the first matching degree threshold with each executable command entry, it is determined that the preset configuration command set of the functional module does not meet the compatibility conditions. If for each preset command entry, there exists at least one executable command entry with a first matching degree greater than or equal to the first matching degree threshold, then the preset configuration command set of the functional module is determined to meet the compatibility conditions.
[0127] Optionally, the aforementioned preset configuration command set includes at least one preset command entry, the aforementioned executable command set includes at least one executable command entry, the aforementioned basic command set is a subset of the executable command set, and the aforementioned target configuration command set includes at least one target configuration command; correspondingly, the aforementioned second determining module 34 includes: The removal unit is used to remove the base command set from the executable command set to obtain the updated executable command set. The first calculation unit is used to calculate the second matching degree between the preset command entry and each executable command entry in the updated executable command set for each preset command entry; The fourth determining unit is used to determine the executable command entry with the highest second matching degree with the preset command entry as the target configuration command when there is at least one executable command entry whose second matching degree with the preset command entry is greater than the second matching degree threshold. The combination unit is used to combine each determined target configuration command into a target configuration command set.
[0128] Optionally, the network device configuration loading device 30 further includes: The detection module is used to detect whether there are any abnormal logs during the operation of each functional module; The delete module is used to remove the target configuration command set of a functional module when there are abnormal logs in the functional module, and make the functional module run based on the basic command set.
[0129] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0130] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0131] To implement the above embodiments, this application also proposes an electronic device.
[0132] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application.
[0133] like Figure 4 As shown, the above-mentioned electronic device 200 includes: The device includes a memory 210 and at least one processor 220, and a bus 230 connecting different components (including the memory 210 and the processor 220). The memory 210 stores a computer program, which, when executed by the processor 220, implements the network device configuration loading method described in this application embodiment.
[0134] Bus 230 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0135] Electronic device 200 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by electronic device 200, including volatile and non-volatile media, removable and non-removable media.
[0136] Memory 210 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 240 and / or cache memory 250. Electronic device 200 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 260 may be used to read and write non-removable, non-volatile magnetic media (… Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 230 via one or more data media interfaces. Memory 210 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.
[0137] A program / utility 280 having a set (at least one) of program modules 270 may be stored in, for example, memory 210. Such program modules 270 include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 270 typically perform the functions and / or methods described in the embodiments of this application.
[0138] Electronic device 200 can also communicate with one or more external devices 290 (e.g., keyboard, pointing device, display 291, etc.), and with one or more devices that enable a user to interact with electronic device 200, and / or with any device that enables electronic device 200 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 292. Furthermore, electronic device 200 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 293. As shown, network adapter 293 communicates with other modules of electronic device 200 via bus 230. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0139] The processor 220 performs various functional applications and data processing by running programs stored in the memory 210.
[0140] It should be noted that the implementation process and technical principles of the electronic device in this embodiment are explained in the foregoing description of the network device configuration loading method in the embodiments of this application, and will not be repeated here.
[0141] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0142] This application provides a computer program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.
[0143] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographic device / electronic device, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0144] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0145] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0146] In the embodiments provided in this application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0147] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0148] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for loading network device configuration, characterized in that, The network device includes at least one functional module, and the method includes: In response to the configuration loading command for the network device, obtain the preset configuration command set corresponding to each of the functional modules; For each of the functional modules, based on the executable command set of the functional module, determine whether the preset configuration command set of the functional module meets the compatibility conditions; If the preset configuration command set of the functional module does not meet the compatibility conditions, the basic command set is loaded into the functional module. Based on the preset configuration command set and the executable command set, determine the target configuration command set of the functional module; Load the target configuration command set into the functional module.
2. The method as described in claim 1, characterized in that, The preset configuration command set includes at least one preset command entry. For each functional module, determining whether the preset configuration command set of the functional module meets compatibility conditions based on the executable command set of the functional module includes: Determine the total number of preset command entries in all the preset configuration command sets; If the total number of entries is less than the entry threshold, for each functional module, based on the executable command set of the functional module, determine whether the preset configuration command set of the functional module meets the compatibility condition; If the total number of entries is greater than or equal to the entry threshold, a timed resource monitoring task is set to obtain the current resource usage of the network device in real time. When the current resource usage is less than the usage threshold, for each functional module, based on the executable command set of the functional module, it is determined whether the preset configuration command set of the functional module meets the compatibility condition.
3. The method as described in claim 2, characterized in that, When the current resource usage is less than the usage threshold, for each functional module, determining whether the preset configuration command set of the functional module meets the compatibility condition based on the executable command set of the functional module includes: If the current resource usage is less than the usage threshold, obtain the priority corresponding to each of the functional modules. According to their respective priorities, the functional modules are sorted to determine their priority order. According to the priority order, for each functional module, based on the executable command set of the functional module, it is determined whether the preset configuration command set of the functional module meets the compatibility conditions.
4. The method as described in any one of claims 2 or 3, characterized in that, The executable command set includes at least one executable command entry. For each functional module, determining whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module includes: For each of the aforementioned functional modules, calculate the first matching degree between each of the preset command entries in the preset configuration command set and each of the executable command entries in the executable command set; If the first matching degree between any of the preset command entries and each of the executable command entries is less than the first matching degree threshold, it is determined that the preset configuration command set of the functional module does not meet the compatibility condition. If, for each preset command entry, there exists at least one executable command entry whose first matching degree with the preset command entry is greater than or equal to the first matching degree threshold, then the preset configuration command set of the functional module is determined to satisfy the compatibility condition.
5. The method as described in claim 1, characterized in that, The preset configuration command set includes at least one preset command entry, the executable command set includes at least one executable command entry, the base command set is a subset of the executable command set, and the target configuration command set includes at least one target configuration command. Determining the target configuration command set of the functional module based on the preset configuration command set and the executable command set includes: Remove the base command set from the executable command set to obtain the updated executable command set; For each of the preset command entries, calculate the second matching degree between the preset command entry and each of the executable command entries in the updated executable command set; If at least one of the executable command entries has a second matching degree greater than the second matching degree threshold with the preset command entry, the executable command entry with the highest second matching degree with the preset command entry is determined as the target configuration command; Each of the identified target configuration commands is combined into the target configuration command set.
6. The method as described in any one of claims 1-3 or 5, characterized in that, After loading the target configuration command set into the functional module, the method further includes: Check whether there are any abnormal logs during the operation of each of the aforementioned functional modules; If the functional module has abnormal logs, delete the target configuration command set of the functional module and make the functional module run based on the basic command set.
7. A network device configuration loading device, characterized in that, The network device includes at least one functional module, and the apparatus includes: The acquisition module is used to acquire the preset configuration command set corresponding to each of the functional modules in response to the configuration loading instruction for the network device; The first determining module is used to determine, for each of the functional modules, whether the preset configuration command set of the functional module meets the compatibility conditions based on the executable command set of the functional module; The first loading module is used to load a basic command set into the functional module when the preset configuration command set of the functional module does not meet the compatibility conditions. The second determining module is used to determine the target configuration command set of the functional module based on the preset configuration command set and the executable command set. The second loading module is used to load the target configuration command set into the functional module.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it causes the electronic device to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by an electronic device, it implements the method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, Includes a computer program that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1-6.