An online debugging method, system, electronic device and storage medium for configuring CLI commands to dynamically collect and analyze device information

By configuring the online debugging method of dynamically collecting and analyzing device information, using TextFSM to perform online analysis of regular scripts, generating atomic capabilities, and publishing automatic device information through the interface, solving the problem of inefficient device information collection process in the SDN controller, and achieving efficient and flexible device information collection and business scenario use.

CN117667743BActive Publication Date: 2025-04-22CHINA TELECOM DIGITAL INTELLIGENCE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311817296.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-27
Publication Date
2025-04-22
Estimated Expiration
2043-12-27

AI Technical Summary

Technical Problem

The process of collecting device information in the prior art in the SDN controller is inefficient and inflexible, and requires offline testing through the development of new interfaces, resulting in the system development process being complex and time-consuming.

Method used

By configuring the online debugging method for dynamically collecting and analyzing device information, using TextFSM to perform online parsing of regular scripts, generating atomic capabilities, and automatically collecting device information through the interface, realizing online modulation and online publishing.

Benefits of technology

It realizes online debugging and information analysis, improves work efficiency, simplifies the equipment information collection process, reduces system development costs, and supports flexible use of business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117667743B_ABST
    Figure CN117667743B_ABST
Patent Text Reader

Abstract

The present invention discloses an online debugging method, system, electronic device and storage medium for configuring cli commands to dynamically collect and parse device information, parse TextFSM, render the parsing results into templates and store them, perform granular parsing on the rendered templates, generate atomic capabilities for selection and use, and automatically collect data from devices by finding a set of cli commands corresponding to an interface when using them. The TextFSM in the present invention comes from the TextFSM compiled and obtained by online debugging of the cli commands sent to the device when collecting data information. The present invention can debug and parse information content online on a page, realize online debugging, online publishing, and immediate collection, and can realize flexible use and improve work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

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 parse 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' manual operation and maintenance mode generally uses CLI commands to directly interact with devices to complete operations such as device startup, backbone trunk activation, service activation, and device upgrade and maintenance. However, this method is greatly affected by space and time, and is also limited by the technical level and work efficiency of network engineers. If the response to a major fault is not fast enough, it may cause incalculable losses to customer business.

[0004] In the process of SDN controller managing network devices, the real-time data on the device is the most important data that the controller relies on to configure the device. Only by collecting various data of the device in real time and processing and analyzing them can the device be managed and controlled more reasonably. In the past, the process of SDN controller collecting device information was to analyze the required data and then analyze the required CLI command set. Then, a new interface for interacting with the device was developed based on the CLI command, and then offline testing was carried out. After a series of software development processes, the interface could be launched and put into use. This method is relatively 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 of router products. Using CLI has the advantages of low usage requirements (only serial port is required), easy use, convenient function expansion, etc. Especially when there are many (such as 10) router devices that need to be configured, the configuration of all routers can be completed quickly through the COPY / PASTE function, without the need to configure one by one through IE.

[0006] TextFSM consists of two parts: text and FSM (finite state machine). It is a Python module open sourced by Google for parsing semi-formatted text. It is also specifically designed 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 parse device information, which can debug and parse information content on the page online, realize online debugging, online publishing, immediate collection, and can be used flexibly to improve work efficiency.

[0008] To achieve the above purpose, the technical solution provided by the present invention is:

[0009] An online debugging method for configuring cli commands to dynamically collect and parse device information, parses TextFSM, renders the parsing results into templates and stores them, performs granular parsing on the rendered templates, generates atomic capabilities for selection and assembly to obtain required business scenario templates; publishes interfaces for business scenario templates, and when the business scenario templates are used, automatically collects equipment by finding the cli command set corresponding to the interface for use in the business scenario;

[0010] The TextFSM is obtained in the following process:

[0011] 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 original string type information of the device in real time, write TextFSM according to the original string type information of the device, 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] In order to optimize the above technical solutions, the specific measures / limitations taken also include:

[0013] The specific process of parsing 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 expression of the written TextFSM to parse out the specific names of each variable and the relevant hierarchical relationships;

[0015] (2) After the CLI command is sent to the device, the original string type information of the device 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 tree-like hierarchical relationship 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, including:

[0019] The online debugging module is used to write cli commands and select devices according to the data information to be collected, send the written cli commands to the selected devices, collect the original information of the devices in real time, write TextFSM according to the original information of the devices, perform online parsing of regular scripts through TextFSM, and display the parsing results in real time. According to the parsing results, the syntax of TextFSM is debugged to meet the requirements for collecting data information;

