Summary of the invention
The problems referred to above existed for existing packet capturing service, now providing one to aim at can be integrated at automatic testEnvironment triggers automatically and captures error message, it is provided that triggering packet snapping system and the method automatically of fault location efficiency.
Concrete technical scheme is as follows:
One triggers packet snapping system automatically, including
A plurality of clients, described client tests accordingly in order to performing, and each described client includes multiple thread,The corresponding pre-set code of each thread and corresponding default crawl time;
One server, is connected with described a plurality of clients respectively, it is provided that a plurality of different described pre-set code, describedServer is in order to monitor the test code of each described client, when described test code is described pre-set code, and described clothesBusiness device controls described client terminal start-up corresponding to the described test code described thread corresponding with described pre-set code described pre-If performing to capture the operation of message in the time of crawl, described client closes described thread after the described crawl time terminates.
Preferably, described server includes:
One monitoring means, in order to monitor a plurality of described test code of described a plurality of client;
One memory element, in order to store a plurality of different described pre-set code;
One recognition unit, connects described monitoring means and described memory element respectively, in order to identify each described test generationWhether code is described pre-set code;
One processing unit, connects described recognition unit, when described test code is described pre-set code, and described process listUnit sends control instruction in order to the described client corresponding to described test code, pre-with described to control described client terminal start-upIf the described thread that code is corresponding performs to capture the operation of message within the described default crawl time, after the described crawl time terminatesDescribed client closes described thread.
Preferably, described client is in order to save as PCAP lattice by the described message captured after the described crawl time terminatesFormula.
Preferably, the described thread that the described pre-set code in described client is corresponding is in order to set up described pre-set code pairThe session channel being in original state between described client and the described server answered;Sign on is sent out by described serverWhen delivering to described client, described session channel is converted to state of activation by described original state;Described client executing capturesDuring the operation of message, described session channel is converted to waiting state by described state of activation;After the described crawl time terminates, describedSession channel is converted to close off state by described waiting state, and described thread is closed.
Preferably, when described session channel is in described waiting state, described client sends heartbeat message in order to timingTo described server.
One triggers packet snapping method automatically, and application triggers packet snapping system described above automatically, including:
Described server is in order to monitor the test code of each described client, when described test code is described default generationDuring code, described in described server controls, test the described line that described client terminal start-up corresponding to code is corresponding with described pre-set codeJourney performs to capture the operation of message within the described default crawl time, and described client closes institute after the described crawl time terminatesState thread.
Preferably, comprise the steps:
The a plurality of described test code of a plurality of clients described in the most described monitoring server;
Whether each described test code of the most described server identification is described pre-set code;
S3., when described test code is described pre-set code, described server is in order to corresponding to described test codeDescribed client sends control instruction, to control the described client terminal start-up described thread corresponding with described pre-set code describedPerform to capture the operation of message in presetting the crawl time;
The most described crawl time terminates rear described client and closes described thread.
Preferably, described client is in order to save as PCAP lattice by the described message captured after the described crawl time terminatesFormula.
Preferably, the described thread that the described pre-set code in client is corresponding described in described step S3 is in order to set upThe session channel being in original state between described client and described server that described pre-set code is corresponding;Described serviceWhen sign on is sent to described client by device, described session channel is converted to state of activation by described original state;DescribedWhen client executing captures the operation of message, described session channel is converted to waiting state by described state of activation;Described crawlAfter time terminates, described session channel is converted to close off state by described waiting state, and described thread is closed.
Preferably, when described session channel is in described waiting state, described client sends heartbeat message in order to timingTo described server.
The beneficial effect of technique scheme:
Automatically triggering packet snapping system obtains error code by the way of using monitoring client test code thus opens visitorIn the end of family, the triggering of corresponding thread captures message operation, and stopping crawl message closes this thread within the time set, it is achievedCan when client breaks down quick obtaining fault message, fault is positioned, the efficiency of location is high;
Automatically triggering packet snapping method support automatically triggers packet snapping system and achieves the technique effect of fast failure location.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, completeDescribe, it is clear that described embodiment is only a part of embodiment of the present invention rather than whole embodiments wholely.Based onEmbodiment in the present invention, those of ordinary skill in the art obtained on the premise of not making creative work all itsHis embodiment, broadly falls into the scope of protection of the invention.
It should be noted that in the case of not conflicting, the embodiment in the present invention and the feature in embodiment can phasesCombination mutually.
The invention will be further described with specific embodiment below in conjunction with the accompanying drawings, but not as limiting to the invention.
As it is shown in figure 1, one triggers packet snapping system automatically, including
A plurality of clients 1, client 1 tests accordingly in order to performing, and each client 1 includes multiple thread, eachThe corresponding pre-set code of thread and corresponding default crawl time;
One server 2, is connected with a plurality of clients 1 respectively, it is provided that a plurality of different pre-set code, and server 2 is usedTo monitor the test code of each client 1, when testing code and being pre-set code, it is corresponding that server 2 controls test codeClient 1 starts the thread corresponding with pre-set code and performs to capture the operation of message within the default crawl time, and client 1 is being grabbedThe time of taking closes thread after terminating.
Further, pre-set code is test Error Code (error code), can set according to different Error CodePut the different crawl time.
In the present embodiment, automatically trigger packet snapping system and use Master (master)/Slave (from dish) framework, client 1For equipment under test.By the way of using monitoring client 1 to test code, obtain error code thus open in client 1 correspondingThread triggering captures message operation, and stopping crawl message closes this thread within the time set, it is achieved that can be in client 1Quick obtaining fault message when breaking down, positions fault, and the efficiency of fault location is high.
In a preferred embodiment, server 2 comprises the steps that
One monitoring means 21, in order to monitor a plurality of test codes of a plurality of client 1;
One memory element 22, in order to store a plurality of different pre-set code;
One recognition unit 23, connects monitoring means 21 and memory element 22, respectively in order to whether to identify each test codeFor pre-set code;
One processing unit 24, connects recognition unit 23, and when testing code and being pre-set code, processing unit 24 is in order to surveyExamination client 1 corresponding to code sends control instruction, starts the thread corresponding with pre-set code and grabs default controlling client 1Performing to capture the operation of message in taking the time, the crawl time terminates rear client 1 and closes thread.
In the present embodiment, server 2 uses multithread state conversion to realize controlling occur that the client 1 of error code is enteredRow captures the operation of message.When that is equipment under test breaks down client 1, the daily record output of the equipment under test of monitoring or testThe return value of script is corresponding Error Code, when monitoring Error Code, starts the operation capturing message, according to notSame Error Code carries out corresponding time delay, stops capturing the operation of message after arriving the crawl time.
In a preferred embodiment, client 1 is in order to save as PCAP lattice by the message of crawl after the crawl time terminatesFormula.
In the present embodiment, message saves as PCAP form can conveniently reduce equipment under test situation when going wrong, andEasily obtain the problem between message interaction.
In a preferred embodiment, the thread that the pre-set code in client 1 is corresponding is corresponding in order to set up pre-set codeThe session channel being in original state between client 1 and server 2;Sign on is sent to client 1 by server 2Time, session channel is converted to state of activation by original state;When client 1 performs the operation capturing message, session channel is by swashingState Transferring of living is waiting state;After the crawl time terminates, session channel is converted to close off state by waiting state, and thread closesClose.
As in figure 2 it is shown, in the present embodiment, after setting up session channel between client 1 and server 2, session channelIt is now in initial (OPEN) state;After client 1 receives the sign on that server 2 issues, session channel is turned by OPENBeing changed to activate (ALIVE) state, if there being abnormal appearance in this process, session channel is immediately returned to OPEN state;ClientAfter end 1 execution captures the operation of message, session channel is converted to wait (WAIT) state by alive state, in this processIf there being abnormal appearance, session channel is immediately returned to OPEN state;After reaching the crawl time corresponding for Error Code, sessionPassage is to close (Close) state by WAIT State Transferring, and the operation capturing message terminates, and thread is closed;Until can next timeTalking path is OPEN state by Close State Transferring.
In a preferred embodiment, when session channel is waited for, client 1 sends heartbeat message extremely in order to timingServer 2.
In the present embodiment, client 1 notification server 2 by the way of sending heartbeat message continuously keeps being somebody's turn to doSession.
One triggers packet snapping method automatically, and application triggers packet snapping system described above automatically, including:
Server 2 is in order to monitor the test code of each client 1, and when testing code and being pre-set code, server 2 is controlledThe client 1 that system test code is corresponding starts the thread corresponding with pre-set code and performs to capture message within the default crawl timeOperation, client 1 closes thread after the crawl time terminates.
In the present embodiment, automatically trigger packet snapping method and can be applicable in continuous integrating test environment, by judging clientWhether end 1 occurs that the mechanism of Error Code performs to capture the operation of message, many owing to having in the environment of continuous integrating testSet automatic test runs simultaneously, and after occurring in that Error Code in test process, this mechanism can be according to different ErrorCode calls corresponding thread, when there being multiple Error Code to occur, can call multiple corresponding thread simultaneously, and thread can lead toCross session channel mechanism and start the operation capturing message.Until thread terminates after time-out, continuous integrating environment proceeds follow-upTest.
As it is shown on figure 3, in a preferred embodiment, comprise the steps:
S1. server 2 monitors a plurality of test codes of a plurality of client 1;
S2. server 2 identifies whether each test code is pre-set code;
S3., when testing code and being pre-set code, server 2 sends in order to the client 1 corresponding to test code and controlsInstruction, with control client 1 start the thread corresponding with pre-set code perform within the default crawl time crawl message operation;
S4. the time that captures terminates rear client 1 and closes thread.
In the present embodiment, server 2 uses multithread state conversion to realize controlling occur that the client 1 of error code is enteredRow captures the operation of message.When that is equipment under test breaks down client 1, the daily record output of the equipment under test of monitoring or testThe return value of script is corresponding Error Code, when monitoring Error Code, starts the operation capturing message, according to notSame Error Code carries out corresponding time delay, stops capturing the operation of message after arriving the crawl time.
In a preferred embodiment, client 1 is in order to save as PCAP lattice by the message of crawl after the crawl time terminatesFormula.
In the present embodiment, message saves as situation when PCAP form convenient reduction equipment under test goes wrong, and holdsEasily obtain the problem between message interaction.
As in figure 2 it is shown, in a preferred embodiment, the thread that the pre-set code in client 1 is corresponding in step s3 is usedTo set up the session channel being in original state between client corresponding to pre-set code 1 and server 2;Server 2 will be openedWhen beginning to instruct transmission to client 1, session channel is converted to state of activation by original state;Client 1 performs to capture messageDuring operation, session channel is converted to waiting state by state of activation;After the crawl time terminates, session channel is changed by waiting stateFor closed mode, thread is closed.
Further, when session channel is waited for, client 1 sends heartbeat message to server 2 in order to timing.
In the present embodiment, as a example by the operation capturing message of a thread: server 2 and client 1 communicate,Trigger client 1 and perform to capture the operation of message.After occurring in that Error Code in test process, server 2 and clientSetting up a session channel between end 1, while setting up session channel, server 2 can send sign on and inform that client 1 canTo carry out capturing the operation of message, at this moment client 1 starts this session channel, starts to capture message, and by this session channelState is changed into Alive state.During capturing message, session channel is always maintained at, and in conversation procedure, client 1 can be heldThe continuous heartbeat message notification server 2 that constantly sends keeps this session.In the mechanism of Master/Slave, can be according to differentThe Error Code definition different crawl time determines to capture the duration of message, and server 2 can send stopping after a time out and refer toOrder, client 1 stops capturing the operation of message, terminates session simultaneously, and session channel state is changed into Close state.AsFruit has multiple thread simultaneously, and server 2 can carry out the operation of multiple crawl message simultaneously, is not take up mutually resource.
The present invention, can be according to the different settings of Error Code in server 2 in order to ensure to capture the accuracy of messageThe different crawl time, after exceeding the crawl time, stop capturing the operation of message, and crawl message is grabbed save as PCAP latticeFormula, closes corresponding thread.The present invention is to carry out the transmission of order line based on Master/Slave mechanism to control to capture messageAnd stop the operation of crawl message.Owing to continuous integrating automatic test is a continuous print test process, therefore addMulti-thread mechanism controls repeatedly to implement packet capturing operation, it is achieved thereby that go to trigger the behaviour capturing message according to Error CodeMake.
The foregoing is only preferred embodiment of the present invention, not thereby limit embodiments of the present invention and protection modelEnclose, to those skilled in the art, it should can appreciate that done by all utilization description of the invention and diagramatic contentScheme obtained by equivalent and obvious change, all should be included in protection scope of the present invention.