Invention content
In view of the foregoing deficiencies of prior art, the purpose of the present invention is to provide a kind of test system of router and
Method, for solving the problems, such as the carry out router test for repeating break-make power supply can not continue in the prior art, automatic.
In order to achieve the above objects and other related objects, the present invention provides a kind of test system of router, including:With road
By the connected controlled switch unit of the power supply of device;The control unit being connected with the controlled switch unit, for according to preset
Rule sends switch order to the controlled switch unit, so that the controlled switch unit is based on the switch order to described
The power supply of router carries out on-off line operation;The test cell being connected with the controlled switch unit, in the router
When power supply is powered, the router is tested.
Preferably, the preset rules include it is following in it is any:Fixed power on/off periods rules, random power on/off period
Rule, fixed or the power on/off period at random the rule in the time zone of setting.
Preferably, the test cell is used for when the power supply of the router is powered, and the router is carried out and fallen
The relevant test of electricity.
Preferably, the relevant test of described and power down includes following at least one:Configuration loss, mirror image damage.
Preferably, the controlled switch unit includes:Relay.
Based on above-mentioned purpose, the present invention also provides a kind of test methods of router, including:According to default rule to
The connected controlled switch unit of router sends switch order, so that the controlled switch unit is based on the switch order to institute
The power supply for stating router carries out on-off line operation;When the power supply of the router is powered, the router is tested.
Preferably, the preset rules include it is following in it is any:Fixed power on/off periods rules, random power on/off period
Rule, fixed or the power on/off period at random the rule in the time zone of setting.
Preferably, when the power supply in the router is powered, the mode tested the router includes:
When the power supply of the router is powered, the router is carried out and the relevant test of power down.
Preferably, the relevant test of described and power down includes following at least one:Configuration loss, mirror image damage.
As described above, the test system and method for the router of the present invention, has the advantages that:By in router
Power end setting controlled switch unit and set control rule, the test system can be not necessarily to the automatic progress that manually participates in
Test, realizes unattended, and adjust automatically power-on time improves the operational efficiency of test system;In addition, the test system
System can be tested according to various control rules, be effectively ensured in unattended period, test it is comprehensive.
Specific implementation mode
Illustrate that embodiments of the present invention, those skilled in the art can be by this specification below by way of specific specific example
Disclosed content understands other advantages and effect of the present invention easily.The present invention can also pass through in addition different specific realities
The mode of applying is embodied or practiced, the various details in this specification can also be based on different viewpoints with application, without departing from
Various modifications or alterations are carried out under the spirit of the present invention.It should be noted that in the absence of conflict, following embodiment and implementation
Feature in example can be combined with each other.
It should be noted that the diagram provided in following embodiment only illustrates the basic structure of the present invention in a schematic way
Think, component count, shape and size when only display is with related component in the present invention rather than according to actual implementation in schema then
Draw, when actual implementation kenel, quantity and the ratio of each component can be a kind of random change, and its assembly layout kenel
It is likely more complexity.
Referring to Fig. 1, the present invention provides a kind of test system of router.The test system 1 includes:Controlled switch list
Member 11, control unit 12 and test cell 13.
The controlled switch unit 11 is connected with the power supply of router 2 to be tested.
Specifically, the controlled switch unit 11 is attached between the power interface and power supply system of the router 2.
For example, the controlled switch is connected between the power outlet of the router 2 and a wiring board.The wiring board and alternating current phase
Even.Here, the controlled switch unit 11 includes:Relay and peripheral circuit for voltage stabilizing.
Described control unit 12 is connected with the controlled switch unit 11, for controlled being opened to described according to default rule
Close unit 11 send switch order, so as to the controlled switch unit 11 based on the switch order to the electricity of the router 2
Source carries out on-off line operation.
Specifically, technical staff first passes through interface or is arranged in advance to described control unit 12 from external equipment and used in advance
In the rule for controlling the 11 break-make power supply of controlled switch unit, then described control unit 12 based on set rule to described
Controlled switch unit 11 sends switch order.Then the controlled switch unit 11 is based on the switch order to the router 2
It is electrically operated to carry out break-make.Wherein, the rule includes but not limited to:Fixed power on/off periods rules, rule of random power on/off period
Then, fixed or the power on/off period at random the rule in the time zone of setting.
It enabled the controlled switch unit 11 be powered once every 3 seconds for example, technical staff is arranged by interface, is powered every time
When it is 30 seconds a length of.Then described control unit 12 since the rule settings complete, according to system clock every 3 seconds to
The controlled switch unit 11 sends out electrical instruction, then the controlled switch unit 11 is based on the electrical instruction and executes the behaviour that is powered
Make, when being powered 30 seconds, described control unit 12 sends out cut-offing instruction, then the controlled switch unit 11 is based on the power-off
Instruction execution power operation.So repeat.
For another example, the technical staff is arranged from 6 pm to the next morning by interface and is sent using stochastic model for 9 points
Switch order, then described control unit 12 in the afternoon 6 points in 9 points of time zone of the next morning, it is random send electrical instruction or
Cut-offing instruction.In this way, the test system 1 can After Hours continue to test in employee, it is unattended to efficiently use
Dependence test is completed in time zone.
Preferably, the random number generated every time in order to prevent repeats, and described control unit 12 is generated using different seeds
Random number.For example, described control unit 12 generates different seeds by executing srand ((int) time (NULL)) sentences.
Then, the test cell 13 is connected with the controlled switch unit 11, logical for the power supply in the router 2
When electric, the router 2 is tested.
Specifically, the test cell 13 is by monitoring the power on/off situation of the controlled switch unit 11 or by connecing
The switch order is received to identify power on/off situation, when determining that the power supply of the router 2 is powered, according to preset testing process
The router 2 is tested.Wherein, the test can be electric test, routine test, high/low temperature test etc..
Preferably, the opening and closing for the controlled switch unit 11 is frequent, and the test cell 13 is used in the routing
When the power supply of device 2 is powered, the router 2 is carried out and the relevant test of power down.Wherein, the described and relevant test bag of power down
It includes but is not limited to following at least one:Configuration loss, mirror image damage.
According to Fig. 1, the course of work of the test system 1 is exemplified below:
Technical staff by interface input in the afternoon 6 points to 9 points of the next morning using fixed power on/off periods rules, and
Setting enabled the controlled switch unit 11 be powered once every 3 seconds, be powered every time when it is 30 seconds a length of.Then described control unit
12 send electrical instruction or cut-offing instruction, 11 base of the controlled switch unit based on above-mentioned rule to the controlled switch unit 11
2 power on/off of the router is enabled in electrical instruction or cut-offing instruction, at the same time, is connected with the controlled switch unit 11
Test cell 13 sends ping setting IP instructions when it is powered to the router 2, to test the configuration of the router 2
Preserve situation.
Referring to Fig. 2, the present invention provides a kind of test method of router.The test method mainly by test system Lai
It executes.Wherein, the test system includes:Controlled switch unit, control unit and test cell.The test method includes step
Rapid S1 and S2.
The controlled switch unit is connected with the power supply of router to be tested.
Specifically, the controlled switch unit is attached between the power interface and power supply system of the router.Example
Such as, the controlled switch is connected between the power outlet of the router and a wiring board.The wiring board is electrically connected with city.
Here, the controlled switch unit includes:Relay and peripheral circuit for voltage stabilizing.
In step sl, described control unit sends switch order according to default rule to the controlled switch unit,
So that the controlled switch unit carries out on-off line operation based on the switch order to the power supply of the router.
Specifically, technical staff first passes through interface or is used in advance to described control unit setting from external equipment in advance
The rule of the controlled switch unit break-make power supply is controlled, then described control unit controlled is opened based on set rule to described
It closes unit and sends switch order.Then the controlled switch unit is based on the switch order and carries out power on/off behaviour to the router
Make.Wherein, the rule includes but not limited to:Fixed power on/off periods rules, random power on/off periods rules, setting when
The rule in fixed or random power on/off period in area.
It enabled the controlled switch unit be powered once every 3 seconds for example, technical staff is arranged by interface, is powered every time
Shi Changwei 30 seconds.Then described control unit is since being completed the rule settings, according to system clock every 3 seconds to described
Controlled switch unit sends out electrical instruction, then the controlled switch unit is based on the electrical instruction and executes power-on servicing, when logical
When 30 seconds electric, described control unit sends out cut-offing instruction, then it is disconnected to be based on cut-offing instruction execution for the controlled switch unit
It is electrically operated.So repeat.
For another example, the technical staff is arranged from 6 pm to the next morning by interface and is sent using stochastic model for 9 points
Switch order, then described control unit in the afternoon 6 points in 9 points of time zone of the next morning, it is random to send electrical instruction or disconnected
Electricity instruction.In this way, the test system can After Hours continue to test in employee, when efficiently using unattended
Area completes dependence test.
Preferably, the random number that generates every time in order to prevent repeats, described control unit using different seeds generate with
Machine number.For example, described control unit generates different seeds by executing srand ((int) time (NULL)) sentences.
Then, in step s 2, the test cell carries out the router when the power supply of the router is powered
Test.
Specifically, the test cell is by monitoring the power on/off situation of the controlled switch unit or by receiving institute
Switch order is stated to identify power on/off situation, when determining that the power supply of the router is powered, according to preset testing process to institute
Router is stated to be tested.Wherein, the test can be electric test, routine test, high/low temperature test etc..
Preferably, the opening and closing for the controlled switch unit is frequent, and the test cell is used in the router
When power supply is powered, the router is carried out and the relevant test of power down.Wherein, the test relevant with power down includes but not
It is limited to following at least one:Configuration loss, mirror image damage.
According to Fig.2, the course of work of the test system is exemplified below:
Technical staff by interface input in the afternoon 6 points to 9 points of the next morning using fixed power on/off periods rules, and
It is primary that setting enabled the controlled switch unit be powered every 3 seconds, be powered every time when it is 30 seconds a length of.Then described control unit base
Electrical instruction or cut-offing instruction are sent to the controlled switch unit in above-mentioned rule, the controlled switch unit, which is based on being powered, to be referred to
It enables or cut-offing instruction enables the router power on/off, at the same time, the test cell being connected with the controlled switch unit exists
Ping setting IP instructions are sent to the router when it is powered, to test the preservation situation of the configuration of the router.
In conclusion the test system and method for the router of the present invention, controlled by being arranged in the power end of router
Switch unit simultaneously sets control rule, and what the test system can be not necessarily to manually participate in is tested automatically, realizes nobody
On duty, adjust automatically power-on time improves the operational efficiency of test system;In addition, the test system can be according to various
Control rule is tested, and is effectively ensured in unattended period, test it is comprehensive.So the present invention effectively overcomes
Various shortcoming in the prior art and have high industrial utilization.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripe
The personage for knowing this technology can all carry out modifications and changes to above-described embodiment without violating the spirit and scope of the present invention.Cause
This, institute is complete without departing from the spirit and technical ideas disclosed in the present invention by those of ordinary skill in the art such as
At all equivalent modifications or change, should by the present invention claim be covered.