Data processing method and device and storage medium

By introducing template objects and preset operations in YANG data processing, the problem of high difficulty in YANG data processing is solved, and a more efficient and concise data processing process is achieved, and the threshold for use is lowered.

CN119760002APending Publication Date: 2025-04-04CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411933617.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In the prior art, YANG data is difficult to process, resulting in a high threshold for use and it is difficult to achieve efficient network equipment configuration, monitoring and management.

Method used

By providing a data processing method, using template objects to perform preset operations on target YANG data, including data storage, updates and queries, simplifying the job process and reducing the complexity of YANG data processing.

Benefits of technology

This method simplifies the processing flow of YANG data, lowers the threshold for use, improves operation efficiency, and unblocks the binding relationship between YANG data processing and the SDN platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760002A_ABST
    Figure CN119760002A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and device and a storage medium, relates to the technical field of data processing, can execute an operation matched with request information on target YANG data, and is simple in operation process and low in use threshold. The method comprises the following steps: receiving request information, wherein the request information is used for requesting to execute a preset operation on target YANG data; the target YANG data comprises a plurality of sub-data; and in response to the request information, executing a preset operation on the target YANG data based on a template object corresponding to the target YANG data, the template object is used for describing node information where each piece of sub-data in the YANG data is located.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device and storage medium. Background Art

[0002] With the popularization of software defined network (SDN) technology, YANG model has gradually become the core modeling language in the field of network management. By using the YANG model engine to parse and execute the data structure and operations defined by the YANG model, developers can configure, monitor and manage network devices more efficiently, thereby realizing centralized control and management of the network.

[0003] Currently, developers can usually use the YANG model through open source SDN platforms to implement the parsing, verification and storage of YANG data. However, the open source SDN platform has high technical complexity, resulting in a high threshold for use. Therefore, how to reduce the difficulty of processing YANG data has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The present application provides a data processing method, device and storage medium, which can perform preset operations on YANG data and reduce the difficulty of processing YANG data.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect, the present application provides a data processing method, the method comprising: receiving request information, the request information being used to request a preset operation to be performed on target YANG data. The target YANG data includes a plurality of sub-data. In response to the request information, based on a template object corresponding to the target YANG data, a preset operation is performed on the target YANG data. The template object is used to describe node information where each sub-data in the YANG data is located.

[0007] According to the above technical means, the present application can perform operations matching the request information on the target YANG data according to the request information, and the process of performing preset operations on the target YANG data is simple. Based on the template object corresponding to the target YANG data, the preset operation is performed on the target YANG data, which simplifies the operation process and releases the binding relationship between YANG data processing and the SDN platform. Therefore, the difficulty of processing YANG data is reduced.

[0008] In one possible implementation, the preset operation includes at least one of the following: a data storage operation, a data update operation, and a data query operation.

[0009] According to the above technical means, the present application can perform data storage operations, data update operations and data query operations on the target YANG data, enriching the types of operations on the target YANG data and improving the coverage of preset operations.

[0010] In a possible implementation, a data object corresponding to the target YANG data is determined, the data object is stored in a preset format or the stored data object corresponding to the target YANG data is updated, and the data object is obtained by writing the target YANG data into a template object.

[0011] According to the above technical means, the present application can convert the target YANG data into data objects, perform format conversion, store or update them, and can also convert data objects that are difficult to store into a preset format, providing a complete process for storing and updating target YANG data.

[0012] In a possible implementation, a standard YANG file and an associated YANG file of each standard YANG file are obtained. The YANG file is used to describe the attribute format of YANG data. The standard YANG file and the associated YANG file are integrated to obtain a template object.

[0013] According to the above technical means, the present application can determine the format of the data structure of the standard YANG file and the attribute format of multiple YANG data contained therein according to the content of the standard YANG file and the associated YANG file of the standard YANG file, and obtain a template object, thereby ensuring the consistency of the target YANG data format and improving the operation efficiency of the target YANG data.

[0014] In a possible implementation, when the standard YANG file and the YANG file associated with the standard YANG file pass verification, the YANG file and the YANG file associated with the standard YANG file are preprocessed, and parameter information in the preprocessed standard YANG file and the associated YANG file is converted into a preset parameter format to obtain a preset template object.

[0015] According to the above technical means, the present application can verify the standard YANG file and the YANG file associated with the standard YANG file, and generate a template object if the verification passes. The accuracy of the template object and the consistency of the data between the standard YANG file and the associated YANG file are ensured. By generating a template object from the verified standard YANG file, the security and stability of the target YANG data can be enhanced.

[0016] In a possible implementation, the verification includes at least one of the following: format integrity verification, format validity verification, and logical relationship verification.

[0017] According to the above technical means, the present application can perform format integrity verification, format validity verification, and logical relationship verification on the standard YANG file and the associated YANG file. The verification process of the standard YANG file and the associated YANG file is enriched, making the verification of the standard YANG file and the associated YANG file more comprehensive, and optimizing the generated template object to make it more perfect.