[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 parsing module, the variables in the expression of the written TextFSM 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 relevant hierarchical relationship, the variable is assigned with the matched content, and 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, including: 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 online debugging method for dynamically collecting and parsing device information by configuring CLI commands as described above.

[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 by configuring CLI commands, which can debug and parse information content online on a page, realize online debugging, online publishing and immediate collection, so as to replace the inefficient and inflexible method of developing a new collection interface and re-publishing the system according to the CLI commands and information return formats required for collection when adding different types of information of collection devices in the past SDN controller.

[0030] Most of the services of the controller system need to rely on the support of cli data collection. According to the characteristics of cli collection and the flexible characteristics of TextFSM regular batch, the present invention integrates interface parameter abstraction, return result template, 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 process of the page, and operate the entire process. Later, 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 the business implementation, so as to truly realize 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, and after the interface is online, it can be used for business functions immediately;

[0033] 2. Perform regular expression analysis on the collection results of the CLI command and match the granular fields. These fields are abstracted into corresponding atomic capabilities. The business template can orchestrate and use these business-oriented atomic capabilities without understanding the CLI command, so as to flexibly use 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 interfaces published by users themselves, or they can use the atomic capabilities output by each interface in an orchestrated manner.

[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 process the real-time data of the equipment in a business-oriented manner, so as to better analyze the current status of the equipment; it can be used in all business systems that require equipment collection, and engineers do not need to redevelop new collection, so as to support user use and business iteration more quickly; 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 according to the CLI command, realize real-time online debugging of different devices, fast return and fast response; perform regular matching on the returned content, and realize the generation of different atomic capabilities of the same collection command for use by multiple business modules.

[0037] The present invention can provide basic data support for all device 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 fault diagnosis and information inspection of backbone network equipment, better monitor the operation of equipment, thereby discovering equipment problems earlier and ensuring stable operation of the network. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 : A structural diagram of an online debugging system for dynamically collecting and parsing device information using the configuration CLI command of 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, and all technologies realized based on the above contents of the present invention belong to 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, parse TextFSM, render the parsing results into templates and store them, perform granular parsing on the rendered templates, generate atomic capabilities for selection and assembly to obtain required business scenario templates; publish interfaces for business scenario templates, and when the business scenario templates are used, automatically collect equipment by finding the cli command set corresponding to the interface for use in the business scenario;

[0041] Among them, TextFSM is obtained in the following process:

[0042] 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 original string type information of the device in real time, write TextFSM according to the original string type information of the device, 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 templates and storing them, and performing granular parsing on the rendered templates to generate atomic capabilities is as follows:

[0044] (1) Perform deep recursive traversal of the variables in the expression of the written TextFSM to parse out the specific names of each variable and the relevant hierarchical relationships;

[0045] (2) After the CLI command is sent to the device, the original string type information of the device 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 tree-like hierarchical relationship 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 business scenario templates are used, they automatically collect data from devices by finding the CLI command set corresponding to the interface for use in business scenarios. Specifically, they can be used by directly applying the published interfaces or orchestrating the use of the atomic capabilities output by the interfaces.

[0048] To make the above method more clear, the following is a demonstration of the specific implementation of the online debugging method of configuring CLI commands to dynamically collect and analyze device information of the present invention in steps:

[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 the user wants.

[0050] The second step is to write TextFSM. The user clicks the real-time acquisition button according to the cli command and the selected device in the first step. The system sends the cli command to the corresponding device and obtains the original information of the device. The user writes the corresponding TextFSM according to 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 the user to debug the syntax, so as 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 template storage, so that each CLI command and regular script obtains the results to generate a unique template, which can be selected and used by global users;

[0052] Fourth, atomic capability generation. The system performs minimum granularity analysis on each rendered template and generates minimized atomic capabilities. In this way, even if the user does not understand the writing syntax of CLI and TextFSM, he can still drag and assemble the generated atomic capabilities through the page to generate a new template and obtain the collection interface required for his 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 cloth is:

[0055] 1. After receiving the expression written by the user, the background will perform deep recursive traversal on the variables in the expression, and parse out 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 original string type information of the device, and performs global matching based on the variables and variable hierarchy relationships of the TextFSM expression that the system has parsed in advance, assigns the matched content to the variable, and assembles the assigned information into the json structure desired by the user through deep traversal.

[0057] 3. The background algorithm parses the JSON obtained in the second step again, and after parsing it into a tree structure, stores the hierarchical relationship in the database. In this way, the system obtains atomic capabilities that can support the business, and users can use them directly in future business scenarios.

[0058] In addition to performing a global scan of the tree-like data, the deep traversal algorithm described in the above process can also perform regular matching on the specific fields scanned, assign parameters, and persist the 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 proposes an online debugging system for configuring a CLI command to dynamically collect and parse device information, including:

[0061] The online debugging module is used to write cli commands and select devices according to the data information to be collected, send the written cli commands to the selected devices, collect the original information of the devices in real time, write TextFSM according to the original information of the devices, perform online parsing of regular scripts through TextFSM, and display the parsing results in real time. According to the parsing results, the syntax of TextFSM is debugged to meet the requirements for collecting data information;

[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 variable obtained by parsing and the relevant 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.

[0067] 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 the database to obtain atomic capabilities that can be used in business scenarios.

[0068] In the present invention, the online debugging module performs real-time debugging on the page according to the cli command and the selected device to obtain the collection results required by the business; the regular parsing template uses the TextFSM regular script to parse the results online to meet the user's requirements; the parameter rendering module performs parameter rendering on the cli command and the selected device to generate an interface message capable of collecting equipment; the atomic capability generation and configuration delivery module performs atomic capability abstraction on the debugged collection interface, so that the business template can better debug the interface and realize flexible arrangement and use according to the generated atomic capabilities.

[0069] In another embodiment, the present invention proposes an electronic device, including: 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 configuring CLI commands to dynamically collect and parse device information is implemented.

[0070] In another embodiment, the present invention provides 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.

[0071] The present invention is further described in detail below in conjunction with specific embodiments:

[0072] If the user wants to check whether the version information of Huawei router is consistent with that in the SDN controller database, the user needs to collect the information on the device in real time and compare it with the database. Then the user can perform the following operations on the page provided by the SDN controller through the steps required by this patent.

[0073] In the CLI template function, fill in the CLI command corresponding to viewing the Huawei router version number: display version; after filling in the command, select any Huawei router device managed by the controller and click Test; the system will automatically send the command to the selected device and render the original version information of the device on the page; then the user can write the corresponding TextFSM script:

[0074] Value Required version(.+)

[0075] Start

[0076] ^.*Version.*\(.*\s${version}\)->Record

[0077] The system will extract 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 background automatically renders the information extracted by the user and the CLI script used into a template, and provides it for the user to choose in the template selection module; after the user selects the Huawei device to be inspected in the inspection template, selects the collection template produced by the system; specifies whether the version information in the collection template is equal to that in the database; then triggers the device inspection function; the system automatically collects device information based on the template content through the corresponding CLI command; and parses the device information in combination with the template; obtains the version field of the inspected device and compares it with the information in the database; thus completing the inspection of Huawei device versions.

[0079] The system will granulate the templates generated by users into atomic capabilities. For example, for the above template, the system will generate a Huawei version atomic capability. If other users need to collect version information in the future, they only need to check this information in the atomic capability, and the system will collect the information from the device and return it for business use. Users can also use atomic capabilities in combination and select multiple atomic capabilities. In this way, the system will issue multiple CLI commands at one time and collect various device information for users to use.

[0080] In the embodiments disclosed in the present application, the computer storage medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. The computer storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above. 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-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0081] Those of ordinary skill 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 limit the present invention in any form. Any technician familiar with the profession, without departing from the scope of the technical solution of the present invention, according to the technical essence of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.

Claims

1. An online debugging method for dynamically collecting and parsing device information by configuring CLI commands, characterized in that: Parse the TextFSM, render the parsing results into a template and store them. The template is generated by the results obtained by the cli command and the regular script. Perform granular parsing on the rendered template to generate atomic capabilities for selection and assembly to obtain the required business scenario template; Publish interfaces for business scenario templates. When business scenario templates are used, they automatically collect data from devices by finding the CLI command set corresponding to the interface for use in business scenarios. The TextFSM is obtained in the following process: writing a cli command and selecting a device according to the data information to be collected, sending the written cli command to the selected device, collecting the original string type information of the device in real time, writing TextFSM according to the original string type information of the device, performing online parsing of the regular script through TextFSM, and displaying the parsing result in real time, and performing syntax debugging on TextFSM according to the parsing result to meet the collection requirements of the data information; 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: (1) Perform deep recursive traversal of the variables in the expression of the written TextFSM to parse out the specific names of each variable and the relevant hierarchical relationships; (2) After sending the CLI command to the device, the collected device original string type information 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; (3) Parse the JSON structure into a tree-like hierarchical relationship and store it in the database to obtain atomic capabilities that can be used in business scenarios.

2. The online debugging method for dynamically collecting and parsing device information by configuring CLI commands according to claim 1 is characterized in that: 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.

3. An online debugging system for configuring cli commands to dynamically collect and analyze device information, the system is used to execute the online debugging method for configuring cli commands to dynamically collect and analyze device information as claimed in claim 1 or 2, characterized in that: include: The online debugging module is used to write cli commands and select devices according to the data information to be collected, send the written cli commands to the selected devices, collect the original information of the devices in real time, write TextFSM according to the original information of the devices, perform online parsing of regular scripts through TextFSM, and display the parsing results in real time. According to the parsing results, the syntax of TextFSM is debugged to meet the requirements for collecting data information; Regular parsing module, used to parse TextFSM; Parameter rendering module, used to render the parsing results into templates and store them; 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.

4. The online debugging system for dynamically collecting and parsing device information using CLI commands according to claim 3 is characterized in that: In the regular parsing module, the variables in the expression of the written TextFSM are deeply recursively traversed to parse out the specific name of each variable and the related hierarchical relationship.

5. The online debugging system for dynamically collecting and analyzing device information by configuring CLI commands according to claim 4 is characterized in that: 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 relevant hierarchical relationship, the variable is assigned with the matched content, and the assigned information is assembled into the json structure desired by the user through deep traversal.

6. The online debugging system for dynamically collecting and analyzing device information by configuring CLI commands according to claim 5, characterized in that: 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.

7. An electronic device, characterized in that: include: 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 in claim 1 or 2 is implemented.

8. A computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the online debugging method for dynamically collecting and parsing device information by configuring CLI commands as claimed in claim 1 or 2.

Citation Information

Patent Citations

  • Rapid customized development method and system for operation and maintenance tool

    CN115484138A