CN110233779B - Test method, test system and computer readable storage medium - Google Patents

Test method, test system and computer readable storage medium Download PDF

Info

Publication number
CN110233779B
CN110233779B CN201910644109.1A CN201910644109A CN110233779B CN 110233779 B CN110233779 B CN 110233779B CN 201910644109 A CN201910644109 A CN 201910644109A CN 110233779 B CN110233779 B CN 110233779B
Authority
CN
China
Prior art keywords
data packet
test
network device
interfaces
path information
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
CN201910644109.1A
Other languages
Chinese (zh)
Other versions
CN110233779A (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.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication 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 Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN201910644109.1A priority Critical patent/CN110233779B/en
Publication of CN110233779A publication Critical patent/CN110233779A/en
Application granted granted Critical
Publication of CN110233779B publication Critical patent/CN110233779B/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/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/34Source routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/50Routing or path finding of packets in data switching networks using label swapping, e.g. multi-protocol label switch [MPLS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a test method, a test system and a computer readable storage medium. The method can be applied to a test system, wherein the test system comprises a first network device and a second network device; the plurality of first interfaces in the first network equipment and the plurality of second interfaces in the second network equipment are connected according to the preset path information to form the test path. The method comprises the following steps: when receiving a data packet, a first network device encapsulates preset path information on the data packet to obtain a test data packet; based on the preset path information, the first network equipment and the second network equipment mutually transmit a test data packet in the test path; when the second network device determines that the second interface receiving the test data packet is the last interface in the test path, the second network device outputs the data packet to the test device based on the test data packet, and the test device determines the detection result of the preset path information based on the data packet, so that the problem that the forwarding path process is inconvenient to test can be solved.

Description

Test method, test system and computer readable storage medium
Technical Field
The invention relates to the technical field of communication testing, in particular to a testing method, a testing system and a computer readable storage medium.
Background
Segment Routing (SR) is a source Routing mechanism that selects a forwarding path through a node and directs forwarding packets to be forwarded along the forwarding path. The ingress node needs to insert a Segment (Segment) list in the packet header, which indicates the node receiving the packet to forward the packet based on the Segment list handling, and the Segment list can be understood as a forwarding path. In an actual network, because the number of nodes (one node is one network device) in a forwarding path of a segment route is large, conditions and cost are not provided in a test environment of a laboratory to simulate the situation of large forwarding path depth in an actual user network, so that the progress test of the forwarding path is inconvenient.
Disclosure of Invention
The application provides a test method, a test system and a computer readable storage medium, which can solve the problem that the forwarding path process is inconvenient to test.
In order to achieve the above purpose, the technical solutions provided in the embodiments of the present application are as follows:
in a first aspect, an embodiment of the present application provides a test method, which is applied to a test system, where the test system includes a first network device and a second network device; the first network device comprises a plurality of first interfaces, the second network device comprises a plurality of second interfaces, the plurality of first interfaces and the plurality of second interfaces are connected according to preset path information to form a test path, and the method comprises the following steps:
when the first network equipment receives a data packet, the first network equipment encapsulates the preset path information into the data packet to obtain a test data packet; based on the preset path information, the first network device and the second network device mutually forward the test data packet in the test path; when the second network device determines that the second interface receiving the test data packet is the last interface in the test path, the second network device outputs a data packet to the test device based on the test data packet, so that the test device determines the detection result of the preset path information based on the data packet.
In the above embodiment, the first network device and the second network device cooperate with each other to build a test path for detecting the preset path information, so that when the preset path information is tested, the test on the preset path information can be realized without other network devices participating in forwarding of the test data packet, and the problem of inconvenience in testing the forwarding path process can be solved.
With reference to the first aspect, in some optional implementations, based on the preset path information, the forwarding, by the first network device and the second network device, the test data packet to each other in the test path includes:
the first network equipment determines a current first output interface in the plurality of first interfaces according to the preset path information; the first network equipment sends the test data packet to the second network equipment through the first output interface; when the second network equipment receives the test data packet, judging whether a second interface receiving the test data packet is the last interface in the test path or not; when the second interface of the second network device receiving the test data packet is not the last interface in the test path, the second network device determines a current second output interface in the plurality of second interfaces according to the preset path information, and sends the test data packet to the first network device through the second output interface, so that the step that the first network device determines the current first output interface in the plurality of first interfaces according to the preset path information until the second network device receives the test data packet is repeatedly executed, and whether the second interface receiving the test data packet is the last interface in the test path is judged until the second network device determines that the second interface receiving the test data packet is the last interface.
In the above embodiment, the first network device and the second network device can implement the test on the preset path information by mutually forwarding the test data packet without other network devices participating in the forwarding of the test data packet, which is helpful to simplify the test operation flow and reduce the test cost.
With reference to the first aspect, in some optional embodiments, when receiving a data packet, the first network device encapsulates the preset path information in the data packet, including:
when receiving a data packet sent by the testing device, the first network device encapsulates the preset path information to the data packet, where the preset path information includes multiple MPLS labels, and is used to query, according to the MPLS labels, interface information of the multiple first interfaces and the multiple second interfaces in a forwarding path, and an interface order of the multiple first interfaces and the multiple second interfaces in the testing path.
In the above embodiment, the first network device and the second network device are convenient to forward the test data packet according to the preset path information by encapsulating the preset path information to the data packet, so as to implement measurement of the preset path information.
With reference to the first aspect, in some optional embodiments, the test system further comprises the test device; the test equipment determines the detection result of the preset path information based on the data packet, and the detection result comprises the following steps:
when the data packet output by the second network device includes the number of first interfaces and/or second interfaces through which the test data packet passes in the forwarding process, the test device determines the depth of a forwarding path corresponding to the preset path information according to the number of the first interfaces or the second interfaces; and when the number of the first interfaces passed by the test data packet in the forwarding process is different from the number of the first interfaces in the preset path information, and/or when the number of the second interfaces passed by the test data packet in the forwarding process is different from the number of the second interfaces in the preset path information, determining that the preset path information is abnormal.
In the above embodiment, by testing the number of the first interfaces and/or the second interfaces through which the data packet passes in the forwarding process, it can be determined whether the budget path information is normal, which can facilitate the determination of the detection result.
With reference to the first aspect, in some optional embodiments, before the first network device and the second network device forward the test data packet to each other in the test path based on the preset path information, the method further includes:
the first network equipment controls the plurality of first interfaces to be in a connected state; the second network device controls the plurality of second interfaces to be in a connected state.
In the above embodiment, by communicating the plurality of first interfaces and the second interfaces, a problem that the test of the preset path information cannot be realized because the data packet cannot be forwarded due to an interface that cannot be normally communicated among the plurality of first interfaces and the second interfaces can be avoided.
In a second aspect, an embodiment of the present application further provides a testing method, which is applied to a first network device, where the first network device is in communication connection with a second network device, the first network device includes a plurality of first interfaces, the second network device includes a plurality of second interfaces, and the plurality of first interfaces and the plurality of second interfaces are connected according to preset path information to form a testing path, where the method includes:
when a data packet is received, packaging the preset path information for the data packet to obtain a test data packet; and mutually forwarding the test data packet in the test path with the second network equipment based on the preset path information, and when the second network equipment determines that a second interface for receiving the test data packet is the last interface in the test path, the second network equipment is used for outputting the data packet to the test equipment based on the test data packet, so that the test equipment determines the detection result of the preset path information based on the data packet.
In a third aspect, an embodiment of the present application further provides a testing method, which is applied to a second network device, where the second network device is in communication connection with a first network device, the first network device includes a plurality of first interfaces, the second network device includes a plurality of second interfaces, the plurality of first interfaces and the plurality of second interfaces are connected according to preset path information to form a testing path, and the method includes:
when a test data packet sent by the first network equipment is received, forwarding the test data packet in the test path with the first network equipment based on preset path information in the test data packet, wherein the test data packet is obtained by encapsulating the preset path information in the data packet when the first network equipment receives the data packet for the first time; and when the second interface for receiving the test data packet is determined to be the last interface in the test path, outputting the data packet to test equipment based on the test data packet, wherein the test equipment is used for determining the detection result of the preset path information based on the data packet.
In a fourth aspect, an embodiment of the present application further provides a test system, where the test system includes a first network device and a second network device; the first network equipment comprises a plurality of first interfaces, the second network equipment comprises a plurality of second interfaces, and the first interfaces and the second interfaces are connected according to preset path information to form a test path;
the first network equipment is used for encapsulating the preset path information into a data packet to obtain a test data packet when receiving the data packet; the first network device is further configured to mutually forward the test data packet in the test path based on the preset path information and the second network device; when the second network device determines that the second interface receiving the test data packet is the last interface in the test path, the second network device is configured to output the data packet to the test device based on the test data packet, and the test device is configured to determine a detection result of the preset path information based on the data packet.
With reference to the fourth aspect, in some optional embodiments, the first network device is further configured to determine a current first output interface in the plurality of first interfaces according to the preset path information;
the first network device is further configured to send the test data packet to the second network device through the first output interface; the second network device is further configured to determine, when receiving the test data packet, whether a second interface that receives the test data packet is a last interface in the test path; when the second interface of the second network device receiving the test data packet is not the last interface in the test path, the second network device is further configured to determine a current second output interface in the plurality of second interfaces according to the preset path information, and send the test data packet to the first network device through the second output interface, so that the step of determining, by the first network device, that the current first output interface is in the plurality of first interfaces according to the preset path information until the second network device receives the test data packet is repeatedly performed, and whether the second interface receiving the test data packet is the last interface in the test path is determined until the second network device determines that the second interface receiving the test data packet is the last interface.
With reference to the fourth aspect, in some optional embodiments, when receiving the data packet sent by the test device, the first network device is further configured to encapsulate the preset path information in the data packet, where the preset path information includes multiple MPLS label information, and is configured to query, according to the label information, interface information of the multiple first interfaces and the multiple second interfaces in the forwarding path, and an interface order of the multiple first interfaces and the multiple second interfaces in the test path.
With reference to the fourth aspect, in some optional embodiments, the test system further comprises the test device;
the test device is further configured to determine, when the data packet output by the second network device includes the number of first interfaces and/or second interfaces through which the test data packet passes in a forwarding process, a depth of a forwarding path corresponding to the preset path information according to the number of the first interfaces or the second interfaces; the test equipment is further configured to determine that the preset path information is abnormal when the number of the first interfaces through which the test data packet passes in the forwarding process is different from the number of the first interfaces in the preset path information, and/or when the number of the second interfaces through which the test data packet passes in the forwarding process is different from the number of the second interfaces in the preset path information.
With reference to the fourth aspect, in some optional embodiments, before the first network device and the second network device forward the test packet to each other in the test path, the first network device is further configured to control the plurality of first interfaces to be in a connected state, and the second network device is further configured to control the plurality of second interfaces to be in a connected state.
In a fifth aspect, the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program runs on a computer, the computer is caused to execute the above method.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly described below. It is appreciated that the following drawings depict only certain embodiments of the application and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
Fig. 1 is a schematic structural diagram of a test system according to an embodiment of the present disclosure.
Fig. 2 is a second schematic structural diagram of a test system according to an embodiment of the present application.
Fig. 3 is a schematic flowchart of a testing method according to an embodiment of the present application.
Fig. 4 is a second flowchart of the testing method according to the embodiment of the present application.
Fig. 5 is a third schematic flowchart of a testing method according to an embodiment of the present application.
Icon: 10-a test system; 20-a first network device; 30-a second network device; 40-test equipment.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. It should be noted that the terms "first," "second," and the like are used merely to distinguish one description from another, and are not intended to indicate or imply relative importance.
Referring to fig. 1, an embodiment of the present application provides a test system 10, which can be used to execute or implement the following test method, and can test a Segment list.
The test system 10 may include a first network device 20 and a second network device 30. The first network device 20 may include a plurality of first interfaces, and the second network device 30 includes a plurality of second interfaces, and the plurality of first interfaces and the plurality of second interfaces are connected in a serpentine shape according to the preset path information to form the test path.
Understandably, the plurality of first interfaces may be all interfaces in the first network device 20, or may be a part of interfaces in the first network device 20. The plurality of second interfaces may be all interfaces in the second network device 30, or may be a part of interfaces in the second network device 30.
The first network device 20 may be, but is not limited to, a router, a switch, etc., and the second network device 30 is the same as or similar to the first network device 20, e.g., the second network device 30 may be a router, a switch, etc.
Referring to fig. 2, as an alternative embodiment, the test system 10 may further include a test device 40. The number of test apparatuses 40 may be one or two. For example, if there is one testing device 40, the testing device 40 can be connected to the first network device 20 and the second network device 30 at the same time. If there are two test devices 40, one of the test devices 40 may be connected to the first network device 20, and is configured to send a data packet for performing a forwarding path test to the first network device 20; another testing device 40 is connected to the second network device 30, and is configured to receive the data packet fed back by the second network device 30, and detect the integrity and validity of the forwarding path according to the received data packet.
The testing Device 40 may be, but is not limited to, a Personal Computer (PC), a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), etc., and may be configured to send a packet for measuring the Segment list to the network Device, forward the packet through the first network Device 20 and the second network Device 30, and measure the integrity and validity of the Segment list according to the packet fed back by the second network Device 30. Wherein the Segment list can be understood as a forwarding path.
Referring to fig. 3, an embodiment of the present application further provides a testing method, which can be applied to the testing system 10. The devices in test system 10 may cooperate to implement the steps of the test method to implement the Segment list test.
The test method shown in fig. 3 will be explained in detail below:
in step S210, when receiving the data packet, the first network device 20 encapsulates the preset path information into the data packet to obtain a test data packet.
When receiving the data packet, the first network device 20 may parse the data packet to determine whether to encapsulate the preset path information to the data packet, or the first network device 20 directly encapsulates the preset path information to the received data packet. The preset path information may be a Segment list designed by human in advance, and the Segment list may be used as a forwarding path of the packet. The data packet may be used to test a forwarding path of the Segment list, and the content of the data packet may be set according to an actual situation, which is not specifically limited herein.
The principle of determining whether the preset path information needs to be encapsulated in the data packet may be: for example, if the received data packet is a data packet directly received from the testing device 40, or the data packet is received for the first time, the data packet is encapsulated with the predetermined path information.
Step S210 may include: when receiving the data packet sent by the testing device 40, the first network device 20 encapsulates the preset path information into the data packet, where the preset path information includes MPLS (Multi-Protocol Label Switching) Label information of a forwarding path, and is used to query interface information of the plurality of first interfaces and the plurality of second interfaces in the forwarding path and interface orders of the plurality of first interfaces and the plurality of second interfaces in the testing path according to the MPLS Label information. The MPLS label information may be set according to an actual situation.
In this embodiment, the first network device 20 may encapsulate the received data packet with the preset path information when receiving the data packet from the testing device 40, and may not need to encapsulate the preset path information for the data packet received in other cases. For example, when receiving the data packet sent by the second network device 30, the first network device 20 does not need to encapsulate the preset path information in the data packet sent by the second network device 30.
The data packet encapsulated with the preset path information may be used as a test data packet. Understandably, the test data packet includes the preset path information, so that the test data packet is forwarded by the first network device 20 and the second network device 30 according to the forwarding path in the preset path information. After receiving the test data packet, the first network device 20 or the second network device 30 does not need to encapsulate the preset path information in the test data packet.
In this embodiment, the interface information of the preset path information may include, but is not limited to, an IP address, an interface number, and the like of the interface. The interface order in the test path may be set according to the forwarding interface order in the Segment list.
For example, in the Segment list, the sequence of forwarding the test packets is set as follows: the first interface N in the first network device 20 is sent to the second interface N in the second network device 30, then the second interface N +1 in the second network device 30 is sent to the first interface N +1 in the first network device 20, and then the first interface N +2 in the first network device 20 is sent to the second interface N +2 in the second network device 30, until the plurality of first interfaces in the first network device 20 and the plurality of second interfaces in the second network device 30 are traversed. Wherein, N is a positive integer greater than or equal to 1, and is used to refer to the numbers of the first interface and the second interface.
When the first network device 20 and the second network device 30 are connected, the first interface with the interface number N and the second interface with the interface number N may be connected, and the connected first interface and the connected second interface are configured as IP addresses of the same network segment, and the unconnected first interface and the unconnected second interface are configured as IP addresses of different network segments.
As an optional implementation manner, when designing the Segment list, the sequence of forwarding the test packets may also be set to be other sequences, for example: the data packet is sent from the first interface N in the first network device 20 to the second interface N +1 in the second network device 30, then sent from the second interface N +2 in the second network device 30 to the first interface N +1 in the first network device 20, and then sent from the first interface N +2 in the first network device 20 to the second interface N +3 in the second network device 30, that is, the data packet is forwarded in the first interface and the second interface with different interface numbers. When the first network device 20 and the second network device 30 are connected, the interfaces in the forwarding paths in the Segment list are connected in sequence. For example, the first interface with the interface number N is connected to the second interface with the interface number N +1, and the first interface with the interface number N +1 is connected to the second interface with the interface number N + 2. The first interface and the second interface which are connected are configured to be IP addresses of the same network segment, and the first interface and the second interface which are not connected are configured to be IP addresses of different network segments.
Step S220, based on the preset path information, the first network device 20 and the second network device 30 mutually forward the test data packet in the test path.
In this embodiment, the first network device 20 and the second network device 30 may forward the test packet to each other in the test path according to the preset path information.
For example, step 220 may include:
the first network device 20 determines a current first output interface among the plurality of first interfaces according to the preset path information;
the first network device 20 sends the test data packet to the second network device 30 through the first output interface;
when receiving the test data packet, the second network device 30 determines whether the second interface receiving the test data packet is the last interface in the test path;
when the second interface on which the second network device 30 receives the test packet is not the last interface in the test path, the second network device 30 determines a current second output interface among the plurality of second interfaces according to the preset path information, and sends the test data packet to the first network device 20 via the second output interface, so as to repeatedly execute the determination of the current first output interface in the plurality of first interfaces by the first network device 20 according to the preset path information to the second network device 30 when the test data packet is received, and judging whether the second interface receiving the test data packet is the last interface in the test path or not until the second network device 30 determines that the second interface receiving the test data packet is the last interface.
Understandably, the preset path information may include the sequence of the data packets passing through each interface and the corresponding interface numbers. For example, assuming that the forwarding path of the preset path information is the same as the test path, the following are both: a first interface 1 and a second interface 1; a second interface 2, a first interface 2; the first interface 3, the second interface 3, and the second interface 3 is the last interface in the test path. Based on the order, the first network device 20 may determine that the first interface 1 is the current first output interface, and then the first network device 20 transmits the first output interface and the second interface 1 to the second network device 30.
When receiving the test data packet, the second network device 30 may determine whether the second interface 1 receiving the test data packet is the last interface in the test path. Because the second interface 1 is not the last interface in the test path, the second network device 30 may determine that the second interface 2 is the current second output interface based on the preset path information, and send the test packet to the first network device 20 through the second output interface and the first interface 2, and then repeat the above-mentioned test packet forwarding steps by the first network device 20 and the second network device 30. When the second interface 3 receives the test data packet, the second network device 30 may determine that the second interface receiving the test data packet is the last interface in the test path, and at this time, may stop forwarding the test data packet to the first network device 20.
As an alternative embodiment, the first network device 20 may be a first interface of each hop determined based on the preset path information when encapsulating the preset path information to the data packet; likewise, the second network device 30 may be a second interface of each hop determined based on the preset path information when the test packet encapsulating the preset path information is received for the first time. In forwarding the test packets, the test packets may be forwarded to each other based on the first and second interface orders determined by the first and second network devices 20 and 30. Based on this, the first network device 20 may not need to determine the current first output interface each time a test packet is received; likewise, the second network device 30 may not need to determine the current second output interface each time a test packet is received.
Prior to step S220, the method may include the first network device 20 controlling the plurality of first interfaces to be in a connected (UP) state; the second network device 30 controls the plurality of second interfaces to be in a connected (UP) state.
In this embodiment, the first network device 20 may control all of its first interfaces to be in a connected state, or may control a plurality of first interfaces that need to be tested to be in a connected state. Similarly, the second network device 30 may control all its second interfaces to be in a connected state, or may control a plurality of second interfaces to be tested to be in a connected state. The specific number of the first interface and the second interface which need to be communicated with each other can be set according to actual conditions, and is not limited specifically here.
In this embodiment, before testing the preset path information, it is usually necessary to ensure that the plurality of first interfaces in the first network device 20 can be normally connected, and the plurality of second interfaces in the second network device 30 can be normally connected, so as to avoid a problem that the data packet cannot be forwarded due to the existence of the interface that cannot be normally connected in the first interfaces and the second interfaces, so that the test of the preset path information cannot be implemented.
In step S230, when the second network device 30 determines that the second interface receiving the test data packet is the last interface in the test path, the second network device 30 outputs a data packet to the test device 40 based on the test data packet, so that the test device 40 determines the detection result of the preset path information based on the data packet.
In this embodiment, the second network device 30 may output the forwarded result packet to the test device 40, where the result packet may include a packet sent by the test device 40 to the first network device 20. The test device 40 may obtain the detection result of the preset path information by analyzing the result data packet. The detection result may be a first result indicating that the preset path information is normal or a second result indicating that the preset path information is abnormal. The preset path information can be normally understood that the actual depth of the forwarding path in the preset path information is the same as the depth obtained by the test, and the forwarding of the test data packet can be realized through the forwarding path, that is, the forwarding path is complete and correct. If the forwarding path is incomplete or incorrect, a detection result indicating that the preset path information is abnormal can be obtained.
For example, step S230 may include: when the data packet output by the second network device 30 includes the number of the first interfaces and/or the second interfaces through which the test data packet passes in the forwarding process, the test device 40 determines the depth of the forwarding path corresponding to the preset path information according to the number of the first interfaces or the second interfaces.
The data packet output by the second network device 30 to the test device 40 may include: the number of the first interfaces passed by the test data packet in the forwarding process, or the number of the first interfaces and the number of the second interfaces passed by the test data packet in the forwarding process.
The test apparatus 40 may determine the depth of the forwarding path according to the number of the first interfaces through which the test data packet passes, or according to the number of the second interfaces, or according to the number of the first interfaces and the number of the second interfaces. The depth of the forwarding path is the number of first interfaces or second interfaces. For example, if the number of the first interfaces through which the test data packet passes is 255, the depth of the forwarding path corresponding to the preset path information is 255.
When the number of first interfaces passed by the test data packet in the forwarding process is different from the number of first interfaces in the preset path information, or when the number of second interfaces passed by the test data packet in the forwarding process is different from the number of second interfaces in the preset path information, or when the number of first interfaces passed by the test data packet in the forwarding process is different from the number of first interfaces in the preset path information, and the number of second interfaces passed by the test data packet in the forwarding process is different from the number of second interfaces in the preset path information, it is determined that the preset path information is abnormal.
In this embodiment, when the test packet passes through each first interface, the second network device 30 may record, in the packet, interface information of the first interface that successfully passes through; or when the test data packet passes through one second interface each time, the first network device 20 records the interface information of the first interface that successfully passes through in the data packet; alternatively, the second network device 30 may record interface information of the successfully passed first interface in the test packet every time the test packet passes through one first interface, and the first network device 20 may record interface information of the successfully passed first interface in the test packet every time the test packet passes through one second interface. The second network device 30 may send interface information (such as an IP address) recorded in the test packet to the test device 40, which indicates the first interface and the second interface through which the test packet passes.
The test device 40 may determine the number of the first interfaces and the number of the second interfaces through which the test data packet passes according to interface information indicating the first interfaces and the second interfaces through which the test data packet passes in the data packet sent by the second network device 30.
To facilitate understanding by those skilled in the art, the following will illustrate the flow of the test method:
referring to fig. 2 again, first, assuming that the actual depth of the Segment list (preset path information) to be tested is 255, when connecting two network devices, the interfaces of the first network device 20 and the second network device 30 with the same interface number are paired, and an IP address is set; interface 1 of the first network device 20 sets the IP address a1, and interface 1 of the second network device 30 sets the IP address b 1; the interface 2 of the first network device 20 sets the IP address to be a2, the interface 2 of the second network device 30 sets the IP address to be b2, the same network Segment of a1 and b1, the different network Segment between a1 and a2, and so on, until the interfaces required by the test Segment list are satisfied.
Secondly, the interfaces with the same number between the first network device 20 and the second network device 30 are connected through a physical line, so that the interfaces are in a connected state; configuring Segment routing on the first network device 20, where an output interface corresponding to Segment list stack top information is interface 1, and a next hop address is b 1; the second network device 30 is configured with Segment routing, the output interface corresponding to the second layer information of the Segment list is interface 2, the next hop is a2, and so on, the interfaces of the first network device 20 and the second network device 30 are networked by snake-shaped networking until 255 interfaces are configured on the first network device 20 and the second network device 30, respectively.
In the testing process, the data packet sent by the testing device 40 encapsulates the complete Segment list with the depth of 255 layers on the first network device 20, finds that the outlet interface is interface 1 and the next hop address is b1 according to the stack top information of the Segment list, and sends the Segment list of the data packet to the second network device 30 through the interface 1 after popping the Segment list of the first layer of the stack top.
The second network device 30 checks the stack top information of the current Segment list after receiving the data packet, finds that the outlet interface is interface 2 according to the stack top information of the Segment list, the next hop address is a2, pops the Segment list of the data packet out of the first layer Segment of the stack top, and sends the Segment list of the data packet to the first network device 20 through the interface 2, and so on, finally, supposing that the interface 255 of the second network device 30 receives the data packet, then outputs the result data packet to the test device 40 based on the IP path passed by the data packet, and the test device 40 can determine the number of the first interfaces or the number of the second interfaces passed by the data packet according to the IP path in the result data packet, thereby determining the depth of the Segment list.
Based on the above design, the first network device 20 and the second network device 30 cooperate with each other to build a test path for detecting the preset path information, so that when the preset path information is tested, the preset path information can be tested without other network devices, and the problem of inconvenience in testing the forwarding path process can be solved. Compared with the traditional method that 255 network devices are needed to realize the Segment list test with the depth of 255, the method and the device can realize the Segment list test with the depth of 255 through two network devices, thereby being beneficial to reducing the number of the network devices needing to participate in forwarding the data packet and reducing the test cost.
Referring to fig. 4, an embodiment of the present application further provides a testing method applied to the first network device 20, and the first network device 20 may perform or implement the steps of the testing method.
Step S310, when a data packet is received, the preset path information is packaged in the data packet to obtain a test data packet;
step S320, based on the preset path information, mutually forwarding the test data packet with the second network device 30 in the test path, and when the second network device 30 determines that the second interface receiving the test data packet is the last interface in the test path, the second network device 30 is configured to output a data packet to the test device 40 based on the test data packet, so that the test device 40 determines the detection result of the preset path information based on the data packet.
Understandably, the first network device 20 can cooperate with the second network device 30 to implement the forwarding path test. For details of each step of the testing method executed by the first network device 20, reference may be made to corresponding steps in the testing method shown in fig. 3, which is not described herein again.
Referring to fig. 5, an embodiment of the present application further provides a testing method applied to the second network device 30, and the second network device 30 may perform or implement the steps of the testing method.
Step S410, when receiving a test data packet sent by the first network device 20, mutually forwarding the test data packet in the test path with the first network device 20 based on preset path information in the test data packet, where the test data packet is a data packet obtained by encapsulating, by the first network device 20, the preset path information when receiving the data packet for the first time;
step S420, when it is determined that the second interface receiving the test data packet is the last interface in the test path, outputting a data packet to the test device 40 based on the test data packet, where the data packet is used by the test device 40 to determine a detection result of the preset path information based on the data packet.
Understandably, the second network device 30 may interact with the first network device 20 to implement the forwarding path test. The details of each step of the testing method executed by the second network device 30 may refer to corresponding steps in the testing method shown in fig. 3, and are not described herein again.
Referring to fig. 1 again, in the test system 10 provided in the embodiment of the present application, when the above-mentioned test method is executed, the functional roles of the respective devices may be as follows:
the first network device 20 is configured to, when receiving a data packet, encapsulate the preset path information in the data packet to obtain a test data packet.
The first network device 20 is further configured to forward the test data packet to the second network device 30 in the test path based on the preset path information.
When the second network device 30 determines that the second interface receiving the test data packet is the last interface in the test path, the second network device 30 is configured to output a data packet to the test device 40 based on the test data packet, and the test device 40 is configured to determine a detection result of the preset path information based on the data packet.
Optionally, the first network device 20 is further configured to determine a current first output interface in the plurality of first interfaces according to the preset path information.
The first network device 20 is further configured to send the test data packet to the second network device 30 through the first output interface.
The second network device 30 is further configured to determine, when receiving the test data packet, whether the second interface receiving the test data packet is the last interface in the test path.
When the second interface on which the second network device 30 receives the test packet is not the last interface in the test path, the second network device 30 is further configured to determine a current second output interface among the plurality of second interfaces according to the preset path information, and sends the test data packet to the first network device 20 via the second output interface, so as to repeatedly execute the determination of the current first output interface in the plurality of first interfaces by the first network device 20 according to the preset path information to the second network device 30 when the test data packet is received, and judging whether the second interface receiving the test data packet is the last interface in the test path or not until the second network device 30 determines that the second interface receiving the test data packet is the last interface.
Optionally, when receiving the data packet sent by the testing device 40, the first network device 20 is further configured to encapsulate the preset path information in the data packet, where the preset path information includes MPLS label information of a forwarding path, and is configured to query, according to the MPLS label information, interface information of the plurality of first interfaces and the plurality of second interfaces in the forwarding path, and an interface order of the plurality of first interfaces and the plurality of second interfaces in the testing path.
Optionally, the test system 10 further comprises the test apparatus 40. The test device 40 is further configured to determine, according to the number of the first interfaces or the second interfaces, a depth of a forwarding path corresponding to the preset path information when the data packet output by the second network device 30 includes the number of the first interfaces and/or the second interfaces through which the test data packet passes in the forwarding process;
the test device 40 is further configured to determine that the preset path information is abnormal when the number of the first interfaces through which the test data packet passes in the forwarding process is different from the number of the first interfaces in the preset path information, and/or when the number of the second interfaces through which the test data packet passes in the forwarding process is different from the number of the second interfaces in the preset path information.
Optionally, before the first network device 20 and the second network device 30 mutually forward the test data packet in the test path, the first network device 20 is further configured to control the plurality of first interfaces to be in a connected state, and the second network device 30 is further configured to control the plurality of second interfaces to be in a connected state.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working process of the test system 10 described above may refer to the corresponding process of each step in the foregoing method, and will not be described in detail herein.
The embodiment of the application also provides a computer readable storage medium. The readable storage medium has stored therein a computer program which, when run on a computer, causes the computer to perform the test method as described in the above embodiments.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by hardware, or by software plus a necessary general hardware platform, and based on such understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments of the present application.
In summary, the present application provides a testing method, a testing system and a computer readable storage medium. The method can be applied to a test system, wherein the test system comprises a first network device and a second network device; the first network equipment comprises a plurality of first interfaces, the second network equipment comprises a plurality of second interfaces, the plurality of first interfaces and the plurality of second interfaces are connected according to preset path information to form a test path, and the method comprises the following steps: when receiving a data packet, a first network device encapsulates preset path information on the data packet to obtain a test data packet; based on the preset path information, the first network equipment and the second network equipment mutually transmit a test data packet in the test path; and when the second network equipment determines that the second interface for receiving the test data packet is the last interface in the test path, the second network equipment outputs the data packet to the test equipment based on the test data packet, and the test equipment determines the detection result of the preset path information based on the data packet. In the scheme, the first network equipment and the second network equipment are matched with each other to build the test path for detecting the preset path information, so that when the preset path information is tested, the test on the preset path information can be realized without other network equipment participating in the forwarding of the test data packet, and the problem that the test on the forwarding path process is inconvenient can be solved.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus, system, and method may be implemented in other ways. The apparatus, system, and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, 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).
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.