[0018] In a possible implementation, a template file corresponding to the target YANG data is loaded to obtain a template object. The template file is saved as the template object. When the target YANG data matches the template object, the target YANG data is written into the template object to obtain a data object.

[0019] According to the above technical means, the present application can write the target YANG data into the corresponding template object to obtain the data object. The efficiency of generating data objects is improved, and there is no need to create the structure of the data object from scratch. The consistency of the format of the data object and the template object is ensured through the preset structure and attributes of the template object.

[0020] In a possible implementation, the preset operation includes a data query operation, and the request information includes a query prefix for querying the target YANG data. A query is performed based on the query prefix of the target YANG data to obtain stored data corresponding to the target YANG data. The target YANG data is stored in a preset format. The stored data is written into a template object corresponding to the target YANG data to obtain the target YANG data.

[0021] According to the above technical means, the present application can query the stored data corresponding to the target YANG data according to the query prefix contained in the request information, and write the stored data into the corresponding template object to obtain the target YANG data. Through the above process, the target YANG data stored in the preset format can be converted into the YANG data format, and searched according to the query prefix, which improves the query efficiency and makes the execution process of the query operation more efficient and convenient.

[0022] In a second aspect, the present application provides a data processing device, which includes: a communication unit and a processing unit.

[0023] The communication unit is used to receive request information, where the request information is used to request to perform a preset operation on the target YANG data. The target YANG data includes multiple sub-data.

[0024] The processing unit is used to perform a preset operation on the target YANG data based on the template object corresponding to the target YANG data in response to the request information. The template object is used to describe the node information where each sub-data in the YANG data is located.

[0025] In a possible implementation, the preset operation includes at least one of the following: a data storage operation, a data update operation, or a data query operation.

[0026] In a possible implementation, the processing unit is further configured to determine a data object corresponding to the target YANG data, store the data object in a preset format, or update the stored data object corresponding to the target YANG data. The data object is obtained by writing the target YANG data into the template object.

[0027] In a possible implementation, the processing unit is further used to obtain a standard YANG file and an associated YANG file of each standard YANG file. The YANG file is used to describe the attribute format of YANG data. The standard YANG file and the associated YANG file are integrated to obtain a template object.

[0028] In a possible implementation, the processing unit is further configured to preprocess the YANG file and the YANG file associated with the standard YANG file when the standard YANG file and the YANG file associated with the standard YANG file pass verification, and convert parameter information in the preprocessed standard YANG file and the associated YANG file into a preset parameter format to obtain a preset template object.

[0029] In a possible implementation, the verification includes at least one of the following: format integrity verification, format validity verification, and logical relationship verification.

[0030] In a possible implementation, the processing unit is further configured to load a template file corresponding to the target YANG data to obtain a template object. The template file is saved as the template object. When the target YANG data matches the template object, the target YANG data is written into the template object to obtain a data object.

[0031] In a possible implementation, the preset operation includes a data query operation, and the request information includes a query prefix for querying the target YANG data. The processing unit is further configured to query based on the query prefix of the target YANG data to obtain the stored data corresponding to the target YANG data. The target YANG data is stored in a preset format. The stored data is written into a template object corresponding to the target YANG data to obtain the target YANG data.

[0032] In a third aspect, the present application provides an electronic device, comprising: a processor and a communication interface; the communication interface and the processor are coupled, and the processor is used to run a computer program or instructions to implement the data processing method described in the first aspect and any possible implementation method of the first aspect.

[0033] In a fourth aspect, the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a terminal, the terminal executes the data processing method described in the first aspect and any possible implementation of the first aspect.

[0034] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when the computer program product runs on a data processing device, enables the data processing device to execute the data processing method described in the first aspect and any possible implementation of the first aspect.

[0035] In a sixth aspect, the present application provides a chip, the chip comprising a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run a computer program or instructions to implement the data processing method described in the first aspect and any possible implementation method of the first aspect.

[0036] Specifically, the chip provided in the present application also includes a memory for storing computer programs or instructions. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A data processing method provided in the embodiment of the present application Figure 1 ;

[0038] Figure 2 A schematic diagram of a data processing method provided in an embodiment of the present application Figure 1 ;

[0039] Figure 3 A data processing method provided in the embodiment of the present application Figure 2 ;

[0040] Figure 4 A schematic diagram of a data processing method provided in an embodiment of the present application Figure 2 ;

[0041] Figure 5 A data processing method provided in the embodiment of the present application Figure 3 ;

[0042] Figure 6 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] The data processing method, device and storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0044] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0045] The terms "first" and "second" and the like in the specification and drawings of this application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.

[0046] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0047] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0048] In the description of the present application, unless otherwise specified, “plurality” means two or more.

