CN109639535B - Routing relation detection method and device - Google Patents

Routing relation detection method and device Download PDF

Info

Publication number
CN109639535B
CN109639535B CN201910049851.8A CN201910049851A CN109639535B CN 109639535 B CN109639535 B CN 109639535B CN 201910049851 A CN201910049851 A CN 201910049851A CN 109639535 B CN109639535 B CN 109639535B
Authority
CN
China
Prior art keywords
message
port
data
forwarding
test
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.)
Active
Application number
CN201910049851.8A
Other languages
Chinese (zh)
Other versions
CN109639535A (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.)
Guangzhou Xiaopeng Motors Technology Co Ltd
Original Assignee
Guangzhou Xiaopeng Motors Technology 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 Guangzhou Xiaopeng Motors Technology Co Ltd filed Critical Guangzhou Xiaopeng Motors Technology Co Ltd
Priority to CN201910049851.8A priority Critical patent/CN109639535B/en
Publication of CN109639535A publication Critical patent/CN109639535A/en
Application granted granted Critical
Publication of CN109639535B publication Critical patent/CN109639535B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/18Protocol analysers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/70Routing based on monitoring results
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Abstract

The embodiment of the application provides a method and a device for detecting a routing relation, wherein the method comprises the following steps: sending a test message carrying a jth identity to be tested to an ith port of message forwarding equipment, wherein the message forwarding equipment comprises M ports, the value of i is a positive integer from 1 to M, the value of j is a positive integer from 1 to N, and N is the total number of the identity to be tested; monitoring messages sent by (M-1) ports except the ith port, and judging whether a forwarding message carrying the jth identity to be tested is output by the port exists or not; if the identity identifier exists, establishing a message routing relation between the ith port and the port outputting the forwarding message, wherein the message routing relation is related to the jth identity identifier to be tested. The method can obtain all message routing relations of the message forwarding equipment in a traversal mode, and the condition that the two ports have the message routing relations but are not detected can be avoided, so that the routing relations can be detected more comprehensively.

Description

