Online debugging method and system for dynamically acquiring and analyzing device information by configuring CLI command, electronic device, and storage medium
Through the online analysis and generation of atomic capabilities of TextFSM, the problem of inefficient collection of equipment information by SDN controllers is solved, fast response and efficient equipment monitoring are achieved, and fault diagnosis and monitoring capabilities of network equipment are improved.
Patent Information
- Application Number
- PCT/CN2024/133381
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-27
- Filing Date
- 2024-11-21
- Publication Date
- 2025-07-03
AI Technical Summary
In the prior art In operator network communication, the SDN controller collects equipment information process is inefficient and inflexible. The manual operation and maintenance mode of the integrated merchant is limited by the engineer level and efficiency, resulting in a slow response and may cause losses to customer business.
TextFSM is used for parsing, templates are generated and stored, and regular scripts are debugged online, device information is automatically collected, atomic capabilities are generated, interface publishing and real-time data processing are realized.
It realizes online debugging, online release, and rapid response, improves equipment information collection efficiency, supports the use of multiple service modules, and improves the fault diagnosis and monitoring capabilities of network equipment.
Smart Images

Figure CN2024133381_03072025_PF_FP_ABST
Abstract
Description
An online debugging method, system, electronic device and storage medium for configuring CLI commands to dynamically collect and analyze device information Technical Field
[0001] The present invention relates to the fields of communication technology and IP network technology, and in particular to an online debugging method, system, electronic device and storage medium for configuring CLI commands to dynamically collect and analyze device information. Background Art
[0002] In the field of operator network communications, there are two main ways to configure and control network equipment: the integrator manual operation and maintenance mode and the SDN controller mode.
[0003] Integrators typically use manual O&M (Manual Operations and Maintenance) to interact directly with devices using CLI commands to complete operations such as deployment, backbone trunk activation, service provisioning, and device upgrades and maintenance. However, this approach is significantly impacted by space and time constraints, as well as the technical expertise and work efficiency of network engineers. Failure to respond quickly to major faults can result in immeasurable losses to customer services.
[0004] When SDN controllers manage network devices, real-time device data is crucial for configuring them. Only by collecting, processing, and analyzing all device data in real time can they manage and control the devices more effectively. Traditionally, SDN controllers collected device information by analyzing the required data and then deriving the required CLI command set. Based on the CLI commands, they then developed a new interface for interacting with the device, conducted offline testing, and completed a series of software development steps before the interface was launched and operational. This approach was inefficient and inflexible.
[0005] CLI is the abbreviation of Command Line Interface. CLI interface is provided by all routers, TM (Termination Multiplexer), CM (Cable Modem) and other products such as CISCO, LUCENT, Arris, Huawei, etc. It is the standard for router products. Using CLI has the advantages of low usage requirements (only requires a serial port), ease of use, and convenient function expansion. Especially when there are many (such as 10) router devices that need to be configured, the COPY / PASTE function can be used to quickly complete the configuration of all routers without having to configure each one through IE.
[0006] TextFSM consists of two parts: text and FSM (finite state machine). It is an open source Python module developed by Google for parsing semi-formatted text. It is also designed specifically for the network. TextFSM was created to parse information from network devices driven by the CLI. Summary of the Invention
[0007] The purpose of the present invention is to provide an online debugging method, system, electronic device and storage medium for configuring CLI commands to dynamically collect and analyze device information, which can debug and analyze information content online on the page, realize online debugging, online publishing, immediate collection, and can be used flexibly to improve work efficiency.
[0008] To achieve the above object, the technical solution provided by the present invention is:
[0009] An online debugging method that configures CLI commands to dynamically collect and parse device information. The method parses TextFSM, renders the parsed results into templates, and stores them. The rendered templates are then parsed at a granular level to generate atomic capabilities for selection and assembly to obtain the required business scenario templates. The business scenario templates are then published through interfaces. When the business scenario templates are used, the method automatically collects device information for use in the business scenario by finding the CLI command set corresponding to the interface.
[0010] The TextFSM is obtained in the following process:
[0011] Write a CLI command based on the data information to be collected and select a device. Send the written CLI command to the selected device, collect the device's original string type information in real time, write a TextFSM based on the device's original string type information, perform regular script online parsing through TextFSM, and display the parsing results in real time. Perform syntax debugging on TextFSM based on the parsing results to meet the data information collection requirements.
[0012] To optimize the above technical solutions, specific measures / limitations adopted also include:
[0013] The specific process of parsing the TextFSM, rendering the parsing result into a template and storing it, performing granular parsing on the rendered template, and generating atomic capabilities is as follows:
[0014] (1) Perform deep recursive traversal of the variables in the written TextFSM expression to parse out the specific names of each variable and the related hierarchical relationships;
[0015] (2) After the CLI command is sent to the device, the device's original string type information collected is globally matched with the specific name of the variable obtained by parsing and the related hierarchical relationship, and the variable is assigned with the matched content. The assigned information is assembled into the JSON structure desired by the user through deep traversal;
[0016] (3) Parse the JSON structure into a hierarchical tree structure and store it in the database to obtain atomic capabilities that can be used in business scenarios.
[0017] The interface of the business scenario template is published. When the business scenario template is used, the device is automatically collected by finding the CLI command set corresponding to the interface for use in the business scenario. Specifically, the published interface is directly applied for use, or the atomic capabilities output by the interface are orchestrated for use.
[0018] The present invention also protects an online debugging system for configuring CLI commands to dynamically collect and analyze device information, comprising:
[0019] The online debugging module is used to write CLI commands based on the data information to be collected and select devices. The written CLI commands are sent to the selected devices, and the original information of the devices is collected in real time. The TextFSM is written based on the original information of the devices. The regular script is parsed online through the TextFSM, and the parsing results are displayed in real time. The syntax of the TextFSM is debugged based on the parsing results to meet the data information collection requirements.
[0020] Regular parsing module, used to parse TextFSM;
[0021] Parameter rendering module, used to render the parsing results into templates and store them;
[0022] The atomic capability generation and configuration delivery module is used to perform granular analysis on the rendered template, generate atomic capabilities, and use the generated atomic capabilities in business scenarios.
[0023] In the regular expression parsing module, the variables in the written TextFSM expression are deeply recursively traversed to parse out the specific name of each variable and the related hierarchical relationship.
[0024] In the parameter rendering module, the original string type information of the device collected after the CLI command is sent to the device is globally matched with the specific name of the variable obtained by parsing and the related hierarchical relationship, and the variable is assigned with the matched content. The assigned information is assembled into the JSON structure desired by the user through deep traversal.
[0025] In the atomic capability generation and configuration delivery module, the JSON structure is parsed into a hierarchical relationship of a tree structure and stored in a database to obtain atomic capabilities that can be used in business scenarios.
[0026] The present invention also protects an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the online debugging method for dynamically collecting and parsing device information by configuring CLI commands as described above is implemented.
[0027] The present invention also protects a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the above-mentioned online debugging method for dynamically collecting and parsing device information by configuring CLI commands.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] The present invention provides an online debugging method, system, electronic device and storage medium for dynamically collecting and parsing device information using CLI commands, which can debug and parse information content online on a page, realize online debugging, online publishing and immediate collection. This method replaces the inefficient and inflexible method of previously developing a new collection interface and re-publishing the system based on the CLI commands and information return formats required for collection of different types of information from newly added SDN controllers.
[0030] Most of the controller system's services rely on the support of cli data collection. Based on the characteristics of cli collection and combined with the flexible characteristics of TextFSM regular batch, the present invention integrates interface parameter abstraction, return result templates, and interface request unification, so that users can complete cli command input, return result parsing, atomic capability generation, and interface online publishing in the entire page process, and operate the entire process. Subsequently, users can also add the interface to the scheduler to realize timed data collection, automatic generation of atomic capability information and structured storage in the background. Other services can also use the user-defined cli collection interface in business implementation, truly realizing a better combination of cli collection and system services.
[0031] Specifically, the present invention has the following advantages:
[0032] 1. Users can use the online debugging function on the page to directly generate a real-time collection interface for the debugged CLI command. After the interface is online, it can be used for business functions immediately;
[0033] 2. Perform regular expression parsing on the collection results of CLI commands and match them to granular fields. These fields are then abstracted into corresponding atomic capabilities. Business templates can orchestrate and use these business-specific atomic capabilities without understanding CLI commands, enabling flexible use of the collected data.
[0034] 3. One-stop publishing and use: Users can publish debugged interfaces in real time in one stop. After publishing, users can directly add the interfaces to scheduling tasks to achieve timely collection and storage. At the same time, various business needs can also use the user-published interfaces themselves, or they can orchestrate the use of the atomic capabilities output by each interface.
[0035] The CLI online debugging and collection solution designed in the present invention can be applied to multi-scenario data collection of SDN controllers, and can perform business-oriented processing on the real-time data of the equipment, so as to better analyze the current status of the equipment. It can be used in all business systems that require data collection equipment, without the need for engineers to redevelop new collection, and can more quickly support user use and business iteration. The solution based on regular matching in the present invention can also be used in all similar parameter analysis.
[0036] The present invention can automatically identify the validity and manufacturer of commands based on CLI commands, realize real-time online debugging of different devices, and quickly return and respond; perform regular matching on the returned content, and realize the generation of different atomic capabilities for the same acquisition command for use by multiple business modules.
[0037] The present invention can provide basic data support for all device-type data collection required by the SDN controller, realize rapid iteration of services, and maximize the use of data collection; the present invention can be used to improve the fault diagnosis and information inspection of backbone network equipment, better monitor the operation of equipment, thereby discovering equipment problems earlier and ensuring the stable operation of the network. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] FIG1 is a schematic structural diagram of an online debugging system for dynamically collecting and analyzing device information using CLI commands according to the present invention. DETAILED DESCRIPTION
[0039] The above contents of the present invention are further described in detail below in the form of embodiments, but this should not be understood as the scope of the above subject matter of the present invention being limited to the following embodiments. All technologies implemented based on the above contents of the present invention fall within the scope of the present invention.
[0040] In one embodiment, the present invention proposes an online debugging method for configuring CLI commands to dynamically collect and parse device information. The method parses TextFSM, renders the parsed results into templates and stores them. The rendered templates are then parsed at a granular level to generate atomic capabilities for selection and assembly to obtain the required business scenario templates. The business scenario templates are then published with interfaces. When the business scenario templates are used, the method automatically collects device information for use in the business scenario by searching for the CLI command set corresponding to the interface.
[0041] Among them, TextFSM is obtained in the following process:
[0042] Write a CLI command based on the data information to be collected and select a device. Send the written CLI command to the selected device, collect the device's original string type information in real time, write a TextFSM based on the device's original string type information, perform regular script online parsing through TextFSM, and display the parsing results in real time. Perform syntax debugging on TextFSM based on the parsing results to meet the data information collection requirements.
[0043] The specific process of parsing TextFSM, rendering the parsing results into a template and storing it, and performing granular parsing on the rendered template to generate atomic capabilities is as follows:
[0044] (1) Perform deep recursive traversal of the variables in the written TextFSM expression to parse out the specific names of each variable and the related hierarchical relationships;
[0045] (2) After the CLI command is sent to the device, the device's original string type information collected is globally matched with the specific name of the variable obtained by parsing and the related hierarchical relationship, and the variable is assigned with the matched content. The assigned information is assembled into the JSON structure desired by the user through deep traversal;
[0046] (3) Parse the JSON structure into a hierarchical tree structure and store it in the database to obtain atomic capabilities that can be used in business scenarios.
[0047] Publish interfaces for business scenario templates. When using business scenario templates, the system automatically collects data from devices by finding the CLI command set corresponding to the interface for use in business scenarios. Specifically, the published interface can be directly applied or the atomic capabilities output by the interface can be orchestrated.
[0048] To make the above method clearer, the following steps illustrate the specific implementation of the online debugging method of configuring CLI commands to dynamically collect and analyze device information of the present invention:
[0049] The first step is to write the CLI command. According to the required data information and the manufacturer of the device, write the corresponding CLI command and select the test device you want.
[0050] The second step is to write a TextFSM. Based on the CLI command and the device selected in the first step, the user clicks the real-time acquisition button. The system sends the CLI command to the corresponding device and obtains the original information of the device. The user writes the corresponding TextFSM based on the original information. The system parses the regular script written by the user on the page online and displays the parsing results to the user in real time for syntax debugging to meet the user's requirements.
[0051] In the third step, the system parses the TextFSM written by the user and renders the parsed results into a template for storage. In this way, each CLI command and regular script obtains a unique template for selection and use by global users.
[0052] The fourth step is atomic capability generation. The system parses each rendered template at the minimum granularity to generate minimized atomic capabilities. This allows users, even if they do not understand the CLI and TextFSM syntax, to drag and drop generated atomic capabilities on the page to generate new templates and obtain the collection interface required for their business.
[0053] The fifth step is business use. The system publishes the template generated by the user as an interface. When the business uses this template, the system can use this template to find the corresponding CLI command set, and then automatically collect data from the device for business use.
[0054] The specific rendering process in the fourth step is:
[0055] 1. After receiving the expression written by the user, the backend performs a deep recursive traversal of the variables in the expression, and parses the specific name and related hierarchical relationship of each variable in turn.
[0056] 2. After the background program sends the CLI command to the device, it collects the device's original string type information and performs a global match based on the variables and variable hierarchical relationships of the TextFSM expression that the system has previously parsed. It assigns the matched content to the variables and assembles the assigned information into the user's desired JSON structure through deep traversal.
[0057] 3. The background algorithm parses the JSON obtained in the second step again, converts it into a tree structure, and stores the hierarchical relationship in the database. In this way, the system obtains atomic capabilities that can support the business, which users can directly use in future business scenarios.
[0058] In addition to performing a global scan of tree-like data, the deep traversal algorithm described in the above process can also perform regular expression matching on specific scanned fields, assign parameters, and persist data into the database in this project.
[0059] Through the above method, when faced with new collection requirements, a collection capability can be directly launched through real-time debugging, field extraction, atomic capability generation, interface release and other steps on the page. There is no need to submit requirements to R&D personnel and go through a long software development project to complete the release, which greatly improves efficiency and reduces costs.
[0060] In another embodiment, the present invention provides an online debugging system for dynamically collecting and parsing device information using CLI commands, including:
[0061] The online debugging module is used to write CLI commands based on the data information to be collected and select devices. The written CLI commands are sent to the selected devices, and the original information of the devices is collected in real time. The TextFSM is written based on the original information of the devices. The regular script is parsed online through the TextFSM, and the parsing results are displayed in real time. The syntax of the TextFSM is debugged based on the parsing results to meet the data information collection requirements.
[0062] Regular parsing module, used to parse TextFSM;
[0063] Parameter rendering module, used to render the parsing results into templates and store them;
[0064] The atomic capability generation and configuration delivery module is used to perform granular analysis on the rendered template, generate atomic capabilities, and use the generated atomic capabilities in business scenarios.
[0065] In the regular expression parsing module, the variables in the written TextFSM expression are deeply recursively traversed to parse out the specific names of each variable and the related hierarchical relationships.
[0066] In the parameter rendering module, the original string type information of the device collected after the CLI command is sent to the device is globally matched with the specific name of the parsed variable and the related hierarchical relationship. The matched content is used to assign values to the variables, and the assigned information is assembled into the JSON structure desired by the user through deep traversal.
[0067] In the atomic capability generation and configuration delivery module, the JSON structure is parsed into a hierarchical tree structure and stored in the database to obtain atomic capabilities that can be used in business scenarios.
[0068] In the present invention, the online debugging module debugs the page in real time according to the cli command and the selected device to obtain the collection results required by the business; the regular parsing template parses the results online through the TextFSM regular script to meet the user's requirements; the parameter rendering module renders the parameters of the cli command and the selected device to generate an interface message that can collect equipment; the atomic capability generation and configuration distribution module abstracts the debugged collection interface into atomic capabilities, allowing the business template to better use the debugged interface and realize flexible arrangement and use according to the generated atomic capabilities.
[0069] In another embodiment, the present invention proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the online debugging method for dynamically collecting and parsing device information by configuring CLI commands is implemented.
[0070] In another embodiment, the present invention provides a computer-readable storage medium storing a computer program, which enables a computer to execute the above-mentioned online debugging method for dynamically collecting and parsing device information by configuring CLI commands.
[0071] The present invention is further described in detail below with reference to specific embodiments:
[0072] If a user wants to check whether the version information of a Huawei router is consistent with that in the SDN controller database, the user needs to collect information on the device in real time and compare it with the database. The user can then perform the following operations on the page provided by the SDN controller through the steps required by the present invention.
[0073] In the CLI template function, enter the CLI command display version to view the Huawei router version number. After entering the command, select any Huawei router managed by the controller and click Test. The system will automatically send the command to the selected device and render the device's original version information on the page. You can then write the corresponding TextFSM script:
[0074] Value Required version(.+)
[0075] Start
[0076] ∧ .*Version.*\(.*\s${version}\)->Record
[0077] The system extracts the original information collected by the user-defined script interface CLI command into a key and value format such as "version": "NE40XXXXXXX".
[0078] The system backend automatically renders the user-extracted information and the used CLI script into a template and provides it for user selection in the template selection module. After selecting the Huawei device to be inspected in the inspection template, the user selects the collection template generated by the system and specifies whether the version information in the collection template is equal to that in the database. The device inspection function is then triggered. The system automatically collects device information based on the template content through the corresponding CLI command, parses the device information based on the template, obtains the version field of the inspected device, and compares it with the information in the database, thus completing the Huawei device version inspection service.
[0079] The system granulates user-generated templates into atomic capabilities. For example, for the template above, the system generates a Huawei version atomic capability. Later, if other users need to collect version information, they only need to select this information in the atomic capability. The system will then collect the information for the device and return it for business use. Users can also combine atomic capabilities. By selecting multiple atomic capabilities, the system will issue multiple CLI commands at once and collect various device information for users to use.
[0080] In the embodiments disclosed herein, computer storage media can be tangible media that can contain or store programs for use by or in conjunction with an instruction execution system, device, or apparatus. Computer storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specific examples of computer storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0081] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0082] The above description is only a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Any simple modification, equivalent replacement and improvement made by any technician familiar with the profession to the above embodiment without departing from the scope of the technical solution of the present invention and based on the technical essence of the present invention shall still fall within the scope of protection of the technical solution of the present invention.
Claims
1. An online debugging method for configuring a CLI command to dynamically collect and parse device information, characterized in that: Parse TextFSM, render the parsing result into a template and store it, perform granularity parsing on the rendered template to generate atomic capabilities for selective assembly to obtain the required business scenario template; Publish the interface for the business scenario template. When the business scenario template is used, automatically collect the device by finding the set of CLI commands corresponding to the interface for use in the business scenario; Among them, the TextFSM is obtained in the following process: Write a CLI command according to the data information to be collected and select a device, send the written CLI command to the selected device, collect the device's original string type information in real time, write a TextFSM according to the device's original string type information, perform online parsing of the regular script through the TextFSM, and display the parsing result in real time. Debug the syntax of the TextFSM according to the parsing result to meet the requirements for collecting data information.
2. The online debugging method for dynamically collecting and parsing device information by configuring cli commands according to claim 1, characterized in that: The specific process of parsing the TextFSM, rendering the parsing result into a template and storing it, and performing granularity parsing on the rendered template to generate atomic capabilities is as follows: (1) Deeply recursively traverse the variables in the expression of the written TextFSM to parse out the specific names and related hierarchical relationships of each variable; (2) Globally match the device's original string type information collected after sending the CLI command to the device with the specific names and related hierarchical relationships of the parsed variables, assign values to the variables with the matched content, and assemble the assigned information into the JSON structure desired by the user through deep traversal; (3) Parse the JSON structure into a hierarchical relationship of a tree structure and store it in the database to obtain atomic capabilities that can be used in business scenarios.
3. The online debugging method for dynamically collecting and parsing device information by configuring cli commands according to claim 1, characterized in that: The specific method of publishing the interface for the business scenario template and automatically collecting the device by finding the set of CLI commands corresponding to the interface for use in the business scenario when the business scenario template is used is as follows: directly apply the published interface for use, or perform orchestrated use on the atomic capabilities output by the interface.
4. An online debugging system for configuring a CLI command to dynamically collect and parse device information, characterized in that It includes: An online debugging module for writing a CLI command according to the data information to be collected and selecting a device, sending the written CLI command to the selected device, collecting the original information of the device in real time, writing a TextFSM according to the original information of the device, performing online parsing of the regular script through the TextFSM, and displaying the parsing result in real time. Debug the syntax of the TextFSM according to the parsing result to meet the requirements for collecting data information; A regular parsing module for parsing the TextFSM; A parameter rendering module for rendering the parsing result into a template and storing it; An atomic capability generation and configuration distribution module for performing granularity parsing on the rendered template to generate atomic capabilities and using them in business scenarios according to the generated atomic capabilities.
5. The online debugging system for dynamically collecting and parsing device information by configuring cli commands according to claim 4, characterized in that: In the regular parsing module, deeply recursively traverse the variables in the expression of the written TextFSM to parse out the specific names and related hierarchical relationships of each variable.
6. The online debugging system for dynamically collecting and parsing device information by configuring cli commands according to claim 5, characterized in that: In the parameter rendering module, the original string-type information of the device collected after sending the cli command to the device is globally matched with the specific names of the parsed variables and the relevant hierarchical relationships, and the variables are assigned values with the matched content. The information after assignment is assembled into the json structure desired by the user through depth traversal.
7. The online debugging system for dynamically collecting and parsing device information by configuring cli commands according to claim 6, characterized in that: In the atomic capability generation and configuration distribution module, the json structure is parsed into a hierarchical relationship of a tree structure and stored in the database to obtain atomic capabilities that can be used in business scenarios.
8. An electronic device, characterized in that, including: A memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, an online debugging method for configuring a cli command to dynamically collect and parse device information as described in any one of claims 1-3 is implemented.
9. A computer-readable storage medium storing a computer program, where the computer program causes a computer to execute the online debugging method for configuring a cli command to dynamically collect and parse device information as described in any one of claims 1-3.
Citation Information
Patent Citations
Rapid customized development method and system for operation and maintenance tool
CN115484138A
Online debugging method and system for configuring cli command to dynamically collect and analyze equipment information, electronic equipment and storage medium
CN117667743A
Techniques for implementing a command line interface
US20210026917A1