[0049] The following explains the terms involved in the embodiments of the present application to facilitate the reader's understanding.

[0050] (1) YANG (yet another next generation) model: a data modeling language designed and optimized for network devices. It defines a hierarchical structure of data and is particularly suitable for operations based on network configuration management protocols. The YANG model simplifies network operation and maintenance management and reduces operation and maintenance costs by providing a unified data description and operation method. The YANG model supports the definition of complex data structures and can be flexibly expanded according to needs.

[0051] (2) YANG engine: A component for network device data management and configuration, which works based on the YANG model. The YANG engine can be deployed on a terminal device or server. The terminal device or server deployed with the YANG engine is also equipped with a database and a network device data management system. The database is used to store YANG data, and the network device management system is used to send request information to the YANG engine. The YANG engine can parse the YANG model file and understand the data structure, constraints, and operation definitions. It can also flexibly convert YANG model data into formats such as extensible markup language (XML) and JSON to adapt to different application scenarios.

[0052] (3) Standard YANG file: A descriptive file published by a network equipment manufacturer or a standard organization that specifies the parameters, parameter format, and other related information of the YANG model. The content includes the YANG model name, node type, data type, and constraints.

[0053] The above is a brief introduction to some concepts involved in the embodiments of this application.

[0054] Currently, developers can usually use YANG models through open source SDN platforms to implement the parsing, verification and storage of YANG model data. However, the open source SDN platform has a complex architecture, a huge system and a high threshold for use.

[0055] In view of this, an embodiment of the present application provides a data processing method for performing preset operations on YANG data according to request information, with a simple architecture, clear process, and a low threshold for use.

[0056] The data processing method provided by the embodiment of the present application is described below in conjunction with the accompanying drawings. Among them, the actions, terms, etc. involved in the various embodiments of the present application can refer to each other without limitation. The message name or parameter name in the message exchanged between the various devices in the embodiment of the present application is only an example, and other names can also be used in the specific implementation without limitation. The actions involved in the various embodiments of the present application are only an example, and other names can also be used in the specific implementation, such as: "included in" in the embodiment of the present application can also be replaced by "carried on" or "carried on", etc.

[0057] It should be noted that the execution subject of the present application may be a terminal device, a server, or a component or an execution program deployed in the terminal device or server, such as a YANG engine. The following description will be made using the YANG engine as an example.

[0058] like Figure 1 As shown, an embodiment of the present application proposes a data processing method, which includes: S101-S102.

[0059] S101. Receive request information.

[0060] The request information is used to request to perform a preset operation on the target YANG data. The preset operation includes at least one of a data storage operation, a data update operation, and a data query operation. The data update operation is to replace the YANG data stored in the database with the target YANG data contained in the request information. The data storage operation is to save the target YANG data contained in the request information to the database. The data query operation is to obtain the target YANG data corresponding to the query prefix contained in the request information. The target YANG data includes multiple sub-data. The target YANG data can also be called a target YANG node, and the multiple sub-data of the target YANG data can also be called multiple sub-nodes of the target YANG node.

[0061] In one example, the target YANG data is a tree structure with a root node and one or more child nodes. For example, module A of a YANG file includes interface B, and the request information is used to request the storage of configuration information of interface B, and the configuration information of interface B includes the name of interface B (name), the description of interface B (description), and the enabled state of interface B (enabled). In the tree structure of the target YANG data, the root node is module A, the child node of the root node is interface B, and the child node of interface B (i.e., the leaf node of the target YANG data) is the name of interface B (name), the description of interface B (description), and the enabled state of interface B (enabled).

[0062] In another example, request information is received through a northbound interface, where the request information includes a file name of a YANG file, a YANG node path, and a YANG node data message.

[0063] Among them, the northbound interface can receive request information from the upper-layer application. The upper-layer application represents an application that manages YANG data, for example, a network device data management system. The upper-layer application can send request information to the YANG engine through the northbound interface. The file name of the YANG file represents the name of the YANG model to which the target YANG node belongs. The YANG node path represents the position of the target YANG node in the tree structure of the YANG model to which it belongs. The YANG node data message includes the data that the target YANG node needs to store or the data that multiple child nodes of the target YANG node need to store.

[0064] In one application scenario, the northbound interface is a RestConf (representational state transfer configuration) interface. The request information received through the RestConf interface is used to request to update and store the data of multiple sub-nodes of the target YANG node interface. The file name of the YANG file is ietf-interfaces. The YANG node path is ietf-interfaces:interfaces. The YANG node data message is the content that needs to be updated for the two sub-nodes Ethernet0 / 0 and Ethernet0 / 1 contained in the target YANG node interface. Specifically, the request information is as follows.

[0065]

[0066]