Claims (11)

1. A test method is characterized in that the test method is applied to a test system, the test system comprises a first network device and a second network device, and the first network device and the second network device are both configured with segmented routes; the first network device comprises a plurality of first interfaces, the second network device comprises a plurality of second interfaces, the plurality of first interfaces and the plurality of second interfaces are connected according to preset path information to form a test path, and the method comprises the following steps:
when the first network equipment receives a data packet, the first network equipment encapsulates the preset path information on the data packet to obtain a test data packet, wherein the preset path information is a segmented list;
based on the preset path information, the first network device and the second network device mutually forward the test data packet in the test path;
when the second network device determines that the second interface receiving the test data packet is the last interface in the test path, the second network device outputs a data packet to the test device based on the test data packet, so that the test device determines a detection result of the preset path information based on the data packet, the detection result is a first result indicating that the preset path information is normal or a second result indicating that the preset path information is abnormal, and the detection result includes a depth of a forwarding path corresponding to the preset path information.
2. The method of claim 1, wherein forwarding the test packet to each other in the test path by the first network device and the second network device based on the preset path information comprises:
the first network equipment determines a current first output interface in the plurality of first interfaces according to the preset path information;
the first network equipment sends the test data packet to the second network equipment through the first output interface;
when the second network equipment receives the test data packet, judging whether a second interface receiving the test data packet is the last interface in the test path or not;
when the second interface of the second network device receiving the test data packet is not the last interface in the test path, the second network device determines a current second output interface in the plurality of second interfaces according to the preset path information, and sends the test data packet to the first network device through the second output interface, so that the step that the first network device determines the current first output interface in the plurality of first interfaces according to the preset path information until the second network device receives the test data packet is repeatedly executed, and whether the second interface receiving the test data packet is the last interface in the test path is judged until the second network device determines that the second interface receiving the test data packet is the last interface.
3. The method according to claim 1, wherein the first network device encapsulates the preset path information on the data packet when receiving the data packet, and comprises:
when receiving a data packet sent by the testing device, the first network device encapsulates the preset path information to the data packet, where the preset path information includes MPLS label information of a forwarding path, and is used to query interface information of the plurality of first interfaces and the plurality of second interfaces in the forwarding path according to the MPLS label information, and interface orders of the plurality of first interfaces and the plurality of second interfaces in the testing path.
4. The method of claim 1, wherein the test system further comprises the test equipment;
the test equipment determines the detection result of the preset path information based on the data packet, and the detection result comprises the following steps:
when the data packet output by the second network device includes the number of first interfaces and/or second interfaces through which the test data packet passes in the forwarding process, the test device determines the depth of a forwarding path corresponding to the preset path information according to the number of the first interfaces or the second interfaces;
and when the number of the first interfaces passed by the test data packet in the forwarding process is different from the number of the first interfaces in the preset path information, and/or when the number of the second interfaces passed by the test data packet in the forwarding process is different from the number of the second interfaces in the preset path information, determining that the preset path information is abnormal.
5. A testing method is applied to a first network device, the first network device is in communication connection with a second network device, both the first network device and the second network device are configured with segment routing, the first network device comprises a plurality of first interfaces, the second network device comprises a plurality of second interfaces, the plurality of first interfaces and the plurality of second interfaces are connected according to preset path information to form a testing path, and the method comprises:
when a data packet is received, packaging the preset path information for the data packet to obtain a test data packet;
based on the preset path information, mutually forwarding the test data packet in the test path with the second network device, and when the second network device determines that a second interface receiving the test data packet is the last interface in the test path, the second network device is used for outputting the data packet to the test device based on the test data packet, so that the test device determines a detection result of the preset path information based on the data packet, wherein the preset path information is a segment list, the detection result is a first result indicating that the preset path information is normal or a second result indicating that the preset path information is abnormal, and the detection result includes the depth of the forwarding path corresponding to the preset path information.
6. A testing method is applied to a second network device, the second network device is in communication connection with a first network device, the first network device and the second network device are both configured with segment routing, the first network device includes a plurality of first interfaces, the second network device includes a plurality of second interfaces, the plurality of first interfaces and the plurality of second interfaces are connected according to preset path information to form a testing path, and the method includes:
when a test data packet sent by the first network equipment is received, forwarding the test data packet in the test path with the first network equipment based on preset path information in the test data packet, wherein the test data packet is obtained by encapsulating the preset path information in the data packet when the first network equipment receives the data packet for the first time, and the preset path information is a segment list;
and when determining that the second interface receiving the test data packet is the last interface in the test path, outputting the data packet to test equipment based on the test data packet, wherein the test equipment is used for determining a detection result of the preset path information based on the data packet, the detection result is a first result indicating that the preset path information is normal or a second result indicating that the preset path information is abnormal, and the detection result includes the depth of a forwarding path corresponding to the preset path information.
7. A test system is characterized in that the test system comprises a first network device and a second network device, wherein the first network device and the second network device are both configured with segmented routes; the first network equipment comprises a plurality of first interfaces, the second network equipment comprises a plurality of second interfaces, and the first interfaces and the second interfaces are connected according to preset path information to form a test path;
the first network device is used for encapsulating the preset path information into a data packet to obtain a test data packet when receiving the data packet, wherein the preset path information is a segmented list;
the first network device is further configured to mutually forward the test data packet in the test path based on the preset path information and the second network device;
when the second network device determines that the second interface receiving the test data packet is the last interface in the test path, the second network device is configured to output the data packet to the test device based on the test data packet, the test device is configured to determine a detection result of the preset path information based on the data packet, where the detection result is a first result indicating that the preset path information is normal or a second result indicating that the preset path information is abnormal, and the detection result includes a depth of a forwarding path corresponding to the preset path information.
8. The test system of claim 7, wherein the first network device is further configured to determine a current first output interface among the plurality of first interfaces according to the preset path information;
the first network device is further configured to send the test data packet to the second network device through the first output interface;
the second network device is further configured to determine, when receiving the test data packet, whether a second interface that receives the test data packet is a last interface in the test path;
when the second interface of the second network device receiving the test data packet is not the last interface in the test path, the second network device is further configured to determine a current second output interface in the plurality of second interfaces according to the preset path information, and send the test data packet to the first network device through the second output interface, so that the step of determining, by the first network device, that the current first output interface is in the plurality of first interfaces according to the preset path information until the second network device receives the test data packet is repeatedly performed, and whether the second interface receiving the test data packet is the last interface in the test path is determined until the second network device determines that the second interface receiving the test data packet is the last interface.
9. The test system according to claim 7, wherein the first network device, upon receiving the data packet sent by the test device, is further configured to encapsulate the preset path information in the data packet, where the preset path information includes MPLS label information of a forwarding path, and is configured to query, according to the MPLS label information, interface information of the plurality of first interfaces and the plurality of second interfaces in the forwarding path, and an interface order of the plurality of first interfaces and the plurality of second interfaces in the test path.
10. The test system of claim 7, further comprising the test equipment;
the test device is further configured to determine, when the data packet output by the second network device includes the number of first interfaces and/or second interfaces through which the test data packet passes in a forwarding process, a depth of a forwarding path corresponding to the preset path information according to the number of the first interfaces or the second interfaces;
the test equipment is further configured to determine that the preset path information is abnormal when the number of the first interfaces through which the test data packet passes in the forwarding process is different from the number of the first interfaces in the preset path information, and/or when the number of the second interfaces through which the test data packet passes in the forwarding process is different from the number of the second interfaces in the preset path information.
11. A computer-readable storage medium, in which a computer program is stored which, when run on a computer, causes the computer to carry out the method according to any one of claims 1-6.
CN201910644109.1A 2019-07-16 2019-07-16 Test method, test system and computer readable storage medium Active CN110233779B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910644109.1A CN110233779B (en) 2019-07-16 2019-07-16 Test method, test system and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910644109.1A CN110233779B (en) 2019-07-16 2019-07-16 Test method, test system and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110233779A CN110233779A (en) 2019-09-13
CN110233779B true CN110233779B (en) 2021-08-06

