Network configuration file processing method and device, program product and electronic equipment

By analyzing and mapping the YANG model to CLI commands, the problem of converting the YANG model to CLI commands is solved, efficient and accurate network device configuration processing is achieved, development costs and human errors are reduced, and CLI commands compatible with multiple device manufacturers .

CN119094351APending Publication Date: 2024-12-06CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411464996.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The existing technology lacks an efficient conversion solution from YANG model to CLI commands, which leads to operation and maintenance and R&D managers who need to hard code when handling network equipment configurations, which increases development costs and human errors, and is incompatible with CLI commands from different equipment manufacturers.

Method used

By obtaining the network configuration file based on the YANG model, analyzing the target YANG model node and text value, determining the target CLI command template based on the pre-configured mapping relationship, and filtering out the accurate CLI command through similarity, achieving efficient YANG model to CLI commands Convert.

Benefits of technology

The conversion of YANG model to CLI commands can be realized without hard coding, reducing manual operations and human errors, reducing development costs, improving work efficiency, and compatible with CLI commands from different device manufacturers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094351A_ABST
    Figure CN119094351A_ABST
Patent Text Reader

Abstract

The invention provides a network configuration file processing method and device, a program product and electronic equipment, and relates to the technical field of computers. The method comprises the following steps: acquiring a network configuration file, wherein the network configuration file comprises data based on a YANG model; analyzing a target YANG model node in the network configuration file and a text value of the target YANG model node; determining a target CLI command template corresponding to the target YANG model node on the basis of a pre-configured mapping relationship between a YANG model and a CLI command; a first CLI command is extracted from the target CLI command template; and determining a second CLI command from the first CLI command according to the similarity between the first CLI command and the text value. According to the method and the device, efficient conversion from the YANG model to the CLI command is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a network configuration file processing method, a network configuration file processing device, a computer program product, and an electronic device. Background Art

[0002] The YANG model provides a standardized way to describe the data structure and operation of network devices. With the rapid increase of network devices, the YANG model provides convenience and better user experience for operation and maintenance, R&D managers. Therefore, most network configuration files currently use the YANG model as their data model.

[0003] However, in some cases, traditional CLI commands are still needed, for example, some equipment scenarios have difficulty in applying YANG models, or some staff are more accustomed to using CLI commands, etc. The industry lacks an efficient conversion solution from YANG models to CLI commands. Summary of the invention

[0004] The present disclosure provides a network configuration file processing method, a network configuration file processing device, a computer program product and an electronic device, so as to realize efficient conversion from a YANG model to a CLI command at least to a certain extent.

[0005] According to a first aspect of the present disclosure, a network configuration file processing method is provided, the method comprising: acquiring a network configuration file, the network configuration file comprising data based on a YANG model; parsing a target YANG model node in the network configuration file and a text value of the target YANG model node; determining a target CLI command template corresponding to the target YANG model node based on a pre-configured mapping relationship between a YANG model and a CLI command; extracting a first CLI command from the target CLI command template; and determining a second CLI command from the first CLI command according to a similarity between the first CLI command and the text value.

[0006] According to a second aspect of the present disclosure, a network configuration file processing device is provided, the device comprising: a file acquisition module, configured to acquire a network configuration file, the network configuration file comprising data based on a YANG model; a file parsing module, configured to parse out a target YANG model node in the network configuration file and a text value of the target YANG model node; a template determination module, configured to determine a target CLI command template corresponding to the target YANG model node based on a pre-configured mapping relationship between a YANG model and a CLI command; a first CLI command determination module, configured to extract a first CLI command from the target CLI command template; and a second CLI command determination module, configured to determine a second CLI command from the first CLI command according to a similarity between the first CLI command and the text value.

[0007] According to a third aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method of the first aspect and possible implementations thereof are implemented.

[0008] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method of the above-mentioned first aspect and its possible implementation methods by executing the executable instructions.

[0009] The technical solution disclosed in this disclosure has the following beneficial effects:

[0010] An efficient conversion solution from YANG model to CLI command is provided, which can generate CLI commands that meet the specifications according to the data structure and constraints defined by the YANG model. In particular, for the possible non-one-to-one mapping relationship between YANG model and CLI command, more accurate conversion results can be screened out by determining the target CLI command template and calculating the similarity. This helps operation and maintenance, R&D management personnel and other personnel to batch process the configuration of network devices, and can achieve the conversion from YANG model to CLI command without hard coding, providing the possibility for multi-model integration, reducing manual operations, and reducing human errors, saving a lot of development costs, and improving work efficiency. In addition, it can be compatible with different equipment manufacturers to ensure that the converted target CLI command can be correctly executed on the target device. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A flowchart showing a method for processing a network configuration file in this exemplary embodiment is shown.