[0067] Among them, RestConf is the interface type. HTTP Method: PATCH is the request method, indicating that the operation requested by the request information is an update storage operation. URL represents the YANG node path, and http: / / restconf / data / is the fixed part in the RestConf protocol corresponding to the RestConf interface. BODY is the request body, that is, the YANG node data message, which contains the data that needs to be updated and stored. The YANG node data message indicates that the data of the two child nodes Ethernet0 / 0 and Ethernet0 / 1 of the target YANG node interface are updated. description, enabled, admin-status, and oper-status are the parameter names that need to be updated and stored for the two child nodes, and the content after the parameter name to-R1, to-R2, true, and up are the updated parameters. Specifically, the meaning of each parameter can refer to the existing technology and will not be repeated here.

[0068] Furthermore, HTTP Method: PATCH indicates that the operation requested by the request information is to update the storage operation. HTTP Method: POST indicates that the operation requested by the request information is to add a storage operation.

[0069] S102: In response to the request information, based on the template object corresponding to the target YANG data, perform a preset operation on the target YANG data.

[0070] The template object is used to describe the node information of each child data in the YANG data. The template object is a framework of a tree data structure generated according to a standard YANG file, including node types, node names, node namespaces, node primary keys, node parameters, node child nodes, node parent nodes and other information of multiple nodes in the standard YANG file, and the data of the target YANG node is written into the template object. The standard YANG file can be loaded, verified, preprocessed and compiled by the YANG compiler to obtain the template object. For details, refer to the content of Example 3, which will not be repeated here.

[0071] In one example, when the preset operation is a data query operation, refer to the content of Example 2 and do not elaborate on it here. When the preset operation is a data storage operation or a data update operation, determine the template file according to the file name of the YANG file contained in the request information. Load the template file corresponding to the target YANG data to obtain a template object. When the target YANG data matches the template object, write the target YANG data into the template object to obtain a data object. According to the data object corresponding to the target YANG data. Store the data object in a preset format or update the data object corresponding to the stored target YANG data.

[0072] The template file is saved as a template object. The data object is a tree data structure obtained by writing the target YANG data into the template object. The content of the data object includes the node type, node name, node name space, node primary key, node parameter, node child node, and node parent node of the target YANG node. The preset format can be a data record format. The data record format exists in the form of a path. For example, the request information is used to request to modify the name (name) of interface B in module A to E0 / 1, and the converted data record format is A / B / name=E0 / 1.

[0073] The process of matching the target YANG data with the template object includes: determining the template node in the template object that is identical to the YANG node path of the target YANG node according to the YANG node path of the target YANG node, and matching the template node with the target YANG node based on a matching rule.

[0074] Specifically, the matching rule is whether the name of the template node is the same as that of the target YANG node and whether the parameters are equal. After the template node and the target YANG node are successfully matched, the child nodes of the target YANG node are matched with the child nodes of the template node in turn, and the matching rules are the same as the above matching rules. Both the template node and the target YANG node are tree structures, and one or more child nodes and descendant nodes of the target YANG node need to be matched with one or more child nodes and descendant nodes of the template node. If the target YANG node, child node, and descendant node are all matched successfully, the information of the target YANG node and the child nodes of the target YANG node are written into the template node and the child nodes of the template node to obtain the data object. If the match is unsuccessful, the parsing process is exited, and a prompt is given that there is an unsuccessful match during the matching process.

[0075] Further, the format of the data object is converted into a preset format and stored in a database. The preset format can be a data record format, which is specifically expressed in a path form. According to the subordinate relationship between multiple nodes contained in the data object, the path of each node is generated. According to the path of the node, a hash value (i.e., a 32-bit string) corresponding to the path is generated by a hash algorithm. The path of the node, the hash value of the node, and the hash value of the parent node are stored in the database as a set of data.

[0076] Among them, a node of a data object has a unique path, and the unique path is saved as the primary key (key) in the database as the data record corresponding to the node. Since the paths of multiple nodes of the data object are of long string type, it is not conducive to the generation and maintenance of database indexes. Therefore, hash values ​​are used to replace the paths of nodes as the basis of indexes in the database. Hash values ​​are 32-bit strings, which are more conducive to the generation and maintenance of database indexes compared to node paths of long string type.

[0077] Before storing the node path, the node hash value, and the parent node hash value as a set of data in the database, each set of data needs to be checked. Check whether there is exactly the same stored data in the database based on the hash values ​​of multiple nodes. If the stored data already exists, it will not be inserted repeatedly, and success will be returned directly. If the node is a leaf node, its path contains parameter assignments, so it cannot be directly searched by the hash value generated by the path. It is necessary to search for all child nodes of its parent node based on the hash value of the node's parent node, and compare multiple child nodes with the node in turn. If there is data with the same name but different parameters, the original child nodes need to be deleted.

[0078] In an application scenario, a template file is determined by the file name of the YANG file in the URL contained in the above request message, and the template file is loaded into the memory to obtain a template object. The template object is used to match the YANG node data message contained in the request information in the above application scenario. After matching, a data object is generated, and the data object includes multiple nodes, as shown in Table 1.