Family

ID=67855645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910644109.1A Active CN110233779B (en) 2019-07-16 2019-07-16 Test method, test system and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110233779B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113037581B (en) * 2019-12-24 2024-02-27 迈普通信技术股份有限公司 Backboard channel testing method and device, board card and computer readable storage medium
CN115333980B (en) * 2021-05-11 2023-10-20 中国联合网络通信集团有限公司 Test method, second edge node equipment and edge gateway
CN114465924B (en) * 2021-12-24 2023-12-22 阿里巴巴(中国)有限公司 Network equipment testing method, data packet generating method and switching chip

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102355377A (en) * 2011-06-30 2012-02-15 迈普通信技术股份有限公司 Entire test system and method for Ethernet switch
CN107222332A (en) * 2017-05-05 2017-09-29 北京神州新桥科技有限公司 Method of testing, device, system and machinable medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7764689B2 (en) * 2005-09-16 2010-07-27 Hewlett-Packard Development Company, L.P. Method and apparatus for arbitrating data packets in a network system
CN104954205B (en) * 2015-07-22 2018-03-27 上海斐讯数据通信技术有限公司 A kind of soft routing performance method of testing

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102355377A (en) * 2011-06-30 2012-02-15 迈普通信技术股份有限公司 Entire test system and method for Ethernet switch
CN107222332A (en) * 2017-05-05 2017-09-29 北京神州新桥科技有限公司 Method of testing, device, system and machinable medium

