CN116896518A - Route checking method and device, electronic equipment and storage medium - Google Patents

Route checking method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116896518A
CN116896518A CN202311162683.6A CN202311162683A CN116896518A CN 116896518 A CN116896518 A CN 116896518A CN 202311162683 A CN202311162683 A CN 202311162683A CN 116896518 A CN116896518 A CN 116896518A
Authority
CN
China
Prior art keywords
configuration data
data set
compressed
route
route configuration
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.)
Granted
Application number
CN202311162683.6A
Other languages
Chinese (zh)
Other versions
CN116896518B (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311162683.6A priority Critical patent/CN116896518B/en
Publication of CN116896518A publication Critical patent/CN116896518A/en
Application granted granted Critical
Publication of CN116896518B publication Critical patent/CN116896518B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements

Abstract

The application discloses a route account checking method, a device, electronic equipment and a storage medium, which can be applied to various fields of cloud technology, intelligent traffic and the like, wherein a current route configuration data set is compressed according to the same character compression mode to obtain a first compressed route configuration data set, and a desired route configuration data set is compressed to obtain a second compressed route configuration data set; according to the character sequence of the preset character set, sequencing the first compressed route configuration data set to obtain a first ordered compressed route configuration data set, and sequencing the second compressed route configuration data set to obtain a second ordered compressed route configuration data set; comparing the first ordered compressed route configuration data set with the second ordered compressed route configuration data set to obtain a differential compressed route configuration data set; and finally, decompressing the differential compressed routing configuration data set to obtain a differential routing configuration data set of the current routing configuration data set and the expected routing configuration data set. Compared with the related art, the method and the device can improve the efficiency of route checking.

Description

Route checking method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of network technologies, and in particular, to a route accounting method, a route accounting device, an electronic device, and a computer readable storage medium.
Background
The router is also called gateway equipment and is used for connecting a plurality of logically separated networks to realize the forwarding of data among different networks, for example, the router is connected with an internal network and the Internet, so that the forwarding of data from the internal network to the Internet can be realized, and the forwarding of data from the Internet to the internal network can also be realized.
The router decides on the forwarding of the data by means of the routing configuration data, and the forwarding policy is called routing, which is also the origin of the router name. In general, a router is configured with a routing configuration data set composed of routing configuration data composed of a plurality of pieces of routing configuration data, and whether the routing configuration data set is correct or not, that is, whether the router can normally implement data forwarding is determined.
Currently, a reconciliation mode is generally adopted to find the difference between the actual routing configuration and the expected routing configuration on the router, however, the efficiency of performing the routing reconciliation in the related art is low.
Disclosure of Invention
The embodiment of the application provides a route checking method, a route checking device, electronic equipment and a computer readable storage medium, which can improve the efficiency of route checking.
In a first aspect, the present application provides a route reconciliation method, including:
according to the same character compression mode, compressing the current route configuration data set to obtain a first compressed route configuration data set, and compressing the expected route configuration data set to obtain a second compressed route configuration data set;
according to the character sequence of the preset character set, sequencing the first compressed route configuration data set to obtain a first ordered compressed route configuration data set, and sequencing the second compressed route configuration data set to obtain a second ordered compressed route configuration data set;
comparing the first ordered compressed route configuration data set with the second ordered compressed route configuration data set to obtain a differential compressed route configuration data set of the first ordered compressed route configuration data set and the second ordered compressed route configuration data set;
decompressing the differential compressed routing configuration data set to obtain a differential routing configuration data set of the current routing configuration data set and the expected routing configuration data set.
In a second aspect, the present application provides a routing accounting device, including:
the compression module is used for compressing the current route configuration data set to obtain a first compressed route configuration data set and compressing the expected route configuration data set to obtain a second compressed route configuration data set according to the same character compression mode;
The ordering module is used for ordering the first compressed route configuration data set according to the character sequence of the preset character set to obtain a first ordered compressed route configuration data set, and ordering the second compressed route configuration data set to obtain a second ordered compressed route configuration data set;
the comparison module is used for comparing the first ordered compressed route configuration data set and the second ordered compressed route configuration data set to obtain a differential compressed route configuration data set of the first ordered compressed route configuration data set and the second ordered compressed route configuration data set;
and the restoration module is used for decompressing the differential compression route configuration data set to obtain a differential route configuration data set of the current route configuration data set and the expected route configuration data set.
Optionally, in an embodiment, the route configuration data includes an IP (Internet Protocol ) address set, and the compression module is configured to convert the IP address set in the current route configuration data set into an integer address to obtain an integer address set; and performing binary conversion on the integer addresses in the integer address set according to a target binary system to obtain a first compressed route configuration data set, wherein the target binary system is larger than the current binary system of the integer addresses in the integer address set.
Optionally, in an embodiment, the IP address group includes an IPv4 address group, and the compression module is configured to convert each IPv4 address group in the current routing configuration data set into a 64-bit integer address, to obtain an integer address set.
Optionally, in an embodiment, the compression module is configured to convert two IPv4 addresses in each IPv4 address set into corresponding 32-bit decimal integer addresses respectively; and shifting one 32-bit decimal address obtained by converting each IP address group left by 32 bits, and adding the 32-bit decimal address with the other 32-bit decimal address to obtain a 64-bit decimal integer address, thereby obtaining an integer address set.
Optionally, in an embodiment, the restoring module is configured to perform a binary restoration on each of the differential compressed routing configuration data in the differential compressed routing configuration data set to obtain a corresponding 64-bit decimal integer address; decomposing the 64-bit decimal integer address corresponding to each differential compression route configuration data into two 32-bit decimal integer addresses; and respectively restoring the two 32-bit decimal integer addresses corresponding to each differential compressed routing configuration data to corresponding IPv4 addresses to obtain a differential routing configuration data set.
Optionally, in an embodiment, the IP address group includes an IPv6 address group, and the compression module is configured to convert a high 64-bit portion of each IPv6 address of the IPv6 address group in the current routing configuration data set to a 64-bit decimal integer address, and convert a low 64-bit portion of each IPv6 address of the IP address group in the current routing configuration data set to a 64-bit decimal integer address, to obtain the integer address set.
Optionally, in an embodiment, the restoring module is configured to perform a binary restoration on each of the differential compressed routing configuration data in the differential compressed routing configuration data set to obtain four 64-bit decimal integer addresses; and restoring the 64-bit decimal integer address with the same source into an IPv6 address to obtain a differential routing configuration data set.
Optionally, in an embodiment, the compression module is configured to divide each integer address in the integer address set by taking the binary number of the target system as a divisor until the quotient is 0; and reversely mapping the remainder of each integer address in the integer address set in the division operation process to characters in a preset character set to obtain first compressed route configuration data.
Optionally, in an embodiment, the compression module is further configured to determine a desired compression rate, and determine the target system according to the desired compression rate.
Optionally, in an embodiment, the route reconciliation device provided by the application further includes an alarm module configured to output alarm information according to the differential route data set, where the alarm information is used to indicate that the current route configuration data set is abnormal.
Optionally, in an embodiment, the route accounting device further includes a repair module, configured to repair the current route configuration data set according to the differential route configuration data set in response to a configuration repair operation for the alarm information input.
In a third aspect, the present application provides an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor is configured to execute the computer program in the memory, to implement steps in the routing reconciliation method provided by the present application.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program adapted to be run by a processor to implement the steps in the route checking method provided by the present application.
According to the application, the first compressed route configuration data set is obtained by compressing the current route configuration data set according to the same character compression mode, the second compressed route configuration data set is obtained by compressing the expected route configuration data set, so that the character number of the route configuration data can be reduced, compared with the original current route configuration data set and the expected route configuration data set, the sorting of the first compressed route configuration data set and the second compressed route configuration data set can be completed in a shorter time, the first ordered compressed route configuration data set and the second ordered compressed route configuration data set are obtained, and similarly, the comparison of the first ordered compressed route configuration data set and the second ordered compressed route configuration data set can be completed in a shorter time, the differential route configuration data set is obtained by decompressing the differential route configuration data set, and compared with the direct sorting of the current route configuration data set and the expected route configuration data set, the sorting comparison of the first ordered route configuration data set and the second ordered route configuration data set can be completed, the account configuration operation efficiency can be effectively reduced, the time of the order configuration operation can be shortened, and the time of the expected route configuration can be shortened, and the cost is shortened.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1a is a schematic diagram of a scenario of a route reconciliation system provided by an embodiment of the application;
fig. 1b is a schematic flow chart of a route reconciliation method according to an embodiment of the disclosure;
FIG. 1c is a diagram of an exemplary alert interface shown in an embodiment of the present application;
FIG. 1d is another exemplary diagram of a differential routing configuration data presentation interface presented in an embodiment of the present application;
fig. 2 is another flow chart of a route reconciliation method provided by an embodiment of the application;
fig. 3 is a schematic structural diagram of a route checking device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
It should be noted that the principles of the present application are illustrated as implemented in a suitable computing environment. The following description is based on illustrative embodiments of the application and should not be taken as limiting other embodiments of the application not described in detail herein.
In the following description of the present application reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is to be understood that "some embodiments" can be the same subset or a different subset of all possible embodiments and can be combined with each other without conflict.
In the following description of the present application, the terms "first", "second", "third" and "third" are merely used to distinguish similar objects from each other, and do not represent a particular ordering of the objects, it being understood that the "first", "second", "third" may be interchanged with a particular order or sequence, as permitted, to enable embodiments of the present application described herein to be practiced otherwise than as illustrated or described herein.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the application only and is not intended to be limiting of the application.
In order to be able to improve the efficiency of route checking, embodiments of the present application provide a route checking method, a route checking device, an electronic apparatus, a computer-readable storage medium, and a computer program product. The route checking method may be executed by the route checking device or by an electronic apparatus integrated with the route checking device.
The routing reconciliation scheme provided by the application can be applied to a bottom network configuration reconciliation system of network related products, such as private networks, cloud networking, load balancing and the like in a cloud network, or routers, switch configuration reconciliation and the like in a traditional physical network. Taking a router applied to a traditional physical network as an example, the router accounting scheme provided by the application can ensure the normal forwarding of data among devices in the network connected by the router, wherein the devices in the network can comprise a server and a terminal, the server can be an independent physical server, can be a server cluster or a distributed system formed by a plurality of physical servers, and can also be a cloud server for providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, big data, artificial intelligent platforms and the like. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc.
Cloud technology (Cloud technology) is a generic term of network technology, information technology, integration technology, management platform technology, application technology and the like based on Cloud computing business model application, and can form a resource pool, so that the Cloud computing business model application system is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
Referring to fig. 1a, the present application further provides a route reconciliation system, as shown in fig. 1a, where the route reconciliation system includes an electronic device 100, and the route reconciliation device provided by the present application is integrated in the electronic device 100. For example, when the route checking device operates, responding to the trigger of the route checking, compressing the current route configuration data set according to the same character compression mode to obtain a first compressed route configuration data set, and compressing the expected route configuration data set to obtain a second compressed route configuration data set; according to the character sequence of the preset character set, sequencing the first compressed route configuration data set to obtain a first ordered compressed route configuration data set, and sequencing the second compressed route configuration data set to obtain a second ordered compressed route configuration data set; comparing the first ordered compressed route configuration data set with the second ordered compressed route configuration data set to obtain a differential compressed route configuration data set of the first ordered compressed route configuration data set and the second ordered compressed route configuration data set; decompressing the differential compressed routing configuration data set to obtain a differential routing configuration data set of the current routing configuration data set and the expected routing configuration data set.
The electronic device 100 may be any device configured with a processor, such as a router device itself, a server device, a terminal device, or the like.
In addition, as shown in fig. 1a, the route checking system may further include a memory 200 for storing relevant data in the route checking process, for example, the electronic device 100 stores a desired route configuration data set for checking, a first compressed route configuration data set and a second compressed route configuration data set obtained by compression, and a differential compressed route configuration data set obtained by comparison, differential route configuration data obtained by decompression of the differential compressed route configuration data set, and the like in the memory 200.
It should be noted that, the schematic view of the scenario of the route checking system shown in fig. 1a is only an example, and the route checking system and the scenario described in the embodiments of the present application are for more clearly describing the technical solution of the embodiments of the present application, and do not constitute a limitation on the technical solution provided by the embodiments of the present application, and those skilled in the art can know that, with the evolution of the route checking system and the appearance of a new service scenario, the technical solution provided by the embodiments of the present application is equally applicable to similar technical problems.
The following will describe in detail. The numbers of the following examples are not intended to limit the preferred order of the examples.
Referring to fig. 1b, fig. 1b is a flow chart of a route checking method provided by an embodiment of the present application, in the following embodiment, an electronic device executes the route checking method with an identity of a client, as shown in fig. 1b, and the flow chart of the route checking method provided by the present application is as follows:
at 110, the current route configuration data set is compressed to obtain a first compressed route configuration data set and the desired route configuration data set is compressed to obtain a second compressed route configuration data set in the same character compression manner.
It should be noted that, character compression refers to compressing a character string by using a certain compression strategy, so as to reduce the number of characters in the character string, and can be divided into lossless compression and lossy compression. The main idea of the lossless compression is to compress the character string without loss by using the statistical redundancy of the data, so that the original data can be restored without any distortion, and common lossless character compression algorithms such as LZW compression algorithm, huffman compression algorithm and the like; the lossy compression refers to that the data is saved after being reduced, partial characters are lost, and common lossy character compression algorithms such as ZLIB compression algorithm, LZ0 compression algorithm and the like are adopted. In this embodiment, a suitable lossless character compression algorithm may be selected by those skilled in the art according to actual needs for compressing the routing configuration data.
In this embodiment, the electronic device for executing the route checking method may determine, in response to a trigger of route checking, a target routing device that needs to perform route checking. It is understood that the target routing device may be the electronic device itself, or may be a routing device other than the electronic device.
After determining the target routing device that needs to perform route checking, the electronic device first obtains, from the target routing device, a route configuration data set that is currently actually used for the routing implementation, denoted as a current route configuration data set, and obtains, from the target routing device, a route configuration data set that is expected to be used for the routing implementation, denoted as a desired route configuration data set. The desired route configuration data may be colloquially understood as a route configuration data set that the target routing device should use for route implementation, and may be obtained from a control device of the target routing device, for example, may receive a desired route configuration data set for the target routing device that is pushed by the control device of the target routing device; the control device may also send a route data acquisition request to the control device of the target routing device, where the route data acquisition request is used to instruct the control device to return a desired route configuration data set of the target routing device, and correspondingly receive the desired route configuration data set returned by the control device for the target routing device.
The routing configuration data includes an IP address group formed by two IP addresses, and typically, the two IP addresses are a destination IP address and a next hop IP address, where the destination IP address refers to an IP address of a device to which an IP packet is expected to be sent, and the next hop IP address refers to an IP address of a next routing device through which the IP packet needs to pass when being sent to the destination IP address. In other embodiments, the IP address group may also be composed of other types of IP addresses, which are not particularly limited herein. It should be noted that the IP address is a unified address format provided by the IP protocol, and allocates a logical address to each network and each host on the internet, so as to mask the difference of physical addresses. It should be noted that an IP address refers to an internet protocol address (which is also translated into an internet protocol address), which is a unified address format provided by the internet protocol, and assigns a logical address to each network and each host on the internet as a feature, so as to mask the difference of physical addresses.
As described above, after the current route configuration data set and the desired route configuration data set are obtained, the electronic device compresses the current route configuration data set and the desired route configuration data set according to the same character compression manner, marks the compressed current route configuration data set as a first compressed route configuration data set, and marks the compressed desired route configuration data set as a second compressed route configuration data set. Thus, characters of the routing configuration data are reduced by character-compressing the current routing configuration data set and the desired routing configuration data.
Optionally, in an embodiment, compressing the current route configuration data set to obtain the first compressed route configuration data set includes:
converting the IP address group in the current route configuration data set into an integer address to obtain an integer address set;
and carrying out binary conversion on the integer addresses in the integer address set according to the target binary system to obtain a first compressed route configuration data set, wherein the target binary system is larger than the current binary system of the integer addresses in the integer address set.
In this embodiment, a character compression method different from the prior art is provided, and a current routing configuration data set is taken as an example for explanation.
And converting each IP address group into an integer form according to a reversible conversion mode for each piece of route configuration data in the current route configuration data set, namely each IP address group, marking the integer form as an integer address, and correspondingly converting the current route configuration data set into an integer address set.
As described above, after the IP address group in the current routing configuration data set is converted into the integer address and the integer address set is obtained correspondingly, the integer address set is further converted according to the target system, that is, each integer address in the integer address set is converted from the current system into the target system, and the target system is greater than the current system of the integer address, so that the character reduction is realized, and the purpose of compressing characters is achieved.
The method takes the constraint that the total character number of the integer address corresponding to an IP address group after the binary conversion is smaller than that of the IP address group, and can determine the target binary according to actual needs by a person skilled in the art.
IPv4, also known as the fourth version of the internet protocol, is a fourth revision of the development process of the internet protocol and is also a widely deployed version of the first of this protocol. IPv4 is the core of the internet and is also the most widely used version of the internet protocol, the latter version of which is IPv6. The IPv4 address is expressed as (a.b.c.d) in the form of a dot decimal, wherein a, b, c, d is a decimal integer between 0 and 255. Optionally, in an embodiment, for an IPv4 address group formed by IPv4 addresses, converting the IP address group in the current routing configuration data set into an integer address to obtain an integer address set, including:
and converting each IPv4 address group in the current route configuration data set into a 64-bit integer address to obtain an integer address set.
It will be appreciated that IPv4 addresses use 32-bit addresses, typically expressed in the form of dot-decimal, i.e. four bytes are separated by decimal and the middle is separated by dots. In this embodiment, for each IPv4 address set in the current routing configuration data set, it is converted into a 64-bit integer address, that is, two 32-bit decimal addresses that make up the IPv4 address set are converted into a 64-bit integer address, thereby converting the current routing configuration data set into an integer address set.
Optionally, in an embodiment, converting each IPv4 address set in the current routing configuration data set into a 64-bit integer address to obtain an integer address set includes:
converting two IPv4 addresses in each IPv4 address group into corresponding 32-bit decimal integer addresses respectively;
after a 32-bit decimal address obtained by converting each IP address group is shifted left by 32 bits, the 32-bit decimal address is added with another 32-bit decimal address to form a 64-bit decimal integer address, and an integer address set is obtained.
Wherein the point decimal IPv4 address (a.b.c.d) can be converted into a 32-bit decimal integer address according to the following formula:
X=(a×(256^3))+(b×(256^2))+(c×(256^1))+d;
after converting two IPv4 addresses in each IPv4 address group into corresponding 32-bit decimal integer addresses according to the above formula, after shifting one 32-bit decimal address obtained by converting each IP address group to the left by 32 bits, adding the 32-bit decimal address to another 32-bit decimal address to form a 64-bit decimal integer address, which can be expressed as:
Y=X 1 <<32+X 2
wherein X is 1 And X 2 Respectively representing 32-bit decimal integer addresses obtained by converting two IPv4 addresses in an IPv4 address group, and Y represents 64-bit decimal integer addresses.
It should be noted that, for different IPv4 address groups, a left shift operation should be performed on the 32-bit decimal address obtained by converting the IPv4 address at the same location, for example, for an IPv4 address group consisting of the destination IPv4 address and the next-hop IPv4 address, for each IPv4 address group, the 32-bit decimal integer address obtained by converting the destination IPv4 address is left shifted by 32 bits, and then added to the 32-bit decimal integer address obtained by converting the next-hop IPv4 address to form a 64-bit decimal integer address.
For example, assuming that there is an IPv4 address group consisting of the destination IPv4 address (1.1.1.1) and the next-hop IPv4 address (2.2.2.2), the destination IPv4 address (1.1.1.1) will be converted into a 32-bit decimal integer address 16843009, the next-hop IPv4 address (2.2.2.2) will be converted into a 32-bit decimal integer address 33686018, and the 32-bit decimal integer address 16843009 is left shifted by 32 bits and added to the 32-bit decimal integer address 33686018 to obtain a 64-bit decimal integer address 72340172854919682 according to the above formula.
In this way, for each piece of routing configuration data (IPv 4 address group), it will be converted into 1 64-bit decimal integer addresses, and these 64-bit decimal integer addresses converted by the IPv4 address group constitute an integer address set.
It should be noted that, IPv6 is an internet protocol designed by the internet engineering task force to replace IPv4, and its address number is called to be able to encode an address for each sand worldwide, so that IPv6 is widely used. The IPv6 address is represented in hexadecimal form as nnnn: nnnn: nnnn: nnnn: nnnn: nnnn: nnnn, where each n is any value between 0 to 9 and a to F, and optionally, in an embodiment, for an IPv6 address group formed by two IPv6 addresses, converting the IP address group in the current routing configuration data set into an integer address, to obtain an integer address set, including:
The high 64-bit part of each IPv6 address of the IPv6 address group in the current routing configuration data set is converted into a 64-bit decimal integer address, and the low 64-bit part of each IPv6 address of the IP address group in the current routing configuration data set is converted into a 64-bit decimal integer address, so that an integer address set is obtained.
It should be noted that, in this embodiment, for each piece of route configuration data in the current route configuration data set, that is, each IPv6 address group, the upper 64-bit part (network bit) of the IPv6 address is converted from the top-level hexadecimal to the decimal, to obtain a 64-bit decimal integer address (corresponding to the network bit), and the lower 64-bit part (host bit) is converted from the top-level hexadecimal to the decimal, to obtain a 64-bit decimal integer address (corresponding to the host bit).
In this way, for each piece of routing configuration data (IPv 6 address group), four 64-bit decimal integer addresses are to be converted, and these 64-bit decimal integer addresses converted by the IPv6 address group constitute an integer address set.
Optionally, in an embodiment, performing, according to a target system, binary conversion on an integer address in the integer address set to obtain a first compressed routing configuration data set, where the target system is greater than a current system of the integer address in the integer address set, and includes:
dividing each integer address in the integer address set by taking the binary number of the target system as a divisor until the quotient is 0;
and reversely mapping the remainder of each integer address in the integer address set in the division operation process to characters in a preset character set to obtain a first compressed route configuration data set.
For each integer address in the integer address set, dividing the integer address by taking the target system number as a divisor to obtain a quotient and a remainder, taking the quotient as a new divisor, continuing dividing by taking the target system number as the divisor to obtain a new quotient and a remainder, and the like until the quotient is 0; for each integer address in the integer address set, reversely concealing all remainder in the corresponding division operation process to characters in a preset character set to obtain a character string, wherein the character string is compressed route configuration data of corresponding route configuration data.
As can be understood from the relevant description in the above embodiments, for the IPv4 address set (routing configuration data), the IPv4 address set (routing configuration data) is converted into a 64-bit decimal integer address, and finally is converted into a string, which is compressed routing configuration data obtained by compressing the IPv4 address set (routing configuration data); for the IPv6 address set, the four 64-bit decimal integer addresses are converted into four corresponding four character strings, and the four character strings are compressed routing configuration data obtained by compressing the IPv6 address set (routing configuration data).
Optionally, in an embodiment, reversely mapping a remainder of each integer address in the integer address set in the division operation process to a character in a preset character set to obtain a first compressed routing configuration data set, including:
and reversely mapping the remainder of each integer address in the integer address set in the division operation process to visible characters in a preset character set to obtain a first compressed route configuration data set.
In order to improve the readability of the compressed routing configuration data, for a preset character set, visible characters of the target number are screened out in advance for subsequent mapping.
For example, assuming that the predetermined character set is determined as an ASCII character set, the target system is determined as 90, and accordingly 90 visible characters "01234556789 ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijnonoqrstuvwxyz". | @ # $ ++ # - += { [ ] } ], are selected for character mapping, respectively corresponding to 0-89. Assuming that there is a routing configuration data IPv4 address set (1.1.1.1,2.2.2.2), the IPv4 address set is converted into a 64-bit decimal integer address 72340172854919682, and the 64-bit decimal integer address 72340172854919682 is converted into 90-bit decimal, so as to obtain compressed routing configuration data G) e ((dYag, as compared with the routing configuration data before compression, 15 characters are total, and compressed routing configuration data G) e ((dYag has only 9 characters, and 6 characters are reduced).
Taking the routing configuration data as the IPv4 address group as an example, according to the above compression method provided in the present embodiment, the IPv4 address group (1.1.1.1,2.2.2.2) of 15 characters can be compressed to G) e of 9 characters in the worst case ((dYag), 6 characters can be reduced to obtain a compression rate of 40%, and preferably the IPv4 address group (100.100.100.100, 101.101.101.101) of 31 characters is compressed to IyjT &8u|k &of10 characters, which can reduce 21 characters to obtain a compression rate of 67.7%, compared with the conventional character compression method, the compression method provided in the present embodiment can obtain a compression rate of 40% -67.7%.
In other embodiments, when the converted integer address adopts decimal system, 128 system and 256 system and other higher system numbers can be adopted for carrying out system conversion, so as to further improve the compression rate.
Optionally, in an embodiment, before performing the binary conversion on the integer address in the integer address set according to the target binary system to obtain the first compressed routing configuration data set, the method further includes:
and determining the expected compression rate, and determining a target system according to the expected compression rate.
It should be noted that the compression method provided in the above embodiment mainly performs compression operation in the binary conversion, in other words, the size of the selected target binary, that is, the size of the compression ratio is determined to some extent. Correspondingly, in this embodiment, the correspondence between the conversion system and the compression ratio is calibrated in advance.
Before the binary conversion, the expected compression rate is determined, for example, the expected compression rate can be determined according to the input compression rate configuration operation, and then the conversion binary corresponding to the expected compression rate is determined as the target binary according to the corresponding relation between the conversion binary calibrated in advance and the compression rate.
It should be noted that, for how to compress the desired route configuration data set to obtain the second compressed route configuration data set, the manner of compressing the current route configuration data set to obtain the first compressed route configuration data set in the above embodiment is correspondingly implemented, and will not be described herein.
At 120, the first compressed routing configuration dataset is ordered according to the character order of the preset character set to obtain a first ordered compressed routing configuration dataset, and the second compressed routing configuration dataset is ordered to obtain a second ordered compressed routing configuration dataset.
One character is basic information of a unit font, font-like unit or symbol, namely, the character is a generic name of various characters and symbols, and one character can be a Chinese character, an English letter, an Arabic number, a punctuation mark, a graphic symbol or a control symbol, and the like. It should be noted that the information stored in the computer is represented by binary numbers, and the characters displayed on the screen are the result of binary number conversion. The characters are stored in the computer according to a certain rule, which is called encoding, whereas the binary numbers stored in the computer are displayed by analysis according to a certain rule, which is called decoding. Character encoding is a set of rules for correspondence between characters in natural language and binary numbers. The character set, also called coding table, is a set of all characters supported by the system, including various nations characters, punctuation marks, graphic symbols, numbers, etc. The different character sets contain different numbers of characters, different contained characters and different coding modes of the characters. For example, the GB2312 character set is a simplified chinese character set of national standard of china, which records simplified chinese characters (6763) and general symbols, serial numbers, latin letters, japanese kana, greek letters, russian letters, pinyin symbols, chinese phonetic alphabet, 7445 graphic characters in total, whereas the ASCII (American Standard Code for Information Interchange, american standard code for information exchange) character set records only 128 characters, mainly including english letters, arabic numbers, and some simple control characters. In addition, other commonly used character sets are the GBK character set, the GB18030 character set, the Big5 character set, the Unicode character set, and the like. It should be noted that, for each character in the character set, there are two attributes, one is the position of the character in the belonging character set, which may be called a character number, or a code point; the other is the data representation of the character in the computer, i.e. the memory coding.
In this embodiment, after the compression of the current route configuration data set and the desired route configuration data set is completed, the first route configuration data set and the second route configuration data set are further ordered according to the character sequence of the preset character set, the ordered first route configuration data set is recorded as a first ordered route configuration data set, and the ordered second route configuration data set is recorded as a second ordered route configuration data set.
The preset character set may be selected by a person skilled in the art according to actual needs, and the character sequence is not specifically limited herein, that is, the sequence of different characters in the preset character set. In addition, the present embodiment does not limit what sort algorithm is used, including but not limited to, a sort algorithm such as a fast sort or a merge sort.
By way of example, in this embodiment, the IP address is considered to be composed of a numeric character, an english alphabetic character, and a punctuation character, and the use requirement can be satisfied by selecting an ASCII character set with relatively high compatibility as the preset character set.
And comparing the first ordered compressed routing configuration data set with the second ordered compressed routing configuration data set to obtain a differential compressed routing configuration data set of the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set at 130.
As described above, after the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set are obtained by sorting, the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set are further compared, and a differential compressed routing configuration data set composed of differential compressed routing configuration data between the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set is obtained. The differential compressed route configuration data set comprises a first differential compressed route configuration data set and a second differential compressed route configuration data set, wherein the compressed route configuration data in the first differential compressed route configuration data set is compressed route configuration data which exists in the first ordered compressed route configuration data set and does not exist in the second ordered compressed route configuration data set, and the compressed route configuration data in the second differential compressed route configuration data set is compressed route configuration data which does not exist in the first ordered compressed route configuration data set and does exist in the second ordered compressed route configuration data set.
For example, the first differential compressed routing configuration data set and the second differential compressed routing configuration data set of the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set may be obtained by comparison in a dual pointer traversal comparison. Wherein pointer 1 corresponds to a first ordered set of compressed routing configuration data and pointer 2 corresponds to a second ordered set of compressed routing configuration data:
a. If the character strings of the compressed route configuration data pointed by the current two pointers are the same, indicating that the compressed route configuration data exist in both the first ordered compressed route configuration data set and the second ordered compressed route configuration data set, and moving the two pointers backwards at the same time;
b. if the compressed route configuration data in the first ordered compressed route configuration data set pointed by the pointer 1 is smaller than the compressed route configuration data in the second ordered compressed route configuration data set pointed by the pointer 2, indicating that the compressed route configuration data in the first ordered compressed route configuration data set pointed by the pointer 1 does not exist in the second ordered compressed route configuration data set, adding the compressed route configuration data in the first ordered compressed route configuration data set to the first differential compressed route configuration data set, and then moving the pointer 1 backwards;
c. if the compressed routing configuration data in the first ordered compressed routing configuration data set pointed to by pointer 1 is larger than the compressed routing configuration data in the second ordered compressed routing configuration data set pointed to by pointer 2, pointer 2 is moved backward.
And adding the remaining compressed route configuration data in the first ordered compressed route configuration data set to the first differential compressed route configuration data set until the first ordered compressed route configuration data set and the second ordered compressed route configuration data set are traversed by using the double pointers.
Furthermore, the ordered compressed routing configuration data sets pointed to by pointer 1 and pointer 2 are exchanged, i.e. pointer 1 corresponds to the second ordered compressed routing configuration data set and pointer 2 corresponds to the first ordered compressed routing configuration data set:
d. if the character strings of the compressed route configuration data pointed by the current two pointers are the same, indicating that the compressed route configuration data exist in both the first ordered compressed route configuration data set and the second ordered compressed route configuration data set, and moving the two pointers backwards at the same time;
e. if the compressed route configuration data in the second ordered compressed route configuration data set pointed by the pointer 1 is smaller than the compressed route configuration data in the first ordered compressed route configuration data set pointed by the pointer 2, indicating that the compressed route configuration data in the second ordered compressed route configuration data set pointed by the pointer 1 does not exist in the first ordered compressed route configuration data set, adding the compressed route configuration data in the second ordered compressed route configuration data set to the second differential compressed route configuration data set, and then moving the pointer 1 backwards;
f. if the compressed routing configuration data in the second ordered compressed routing configuration data set pointed to by pointer 1 is larger than the compressed routing configuration data in the first ordered compressed routing configuration data set pointed to by pointer 2, pointer 2 is moved backward.
And adding the remaining compressed route configuration data in the second ordered compressed route configuration data set to the second differential compressed route configuration data set until the first ordered compressed route configuration data set and the second ordered compressed route configuration data set are traversed by using the double pointers.
At 140, the differential compressed routing configuration dataset is decompressed to obtain a differential routing configuration dataset of the current routing configuration dataset and the desired routing configuration dataset.
In this embodiment, according to the reverse operation of character compression, the differential compressed route configuration data set is decompressed, so as to obtain the differential route configuration data set of the current route configuration data set and the desired route configuration data set.
Decompressing the first differential compressed route configuration data set to obtain a current route configuration data set and a first differential route configuration data set of an expected route configuration data set, wherein the route configuration data in the first differential route configuration data set is route configuration data which exists in the current route configuration data set but does not exist in the expected route configuration data set; decompressing the second differential compressed route configuration data set to obtain a current route configuration data set and a second differential route configuration data set of the expected route configuration data set, wherein the route configuration data in the second differential route configuration data set is the route configuration data which does not exist in the current route configuration data set but exists in the expected route configuration data set.
Optionally, in an embodiment, decompressing the differential compressed routing configuration data set for an IPv4 address group consisting of two IPv4 addresses to obtain a differential routing configuration data set of the current routing configuration data set and the desired routing configuration data set includes:
carrying out binary restoration on each difference compression route configuration data in the difference compression route configuration data set to obtain a corresponding 64-bit decimal integer address;
decomposing the 64-bit decimal integer address corresponding to each differential compression routing configuration data into two 32-bit decimal integer addresses;
and respectively restoring the two 32-bit decimal integer addresses corresponding to each differential compressed routing configuration data to corresponding IPv4 addresses to obtain a differential routing configuration data set.
As described above, decompression is the reverse operation of character compression, and correspondingly, when decompressing the differential compression route configuration data set, performing advanced system restoration on each differential compression route configuration data in the differential compression route configuration data set to obtain a 64-bit decimal integer address; for the 64-bit decimal integer address, the two 32-bit decimal integers are decomposed by shifting, expressed as:
X 1 =Y&0xFFFFFFFF00000000)>>32;
X 2 =Y&0x00000000FFFFFFFF;
Further, two 32-bit decimal integers are respectively restored to corresponding point decimal IPv4 addresses (a.b.c.d), so that corresponding IPv4 address groups are obtained, which can be expressed as:
a=(X>>24)&0xFF;
b=(X>>16)&0xFF;
c=(X>>8)&0xFF;
d=X&0xFF;
wherein X represents X 1 、X 2
Thus, the IPv4 address group is obtained by decompressing the differential compressed route configuration data, namely the differential route configuration data set forming the current route configuration data set and the expected route configuration data set.
Optionally, in an embodiment, decompressing the differential compressed routing configuration data set for an IPv6 address group consisting of two IPv6 addresses to obtain a differential routing configuration data set of the current routing configuration data set and the desired routing configuration data set includes:
carrying out binary restoration on each difference compression route configuration data in the difference compression route configuration data set to obtain four 64-bit decimal integer addresses;
and restoring the 64-bit decimal integer address with the same source into an IPv6 address to obtain a differential routing configuration data set.
Similarly, when the route configuration data is an IPv6 address group, decompression is realized according to the reverse operation of the compressed IPv6 address group. And performing advanced system restoration on each differential compressed routing configuration data in the differential compressed routing configuration data set to obtain four 64-bit decimal integer addresses. Every two 64-bit decimal integer addresses with the same source are converted into a hexadecimal system, and the hexadecimal system is used as a high 64-bit part and a low 64-bit part of an IPv6 address respectively to correspondingly obtain two IPv6 addresses, so that an IPv6 address group is formed.
Thus, the IPv6 address group is obtained by decompressing the differential compressed route configuration data, namely the differential route configuration data set forming the current route configuration data set and the expected route configuration data set.
Optionally, in an embodiment, after decompressing the differential compressed routing configuration data set to obtain the differential routing configuration data set of the current routing configuration data set and the desired routing configuration data set, the method further includes:
and outputting alarm information according to the differential routing data set, wherein the alarm information is used for indicating that the current routing configuration data set is abnormal.
It should be noted that, the information content and the output form of the alarm information in this embodiment are not particularly limited, and include, but are not limited to, text, image, sound and combinations of at least two of them.
For example, referring to FIG. 1c, an alert interface is illustrated that includes alert information 501, content "whether the target routing device is configured abnormally, automatically healed", and further includes a view control 502 (provided with text prompt "view abnormal configuration"), a confirm control 503 (provided with text prompt "yes"), and a reject control 504 (provided with text prompt "no"). Wherein a view operation for the differential routing configuration dataset is generated when view control 502 is triggered, a configuration repair operation is generated when confirm control 503 is triggered, and a stop display operation for the alert interface is generated when reject control 504 is triggered.
And prompting operation and maintenance personnel of the target routing equipment by outputting alarm information, and guiding the operation and maintenance personnel to solve the configuration abnormality of the target routing equipment as soon as possible.
Optionally, in an embodiment, after outputting the alarm information according to the differential routing dataset, the method further includes:
and responding to the trigger of the check control, and displaying the differential route configuration data according to the differential route data set.
In this embodiment, the differential routing data set includes first differential routing data and second differential routing configuration data, where the routing configuration data in the first differential routing configuration data set is routing configuration data that exists in the current routing configuration data set but does not exist in the expected routing configuration data set, that is, the routing configuration data that is redundant in the current routing configuration data set than the expected routing configuration data set; the routing configuration data in the second differential routing configuration data set is the routing configuration data which does not exist in the current routing configuration data set but exists in the expected routing configuration data set, namely the routing configuration data which is missing in the current routing configuration data set compared with the expected routing configuration data set.
When the differential routing configuration data is displayed, the classification type of the embodiment is displayed. For example, referring to fig. 1d, a differential route configuration data display interface is shown, where the display interface is divided into two areas, namely, an redundant configuration area and a missing configuration area, and when displaying, differential route configuration data in the first differential route configuration data is displayed in the redundant configuration area, and differential route configuration data in the second differential route configuration data is displayed in the missing configuration area.
Optionally, in an embodiment, after outputting the alarm information according to the differential routing dataset, the method further includes:
and responding to configuration repair operation aiming at alarm information input, and repairing the current routing configuration data set according to the differential routing configuration data set.
In this embodiment, according to the input configuration repair operation, the current route configuration data set is automatically repaired according to the differential route configuration data set, wherein according to the first differential route configuration data set, redundant route configuration data on the target route configuration device is deleted, and according to the second differential route configuration data set, the route configuration data deleted by the target route device is supplemented, so that the abnormal configuration of the target route device is automatically repaired.
According to the application, the first compressed route configuration data set is obtained by compressing the current route configuration data set according to the same character compression mode, the second compressed route configuration data set is obtained by compressing the expected route configuration data set, so that the character number of the route configuration data can be reduced, compared with the original current route configuration data set and the expected route configuration data set, the ordering of the first compressed route configuration data set and the second compressed route configuration data set can be completed in a shorter time, the first ordered compressed route configuration data set and the second ordered compressed route configuration data set are obtained, and by the same reason, the comparison of the first ordered compressed route configuration data set and the second ordered compressed route configuration data set can be completed in a shorter time, the differential route configuration data set is obtained by decompressing the differential route configuration data set, and compared with the direct comparison of the current route configuration data set and the expected route configuration data set, the account ordering operation can be effectively completed, the time of the current route configuration data set and the expected route configuration data set can be shortened, and the time required for ordering the current route configuration data set can be shortened.
Referring to fig. 2, fig. 2 is another flow chart of the route checking method provided by the present application, in the following embodiment, taking an electronic device as an execution body, route configuration data is an IPv4 address group as an example, and the flow chart of the route checking method provided by the present application may further be as follows:
at 210, the electronic device converts each point in the current routing configuration data set into a 64-bit decimal integer address in a decimal IPv4 address set, resulting in an integer address set.
In this embodiment, the electronic device for executing the route checking method may determine, in response to a trigger of route checking, a target routing device that needs to perform route checking. It is understood that the target routing device may be the electronic device itself, or may be a routing device other than the electronic device.
After determining the target routing device that needs to perform route checking, the electronic device first obtains, from the target routing device, a route configuration data set that is currently actually used for the routing implementation, denoted as a current route configuration data set, and obtains, from the target routing device, a route configuration data set that is expected to be used for the routing implementation, denoted as a desired route configuration data set. The routing configuration data comprises an IPv4 address group which is a target IPv4 address and a next-hop IPv4 address respectively, wherein the target IPv4 address refers to an IPv4 address of equipment which an IP data packet expects to be sent to, and the next-hop IPv4 address refers to an IPv4 address of next routing equipment which the IP data packet needs to pass through when the IP data packet arrives at the target IPv4 address.
The electronic device obtains the current route configuration data set and the expected route configuration data set, and compresses the current route configuration data set and the expected route configuration data set according to the same character compression mode, and the current route configuration data set is taken as an example for illustration.
It will be appreciated that IPv4 addresses use 32-bit addresses, expressed in the form of dot decimal, i.e. four bytes are separated by decimal and the middle is separated by dots. In this embodiment, for each IPv4 address set in the current routing configuration data set, it is converted into a 64-bit decimal integer address, that is, two 32-bit decimal addresses that make up the IPv4 address set are converted into a 64-bit decimal integer address, thereby converting the current routing configuration data set into an integer address set.
The electronic equipment divides two points in each IPv4 address group into decimal IPv4 addresses, converts the decimal IPv4 addresses into corresponding 32-bit decimal integer addresses respectively, and adds one 32-bit decimal address obtained by converting each IP address group into one 64-bit decimal integer address after shifting the 32-bit decimal address leftwards.
For example, assume that there is an IPv4 address set consisting of a destination IPv4 address (1.1.1.1) and a next-hop IPv4 address (2.2.2.2), wherein the destination IPv4 address (1.1.1.1) is to be converted into a 32-bit decimal integer address 16843009, the next-hop IPv4 address (2.2.2.2) is to be converted into a 32-bit decimal integer address 33686018, and the 32-bit decimal integer address 16843009 is left-shifted by 32 bits and added to the 32-bit decimal integer address 33686018, resulting in a 64-bit decimal integer address 72340172854919682.
In this way, for each piece of routing configuration data (IPv 4 address group), it will be converted into 1 64-bit decimal integer addresses, and these 64-bit decimal integer addresses converted by the IPv4 address group constitute an integer address set.
At 220, the electronic device divides each integer address in the set of integer addresses by a divisor that is a target binary number, until the quotient is 0, the target binary number being greater than the current binary number of the integer addresses in the set of integer addresses.
At 230, the electronic device inversely maps the remainder of each integer address in the set of integer addresses during the division operation to visible characters in the set of ACSII characters, resulting in a first compressed routing configuration dataset.
For each integer address in the integer address set, the electronic device performs division operation by taking the binary number of the target system as a divisor, taking the integer address as a divisor to obtain a quotient and a remainder, taking the quotient as a new divisor, continuing to perform division operation by taking the binary number of the target system as a divisor to obtain a new quotient and a remainder, and the like until the quotient is 0; for each integer address in the integer address set, reversely concealing all remainder in the corresponding division operation process to characters in the ASCII character set to obtain a character string, wherein the character string is compressed route configuration data of route configuration data corresponding to the integer address. In this way, each integer address in the set of integer addresses is converted into compressed routing configuration data, whereby a first set of compressed routing configuration data corresponding to the current set of routing configuration data is formed from the compressed routing configuration data.
It should be noted that the ASCII (American Standard Code for Information Interchange ) character set has 128 characters recorded, mainly including english letters, arabic numerals, and some simple control characters, of which 33 characters cannot be displayed (most of the control characters are obsolete), and the other 95 characters are displayable.
For example, assume that the target bin is determined to be 90, and accordingly 90 visible characters "0123456789 abcdefghijklmnopqruvwxyzabcdefghjlmnonqrstuvwxyz. Assuming that there is a routing configuration data IPv4 address set (1.1.1.1,2.2.2.2), the IPv4 address set is converted into a 64-bit decimal integer address 72340172854919682, and the 64-bit decimal integer address 72340172854919682 is converted into 90-bit decimal, so as to obtain compressed routing configuration data G) e ((dYag, as compared with the routing configuration data before compression, 15 characters are total, and compressed routing configuration data G) e ((dYag has only 9 characters, and 6 characters are reduced).
At 240, the electronic device compresses the desired routing configuration data set to obtain a second compressed routing configuration data set in accordance with the same character compression of the current routing configuration data set.
In this embodiment, the electronic device compresses the desired route configuration data set to obtain the second compressed route configuration data according to the same character compression manner for compressing the current route configuration data set, and specific reference is made to the related description in the above embodiment, which is not repeated here.
At 250, the electronic device sorts the first compressed routing configuration dataset according to the character order of the ASCII character set to obtain a first ordered compressed routing configuration dataset, and sorts the second compressed routing configuration dataset to obtain a second ordered compressed routing configuration dataset.
In this embodiment, after the compression of the current route configuration data set and the desired route configuration data set is completed, the electronic device further sorts the first compressed route configuration data set and the second compressed route configuration data set according to the character sequence of the ASCII character set, respectively, and the sorted first compressed route configuration data set is denoted as a first ordered compressed route configuration data set, and the sorted second compressed route configuration data set is denoted as a second ordered compressed route configuration data set. Wherein, the method is not limited to the sort algorithm, including but not limited to quick sort or merge sort.
At 260, the electronic device compares the first ordered set of compressed routing configuration data with the second ordered set of compressed routing configuration data to obtain a differential set of compressed routing configuration data for the first ordered set of compressed routing configuration data and the second ordered set of compressed routing configuration data.
As described above, after the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set are obtained by sorting, the electronic device further compares the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set to obtain a differential compressed routing configuration data set composed of differential compressed routing configuration data between the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set. The differential compressed route configuration data set comprises a first differential compressed route configuration data set and a second differential compressed route configuration data set, wherein the compressed route configuration data in the first differential compressed route configuration data set is compressed route configuration data which exists in the first ordered compressed route configuration data set and does not exist in the second ordered compressed route configuration data set, and the compressed route configuration data in the second differential compressed route configuration data set is compressed route configuration data which does not exist in the first ordered compressed route configuration data set and does exist in the second ordered compressed route configuration data set.
The electronic device obtains a first differential compression route configuration data set and a second differential compression route configuration data set of the first ordered compression route configuration data set and the second ordered compression route configuration data set by means of double pointer traversal comparison. Wherein pointer 1 corresponds to a first ordered set of compressed routing configuration data and pointer 2 corresponds to a second ordered set of compressed routing configuration data:
a. if the character strings of the compressed route configuration data pointed by the current two pointers are the same, the compressed route configuration data are shown to exist in both the first ordered compressed route configuration data set and the second ordered compressed route configuration data set, and the electronic equipment moves the two pointers backwards at the same time;
b. if the compressed route configuration data in the first ordered compressed route configuration data set pointed by the pointer 1 is smaller than the compressed route configuration data in the second ordered compressed route configuration data set pointed by the pointer 2, the compressed route configuration data in the first ordered compressed route configuration data set pointed by the pointer 1 is indicated to be absent in the second ordered compressed route configuration data set, the electronic device adds the compressed route configuration data in the first ordered compressed route configuration data set, and then moves the pointer 1 backwards;
c. If the compressed routing configuration data in the first ordered set of compressed routing configuration data pointed to by pointer 1 is greater than the compressed routing configuration data in the second ordered set of compressed routing configuration data pointed to by pointer 2, the electronic device moves pointer 2 backward.
As above, until the first ordered set of compressed route configuration data and the second ordered set of compressed route configuration data are traversed using the double pointers, the electronic device adds the remaining compressed route configuration data in the first ordered set of compressed route configuration data to the first differential set of compressed route configuration data.
Furthermore, the ordered compressed routing configuration data sets pointed to by pointer 1 and pointer 2 are exchanged, i.e. pointer 1 corresponds to the second ordered compressed routing configuration data set and pointer 2 corresponds to the first ordered compressed routing configuration data set:
d. if the character strings of the compressed route configuration data pointed by the current two pointers are the same, the compressed route configuration data are shown to exist in both the first ordered compressed route configuration data set and the second ordered compressed route configuration data set, and the electronic equipment moves the two pointers backwards at the same time;
e. if the compressed route configuration data in the second ordered compressed route configuration data set pointed by the pointer 1 is smaller than the compressed route configuration data in the first ordered compressed route configuration data set pointed by the pointer 2, the compressed route configuration data in the second ordered compressed route configuration data set pointed by the pointer 1 is not existed in the first ordered compressed route configuration data set, the electronic device adds the compressed route configuration data in the second ordered compressed route configuration data set, and then moves the pointer 1 backwards;
f. If the compressed routing configuration data in the second ordered compressed routing configuration data set pointed to by pointer 1 is larger than the compressed routing configuration data in the first ordered compressed routing configuration data set pointed to by pointer 2, the electronic device moves pointer 2 backward.
As above, until the first ordered set of compressed route configuration data and the second ordered set of compressed route configuration data are traversed using the double pointers, the electronic device adds remaining compressed route configuration data in the second ordered set of compressed route configuration data to the second differential set of compressed route configuration data.
In 270, the electronic device performs a binary restoration on each of the differential compressed routing configuration data in the differential compressed routing configuration data set to obtain a corresponding 64-bit decimal integer address.
In 280, the electronic device restores the 64-bit decimal integer address corresponding to each differential compressed routing configuration data to the corresponding point decimal IPv4 address group, and obtains a differential routing configuration data set.
It should be noted that decompression is the reverse operation of character compression, and correspondingly, when the electronic device decompresses the differential compression route configuration data set, the electronic device first makes recovery for each differential compression route configuration data in the differential compression route configuration data set to obtain a 64-bit decimal integer address; for the 64-bit decimal integer address, the two 32-bit decimal integers are decomposed by shifting, expressed as:
X 1 =Y&0xFFFFFFFF00000000)>>32;
X 2 =Y&0x00000000FFFFFFFF;
Wherein X is 1 、X 2 Representing two 32-bit decimal integers obtained by shift decomposition.
Further, two 32-bit decimal integers are respectively restored to corresponding point decimal IPv4 addresses (a.b.c.d), so that corresponding IPv4 address groups are obtained, which can be expressed as:
a=(X>>24)&0xFF;
b=(X>>16)&0xFF;
c=(X>>8)&0xFF;
d=X&0xFF;
wherein X represents X 1 、X 2
Thus, the IPv4 address group is obtained by decompressing the differential compressed route configuration data, namely the differential route configuration data set forming the current route configuration data set and the expected route configuration data set.
In order to facilitate better implementation of the route reconciliation method provided by the application, the embodiment of the application also provides a corresponding route reconciliation device. The meaning of the nouns is the same as that in the routing checking method, and specific implementation details refer to the description in the method embodiment.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a route accounting device according to an embodiment of the present application, where the route accounting device may include a compression module 310, a sorting module 320, a comparison module 330, and a restoration module 340,
a compression module 310, configured to compress the current route configuration data set to obtain a first compressed route configuration data set, and compress the desired route configuration data set to obtain a second compressed route configuration data set according to the same character compression manner;
The sorting module 320 is configured to sort the first compressed routing configuration data set according to a character sequence of a preset character set to obtain a first ordered compressed routing configuration data set, and sort the second compressed routing configuration data set to obtain a second ordered compressed routing configuration data set;
a comparison module 330, configured to compare the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set to obtain a differential compressed routing configuration data set of the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set;
a restoration module 340, configured to decompress the differential compressed routing configuration data set to obtain a differential routing configuration data set of the current routing configuration data set and the desired routing configuration data set.
Optionally, in an embodiment, the route configuration data includes an IP address group, and the compression module 310 is configured to convert the IP address group in the current route configuration data set into an integer address, to obtain an integer address set; and performing binary conversion on the integer addresses in the integer address set according to a target binary system to obtain a first compressed route configuration data set, wherein the target binary system is larger than the current binary system of the integer addresses in the integer address set.
Optionally, in an embodiment, the IP address group includes an IPv4 address group, and the compression module 310 is configured to convert each IPv4 address group in the current routing configuration data set into a 64-bit integer address, to obtain an integer address set.
Optionally, in an embodiment, the compression module 310 is configured to convert two IPv4 addresses in each IPv4 address set into corresponding 32-bit decimal integer addresses, respectively; and shifting one 32-bit decimal address obtained by converting each IP address group left by 32 bits, and adding the 32-bit decimal address with the other 32-bit decimal address to obtain a 64-bit decimal integer address, thereby obtaining an integer address set.
Optionally, in an embodiment, the restoration module 340 is configured to perform a binary restoration on each of the differential compressed routing configuration data in the differential compressed routing configuration data set to obtain a corresponding 64-bit decimal integer address; decomposing the 64-bit decimal integer address corresponding to each differential compression route configuration data into two 32-bit decimal integer addresses; and respectively restoring the two 32-bit decimal integer addresses corresponding to each differential compressed routing configuration data to corresponding IPv4 addresses to obtain a differential routing configuration data set.
Optionally, in an embodiment, the IP address group includes an IPv6 address group, and the compression module 310 is configured to convert a high 64-bit part of each IPv6 address of the IPv6 address group in the current routing configuration data set to a 64-bit decimal integer address, and convert a low 64-bit part of each IPv6 address of the IP address group in the current routing configuration data set to a 64-bit decimal integer address, to obtain the integer address set.
Optionally, in an embodiment, the restoration module 340 is configured to perform a binary restoration on each of the differential compressed routing configuration data in the differential compressed routing configuration data set to obtain four 64-bit decimal integer addresses; and restoring the 64-bit decimal integer address with the same source into an IPv6 address to obtain a differential routing configuration data set.
Optionally, in an embodiment, the compression module 310 is configured to divide each integer address in the integer address set by taking the binary number of the target system as a divisor until the quotient is 0; and reversely mapping the remainder of each integer address in the integer address set in the division operation process to characters in a preset character set to obtain first compressed route configuration data.
Optionally, in an embodiment, the compression module 310 is further configured to determine a desired compression rate, and determine the target system according to the desired compression rate.
Optionally, in an embodiment, the route reconciliation device provided by the application further includes an alarm module configured to output alarm information according to the differential route data set, where the alarm information is used to indicate that the current route configuration data set is abnormal.
Optionally, in an embodiment, the route accounting device further includes a repair module, configured to repair the current route configuration data set according to the differential route configuration data set in response to a configuration repair operation for the alarm information input.
The specific implementation of each module can be referred to the previous embodiments, and will not be repeated here.
In the present application, the compression module 310 compresses the current route configuration data set to obtain the first compressed route configuration data set according to the same character compression mode, and compresses the expected route configuration data set to obtain the second compressed route configuration data set, so that the number of characters of the route configuration data can be reduced, compared with the original current route configuration data set and the expected route configuration data set, the ordering module 320 can complete the ordering of the first compressed route configuration data set and the second compressed route configuration data set in a shorter time, so as to obtain the first ordered compressed route configuration data set and the second ordered compressed route configuration data set, and similarly, the comparison module 330 can complete the comparison of the first ordered compressed route configuration data set and the second ordered compressed route configuration data set in a shorter time, so as to obtain the differential route configuration data set of the current route configuration data set and the expected route configuration data set, and finally, the reduction module 340 decompresses the differential route configuration data set of the current route configuration data set and the expected route configuration data set, so that the present application can complete the ordering operation of the current route configuration data set and the expected route configuration data set in a shorter time than the direct comparison of the current route configuration data set and the expected route configuration data set, thereby achieving the effective comparison operation and the order of the current routing configuration data set.
The embodiment of the application also provides electronic equipment, which comprises a memory and a processor, wherein the processor is used for executing the steps in the routing checking method provided by the embodiment by calling the computer program stored in the memory.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the application.
The electronic device may include one or more processing cores 'processors 101, one or more computer-readable storage media's memory 102, power supply 103, and input unit 104, among other components. Those skilled in the art will appreciate that the electronic device structure shown in fig. 4 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components. Wherein:
the processor 101 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 102, and invoking data stored in the memory 102. Optionally, processor 101 may include one or more processing cores; alternatively, the processor 101 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 101.
The memory 102 may be used to store software programs and modules, and the processor 101 executes various functional applications and data processing by executing the software programs and modules stored in the memory 102. The memory 102 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device, etc. In addition, memory 102 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 102 may also include a memory controller to provide access to the memory 102 by the processor 101.
The electronic device further comprises a power supply 103 for powering the various components, optionally, the power supply 103 may be logically connected to the processor 101 by a power management system, whereby the functions of managing charging, discharging, and power consumption are performed by the power management system. The power supply 103 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The electronic device may further comprise an input unit 104, which input unit 104 may be used for receiving input digital or character information and for generating keyboard, mouse, joystick, optical or trackball signal inputs in connection with user settings and function control.
Although not shown, the electronic device may further include a display unit, an image acquisition component, and the like, which are not described herein. In particular, in this embodiment, when the electronic device is used as the client, the processor 101 loads executable codes corresponding to one or more computer programs into the memory 102, and the processor 101 executes steps in the route checking method provided by the present application, for example:
according to the same character compression mode, compressing the current route configuration data set to obtain a first compressed route configuration data set, and compressing the expected route configuration data set to obtain a second compressed route configuration data set;
according to the character sequence of the preset character set, sequencing the first compressed route configuration data set to obtain a first ordered compressed route configuration data set, and sequencing the second compressed route configuration data set to obtain a second ordered compressed route configuration data set;
comparing the first ordered compressed route configuration data set with the second ordered compressed route configuration data set to obtain a differential compressed route configuration data set of the first ordered compressed route configuration data set and the second ordered compressed route configuration data set;
Decompressing the differential compressed routing configuration data set to obtain a differential routing configuration data set of the current routing configuration data set and the expected routing configuration data set.
It should be noted that, the electronic device provided in the embodiment of the present application and the route accounting method in the above embodiment belong to the same concept, and detailed implementation processes of the electronic device are described in the above related embodiments, which are not repeated herein.
The present application also provides a computer-readable storage medium, on which a computer program is stored, which when executed on a processor of an electronic device provided by an embodiment of the present application, causes the processor of the electronic device to implement steps in a route checking method provided by the present application. The storage medium may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The application also provides a computer program product, which comprises a computer program, wherein the computer program, when being executed on a processor of the electronic device provided by the embodiment of the application, causes the processor of the electronic device to realize the steps in the routing checking method provided by the application.
The foregoing has outlined the detailed description of the route accounting method, the route accounting device, the electronic device, the computer readable storage medium and the computer program product of the present application, and the specific examples are provided herein to illustrate the principles and embodiments of the present application, and the above examples are only used to help understand the method and core idea of the present application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, the present description should not be construed as limiting the present application.
It should be noted that when the above embodiments of the present application are applied to specific products or technologies, related data concerning users are required to obtain user approval or consent, and the collection, use and processing of the related data are required to comply with related laws and regulations and standards of related countries and regions.