[0079] Table 1

[0080]

[0081]

[0082] The template name is the name of the data node, that is, the name of the template node used. The parameter value represents the value assigned to the node. Specifically, the meanings of the parameter values ​​such as Ethernet0 / 0, Ethernet0 / 1, to-R1, true, and up can be referred to in the prior art and will not be described in detail here.

[0083] Further, such as Figure 2 As shown, the data object is a part of the YANG model. There are multiple nodes, and the number of nodes is 13, namely, module (interfaces), interface E0 / 0 (interface [name = 'Ethernet0 / 0']), name of interface E0 / 0 (name), description of interface E0 / 0 (description), enabled status of interface E0 / 0 (enabled), management status of interface E0 / 0 (admin-status), operating status of interface E0 / 0 (oper-status), interface E0 / 1 (interface [name = 'Ethernet0 / 1']), name of interface E0 / 1, description of interface E0 / 1, enabled status of interface E0 / 1, management status of interface E0 / 1, operating status of interface E0 / 1.

[0084] Among them, one of the multiple nodes is taken as the root node, and the multiple descendant nodes it contains can form a data object with the root node. Therefore, depending on the root node, such as Figure 2As shown, 13 data objects can be obtained. The YANG model is the YANG model to which the data object belongs, which can be ietf-interfaces or ietf-types and other YANG models. The following takes ietf-interfaces as an example for explanation. E0 / 0, E0 / 1, TR1, TR2, T, and U are the values ​​of the parameters of multiple nodes. E0 / 0 represents Ethernet0 / 0, E0 / 1 represents Ethernet0 / 1, TR1 represents to-R1, TR2 represents to-R2, T represents true, and U represents up. For details, refer to the prior art and will not be repeated here.

[0085] As shown in Table 2, Figure 2 Multiple data objects in , and the paths of 13 data objects obtained by conversion.

[0086] Table 2

[0087]

[0088]

[0089] The data objects are directly saved in the database through a data record format in the form of a path, and the path of each data object represents the hierarchical structure of the data object in the YANG model.

[0090] According to the above technical means, the present application can perform operations matching the request information on the target YANG data according to the request information, and the process of performing preset operations on the target YANG data is simple. Based on the template object corresponding to the target YANG data, the preset operation is performed on the target YANG data, which simplifies the operation process and releases the binding relationship between YANG data processing and the SDN platform. Therefore, the difficulty of processing YANG data is reduced.

[0091] In another embodiment (Example 2), as Figure 3 As shown, the embodiment of the present application proposes a data processing method for performing a data query operation on target YANG data when the preset operation is a data query operation. The method includes: S301-S303.

[0092] S301, receiving request information.

[0093] The request information includes a query prefix for querying the target YANG data. The request information is used to request to perform a query operation on the target YANG data. The query operation includes a get query operation and a delete query operation.

[0094] In one example, request information is received through a northbound interface, and content of the request information includes a query prefix of target YANG data, that is, path information of the target YANG data in a database.

[0095] In one application scenario, the northbound interface is a RestConf interface. The request information received through the RestConf interface is used to request the data of the subnode named Ethernet0 / 1 of the target YANG node interface. The query prefix is ​​ / ietf-interfaces:interfaces / interface, and the file name of the YANG file to which the target YANG node belongs is ietf-interfaces. Specifically, the request information is as follows.

[0096]

[0097] Among them, RestConf is the interface type. HTTP Method:GET is the request method, indicating that the operation requested by the request information is a get query operation. URL represents the path of the YANG node, and the path information contains the query prefix / ietf-interfaces:interfaces / interface. The query prefix of this path can be divided into the first path prefix / ietf-interfaces:interfaces (that is, the first-level index) and the second path prefix / ietf-interfaces:interfaces / interface[name='Ethernet0 / 1'] (that is, the second-level index). During the query process, since the first path contains too many nodes and there is a large amount of data that does not belong to the target YANG node, the query can be directly performed based on the second path prefix.

[0098] Furthermore, HTTP Method: GET indicates that the operation requested by the request information is a get query operation. HTTP Method: DELET indicates that the operation requested by the request information is a delete query operation.

[0099] S302: Perform a query based on the query prefix of the target YANG data to obtain storage data corresponding to the target YANG data.

[0100] The target YANG data is stored in a preset format.

[0101] In one example, a query is performed in a database according to a query prefix of the target YANG data in the request information to obtain storage data corresponding to one or more target YANG data.

[0102] In an application scenario, when the request information is the request information in the above scenario, the query prefix is ​​ / ietf-interfaces:interfaces / interface[name='Ethernet0 / 1']. Based on the data records in Table 2, according to the query prefix, a query is performed in Table 2 to obtain multiple data records with sequence numbers 8 to 13.

