The automated testing method of Qinq function and system
Technical field
The present invention relates to automatic test field, particularly relate to a kind of automated testing method and system of Qinq function.
Background technology
At present when testing Qinq function, need change to the port mode in testing equipment, by equipment arranging band vlantag, message not with vlantag, different tpid value giving out a contract for a project, receiving at receiving terminal and E-Packeting, verifying whether Qinq function comes into force by analytic message.This test needs manually repeatedly configure the port mode of equipment under test and create multiple vlanmap mapping table, sends, resolves, verifies various message.Testing procedure is similar, often changes port mode and all can send identical band vlantag, message not with vlantag, different tpid value, operate repeat loaded down with trivial details.
Summary of the invention
For problems of the prior art, the invention provides a kind of automated testing method and system of Qinq function, the test of intellectuality, automation can be carried out.
The present invention adopts following technical scheme:
An automated testing method for Qinq function, be applied to the Qinq functional test of testing equipment to switch, described automated testing method comprises:
Step S1, described testing equipment utilizes serial ports instrument to log in the bottom of switch;
Step S2, described testing equipment opens the Qinq function of described switch, and creates multiple vlan;
Step S3, described testing equipment sends test packet to described switch;
Step S4, described testing equipment receives the feedback message of described switch, and is mated with default result by described feedback message, to determine that whether the Qinq function of described switch is normal according to the result of coupling.
Preferably, in described automated testing method:
Described testing equipment sends the receiving port of test packet to described switch;
Described testing equipment feeds back message described in the forwarding port accepts of described testing equipment.
Preferably, described receiving port is set as UNI pattern, and described forwarding ports-settings is NNI or UNI pattern.
Preferably, in described automated testing method:
Described testing equipment comprises the first network interface card and the second network interface card; And
Described testing equipment sends described test packet to described switch by described first network interface card;
Described testing equipment receives by the second network interface card the described feedback message that described testing equipment sends.
Preferably, described test packet comprises: be with vlan, not with vlan and different tpid values; And
Described testing equipment by vlan and the tpid value of described feedback message with preset result and mate.
Preferably, in described automated testing method:
If when described feedback message mates with default result, then the Qinq function of described switch is normal;
Otherwise, the Qinq dysfunction of described switch.
Preferably, described automated testing method also comprises:
Step S51: after described step S4, revises the tpid value of described receiving port and/or forwarding port, continues to perform described step S3.
Preferably, described automated testing method also comprises:
Step S52, after described step S4, arranges multiple vlan at described receiving port and/or forwarding port and maps, continue to perform described step S3.
Preferably, described automated testing method also comprises:
Step S53, after described step S4, revising described receiving port is NNI pattern, and described forwarding port is NNI or UNI pattern, continues to perform described step S3.
An automatization test system for Qinq function, described automated system comprises:
Testing equipment, comprises the first network interface card and the second network interface card;
Switch, comprises receiving port and forwards port; And
First network interface card of described testing equipment is connected with the receiving port of switch, and the second network interface card of described testing equipment is connected with the forwarding port of described switch; The serial ports of described testing equipment is connected with the serial ports of described switch; Wherein
Described testing equipment sends test packet to described receiving port by the first network interface card, and the second network interface card of described testing equipment is by forwarding port accepts feedback message, by resolving described feedback message, described testing equipment determines that whether Qinq function is normal.
Preferably, testing equipment is stored in described testing equipment; And
Described testing equipment sends test packet to described receiving port by the first network interface card, second network interface card of described testing equipment is by forwarding port accepts feedback message, described feedback message mates with default result by described testing equipment, and the result according to coupling determines that whether Qinq function is normal.
The invention has the beneficial effects as follows:
Testing efficiency of the present invention is high, automated procedures can configure the combination of various port mode, configure tpid and the vlanapp information of all supports and do not need to consume manpower manual test, program is only needed automatically to run, and this test can complete on one's own time, improve testing efficiency, the test resource that the present invention simultaneously needs is few, only needs PC and two network interface card.After networking, only need click this program and automatically run, and automatically can read result:, automatically parse vlantag and the tpid value of message, and contrast with expected results, comparing result is accurately errorless.Pinpoint the problems and stop in time.
Accompanying drawing explanation
Fig. 1 is the structural representation of the automatization test system of Qinq function of the present invention;
Fig. 2 is the schematic diagram of the automated testing method of Qinq function of the present invention.
Embodiment
It should be noted that, when not conflicting, following technical proposals, can combine between technical characteristic mutually.
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is further described:
In reality test, need the test environment of two terminal equipments and equipment under test composition.Manually configure the port mode of equipment under test and multiple vlanmap mapping table, software of giving out a contract for a project is set and sends various appointment message, then whether meet Qing rule by vlantag and the tpid value in packet receiving software parses message.At present not for the automated testing method of switch ports themselves Qinq function.
Embodiment one
The present embodiment devises automated procedures, controls the automatic logging device of serial ports instrument, and control PC network interface card sends specifies message (test packet), and analyzing device E-Packets.Vlantag and the tpid value parsed and expected results contrast by this program.Do not mate with expected results if find, out of service, eject miscue.
The present embodiment provides a kind of automatization test system of Qinq function, and automated system comprises:
Testing equipment, comprises the first network interface card and the second network interface card;
Equipment under test (can be switch), comprises receiving port and forwards port; And
First network interface card of testing equipment is connected with the receiving port of equipment under test, and the second network interface card of testing equipment is connected with the forwarding port of equipment under test; The serial ports of testing equipment is connected with the serial ports of equipment under test; Wherein
Testing equipment sends message to receiving port by the first network interface card, and the second network interface card of testing equipment is by forwarding port accepts feedback message, by resolving feedback message, testing equipment determines that whether Qinq function is normal.
In the present invention's preferred embodiment, in testing equipment, store automated procedures; And
Automated procedures send message to receiving port by the first network interface card, and the second network interface card of automated procedures is by forwarding port accepts feedback message, and automated procedures will be fed back message and mate with default result, and the result according to coupling determines that whether Qinq function is normal.
In the present embodiment, need the testing equipment (can be PC) of a double netcard, network interface card 1 (the first network interface card) connects the receiving port of equipment under test, and network interface card 2 (the second network interface card) connects the forwarding port of equipment under test; The serial ports of this PC is connected the serial ports of equipment under test; Finally automated procedures are copied into this PC.
Embodiment two
The present embodiment provides a kind of automated testing method of Qinq function, and be applied to the Qinq functional test of testing equipment to switch ports themselves, automated testing method comprises:
Step S1: the serial ports instrument of testing equipment logs in the bottom of equipment under test;
Step S2: the automated procedures in testing equipment open the Qinq function of equipment under test, and create multiple vlan;
Step S3: automated procedures send message (test packet) to equipment under test;
Step S4 automated procedures receive the feedback message of testing equipment, and automated procedures will be fed back message and mate with default result, determine that whether Qinq function is normal.
In the present invention's preferred embodiment, automated testing method specifically comprises:
Automated procedures send the receiving port of message to equipment under test;
Automated procedures are from the forwarding port accepts feedback message of testing equipment.
In the present invention's preferred embodiment, receiving port is set as UNI pattern; Forwarding ports-settings is NNI or UNI pattern.
In the present invention's preferred embodiment, automated testing method specifically comprises:
Testing equipment comprises the first network interface card and the second network interface card; And
Automated procedures send message to equipment under test by the first network interface card;
Automated procedures receive the feedback message of testing equipment by the second network interface card.
In the present invention's preferred embodiment, message comprises: band vlan and not with vlan and different tpid values; And
Automated procedures by vlan and the tpid value of feedback message with preset result and mate.
In the present invention's preferred embodiment, automated testing method also comprises:
When feedback message mates with default result, then Qinq function is normal, when automated procedures can not receive feedback message or feedback message does not mate with default result, and Qinq dysfunction.
In the present invention's preferred embodiment, automated testing method also comprises:
Step S51: after step S4, the tpid value of amendment receiving port and/or forwarding port, performs step S3.
In the present invention's preferred embodiment, automated testing method also comprises:
Step S52: after step S4, arranges multiple vlan at receiving port and/or forwarding port and maps, perform step S3.
In the present invention's preferred embodiment, automated testing method also comprises:
Step S53: after step S4, amendment receiving port is set as NNI pattern, and forwarding ports-settings is NNI or UNI pattern, performs step S3.
In the present invention's preferred embodiment, automated testing method also comprises:
Automated procedures are copied in testing equipment by step S0: before step S1.
In the present embodiment, the serial ports instrument of automated procedures (hereinafter referred to as program) control PC logs in equipment under test bottom, program opening device Qinq, creates multiple vlan, the receiving port of network interface card 1 connection device, the forwarding port of network interface card 2 connection device; Programming equipment receiving port is UNI pattern, and forwarding port is NNI/UNI pattern; Program is transmit band vlantag, message not with vlantag, different tpid value respectively, and is sent to the receiving port of equipment by the network interface card 1 of PC; Program is resolved network interface card 2 and is received vlantag and the tpid value of message and contrast with expected results, if without receiving or not mating, eject miscue, and out of service.
In the present invention's preferred embodiment, the TPID value of amendment receiving port, repeated execution of steps S3;
In the present invention's preferred embodiment, amendment forwards the TPID value of port, repeated execution of steps S3;
In the present invention's preferred embodiment, various vlan is set at receiving port and maps, repeated execution of steps S3;
In the present invention's preferred embodiment, various vlan is set at forwarding port and maps, repeated execution of steps S3;
In the present invention's preferred embodiment, amendment receiving port is NNI pattern, and forwarding port is NNI/UNI pattern, repeated execution of steps S3.
In sum, the network interface card that the present invention designs a kind of method control PC sends appointment message, configured port pattern and vlanmap table, monitoring also analyzing device E-Packets, whether checking Qinq function comes into force, and adopts automated procedures to test, and real-time test results monitored.The present invention can change port mode (UNI, NNI pattern) flexibly and use automated procedures to configure various vlanmap mapping table; Use automated procedures control PC network interface card to send and specify message, use automated procedures vlantag and the tpid value parsed and expected results to be contrasted, real-time test results monitored, gets off if any exception record simultaneously, and shut-down operation.Testing efficiency of the present invention is high, automated procedures can configure the combination of various port mode, configure tpid and the vlanapp information of all supports and do not need to consume manpower manual test, program is only needed automatically to run, and this test can complete on one's own time, improve testing efficiency, the test resource that the present invention simultaneously needs is few, only needs PC and two network interface card.After networking, only need click this program and automatically run, and automatically can read result, automatically parse vlantag and the tpid value of message, and contrast with expected results, comparing result is accurately errorless.Pinpoint the problems and stop in time.
By illustrating and accompanying drawing, giving the exemplary embodiments of the ad hoc structure of embodiment, based on the present invention's spirit, also can do other conversion.Although foregoing invention proposes existing preferred embodiment, but these contents are not as limitation.
For a person skilled in the art, after reading above-mentioned explanation, various changes and modifications undoubtedly will be apparent.Therefore, appending claims should regard the whole change and correction of containing true intention of the present invention and scope as.In Claims scope, the scope of any and all equivalences and content, all should think and still belong to the intent and scope of the invention.