[0012] Figure 2 A sub-flowchart of a network configuration file processing method in this exemplary embodiment is shown.

[0013] Figure 3 A schematic diagram of establishing a mapping relationship in this exemplary embodiment is shown.

[0014] Figure 4 A schematic diagram showing a mapping relationship in this exemplary embodiment.

[0015] Figure 5 A sub-flowchart of a network configuration file processing method in this exemplary embodiment is shown.

[0016] Figure 6 A schematic diagram showing a first tree structure in this exemplary embodiment.

[0017] Figure 7 A sub-flowchart of a network configuration file processing method in this exemplary embodiment is shown.

[0018] Figure 8 A sub-flowchart of a network configuration file processing method in this exemplary embodiment is shown.

[0019] Fig. 9 A schematic diagram of the structure of a network configuration file processing device in this exemplary embodiment is shown.

[0020] Fig.10 A schematic structural diagram of an electronic device in this exemplary embodiment is shown. DETAILED DESCRIPTION

[0021] Exemplary embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings.

[0022] The accompanying drawings are schematic diagrams of the present disclosure and are not necessarily drawn to scale. Some of the block diagrams shown in the accompanying drawings may be functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in hardware modules or integrated circuits, or in networks, processors or microcontrollers. The embodiments can be implemented in various forms and should not be construed as being limited to the examples set forth herein. The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the description below, many specific details are provided to provide a full description of the embodiments of the present disclosure. However, those skilled in the art should appreciate that one or more specific details may be omitted when implementing the technical solution of the present disclosure, or one or more specific details may be replaced by other methods, components, devices, steps, etc.

[0023] The YANG model has advantages in terms of uniformity and standardization of data models, convenience of automated management, management efficiency, and user experience. However, the promotion and application of the YANG model also has limitations. For example, some network administrators have knowledge reserves of CLI commands but do not have relevant knowledge of the YANG model, or some device scenarios do not support the YANG model. Therefore, it is necessary to convert the YANG model into traditional CLI commands. At present, the industry lacks an efficient conversion solution from the YANG model to the CLI command.

[0024] In view of the above problems, an exemplary embodiment of the present disclosure provides a network configuration file processing method. Figure 1 An exemplary process of a method for processing a network configuration file is shown, which may include the following steps S110 to S150:

[0025] Step S110, obtaining a network configuration file, where the network configuration file includes data based on a YANG model;

[0026] Step S120, parsing the target YANG model node and the text value of the target YANG model node in the network configuration file;

[0027] Step S130, determining a target CLI command template corresponding to a target YANG model node based on a pre-configured mapping relationship between a YANG model and a CLI command;

[0028] Step S140, extracting a first CLI command from a target CLI command template;

[0029] Step S150: determining a second CLI command from the first CLI command according to the similarity between the first CLI command and the text value.

[0030] based on Figure 1 This method provides an efficient conversion solution from YANG model to CLI command, which can generate compliant CLI commands according to the data structure and constraints defined by the YANG model. In particular, for the possible non-one-to-one mapping relationship between YANG model and CLI command, more accurate conversion results can be screened out by determining the target CLI command template and calculating the similarity.

[0031] This helps operation and maintenance, R&D management personnel and other personnel to batch process the configuration of network devices. They can realize the conversion from YANG models to CLI commands without hard coding, providing the possibility for multi-model integration, reducing manual operations and human errors, saving a lot of development costs and improving work efficiency. In addition, it can be compatible with different equipment manufacturers to ensure that the converted target CLI commands can be correctly executed on the target device.

[0032] Below Figure 1 Provide detailed instructions for each step.

[0033] refer to Figure 1 In step S110, a network configuration file is obtained, where the network configuration file includes data based on a YANG model.

[0034] Among them, the network configuration file can be a NETCONF (Network Configuration Protocol) file. The XML (Extensible Markup Language) format is generally used to describe the configuration information. The NETCONF file uses the YANG model to define and manage network configurations and is instance data of the YANG model. The YANG (Yet Another Next Generation) model defines a hierarchical structure of data and can be used for operations based on network configuration management protocols (such as NETCONF), such as configuration, status data, remote procedure calls, and notifications.

