A method, system, device and storage medium for flow table compression and decompression
By using flow table templates and TLV encoding rules in the DataStore database to compress the flow table, the problems of large memory usage, low efficiency and waste of configuration space when storage of massive flow tables are solved, more efficient storage and loading speed is achieved, and data standardization is improved.
Patent Information
- Application Number
- CN202111643506.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2041-12-29
AI Technical Summary
When storing massive stream tables in DataStore databases, there are problems such as large memory usage, low database efficiency and useless configuration space.
Select the corresponding flow table template through the flow table type, use the template to identify the flow table characteristic parameters, and generate a compressed flow table using TLV encoding rules.
It greatly reduces the use of storage space, improves database loading speed, reduces the waste of useless configuration space for stream table storage, and makes stream table data more standardized, making it easier to maintain and manage.
Smart Images

Figure CN114328457B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method, system, device and storage medium for compressing and decompressing a flow table. Background Art
[0002] Software Defined Network (SDN) is an emerging network revolutionary concept that has greatly improved the scale, function, control and flexibility of traditional networks. With the rise of data center network technology, new challenges have been posed to SDN controllers. SDN controllers in data centers need to support centralized management and scheduling of thousands of network device nodes, and support the configuration and storage of tens of millions of flow tables to meet the business deployment and control needs of data centers. These put forward higher requirements on the storage capacity, stability and efficiency of the controller.
[0003] At present, SDN controllers based on the MD-SAL (Model-Driven Service Abstraction Layer) architecture generally store data through the DataStore database, which provides data storage, reading, transaction and other functions. As a memory database, all data is directly operated in the memory, and the data is stored in the DataStore in a tree structure. In order to meet the above functional requirements, traditional SDN controllers use the DataStore memory database to store tens of millions of flow table configuration information.
[0004] However, since DataStore is an in-memory database, the data capacity is limited by the memory. Excessive data volume can easily lead to insufficient memory. On the one hand, the storage of data in memory objects will cause space expansion. On the other hand, in addition to the static space requirements, the process of persisting data to disk to generate snapshots also requires additional memory support. In order to support the storage of tens of millions of flow table configurations, DataStore needs to occupy hundreds of GB of memory resources, which causes a sharp increase in the cost of the controller. Secondly, as a memory database, DataStore will persist the memory data and generate snapshots to write to the disk. When the controller starts, the data in the disk needs to be loaded into the memory. The loading time of tens of millions of massive data takes a long time, which leads to a long startup time of the controller. When the controller is restarted due to abnormal conditions such as controller abnormality or power failure, it will affect the normal use of the controller for a long time. Finally, the amount of memory data in the DataStore database is mainly composed of two parts, namely the header size and data size of the node object. Generally, the object header occupies a large space, the data structure of the flow table is complex, and the number of nodes is large. Therefore, the database needs to consume most of the resources to store the node object header, while the space for the actual flow table data content is compressed, resulting in a waste of memory space.
[0005] Therefore, how to solve the problems of large memory usage, low database efficiency and waste of useless configuration space caused by storing massive flow tables in the DataStore database has become an urgent problem to be solved. Summary of the invention
[0006] The present invention provides a method, system, device and storage medium for compressing and decompressing a flow table, which are used to solve the technical problems of large memory usage, low database efficiency and waste of useless configuration space in storing massive flow tables in a DataStore database in the prior art.
[0007] A first aspect of the present invention provides a flow table compression method, which is applied to a DataStore database in an SDN. The method includes:
[0008] According to the type of flow table, a corresponding flow table template is selected, and each characteristic parameter of the flow table is identified by using the flow table template; wherein the flow table template is a flow table rule pre-set according to the type of flow table, and is used to identify the characteristic parameters in the flow table;
[0009] Generate TLV codes corresponding to each characteristic parameter using TLV coding rules;
[0010] The number of the flow table template is used as the first byte of the compressed flow table, and the TLV codes corresponding to the characteristic parameters are arranged in sequence after the first byte according to the order of the characteristic parameters in the flow table to obtain the compressed flow table corresponding to the flow table.
[0011] Optionally, according to the type of the flow table, a corresponding flow table template is selected, and each characteristic parameter of the flow table is identified by using the flow table template, including:
[0012] Perform feature matching on the flow table according to the type of the flow table, and select a corresponding flow table template from a flow table template library according to the feature sequence and rules in the flow table;
[0013] According to the flow table rules preset in the flow table template, each characteristic parameter of the flow table is identified and extracted in the flow table.
[0014] Optionally, according to the characteristic parameter, using a TLV encoding rule to generate a TLV encoding corresponding to the characteristic parameter includes:
[0015] According to the type of the characteristic parameter, generating a type code of the characteristic parameter;
[0016] Generating a length code and a value code of the characteristic parameter according to the parameter value of the characteristic parameter;
[0017] The type code, length code and value code of the characteristic parameter are assembled together in sequence to obtain the TLV code of the characteristic parameter.
[0018] In a second aspect, the present application provides a method for decompressing a compressed flow table, which is applied to a DataStore database in an SDN, wherein the DataStore database generates a compressed flow table using the method described in any one of the first aspects, including:
[0019] Obtaining a compressed flow table to be decompressed, parsing the first byte of the compressed flow table, and obtaining a flow table template number corresponding to the compressed flow table;
[0020] Obtaining a corresponding flow table template according to the flow table template number, obtaining a flow table rule of a complete flow table corresponding to the compressed flow table and a TLV encoding of the compressed flow table according to the flow table template, decoding the TLV encoding of the compressed flow table using a TLV decoding rule, and obtaining characteristic parameters of the compressed flow table;
[0021] The characteristic parameters of the compressed flow table are input into the flow table rule of the complete flow table to obtain the complete flow table corresponding to the compressed flow table.
[0022] Optionally, obtaining the TLV encoding of the compressed flow table according to the flow table template, decoding the TLV encoding of the compressed flow table using a TLV decoding rule, and obtaining characteristic parameters of the compressed flow table include:
[0023] According to the flow table template, extracting the TLV code of the compressed flow table starting from the second byte of the compressed flow table;
[0024] The TLV encoding of the compressed flow table is decoded in sequence according to the order of type, length and value to obtain corresponding characteristic parameters until the TLV encoding is completely decoded.
[0025] The TLV encoding of the compressed flow table is decoded in order of type, length and value to obtain corresponding characteristic parameters, including:
[0026] The first byte of the TLV code that has not been decoded is used as the type of the characteristic parameter corresponding to the TLV code, and the second byte is used as the length of the characteristic parameter corresponding to the TLV code;
[0027] According to the length of the characteristic parameter, the TLV encoding of the corresponding length is used as the value of the characteristic parameter to obtain the complete characteristic parameter.
[0028] In a third aspect, the present application provides a flow table compression system, including:
[0029] A template selection unit, configured to select a corresponding flow table template according to the type of flow table, and use the flow table template to identify various characteristic parameters of the flow table; wherein the flow table template is a flow table rule pre-set according to the type of flow table, and is used to identify the characteristic parameters in the flow table;
[0030] A TLV encoding unit, used to generate TLV codes corresponding to each characteristic parameter using TLV encoding rules;
[0031] A flow table compression unit is used to use the number of the flow table template as the first byte of the compressed flow table, and arrange the TLV codes corresponding to the characteristic parameters in the order of the characteristic parameters in the flow table in sequence after the first byte to obtain the compressed flow table corresponding to the flow table.
[0032] In a fourth aspect, the present application provides a system for decompressing a compressed flow table, wherein the compressed flow table is generated using the method as described in any one of the first aspects, including:
[0033] A template query unit, used to obtain a compressed flow table to be decompressed, parse the first byte of the compressed flow table, and obtain a flow table template number corresponding to the compressed flow table;
[0034] A TLV decoding unit is used to obtain a corresponding flow table template according to the flow table template number, obtain a flow table rule of a complete flow table corresponding to the compressed flow table and a TLV encoding of the compressed flow table according to the flow table template, and use a TLV decoding rule to decode the TLV encoding of the compressed flow table to obtain characteristic parameters of the compressed flow table;
[0035] The flow table decompression unit is used to input the characteristic parameters of the compressed flow table into the flow table rules of the complete flow table to obtain the complete flow table corresponding to the compressed flow table.
[0036] In a fifth aspect, an embodiment of the present application provides a flow table compression and decompression device, including:
[0037] at least one processor, and
[0038] a memory coupled to the at least one processor;
[0039] The memory stores instructions that can be executed by the at least one processor, and the at least one processor performs the method as described in any one of the first aspect and the second aspect by executing the instructions stored in the memory.
[0040] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes a method as described in any one of the first aspect and the second aspect.
[0041] The technical solution in the embodiments of the present application has the following beneficial effects: the flow table compression system selects the corresponding flow table template according to the type of flow table, and uses the flow table template to identify the various characteristic parameters of the flow table; the flow table template is a flow table rule pre-set according to the type of flow table, and is used to identify the characteristic parameters in the flow table; the TLV encoding rule is used to generate the TLV encoding corresponding to each characteristic parameter; the number of the flow table template is used as the first byte of the compressed flow table, and the TLV encodings corresponding to the characteristic parameters are arranged in sequence after the first byte according to the order of the characteristic parameters in the flow table, so as to obtain the compressed flow table corresponding to the flow table, thereby compressing data based on the flow table template, greatly reducing the storage space occupied, improving the speed of database loading, and reducing the waste of useless configuration space stored in the flow table. At the same time, due to the data compression based on the preset flow table template, the data in the flow table is also more standardized, which is convenient for maintenance and management. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a flow chart of a method for flow table compression provided by an embodiment of the present invention;
[0043] Figure 2 It is a structural schematic diagram of a flow table compression and decompression system provided by an embodiment of the present invention;
[0044] Figure 3 It is a schematic diagram of extracting characteristic parameters in a flow table according to a flow table template provided by an embodiment of the present invention;
[0045] Figure 4is a flow chart of a method for decompressing a compressed flow table provided by an embodiment of the present invention;
[0046] Figure 5 It is a structural diagram of a flow table compression system provided by an embodiment of the present invention;
[0047] Figure 6 It is a structural diagram of a system for decompressing a compressed flow table provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0049] In the prior art, since DataStore is an in-memory database, when a large amount of flow table data is stored therein, problems such as large memory usage, low database efficiency, and waste of configuration space are likely to occur.
[0050] To this end, the present invention provides a method, system, device and storage medium for flow table compression and decompression, which are applied to the DataStore database in SDN, and are used to solve the technical problems of large memory usage, low database efficiency and waste of useless configuration space in the prior art when storing massive flow tables in the DataStore database.
[0051] The technical solution provided by the embodiments of the present application is introduced below in conjunction with the drawings in the specification.
[0052] See also Figure 1 The present invention provides a method for compressing a flow table, comprising:
[0053] 101. According to the type of the flow table, a corresponding flow table template is selected, and each characteristic parameter of the flow table is identified by using the flow table template; wherein the flow table template is a flow table rule pre-set according to the type of the flow table, and is used to identify the characteristic parameters in the flow table;
[0054] 102. Generate TLV codes corresponding to each characteristic parameter using TLV coding rules;
[0055] 103. The number of the flow table template is used as the first byte of the compressed flow table, and the TLV codes corresponding to the characteristic parameters are arranged in sequence after the first byte according to the order of the characteristic parameters in the flow table to obtain the compressed flow table corresponding to the flow table.
[0056] For example, see Figure 2 , Figure 2 The schematic diagram of the structure of a flow table compression and decompression system provided by an embodiment of the present invention includes a service module 21, a flow table management module 22, a flow table template library 23 and a DataStore database 24.
[0057] Before compressing the flow table, the flow table compression system first establishes a flow table template for each type of flow table according to the different flow table types. The flow table template includes a flow table template number, flow table rules, and a flow table compression and decompression method. After the flow table compression system establishes the flow table template, it stores the flow table template in the flow table template library 23.
[0058] After the service module 21 sends the flow table issuing operation to the flow table management module 22, the flow table management module 22 first detects and obtains the flow table. After the flow table management module 22 obtains the flow table a, it searches the flow table template A corresponding to the flow table a in the flow table template library 23 according to the type of the flow table a. According to the flow table rules in the flow table template A and the flow table a, feature matching is performed, and two feature parameters in the flow table a are identified, which are the feature parameter a1 of type 40 and the feature parameter a2 of type 20.
[0059] Then, the flow table management module 22 encodes the characteristic parameters a1 and a2. According to the TLV (Type-length-value) encoding rules, the type of the characteristic parameter a1 is 40, the value is 07020103A00000010A010000017400116766E9, and the length is 19. Therefore, the TLV encoding corresponding to the characteristic parameter a1 is 401907020103A00000010A010000017400116766E9; the type of the characteristic parameter a2 is 20, the value is 027C009F34, and the length is 5. Therefore, the TLV encoding corresponding to the characteristic parameter a2 is 2005027C009F34.
[0060] Finally, the flow table management module 22 uses the number of the flow table template A corresponding to the flow table a as the compressed flow table a corresponding to the flow table a. c The first byte of the feature parameter a1 and the feature parameter a2 are sequentially arranged after the first byte to obtain the compressed flow table a corresponding to the flow table a. c 0A401907020103A00000010A010000017400116766E92005027C009F34. The flow table management module 22 compresses the flow table a corresponding to the flow table a c Stored in the DataStore database 24. In practical applications, based on the above flow table compression method, an efficient flow table retrieval method can also be obtained. When the SDN sends a query request, the flow table management module 22 queries the corresponding compressed flow table according to the query request and returns it to the SDN; after receiving the compressed flow table, the SDN decompresses the compressed flow table to obtain a complete flow table. This flow table retrieval method effectively improves the retrieval efficiency. At the same time, since the network transmits the compressed flow table, it also reduces the pressure of network transmission.
[0061] In the embodiment provided by the present invention, the flow table compression system selects the corresponding flow table template according to the type of flow table, and uses the flow table template to identify various characteristic parameters of the flow table; wherein the flow table template is a flow table rule pre-set according to the type of flow table, and is used to identify the characteristic parameters in the flow table; according to the characteristic parameters, the TLV encoding rule is used to generate the TLV encoding corresponding to each characteristic parameter; the number of the flow table template is used as the first byte of the compressed flow table, and the TLV encodings corresponding to the characteristic parameters are arranged in sequence after the first byte according to the order of the characteristic parameters in the flow table, so as to obtain the compressed flow table corresponding to the flow table, thereby compressing data based on the flow table template, greatly reducing the storage space occupied, improving the speed of database loading, and reducing the waste of useless configuration space stored in the flow table. At the same time, due to the data compression based on the preset flow table template, the data in the flow table is also more standardized, which is convenient for maintenance and management.
[0062] A possible implementation method is to select a corresponding flow table template according to the type of the flow table, and use the flow table template to identify various characteristic parameters of the flow table, including:
[0063] The flow table is feature matched according to the type of the flow table, and the corresponding flow table template is selected in the flow table template library according to the feature order and rules in the flow table; and each feature parameter of the flow table is identified and extracted in the flow table according to the flow table rules pre-set in the flow table template.
[0064] For example, see Figure 3 , Figure 3 A schematic diagram of extracting characteristic parameters in a flow table according to a flow table template provided in an embodiment of the present invention.
[0065] After the flow table management module 22 obtains the flow table a, it performs feature matching on the flow table a according to the type of the flow table a. According to the feature sequence and rules in the flow table a, the feature sequence and rules in the flow table model A and the flow table a are consistent, both of which are {matching domain: A; counter: (parameter); instruction set: (parameter)}. Therefore, according to the rule list in the flow table template A, each feature parameter in the flow table a is obtained from the counter and the instruction set, and the obtained feature parameters are feature parameter a1 and feature parameter a2.
[0066] In the embodiment provided by the present invention, the flow table compression system matches the corresponding flow table template according to the type of flow table and the characteristics in the flow table, obtains each characteristic parameter in the flow table through the predefined characteristic parameter list in the flow table template, and converts the complete flow table into the characteristic parameters for representation, thereby greatly reducing the memory space occupied by the object header when the flow table is stored, improving the efficiency of the database, and ensuring that after the complete flow table is restored according to the flow table template, the data in the complete flow table is complete and standardized, which is easy to manage.
[0067] A possible implementation method is to generate TLV codes corresponding to each characteristic parameter using TLV coding rules according to the characteristic parameters, including:
[0068] According to the type of the characteristic parameter, a type code of the characteristic parameter is generated; according to the parameter value of the characteristic parameter, a length code and a value code of the characteristic parameter are generated; the type code, the length code and the value code of the characteristic parameter are assembled together in sequence to obtain the TLV code of the characteristic parameter.
[0069] For example, after the flow table management module 22 obtains the characteristic parameter a1 in the flow table a, it first obtains the type code of the characteristic parameter a1 as 40 according to the type of the characteristic parameter a1; then, according to the parameter value 07020103A00000010A010000017400116766E9 of the characteristic parameter a1, it obtains the length code of the characteristic parameter a1 as 19 and the value code as 07020103A00000010A010000017400116766E9. The type code, length code and value code of the characteristic parameter a1 are assembled together in sequence to obtain the TLV code of the characteristic parameter a1 as 401907020103A00000010A010000017400116766E9.
[0070] In the embodiment provided by the present invention, the flow table compression system encodes each characteristic parameter obtained into a corresponding TLV code in sequence according to the TLV encoding rule, thereby converting the characteristic parameters into a binary array, thereby greatly reducing the memory space required for flow table storage and improving the efficiency of the database.
[0071] Based on the same inventive concept, the present invention provides a method for decompressing a compressed flow table, which is applied to a DataStore database in an SDN. The DataStore database generates a compressed flow table using the above flow table compression method. Figure 4 , the method comprising:
[0072] 401. Obtain a compressed flow table to be decompressed, parse the first byte of the compressed flow table, and obtain a flow table template number corresponding to the compressed flow table;
[0073] 402. Obtain a corresponding flow table template according to the flow table template number, obtain a flow table rule of a complete flow table corresponding to the compressed flow table and a TLV code of the compressed flow table according to the flow table template, decode the TLV code of the compressed flow table using a TLV decoding rule, and obtain characteristic parameters of the compressed flow table;
[0074] 403. Input characteristic parameters of the compressed flow table into the flow table rule of the complete flow table to obtain the complete flow table corresponding to the compressed flow table.
[0075] For example, Figure 2As shown, it is assumed that the service module 21 sends a flow table query request to the flow table management module 22.
[0076] After receiving the query request, the flow table management module 22 obtains the corresponding compressed flow table a from the DataStore database 24 c The flow table management module 22 parses and compresses the flow table a c The first byte A of the flow table template corresponding to the flow table template A is obtained. Then, the flow table management module 22 searches the flow table template A in the flow table template library 23, and compresses the flow table template A according to the flow table rules and the compressed flow table A in the flow table template A. c The TLV encoding in the table is decoded using the TLV decoding rule to obtain the compressed flow table a c The characteristic parameters a1{07020103A00000010A010000017400116766E9} and a2{027C009F34} in the flow table management module 22 are input into the complete flow table rules in the flow table template A to obtain the compressed flow table a. c The corresponding complete flow table a.
[0077] In the embodiment provided by the present invention, the flow table compression system uses the flow table template to decompress the compressed flow table and restore the compressed flow table to a complete flow table, thereby ensuring the accuracy and standardization of the flow table data.
[0078] A possible implementation method is to obtain the TLV encoding of the compressed flow table according to the flow table template, use the TLV decoding rule to decode the TLV encoding of the compressed flow table, and obtain the characteristic parameters of the compressed flow table, including:
[0079] According to the flow table template, extract the TLV code of the compressed flow table starting from the second byte of the compressed flow table; decode the TLV code of the compressed flow table in the order of type, length and value to obtain the corresponding characteristic parameters until the TLV code is decoded.
[0080] The TLV encoding of the compressed flow table is decoded in order of type, length and value to obtain the corresponding characteristic parameters, including:
[0081] The first undecoded byte of the TLV code is used as the type of the characteristic parameter corresponding to the TLV code, and the second byte is used as the length of the characteristic parameter corresponding to the TLV code; according to the length of the characteristic parameter, the TLV code of the corresponding length is used as the value of the characteristic parameter to obtain the complete characteristic parameter.
[0082] For example, the flow table management module 22 obtains the compressed flow table a c0A401907020103A00000010A010000017400116766E92005027C009F34. First, extract the first byte to obtain the compressed stream table a. c The corresponding flow table template is flow table template A.
[0083] Then extract the second byte and obtain the type of characteristic parameter a1 as "40". Then extract the third byte and obtain the length of the parameter value of characteristic parameter a1 as "19". According to the length of the parameter value of characteristic parameter a1, extract the content of 19 bytes "07020103A00000010A010000017400116766E9" as the parameter value of characteristic parameter a1.
[0084] At this time, the compression flow table a c The extraction is not complete, so continue to decompress the characteristic parameter a2 in the order of type-length-value. The extracted characteristic parameter a2 has a type of "20", a parameter value length of "5", and a parameter value of "027C009F34". At this time, the compression flow table a c Extraction is complete, so compress flow table a c There are two characteristic parameters in the corresponding complete flow table, namely characteristic parameter a1{07020103A00000010A010000017400116766E9} and characteristic parameter a2{027C009F34}.
[0085] In the embodiment provided by the present invention, the flow table compression system uses a flow table template to re-decompress the compressed flow table into characteristic parameters corresponding to the complete flow table, thereby ensuring the accuracy of the flow table data. At the same time, since the rules used for flow table compression and decompression are all pre-set, the standardization of the flow table data is also improved.
[0086] Based on the same inventive concept, this application provides a flow table compression system, see Figure 5 , the flow table compression system includes:
[0087] The template selection unit 501 is used to select a corresponding flow table template according to the type of the flow table, and use the flow table template to identify various characteristic parameters of the flow table; wherein the flow table template is a flow table rule pre-set according to the type of the flow table, and is used to identify the characteristic parameters in the flow table;
[0088] A TLV encoding unit 502 is used to generate TLV codes corresponding to each characteristic parameter using TLV encoding rules;
[0089] The flow table compression unit 503 is used to use the number of the flow table template as the first byte of the compressed flow table, and arrange the TLV codes corresponding to the characteristic parameters in sequence after the first byte according to the order of the characteristic parameters in the flow table to obtain the compressed flow table corresponding to the flow table.
[0090] In a possible implementation manner, the template selection unit 501 is used to:
[0091] Perform feature matching on the flow table according to the type of flow table, select the corresponding flow table template in the flow table template library according to the feature order and rules in the flow table; identify and extract various feature parameters of the flow table in the flow table according to the flow table rules pre-set in the flow table template.
[0092] In a possible implementation manner, the TLV encoding unit 502 is used to:
[0093] According to the type of the characteristic parameter, a type code of the characteristic parameter is generated; according to the parameter value of the characteristic parameter, a length code and a value code of the characteristic parameter are generated; the type code, the length code and the value code of the characteristic parameter are assembled together in sequence to obtain the TLV code of the characteristic parameter.
[0094] Based on the same inventive concept, this application also provides a system for decompressing a compressed flow table, see Figure 6 , the system for decompressing the compressed flow table includes:
[0095] The template query unit 601 is used to obtain the compressed flow table to be decompressed, parse the first byte of the compressed flow table, and obtain the flow table template number corresponding to the compressed flow table;
[0096] A TLV decoding unit 602 is used to obtain a corresponding flow table template according to the flow table template number, obtain a flow table rule of a complete flow table corresponding to the compressed flow table and a TLV code of the compressed flow table according to the flow table template, and decode the TLV code of the compressed flow table using the TLV decoding rule to obtain characteristic parameters of the compressed flow table;
[0097] The flow table decompression unit 603 is used to input the characteristic parameters of the compressed flow table into the flow table rules of the complete flow table to obtain the complete flow table corresponding to the compressed flow table.
[0098] In a possible implementation manner, the TLV decoding unit 602 is used to:
[0099] According to the flow table template, extract the TLV code of the compressed flow table starting from the second byte of the compressed flow table; decode the TLV code of the compressed flow table in the order of type, length and value to obtain the corresponding characteristic parameters until the TLV code is decoded.
[0100] In a possible implementation manner, the TLV decoding unit 602 is used to:
[0101] The first undecoded byte of the TLV code is used as the type of the characteristic parameter corresponding to the TLV code, and the second byte is used as the length of the characteristic parameter corresponding to the TLV code; according to the length of the characteristic parameter, the TLV code of the corresponding length is used as the value of the characteristic parameter to obtain the complete characteristic parameter.
[0102] Based on the same inventive concept, an embodiment of the present invention provides a flow table compression and decompression device, including:
[0103] At least one processor, the processor is used to implement the steps of the above flow table compression and decompression method provided in the embodiment of the present application when executing the computer program stored in the memory.
[0104] Optionally, the processor may specifically be a central processing unit, an application specific integrated circuit (English: Application Specific Integrated Circuit, abbreviated as: ASIC), or may be one or more integrated circuits for controlling program execution.
[0105] Optionally, the data integrity protection device further includes a memory connected to at least one processor, and the memory may include a read-only memory (ROM), a random access memory (RAM), and a disk memory. The memory is used to store data required by the processor when it is running, that is, it stores instructions that can be executed by at least one processor. At least one processor executes the instructions stored in the memory to execute the instructions such as Figure 1 or Figure 4 The method shown in the figure. Wherein, the number of memories is one or more.
[0106] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer executes the steps of the above flow table compression and decompression method.
[0107] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0108] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0109] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0110] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0111] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A flow table compression method, applied to a DataStore database in SDN, characterized in that: The method comprises: According to the type of flow table, a corresponding flow table template is selected, and each characteristic parameter of the flow table is identified by using the flow table template; wherein the flow table template is a flow table rule pre-set according to the type of flow table, and is used to identify the characteristic parameters in the flow table; Generate TLV codes corresponding to each characteristic parameter using TLV coding rules; The number of the flow table template is used as the first byte of the compressed flow table, and the TLV codes corresponding to the characteristic parameters are arranged in sequence after the first byte according to the order of the characteristic parameters in the flow table to obtain the compressed flow table corresponding to the flow table.
2. The method according to claim 1, characterized in that According to the type of flow table, a corresponding flow table template is selected, and each characteristic parameter of the flow table is identified by using the flow table template, including: Perform feature matching on the flow table according to the type of the flow table, and select a corresponding flow table template from a flow table template library according to the feature sequence and rules in the flow table; According to the flow table rules preset in the flow table template, each characteristic parameter of the flow table is identified and extracted in the flow table.
3. The method according to claim 1, characterized in that According to the characteristic parameters, using TLV encoding rules to generate TLV encodings corresponding to the characteristic parameters, including: According to the type of the characteristic parameter, generating a type code of the characteristic parameter; Generating a length code and a value code of the characteristic parameter according to the parameter value of the characteristic parameter; The type code, length code and value code of the characteristic parameter are assembled together in sequence to obtain the TLV code of the characteristic parameter.
4. A method for decompressing a compressed flow table, applied to a DataStore database in an SDN, wherein the DataStore database generates a compressed flow table using a method as described in any one of claims 1 to 3, characterized in that: include: Obtaining a compressed flow table to be decompressed, parsing the first byte of the compressed flow table, and obtaining a flow table template number corresponding to the compressed flow table; Obtaining a corresponding flow table template according to the flow table template number, obtaining a flow table rule of a complete flow table corresponding to the compressed flow table and a TLV encoding of the compressed flow table according to the flow table template, decoding the TLV encoding of the compressed flow table using a TLV decoding rule, and obtaining characteristic parameters of the compressed flow table; The characteristic parameters of the compressed flow table are input into the flow table rule of the complete flow table to obtain the complete flow table corresponding to the compressed flow table.
5. The method according to claim 4, characterized in that Acquiring the TLV encoding of the compressed flow table according to the flow table template, decoding the TLV encoding of the compressed flow table using a TLV decoding rule, and obtaining characteristic parameters of the compressed flow table, including: According to the flow table template, extracting the TLV code of the compressed flow table starting from the second byte of the compressed flow table; The TLV encoding of the compressed flow table is decoded in sequence according to the order of type, length and value to obtain corresponding characteristic parameters until the TLV encoding is completely decoded.
6. The method according to claim 5, characterized in that The TLV encoding of the compressed flow table is decoded in order of type, length and value to obtain corresponding characteristic parameters, including: The first byte of the TLV code that has not been decoded is used as the type of the characteristic parameter corresponding to the TLV code, and the second byte is used as the length of the characteristic parameter corresponding to the TLV code; According to the length of the characteristic parameter, the TLV encoding of the corresponding length is used as the value of the characteristic parameter to obtain the complete characteristic parameter.
7. A flow table compression system, characterized in that: include: A template selection unit, configured to select a corresponding flow table template according to the type of flow table, and use the flow table template to identify various characteristic parameters of the flow table; wherein the flow table template is a flow table rule pre-set according to the type of flow table, and is used to identify the characteristic parameters in the flow table; A TLV encoding unit, used to generate TLV codes corresponding to each characteristic parameter using TLV encoding rules according to the characteristic parameters; A flow table compression unit is used to use the number of the flow table template as the first byte of the compressed flow table, and arrange the TLV codes corresponding to the characteristic parameters in the order of the characteristic parameters in the flow table in sequence after the first byte to obtain the compressed flow table corresponding to the flow table.
8. A system for decompressing a compressed flow table, wherein the compressed flow table is generated using the method according to any one of claims 1 to 3, characterized in that: include: A template query unit, used to obtain a compressed flow table to be decompressed, parse the first byte of the compressed flow table, and obtain a flow table template number corresponding to the compressed flow table; A TLV decoding unit is used to obtain a corresponding flow table template according to the flow table template number, obtain a flow table rule of a complete flow table corresponding to the compressed flow table and a TLV encoding of the compressed flow table according to the flow table template, and use a TLV decoding rule to decode the TLV encoding of the compressed flow table to obtain characteristic parameters of the compressed flow table; The flow table decompression unit is used to input the characteristic parameters of the compressed flow table into the flow table rules of the complete flow table to obtain the complete flow table corresponding to the compressed flow table.
9. A flow table compression and decompression device, characterized in that: include: at least one processor, and a memory coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor executes the method according to any one of claims 1 to 6 by executing the instructions stored in the memory.
10. 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 caused to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Table look-up key value construction method and microcode issuing method, device and system
CN103560957A
Flow table issuing method, system and controller thereof
CN106878178A