Claims (14)

1. A method of route reconciliation, comprising:
according to the same character compression mode, compressing the current route configuration data set to obtain a first compressed route configuration data set, and compressing the expected route configuration data set to obtain a second compressed route configuration data set;
According to the character sequence of the preset character set, sequencing the first compressed route configuration data set to obtain a first ordered compressed route configuration data set, and sequencing the second compressed route configuration data set to obtain a second ordered compressed route configuration data set;
comparing the first ordered compressed route configuration data set with the second ordered compressed route configuration data set to obtain a differential compressed route configuration data set of the first ordered compressed route configuration data set and the second ordered compressed route configuration data set;
decompressing the differential compressed routing configuration data set to obtain a differential routing configuration data set of the current routing configuration data set and the expected routing configuration data set.
2. The route reconciliation method of claim 1, wherein the route configuration data comprises a set of IP addresses and the compressing the current route configuration data set to obtain a first compressed route configuration data set comprises:
converting the IP address group in the current route configuration data set into an integer address to obtain an integer address set;
and carrying out binary conversion on the integer addresses in the integer address set according to a target binary system, so as to obtain a first compressed route configuration data set, wherein the target binary system is larger than the current binary system of the integer addresses in the integer address set.
3. The route accounting method of claim 2, wherein the set of IP addresses includes an IPv4 address set, said converting the set of IP addresses in the current route configuration data set to integer addresses, resulting in an integer address set, comprising:
and converting each IPv4 address group in the current route configuration data set into a 64-bit integer address to obtain an integer address set.
4. The method of route reconciliation of claim 3, wherein converting each IPv4 address set in the current route configuration data set to a 64-bit integer address results in an integer address set, comprising:
converting two IPv4 addresses in each IPv4 address group into corresponding 32-bit decimal integer addresses respectively;
after a 32-bit decimal address obtained by converting each IP address group is shifted left by 32 bits, the 32-bit decimal address is added with another 32-bit decimal address to form a 64-bit decimal integer address, and an integer address set is obtained.
5. The route reconciliation method of claim 4, wherein decompressing the differential compressed route configuration data set resulting in a differential route configuration data set of the current route configuration data set and the desired route configuration data set comprises:
Carrying out binary restoration on each difference compression route configuration data in the difference compression route configuration data set to obtain a corresponding 64-bit decimal integer address;
decomposing the 64-bit decimal integer address corresponding to each differential compression routing configuration data into two 32-bit decimal integer addresses;
and respectively restoring the two 32-bit decimal integer addresses corresponding to each differential compressed routing configuration data to corresponding IPv4 addresses to obtain a differential routing configuration data set.
6. The route accounting method of claim 2, wherein the set of IP addresses includes an IPv6 address set, said converting the set of IP addresses in the current route configuration data set to integer addresses, resulting in an integer address set, comprising:
converting the upper 64-bit part of each IPv6 address of the IPv6 address group in the current routing configuration data set into a 64-bit decimal integer address, and converting the lower 64-bit part of each IPv6 address of the IP address group in the current routing configuration data set into a 64-bit decimal integer address, so as to obtain an integer address set.
7. The route reconciliation method of claim 6, wherein decompressing the differential compressed route configuration data set resulting in a differential route configuration data set of the current route configuration data set and the desired route configuration data set comprises:
Carrying out binary restoration on each difference compression route configuration data in the difference compression route configuration data set to obtain four 64-bit decimal integer addresses;
and restoring the 64-bit decimal integer address with the same source into an IPv6 address to obtain a differential routing configuration data set.
8. The route reconciliation method of claim 2, wherein performing a binary translation of the integer addresses in the set of integer addresses according to a target binary system results in a first compressed route configuration data set comprising:
dividing each integer address in the integer address set by taking the binary number of the target system as a divisor until the quotient is 0;
and reversely mapping the remainder of each integer address in the integer address set in the division operation process to the characters in the preset character set to obtain first compressed route configuration data.
9. The route reconciliation method of claim 2, wherein prior to performing the binary translation of the integer addresses in the set of integer addresses in accordance with the target binary system to obtain the first compressed route configuration data set, further comprising:
and determining a desired compression rate, and determining the target system according to the desired compression rate.
10. The route reconciliation method of any one of claims 1-9, wherein decompressing the differential compressed route configuration data set to obtain a differential route configuration data set of the current route configuration data set and the desired route configuration data set further comprises:
and outputting alarm information according to the differential routing data set, wherein the alarm information is used for indicating that the current routing configuration data set is abnormal.
11. The route reconciliation method of claim 10, wherein after the outputting of the alert information from the differential route dataset, the route reconciliation method further comprises:
and responding to configuration repair operation aiming at the alarm information input, and repairing the current routing configuration data set according to the difference routing configuration data set.
12. A routing accounting apparatus, comprising:
the compression module is used for compressing the current route configuration data set to obtain a first compressed route configuration data set and compressing the expected route configuration data set to obtain a second compressed route configuration data set according to the same character compression mode;
the ordering module is used for ordering the first compressed route configuration data set according to the character sequence of the preset character set to obtain a first ordered compressed route configuration data set, and ordering the second compressed route configuration data set to obtain a second ordered compressed route configuration data set;
A comparison module, configured to compare the first ordered compressed routing configuration data set with the second ordered compressed routing configuration data set to obtain a differential compressed routing configuration data set of the first ordered compressed routing configuration data set and the second ordered compressed routing configuration data set;
and the restoration module is used for decompressing the differential compressed route configuration data set to obtain a differential route configuration data set of the current route configuration data set and the expected route configuration data set.
13. An electronic device comprising a memory storing a computer program and a processor for executing the computer program in the memory to implement the steps in the route checking method of any one of claims 1 to 11.
14. A computer readable storage medium, characterized in that it stores a computer program adapted to be executed by a processor to implement the steps in the route checking method of any one of claims 1 to 11.
CN202311162683.6A 2023-09-11 2023-09-11 Route checking method and device, electronic equipment and storage medium Active CN116896518B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311162683.6A CN116896518B (en) 2023-09-11 2023-09-11 Route checking method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311162683.6A CN116896518B (en) 2023-09-11 2023-09-11 Route checking method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116896518A true CN116896518A (en) 2023-10-17
CN116896518B CN116896518B (en) 2023-11-24