[0035] The following example shows a NETCONF instance based on the YANG model:

[0036]

[0037]

[0038] In one implementation, a network configuration file based on a target manufacturer may be obtained. The target manufacturer may be a provider of network equipment. Different manufacturers may define their own YANG models, so the data in the network configuration file may be data based on the YANG model of the target manufacturer.

[0039] Continue to refer Figure 1 In step S120, the target YANG model node and the text value of the target YANG model node in the network configuration file are parsed.

[0040] Among them, the YANG model node can represent the location path of the element in the YANG model. Since NETCONF uses XML format, the YANG model node can be described by XPath (XML path language). The text value of the YANG model node is the information of the YANG model node expressed in text form. The YANG model node parsed from the network configuration file is called the target YANG model node. For example, in the NETCONF example above, the target YANG model node can be parsed as follows:

[0041] profile-name: uni_1000m, its text value is uni_1000m;

[0042] direction: inbound, its text value is inbound;

[0043] identify-type: none, whose text value is none.

[0044] In one implementation, the network configuration file may be parsed to identify tags in the network configuration file. If the path represented by the tag is a leaf path (ie, a path without a next-level path), the tag is a target YANG model node.

[0045] In one embodiment, the network configuration file can be parsed line by line to extract the leaf tags in each line as the target YANG model nodes until the parsing of the network configuration file is completed. In the process of parsing the network configuration file line by line, it is determined whether the parsing of the entire file is completed. If the parsing is completed, the subsequent steps are continued. If the parsing is not completed, the parsing is continued line by line. In this way, the entire file can be traversed to extract all the target YANG model nodes. This avoids information omission during the conversion of CLI commands.

[0046] Continue to refer Figure 1 In step S130, based on the pre-configured mapping relationship between the YANG model and the CLI command, a target CLI command template corresponding to the target YANG model node is determined.

[0047] CLI (Command Line Interface) is a way of interacting with users through a text interface, allowing users to execute specific operations in computer programs or operating systems by entering commands. Commands entered by users based on CLI are CLI commands. CLI command templates are a summary of different forms of CLI commands in different scenarios, which may contain identifiers. Identifiers have special meanings, as shown in Reference Table 1. CLI command templates can be expanded into multiple CLI commands according to the meaning of the identifiers.

[0048] Table 1

[0049]

[0050] The mapping relationship between the YANG model and the CLI command may include a mapping relationship between a YANG model node and a CLI command, a YANG model node and a CLI command template, or a YANG model node and an attribute of a CLI command. The attributes of the CLI command may include attributes of types such as keywords and variables, wherein the variables are of assignment type and have a mapping relationship with the YANG model, and the keywords are fixed combinations, some of which have a mapping relationship with the YANG model, while some do not.

[0051] The CLI commands and YANG model configuration descriptions are inconsistent, and there is no one-to-one correspondence between the two. There may be a situation where one YANG model node corresponds to multiple CLI commands (or CLI command templates, or CLI command attributes), or multiple YANG model nodes correspond to one CLI command or CLI command template, or CLI command attributes).

[0052] In one implementation, the mapping relationship between the YANG model and the CLI command may be based on the mapping relationship of the target manufacturer, which may be directly provided by the target manufacturer or obtained by operation and maintenance personnel based on the YANG model of the target manufacturer.

[0053] In one embodiment, reference Figure 2 As shown, the network configuration file processing method may further include the following steps S210 to S230:

[0054] Step S210, obtaining a YANG model and a CLI command template;

[0055] Step S220, constructing a second tree structure based on the YANG model, and determining a YANG model node based on a node of the second tree structure;

[0056] Step S230, determining the attributes corresponding to the YANG model node, and configuring the mapping relationship between the YANG model and the CLI command according to the attributes corresponding to the YANG model node and the attributes included in the CLI command template.

[0057] The YANG model represents the data structure in the network configuration file, which can be provided by the target manufacturer. Referring to the YANG model in the NETCONF example above, it can represent the hierarchical relationship of data. Based on this, the data structure in the YANG model can be represented by the second tree structure, referring to Figure 3 As shown in the figure, the different hierarchical structures in the YANG model are represented by the parent-child node relationship in the tree. Figure 3The second tree structure shown is the tree structure corresponding to the YANG model in the NETCONF example above. The YANG model node can be determined according to the second tree structure, such as determining the YANG model node according to the path from the root node to the leaf node in the second tree structure.

