Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a method for testing broadband access of a router.
The invention provides a method for testing router broadband access, which comprises the following steps:
s1, constructing 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 a router to be tested through a network cable, serves as an upper 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 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 respectively and is used for installing an automatic test platform;
s2, executing the following test cases by the test PC:
1) Initializing SSH to connect the first industrial personal computer and the second industrial personal computer;
2) Sending a command to call the shell script to generate a virtual network port for providing service;
3) Pulling up a service process on the virtual network port with the Vlan;
4) The WEB management page configuration router configuration access is accessed through the browser;
5) The following verification was performed:
a, whether the allocated address is normally acquired or not;
b, whether the interactive message carries Vlan Tags or not;
c if the message is not divided into Vlan, whether the message can still be accessed by dialing;
6) Closing the vlan;
7) And generating an execution record and a report after the execution is completed.
As a further improvement of the invention, the test PC is provided with a Python and a robot frame work automatic test platform.
As a further improvement of the invention, the first industrial personal computer installs the vconofig 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 beneficial effects of the invention are as follows:
(1) Automatic test of dial-up access functions of router broadband access (ISP operators) is realized, access environments of the operators are rapidly configured, labor cost is saved, and test efficiency is improved;
(2) The function of the existing automatic test platform is expanded, the test coverage of the platform is widened, and the test process and the result are presented more intuitively.
Detailed Description
It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other.
In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on the drawings, are merely for convenience in describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the scope of the present invention. Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first", "a second", etc. may explicitly or implicitly include one or more such feature. In the description of the present invention, unless otherwise indicated, the meaning of "a plurality" is two or more.
In the description of the present invention, it should be noted that, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be either fixedly connected, detachably connected, or integrally connected, for example; can be directly connected or indirectly connected through an intermediate medium, and can be communication 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 in a specific case.
The invention is further described with reference to the following description of the drawings and detailed description.
As shown in fig. 1 to 5, the present invention proposes a method for configuring a central os server interface (including vlan) to implement an automatic test method for configuring a server such as DHCP, PPPoE, L TP, PPTP, etc. with a vlan specified (or not).
The invention relates to the following technology:
(1) python language: the technology is mainly used for a robot frame work automatic test platform, a test library is called, and access environments of operators on the WAN side of the DUT are configured.
(2) Shell script: the technical configuration method is to write the shell script and call the shell script to realize the broadband service of the configuration server interface.
(3) Web UI automation test technique: the Web application test tool Selenium is used to control the router Web management interface.
(4) Platform SSH: the SSH is used to connect the centOS system and send the service configuration instruction.
(5) The centOS system uses: providing service and configuring network card.
The hardware device of the present invention, as shown in fig. 1, mainly comprises a first industrial personal computer 101, a second industrial personal 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 of a router WAN side, configures an interface Vlan of the centOS, and is provided with access environments of DHCP, PPPoE, L TP, PPTP and the like;
a second industrial personal computer 102, installed with a centOS system, serving as a router user, simulating the user's surfing the internet, etc.;
the test PC103 is configured to build an automation platform, install Python, deploy a robot framework automation test platform, and a related third party test library, and includes: selenium2Library, SSHLibrary test libraries, etc.
The invention provides a method for testing router broadband access, which comprises the following detailed procedures:
(1) Installed on the test PC is a windows system. In which python is installed, robot Framework automation is deployed to test open source Framework environments and related libraries (Selenium 2Library, SSHLibrary, etc.). The industrial personal computer installs the cents 7.8 and installs services (DHCP, PPPoE, DNS, etc. services, the function is to provide the router with dial-up access environment) to act as an upper server of the device under test, providing dial-up access environment. The device under test is connected according to fig. 1.
(2) The physical circuit is shown in fig. 1, and the network cable of the LAN side of the router to be tested is connected with a test PC; one network card on a first industrial personal computer for providing service for network cable connection of a router WAN side to be tested is connected with a network cable connection test PC of the other network card for SSH connection and sending a command to control starting and closing of service processes such as DHCP/PPPoE/DNS; the network cable connection of the router LAN side serves as a network card of a second industrial personal computer of the router user, and the network cable connection test PC of the other network card is used for SSH connection and sending commands, and performing operations such as ping domain name, connectivity check and the like.
(3) The first industrial personal computer installs the vcoonfig service, imports a shell script for configuring vlan and gives execution authority.
(4) And running an automation program on the test PC, and executing the test case. The program running flow is as follows:
(1) initializing SSH to connect the first industrial personal computer and the second industrial personal computer;
(2) sending a command to call a shell script to generate a virtual network port for providing services, such as: eth1.500 (500 here is vlan ID which serves the centOS server);
(3) pulling up a service process, such as a (DHCP/PPPoE/L2 TP/PPTP) server, on a virtual network port with a Vlan;
(4) the browser enters a WEB management page configuration router to configure access;
(5) and (3) verification:
a whether the allocated address is normally acquired (expected: yes);
b, whether the interactive message carries Vlan Tags (expected: yes);
c if the message does not divide the Vlan, whether the Vlan can still dial up access (expected: no);
(6) closing the vlan;
(7) execution completion generates an execution record and report.
The flow of the first industrial personal computer for turning on and off the service is shown in fig. 2 and 3, and the logic processing process is automatically executed.
The flow of configuring and canceling the service interface with vlan is shown in fig. 4 and 5, which is a shell script layer processing procedure.
The invention provides a method for testing broadband access of a router, which provides an environment configuration method for testing access of each operator of the router or vlan-attached, and can effectively improve testing efficiency and reduce labor cost.
The invention relates to the field of automatic testing, in particular to a method for testing router broadband access automatic configuration testing environment.
The foregoing is a further detailed description of the invention in connection with the preferred embodiments, and it is not intended that the invention be limited to the specific embodiments described. It will be apparent to those skilled in the art that several simple deductions or substitutions may be made without departing from the spirit of the invention, and these should be considered to be within the scope of the invention.