Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a method for testing the broadband access of a router.
The invention provides a method for testing the broadband access of a router, which comprises the following steps:
s1, building a test system, providing a first industrial personal computer, a second industrial personal computer and a test PC, wherein,
the first industrial personal computer is provided with a centOS system, is connected with a WAN port of the router to be tested through a network cable, serves as a superior server of the router to be tested and provides access service for the router to be tested;
the second industrial personal computer is provided with a centOS system and is connected with the LAN port of the router to be tested through a network cable so as to serve as a user of the router to be tested;
the test PC is respectively connected with the LAN port of the router to be tested, the first industrial personal computer and the second industrial personal computer through network cables and is used for installing an automatic test platform;
s2, executing the following test cases through the test PC:
1) the initialization SSH is connected with the first industrial personal computer and the second industrial personal computer;
2) sending a command to call the shell script and generating a virtual network port for providing service;
3) pulling up a service process on the virtual network port with the Vlan;
4) entering a WEB management page through a browser to configure router configuration access;
5) the following verifications were performed:
whether the allocated address is normally acquired or not is judged;
b, whether the interactive message carries Vlan Tags or not is judged;
c, if the message is not divided into the Vlan, whether the access can be dialed;
6) closing the vlan;
7) and finishing the execution, and generating an execution record and a report.
As a further improvement of the invention, the test PC is provided with Python, and a robot frame automatic test platform is deployed.
As a further improvement of the invention, the first industrial personal computer installs the vconfig service, imports the shell script for configuring the vlan, gives the execution authority, and configures and closes the vlan of the service end through the shell script.
As a further improvement of the invention, the first industrial personal computer, the second industrial personal computer and the test PC are respectively connected with the switch through network cables.
The invention has the beneficial effects that:
(1) the automatic test of the dialing access function of the router broadband access (of each ISP operator) is realized, the access environment of each operator is rapidly configured, the labor cost is saved, and the test efficiency is improved;
(2) the functions of the existing automatic test platform are expanded, the test coverage of the platform is expanded, and the test process and the test result are presented more visually.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on those shown in the drawings, and are used merely for convenience in describing the present invention and for simplicity in description, and do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore, should not be taken as limiting the scope of the present invention. Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first," "second," etc. may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless otherwise specified.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art through specific situations.
The invention is further described with reference to the following description and embodiments in conjunction with the accompanying drawings.
As shown in fig. 1 to fig. 5, the present invention provides a method for configuring a centOS server interface (including vlan), so as to implement an automated testing method for configuring servers such as DHCP, PPPoE, L2TP, PPTP, etc. with a designated vlan (or without designating a vlan).
The present invention relates to the following technologies:
(1) python language: the technology is mainly used for a robot frame automatic test platform, calls a test library and configures access environments of operators on the WAN side of the DUT.
(2) shell script: the technical configuration method is to realize the configuration of the broadband service of the server-side interface by compiling the shell script and calling the shell script.
(3) Web UI automation testing technology: router Web management interface is controlled using the Web application test tool Selenium.
(4) Platform SSH: and connecting the centOS system by using SSH, and sending a service configuration instruction.
(5) The centOS system uses: providing service and configuring network cards.
As shown in fig. 1, the hardware device of the present invention mainly includes a first industrial computer 101, a second industrial computer 102, a test PC103, a switch 104, and a router to be tested (DUT for short) 105, wherein,
the first industrial personal computer 101 is provided with a centOS system, provides an access environment on the WAN side of the router, configures an interface Vlan of the centOS, and simultaneously installs access environments such as DHCP, PPPoE, L2TP and PPTP;
the second industrial personal computer 102 is provided with a centOS system which serves as a router user and simulates the internet access of the user and the like;
test PC103 for set up automation platform, installation Python deploys robot frame automatic test platform, and relevant third party test library, include: the Selenium2Library, SSHLibrary test Library, and the like.
The invention provides a method for testing the broadband access of a router, which comprises the following detailed processes:
(1) the test PC has a windows system installed. Where python is installed and the robot Framework automation test open source Framework environment and related libraries (Selenium 2Library, SSHLibrary, etc.) are deployed. The industrial personal computer is provided with CentOS7.8 and is provided with various services (DHCP, PPPoE, DNS and the like, which are used for providing dial-up access environment for the router) to serve as a superior server of the equipment to be tested, so that the dial-up access environment is provided. The device under test is connected according to fig. 1.
(2) The physical line is as shown in figure 1, the LAN side network cable of the router to be tested is connected with a test PC; the WAN side network cable of the router to be tested is connected with one network card on a first industrial personal computer providing services, and the network cable of the other network card is connected with a test PC for SSH connection and sending commands to control the starting and closing of DHCP/PPPoE/DNS and other service processes; and the network card of the second industrial personal computer used as a router user is connected with the LAN side network cable of the router, and the other network card network cable connection test PC is used for SSH connection and sending commands to execute operations such as ping domain name and connectivity check.
(3) And the first industrial personal computer installs the vconfig service, imports the shell script for configuring the vlan and gives an execution authority.
(4) And running an automation program on the test PC and executing the test case. The program operation flow comprises the following steps:
firstly, initializing SSH to connect a first industrial personal computer and a second industrial personal computer;
sending a command to call the shell script and generating a virtual network port for providing service, such as: eth1.500 (here, 500 is vlan id for the centOS server to provide service);
third, pull up the service process on the virtual network port with Vlan, such as (DHCP/PPPoE/L2TP/PPTP) server;
fourthly, the browser enters a WEB management page to configure router configuration access;
verifying:
whether the allocated address is normally acquired (expected: yes);
b, whether the interactive message carries Vlan Tags or not (expectedly, yes);
c, if the message is not divided into the vlans, whether the vlans can still be accessed by dialing (expecting: no);
closing the vlan;
and generating an execution record and a report after execution is completed.
The flow of the first industrial personal computer for starting and closing the service is shown in fig. 2 and 3, and the first industrial personal computer is used for automatically executing a logic processing process.
The flow of configuring and canceling the service interface with the vlan is shown in fig. 4 and 5, and is a shell script layer processing process.
The invention provides a method for testing the broadband access of a router, and provides an environment configuration method for testing the access of each operator of the router or with a vlan, which can effectively improve the testing efficiency and reduce the labor cost.
The invention relates to the field of automatic testing, in particular to a method for testing the automatic configuration testing environment of router broadband access.
The foregoing is a further detailed description of the invention in connection with specific preferred embodiments and it is not intended to limit the invention to the specific embodiments described. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.