[0058] YANG model nodes can correspond to the attributes of CLI commands, such as Figure 3 The arrow mapping relationship shown. The CLI command template also includes the attributes of the CLI command, and the mapping relationship between the YANG model and the CLI command can be established through the attributes. For example, if the YANG model node A corresponds to the attribute B of the CLI command, and the CLI command template C also contains the attribute B, then the YANG model node A and the CLI command template C have a mapping relationship.

[0059] based on Figure 3 The second tree structure, CLI command template and its attributes shown in the figure can be configured Figure 4 In the mapping relationship shown in the figure, the CLI command template in line 1 corresponds to the YANG model nodes in lines 2 to 14, and the CLI command template in line 17 corresponds to the YANG model nodes in lines 18 to 27. Figure 3 or Figure 4 In the figure, due to the size limitation of the graph, some YANG model nodes are not shown in their entirety. Figure 3 or Figure 4 This is for illustrative purposes only.

[0060] Based on the mapping relationship between YANG models and CLI commands, the target CLI command template corresponding to the target YANG model node can be determined. Figure 3 and Figure 4 As shown in the mapping relationship, the target YANG model node "profile-name: uni_1000m", "direction: inbound", "identify-type: none" corresponds to the target CLI command template: qos-profile <qos-profile-name>{inbound|outbound} pe-vid <pe-vlan-id>what-void { <ce-vlan-id-begin>[to <ce-vlan-id-end>]} [identifier {on-empty|what-is-empty|on-what-is-empty|none[group <group-name>](hereinafter referred to as template 1), and qos-profile <qos-profile-name>{inbound|outbound}[identifier{none|vid|ce-vid|vid-ce-vid}][group <group-name>](hereinafter referred to as Template 2).

[0061] Continue to refer Figure 1 , in step S140, a first CLI command is extracted from the target CLI command template.

[0062] The first CLI command is a CLI command preliminarily determined according to the target CLI command template. These CLI commands may cover the data content described by the YANG model in the network configuration file, or may cover the data content not covered in the network configuration file. When the first CLI command is obtained, further processing can be performed through subsequent steps to filter out the data content not covered in the network configuration file.

[0063] In one implementation, all CLI commands included in the target CLI command template may be used as the first CLI command.

[0064] In one embodiment, reference Figure 5 As shown, the above-mentioned extraction of the first CLI command from the target CLI command template may include the following steps S510 to S530:

[0065] Step S510, identifying a first attribute in a target CLI command template;

[0066] Step S520, filtering out the first attributes that have a mapping relationship with the YANG model node and whose corresponding YANG model node is not the target YANG model node, and taking the remaining first attributes as the second attributes;

[0067] Step S530: Combine the second attributes to form a first CLI command.

[0068] The first attribute is an attribute of the CLI command identified from the target CLI command template, and may include all attributes in the target CLI command template, and the second attribute is an attribute remaining after further filtering the first attribute.

[0069] In one implementation, the identifying the first attribute in the target CLI command template may include the following steps:

[0070] Identify the elements in the target CLI command template one by one;

[0071] If the current element is an identifier, the identifier is expanded according to its meaning, and the optional values ​​associated with the identifier are used as the first attribute.

[0072] For example, the above template 1 is identified element by element, "qos-profile", " <qos-profile-name>" is an attribute, and it is taken as the first attribute. Then the identifier "{inbound|outbound}" is identified, and it is expanded according to its meaning. Its optional values ​​include "inbound" and "outbound", and these two optional values ​​are taken as the first attribute. In this way, all the first attributes in the target CLI command template can be identified.

[0073] For the first attribute identified in step S510, further determination is performed. If there is no mapping relationship between a first attribute and a YANG model node, such as Figure 4 If the "identifier" attribute in the YANG model node has no mapping relationship with any YANG model node, such first attribute is retained. If a first attribute has a mapping relationship with a YANG model node, and the corresponding YANG model node is the target YANG model node, such first attribute is retained. If a first attribute has a mapping relationship with a YANG model node, and the corresponding YANG model node is not the target YANG model node, such first attribute is deleted. The remaining first attributes are second attributes. The second attributes are combined into a CLI command, thereby obtaining a first CLI command.

[0074] In one embodiment, the extracting the first CLI command from the target CLI command template further includes the following steps:

[0075] In the process of identifying the first attributes in the target CLI command template, a first tree structure with the first attributes as nodes is constructed according to the relationship between the first attributes.

[0076] In the target CLI command template, the first attributes have a hierarchical relationship, and the multiple optional values ​​associated with the identifier have the same hierarchy. According to the relationship between the first attributes, a first tree structure can be constructed so that the first attributes of the upper and lower hierarchical levels form a parent-child node relationship in the first tree structure.

[0077] Figure 6 A schematic diagram of constructing a first tree structure for the template 2 is shown. In the process of constructing the first tree structure, it can be determined whether the first attribute in the template 2 is the second attribute. Figure 6 As shown, first determine that "qos-profile" is not an identifier. There is no mapping relationship between "qos-profile" and the YANG model node, so it is retained as the second attribute. The child nodes of the "qos-profile" node are " <qos-profile-name> ”," <qos-profile-name>"Non-identifier, which has a mapping relationship with the YANG model node and has a corresponding target YANG model node, so it is also retained as the second attribute." <qos-profile-name>"The identifier "{}" is after the node. According to the meaning of the identifier, it is expanded into two optional values ​​"inbound" and "outbound". Both optional values ​​are " <qos-profile-name>" node. Both optional values ​​have a mapping relationship with the YANG model node and have corresponding target YANG model nodes, so they are both retained as the second attribute. By analogy, the first tree structure corresponding to template 2 can be constructed and the second attribute therein can be determined. It should be noted that Figure 6 The "-" in indicates that no value is selected. For example, the identifier "[]" and "[x|y|…]" indicate that the elements are optional. When no value is selected, it is represented by "-". "-" does not have a mapping relationship with the YANG model node and can be retained as the second attribute. <group-name>"There is a mapping relationship with the YANG model node, but there is no corresponding target YANG model node, so it is filtered out and is not the second attribute.

[0078] In one implementation, combining the second attributes to form the first CLI command may include the following steps:

[0079] Determine a valid path in the first tree structure; a valid path is a path from a root node to a leaf node, all of which have the second attribute;

[0080] A first CLI command is formed according to the valid path.

[0081] Taking the first tree structure corresponding to template 1 as an example, its root node can be a public root node (which can be a node without actual meaning, indicating the start of the first tree structure), or a "qos-profile" node, and its leaf node can be the first attribute of the lowest level. A valid path needs to meet two conditions: one is a complete path, that is, a path from the root node to the leaf node, such as Figure 6 The path from the "start" to the "-" node in the tree. If the end point of a path is not a leaf node, the path is not a complete path, and is not a valid path. The second is that the nodes on the path are all second attributes. If a path includes at least one node with the first attribute, the path is not a valid path. When determining the valid path, the second attributes in the valid path can be combined in the order of the path to form a first CLI command. Each valid path can correspond to a first CLI command. The accuracy of the first CLI command can be guaranteed by means of the first tree structure.

[0082] Combine the following Figure 7 The process of extracting the first CLI command is further illustrated. Figure 7 As shown, the process of extracting the first CLI command may include the following steps:

[0083] Step S701, parsing elements in the target CLI command template.

[0084] Step S702, determine whether the current element is an attribute or an identifier, if it is an attribute, execute step S703, if it is an identifier, execute step S704.

[0085] Step S703: taking the identified attribute as the first attribute.

[0086] Step S704: Expand the identifier according to its meaning and use the optional value as the first attribute.

[0087] Step S705, determining whether the first attribute has a mapping relationship with a YANG model node, if so, executing step S706, if not, executing step S708.

[0088] Step S706, determining whether the YANG model node of the first attribute mapping is a target YANG model node, if so, executing step S708, if not, executing step S707.

[0089] Step S707: filter out the first attribute.

[0090] Step S708, determining the second attribute.

[0091] Step S709: combine the second attributes to form a first CLI command.

[0092] Exemplarily, by adopting the above method, the first CLI command can be determined from template 1 and template 2 as shown in Table 2:

[0093] Table 2

[0094] Serial number First CLI Command 1 qos-profile <qos-profile-name>inbound identifier none 2 qos-profile <qos-profile-name>inbound identifier at 3 qos-profile <qos-profile-name>inbound identifier ce-vid 4 qos-profile <qos-profile-name>inbound identifier vid-ce-vid 5 qos-profile <qos-profile-name>inbound 6 qos-profile <qos-profile-name>outbound identifier none 7 qos-profile <qos-profile-name>outbound identifier vid 8 qos-profile <qos-profile-name>outbound identifier ce-vid 9 qos-profile <qos-profile-name>outbound identifier vid-ce-vid 10 qos-profile <qos-profile-name>outbound

[0095] Continue to refer Figure 1 In step S150, a second CLI command is determined from the first CLI command according to the similarity between the first CLI command and the text value.

[0096] The similarity between the first CLI command and the text value of the target YANG model node may be calculated based on the text feature to measure the matching degree between each first CLI command and the network configuration file.

[0097] In one embodiment, reference Figure 8 As shown, the above-mentioned determining the second CLI command from the first CLI command according to the similarity between the first CLI command and the text value may include the following steps S810 and S820:

[0098] Step S810, combining text values ​​to form a text to be matched;

[0099] Step S820: Calculate the similarity between the text to be matched and the first CLI command, and determine the first CLI command with the highest similarity as the second CLI command.

[0100] For example, the text values ​​uni_1000m, inbound, and none of the target YANG model node above can be combined to form a to-be-matched text, and the similarity between the to-be-matched text and the first CLI command in Table 2 is calculated one by one, where the first CLI command "qos-profile <qos-profile-name>Inbound identifier none" has the highest similarity with the command to be matched, and the first CLI command is used as the second CLI command. The second CLI command can be used as a conversion result of converting a network configuration file into a CLI command.

[0101] In one embodiment, the network configuration file processing method may further include the following steps:

[0102] If the second CLI command includes a variable attribute, the variable attribute is filled in according to the text value to obtain a third CLI command.

[0103] For example, the second CLI command "qos-profile <qos-profile-name>inbound identifiernone" contains variable attributes" <qos-profile-name>", fill the uni_1000m in the text value with the value, that is, " <qos-profile-name>" is replaced with uni_1000m, resulting in the third CLI command "qos-profile<uni_1000m> inbound identifier none". The third CLI command may be output as a final conversion result of converting the network configuration file into the CLI command.

[0104] The exemplary embodiment of the present disclosure also provides a network configuration file processing device. Fig. 9 As shown, the network configuration file processing device 900 may include:

[0105] The file acquisition module 910 is configured to acquire a network configuration file, where the network configuration file includes data based on a YANG model;

[0106] A file parsing module 920, configured to parse out a target YANG model node and a text value of the target YANG model node in the network configuration file;

[0107] The template determination module 930 is configured to determine a target CLI command template corresponding to a target YANG model node based on a pre-configured mapping relationship between a YANG model and a CLI command;

[0108] A first CLI command determination module 940 is configured to extract a first CLI command from a target CLI command template;

[0109] The second CLI command determining module 950 is configured to determine the second CLI command from the first CLI command according to the similarity between the first CLI command and the text value.

[0110] In one embodiment, extracting a first CLI command from a target CLI command template includes: identifying a first attribute in the target CLI command template; filtering out first attributes that have a mapping relationship with a YANG model node and whose corresponding YANG model node is not the target YANG model node, and using the remaining first attributes as second attributes; and combining the second attributes to form the first CLI command.

[0111] In one embodiment, identifying the first attribute in the target CLI command template includes: identifying the elements in the target CLI command template one by one; if the current element is an identifier, expanding the identifier according to the meaning of the identifier, and taking all optional values ​​associated with the identifier as the first attribute.

[0112] In one embodiment, extracting a first CLI command from a target CLI command template also includes: in a process of identifying a first attribute in the target CLI command template, constructing a first tree structure with the first attribute as a node according to the relationship between the first attributes; combining the second attributes to form the first CLI command, including: determining a valid path in the first tree structure; the valid path is a path from the root node to the leaf node where all the nodes are the second attribute; and forming the first CLI command according to the valid path.

[0113] In one embodiment, based on the similarity between the first CLI command and the text value, determining the second CLI command from the first CLI command includes: combining the text values ​​to form a text to be matched; calculating the similarity between the text to be matched and the first CLI command, and determining the first CLI command with the highest similarity as the second CLI command.

[0114] In one embodiment, the device is further used for: if the second CLI command includes a variable attribute, filling the variable attribute with a text value to obtain a third CLI command.

[0115] In one embodiment, the device is also used to: obtain a YANG model and a CLI command template; construct a second tree structure based on the YANG model, and determine the YANG model nodes based on the nodes of the second tree structure; determine the attributes corresponding to the YANG model nodes, and configure the mapping relationship between the YANG model and the CLI command according to the attributes corresponding to the YANG model nodes and the attributes included in the CLI command template.

[0116] The specific details of each part of the above-mentioned device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.

[0117] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0118] The exemplary embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the above-mentioned named entity recognition method is implemented.

[0119] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.

[0120] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.

[0121] The code of the computer program can be written in one or more programming languages. Programming languages ​​such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).

