CN114328457A - Method, system, device and storage medium for compressing and decompressing flow table - Google Patents

Method, system, device and storage medium for compressing and decompressing flow table Download PDF

Info

Publication number
CN114328457A
CN114328457A CN202111643506.0A CN202111643506A CN114328457A CN 114328457 A CN114328457 A CN 114328457A CN 202111643506 A CN202111643506 A CN 202111643506A CN 114328457 A CN114328457 A CN 114328457A
Authority
CN
China
Prior art keywords
flow table
compressed
template
tlv
characteristic parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111643506.0A
Other languages
Chinese (zh)
Inventor
许福
游俊强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ruijie Networks Co Ltd
Original Assignee
Ruijie Networks Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ruijie Networks Co Ltd filed Critical Ruijie Networks Co Ltd
Priority to CN202111643506.0A priority Critical patent/CN114328457A/en
Publication of CN114328457A publication Critical patent/CN114328457A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The invention relates to the technical field of communication, and provides a flow table compression and decompression method, a system, a device and a storage medium, which are used for solving the technical problems of large memory occupation, low database efficiency and waste of useless configuration space in the prior art when massive flow tables are stored in a DataStore database, wherein the flow table compression method comprises the following steps: selecting a corresponding flow table template according to the type of the flow table, and identifying each characteristic parameter of the flow table by using the flow table template; the flow table template is a flow table rule preset according to the type of the flow table and is used for identifying characteristic parameters in the flow table; according to the characteristic parameters, using TLV encoding rules to generate TLV encoding corresponding to each characteristic parameter; and taking the number of the flow table template as a first byte of the compressed flow table, and sequentially arranging TLV codes corresponding to the characteristic parameters after the first byte according to the sequence of the characteristic parameters in the flow table to obtain the compressed flow table corresponding to the flow table.

Description