Family

ID=88315259

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311162683.6A Active CN116896518B (en) 2023-09-11 2023-09-11 Route checking method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116896518B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6385649B1 (en) * 1998-11-06 2002-05-07 Microsoft Corporation Routers and methods for optimal routing table compression
US9843685B1 (en) * 2014-09-26 2017-12-12 8X8, Inc. User configurable routing of VoIP calls
US20180227239A1 (en) * 2017-02-06 2018-08-09 Honeywell International Inc. Efficient message combining communication exchange system
CN110196780A (en) * 2018-03-23 2019-09-03 腾讯科技(深圳)有限公司 Determine method, apparatus, storage medium and the electronic device of server state

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6385649B1 (en) * 1998-11-06 2002-05-07 Microsoft Corporation Routers and methods for optimal routing table compression
US9843685B1 (en) * 2014-09-26 2017-12-12 8X8, Inc. User configurable routing of VoIP calls
US20180227239A1 (en) * 2017-02-06 2018-08-09 Honeywell International Inc. Efficient message combining communication exchange system
CN110196780A (en) * 2018-03-23 2019-09-03 腾讯科技(深圳)有限公司 Determine method, apparatus, storage medium and the electronic device of server state

Also Published As

Publication number Publication date
CN116896518B (en) 2023-11-24