[0122] Computer programs can be carried or transmitted through electrical, magnetic, optical, electromagnetic, infrared and other signals. Electronic devices can convert signals carrying computer programs into digital signals to run computer programs. When a computer program is running on an electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device can execute) the method steps of various exemplary embodiments of the present disclosure, such as the following steps: Step S110, obtain a network configuration file, the network configuration file includes data based on a YANG model; Step S120, parse the target YANG model node and the text value of the target YANG model node in the network configuration file; Step S130, based on the mapping relationship between the pre-configured YANG model and the CLI command, determine the target CLI command template corresponding to the target YANG model node; Step S140, extract the first CLI command from the target CLI command template; Step S150, determine the second CLI command from the first CLI command according to the similarity between the first CLI command and the text value.

[0123] Based on the execution of the above method by a computer program, an efficient conversion solution from YANG model to CLI command is provided, which can generate CLI commands that meet the specifications according to the data structure and constraints defined by the YANG model. In particular, for the possible non-one-to-one mapping relationship between the YANG model and the CLI command, a more accurate conversion result is screened out by determining the target CLI command template and calculating the similarity. This helps operation and maintenance, R&D management personnel and other personnel to batch process the configuration of network devices, and can achieve the conversion from YANG model to CLI command without hard coding, providing the possibility for multi-model integration, reducing manual operations, and reducing human errors, saving a lot of development costs, and improving work efficiency. In addition, it can be compatible with different equipment manufacturers to ensure that the converted target CLI command can be correctly executed on the target device.