Routing relation detection method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for detecting a routing relationship.
Background
In automobile communication, a message forwarding device such as a gateway plays a role in bridging signals of different network segments and forwarding the signals. The forwarding behavior of the signals without the network segment can be realized by a routing table in the gateway. When a provider performs development work, a routing function of a gateway is usually implemented according to a routing table, which requires that the gateway can implement all routing relationships existing in the routing table, and the gateway cannot execute any routing relationship not recorded in the routing table. Therefore, the routing relationship of the gateway needs to be clarified.
In the existing testing method for gateway routing relationship in the prior art, based on a known routing table, a corresponding test file is generated for testing, that is, whether the routing relationship recorded in the routing table exists is verified. The existing testing method can test whether the gateway can realize all routing relations which should exist in the routing table, but cannot test whether the gateway forwards more data which should not be forwarded originally. Therefore, the existing testing method has blind areas and cannot completely cover the one-to-one correspondence between the gateway routing behaviors and the routing tables.
Content of application
In view of this, embodiments of the present application provide a method and an apparatus for detecting a routing relationship, so as to solve a problem that an existing testing method cannot completely cover a correspondence between a gateway routing behavior and a routing table.
In a first aspect, an embodiment of the present application provides a method for detecting a routing relationship, where the method includes: sending a test message carrying a jth identity to be tested to an ith port of message forwarding equipment, wherein the message forwarding equipment comprises M ports, the value of i is a positive integer from 1 to M, the value of j is a positive integer from 1 to N, and N is the total number of the identity to be tested; monitoring messages sent by (M-1) ports except the ith port, and judging whether a forwarding message carrying the jth identity to be tested is output by the port exists or not; if the identity identifier exists, establishing a message routing relation between the ith port and the port outputting the forwarding message, wherein the message routing relation is related to the jth identity identifier to be tested.
The routing relation detection method provided by the embodiment of the application tests the test message of each port about each identity to be tested in a traversal mode, sends the test message carrying a certain identity to be tested to one port, then monitors other ports of the message forwarding equipment to see whether a port outputs a forwarding message corresponding to the test message, and if so, establishes the message routing relation of the two ports about the identity to be tested. The above process is carried out for each port with respect to each identity to be detected, so that all message routing relationships in the message forwarding device are obtained, and all message routing relationships in the message forwarding device can be obtained in a traversal mode, so that the situation that two ports have message routing relationships but are not detected is avoided, and the routing relationships are detected more comprehensively.
In one possible design, the method further includes: if a forwarding message carrying the jth identity to be tested is output by a port, acquiring a first period of the port outputting the forwarding message; acquiring a second period of the test message received by the ith port; judging whether the first period is greater than the second period; if so, determining and recording that the message forwarding equipment processes the test message for a fixed period. After the port for outputting the forwarding message is obtained, the period for outputting the forwarding message by the port can be obtained, and the period is compared with the period for receiving the test message by the ith port, if the period for outputting the forwarding message is greater than the period of the ith port, the message forwarding equipment processes the test message for a fixed period, so that the periods of the input test message and the output forwarding message are different.
In one possible design, at least one of the M ports of the message forwarding device is configured with a preset message, and the port configured with the preset message outputs the preset message when the test message is not received; after sending the test packet carrying the jth id to be tested to the ith port of the packet forwarding device, the method further includes: monitoring a message sent by a port configured with a preset message, and judging whether message data of the preset message of the port changes in the port configured with the preset message of the message forwarding equipment; if so, establishing a bit signal routing relationship between the ith port and the port with the changed message data, wherein the bit signal routing relationship is the relationship that at least one bit of message data in a preset message changes along with the change of at least one bit of message data in the test message. All bit signal routing relations of the message forwarding equipment are obtained in a traversal mode, and therefore the routing relations are detected more comprehensively.
In a possible design, after the establishing a bit signal routing relationship between the ith port and the port whose packet data changes with respect to the jth id to be tested, the method further includes: obtaining a plurality of different content change messages, wherein the content of one data in the message data of the content change message is changed compared with the message data of the test message carrying the jth identity to be tested; sending the different content change messages to an ith port; obtaining a secondary preset message influenced by each of a plurality of content change messages, wherein the possibility that the message data of the secondary preset message is different from the message data of the initial preset message exists; and performing XOR operation on the message data of the plurality of secondary preset messages and the message data of the initial preset message, and calculating and recording data bits which are changed along with the test message in the preset messages.
After the port establishing the bit signal routing relation is obtained, it can be specifically judged which specific data bit of the preset message of the port configured with the preset message changes with whether the test message is input or not, and the relation is recorded, so that the comprehensiveness of the detection of the route relation is further improved.
In a possible design, the sending a test packet carrying a jth id to be tested to an ith port of the packet forwarding device includes: and sending a test message with a data length corresponding to the communication protocol type to the ith port, wherein the test message carries the jth identity to be tested. Because the data length forwarded by the message forwarding equipment is uncertain, each data length needs to be tested, and the test comprehensiveness is improved.
In a second aspect, an embodiment of the present application provides an apparatus, including: the test message sending module is used for sending a test message carrying a jth to-be-tested identity to an ith port of message forwarding equipment, wherein the message forwarding equipment comprises M ports, the value of i is a positive integer from 1 to M, the value of j is a positive integer from 1 to N, and N is the total number of the to-be-tested identity; a forwarding message output module, configured to monitor messages sent by (M-1) ports other than the ith port, and determine whether a port outputs a forwarding message carrying the jth id to be tested; and the message routing establishing module is used for establishing a message routing relation between the ith port and the port for outputting the forwarding message and related to the jth to-be-detected identity identifier.
The routing relation detection method provided by the embodiment of the application tests the test message of each port about each identity to be tested in a traversal mode, sends the test message carrying a certain identity to be tested to one port, then monitors other ports of the message forwarding equipment to see whether a port outputs a forwarding message corresponding to the test message, and if so, establishes the message routing relation of the two ports about the identity to be tested. The above process is carried out for each port with respect to each identity to be detected, so that all message routing relationships in the message forwarding device are obtained, and all message routing relationships in the message forwarding device can be obtained in a traversal mode, so that the situation that two ports have message routing relationships but are not detected is avoided, and the routing relationships are detected more comprehensively.
In one possible design, the apparatus includes: a first period obtaining module, configured to obtain a first period of a port outputting a forwarding packet carrying the jth id to be tested if the port outputs the forwarding packet carrying the jth id; a second cycle acquiring module, configured to acquire a second cycle in which the ith port receives the test packet; the period judging module is used for judging whether the first period is greater than the second period; and the fixed period determining module is used for determining and recording that the message forwarding equipment processes the test message in a fixed period.
After the port for outputting the forwarding message is obtained, the period for outputting the forwarding message by the port can be obtained, and the period is compared with the period for receiving the test message by the ith port, if the period for outputting the forwarding message is greater than the period of the ith port, the message forwarding equipment processes the test message for a fixed period, so that the periods of the input test message and the output forwarding message are different.
In one possible design, the apparatus further includes: the message data change judging module is used for monitoring a message sent by a port configured with a preset message and judging whether the message data of the preset message of the port changes in the port configured with the preset message of the message forwarding equipment; and the bit signal routing establishing module is used for establishing a bit signal routing relationship between the ith port and the port with the changed message data, which is related to the jth identity to be tested, wherein the bit signal routing relationship is the relationship that at least one bit of message data in a preset message changes along with the change of at least one bit of message data in the test message.
When the message forwarding device does not receive the input message, the port configured with the preset message can still output the configured preset message. When the message forwarding device receives a test message carrying a certain identity to be tested, whether the message data of the preset message of the port configured with the preset message changes is judged, if the message data of the preset message of at least one port changes, a bit signal routing relation between the port for inputting the test message and the port with the changed message data about the identity to be tested can be established, and the bit signal routing relation is a relation that at least one bit of message data in the preset message changes along with the change of at least one bit of message data in the test message. All bit signal routing relations of the message forwarding equipment are obtained in a traversal mode, and therefore the routing relations are detected more comprehensively.
In one possible design, the apparatus further includes: a content change message obtaining module, configured to obtain a plurality of different content change messages, where content of one data in message data of the content change message is changed compared with message data of the test message carrying the jth id to be tested; a content change message sending module, configured to send the multiple different content change messages to an ith port; the secondary preset message module is used for obtaining a secondary preset message influenced by each of the plurality of content change messages, and the message data of the secondary preset message has the possibility different from the message data of the initial preset message; and the exclusive or operation module is used for performing exclusive or operation on the message data of the plurality of secondary preset messages and the message data of the initial preset message, and calculating and recording data bits which are changed along with the test message in the preset messages.
After the port establishing the bit signal routing relation is obtained, it can be specifically judged which specific data bit of the preset message of the port configured with the preset message changes with whether the test message is input or not, and the relation is recorded, so that the comprehensiveness of the detection of the route relation is further improved.
In a possible design, the test packet sending module is further configured to send a test packet with a data length corresponding to the communication protocol type to the ith port, where the test packet carries the jth id to be tested.
For different communication protocol types, there may be test messages with data length corresponding to the communication protocol types, for example, for a Controller Area Network (CAN) communication protocol, a message with data length of 8 bytes; for a Controller Area Network (Controller Area Network) communication protocol with flexible data Rate, the protocol has messages with data lengths of 8 bytes, 12 bytes, 16 bytes, 20 bytes, 24 bytes, 32 bytes, 48 bytes and 64 bytes, and because the data length forwarded by the message forwarding device is not determined, each data length needs to be tested, and the test comprehensiveness is improved.
In a third aspect, the present application provides an electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the apparatus is run, the machine-readable instructions when executed by the processor performing the method of the first aspect or any of the alternative implementations of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of the first aspect or any of the alternative implementations of the first aspect.
In a fifth aspect, the present application provides a computer program product which, when run on a computer, causes the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
For a clearer explanation of the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a routing relation detection method according to a first embodiment of the present application;
fig. 2 is a flowchart of steps subsequent to step S130;
fig. 3 is a flowchart of part of steps of a routing relation detection method according to a first embodiment of the present application;
fig. 4 is a block diagram of a routing relation detection apparatus according to a second embodiment of the present application.
Detailed Description
In the prior art, when detecting the routing relationship of a message forwarding device such as a gateway, the routing table of the message forwarding device is often obtained first, and then whether the routing relationship recorded by the routing table exists is verified one by one; however, for the routing relation not recorded in the routing table, the existing detection method cannot verify that the routing relation does not exist, that is, whether the gateway forwards more data which should not be forwarded is what the existing detection method cannot verify.
The above-mentioned drawbacks of the prior art are considered by the applicant to be the result of the practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solution proposed by the following embodiments of the present invention to the above-mentioned problems should be the contribution of the inventor to the present invention in the course of the present invention.
In order to solve the above technical problem, embodiments of the present application provide a method and an apparatus for detecting a routing relationship, which will be described in detail below with reference to the accompanying drawings.
First embodiment
Referring to fig. 1, fig. 1 shows a schematic flow chart of a routing relationship detection method provided in a first embodiment of the present application, which specifically includes the following steps:
step S110, sending a test message carrying the jth identity to be tested to the ith port of the message forwarding device.
The message forwarding device is a device for implementing a function of forwarding a message, and may be a gateway device, for example, a router. The message forwarding equipment comprises M ports, the value of i is a positive integer from 1 to M, the value of j is a positive integer from 1 to N, and N is the total number of the to-be-detected identity marks. The identity to be detected is the message ID to be detected, and optionally, the number of the message IDs may be from 0x00 to 0x7ff, which is 8 × 16 — 2048 in total. The test message is a message for detecting a routing relationship between ports of the message forwarding device.
In a specific embodiment, step S110 may be to send a test packet having a data length corresponding to a communication protocol type to the ith port, where the test packet carries a jth id to be tested.
For different communication protocol types, there may be test messages with data length corresponding to the communication protocol types, for example, for a Controller Area Network (CAN) communication protocol, a message with data length of 8 bytes; for a Controller Area Network (CAN FD) communication protocol with flexible data Rate, there are messages with data lengths of 8 bytes, 12 bytes, 16 bytes, 20 bytes, 24 bytes, 32 bytes, 48 bytes, and 64 bytes, respectively.
For each data length, two kinds of test messages can be sent, one is data with all data being 0, and the other is data with all data being 1.
That is, in the CAN communication protocol, for each port and each identity to be tested, a test message with a data length of 8 bytes and data content of 0 CAN be sent; and the test message with the data length of 8 bytes and the data content of 1, and each data length can send the test message of two data contents.
In the CAN FD communication protocol, each port and each identity mark to be tested CAN send test messages with the data length of 8 bytes, the data contents of all 0 and the data contents of all 1; the test message with the data length of 12 bytes, all data contents of 0 and all data contents of 1 can be sent; the data length is 16 bytes, the data content is all 0 and the data content is all 1; the test message has the data length of 20 bytes, the data contents of all 0 and the data contents of all 1; the data length is 24 bytes, the data content is all 0 and the data content is all 1; the data length is 32 bytes, the data content is all 0 and the data content is all 1; the data length is 48 bytes, the data content is all 0 and the data content is all 1; the test message has the data length of 64 bytes, the data contents of all 0 and the data contents of all 1; there are 16 kinds of test messages.
Because the data length forwarded by the message forwarding equipment is uncertain, each data length needs to be tested, and the test comprehensiveness is improved.
Step S120, monitoring messages sent by (M-1) ports except the ith port, judging whether a forwarding message carrying the jth to-be-detected identity is output by the port, and if so, executing step S130.
In the routing relation detection method provided by the application, all ports of the message forwarding device to be detected for the routing relation can be connected through a processing device, and then after the processing device sends the test message to the ith port, the processing device monitors (M-1) ports of the message forwarding device except the ith port. In general, a message input from one port of the message forwarding device is not output from the same port, so the processing device may monitor other ports except for the port from which the message is input, and of course, the processing device may also monitor all ports of the message forwarding device, and the number of the ports monitored by the processing device should not be construed as a limitation to the present application.
After the test message is input through the ith port, other ports of the message forwarding device may be monitored, and it is determined whether there is a forwarding message whose port outputs the same id to be tested as the test message in the other ports of the message forwarding device, if so, it indicates that the port outputting the forwarding message is communicated with the ith port, and the message input from the ith port may be output and forwarded to other devices, then step S130 is executed.
Step S130, establishing a message routing relation between the ith port and the port outputting the forwarding message, wherein the message routing relation is related to the jth identity to be tested.
The message routing relationship is a signal link or a serial adjacent link used for transmitting the message from a sending point to a destination. The above steps are to detect the message carrying the jth id to be detected, so that it can be determined that the ith port and the port outputting the forwarding message have a message routing relationship with respect to the jth id to be detected, and whether the message routing relationship exists in the messages of other ids to be detected or not needs to be correspondingly detected.
The routing relation detection method provided by the embodiment of the application tests the test message of each port about each identity to be tested in a traversal mode, sends the test message carrying a certain identity to be tested to one port, then monitors other ports of the message forwarding equipment to see whether a port outputs a forwarding message corresponding to the test message, and if so, establishes the message routing relation of the two ports about the identity to be tested. The above process is carried out for each port with respect to each identity to be detected, so that all message routing relationships in the message forwarding device are obtained, and all message routing relationships in the message forwarding device can be obtained in a traversal mode, so that the situation that two ports have message routing relationships but are not detected is avoided, and the routing relationships are detected more comprehensively.
Referring to fig. 2, fig. 2 is a schematic diagram illustrating a part of steps of a routing relationship detection method according to a first embodiment of the present application, and specifically includes the following steps:
step S140, if there is a forwarding message carrying the jth ID to be tested and output by a port, acquiring a first period of the port outputting the forwarding message.
After the port outputting the forwarding packet is obtained by monitoring, a time interval for the port to send two adjacent forwarding packets may be calculated, and the time interval may be recorded as a first period.
Step S150, obtaining the second period of the ith port receiving the test message.
When the ith port receives the test message, the time interval for the ith port to receive two adjacent test messages is calculated, and the time interval can be recorded as a second period.
Step S160, determining whether the first period is greater than the second period, if yes, executing step S170.
Comparing the first period with the second period, if the first period is larger than the second period, it indicates that the message forwarding device has adjusted the sending period of the forwarded message, and if the first period is equal to the second period, the step S170 is executed.
Step S170, determining and recording that the message forwarding device has performed a fixed period of processing on the test message.
Determining and recording the fixed period processing of the message forwarding equipment on the test message, if the period of the port outputting the forwarding message is greater than the period of the ith port, the message forwarding equipment processes the test message in a fixed period, so that the periods of the input test message and the output forwarding message are different.
Optionally, referring to fig. 3, in a specific embodiment, after step S110, the following steps may be further included:
step S210, monitoring a message sent by a port configured with a preset message, and determining whether there is a change in message data of the preset message of the port in the port configured with the preset message of the message forwarding device, if so, executing step S220.
At least one port of the M ports of the message forwarding equipment is configured with a preset message, and the port configured with the preset message outputs the preset message when the test message is not received. The processing device may monitor only the port configured with the preset packet, and of course, the processing device may also monitor all the ports of the packet forwarding device, and the number of the ports monitored by the processing device should not be construed as a limitation to the present application.
The content of the preset message is preset data. In a specific embodiment, when the test packet is not received within a certain time period, the content of the preset packet may be an initial value; if the message forwarding device still does not receive the test message after a certain period of time, the content of the preset message may be changed to a loss value, and the loss value may be agreed invalid data. For a receiving end device communicating with a message forwarding device, an initial value generally conforms to a message processing logic and is an effective value, and if the receiving end device receives a preset message of which the message content is the initial value all the time, the receiving end considers that the preset message comes from a source device all the time, so that the receiving end device performs corresponding processing action on the preset message; the loss value is usually not in accordance with the message processing logic and is an invalid value, and the receiving end device receives the preset message with the message content being the loss value and can not execute the processing action, thereby saving the operation resources.
After the message forwarding device receives the test message, the processing device monitors the port of the message forwarding device configured with the preset message, and judges whether the message content of the preset message sent by the port changes compared with the preset data. If the change occurs, it indicates whether the test message has an influence on the change of the message content of the preset message, and step S220 is executed.
Step S220, establishing a bit signal routing relation between the ith port and the port with the changed message data, which is related to the jth identity to be tested.
The bit signal routing relationship is a relationship that at least one bit of message data in a preset message changes along with the change of at least one bit of message data in the test message. Taking the preset packet with the data length of 5 bytes as an example, when the packet forwarding device does not receive the test packet, the packet content of the preset packet is 1111111111, and when the packet forwarding device receives the test packet, the packet content of the preset packet is changed to 1000000000. Because the message content of the preset message changes, a bit signal routing relation between the ith port and the port with the changed message data about the carried identity to be detected can be established.
When the message forwarding device does not receive the input message, the port configured with the preset message can still output the configured preset message. When the message forwarding device receives a test message carrying a certain identity to be tested, whether the message data of the preset message of the port configured with the preset message changes is judged, and if the message data of the preset message of at least one port changes, a bit signal routing relation between the port for inputting the test message and the port with the changed message data about the identity to be tested can be established. All bit signal routing relations of the message forwarding equipment are obtained in a traversal mode, and therefore the routing relations are detected more comprehensively.
Step S230, a plurality of different content change messages are obtained.
And comparing the message data of the content change message with the message data of the test message carrying the jth identity to be tested, wherein the content of one data bit changes, namely one bit changes. A plurality of different content change messages change corresponding to different bits in the message content.
Step S240, sending the different content change messages to the ith port.
Step S250, obtaining a secondary preset message affected by each of the plurality of content change messages.
The message data of the secondary preset message has a possibility different from the message data of the initial preset message. For the port configured with the preset message, when the message forwarding device receives a plurality of different content change messages, the port configured with the preset message outputs the corresponding preset message, and the preset message can be recorded as a secondary preset message. The message data of the secondary preset message may be different from the message data of the initial preset message, and may also be the same as the message data of the initial preset message.
Step S260, performing an exclusive or operation on the message data of the plurality of secondary preset messages and the message data of the initial preset message, and calculating and recording a data bit in the preset message, which changes with the test message.
And performing XOR operation on the message data of each secondary preset message in the plurality of secondary preset messages and the message data of the initial preset message, thereby calculating the data bit in the preset messages, which changes along with the input of the test message.
The specific exclusive or operation process is as follows, taking the data length of 5Byte as an example:
the message content of the initial preset message is as follows: 00A 8000000, after the message forwarding device receives the test message, changing the message content of the preset message into: 0028000000, the two message contents are then subjected to exclusive-or operation. Binary 10100000 for 0xA8 and 00100000 for 0x28, the xor result of the two numbers is 10000000, and the xor result corresponds to 16-ary number 0x 80; the result of the two 0x00 exclusive or operations remains 0x 00. Therefore, the exclusive-or operation of the two message contents obtains 0080000000.
The exclusive or process is the process of changing the third bit data bit from left to right of 10100000 and 00100000 from 1 to 0. For the result 0080000000 obtained by exclusive-or, converting it into a binary number, one obtains:
0000 0000 1000 0000 0000 0000 0000 0000 0000 0000
and continuously moving 1 in the binary number from right to left, moving one data bit each time, and judging the number of times of movement, so as to obtain the following binary number:
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
by shifting, 1 is shifted to the left by one data Bit every time, the binary number can be obtained by shifting 9 times, and the data Bit in the preset message changing along with the test message can be obtained by subtracting 1 from the number of shifts, for this example, the data Bit in the preset message changing along with the test message is the 8 th Bit data Bit.
After the port establishing the bit signal routing relation is obtained, it can be specifically judged which specific data bit of the preset message of the port configured with the preset message changes with whether the test message is input or not, and the relation is recorded, so that the comprehensiveness of the detection of the route relation is further improved.
Second embodiment
Referring to fig. 4, fig. 4 shows an apparatus provided in a second embodiment of the present application, where the apparatus 300 includes:
the test packet sending module 310 is configured to send a test packet carrying a jth id to be tested to an ith port of a packet forwarding device, where the packet forwarding device includes M ports, a value of i is a positive integer from 1 to M, a value of j is a positive integer from 1 to N, and N is a total number of ids to be tested.
And a forwarding message output module 320, configured to monitor messages sent by (M-1) ports other than the ith port, and determine whether there is a forwarding message carrying the jth id to be tested and output by a port.
A message routing establishing module 330, configured to establish a message routing relationship between the ith port and the port that outputs the forwarding message, where the jth id to be tested is related to the ith port.
The test packet sending module 310 is further configured to send a test packet with a data length corresponding to the communication protocol type to the ith port, where the test packet carries the jth id to be tested.
The device further comprises:
and the first period acquisition module is used for acquiring a first period of the port outputting the forwarding message carrying the jth to-be-detected identity if the port outputs the forwarding message carrying the jth to-be-detected identity.
And the second period acquisition module is used for acquiring a second period of the test message received by the ith port.
And the period judging module is used for judging whether the first period is greater than the second period.
And the fixed period determining module is used for determining and recording that the message forwarding equipment processes the test message in a fixed period.
And the message data change judging module is used for monitoring the message sent by the port configured with the preset message and judging whether the message data of the preset message of the port is changed or not in the port configured with the preset message of the message forwarding equipment.
And the bit signal routing establishing module is used for establishing a bit signal routing relationship between the ith port and the port with the changed message data, which is related to the jth identity to be tested, wherein the bit signal routing relationship is the relationship that at least one bit of message data in a preset message changes along with the change of at least one bit of message data in the test message.
And the content change message obtaining module is used for obtaining a plurality of different content change messages, wherein the content of one data in the message data of the content change message is changed compared with the message data of the test message carrying the jth identity to be tested.
And the content change message sending module is used for sending the different content change messages to the ith port.
And the secondary preset message module is used for obtaining a secondary preset message influenced by each of the plurality of content change messages, and the message data of the secondary preset message has the possibility different from the message data of the initial preset message.
And the exclusive or operation module is used for performing exclusive or operation on the message data of the plurality of secondary preset messages and the message data of the initial preset message, and calculating and recording data bits which are changed along with the test message in the preset messages.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method, and will not be described in too much detail herein.
The present application further provides an electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the apparatus is operated, the machine-readable instructions when executed by the processor performing the method of the first embodiment.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of the first embodiment.
The present application also provides a computer program product which, when run on a computer, causes the computer to perform the method of the first embodiment.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system described above may refer to the corresponding process in the foregoing method, and will not be described in too much detail herein.
Under the background of the continuous development of the automobile communication technology, the message forwarding equipment can be connected with channels of various different communication protocols, and the routes among the different communication protocols are gradually increased. The detection method provided by the embodiment of the application can be expanded to be a routing test of different communication protocols among CAN (FD), LIN, MOST, Flexray and Ethernet according to the configuration of different channels of the message forwarding equipment. Because traversal test takes longer time, if the number of gateway channels is more, the routing relation detection method provided by the embodiment of the application can be executed for a plurality of message forwarding devices with the same routing relation, so that different channels are traversed for different message forwarding devices, the test speed is reduced, and the test efficiency is improved.
The embodiment of the application provides a method and a device for detecting a routing relation, wherein the method comprises the following steps: sending a test message carrying a jth identity to be tested to an ith port of message forwarding equipment, wherein the message forwarding equipment comprises M ports, the value of i is a positive integer from 1 to M, the value of j is a positive integer from 1 to N, and N is the total number of the identity to be tested; monitoring messages sent by (M-1) ports except the ith port, and judging whether a forwarding message carrying the jth identity to be tested is output by the port exists or not; if the identity identifier exists, establishing a message routing relation between the ith port and the port outputting the forwarding message, wherein the message routing relation is related to the jth identity identifier to be tested. The method can obtain all message routing relations of the message forwarding equipment in a traversal mode, and the condition that the two ports have the message routing relations but are not detected can be avoided, so that the routing relations can be detected more comprehensively.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for detecting routing relationship, the method comprising:
sending a test message carrying a jth identity to be tested to an ith port of message forwarding equipment, wherein the message forwarding equipment comprises M ports, the value of i is a positive integer from 1 to M, the value of j is a positive integer from 1 to N, and N is the total number of the identity to be tested;
monitoring messages sent by M-1 ports except the ith port, and judging whether a forwarding message carrying the jth to-be-detected identity identifier is output by a port or not;
and if the identity identifier exists, establishing a message routing relation between the ith port and the port for outputting the forwarding message, wherein the message routing relation is related to the jth identity identifier to be tested.
2. The method of claim 1, further comprising:
if a forwarding message carrying the jth to-be-detected identity identifier is output by a port, acquiring a first period of the port outputting the forwarding message, wherein the first period is a time interval of sending two adjacent forwarding messages by the port outputting the forwarding message;
acquiring a second period of the test message received by the ith port;
judging whether the first period is greater than the second period;
if so, determining and recording that the message forwarding equipment processes the test message for a fixed period.
3. The method according to claim 1, wherein at least one of the M ports of the message forwarding device is configured with a preset message, and the port configured with the preset message outputs the preset message when the test message is not received;
after sending the test packet carrying the jth id to be tested to the ith port of the packet forwarding device, the method further includes:
monitoring a message sent by a port configured with a preset message, and judging whether message data of the preset message of the port changes in the port configured with the preset message of the message forwarding equipment;
if so, establishing a bit signal routing relationship related to the jth to-be-tested identity between the ith port and the port with the changed message data, wherein the bit signal routing relationship is a relationship that at least one bit of message data in a preset message changes along with the change of at least one bit of message data in the test message.
4. The method according to claim 3, wherein after said establishing a bit signal routing relationship between said ith port and a port where packet data changes with respect to said jth id under test, said method further comprises:
obtaining a plurality of different content change messages, wherein the content of one data in the message data of the content change message is changed compared with the message data of the test message carrying the jth identity to be tested;
sending the different content change messages to an ith port;
obtaining a secondary preset message influenced by each of a plurality of content change messages, wherein the message data of the secondary preset message is the same as or different from the message data of the initial preset message;
and performing XOR operation on the message data of the plurality of secondary preset messages and the message data of the initial preset message, and calculating and recording data bits which are changed along with the test message in the preset messages.
5. The method according to claim 1, wherein the sending the test packet carrying the jth id to be tested to the ith port of the packet forwarding device comprises:
and sending a test message with a data length corresponding to the communication protocol type to the ith port, wherein the test message carries the jth identity to be tested.
6. An apparatus for routing relationship detection, the apparatus comprising:
the test message sending module is used for sending a test message carrying a jth to-be-tested identity to an ith port of message forwarding equipment, wherein the message forwarding equipment comprises M ports, the value of i is a positive integer from 1 to M, the value of j is a positive integer from 1 to N, and N is the total number of the to-be-tested identity;
a forwarding message output module, configured to monitor messages sent by M-1 ports except the ith port, and determine whether a forwarding message carrying the jth id to be detected is output by a port;
and the message routing establishing module is used for establishing a message routing relation between the ith port and the port for outputting the forwarding message, wherein the message routing relation is related to the jth to-be-detected identity identifier.
7. The apparatus of claim 6, wherein the apparatus comprises:
a first cycle obtaining module, configured to obtain a first cycle of a port outputting a forwarding packet carrying the jth id to be tested if there is a forwarding packet output by the port, where the first cycle is a time interval between two adjacent forwarding packets sent by the port outputting the forwarding packet;
a second cycle acquiring module, configured to acquire a second cycle in which the ith port receives the test packet;
the period judging module is used for judging whether the first period is greater than the second period;
and the fixed period determining module is used for determining and recording that the message forwarding equipment processes the test message in a fixed period.
8. The apparatus of claim 6, further comprising:
the message data change judging module is used for monitoring a message sent by a port configured with a preset message and judging whether the message data of the preset message of the port changes in the port configured with the preset message of the message forwarding equipment;
and the bit signal routing establishing module is used for establishing a bit signal routing relationship related to the jth to-be-tested identity between the ith port and the port with the changed message data, wherein the bit signal routing relationship is a relationship that at least one bit of message data in a preset message changes along with the change of at least one bit of message data in the test message.
9. The apparatus of claim 8, further comprising:
a content change message obtaining module, configured to obtain a plurality of different content change messages, where content of one data in message data of the content change message is changed compared with message data of the test message carrying the jth id to be tested;
a content change message sending module, configured to send the multiple different content change messages to an ith port;
the secondary preset message module is used for obtaining a secondary preset message influenced by each of the plurality of content change messages, and the message data of the secondary preset message is the same as or different from the message data of the initial preset message;
and the exclusive or operation module is used for performing exclusive or operation on the message data of the plurality of secondary preset messages and the message data of the initial preset message, and calculating and recording data bits which are changed along with the test message in the preset messages.
10. The apparatus according to claim 6, wherein the test packet sending module is further configured to send a test packet with a data length corresponding to a communication protocol type to the ith port, where the test packet carries the jth id to be tested.
CN201910049851.8A 2019-01-18 2019-01-18 Routing relation detection method and device Active CN109639535B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910049851.8A CN109639535B (en) 2019-01-18 2019-01-18 Routing relation detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910049851.8A CN109639535B (en) 2019-01-18 2019-01-18 Routing relation detection method and device