Similar Documents

Publication Publication Date Title
US7188115B2 (en) Processing fixed-format data in a unicode environment
EP0621557A1 (en) Font definition conversion method
US11070231B2 (en) Reducing storage of blockchain metadata via dictionary-style compression
CN111008230A (en) Data storage method and device, computer equipment and storage medium
US10897270B2 (en) Dynamic dictionary-based data symbol encoding
US10606838B2 (en) Relational operations between database tables and application tables
CN112464619B (en) Big data processing method, device and equipment and computer readable storage medium
Abas et al. Increasing data storage of coloured QR code using compress, multiplexing and multilayered technique
CN116896518B (en) Route checking method and device, electronic equipment and storage medium
CN110554878A (en) data conversion method, game data processing method and device and server
US8954400B2 (en) Method, system and program product for managing structured data
CN113722533A (en) Information pushing method and device, electronic equipment and readable storage medium
JP2008192163A (en) Unicode converter
KR100494876B1 (en) Data compression method for multi-byte character language
US8463759B2 (en) Method and system for compressing data
JP4263627B2 (en) Communication terminal device, receiving device, and program
Srinivas et al. Storage Optimization Using File Compression Techniques for Big Data.
US6118391A (en) Compression into arbitrary character sets
Jrai et al. Improving LZW Compression of Unicode Arabic Text Using Multi-Level Encoding and a Variable-Length Phrase Code
CN112527753B (en) DNS analysis record lossless compression method and device, electronic equipment and storage medium
Murugan et al. WordCode using WordTrie
Ramanathan Unishox: A hybrid encoder for short unicode strings
CN116796705B (en) Method and device for detecting expression, electronic equipment and storage medium
CN117856798A (en) Character compression method, device, equipment and storage medium based on data stream
US10063864B2 (en) System and method for compression and decompression of text data

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
GR01 Patent grant
GR01 Patent grant