[0124] The exemplary embodiments of the present disclosure also provide an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as a computer program. The processor executes the method steps of various exemplary embodiments of the present disclosure by executing the executable instructions.

[0125] Reference below Fig.10 , the electronic device is exemplarily described in the form of a general-purpose computing device. It should be understood that Fig.10 The electronic device 1000 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0126] like Fig.10 As shown, the electronic device 1000 may include: a processor 1010 , a memory 1020 , a bus 1030 , an I / O (input / output) interface 1040 , and a network adapter 1050 .

[0127] The memory 1020 may include a volatile memory, such as a RAM 1021, a cache unit 1022, and may also include a non-volatile memory, such as a ROM 1023. The memory 1020 may also include one or more program modules 1024, such program modules 1024 include but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof may include the implementation of a network environment. For example, the program module 1024 may include each module in the above-mentioned device.

[0128] The processor 1010 may include one or more processing units. For example, the processor 1010 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc.

[0129] The processor 1010 may be used to execute executable instructions stored in the memory 1020, which may include method steps of various exemplary embodiments of the present disclosure, such as executing the following steps: step S110, obtaining a network configuration file, the network configuration file including data based on a YANG model; step S120, parsing a target YANG model node and a text value of the target YANG model node in the network configuration file; step S130, determining a target CLI command template corresponding to the target YANG model node based on a pre-configured mapping relationship between a YANG model and a CLI command; step S140, extracting a first CLI command from the target CLI command template; step S150, determining a second CLI command from the first CLI command according to a similarity between the first CLI command and the text value.