[0103] Further, in the case where the request information is used to request to perform a delete query operation, after the storage data corresponding to the target YANG data is queried, the storage data corresponding to the target YANG data is deleted, thereby completing the request information for requesting to perform a delete query operation.

[0104] S303: Write the stored data into the template object corresponding to the target YANG data to obtain the target YANG data.

[0105] The target YANG data includes multiple sub-data, that is, the target YANG node includes multiple sub-nodes, and the template object is used to describe the node information where each sub-data in the target YANG model is located.

[0106] In one example, the storage data corresponding to the target YANG data is parsed through the template object. The multiple storage data contain multiple paths, and each path is divided into multiple path segments. For example, the complete path is / ietf-interfaces:interfaces / interface[name='Ethernet0 / 1'], the first path segment is / ietf-interfaces:interfaces, and the second path segment is / interface[name='Ethernet0 / 1'].

[0107] For a path in a request message, determine the template file to which the storage data belongs based on the file name of the YANG file contained in the first segment of the path, and load the corresponding template file into the memory to obtain a template object. Based on the preset matching rules, match the root node of the template object with the first segment of the path. After the match is successful, match the next level node with the next segment of the path in turn. Until multiple segment path nodes are successfully matched with the template object, the path is parsed, and the storage data corresponding to the path is written into the template object to obtain the data object of the storage data. After the multiple storage data are parsed, a complete data object is generated, that is, the target YANG data.

[0108] The preset matching rule includes whether the name of the template object is the same as the name of the prefix, and / or whether the parameters of the template object are the same as the parameters of the prefix.

[0109] In one application scenario, the preset operation performed by the request information request is a data query operation, and the query prefix is: / ietf-interfaces:interfaces / interface[name='Ethernet0 / 1']. As shown in Table 2, the path of the query result includes paths from sequence number 8 to sequence number 13. Taking the path of sequence number 9 as an example, the path includes three levels of paths, namely the first segment path ( / ietf-interfaces:interfaces), the second segment path ( / interface[name='Ethernet0 / 1']), and the third segment path ( / name='Ethernet0 / 1').

[0110] According to the file name of the YANG file in the first path, determine the template file to which the path belongs. Load the template file to which the path belongs and obtain the following: Figure 4 The template object shown contains the YANG model ietf-interfaces, module interfaces, interface interface, name name, description information description, enabled status enabled, management status admin-status, and operation status oper-status.

[0111] The root node of the template object is ietf-interfaces:interfaces, which has the same name as the first path segment and no parameters, so the root node matches the first path segment. The child node of the root node is interface, which has the same name as the second path segment and contains the name parameter, so the child node matches the second path segment. The path parsing is completed, and interface[name='Ethernet0 / 1'] is written into the template object to obtain the template object corresponding to the storage data of the path. According to the above method, multiple path information is written into the template object in sequence to obtain the complete target YANG data.

[0112] According to the above technical means, the present application can match the query prefix with the path in the database according to the query prefix in the request information to obtain the storage data of the target YANG data. The storage data can also be converted into complete target YANG data through a template object. Compared with the query of target YANG data through the SDN platform, the query process of the target YANG data has lowered the usage threshold and the process is more concise. Querying by query prefix can more quickly query the storage data of the target YANG data.

[0113] In another embodiment (Example 3), as Figure 5As shown, a data processing method is provided for an embodiment of the present application, which is used to load, verify, preprocess and compile multiple standard YANG files to obtain a template file before receiving request information. The method includes S501 to S503.

[0114] S501. Load a standard YANG file and a YANG file associated with the standard YANG file.

[0115] The contents of the standard YANG file and the template file are both information such as node type, node name, node namespace, node primary key, node parameter, node child node, node parent node, etc. of multiple nodes in the YANG model. The difference is that the standard YANG file is a description class file, and the template file is a code file of the data structure framework obtained according to the standard YANG file. Association means other standard YANG files referenced and included in the standard YANG file. The YANG file associated with the standard YANG file means the standard YANG file that has a dependency relationship with the standard YANG file.

[0116] In one example, a YANG compiler is controlled to load and parse a standard YANG file. According to the content of the standard YANG file, multiple YANG files associated with the standard YANG file are determined. Multiple YANG files associated with the standard YANG file are obtained, and the multiple YANG files are loaded and parsed to obtain the parts of the multiple YANG files associated with the standard YANG file.

[0117] S502: Verify the standard YANG file and preprocess the standard YANG file to obtain a preprocessed standard YANG file.

[0118] The verification includes format integrity verification, format validity verification, and logical relationship verification. Repair includes invalid reference relationship processing, invalid data type processing, and invalid dependent file processing.