Publications (2)

Publication Number Publication Date
CN109639535A CN109639535A (en) 2019-04-16
CN109639535B true CN109639535B (en) 2020-09-11

Family

ID=66061338

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910049851.8A Active CN109639535B (en) 2019-01-18 2019-01-18 Routing relation detection method and device

Country Status (1)

Country Link
CN (1) CN109639535B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110048910A (en) * 2019-04-24 2019-07-23 重庆长安汽车股份有限公司 A kind of vehicle-mounted ethernet gateway test macro and method
CN111343051A (en) * 2020-03-05 2020-06-26 中国第一汽车股份有限公司 Message routing test method, device and storage medium
CN112333038A (en) * 2020-09-29 2021-02-05 北京软慧科技有限公司 Vehicle gateway detection method and device
CN114760227B (en) * 2021-03-16 2023-02-28 广州汽车集团股份有限公司 Message sending delay test method, test upper computer and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101056225A (en) * 2007-05-31 2007-10-17 中兴通讯股份有限公司 A router test method and its onsite simulation test device
US7916734B2 (en) * 2007-09-03 2011-03-29 Electronics And Telecommunications Research Institute Method for determining transmission path of router system
CN106059932A (en) * 2016-08-08 2016-10-26 杭州华三通信技术有限公司 Routing table item generation method and device
CN106953750A (en) * 2017-03-09 2017-07-14 新华三技术有限公司 One kind detection path establishment method and device
CN109150645A (en) * 2017-06-28 2019-01-04 中航光电科技股份有限公司 A kind of test method and system of exchange chip

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7096251B2 (en) * 2002-01-23 2006-08-22 Sun Microsystems, Inc. Calculation of layered routes in a distributed manner
CN103973554A (en) * 2013-01-29 2014-08-06 华为技术有限公司 Routing method, routing system and related equipment
US10091099B2 (en) * 2016-05-31 2018-10-02 128 Technology, Inc. Session continuity in the presence of network address translation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101056225A (en) * 2007-05-31 2007-10-17 中兴通讯股份有限公司 A router test method and its onsite simulation test device
US7916734B2 (en) * 2007-09-03 2011-03-29 Electronics And Telecommunications Research Institute Method for determining transmission path of router system
CN106059932A (en) * 2016-08-08 2016-10-26 杭州华三通信技术有限公司 Routing table item generation method and device
CN106953750A (en) * 2017-03-09 2017-07-14 新华三技术有限公司 One kind detection path establishment method and device
CN109150645A (en) * 2017-06-28 2019-01-04 中航光电科技股份有限公司 A kind of test method and system of exchange chip