Also Published As

Publication number Publication date
CN110233779A (en) 2019-09-13

Similar Documents

Publication Publication Date Title
CN110233779B (en) Test method, test system and computer readable storage medium
WO2019128950A1 (en) Packet processing method, network node, and system
KR102290923B1 (en) Bit-forwarding ingress router, bit-forwarding router, and operation, administration and maintenance detection method
CN108111432B (en) Message forwarding method and device
CN107517119B (en) Virtual network detection method and device in VPC environment
WO2018054397A1 (en) Service function chain detection path method and device
CN112751733B (en) Link detection method, device, equipment, system and switch
US9641419B2 (en) Methods and systems for providing background pretesting of communications or storage network equipment
CN104702468B (en) Determine the method, apparatus and system of transmission path
US11133980B2 (en) Detecting sources of computer network failures
JP2007259069A (en) Switch apparatus
JP6443864B2 (en) Method, apparatus and system for implementing packet loss detection
EP3591899B1 (en) Path detection
CN113709043B (en) Path tracking method and device
JP2018191279A (en) Method for test traffic generation and inspection, and associated switch input port or output port and switch
CN115022161A (en) Network delay fault positioning method and device and network delay fault detection equipment
EP3474493A1 (en) Network performance measurement method and detection device
CN113179189B (en) Method and device for detecting segment route faults, first segment route and destination route
CN110248379A (en) The performance test methods and device of base station in WLAN
CN108259335A (en) Path detection method and apparatus
JP2005142976A (en) Communication tester
CN112350844A (en) Method and device for data transmission
CN113904972B (en) Path detection method and device, controller and PE (polyethylene) equipment
WO2022222479A1 (en) Network detection method and apparatus, and device and storage medium
CN113890858A (en) PMTU detection method and device

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