Method, system, device and storage medium for compressing and decompressing flow table
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, a system, a device, and a storage medium for compressing and decompressing a flow table.
Background
Software Defined Networking (SDN) is a concept of an emerging Network revolution, and has a great improvement in scale, function, control power and flexibility compared with a conventional Network. With the rise of data center network technology, new challenges are presented to the SDN controller. The SDN controller facing the data center needs to support centralized management and scheduling of thousands of network device nodes, and support configuration and storage of tens of millions of flow tables so as to meet service deployment and control requirements of the data center, which put higher requirements on storage capacity, stability and efficiency of the controller.
Currently, an SDN controller based on an MD-SAL (Model-driver Service Abstraction Layer) architecture generally stores data in a DataStore, and the DataStore provides functions of storing, reading, and performing transactions of data. The DataStore is used as an in-memory database, all data are put in the in-memory to be directly operated, and the data are stored in the DataStore in a tree structure. In order to solve the above functional requirements, a conventional SDN controller uses a DataStore memory database to store ten million levels of flow table configuration information in a full amount.
However, since the DataStore is an in-memory database, the data capacity is limited by the memory. The data volume is too large, which easily causes insufficient memory. On one hand, space expansion is caused by storing data into a memory object package, on the other hand, in addition to a static space requirement, extra memory support is also needed in the process from data persistence to disk snapshot generation, and in order to support ten million levels of flow table configuration storage, a DataStore needs to occupy hundreds of G memory resources, so that the cost of the controller is increased greatly; secondly, the DataStore is used as a memory database, memory data can be written into a disk through a persistence generated snapshot, when the controller is started, data in the disk needs to be loaded into a memory, the loading time of the mass data of ten million levels is long, so that the starting time of the controller is long, and when the controller is restarted due to abnormal conditions such as controller abnormity or power failure, the normal use of the controller can be influenced for a long time; finally, the memory data volume in the DataStore is mainly composed of two parts, which are the size of the head of the node object and the size of the data, in general, the space occupied by the object head is large, the data structure of the flow table is complex, and the number of nodes is large, so that the database needs to consume most of resources to store the node object head, and the space of the actual data content of the flow table is compressed, which results in the waste of memory space.
Therefore, how to solve the problems of large memory occupation, low database efficiency and waste of useless configuration space in the database for storing massive flow tables becomes an urgent need.
Disclosure of Invention
The invention provides a method, a system, a device and a storage medium for compressing and decompressing a flow table, which are used for solving the technical problems of large memory occupation, low database efficiency and waste of useless configuration space in the prior art when massive flow tables are stored in a DataStore database.
The first aspect of the present invention provides a flow table compression method, applied to a DataStore database in an SDN, where the method includes:
selecting a corresponding flow table template according to the type of the flow table, and identifying each characteristic parameter of the flow table by using the flow table template; the flow table template is a flow table rule preset according to the type of a flow table and is used for identifying characteristic parameters in the flow table;
using TLV encoding rules to generate TLV encoding corresponding to each characteristic parameter;
and taking the serial number of the flow table template as a first byte of a compressed flow table, and sequentially arranging TLV codes corresponding to the characteristic parameters after the first byte according to the sequence of the characteristic parameters in the flow table to obtain the compressed flow table corresponding to the flow table.
Optionally, selecting a corresponding flow table template according to the type of the flow table, and identifying each characteristic parameter of the flow table by using the flow table template, including:
performing feature matching on the flow table according to the type of the flow table, and selecting a corresponding flow table template from a flow table template library according to a feature sequence and rules in the flow table;
and according to a flow table rule preset in the flow table template, identifying and extracting each characteristic parameter of the flow table in the flow table.
Optionally, according to the feature parameter, a TLV encoding rule is used to generate a TLV encoding corresponding to the feature parameter, where the TLV encoding includes:
generating a type code of the characteristic parameter according to the type of the characteristic parameter;
generating length codes and value codes of the characteristic parameters according to the parameter values of the characteristic parameters;
and sequentially assembling the type coding, the length coding and the value coding of the characteristic parameter together to obtain the TLV coding of the characteristic parameter.
In a second aspect, the present application provides a method for decompression of a compressed flow table, applied in a DataStore database in an SDN, the DataStore database generating the compressed flow table using the method according to any one of the first aspects, including:
acquiring a compressed flow table to be decompressed, analyzing a first byte of the compressed flow table, and acquiring a flow table template number corresponding to the compressed flow table;
acquiring a corresponding flow table template according to the flow table template number, acquiring a flow table rule of an integral flow table corresponding to the compressed flow table and TLV (threshold value limit) codes of the compressed flow table according to the flow table template, and decoding the TLV codes of the compressed flow table by using TLV decoding rules to acquire characteristic parameters of the compressed flow table;
and inputting the 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.
Optionally, the obtaining TLV encoding of the compressed flow table according to the flow table template, decoding the TLV encoding of the compressed flow table by using a TLV decoding rule, and obtaining the characteristic parameters of the compressed flow table includes:
extracting TLV encoding of the compressed flow table from a second byte of the compressed flow table according to the flow table template;
and encoding the TLV of the compressed flow table, and sequentially decoding according to the type, the length and the value sequence to obtain corresponding characteristic parameters until the TLV encoding and decoding are finished.
Encoding the TLV of the compressed flow table, and sequentially decoding according to the type, the length and the sequence of the value to obtain corresponding characteristic parameters, wherein the TLV encoding comprises the following steps:
taking the first byte which is not decoded by the TLV encoding as the type of the characteristic parameter corresponding to the TLV encoding, and taking the second byte as the length of the characteristic parameter corresponding to the TLV encoding;
and according to the length of the characteristic parameter, encoding the TLV with the corresponding length as the value of the characteristic parameter to obtain the complete characteristic parameter.
In a third aspect, the present application provides a system for flow table compression, comprising:
the flow table template selecting unit is used for selecting a corresponding flow table template according to the type of the flow table and identifying each characteristic parameter of the flow table by using the flow table template; the flow table template is a flow table rule preset according to the type of a flow table and is used for identifying characteristic parameters in the flow table;
a TLV encoding unit, configured to generate TLV encoding corresponding to each feature parameter by using a TLV encoding rule;
and the flow table compression unit is used for taking the number of the flow table template as a first byte of a compressed flow table, sequentially arranging TLV codes corresponding to the characteristic parameters after the first byte according to the sequence of the characteristic parameters in the flow table, and obtaining the compressed flow table corresponding to the flow table.
In a fourth aspect, the present application provides a system for compression flow table decompression, the compression flow table generated using the method of any one of the first aspect, comprising:
the template query unit is used for acquiring a compressed flow table to be decompressed, analyzing the first byte of the compressed flow table and acquiring the flow table template number corresponding to the compressed flow table;
the TLV decoding unit is used for acquiring a corresponding flow table template according to the flow table template number, acquiring a flow table rule of an integral flow table corresponding to the compressed flow table and TLV encoding of the compressed flow table according to the flow table template, and decoding the TLV encoding of the compressed flow table by using the TLV decoding rule to acquire the characteristic parameter of the compressed flow table;
and the flow table decompressing unit is used for inputting the 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.
In a fifth aspect, an embodiment of the present application provides an apparatus for compressing and decompressing a flow table, including:
at least one processor, and
a memory coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor, the at least one processor performing the method of any one of the first and second aspects by executing the instructions stored by the memory.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium storing computer instructions that, when executed on a computer, cause the computer to perform the method according to any one of the first and second aspects.
The technical scheme in the embodiment of the application has the following beneficial effects: the flow table compression system selects a corresponding flow table template according to the type of the flow table, and each characteristic parameter of the flow table is identified by using the flow table template; the flow table template is a flow table rule preset according to the type of the flow table and is used for identifying characteristic parameters in the flow table; using TLV encoding rules to generate TLV encoding corresponding to each characteristic parameter; the serial number of the flow table template is used as the first byte of the compressed flow table, TLV codes corresponding to the characteristic parameters are sequentially arranged behind the first byte according to the sequence of the characteristic parameters in the flow table, the compressed flow table corresponding to the flow table is obtained, data are compressed based on the flow table template, occupation of storage space is greatly reduced, the loading speed of a database is increased, waste of useless configuration space of flow table storage is reduced, meanwhile, data in the flow table are more normalized due to data compression based on the preset flow table template, and maintenance and management are facilitated.
Drawings
Fig. 1 is a flowchart of a method for compressing a flow table according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a flow table compression/decompression system according to an embodiment of the present invention;
fig. 3 is a schematic diagram of extracting feature parameters from a flow table according to a flow table template according to an embodiment of the present invention;
fig. 4 is a flowchart of a method for decompressing a compressed flow table according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a system for flow table compression according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a system for decompressing a compressed flow table according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
In the prior art, because the DataStore is a memory database, when a large amount of flow table data is stored in the memory database, the problems of large memory occupation, low database efficiency and waste of configuration space are easy to occur.
Therefore, the invention provides a method, a system, a device and a storage medium for compressing and decompressing flow tables, which are applied to a DataStore database in an SDN and used for solving the technical problems of large memory occupation, low database efficiency and waste of useless configuration space in the prior art when massive flow tables are stored in the DataStore database.
The technical scheme provided by the embodiment of the application is described in the following with the accompanying drawings of the specification.
Referring to fig. 1, the present invention provides a method for compressing a flow table, including:
101. selecting a corresponding flow table template according to the type of the flow table, and identifying each characteristic parameter of the flow table by using the flow table template; the flow table template is a flow table rule preset according to the type of the flow table and is used for identifying characteristic parameters in the flow table;
102. using TLV encoding rules to generate TLV encoding corresponding to each characteristic parameter;
103. and taking the number of the flow table template as a first byte of the compressed flow table, and sequentially arranging TLV codes corresponding to the characteristic parameters after the first byte according to the sequence of the characteristic parameters in the flow table to obtain the compressed flow table corresponding to the flow table.
For example, referring to fig. 2, fig. 2 is a schematic structural diagram of a flow table compression and decompression system according to an embodiment of the present invention. Including a service module 21, a flow table management module 22, a flow table template library 23, and a DataStore database 24.
Before compressing the flow table, the flow table compression system firstly establishes a flow table template for each type of flow table according to the difference of the types of the flow tables, and the flow table template comprises a flow table template number, a flow table rule and a flow table compression and decompression method. After the flow table compression system establishes the flow table template, the flow table template is stored in the flow table template library 23.
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 acquires the flow table, and after the flow table management module 22 acquires the flow table a, the flow table template a corresponding to the flow table a is queried in the flow table template library 23 according to the type of the flow table a. And performing feature matching according to the flow table rule in the flow table template a and the flow table a, and recognizing that two feature parameters in the flow table a are provided, namely a feature parameter a1 with the type of 40 and a feature parameter a2 with the type of 20.
Then, the flow table management module 22 encodes the feature parameter a1 and the feature parameter a2, and according to the rule of TLV (Type-length-value) encoding, the Type of the feature parameter a1 is 40, the value is 07020103a00000010a010000017400116766E9, and the length is 19, so the TLV corresponding to the feature parameter a1 is encoded as 401907020103a00000010a010000017400116766E 9; the type of the characteristic parameter a2 is 20, the value is 027C009F34, the length is 5, so the TLV corresponding to the characteristic parameter a2 is encoded as 2005027C009F 34.
Finally, the flow table management module 22 sets 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 acAfter the TLV encodings of the characteristic parameter a1 and the characteristic parameter a2 are arranged in order after the first byte, the compressed flow table a corresponding to the flow table a is obtainedcIs 0A401907020103A00000010A010000017400116766E92005027C009F 34. The flow table management module 22 compresses the flow table a corresponding to the flow table acStore into DataStore database24, respectively. In practical application, based on the flow table compression method, an efficient flow table retrieval method can be obtained, and when the SDN sends an inquiry request, the flow table management module 22 inquires a corresponding compression flow table according to the inquiry request and returns the compression flow table to the SDN; and the SDN decompresses the compressed flow table after receiving the compressed flow table to obtain a complete flow table. The flow table searching mode effectively improves the searching efficiency, and simultaneously reduces the pressure of network transmission because the flow table is compressed in the network transmission.
In the embodiment provided by the invention, the flow table compression system selects the corresponding flow table template according to the type of the flow table, and identifies each characteristic parameter of the flow table by using the flow table template; the flow table template is a flow table rule preset according to the type of the flow table and is used for identifying characteristic parameters in the flow table; according to the characteristic parameters, using TLV encoding rules to generate TLV encoding corresponding to each characteristic parameter; the serial number of the flow table template is used as the first byte of the compressed flow table, TLV codes corresponding to the characteristic parameters are sequentially arranged behind the first byte according to the sequence of the characteristic parameters in the flow table, the compressed flow table corresponding to the flow table is obtained, data are compressed based on the flow table template, occupation of storage space is greatly reduced, the loading speed of a database is increased, waste of useless configuration space of flow table storage is reduced, meanwhile, data in the flow table are more normalized due to data compression based on the preset flow table template, and maintenance and management are facilitated.
One possible embodiment is that, 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:
performing feature matching on the flow table according to the type of the flow table, and selecting a corresponding flow table template from a flow table template library according to a feature sequence and rules in the flow table; according to a flow table rule preset in the flow table template, each characteristic parameter of the flow table is identified and extracted in the flow table.
For example, referring to fig. 3, fig. 3 is a schematic diagram illustrating extracting feature parameters from a flow table according to a flow table template according to an embodiment of the present invention.
After the flow table management module 22 acquires the flow table a, feature matching is performed on the flow table a according to the type of the flow table a, and according to the feature sequence and the rule in the flow table a, the feature sequence and the rule matched in the flow table model a and the flow table a are consistent and are { matching domain: a; a counter: (parameters); the instruction set: (parameter) }. Therefore, each feature parameter in flow table a is acquired in the counter and instruction set according to the rule list in flow table template a, and the acquired feature parameters are feature parameter a1 and feature parameter a 2.
In the embodiment provided by the invention, the flow table compression system matches the flow table template corresponding to the flow table according to the type of the flow table and the characteristics in the flow table, and acquires each characteristic parameter in the flow table through the predefined characteristic parameter list in the flow table template, so that the complete flow table is converted into the characteristic parameter to be represented, the memory space occupied by the object head during flow table storage is greatly reduced, the efficiency of the database is improved, and the data in the complete flow table is complete and standard after the complete flow table is recovered according to the flow table template, so that the management is convenient.
One possible implementation manner, according to the feature parameters, using TLV encoding rules to generate TLV encodings corresponding to the respective feature parameters, includes:
generating type codes of the characteristic parameters according to the types of the characteristic parameters; generating length codes and value codes of the characteristic parameters according to the parameter values of the characteristic parameters; and sequentially assembling the type encoding, the length encoding and the value encoding of the characteristic parameter together to obtain the TLV encoding of the characteristic parameter.
For example, after the flow table management module 22 acquires the characteristic parameter in the flow table a as the characteristic parameter a1, the type code of the characteristic parameter a1 is obtained as 40 according to the type of the characteristic parameter a 1; then, according to the parameter value 07020103A00000010A010000017400116766E9 of the characteristic parameter a1, the length code of the characteristic parameter a1 is 19, and the value code is 07020103A00000010A010000017400116766E 9. The type encoding, the length encoding and the value encoding of the characteristic parameter a1 are assembled together in sequence, and the TLV encoding of the characteristic parameter a1 is obtained as 401907020103A00000010A010000017400116766E 9.
In the embodiment provided by the invention, the flow table compression system sequentially encodes each acquired characteristic parameter into the corresponding TLV code according to the TLV encoding rule, so that the characteristic parameter is converted into a binary array, the memory space required during flow table storage is greatly reduced, and the database efficiency is improved.
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, where the DataStore database generates a compressed flow table by using the above method for compressing a flow table, please refer to fig. 4, where the method includes:
401. acquiring a compressed flow table to be decompressed, analyzing a first byte of the compressed flow table, and acquiring a flow table template number corresponding to the compressed flow table;
402. acquiring a corresponding flow table template according to the flow table template number, acquiring a flow table rule of an integral flow table corresponding to the compressed flow table and TLV (threshold Length value) encoding of the compressed flow table according to the flow table template, and decoding the TLV encoding of the compressed flow table by using a TLV decoding rule to acquire a characteristic parameter of the compressed flow table;
403. and inputting the 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.
For example, as shown in fig. 2, it is assumed that the traffic module 21 transmits a flow table query request to the flow table management module 22.
After receiving the query request, the flow table management module 22 acquires the corresponding compressed flow table a from the DataStore database 24c. The flow table management module 22 parses the compressed flow table acAnd acquiring the flow table template corresponding to the first byte A as the flow table template A. Then, the flow table management module 22 looks up the flow table template a in the flow table template library 23, and compresses the flow table a in accordance with the flow table rule in the flow table template acUsing TLV decoding rule to decode and obtain compressed flow table acCharacteristic parameter a1{07020103A00000010A010000017400116766E9} and characteristic parameter a2{027C009F34 }. Finally, the flow table management module 22 inputs the characteristic parameter a1 and the characteristic parameter a2 to the full flow table rule in the flow table template a, and obtains the compressed flow table acThe corresponding complete flow table a.
In the embodiment provided by the invention, the flow table compression system decompresses the compressed flow table by using the flow table template, restores the compressed flow table into the complete flow table, and ensures the accuracy and the normalization of the flow table data.
One possible embodiment, acquiring TLV encoding of the compressed flow table according to the flow table template, decoding TLV encoding of the compressed flow table using TLV decoding rules, and acquiring characteristic parameters of the compressed flow table includes:
extracting TLV encoding of the compressed flow table from the second byte of the compressed flow table according to the flow table template; and encoding the TLV of the compressed flow table, and sequentially decoding according to the type, the length and the value sequence to obtain corresponding characteristic parameters until the TLV encoding and decoding are finished.
Wherein, TLV encoding of the compressed flow table, according to the sequence of type, length and value, decoding in turn to obtain corresponding characteristic parameters, including:
taking the first byte which is not decoded by the TLV encoding as the type of the characteristic parameter corresponding to the TLV encoding, and taking the second byte as the length of the characteristic parameter corresponding to the TLV encoding; according to the length of the characteristic parameter, TLV codes with corresponding length are used as the value of the characteristic parameter to obtain the complete characteristic parameter.
For example, the flow table management module 22 acquires the compressed flow table acTo 0a401907020103a00000010a010000017400116766E92005027C009F34, first, the first byte thereof is extracted to obtain a compressed flow table acThe corresponding flow table template is flow table template a.
Then the second byte is extracted to obtain the characteristic parameter a1 with type "40". The third byte is extracted again, and the length of the parameter value for obtaining the characteristic parameter a1 is '19'. According to the length of the parameter value of the characteristic parameter a1, 19 bytes of content "07020103 a00000010a010000017400116766E 9" is extracted later as the parameter value of the characteristic parameter a 1.
And at this time, stream table a is compressedcAnd the extraction is not finished, so the characteristic parameters a2 continue to be decompressed according to the sequence of type-length-values. The type of the extracted characteristic parameter a2 is "20", the length of the parameter value is "5", the parameter value is "027C 009F 34", and the flow table a is compressed at this timecAfter extraction, the flow table a is compressedcCorresponding toThe complete flow table has two feature parameters, namely a feature parameter a1{07020103A00000010A010000017400116766E9} and a feature parameter a2{027C009F34 }.
In the embodiment provided by the invention, the flow table compression system decompresses the compressed flow table into the characteristic parameters corresponding to the complete flow table again by using the flow table template, so that the accuracy of the flow table data is ensured, and meanwhile, the normalization of the flow table data is also improved because the rules used for compressing and decompressing the flow table are preset.
Based on the same inventive concept, the present application provides a flow table compression system, please refer to fig. 5, which includes:
a template selecting unit 501, configured to select a corresponding flow table template according to the type of the flow table, and identify each feature parameter of the flow table by using the flow table template; the flow table template is a flow table rule preset according to the type of the flow table and is used for identifying characteristic parameters in the flow table;
a TLV encoding unit 502, configured to generate TLV encodings corresponding to the respective characteristic parameters by using TLV encoding rules;
the flow table compressing unit 503 is configured to use the number of the flow table template as a first byte of the compressed flow table, and sequentially arrange TLV codes corresponding to the feature parameters after the first byte according to the order of the feature parameters in the flow table, so as to obtain the compressed flow table corresponding to the flow table.
In one possible embodiment, the template selecting unit 501 is configured to:
performing feature matching on the flow table according to the type of the flow table, and selecting a corresponding flow table template from a flow table template library according to a feature sequence and rules in the flow table; according to a flow table rule preset in the flow table template, each characteristic parameter of the flow table is identified and extracted in the flow table.
In one possible embodiment, the TLV encoding unit 502 is configured to:
generating type codes of the characteristic parameters according to the types of the characteristic parameters; generating length codes and value codes of the characteristic parameters according to the parameter values of the characteristic parameters; and sequentially assembling the type encoding, the length encoding and the value encoding of the characteristic parameter together to obtain the TLV encoding of the characteristic parameter.
Based on the same inventive concept, the present application further provides a system for decompressing a compressed flow table, please refer to fig. 6, the system for decompressing a compressed flow table includes:
the template query unit 601 is configured to acquire a compressed flow table to be decompressed, analyze a first byte of the compressed flow table, and acquire a flow table template number corresponding to the compressed flow table;
the TLV decoding unit 602 is configured to acquire a corresponding flow table template according to the flow table template number, acquire a flow table rule of an integrated flow table corresponding to the compressed flow table and TLV encoding of the compressed flow table according to the flow table template, and decode the TLV encoding of the compressed flow table by using the TLV decoding rule to acquire a feature parameter of the compressed flow table;
the flow table decompressing unit 603 is configured to input the characteristic parameter of the compressed flow table into the flow table rule of the complete flow table, and obtain the complete flow table corresponding to the compressed flow table.
In one possible embodiment, the TLV decoding unit 602 is configured to:
extracting TLV encoding of the compressed flow table from the second byte of the compressed flow table according to the flow table template; and encoding the TLV of the compressed flow table, and sequentially decoding according to the type, the length and the value sequence to obtain corresponding characteristic parameters until the TLV encoding and decoding are finished.
In one possible embodiment, the TLV decoding unit 602 is configured to:
taking the first byte which is not decoded by the TLV encoding as the type of the characteristic parameter corresponding to the TLV encoding, and taking the second byte as the length of the characteristic parameter corresponding to the TLV encoding; according to the length of the characteristic parameter, TLV codes with corresponding length are used as the value of the characteristic parameter to obtain the complete characteristic parameter.
Based on the same inventive concept, an embodiment of the present invention provides a flow table compression/decompression device, including:
at least one processor, configured to implement the steps of the method for compressing and decompressing a flow table as provided in the embodiments of the present application when executing the computer program stored in the memory.
Alternatively, the processor may be a central processing unit, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits for controlling program execution.
Optionally, the device for protecting data integrity further includes a Memory connected to the at least one processor, where the Memory may include a Read Only Memory (ROM), a Random Access Memory (RAM), and a disk Memory. The memory is used for storing data required by the processor during operation, namely storing instructions which can be executed by at least one processor, and the at least one processor executes the method shown in the first or fourth figure by executing the instructions stored in the memory. Wherein, the number of the memories is one or more.
Embodiments of the present application further provide a computer storage medium, where the computer storage medium stores computer instructions, and when the computer instructions are run on a computer, the computer is caused to execute the steps of the above method for compressing and decompressing a flow table.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such 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 intended to include such modifications and variations as well.

