Disclosure of Invention
The invention aims to solve the technical problems that the existing test for the VPN function of equipment is a manual test which has high difficulty, low test efficiency and easy error.
The invention solves the technical problem and provides a method, a device and a system for testing the VPN function of equipment and the test equipment.
The method for testing the VPN function of the equipment is applied to the test equipment, and comprises the following steps of automatically executing:
establishing communication connection with terminal equipment and equipment to be tested, configuring the VPN function of the equipment to be tested, and configuring the terminal equipment into a VPN client;
controlling the terminal equipment to send a dial-up connection request to the equipment to be tested so as to establish VPN connection;
and verifying whether the terminal equipment can use the VPN connection for communication through the equipment to be tested.
Optionally, verifying whether the terminal device can use the VPN connection for communication through the device to be tested includes:
acquiring feedback information of the dial-up connection request sent by the equipment to be tested from the terminal equipment, and judging whether the VPN connection is established successfully or not according to the feedback information;
if the VPN connection is successfully established, acquiring a VPN address from the terminal equipment, and judging whether the VPN address is a preset address or not;
and if the VPN address is a preset address, controlling the terminal equipment to call a ping command so as to verify whether the terminal equipment can use the VPN connection for communication.
Optionally, the VPN function of the device under test is configured to use PPTP protocol or L2TP protocol.
Optionally, when it is determined that the VPN connection is not successfully established, the VPN address is determined not to be a preset address, or the terminal device cannot communicate using the VPN connection according to the feedback information, storing test data and terminating the test process.
On the other hand, the invention also provides a device for testing the function of the VPN, which is applied to the test equipment and comprises the following components:
the system comprises a configuration module, a VPN client and a server, wherein the configuration module is used for establishing communication connection with terminal equipment and equipment to be tested, configuring the VPN function of the equipment to be tested and configuring the terminal equipment into a VPN client;
the connection establishing module is used for controlling the terminal equipment to send a dialing connection request to the equipment to be tested so as to establish VPN connection;
and the verification module is used for verifying whether the terminal equipment can use the VPN connection to communicate through the equipment to be tested.
Optionally, the verification module comprises:
the first judgment submodule is used for acquiring feedback information of the dial-up connection request sent by the equipment to be tested from the terminal equipment and judging whether the VPN connection is established successfully or not according to the feedback information;
a second judgment submodule, configured to, when the VPN connection is successfully established, acquire a VPN address from the terminal device, and judge whether the VPN address is a preset address;
and the verification submodule is used for controlling the terminal equipment to call a ping command to verify whether the terminal equipment can use the VPN connection for communication when the VPN address is a preset address.
Optionally, the VPN function of the device under test is configured to use PPTP protocol or L2TP protocol.
Optionally, the method further comprises:
and the data storage module is used for storing test data and terminating the test process when the VPN connection is determined to be unsuccessfully established, the VPN address is determined not to be a preset address or the terminal equipment can not use the VPN connection for communication according to the feedback information.
Further, the invention also provides a test device, which comprises the device for testing the VPN function of the device.
Furthermore, the invention also provides a system for testing the VPN function of the equipment, which comprises the test equipment, the terminal equipment and the equipment to be tested;
the test equipment is used for automatically executing the following steps: establishing communication connection with terminal equipment and equipment to be tested, configuring the VPN function of the equipment to be tested, and configuring the terminal equipment into a VPN client; controlling the terminal equipment to send a dial-up connection request to the equipment to be tested so as to establish VPN connection; and verifying whether the terminal equipment can use the VPN connection for communication through the equipment to be tested.
The method for testing the VPN function of the equipment automatically controls the terminal equipment and the equipment to be tested through the test equipment, configures the VPN function of the equipment to be tested, configures the terminal equipment into a VPN client, further controls the terminal equipment to send a dialing connection request to the equipment to be tested so as to establish VPN connection, and further verifies whether the terminal equipment can use the VPN connection for communication through the equipment to be tested. And further verifying whether the VPN function of the equipment to be tested is normal. The testing method provided by the invention has the advantages of low requirement on testing personnel, low testing difficulty, high testing efficiency, high testing accuracy and short testing period, and saves the labor cost required by testing.
Detailed Description
The following are specific embodiments of the present invention and are further described with reference to the drawings, but the present invention is not limited to these embodiments.
It should also be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention.
The method for testing the VPN function of the equipment automatically controls the terminal equipment and the equipment to be tested through the test equipment, configures the VPN function of the equipment to be tested, configures the terminal equipment into a VPN client, further controls the terminal equipment to send a dialing connection request to the equipment to be tested so as to establish VPN connection, and further verifies whether the terminal equipment can use the VPN connection for communication through the equipment to be tested. And further verifying whether the VPN function of the equipment to be tested is normal. Due to the automatic control of the test process, the requirement on testers is low, the test difficulty is low, the test efficiency is high, the test accuracy is high, the test period is short, and the labor cost required by the test is saved.
The terminal equipment can be a PC, a mobile terminal and the like.
The device to be tested can be a router, a firewall, a switch and other devices with VPN functions.
The test method provided by the invention is applied to a test equipment terminal, and an automatic test script is arranged on the test equipment so as to automatically execute the method steps of the invention.
Example one
Fig. 1 is a flowchart of a method for testing a device VPN function according to this embodiment, which is detailed as follows with reference to the accompanying drawings:
the method for testing the function of the device VPN is applied to the testing device, and the method comprises the following steps of:
step S101, establishing communication connection with a terminal device and a device to be tested, configuring a VPN function of the device to be tested, and configuring the terminal device into a VPN client.
And the test equipment establishes communication connection with the terminal equipment and the equipment to be tested. In addition, the device to be tested and the terminal device can be connected to the internet.
The invention can adopt the following connection mode: the testing equipment is a computer and is provided with two network cards, namely a network card 1 and a network card 2; the terminal equipment is a computer and is provided with two network cards, namely a network card 3 and a network card 4; the equipment to be tested is a router. The network card 1 of the test terminal is connected to the LAN port of the router, and the network card 2 is connected to the network card 3 of the terminal device; the WAN port of the router is connected to the Internet; the network card 4 of the terminal equipment is connected to the Internet; the IP and the mask of the terminal equipment and the test terminal are in the same network segment; the terminal device may not be configured with a gateway and DNS. The above are merely examples of devices and connections that may be used with the present invention.
And the test equipment configures the VPN function of the equipment to be tested so as to enable the equipment to be tested to provide a preset VPN server function, and configures the terminal equipment into a VPN client.
Specifically, the test device calls a command to set a VPN function of the device to be tested, and a protocol used by the VPN function can be selected during setting.
Optionally, the VPN function of the device under test is configured to use PPTP protocol or L2TP protocol.
The test equipment can also configure parameters such as server address, account number, password and the like of the VPN server of the equipment to be tested.
The test device can be connected to the terminal device through a Telnet protocol, and a VPN client is established on the terminal device, and the VPN client and the VPN server use a common protocol, such as a PPTP protocol or an L2TP protocol. The VPN client may connect to the aforementioned VPN server using preset parameters.
Step S102, the terminal device is controlled to send a dial-up connection request to the device to be tested so as to establish VPN connection.
The dialing connection request comprises parameters for connecting the VPN server, and the parameters can comprise preset server addresses, account numbers and passwords.
Specifically, the test device controls the terminal device to send a dial-up connection request to the device to be tested, so as to establish a VPN connection.
Step S103, verifying whether the terminal equipment can use the VPN connection to communicate through the equipment to be tested.
And the test terminal judges whether the VPN function of the equipment to be tested is normal or not by verifying whether the terminal equipment can use the VPN connection to carry out normal communication through the equipment to be tested.
The verifying may include: acquiring feedback information of the dial-up connection request sent by the equipment to be tested from the terminal equipment, and judging whether the VPN connection is established successfully or not according to the feedback information; acquiring a VPN address from the terminal equipment; judging whether the VPN address is a preset address or not; controlling the terminal device to invoke a ping command to verify whether the terminal device is capable of communicating using the VPN connection.
The method for testing the VPN function of the equipment automatically controls the terminal equipment and the equipment to be tested through the test equipment, configures the VPN function of the equipment to be tested, configures the terminal equipment into a VPN client, further controls the terminal equipment to send a dialing connection request to the equipment to be tested so as to establish VPN connection, and further verifies whether the terminal equipment can use the VPN connection for communication through the equipment to be tested. And further verifying whether the VPN function of the equipment to be tested is normal. The testing method provided by the invention has the advantages of low requirement on testing personnel, low testing difficulty, high testing efficiency, high testing accuracy and short testing period, and saves the labor cost required by testing.
Example two
Fig. 2 is a flowchart of a method for testing a device VPN function according to this embodiment, which is detailed as follows with reference to the accompanying drawings:
step S201, establishing a communication connection with a terminal device and a device to be tested, configuring a VPN function of the device to be tested, and configuring the terminal device as a VPN client.
Step S202, the terminal device is controlled to send a dial-up connection request to the device to be tested so as to establish VPN connection.
Step S203, obtaining feedback information of the dial-up connection request sent by the device to be tested from the terminal device, and determining whether the VPN connection is established successfully according to the feedback information.
When a VPN client on the terminal equipment sends a dial-up connection request to a VPN server on the equipment to be tested, the equipment to be tested returns feedback information of the dial-up connection request, and whether VPN connection is established successfully or not can be judged according to the feedback information.
Step S204, if the VPN connection is successfully established, acquiring a VPN address from the terminal equipment, and judging whether the VPN address is a preset address.
After the terminal device and the device to be tested establish the VPN connection, the VPN server of the device to be tested allocates a VPN address to the terminal device. The VPN address can be judged to be a preset address so as to judge whether normal communication can be carried out through the VPN connection.
Step S205, if the VPN address is a preset address, controlling the terminal device to call a ping command to verify whether the terminal device can use the VPN connection for communication.
Specifically, if the VPN address is a preset address, the test terminal controls the terminal device to call a ping command to verify whether the terminal device can use the VPN connection for communication.
Specifically, the test terminal calls a ping command of the terminal device and sends a ping packet to a preset IP address to determine whether the terminal device can use the VPN connection for normal communication. The preset IP address is the IP address of the external network.
In this embodiment, it is verified whether the terminal device can communicate using the VPN function of the device to be tested in multiple ways, so that the accuracy of the test is improved.
EXAMPLE III
Fig. 3 is a block diagram of a device for testing a VPN function of a device according to this embodiment; the following is detailed in conjunction with the drawings:
the apparatus 30 for testing a device VPN function comprises:
the configuration module 31 is configured to establish communication connection with a terminal device and a device to be tested, configure a VPN function of the device to be tested, and configure the terminal device as a VPN client;
a connection establishing module 32, configured to control the terminal device to send a dial-up connection request to the device to be tested, so as to establish a VPN connection;
a verification module 33, configured to verify whether the terminal device can use the VPN connection to perform communication through the device to be tested.
Optionally, the verification module 33 comprises:
the first judgment submodule is used for acquiring feedback information of the dial-up connection request sent by the equipment to be tested from the terminal equipment and judging whether the VPN connection is established successfully or not according to the feedback information;
a second judgment submodule, configured to, when the VPN connection is successfully established, acquire a VPN address from the terminal device, and judge whether the VPN address is a preset address;
and the verification submodule is used for controlling the terminal equipment to call a ping command to verify whether the terminal equipment can use the VPN connection for communication when the VPN address is a preset address.
Optionally, the VPN function of the device under test is configured to use PPTP protocol or L2TP protocol.
Optionally, the apparatus 30 for testing VPN function of a device further includes:
and the data storage module is used for storing test data and terminating the test process when the VPN connection is determined to be unsuccessfully established, the VPN address is determined not to be a preset address or the terminal equipment can not use the VPN connection for communication according to the feedback information.
The apparatus 30 for testing VPN function of device provided in this embodiment is applied to a method embodiment one and a method
In the second embodiment, details refer to corresponding method embodiments, which are not described herein again.
Example four
Fig. 4 shows a block diagram of a test apparatus provided in this embodiment, and for convenience of explanation, only the relevant parts to this embodiment are shown. The testing device 40 may be a computer, and includes the apparatus 30 for testing VPN function of a device according to the third embodiment, where the apparatus 30 for testing VPN function of a device includes: configuration module 31, connection establishment module 32, verification module 33.
The configuration module 31 is configured to establish communication connection with a terminal device and a device to be tested, configure a VPN function of the device to be tested, and configure the terminal device as a VPN client;
a connection establishing module 32, configured to control the terminal device to send a dial-up connection request to the device to be tested, so as to establish a VPN connection;
a verification module 33, configured to verify whether the terminal device can use the VPN connection to perform communication through the device to be tested.
Optionally, the verification module 33 comprises:
the first judgment submodule is used for acquiring feedback information of the dial-up connection request sent by the equipment to be tested from the terminal equipment and judging whether the VPN connection is established successfully or not according to the feedback information;
a second judgment submodule, configured to, when the VPN connection is successfully established, acquire a VPN address from the terminal device, and judge whether the VPN address is a preset address;
and the verification submodule is used for controlling the terminal equipment to call a ping command to verify whether the terminal equipment can use the VPN connection for communication when the VPN address is a preset address.
Optionally, the VPN function of the device under test is configured to use PPTP protocol or L2TP protocol.
Optionally, the apparatus 30 for testing VPN function of a device further includes:
and the data storage module is used for storing test data and terminating the test process when the VPN connection is determined to be unsuccessfully established, the VPN address is determined not to be a preset address or the terminal equipment can not use the VPN connection for communication according to the feedback information.
The test device 40 provided in this embodiment is applied to the first method embodiment and the second method embodiment, and for details, reference is made to the corresponding method embodiments, which are not described herein again.
EXAMPLE five
Fig. 5 shows a block diagram of a system for testing a device VPN function according to this embodiment, where the system for testing a device VPN function includes: a test device 51, and a terminal device 52 and a device under test 53 connected to the test device. In the system, the testing device 51 may configure the terminal device 52 as a VPN client, configure the device to be tested 53 as a VPN server, and further control the VPN client on the terminal device 52 to communicate with the VPN server on the device to be tested 53, so as to achieve the purpose of testing the VPN function on the device to be tested 53.
Specifically, the test device 51 is configured to automatically perform the following steps: establishing communication connection with terminal equipment and equipment to be tested, configuring the VPN function of the equipment to be tested, and configuring the terminal equipment into a VPN client; controlling the terminal equipment to send a dial-up connection request to the equipment to be tested so as to establish VPN connection; and verifying whether the terminal equipment can use the VPN connection for communication through the equipment to be tested.
Optionally, the testing device 51 is further configured to obtain, from the terminal device, feedback information of the dial-up connection request sent by the device to be tested, and determine whether the VPN connection is established successfully according to the feedback information; if the VPN connection is successfully established, acquiring a VPN address from the terminal equipment, and judging whether the VPN address is a preset address or not; and if the VPN address is a preset address, controlling the terminal equipment to call a ping command so as to verify whether the terminal equipment can use the VPN connection for communication.
Optionally, the VPN function of the device under test is configured to use PPTP protocol or L2TP protocol.
Optionally, the testing device 51 is further configured to store the testing data and terminate the testing process when it is determined that the VPN connection is not successfully established, it is determined that the VPN address is not a preset address, or the terminal device cannot use the VPN connection for communication according to the feedback information.
The system for testing a VPN function of a device provided in this embodiment is applied to the first method embodiment and the second method embodiment, and for details, reference is made to the corresponding method embodiments, and details are not described here again.
It is to be understood that the method steps involved in the present invention are not in the exact order of execution and that all changes that can be envisioned and do not affect the performance of the functions are intended to be within the scope of the present invention.
In the embodiments provided in this application, it should be understood that the methods and systems described are illustrative and that variations may be made in the actual implementation by adaptation.
In addition, specific names of the functional units or modules are only used for distinguishing one functional unit from another, and are not used for the protection scope of the present invention.
The specific embodiments described herein are merely illustrative of the spirit of the invention. Various modifications or additions may be made to the described embodiments or alternatives may be employed by those skilled in the art without departing from the spirit or ambit of the invention as defined in the appended claims.