[0130] Based on the execution of the above method by electronic devices, an efficient conversion scheme from YANG model to CLI command is provided, which can generate CLI commands that meet the specifications according to the data structure and constraints defined by the YANG model. In particular, for the possible non-one-to-one mapping relationship between the YANG model and the CLI command, a more accurate conversion result is screened out by determining the target CLI command template and calculating the similarity. This helps operation and maintenance, R&D management personnel and other personnel to batch process the configuration of network equipment, and can achieve the conversion from YANG model to CLI command without hard coding, providing the possibility for multi-model integration, reducing manual operations, and reducing human errors, saving a lot of development costs, and improving work efficiency. In addition, it can be compatible with different equipment manufacturers to ensure that the converted target CLI command can be correctly executed on the target device.

[0131] The bus 1030 is used to realize the connection between different components of the electronic device 1000, and may include a data bus, an address bus, and a control bus.

[0132] The electronic device 1000 can communicate with one or more external devices 1100 (eg, a keyboard, a mouse, an external controller, etc.) through the I / O interface 1040 .

[0133] The electronic device 1000 can communicate with one or more networks through the network adapter 1050. For example, the network adapter 1050 can provide mobile communication solutions such as 3G / 4G / 10G, or provide wireless communication solutions such as wireless LAN, Bluetooth, near field communication, etc. The network adapter 1050 can communicate with other modules of the electronic device 1000 through the bus 1030.