Claims (10)

1. A method for compressing a flow table, applied to a DataStore database in an SDN, the method comprising:
selecting a corresponding flow table template according to the type of the flow table, and identifying each characteristic parameter of the flow table by using the flow table template; the flow table template is a flow table rule preset according to the type of a flow table and is used for identifying characteristic parameters in the flow table;
using TLV encoding rules to generate TLV encoding corresponding to each characteristic parameter;
and taking the serial number of the flow table template as a first byte of a compressed flow table, and sequentially arranging TLV codes corresponding to the characteristic parameters after the first byte according to the sequence of the characteristic parameters in the flow table to obtain the compressed flow table corresponding to the flow table.
2. The method of claim 1, wherein selecting a corresponding flow table template according to a type of a flow table, and identifying each characteristic parameter of the flow table using the flow table template comprises:
performing feature matching on the flow table according to the type of the flow table, and selecting a corresponding flow table template from a flow table template library according to a feature sequence and rules in the flow table;
and according to a flow table rule preset in the flow table template, identifying and extracting each characteristic parameter of the flow table in the flow table.
3. The method of claim 1, wherein generating, according to the feature parameters, TLV encodings corresponding to the respective feature parameters using TLV encoding rules comprises:
generating a type code of the characteristic parameter according to the type of the characteristic parameter;
generating length codes and value codes of the characteristic parameters according to the parameter values of the characteristic parameters;
and sequentially assembling the type coding, the length coding and the value coding of the characteristic parameter together to obtain the TLV coding of the characteristic parameter.
4. A method of compressed flow table decompression applied in a DataStore database in an SDN, the DataStore database generating compressed flow tables using the method of any of claims 1-3, comprising:
acquiring a compressed flow table to be decompressed, analyzing a first byte of the compressed flow table, and acquiring a flow table template number corresponding to the compressed flow table;
acquiring a corresponding flow table template according to the flow table template number, acquiring a flow table rule of an integral flow table corresponding to the compressed flow table and TLV (threshold value limit) codes of the compressed flow table according to the flow table template, and decoding the TLV codes of the compressed flow table by using TLV decoding rules to acquire characteristic parameters of the compressed flow table;
and inputting the 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.
5. The method of claim 4, wherein obtaining TLV encoding of the compressed flow table in accordance with the flow table template, decoding TLV encoding of the compressed flow table using TLV decoding rules, obtaining feature parameters of the compressed flow table, comprises:
extracting TLV encoding of the compressed flow table from a second byte of the compressed flow table according to the flow table template;
and encoding the TLV of the compressed flow table, and sequentially decoding according to the type, the length and the value sequence to obtain corresponding characteristic parameters until the TLV encoding and decoding are finished.
6. The method of claim 5, wherein encoding the TLVs of the compressed flow table, sequentially decoding in order of type, length, and value to obtain corresponding characterizing parameters, comprises:
taking the first byte which is not decoded by the TLV encoding as the type of the characteristic parameter corresponding to the TLV encoding, and taking the second byte as the length of the characteristic parameter corresponding to the TLV encoding;
and according to the length of the characteristic parameter, encoding the TLV with the corresponding length as the value of the characteristic parameter to obtain the complete characteristic parameter.
7. A system for flow table compression, comprising:
the flow table template selecting unit is used for selecting a corresponding flow table template according to the type of the flow table and identifying each characteristic parameter of the flow table by using the flow table template; the flow table template is a flow table rule preset according to the type of a flow table and is used for identifying characteristic parameters in the flow table;
a TLV encoding unit, configured to generate TLV encoding corresponding to each feature parameter by using a TLV encoding rule according to the feature parameter;
and the flow table compression unit is used for taking the number of the flow table template as a first byte of a compressed flow table, sequentially arranging TLV codes corresponding to the characteristic parameters after the first byte according to the sequence of the characteristic parameters in the flow table, and obtaining the compressed flow table corresponding to the flow table.
8. A system that compresses flow tables generated using the method of any of claims 1-3, comprising:
the template query unit is used for acquiring a compressed flow table to be decompressed, analyzing the first byte of the compressed flow table and acquiring the flow table template number corresponding to the compressed flow table;
the TLV decoding unit is used for acquiring a corresponding flow table template according to the flow table template number, acquiring a flow table rule of an integral flow table corresponding to the compressed flow table and TLV encoding of the compressed flow table according to the flow table template, and decoding the TLV encoding of the compressed flow table by using the TLV decoding rule to acquire the characteristic parameter of the compressed flow table;
and the flow table decompressing unit is used for inputting the 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.
9. An apparatus for compressing and decompressing a flow table, comprising:
at least one processor, and
a memory coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor, the at least one processor performing the method of any one of claims 1-6 by executing the instructions stored by the memory.
10. A computer-readable storage medium having stored thereon computer instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1-6.
CN202111643506.0A 2021-12-29 2021-12-29 Method, system, device and storage medium for compressing and decompressing flow table Pending CN114328457A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111643506.0A CN114328457A (en) 2021-12-29 2021-12-29 Method, system, device and storage medium for compressing and decompressing flow table

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111643506.0A CN114328457A (en) 2021-12-29 2021-12-29 Method, system, device and storage medium for compressing and decompressing flow table