[0119] In one example, after the standard YANG file is loaded and parsed, the standard YANG file is checked for format integrity, format validity, and logical relationship. The format integrity check is used to ensure whether the file conforms to the expected format specification. The format validity check is used to verify whether the syntax, structure, and constraints in the standard YANG file are valid. The logical relationship check is used to verify the dependencies between multiple YANG files, the consistency of constraints, and the rationality of the structure. After the check passes, the standard YANG file is preprocessed. The preprocessing operation is used to repair non-critical errors, such as invalid reference relationship processing, invalid data type processing, and invalid dependent file processing.

[0120] The invalid reference relationship and invalid data type may be processed by deletion. The invalid dependent file may be processed by canceling the dependency relationship between the invalid dependent file and the standard YANG file.

[0121] S503: Copy nodes of multiple associated YANG files to generate a template object of a standard YANG file, and save the template object to obtain a template file.

[0122] Among them, node copy is an operation to reduce the complexity of data structure. Template object is a data structure object generated after loading the template file.

[0123] In one example, parts of multiple YANG files that are associated with a standard YANG file are copied, and the preprocessed standard YANG file is inserted to obtain a standard YANG file that has been copied by a node. According to the standard YANG file that has been copied by a node, its internal data structure is constructed, multiple configuration parameter codes are generated, and a template object is obtained. The template object is saved as a template file.

[0124] In one application scenario, the standard YANG file is the ietf-interfaces file shown below.

[0125]

[0126]

[0127] Among them, the standard YANG file is a partial backbone node definition of the ietf-interfaces model defined by the IETF organization. The file name of the standard YANG file is ietf-interfaces.yang. For details, please refer to the prior art and will not be described in detail here.

[0128] After using the YANG compiler to load, verify, preprocess, and compile the above standard YANG file, multiple template objects corresponding to the standard YANG file are obtained. The Java-based definition of each template object is as follows.

[0129]

[0130]

[0131] Among them, module is the name of the standard YANG file to which the template object belongs, xmlns is the namespace of the standard YANG file, name is the name of the template object, key is the keyword of the template object, parent is the parent template object, that is, the parent node, children is the child template object, that is, the child node, parameter is the parameter list, and type is the type of the template object. The type of the template object can be container, list, leaf, leaf-list, augment, choice, case, anyxml, anydata, etc. For specific purposes, refer to the existing technology for each type, which will not be repeated here.

[0132] Furthermore, the obtained multiple template objects are shown in Table 3. The structures of the multiple template objects are as follows: Figure 4 shown.

[0133] Table 3

[0134]

[0135] Among them, ietf-interfaces is the name of the standard YANG file, and its type is module type, that is, the root node in the standard YANG file. interfaces is the name of a module in the standard YANG file, and its type is container type, that is, container node. interface is the name of a list in interfaces, and its type is list type, that is, list node. name, description, enabled, admin-status, and oper-status are multiple actual parameters, and their type is leaf type, that is, leaf node.

[0136] It should be noted that, as shown in Table 3, each serial number can represent a template object, for example, the template object with serial number 1 is the sum of serial numbers 1 to 8, the template object with serial number 2 is the sum of serial numbers 2 to 8, and the template object with serial number 3 is the sum of serial numbers 3 to 8. The complete template objects generated by the standard YANG file are template objects with serial numbers 1 to 8.

[0137] According to the above technical means, the present application can obtain multiple template objects corresponding to the standard YANG files according to multiple standard YANG files, and save the template objects as template files for subsequent calling processes. Among them, the verification, preprocessing and node copying processes of the standard YANG files can reduce non-critical errors in the standard YANG files, and can also reduce the complexity of the data structure of the standard YANG files, making the subsequent process of calling the template files more convenient.

[0138] It is understandable that the above data processing method can be implemented by a data processing device. In order to implement the above functions, the data processing device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the modules and algorithm steps of each example described in the embodiments disclosed herein, the embodiments disclosed in this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments disclosed in this application.

[0139] The embodiments disclosed in the present application can divide the functional modules of the data processing device generated by the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiments disclosed in the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0140] Figure 6 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application. Figure 6 As shown, the data processing device 60 can be used to execute Figure 1-Figure 5 The data processing method shown. The data processing device 60 includes: a communication unit 601 and a processing unit 602.

[0141] The communication unit 601 is used to receive request information, where the request information is used to request to perform a preset operation on target YANG data. The target YANG data includes multiple sub-data.

[0142] The processing unit 602 is configured to perform a preset operation on the target YANG data in response to the request information based on the template object corresponding to the target YANG data. The template object is used to describe the node information where each sub-data in the YANG data is located.

[0143] In a possible implementation, the preset operation includes at least one of the following: a data storage operation, a data update operation, or a data query operation.

[0144] In a possible implementation, the processing unit 602 is further configured to determine a data object corresponding to the target YANG data, store the data object in a preset format, or update the stored data object corresponding to the target YANG data. The data object is obtained by writing the target YANG data into the template object.