Also Published As

Publication number Publication date
CN109639535A (en) 2019-04-16

Similar Documents

Publication Publication Date Title
CN109639535B (en) Routing relation detection method and device
JP4244940B2 (en) Network quality degradation location estimation apparatus, quality degradation location estimation method, and quality degradation location estimation program
EP2684323B1 (en) Microcontroller with can bus module and auto speed detect
CN111934943A (en) Bit forwarding entry router, bit forwarding router and operation management maintenance detection method
EP3474493B1 (en) Network performance measurement method and detection device
JP5506801B2 (en) Transport network failure detection
DE60315623D1 (en) A method, computer readable medium, and nodes for selecting reliable links between nodes in an ad hoc communication network
JP2010505306A (en) Loop detection in mobile networks
US7924737B2 (en) Signal degrade detecting method, signal restoration detecting method, devices for those methods, and traffic transmission system
Marchetta et al. DRAGO: Detecting, quantifying and locating hidden routers in traceroute IP paths
AU2014259939B2 (en) Method for link characterization in a digital network
US10404570B2 (en) Automatically detecting an error in a communication and automatically determining a source of the error
CN110233779B (en) Test method, test system and computer readable storage medium
CN108696433B (en) Route oscillation suppression method and BGP routing equipment
KR20130108879A (en) Method for protection switching in ethernet ring network
CN112350844B (en) Method and device for data transmission
EP2061185B1 (en) Estimating network-layer topology using end-to-end measurements
CN102752169B (en) Transmitting, monitoring method and device
CN111654440A (en) Intelligent routing method, electronic equipment and storage medium
CN113812119B (en) Network node for performance measurement
JP5028202B2 (en) Control network system
US20170132055A1 (en) Determining Physical Layer Error Signatures of a Communications Link
JP2005110038A (en) Congestion detecting device, and method for detecting congestion of tcp traffic, and program
Liu et al. Can observed entropy detect congestion in Ad-Hoc networks?
CN109802970B (en) Message transmission method and device, electronic equipment and computer medium

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 510000 No.8 Songgang street, Cencun, Tianhe District, Guangzhou City, Guangdong Province

Applicant after: GUANGZHOU XPENG AUTOMOBILE TECHNOLOGY Co.,Ltd.

Address before: Room 245, 333 Jiufojian Road, Zhongxin Guangzhou Knowledge City, Luogang District, Guangzhou City, Guangdong 510000

Applicant before: GUANGZHOU XPENG AUTOMOBILE TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant