Disclosure of Invention
The technical problem to be solved by the invention is as follows: the tested communication equipment, the communication equipment port data forwarding test system and the communication equipment port data forwarding test method are provided, and the problems that the traditional test scheme cannot be self-adaptive to the test of any connection mode of the port, so that the test is complex and is inconvenient to manage, and the actual operation of a factory is not facilitated are solved.
In order to solve the above technical problem, in one aspect, an embodiment of the present invention provides a device under test, where two ports of the same type in the device under test are connected to each other; the communication device under test comprises:
the port packet sending module is used for sending a specific data packet containing self port information to the outside through each port before the data forwarding test;
the port analysis module is used for carrying out port analysis after receiving the specific data packets sent by other ports to acquire physical interconnection information of the port and other ports;
the port configuration module is used for carrying out virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type and configuring all the ports into a chained data flow link formed by physical interconnection and a virtual network;
the test packet sending module is used for constructing a test message according to the port configuration condition and sending the test message to the data flow link;
and the counting and judging module is used for counting and comparing the number of the sent messages and the number of the received messages of different ports in the chain data flow link so as to judge whether the ports are normal or not.
As a further optimization, the port configuration module is specifically configured to:
according to the physical interconnection information of all ports of the same type, two ports which are not physically interconnected are arbitrarily selected to be respectively used as a test packet sending port and a test packet receiving port and are divided into different virtual networks; and carrying out virtual network division on the rest ports according to the rule that two ports which are physically interconnected are divided into different virtual networks, thereby configuring all the ports into a chained data stream link formed by the physical interconnection and the virtual networks.
As a further optimization, the test packet sending module is specifically configured to:
and constructing a test message with the MAC address of the test packet sending port as a source address and the MAC address of the test packet receiving port as a destination address, and sending the test message through the test packet sending port.
In a second aspect, an embodiment of the present invention further provides a method for testing port data forwarding of a communication device applied to the communication device under test, including the following steps:
a. before data forwarding test, each port sends a specific data packet containing self port information to the outside;
b. each port analyzes the port after receiving the specific data packet sent by other ports to acquire the physical interconnection information of the port and other ports;
c. carrying out virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type, and configuring all the ports into a chained data flow link formed by physical interconnection and a virtual network;
d. the CPU of the tested communication equipment constructs a test message and sends the test message to the chained data flow link;
e. and counting and comparing the number of the sent messages and the number of the received messages of the two ports in the chain data flow link, thereby judging whether the ports are normal.
As a further optimization, in step c, the performing virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type specifically includes:
according to the physical interconnection information of all ports of the same type, two ports which are not physically interconnected are arbitrarily selected as a test packet sending port and a test packet receiving port and are divided into different virtual networks; and carrying out virtual network division on the rest ports according to the rule that two ports which are physically interconnected are divided into different virtual networks.
As a further optimization, in step d, the CPU of the communication device under test constructs a test packet, and sends the test packet to the chain data flow link, specifically including:
the CPU of the tested communication equipment constructs a test message with the MAC address of the test packet sending port as a source address and the MAC address of the test packet receiving port as a destination address, and sends the test message through the test packet sending port.
In a third aspect, an embodiment of the present invention provides a communication device port data forwarding test system, including a communication device under test and a tester; the communication equipment to be tested is connected to a data sending port and a data receiving port of the tester through two ports in the ports of the same type, and other ports of the communication equipment to be tested are connected in pairs;
the communication device under test comprises:
the port packet sending module is used for sending a specific data packet containing self port information to the outside before the data forwarding test;
the port analysis module is used for carrying out port analysis after receiving the specific data packets sent by other ports to acquire physical interconnection information of the port and other ports;
the port configuration module is used for carrying out virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type and configuring all the ports into a ring-type data flow link formed by physical interconnection and a virtual network;
the tester is used for constructing a test message and sending the test message to the ring type data flow link; and counting and comparing the number of the test messages sent by the data sending port of the tester with the number of the test messages received by the data receiving port, thereby judging whether the port of the tested communication equipment is normal or not.
As a further optimization, the port configuration module is specifically configured to:
and according to the physical interconnection information of all the ports of the same type, carrying out virtual network division on all the ports of the same type according to the rule that two ports of the physical interconnection are divided into different virtual networks, thereby configuring all the ports into a ring type data flow link formed by the physical interconnection and the virtual networks.
In a fourth aspect, an embodiment of the present invention further provides a method for testing port data forwarding of a communication device applied to the test system, including the following steps:
a. before data forwarding test, each port sends a specific data packet containing self port information to the outside;
b. each port analyzes the port after receiving the specific data packet sent by other ports to acquire the physical interconnection information of the port and other ports;
c. carrying out virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type, and configuring all the ports into a ring type data flow link formed by physical interconnection and a virtual network;
d. disconnecting any two physically interconnected ports, and accessing a data sending port and a data receiving port of the tester;
e. the tester constructs a test message and sends the test message to the ring type data flow link;
f. and counting and comparing the number of the test messages sent by the data sending port of the tester with the number of the test messages received by the data receiving port, so as to judge whether the port of the tested communication equipment is normal.
As a further optimization, in step c, the performing virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type specifically includes:
and according to the physical interconnection information of all the ports of the same type, dividing all the ports of the same type into different virtual networks according to the rule that two ports which are physically interconnected are divided into different virtual networks, and carrying out virtual network division.
The invention has the beneficial effects that: identifying the physical interconnection mode of every two ports before forwarding test, automatically dividing a virtual network (vlan or vrf) according to the identified port interconnection condition, configuring all the ports of the same type into a chain type or ring type data flow link which is formed by physical interconnection and the virtual network and can be used for data forwarding test, and counting and comparing the quantity of data packets sent and received by the ports in the data flow link after sending the packets to the chain type or ring type data flow link, thereby testing whether the ports are normal;
the scheme can automatically adapt to any connection mode of the port, so that the connection mode in the test has great flexibility, the test fixture can be compatible with different connection modes, and the test fixture is convenient to upgrade or replace.
Detailed Description
The invention aims to provide tested communication equipment, a communication equipment port data forwarding test system and a communication equipment port data forwarding test method, and solves the problems that the traditional test scheme cannot be used for testing in any connection mode of a self-adaptive port, so that the test is complex and inconvenient to manage, and the actual operation of a factory is not facilitated. According to the invention, before formal packet sending test, each port of the tested communication equipment sends a data packet carrying port information of the tested communication equipment, the physical connection relation of the ports is automatically obtained by analyzing the port information contained in the received data packet, and then the vlan or vrf configuration is automatically carried out, so that the test scheme can flexibly adapt to various connection conditions and even any connection mode.
In the communication device under test of the present invention, the same type of ports are connected two by two, as shown in fig. 1, the communication device under test includes:
the port packet sending module is used for sending a specific data packet containing self port information to the outside through each port before the data forwarding test;
the port analysis module is used for carrying out port analysis after receiving the specific data packets sent by other ports to acquire physical interconnection information of the port and other ports;
the port configuration module is used for carrying out virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type and configuring all the ports into a chained data flow link formed by physical interconnection and a virtual network;
the test packet sending module is used for constructing a test message according to the port configuration condition and sending the test message to the data flow link;
and the counting and judging module is used for counting and comparing the number of the sent messages and the number of the received messages of different ports in the chain data flow link so as to judge whether the ports are normal or not.
Fig. 2 shows a method for implementing port data forwarding test of a communication device based on the tested communication device, which includes the following steps:
s201, before a data forwarding test, each port sends a specific data packet containing self port information to the outside;
in this step, before the data forwarding test, each port of the communication device under test sends a small number of data packets to the outside, where the data packets include port information;
s202, after receiving specific data packets sent by other ports, each port carries out port analysis to obtain physical interconnection information of the port and the other ports;
in this step, after receiving the data packets sent by other ports, a certain port analyzes the port information in the data packets, so as to obtain the physical interconnection information between the ports according to the port number of the certain port and the analyzed port number;
such as: and if the port 1 receives the data packet of the port 2 and the port 2 receives the data packet of the port 1, the port 1 and the port 2 are physically interconnected (connected through a network cable or a test fixture).
S203, carrying out virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type, and configuring all the ports into a chained data flow link formed by physical interconnection and a virtual network;
in the step, the system randomly selects two ports which are not physically interconnected according to the physical interconnection information of all the ports of the same type as a test packet sending port and a test packet receiving port respectively, and divides the ports into different virtual networks (vlans or vrf); dividing the rest ports into different virtual networks according to the rule that two ports which are physically interconnected are divided into different virtual networks;
after being partitioned by the virtual network, all ports are configured into data flow links formed by the physical interconnect and the partitioned virtual network.
S204, a CPU of the tested communication equipment constructs a test message according to the port configuration condition and sends the test message to the chained data flow link;
in this step, the CPU of the communication device under test constructs a test packet using the MAC address of the test packet sending port as a source address and the MAC address of the test packet receiving port as a destination address, and sends the test packet through the test packet sending port.
S205, the number of the sent messages and the number of the received messages of the two ports in the chain type data flow link are counted and compared, and therefore whether the ports are normal or not is judged.
In this step, whether the ports are normal is judged by counting whether the receiving and sending numbers of the data packets of the two ports in the chained data stream link are consistent, if so, the test is passed, and if not, the test is failed, and the two inconsistent ports are reported so as to facilitate further manual analysis and processing.
Such as: for ports 1 and 2 which are physically interconnected, in the data forwarding process of a data stream link, data packets received by port 1 are forwarded to port 2, data packets received by port 2 are forwarded to port 1, and then whether port 1 and port 2 are normal is judged by judging whether the number of data packets sent by port 1 is consistent with the number of data packets received by port 2, and judging whether the number of data packets received by port 1 is consistent with the number of data packets sent by port 2.
Example 1:
taking the tested communication equipment as a certain 10-port switch as an example, in the embodiment, a packet is sent out and tested by a CPU of the tested communication equipment;
firstly, connecting the ports of the same type in all the ports of the switch in a random connection mode by using network cables or optical module optical fibers; then, the equipment is powered on and started, after the equipment is started, before testing, port state inspection is firstly carried out to ensure that all ports are opened, and then the testing is started, wherein the process is as follows:
1) before formal packet sending test, a message is constructed through a CPU (Central processing Unit), so that each port of the switch sends 5 data packets containing port information outwards.
2) Each port analyzes the received message, and obtains the physical connection condition of the port according to the port number of the port and the port information contained in the received message:
such as: through analysis, the physical connection situation between the ports is obtained as shown in the following table:
it can be seen that the physical connections between the 10 ports of this switch device are: 1-2,3-5,4-8,6-9,7-10.
3) After the system obtains the physical connection relation of each port, the vlan is divided in the following way:
two ports which are not physically interconnected are arbitrarily selected to be respectively used as a test packet sending port and a test packet receiving port, wherein 1 port and 10 ports are selected to be used as the test packet sending port and the test packet receiving port (when 1 port is used as the test packet sending port, 10 ports are used as the test packet receiving port; when 1 port is used as the test packet receiving port, 10 ports are used as the test packet sending port), the ports are divided into different vlans so as to be sent out, then, the vlan division is carried out on the other ports according to the rule that the two ports which are physically interconnected are divided into different vlans, as shown in fig. 3, in the embodiment, 2 ports and 3 ports are divided into the same vlan, 4 ports and 5 ports are divided into the same vlan, 6 ports and 8 ports are divided into the same vlan, and 7 ports and 9 ports are divided into the same vlan; thereby forming a chained data stream link as shown in fig. 3.
4) The CPU of the tested communication equipment constructs a test message, and sends the test message to a data flow link:
the CPU of the tested communication equipment constructs a test message which takes the MAC address of 1 port as a source address and the MAC address of 10 ports as a destination address, generates a data stream after an internal storm of a switching chip, and sends the data stream from 1 port, wherein the data stream returns to 10 ports after traversing all the ports according to the sequence of 1-2-3-5-4-8-6-9-7-10;
similarly, a test message with the 10-port MAC address as a source address and the 1-port MAC address as a destination address is constructed, and a data stream is generated after an internal storm of the switching chip, and sent from the 10 ports, and the data stream returns to the 1 port after traversing all the ports according to the sequence of "10-7 ═ 9-6 ═ 8-4 ═ 5-3 ═ 2-1".
5) After the test is stopped after a period of time, the number of the sending packets of the port 1 and the number of the receiving packets of the port 10 are compared, and the number of the sending packets of the port 10 and the number of the receiving packets of the port 1 are compared, so that whether all the ports work normally can be known.
It should be noted that, for the tested communication devices with multiple types or different speed ports, the ports of the tested communication devices of the same type or the same speed are subjected to port physical connection identification and vlan partition according to the above operations, and then the test results of the ports of each type or speed can be obtained through respective tests.
As shown in fig. 4, the port data forwarding test system of the communication device in the present invention includes a communication device under test and a tester; the communication equipment to be tested is connected to a data sending port and a data receiving port of the tester through two ports in the ports of the same type, and other ports of the communication equipment to be tested are connected in pairs;
the communication device under test comprises:
the port packet sending module is used for sending a specific data packet containing self port information to the outside before the data forwarding test;
the port analysis module is used for carrying out port analysis after receiving the specific data packets sent by other ports to acquire physical interconnection information of the port and other ports;
the port configuration module is used for carrying out virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type and configuring all the ports into a ring-type data flow link formed by physical interconnection and a virtual network;
the tester is used for constructing a test message and sending the test message to the ring type data flow link; and counting and comparing the number of the test messages sent by the data sending port of the tester with the number of the test messages received by the data receiving port, thereby judging whether the port of the tested communication equipment is normal or not.
Fig. 5 shows a method for testing port data forwarding of a communication device implemented based on the system, which includes the following steps:
s501, before a data forwarding test, each port sends a specific data packet containing self port information to the outside;
in this step, before the data forwarding test, each port of the communication device under test sends a small number of packets to the outside, where the packets contain port information.
S502, after receiving specific data packets sent by other ports, each port carries out port analysis to obtain physical interconnection information of the port and other ports;
in this step, after receiving the data packets sent by other ports, a certain port analyzes the port information in the data packets, so as to obtain the physical interconnection information between the ports according to the port number of the certain port and the analyzed port number;
such as: and if the port 1 receives the data packet of the port 2 and the port 2 receives the data packet of the port 1, the port 1 and the port 2 are physically interconnected (connected through a network cable or a test fixture).
S503, carrying out virtual network configuration on the ports according to the physical interconnection information of all the ports of the same type, and configuring all the ports into a ring type data flow link formed by physical interconnection and a virtual network;
in this step, according to the physical interconnection information of all ports of the same type, all ports of the same type are divided into virtual networks (vlan or vrf) according to the rule that two ports of the physical interconnection are divided into different virtual networks, and after the virtual networks are divided, all the ports are configured into a ring-type data flow link formed by the physical interconnection and the divided virtual networks.
S504, disconnecting any two physically interconnected ports, and accessing a data sending port and a data receiving port of the tester;
in this step, since the tester is used to send a packet, the communication device under test needs to be connected to the tester, and since the physical interconnection of the ports has been previously identified, it is only necessary to disconnect any two physically connected ports and access the data sending port and the data receiving port of the tester.
S505, the tester constructs a test message according to the port configuration condition and sends the test message to the ring type data flow link;
in this step, the tester constructs a test message using the MAC address of the data transmission port of the tester as a source address and the MAC address of the data reception port of the tester as a destination address, and transmits the test message through the data transmission port of the tester.
S506, counting and comparing the number of the test messages sent by the data sending port of the tester with the number of the test messages received by the data receiving port, so as to judge whether the port of the tested communication equipment is normal.
In this step, whether the port of the tested communication equipment is normal is judged by counting whether the receiving and sending quantity of the data packets of the data sending port and the data receiving port of the tester are consistent.
Example 2:
taking a tested communication device in the data forwarding test system as a certain 10-port switch as an example, in the embodiment, an external tester sends a packet test;
firstly, connecting the ports of the same type in all the ports of the switch in a random connection mode by using network cables or optical module optical fibers; then, the equipment is powered on and started, after the equipment is started, before testing, port state inspection is firstly carried out to ensure that all ports are opened, and then the testing is started, wherein the process is as follows:
1) before formal packet sending test, a message is constructed through a CPU (Central processing Unit), so that each port of the switch sends 5 data packets containing port information outwards.
2) Each port analyzes the received message, and obtains the physical connection condition of the port according to the port number of the port and the port information contained in the received message:
such as: through analysis, the physical connection situation between the ports is obtained as shown in the following table:
it can be seen that the physical connections between the 10 ports of this switch device are: 1-2,3-5,4-8,6-9,7-10.
3) After the system obtains the physical connection relation of each port, the vlan is divided in the following way:
dividing two ports which are physically connected into different vlans, and finally forming a chain ring which is formed by connecting all ports with the vlans and lines; as shown in fig. 6, in this embodiment, 2 ports and 3 ports are divided into the same vlan, 4 ports and 5 ports are divided into the same vlan, 6 ports and 8 ports are divided into the same vlan, and 7 ports and 9 ports are divided into the same vlan; ports 1 and 10 are divided into the same vlan, thereby forming a ring data flow link as shown in fig. 6.
4) Any two physically connected ports are disconnected and the tester is accessed:
in this embodiment, a connection line of port 1 and port 2 is selected, and port 1 and port 2 are connected to a data transmitting end and a data receiving end of a tester;
5) the tester constructs a test message, and sends the test message to the ring type data flow link:
the tester constructs a test message with the MAC address of the data sending port as a source address and the MAC address of the data receiving port as a destination address, and sends the test message through the data sending port of the tester. The data flow is sent from the data sending port, and returns to the data receiving port after traversing all the ports of the communication device under test in the order of "1 ═ 10 ═ 7 ═ 9 ═ 6 ═ 8 ═ 4 ═ 5 ═ 3 ═ 2".
6) And the test is stopped after a period of time, and then the packet sending number of the data sending port of the tester is compared with the packet receiving number of the data receiving port, so that whether all the ports work normally can be known.
Similarly, if 1 port is accessed to the data receiving end of the tester in step 4), and 2 ports are accessed to the data transmitting end of the tester, after the test packet is constructed in step 5) and transmitted, the data stream is transmitted from the data transmitting port, and the data stream returns to the data receiving port after traversing all the ports of the tested communication device according to the sequence of "2-3-5-4-8-6-9-7-10-1". It should be noted that, for the tested communication devices with multiple types or different speed ports, the ports of the tested communication devices of the same type or the same speed are subjected to port physical connection identification and vlan partition according to the above operations, and then the test results of the ports of each type or speed can be obtained through respective tests.