[0134] although Fig.10 Not shown, other hardware and / or software modules may also be provided in the electronic device 1000, including but not limited to: a display, a microcode, a device driver, a redundant processor, an external disk drive array, a RAID system, a tape drive, and a data backup storage system.

[0135] As can be seen from the above, the technical solution of the present disclosure can be implemented as a method, an apparatus, a system, a computer program product, a storage medium, an electronic device, etc. Those skilled in the art can understand that various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software, such as being respectively referred to as a "circuit", "module" or "system".

[0136] It should be understood that the present disclosure is not limited to the specific method steps or structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. Those skilled in the art will easily think of other embodiments based on the specific embodiments provided by the present disclosure. Therefore, the specific embodiments provided by the present disclosure are only exemplary, and the scope and spirit of the present disclosure are indicated by the claims, and any variations, uses or adaptive changes of the present disclosure should be covered, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the technical field that are not disclosed in the present disclosure. < / qos-profile-name>

Claims

1. A method for processing a network configuration file, It is characterized in that The method comprises: Obtain a network configuration file, wherein the network configuration file includes data based on a YANG model; Parsing a target YANG model node and a text value of the target YANG model node in the network configuration file; Determine a target CLI command template corresponding to the target YANG model node based on a pre-configured mapping relationship between a YANG model and a command line interface CLI command; Extracting a first CLI command from the target CLI command template; A second CLI command is determined from the first CLI command according to a similarity between the first CLI command and the text value.

2. The method according to claim 1, It is characterized in that The extracting the first CLI command from the target CLI command template includes: Identifying a first attribute in the target CLI command template; Filter out the first attributes of the target YANG model nodes that have a mapping relationship with the YANG model nodes and whose corresponding YANG model nodes are not the target YANG model nodes, and use the remaining first attributes as the second attributes. The second attributes are combined to form the first CLI command.

3. The method according to claim 2, It is characterized in that The identifying a first attribute in the target CLI command template includes: Identify the elements in the target CLI command template one by one; If the current element is an identifier, the identifier is expanded according to the meaning of the identifier, and all optional values ​​associated with the identifier are used as the first attribute.

4. The method according to claim 2, It is characterized in that The extracting the first CLI command from the target CLI command template further includes: In the process of identifying the first attributes in the target CLI command template, constructing a first tree structure with the first attributes as nodes according to the relationship between the first attributes; The combining the second attributes to form the first CLI command includes: Determine a valid path in the first tree structure; the valid path is a path from a root node to a leaf node, all of which have the second attribute; The first CLI command is formed according to the effective path.

5. The method according to claim 1, It is characterized in that The determining a second CLI command from the first CLI command according to the similarity between the first CLI command and the text value includes: Combining the text values ​​to form a text to be matched; The similarity between the text to be matched and the first CLI command is calculated, and the first CLI command with the highest similarity is determined as the second CLI command.

6. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: If the second CLI command includes a variable attribute, the variable attribute is filled in according to the text value to obtain a third CLI command.

7. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: Get the YANG model and CLI command template; constructing a second tree structure based on the YANG model, and determining a YANG model node based on a node of the second tree structure; Determine the attribute corresponding to the YANG model node, and configure the mapping relationship between the YANG model and the CLI command according to the attribute corresponding to the YANG model node and the attribute included in the CLI command template.

8. A network configuration file processing device, It is characterized in that The device comprises: A file acquisition module is configured to acquire a network configuration file, wherein the network configuration file includes data based on a YANG model; A file parsing module, configured to parse out a target YANG model node and a text value of the target YANG model node in the network configuration file; A template determination module is configured to determine a target CLI command template corresponding to the target YANG model node based on a pre-configured mapping relationship between a YANG model and a CLI command; a first CLI command determination module, configured to extract a first CLI command from the target CLI command template; The second CLI command determination module is configured to determine a second CLI command from the first CLI command according to a similarity between the first CLI command and the text value.

9. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An electronic device, It is characterized in that include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.