Publications (1)

Publication Number Publication Date
CN114328457A true CN114328457A (en) 2022-04-12

Family

ID=81016875

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111643506.0A Pending CN114328457A (en) 2021-12-29 2021-12-29 Method, system, device and storage medium for compressing and decompressing flow table

Country Status (1)

Country Link
CN (1) CN114328457A (en)

Similar Documents

Publication Publication Date Title
CN106936441B (en) Data compression method and device
CN105893337B (en) Method and apparatus for text compression and decompression
US20140040276A1 (en) Method and apparatus for processing time series data
US9031997B2 (en) Log file compression
US8189912B2 (en) Efficient histogram storage
CN107888197B (en) Data compression method and device
EP1990737B1 (en) Document transformation system
CN111708673A (en) Log data compression method, device, equipment and storage medium
CN115408350A (en) Log compression method, log recovery method, log compression device, log recovery device, computer equipment and storage medium
CN113746487A (en) Data compression method and device, electronic equipment and storage medium
CN110633318A (en) Data extraction processing method, device, equipment and storage medium
CN112506869A (en) File processing method, device and system
CN110032432B (en) Example compression method and device and example decompression method and device
CN114328457A (en) Method, system, device and storage medium for compressing and decompressing flow table
CN110825706B (en) Data compression method and related equipment
CN112269601B (en) BMC (baseboard management controller) and component asset information management method, device and storage medium thereof
CN113836157A (en) Method and device for acquiring incremental data of database
CN113076107A (en) Method for automatically acquiring and fusing logs through finite state machine
CN113656474A (en) Service data access method and device, electronic equipment and storage medium
CN108897807B (en) Method and system for carrying out hierarchical processing on data in mobile terminal
CN114070471B (en) Test data packet transmission method, device, system, equipment and medium
CN111291230A (en) Feature processing method and device, electronic equipment and computer-readable storage medium
US12032578B1 (en) Data compression, store, and search system
CN112527753B (en) DNS analysis record lossless compression method and device, electronic equipment and storage medium
US12014169B2 (en) Software recognition using tree-structured pattern matching rules for software asset management

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination