Network equipment configuration conversion method
By introducing high-level configuration function description and large language model, cross-vendor network equipment configuration conversion is automated, and the conversion results are evaluated through configuration parser and functional consistency analysis, the accuracy and evaluation problems of configuration conversion in the prior art are solved, and the reliability of the conversion process and the quality of the results are improved.
Patent Information
- Application Number
- CN202510166733.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-17
AI Technical Summary
The prior art is difficult to achieve accurate cross-vendor network equipment configuration conversion, and the lack of effective evaluation of the conversion results, resulting in poor quality stability of the conversion results.
By introducing high-level configuration function description as the intermediate layer, a large language model is used to realize automated end-to-end network device configuration conversion, and syntax, view and function evaluation of the conversion results are performed through configuration parser and functional consistency analysis.
A more accurate cross-vendor network equipment configuration conversion is achieved, and a multi-dimensional evaluation of the conversion results is given, which improves the reliability of the conversion process and the quality of the results.
Smart Images

Figure CN120166029A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network intelligent operation and maintenance, and particularly to a method for converting network device configurations. Background Art
[0002] Network devices such as routers and switches are important network infrastructure. During network operation and maintenance, network devices often need to be updated and replaced due to factors such as equipment aging, damage, or economic benefits. The process of replacing devices usually requires migrating device configurations. Due to factors such as functionality, economic benefits, and policies, cross-vendor device replacements often occur. However, the configuration models of network devices from different vendors vary greatly, and the configuration migration process requires converting the original device configuration so that the converted configuration can be normally issued and run on the new device.
[0003] The existing configuration conversion process is usually manually completed by operation and maintenance experts. They need to read the original device configuration commands, understand their functions, consult relevant target device documents, and write new commands for the target device. This work not only requires operation and maintenance experts to have a relatively deep understanding of the configuration methods of both devices, but also consumes a large amount of manpower, and it is difficult to avoid errors. Therefore, there is an urgent need for an automated network device configuration conversion tool to assist in the above process.
[0004] The existing network device conversion methods are mainly divided into two categories: single command recommendation and end-to-end configuration conversion. Among them, target command recommendation means that given an original configuration command, the system will automatically search and give the top k commands that may be the most relevant. Although this method has high flexibility, a large amount of manual operations for screening and generating configurations still need to be carried out later, and it cannot fundamentally solve the problem of configuration logic differences. The existing end-to-end configuration conversion methods also have limitations. For example, they have poor generalization ability, lack a sufficient error feedback mechanism during the conversion process, etc., resulting in poor quality stability of the conversion results and a lack of self-evaluation of the conversion results. It is difficult for operation and maintenance engineers to directly use the conversion results with unknown quality and reliability, and still need to carry out a large amount of manual verification and correction work. In short, the existing methods are difficult to be truly used in the production practice of real networks. Summary of the Invention
[0005] The present invention aims to solve at least one of the technical problems in the related art to some extent.
[0006] The present invention proposes a method for converting network device configurations, aiming to solve the technical problem of how to more accurately achieve end-to-end cross-vendor network device configuration conversion and evaluate the conversion results. In a real network environment, there are significant differences in the design concepts of network device configuration models and the behavior patterns of devices from different vendors, making it extremely difficult to directly implement configuration conversion based on rule mapping. To solve the above problems, the present invention proposes to use high-level configuration function descriptions as an intermediate layer and introduce the knowledge in configuration documents to achieve automated end-to-end network device configuration conversion.
[0007] To achieve the above object, on the one hand, the present invention proposes a method for converting network device configurations, including:
[0008] Construct a device configuration model and a corresponding configuration parser according to the source device command document, and parse the corresponding source device configuration file to extract the document information and view information corresponding to the configuration commands;
[0009] According to the extracted document information and view information corresponding to the configuration commands, write prompts for configuration splitting and function extraction for the selected configuration template, source device commands, and corresponding documents, and use a large language model to split the source device configuration into configuration fragment data with function descriptions;
[0010] Retrieve and recall the configuration documents and command documents of the target device according to the configuration fragment data at the same time, and reorder the recalled content corresponding to the configuration documents and command documents of the target device;
[0011] Write configuration conversion prompts according to the two types of document data recalled after reordering and the configuration fragment data to convert and generate the corresponding configuration of the target device;
[0012] Write prompts for analyzing the consistency of configuration functions, and use a large language model to analyze the functional consistency between the corresponding configuration of the target device generated by the conversion and the original configuration, so as to perform directional recall of the configuration documents and command documents for inconsistent entries.
[0013] The network device configuration conversion method according to the embodiments of the present invention may also have the following additional technical features:
[0014] In an embodiment of the present invention, the method further includes: using the constructed configuration parser to evaluate the correctness of the syntax and view of the corresponding configuration of the target device after conversion, and using the prompts for analyzing the consistency of configuration functions to evaluate the semantic functional consistency of the corresponding configuration of the target device after conversion based on a large language model.
[0015] In an embodiment of the present invention, search for and complete the view for commands with incomplete views. In the case of multiple views, select the commands under the correct view by external personnel.
[0016] In an embodiment of the present invention, a device configuration model and a corresponding configuration parser are constructed according to a source device command document, and the corresponding source device configuration file is parsed to extract the document information and view information corresponding to the configuration command, including:
[0017] Obtain the command document from the official document of the network device, and organize the pages of the command document into a class tree structure according to the view relationship to construct the configuration model of each network device;
[0018] The command graph model corresponding to the node in the tree node information is a formatted representation of the node CLI command template. The command graph model converts the CLI command template described in text into a graph node relationship, so that each graph node represents a matching pattern in the command. The key information in the configuration command is extracted by matching the input command with the command template;
[0019] Write a configuration parser based on the configuration model of the network device of the preset manufacturer, and use the command graph model to parse the input complete configuration file line by line, and generate the hierarchical information matching the configuration file on the configuration model of the network device, and finally form the parsed configuration tree.
[0020] In an embodiment of the present invention, the tree node information includes various types such as node type, node CLI command template, parent node, child node list, node corresponding document path, node depth, and command graph model corresponding to the node; the node information in the configuration tree includes: various types such as the CLI configuration command line of the current node, the node of the corresponding network device configuration model, the parent node of the configuration tree, the child node list, the corresponding command graph model, and the fuzzy matching command list.
[0021] In an embodiment of the present invention, use the command graph model to parse the input complete configuration file line by line, and generate the hierarchical information matching the configuration file on the configuration model of the network device, and finally form the parsed configuration tree, including:
[0022] Initialize the current view as the root view, read the configuration command line line by line from the beginning of the configuration file, and at the same time start matching the currently read configuration command line from the root node of the network device configuration model;
[0023] During the matching process of each line, construct a command graph model for matching, record the result of successful matching in the command graph model corresponding to the node, and record the corresponding configuration model node information. If the successfully matched node is a view node, adjust the current view to the newly matched view; if the matching fails, match again in the parent view until the search returns to the root view. If the matching still fails, mark the node as a node that does not conform to the view relationship;
[0024] After all command-line matches in the configuration file are completed, traverse all nodes in the configuration tree that do not conform to the view relationship. Without considering the view relationship, re-match in the full set of commands, and record the successfully matched entries in the fuzzy matching command list.
[0025] In one embodiment of the present invention, retrieving and recalling the configuration document and command document of the target device according to the configuration fragment data at the same time, and re-ranking according to the recalled content corresponding to the configuration document and command document of the target device, including:
[0026] Construct a retrieval prompt for the configuration document directory, and use a large prediction model to read several levels of the document directory to obtain relevant sub-documents. Use a sentence vector model to vectorize and encode the titles and function descriptions of all pages of the sub-documents to obtain a configuration sub-document function description vector library. Vectorize and encode the function description statements of each line of commands in each configuration fragment data after splitting, and use cosine similarity to calculate the similarity scores between each configuration function description and all configuration document pages, and screen the top k similar documents; perform operations on all m function descriptions in a configuration fragment data to obtain m×k similar documents and similarity scores, merge the similarity scores of the same document pages, obtain a list of target device configuration documents with weighted similarity, normalize the merged document scores, and take the top K with the highest similarity scores from the merged list as the preliminary recall results of the configuration document;
[0027] Perform sentence vector encoding on the command function descriptions of the full set of command documents, use all m function descriptions of the configuration fragment data to perform Top-k cosine similarity recalls respectively, and merge the similarities of the same document. Normalize the merged document scores, and take the top K with the highest similarity scores from the merged list as the preliminary recall results;
[0028] For the command document, calculate the BM25 value of each command corresponding to the command document in all configuration documents, and obtain the weighted score with the preliminary recall result score of the configuration document as the weight. Add the weighted score to the original score to obtain the new score of the command document, and re-arrange according to the new score to obtain the final recall result of the command document; for the configuration document, obtain the final recall scores of all commands involved in each configuration document corresponding to the command document, take the maximum score as the representative command score of the configuration document, and add it to the original score of the configuration document as the new score of the configuration document. Re-arrange the configuration documents according to the new score to obtain the final recall result of the configuration document;
[0029] Obtain the list of configuration documents and command documents corresponding to each configuration fragment data, and sort them from high to low according to the final recall scores respectively.
[0030] In one embodiment of the present invention, configuration conversion prompt words are written based on the two types of document data recalled after reordering and the configuration fragment data, so as to convert and generate the corresponding configuration of the target device, including:
[0031] Write configuration fragment conversion prompt words, including source device command fragments and corresponding source device command documents, currently converted target device configuration fragment data, target device-related configuration documents and command document lists, and use a large language model to perform configuration conversion;
[0032] Use the constructed target device configuration parser to parse the converted configuration to obtain entries with view mismatches or syntax mismatches, and use the sentence vector similarity method to retrieve the most similar k commands under the current view and the parent view as a reference for configuration correction;
[0033] Entries that only have view mismatches but correct syntax are also used as a reference for configuration correction. Write configuration syntax and view relationship correction prompt words, use a large language model to correct the commands, and parse the corrected commands. If the number of entries with view or syntax mismatches decreases, the correction result is adopted; otherwise, the configuration before correction is still used, and the iterative operation is performed until all command fragments are successfully converted.
[0034] In one embodiment of the present invention, write configuration function consistency analysis prompt words, recall the configuration documents and command documents of the inconsistent entries again in a targeted manner, and use a large language model to correct the converted configuration, including:
[0035] Write configuration function consistency analysis prompt words, which include the source device configuration and corresponding command documents before conversion and the target device configuration and corresponding command documents after conversion, use a large language model to check the configuration function consistency between the two, and annotate the doubtful points of consistency;
[0036] For the commands with inconsistent analysis, use the sentence vector similarity retrieval method to recall the target device-related configuration documents and command documents for a single source device command that has not been successfully converted, that is, retrieve the most similar k configuration documents and command documents according to the function of the original command that failed to be converted;
[0037] Write configuration function consistency correction prompt words, which include the source and target device configurations, doubtful points of function consistency, and the newly recalled target device-related configuration documents and command documents corresponding thereto, use a large language model to correct the doubtful points of consistency, and use the target device configuration parser to check the syntax and view of the corrected configuration.
[0038] In one embodiment of the present invention, a constructed configuration parser is used to evaluate the syntax and view of the converted configuration corresponding to the target device for correctness, and a configuration function consistency analysis prompt is used to evaluate the semantic function consistency of the converted configuration corresponding to the target device based on a large language model, including:
[0039] Use the target device configuration parser to check the view and syntax correctness of the converted target device configuration, and make detailed annotations on the commands that cannot pass the check;
[0040] Rewrite the configuration function consistency analysis prompt again, use the large language model to conduct a final evaluation of the consistency of the configuration function, and take the converted target device configuration file and two evaluation reports as the output; and according to the configuration conversion result and the target device document retrieval result, add the typical configuration templates to the template library.
[0041] The network device configuration conversion method according to the embodiment of the present invention integrates multiple modules such as a large language model, a configuration parser, configuration document extraction, conversion result evaluation and feedback, and configuration library enhancement, has a high conversion reliability, and gives a multi-dimensional evaluation analysis report of the conversion result, and has the ability to be applied in an actual network production environment.
[0042] Additional aspects and advantages of the present invention will be given in part in the following description, will become apparent in part from the following description, or will be understood through the practice of the present invention. Description of the Drawings
[0043] The above and / or additional aspects and advantages of the present invention will become apparent and be readily understood from the following description of the embodiments in conjunction with the drawings, wherein:
[0044] Figure 1 is a flowchart of the network device configuration conversion method according to the embodiment of the present invention;
[0045] Figure 2 is the overall work flowchart according to the embodiment of the present invention;
[0046] Figure 3 is the large language model prompt used in step S2 according to the embodiment of the present invention;
[0047] Figure 4 is the large language model prompt used in step S3 according to the embodiment of the present invention;
[0048] Figure 5 is the large language model prompt used in step S4 according to the embodiment of the present invention;
[0049] Figure 6 is the large language model prompt used in step S5 according to the embodiment of the present invention. Detailed implementation manners
[0050] It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments may be combined with each other. The present invention will be described in detail below with reference to the drawings and in combination with the embodiments.
[0051] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0052] The network device configuration conversion method according to the embodiments of the present invention will be described below with reference to the drawings.
[0053] Figure 1 is a flowchart of the network device configuration conversion method according to the embodiments of the present invention, as Figure 1 shown, the method includes:
[0054] S1. Construct a device configuration model and a corresponding configuration parser according to the source device command document, and parse the corresponding source device configuration file to extract the document information and view information corresponding to the configuration command;
[0055] S2. Write a prompt for configuration splitting and function extraction according to the extracted document information and view information corresponding to the configuration command, the selected configuration template, the source device command and the corresponding document, and use the large language model to split the source device configuration into configuration fragment data with function descriptions;
[0056] S3. Retrieve and recall the configuration document and command document of the target device according to the configuration fragment data at the same time, and reorder the recalled content corresponding to the configuration document and command document of the target device;
[0057] S4. Write a configuration conversion prompt according to the two types of document data recalled after reordering and the configuration fragment data to convert and generate the corresponding configuration of the target device;
[0058] S5. Write a prompt for analyzing the consistency of configuration functions, and use the large language model to analyze the functional consistency between the corresponding configuration of the target device generated by conversion and the original configuration, recall the configuration document and command document in a targeted manner for the inconsistent entries, and use the large language model to correct the converted configuration.
[0059] As Figure 2As shown in the figure, the present invention proposes an overall workflow of a cross-vendor network configuration conversion method based on a large language model. Through a high-level configuration function description as an intermediate layer, knowledge in the configuration document is introduced to achieve automated end-to-end network device configuration conversion. Specifically, it may include the following steps:
[0060] Step S1, extraction of source device configuration syntax and view relationship. First, construct a device configuration model and a corresponding configuration parser according to the source device command document, and then use the parser to parse the corresponding source device configuration file to extract the document page and view information corresponding to the configuration command. For commands with incomplete views, search and complete the views. If there are multiple views, the operation and maintenance engineer intervenes to select the commands under the correct view.
[0061] Specifically, the extraction of source device configuration syntax and view relationship includes the following 3 sub-steps and functional modules.
[0062] S11) First, obtain the command reference documents from the official network device documents (such as Huawei router command documents and Nokia router command documents), and then organize the document pages into a class tree structure according to the view relationship. Each view node contains the commands and corresponding documents that take effect under that view as child nodes, and so on. The constructed tree structure is the configuration model of each network device. Each node (HierarchyNode) of the tree contains the following information: node type (command or view), node CLI command template, parent node, list of child nodes, document path corresponding to the node, node depth, and command graph model corresponding to the node, etc.
[0063] The command graph model corresponding to the node is a formatted representation of the node CLI command template and contains all matching patterns of the command. Each CLI command template includes keywords, mandatory parameters, and optional parameters, etc. The command graph model converts the CLI command template described in text into graph node relationships. Each graph node CmdGraph includes its type (sequential matching, mandatory matching items, optional matching items, etc.), name, parameter value, sequence of child nodes, etc. The node command graph model is used for parsing a single command, that is, matching the input command with a certain command template and extracting information such as keywords and parameters of the configuration command at the same time.
[0064] S13) Write a configuration parser for the network device configuration model of a specific manufacturer. This parser is used to parse the input complete configuration file line by line and generate the hierarchical information that the configuration file matches on the network device configuration model, and finally form a parsed configuration tree. The nodes (ConfigNode) in the configuration tree contain the following information: the CLI configuration command line of the current node, the corresponding network device configuration model node (HierarchyNode), the parent node of the configuration tree, the list of child nodes, the corresponding command graph model, and the fuzzy matching command list, etc. The process of parsing the configuration file into a configuration tree is stateful, and the specific process is as follows: First, initialize the current view as the root view, read the configuration command line line by line from the beginning of the configuration file, and at the same time start matching the currently read configuration command line from the root node of the network device configuration model; the matching process for each line is to first try to build a command graph model to achieve exact matching, and record the successful matching result in the corresponding command graph model of this node, and at the same time record information such as the corresponding configuration model node. If the successfully matched node is a view node, then adjust the current view to the newly matched view; if it cannot be matched, then try to match again in the parent view (commands returned by the view are often omitted in the configuration file, so performing view rollback matching can still ensure the correctness of the view) until the search returns to the root view. If it still cannot be matched, then mark this node as a node that does not conform to the view relationship. After all the command lines in the configuration file are matched, traverse all the nodes in the configuration tree that do not conform to the view relationship, and perform re-matching in the full set of commands without considering the view relationship, and record the successfully matched entries in the fuzzy matching command list. This list is used as reference information in the subsequent error correction process. The parsed configuration file contains the following information: configuration command line, corresponding configuration document file, corresponding command graph model (syntax matching result), view hierarchical relationship (implied in the parent-child relationship of the nodes in the configuration tree), fuzzy matching list (command lines that are not successfully matched by the view), etc.
[0065] Step S2, configuration function extraction based on the large language model and the configuration template library. According to the information such as the source device command configuration corresponding document and the configuration template library extracted in step S1, write a template selection prompt. First, use the large language model to select the configuration templates that may be used, and then write a configuration splitting and function extraction prompt with the selected configuration templates, the source device commands, and the corresponding documents, and use the large language model to split the source device configuration into configuration fragments with function descriptions.
[0066] Specifically, the purpose of the configuration function analysis based on the large language model and the configuration template library is to split the entire parsed configuration file into configuration fragments in units of functions, and summarize and analyze the functions corresponding to the configuration fragments. Step S2 includes the following two sub-steps:
[0067] S21) Configuration template selection. The configuration template library is expert knowledge organized and summarized based on pre-existing expert experience, previous correct translation results, etc. It is a dictionary with the "overall configuration function description" as the key and the "command template framework and detailed function description" as the value. The function description is presented in the style of the target device documentation for easy subsequent retrieval of relevant target device documentation. The configuration template library stores common typical command combinations and should not be too large, preferably 100 or fewer. When using it, first construct a configuration template selection prompt, which includes a list of template libraries (a list of all overall configuration function descriptions in the template library), the configuration commands parsed in step S1, and the corresponding command document content, etc. Use a large language model to select several configuration templates that may be used. The extracted relevant configuration templates can assist the process of splitting configurations and functional analysis by the large prediction model in the next sub-step;
[0068] S22) Configuration splitting and function extraction with enhanced configuration templates. Construct a configuration splitting and function analysis prompt, which includes the command framework and detailed function descriptions of the relevant configuration templates extracted in the previous sub-step, the configuration commands parsed in step S1, and the corresponding command document content, etc. Use a large prediction model to split the complete configuration commands into segments according to functional modules and describe the function of each line of the command. The language style of the function description is consistent with the description style of the configuration template. The two prompt templates used in step S2 are as Figure 3 shown.
[0069] Step S3, hybrid target device document recall based on sentence vector embedding and similarity weighting. According to the configuration functions extracted in step S2, retrieve and recall the configuration documents and command reference documents of the target device simultaneously, and re-rank according to the recalled content of the configuration documents and command reference documents of the target device.
[0070] Specifically, step S3 is a hybrid target device document retrieval based on sentence vector embedding and similarity weighting. The purpose of this step is to retrieve and recall the configuration documents and command documents of the target device according to the configuration function descriptions obtained through analysis in step S2, which can be divided into the following three sub-steps:
[0071] S31) Configuration document recall. Configuration documents are tutorial-style documents, and each document page includes function descriptions, application scenarios, configuration steps, etc. Configuration documents are large in scale and have a hierarchical table of contents. During the configuration document recall process, first, construct a retrieval prompt for the configuration document table of contents, use a large language model to read several levels of the document table of contents, and obtain relevant sub-documents; then use a sentence vector model (such as Sentence-BERT and BGE-m3, etc.) to vectorize and encode the titles and function descriptions of all pages of the sub-documents to obtain a configuration sub-document function description vector library. At the same time, perform the same vectorization encoding on the function description statements (assuming there are m of them) for each line of commands in each configuration segment split in step S2, and use cosine similarity to calculate the similarity scores of all configuration document pages corresponding to each configuration function description, and select the top k (typical value k = 15) similar documents. Perform the above operations for all m function descriptions in a configuration segment to obtain m × k similar documents and similarity scores, and merge (algebraic sum) the similarity scores of the same document page to obtain a list of target device configuration documents weighted by similarity. Normalize the combined document scores, and take the top K (typical value K = 30) with the highest similarity scores from the combined list as the preliminary recall result of the configuration document. The prompt template used in step S3 is as Figure 4 shown.
[0072] S32) Command document recall. Command documents are detailed explanations of each configuration command, including command function descriptions, command formats (syntax forms such as keywords, parameters, etc.), parameter lists, etc., and are mainly used as references when generating specific commands. The command document recall process is similar to the configuration document recall process. The difference is that the organization form of command documents varies by manufacturer and there may not necessarily be a semantically meaningful document table of contents (such as lexicographical order, etc.). Therefore, perform sentence vector encoding on the command function descriptions of all command documents, and use all m function descriptions of the configuration segment to perform Top-k cosine similarity recalls respectively, and merge the similarities of the same document. Normalize the combined document scores, and take the top K (typical value K = 30) with the highest similarity scores from the combined list as the preliminary recall result.
[0073] S33) Re-rank the document recall results. The configuration document and the command document are associated. A configuration document contains several configuration commands, and each command corresponds to a command document. Use the recall results of the two documents obtained in S31 and S32 for correlation analysis and re-rank them respectively to improve the relevance of the documents at the front of the list. For the command document, calculate the BM25 value of each command corresponding to the command document in all configuration documents, and use the preliminary recall result score of the configuration document as the weight to obtain a weighted score. Add the weighted score to the original score to obtain the new score of the command document, and re-arrange according to the new score to obtain the final recall result of the command document; for the configuration document, extract all the commands involved in each configuration document, take the final recall scores of the command documents corresponding to these commands, and use the maximum score as the representative command score of the configuration document. Add it to the original score of the configuration document as the new score of the configuration document, and re-arrange the configuration documents according to the new score to obtain the final recall result of the configuration document. After step S3 is executed, each configuration fragment obtains a corresponding list of configuration documents and command documents, and the lists are sorted from high to low according to the final recall score.
[0074] Step S4, iterative configuration conversion guided by syntax and view relationship. According to the two types of documents recalled in step S3 and the configuration function and other information extracted in step S2, write configuration conversion prompt words to generate the corresponding configuration of the target device. Use the method in step S1 to construct a configuration parser for the target device to check the syntax and view relationship of the converted configuration, mark the commands with syntax or view errors, retrieve possible correct commands in the current view and the parent view, write configuration error correction prompt words, and perform an error correction on the converted configuration. Iteratively perform the above process until all configurations are completed.
[0075] Specifically, iterative configuration conversion guided by syntax and view relationship. This step is iteratively executed for each fragment in turn, and each iteration is divided into the following two sub-steps:
[0076] S41) Configuration fragment conversion. Write configuration fragment conversion prompt words, including the source device command fragment and the corresponding source device command document extracted in step S2, the currently converted target device configuration fragment (empty for the first iteration), the first k (typical value k = 15) of the target device-related configuration documents and command document lists extracted in step S3, etc., and use the large language model to perform configuration conversion. The prompt word template used in step S4 is as Figure 5 shown.
[0077] S42) Configure syntax and view relationship checking and correction. Use the method in step S1 to construct a target device configuration parser to parse the converted configuration, obtain the entries with view mismatches or syntax mismatches, and use the sentence vector similarity method in step S3 to retrieve the k (typical value k = 5) most similar commands under the current view and the parent view as references for configuration correction. According to step S1, only the entries with view mismatches but correct syntax exist in the fuzzy matching list, which is also used as one of the references for configuration correction. Write configuration syntax and view relationship correction prompts, including the configuration command fragments to be corrected with error markings, the problems corresponding to the error markings (only view mismatches / view and syntax mismatches), and possible recommended correction commands, etc. Use the large language model to correct the commands, and parse the corrected commands again. If the number of entries with view or syntax mismatches decreases, adopt the correction result; otherwise, still use the configuration before correction. Iteratively execute S41 and S42 until all command fragments are completed for conversion.
[0078] Step S5, configuration function consistency analysis. Write configuration function consistency analysis prompts, use the large language model to analyze the function consistency between the converted configuration and the original configuration, recall the configuration documents and command documents for the inconsistent entries in a targeted manner, and use the large language model for configuration correction. Conduct multiple rounds of iteration until the functions are consistent or the consistency level no longer improves.
[0079] Specifically, configuration function consistency analysis and correction. After step S4 is executed, the target device configuration commands for preliminary conversion have been obtained. Step S5 conducts a function consistency analysis on the converted commands and the source device commands before conversion, and corrects the inconsistent parts.
[0080] S51) Configuration function consistency analysis: Write configuration function consistency analysis prompts, including the source device configuration and corresponding command documents before conversion and the target device configuration and corresponding command documents after conversion, etc. Use the large language model to check the configuration function consistency between the two, and annotate the doubtful points of consistency; the prompt template used in step S5 is as Figure 6 shown.
[0081] S52) Configuration Function Consistency Correction: For the commands with inconsistent analysis in S51, use the sentence vector similarity retrieval method described in step S3 to recall the target device-related configuration documents and command documents for the single command (group) of the source device that has not been successfully converted, that is, according to the function of the original command that failed to be converted, retrieve the k most similar configuration documents and command documents (typical value k = 30). Compile a configuration function consistency correction prompt word, which includes the source, target device configurations, doubts about function consistency, and the corresponding newly recalled target device-related configuration documents and command documents, etc., and use the large language model to correct the doubts about consistency. The corrected configuration needs to be checked for syntax and view using the target device configuration parser used in step S42 to ensure that the function consistency correction is completed under the premise of correct syntax and view. Use this method to correct each of the doubts about consistency obtained in S51 one by one.
[0082] Step S6, Evaluation and Output of Configuration Conversion Results. Use the configuration parser constructed in step S1 to evaluate the syntax and view correctness of the converted configuration; use the configuration function consistency analysis prompt word in step S5, combined with the large language model, to evaluate the semantic function consistency of the converted configuration. Output the converted configuration and the corresponding evaluation content for the reference of operation and maintenance personnel.
[0083] Specifically, evaluation and output of configuration conversion results. The evaluation of configuration conversion results is divided into two dimensions: syntax and view correctness and function consistency.
[0084] S61) Syntax and View Correctness Evaluation: Use the target device configuration parser used in step S42 to check the view and syntax correctness of the converted target device configuration, and make detailed annotations for the commands that cannot pass the check: view mismatch but there is a correct syntax match / both view and syntax cannot match.
[0085] S62) Configuration Function Consistency Evaluation: Compile the configuration function consistency analysis prompt word used in step S5 again, and use the large language model to conduct a final evaluation of the consistency of the configuration function. The converted target device configuration file and two evaluation reports are used as the output of this system and handed over to network operation and maintenance engineers for use. The engineer can also add the typical configuration templates to the template library according to the configuration conversion results and the target device document retrieval results to improve the accuracy of subsequent configuration conversion.
[0086] In summary, the present invention proposes a cross-vendor network configuration conversion method with an evaluation feedback mechanism. First, the present invention constructs a device configuration model according to the source device manufacturer's command document, then writes a configuration parser to parse the source device configuration to obtain the command document corresponding to the source device configuration command; constructs prompts in combination with the configuration template library, and uses a large language model to split and analyze the functions of the source configuration; based on the analyzed configuration functions, retrieves the command document and configuration document of the target device through hybrid retrieval; constructs document-enhanced prompts, uses a large language model for configuration conversion, and uses the configuration parser of the target device to check the syntax and view correctness of the converted configuration; the converted configuration needs to undergo functional consistency analysis and correction; finally, evaluates the syntax, view correctness, and functional consistency of the conversion result, and outputs the converted configuration file and evaluation report for efficient use by network operation and maintenance engineers in actual network operation and maintenance.
[0087] The network device configuration conversion method according to an embodiment of the present invention integrates multiple modules such as a large language model, a configuration parser, configuration document extraction, conversion result evaluation feedback, and configuration library enhancement, has a high conversion reliability, and gives a multi-dimensional evaluation analysis report of the conversion result, and has the ability to be applied in an actual network production environment. The multi-functional configuration parser supports precise matching and fuzzy matching of configuration commands, and is used in multiple steps such as source device document extraction, command verification and evaluation of the target device after conversion, improving the conversion accuracy and making the quality of the conversion result more intuitive. Based on the command functions, retrieve in both the configuration tutorial document and the configuration command reference document, comprehensively retrieve and extract the two relevant documents, improving the configuration conversion accuracy. Accumulate configuration conversion experience through the template library and continuously improve the conversion accuracy during long-term use. It can output the converted configuration and corresponding multi-dimensional evaluations, such as the matching situation of configuration syntax and views, the functional consistency analysis of the converted configuration and the source configuration, etc., which is convenient for operation and maintenance experts to efficiently use the conversion result in the actual network. It has the ability to adapt and migrate across vendors and can adapt to different vendor configuration conversion tasks at low cost.
[0088] In the description of this specification, the description referring to terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0089] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In the description of the present invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise specifically defined.
Claims
1. A network device configuration conversion method, characterized in that: include: Construct a device configuration model and a corresponding configuration parser according to the source device command document, and parse the corresponding source device configuration file to extract the document information and view information corresponding to the configuration command; According to the document information and view information corresponding to the extracted configuration commands, the selected configuration templates, source device commands and corresponding documents are compiled into prompt words for configuration splitting and function extraction, and the source device configuration is split into configuration fragment data with function descriptions using a large language model; Retrieving the configuration document and command document of the target device according to the configuration fragment data, and reordering the configuration document and command document of the target device according to the recalled contents corresponding to the configuration document and command document; Writing configuration conversion prompt words according to the two document data recalled after reordering and the configuration fragment data, so as to convert and generate a corresponding configuration of the target device; Write configuration function consistency analysis prompts, and use the large language model to analyze the functional consistency between the converted target device configuration and the original configuration. Re-recall the configuration documents and command documents for inconsistent entries, and use the large language model to correct the converted configuration.
2. The method according to claim 1, characterized in that The method further includes: using the constructed configuration parser to evaluate the correctness of the syntax and view of the converted configuration corresponding to the target device, and using the configuration function consistency analysis prompt words to evaluate the semantic function consistency of the converted configuration corresponding to the target device based on the large language model.
3. The method according to claim 1, characterized in that Search and complete the view for commands with incomplete views. If there are multiple views, select the command in the correct view through external personnel.
4. The method according to claim 1, characterized in that: Build a device configuration model and a corresponding configuration parser based on the source device command document, and parse the corresponding source device configuration file to extract the document information and view information corresponding to the configuration command, including: Obtain command documents from the official documents of network devices, and organize the pages of command documents into a tree-like structure according to the view relationship to build a configuration model for each network device; The command graph model corresponding to the node in the tree node information is a formatted representation of the node CLI command template. The command graph model converts the CLI command template described in the text into a graph node relationship, so that each graph node represents a matching pattern in the command. The key information in the configuration command is extracted by matching the input command with the command template. A configuration parser is written based on the configuration model of the network device of the preset manufacturer, and the command graph model is used to parse the input complete configuration file line by line, and the hierarchical information matching the configuration file on the configuration model of the network device is generated, and finally a parsed configuration tree is formed.
5. The method according to claim 4, characterized in that The tree node information includes multiple types of node type, node CLI command template, parent node, child node list, node corresponding document path, node depth and command graph model corresponding to the node; The node information in the configuration tree includes: the CLI configuration command line of the current node, the corresponding network device configuration model node, the parent node of the configuration tree, the child node list, the corresponding command graph model and the fuzzy matching command list.
6. The method according to claim 4, characterized in that The command graph model is used to parse the input complete configuration file line by line, and generate hierarchical information that matches the configuration file on the configuration model of the network device, and finally form a parsed configuration tree, including: Initialize the current view as the root view, read the configuration command line line by line from the beginning of the configuration file, and match the currently read configuration command line starting from the root node of the network device configuration model; During the matching process of each row, a command graph model is constructed for matching, and the command graph model corresponding to the node with the successful matching result is recorded, and the corresponding configuration model node information is recorded. If the matched node is a view node, the current view is adjusted to the new matching view; if it cannot be matched, it is matched again in the parent view until the search returns to the root view. If it still cannot be matched, the node is marked as a node that does not meet the view relationship; After all command line matches in the configuration file are completed, all nodes in the configuration tree that do not meet the view relationship are traversed, and rematched in the full command without considering the view relationship, and the successfully matched entries are recorded in the fuzzy matching command list.
7. The method according to claim 1, characterized in that Retrieving and recalling the configuration document and command document of the target device simultaneously according to the configuration fragment data, and reordering the recalled contents corresponding to the configuration document and command document of the target device, including: Construct configuration document directory retrieval prompt words, and use the large prediction model to read several layers of document directories to obtain related sub-documents, use the sentence vector model to vectorize the titles and function descriptions of all pages of the sub-documents, obtain the configuration sub-document function description vector library, vectorize the function description statements of each line of commands in each split configuration fragment data, and use cosine similarity to calculate the similarity scores of all configuration document pages corresponding to each configuration function description, and filter the top k similar documents; operate on all m function descriptions in a configuration fragment data, obtain m×k similar documents and similarity scores, merge the similarity scores of the same document pages, obtain a similarity-weighted target device configuration document list, normalize the merged document scores, and take the top K with the highest similarity scores from the merged list as the preliminary recall results of the configuration documents; Encode the command function descriptions of the full command document into sentence vectors, use all m function descriptions of the configuration fragment data to perform Top-k cosine similarity recall, merge the similarities of the same documents, normalize the merged document scores, and take the top K with the highest similarity scores from the merged list as the preliminary recall results; For command documents, calculate the BM25 value of the command corresponding to each command document in all configuration documents, and use the preliminary recall result score of the configuration document as the weight to obtain a weighted score. Add the weighted score to the original score to obtain a new score for the command document, and rearrange according to the new score to obtain the final recall result of the command document. For configuration documents, obtain the final recall score of the command documents corresponding to all commands involved in each configuration document, take the maximum score as the representative command score of the configuration document, and add it to the original score of the configuration document as the new score of the configuration document. Rearrange the configuration documents according to the new score to obtain the final recall result of the configuration document. Get the configuration document list and command document list corresponding to each configuration fragment data, and sort them from high to low according to the final recall score.
8. The method according to claim 1, characterized in that Writing configuration conversion prompt words according to the two document data recalled after reordering and the configuration fragment data to convert and generate the corresponding configuration of the target device, including: Write configuration fragment conversion prompts, including source device command fragments and corresponding source device command documents, currently converted target device configuration fragment data, target device related configuration documents and command document lists, and use a large language model to perform configuration conversion; Use the built target device configuration parser to parse the converted configuration to obtain entries with view mismatch or syntax mismatch, and use the sentence vector similarity method to retrieve the most similar k commands in the current view and parent view as a reference for configuration modification; The fuzzy matching list of entries with only view mismatch but correct syntax is also used as a reference for configuration correction. Configuration syntax and view relationship correction prompts are written, and the commands are corrected using a large language model. The corrected commands are parsed. If the number of entries with view or syntax mismatch decreases, the correction result is adopted; otherwise, the configuration before correction is still used, and the operation is iterated until all command fragments are converted.
9. The method according to claim 1, characterized in that: Write configuration function consistency analysis prompts, re-recall configuration documents and command documents for inconsistent entries, and use the large language model to correct the converted configuration, including: Write configuration function consistency analysis prompts, including the source device configuration and corresponding command documents before conversion and the target device configuration and corresponding command documents after conversion, use a large language model to check the configuration function consistency of the two, and annotate any doubtful consistency points; For commands with inconsistent analysis, the sentence vector similarity retrieval method is used to recall the target device related configuration documents and command documents for the single command of the source device that was not successfully converted. That is, according to the original command function that failed to be converted, the most similar k configuration documents and command documents are retrieved; Write configuration function consistency correction prompts, which include source and target device configurations, points where function consistency is in doubt, and the corresponding newly recalled target device-related configuration documents and command documents. Use a large language model to correct points where consistency is in doubt. Use the target device configuration parser to perform syntax and view checks on the corrected configuration.
10. The method according to claim 2, characterized in that The constructed configuration parser is used to evaluate the correctness of the syntax and view of the converted target device configuration. The configuration function consistency analysis prompt words are used to evaluate the semantic function consistency of the converted target device configuration based on the large language model, including: Use the target device configuration parser to check the view and syntax correctness of the converted target device configuration, and mark the commands that fail the check in detail; Write the configuration function consistency analysis prompt words again, use the large language model to make a final evaluation of the configuration function consistency, and output the converted target device configuration file and two evaluation reports; and According to the configuration conversion results and the target device document retrieval results, typical configuration templates are added to the template library.