[0145] In a possible implementation, the processing unit 602 is further used to obtain a standard YANG file and an associated YANG file of each standard YANG file. The YANG file is used to describe the attribute format of YANG data. The standard YANG file and the associated YANG file are integrated to obtain a template object.

[0146] In a possible implementation, the processing unit 602 is further configured to preprocess the YANG file and the YANG file associated with the standard YANG file when the standard YANG file and the YANG file associated with the standard YANG file pass verification, and convert parameter information in the preprocessed standard YANG file and the associated YANG file into a preset parameter format to obtain a preset template object.

[0147] In a possible implementation, the verification includes at least one of the following: format integrity verification, format validity verification, and logical relationship verification.

[0148] In a possible implementation, the processing unit 602 is further configured to load a template file corresponding to the target YANG data to obtain a template object. The template file is saved as the template object. When the target YANG data matches the template object, the target YANG data is written into the template object to obtain a data object.

[0149] In a possible implementation, the preset operation includes a data query operation, and the request information includes a query prefix for querying the target YANG data. The processing unit 602 is further configured to query based on the query prefix of the target YANG data to obtain the stored data corresponding to the target YANG data. The target YANG data is stored in a preset format. The stored data is written into a template object corresponding to the target YANG data to obtain the target YANG data.

[0150] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0151] The present disclosure also provides a computer-readable storage medium having instructions stored thereon. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method provided by the above-mentioned embodiment of the present disclosure.

[0152] The embodiments of the present disclosure also provide a computer program product including instructions, which, when executed on an electronic device, enables the electronic device to execute the data processing method provided by the embodiments of the present disclosure.

[0153] Among them, the computer readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a register, a hard disk, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above, or any other form of computer readable storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application-specific integrated circuit (ASIC). In the embodiments of the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program, which may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0154] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A data processing method, characterized in that: The method comprises: receiving request information, wherein the request information is used to request to perform a preset operation on target YANG data; the target YANG data includes a plurality of sub-data; In response to the request information, the preset operation is performed on the target YANG data based on a template object corresponding to the target YANG data; the template object is used to describe the node information where each sub-data in the YANG data is located.

2. The method according to claim 1, characterized in that The preset operation includes at least one of the following: Data storage operations; Data update operations; Data query operation.

3. The method according to claim 2, characterized in that The preset operation includes a data storage operation or a data update operation, and performing the preset operation on the target YANG data based on the template object corresponding to the target YANG data includes: Determine a data object corresponding to the target YANG data; The data object is stored in a preset format or a data object corresponding to the stored target YANG data is updated; the data object is obtained by writing the target YANG data into the template object.

4. The method according to claim 3, characterized in that The method further comprises: Obtaining a standard YANG file and an associated YANG file of each standard YANG file; the YANG file is used to describe the attribute format of YANG data; The standard YANG file and the associated YANG file are integrated to obtain the template object.

5. The method according to claim 4, characterized in that The converting the parameter information in the standard YANG file and the associated YANG file into a preset parameter format to obtain the preset template object includes: If the standard YANG file and the YANG file associated with the standard YANG file pass the verification, preprocessing the YANG file and the YANG file associated with the standard YANG file; The parameter information in the preprocessed standard YANG file and the associated YANG file is converted into a preset parameter format to obtain the preset template object.

6. The method according to claim 5, characterized in that The verification includes at least one of the following: Format integrity check; Format validity check; Logical relationship verification.

7. The method according to any one of claims 3 to 6, characterized in that: The determining the data object corresponding to the target YANG data includes: Loading the template file corresponding to the target YANG data to obtain the template object; the template file is saved by the template object; When the target YANG data matches the template object, the target YANG data is written into the template object to obtain the data object.

8. The method according to claim 2, characterized in that: The preset operation includes a data query operation, and the request information includes a query prefix for querying target YANG data; The performing the preset operation on the target YANG data based on the template object corresponding to the target YANG data includes: Performing a query based on a query prefix of the target YANG data to obtain storage data corresponding to the target YANG data; the target YANG data is stored in a preset format; The stored data is written into a template object corresponding to the target YANG data to obtain the target YANG data.

9. A data processing device, characterized in that: The device comprises: a communication unit and a processing unit; The communication unit is used to receive request information, where the request information is used to request to perform a preset operation on target YANG data; the target YANG data includes a plurality of sub-data; The processing unit is used to perform the preset operation on the target YANG data in response to the request information based on the template object corresponding to the target YANG data; the template object is used to describe the node information where each sub-data in the YANG data is located.

10. An electronic device, characterized in that: include: Memory and processor; The memory is coupled to the processor; The memory is used to store instructions executable by the processor; When the processor executes the instructions, the processor performs the data processing method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is enabled to execute the data processing method as claimed in any one of claims 1 to 8.

12. A computer program product, characterized in that The computer program product comprises computer program instructions, and when the computer program instructions are executed by a processor, the data processing method as claimed in any one of claims 1 to 8 is implemented.