A test method and system for flow token bucket based on SrTCM
By constructing different types of set traffic, testing the traffic token bucket based on SrTCM, the problem of insufficient testing in the existing technology is solved, and a more comprehensive and refined test of the single-speed three-color marker algorithm is realized.
Patent Information
- Application Number
- CN202211505082.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-28
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2042-11-28
AI Technical Summary
When testing SrTCM-based traffic token buckets, the prior art lacks targeted testing for burst traffic and excess burst traffic, resulting in insufficient testing and insufficient testing, resulting in missed testing and incomplete policy algorithm branch coverage.
By constructing the set traffic, including constant rate traffic, burst traffic and excess burst traffic, sampling the processing data and forwarding rate of the network equipment under test, and determining whether the test of the traffic token bucket of the single-speed three-color marker algorithm has passed. This method designs a special traffic waveform for the implementation logic of the SrTCM algorithm to test the correctness of the algorithm's processing logic for burst traffic and excess burst traffic.
A more comprehensive and refined test of the single-speed three-color marker algorithm traffic token bucket is realized, covering the test scenarios of burst traffic and excess burst traffic, and enhancing the purpose and accuracy of the test.
Smart Images

Figure CN115801689B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of performance testing. Specifically, it relates to a test method and system for a traffic token bucket based on SrTCM. Background Art
[0002] In the token bucket technology, the token bucket can be regarded as a container that stores a certain number of tokens. The system places tokens into the bucket at a set speed. When the bucket is full of tokens, the extra tokens overflow and the number of tokens in the bucket no longer increases. When using the token bucket to evaluate traffic, it is based on whether the number of tokens in the token bucket is sufficient to satisfy the forwarding of packets. If there are enough tokens in the bucket to forward a packet, the traffic is said to comply with or meet the agreed value; otherwise, it is called traffic overrun or non-compliance with the agreed value.
[0003] Regarding the way the token bucket processes packets, the RFC defines two marking algorithms: the single rate three color marker (SrTCM, or also known as the single speed double bucket algorithm) algorithm, which mainly focuses on the burst of packet sizes. The two rate three color marker (trTCM, or also known as the two speed double bucket algorithm) algorithm, which mainly focuses on the burst of packet rates. The evaluation results of both algorithms are to mark the packets with three colors: red, yellow, and green, so it is called "three-color marking".
[0004] In the single rate three color marker algorithm, for the convenience of description, the two token buckets are called bucket C and bucket E, and the number of tokens in the buckets is represented by Tc and Te. The single speed double bucket has three parameters:
[0005] CIR (Committed Information Rate): The committed information rate, which represents the rate at which tokens are put into bucket C, that is, the average rate at which bucket C allows packets to be transmitted or forwarded.
[0006] CBS (Committed Burst Size): The committed burst size, which represents the capacity of bucket C, that is, the committed burst traffic that bucket C can instantaneously pass through.
[0007] EBS (Excess Burst Size): The excess burst size, which represents the capacity of bucket E, that is, the excess burst traffic that bucket E can instantaneously pass through.
[0008] The system places tokens into the bucket at the CIR rate: If Tc < CBS, Tc increases. If Tc = CBS and Te < EBS, Te increases. If Tc = CBS and Te = EBS, neither increases.
[0009] For the arriving packet, let B denote the size of the packet: If B ≤ Tc, the packet is marked green and Tc is decreased by B. If Tc < B ≤ Te, the packet is marked yellow and Te is decreased by B. If Tc < B and Te < B, the packet is marked red and neither Tc nor Te is decreased.
[0010] However, in the prior art, when testing the traffic token bucket based on SrTCM, only constant rate is tested, and there is no targeted test for its algorithm characteristics, such as tests for burst traffic and excess burst traffic, etc. The test dimension is insufficient and the test is not comprehensive enough, resulting in problems such as test omission and incomplete coverage of policy algorithm branches. Summary of the Invention
[0011] The purpose of the embodiments of the present application is to provide a test method and system for a traffic token bucket based on SrTCM, so as to solve the problems in the prior art that it is impossible to test for burst traffic and excess burst traffic, etc., the test dimension is insufficient, the test is not comprehensive enough, resulting in test omission, incomplete coverage of policy algorithm branches, etc.
[0012] A test method for a traffic token bucket based on SrTCM provided by the embodiments of the present application is applicable to a traffic token bucket based on the single-rate three-color marker algorithm running in a network device under test. The method includes:
[0013] Construct a set of traffic by a traffic generation device and transmit it to a traffic receiving device through the network device under test;
[0014] During the process of transmitting the set of traffic through the network device under test to the traffic receiving device, sample the processing data of the network device under test and the forwarding rate of the output interface of the network device under test by a test control device; wherein, the processing data includes the number of packets hit by the traffic token bucket and the marking situation of the set of traffic.
[0015] Judge whether the test of the traffic token bucket of the single-rate three-color marker algorithm passes according to the processing data, the forwarding rate, and the sending rate of the set of traffic.
[0016] In the above technical solution, by constructing a set of traffic and sending it to the network device under test, the set of traffic includes constant rate traffic, burst traffic, excess burst traffic, etc., sample the processing data of the network device under test and the forwarding rate of the output interface of the network device under test, and finally judge whether the test of the traffic token bucket of the single-rate three-color marker algorithm passes according to the processing data, the forwarding rate, and the sending rate of the set of traffic. In this embodiment, for the implementation logic of the single-rate three-color marker algorithm, a special and targeted design is made for the waveform generated by the traffic according to this logic, rather than just using constant rate traffic for testing, so as to test the correctness of the processing logic of the algorithm for burst traffic and excess burst traffic, and can test its algorithm logic more comprehensively and finely.
[0017] In some optional implementations, judging whether the test of the traffic token bucket of the single-rate three-color marker algorithm passes according to the processing data, the forwarding rate, and the set traffic sending rate includes:
[0018] When there are no packets marked in red in the set traffic, if the forwarding rate is determined to be inconsistent with the sending rate, the test is determined to have failed;
[0019] When there are packets marked in red in the set traffic, if the determined packet loss traffic is inconsistent with the size of the traffic marked in red, the test is determined to have failed; wherein the packet loss traffic is calculated based on the forwarding rate waveform and the sending rate waveform.
[0020] In some optional implementations, judging whether the test of the traffic token bucket of the single-rate three-color marker algorithm passes according to the processing data, the forwarding rate, and the set traffic sending rate includes:
[0021] If the number of hit packets is inconsistent with the number of packets sent by the current traffic generating device, the test is judged to have failed.
[0022] In some optional embodiments, the flow rate is set to a first flow rate f1(t) satisfying the following function: f1(t)=R1;
[0023] Where t is time, R1 = CIR, CIR is the committed information rate;
[0024] Based on the processing data, forwarding rate, and set traffic sending rate, determine whether the traffic token bucket test of the single-rate three-color marker algorithm passes, including:
[0025] If any of the hit messages is not marked green, the test is deemed to have failed.
[0026] In the above technical solution, a constant rate scenario is tested to ensure the functional effectiveness of token consumption and replenishment of the single-rate three-color marker algorithm.
[0027] In some optional implementations, the flow rate is set to a second flow rate f2(t) that satisfies the following function:
[0028]
[0029] Where t is time, R1 = CIR, CIR is the committed information rate;
[0030] Based on the processing data, forwarding rate, and set traffic sending rate, determine whether the traffic token bucket test of the single-rate three-color marker algorithm passes, including:
[0031] If any of the hit messages is not marked green, the test is deemed to have failed.
[0032] In the above technical solution, the traffic rates of CIR and CIR / 2 fluctuate periodically to ensure the effectiveness of token consumption and replenishment functions of the single-rate three-color marker algorithm under traffic fluctuations.
[0033] In some optional implementations, the flow rate is set to a third flow rate f3(t) that satisfies the following function:
[0034]
[0035] Wherein, t is time, f3(t) is a periodic function with a period of T=T1+T2+T3, R1=CIR, CIR is the committed information rate; T2=CBS / (R2-R1), CIR×T3=CBS;
[0036] Based on the processing data, forwarding rate, and set traffic sending rate, determine whether the traffic token bucket test of the single-rate three-color marker algorithm passes, including:
[0037] If any of the hit messages is not marked green, the test is deemed to have failed.
[0038] In the above technical solution, the test is performed on the scenario covering the boundary value where the C bucket token is just exhausted, which increases the completeness of the test logic, enhances the purpose of the test, and improves the accuracy of the test.
[0039] In some optional implementations, the period of the sending rate waveform of the traffic is set to a set period T;
[0040] Before the test control device samples the processed data of the tested network device, the method further includes: setting a sampling period of the tested network device for the test control device to be a set period T.
[0041] In some optional implementations, the flow rate is set to a fourth flow rate f4(t) that satisfies the following function:
[0042]
[0043] Wherein, t is time, the set period T = T1 + T2 + T3, R1 = CIR, CIR is the committed information rate; T2 = (CBS + EBS) / (R2-R1), CIR × T3 = CBS + EBS; CBS is the committed burst size, EBS is the excess burst size;
[0044] Based on the processing data, forwarding rate, and set traffic sending rate, determine whether the traffic token bucket test of the single-rate three-color marker algorithm passes, including:
[0045] If the size of the traffic marked in green is determined to be inconsistent with CIR×T1+R2×T2×[1-EBS / (CBS+EBS+CIR×T2)], or the size of the traffic marked in yellow is determined to be inconsistent with R2×T2×EBS / (CBS+EBS+CIR×T2), the test is determined to fail.
[0046] In the above technical solution, the test is performed on the scenario covering the boundary values where the tokens of buckets C and E are just exhausted, which increases the completeness of the test logic, enhances the purpose of the test, and improves the accuracy of the test.
[0047] In some optional implementations, the flow rate is set to a fifth flow rate f5(t) that satisfies the following function:
[0048]
[0049] Wherein, t is time, the set period T = T1 + T2 + T3 + T4, R1 = CIR, CIR is the committed information rate; T2 = (CBS + EBS) / (R2-R1), CIR × T4 = CBS + EBS; CBS is the committed burst size, EBS is the excess burst size;
[0050] Based on the processing data, forwarding rate, and set traffic sending rate, determine whether the traffic token bucket test of the single-rate three-color marker algorithm passes, including:
[0051] If the size of the traffic marked as green is inconsistent with CIR×T1+R2×T2×[1-EBS / (CBS+EBS+CIR×T2)]+CIR×T3, or the size of the traffic marked as yellow is inconsistent with R2×T2×EBS / (CBS+EBS+CIR×T2), or the size of the traffic marked as red is inconsistent with (R2-CIR)×T3, the test is judged to have failed.
[0052] In the above technical solution, the scenario of sudden default traffic was tested, and the functional effectiveness of the single-speed three-color marker algorithm in dealing with sudden default traffic was tested, which increased the completeness of the test logic, enhanced the purpose of the test, and improved the accuracy of the test.
[0053] In some optional implementations, a test system for a flow token bucket based on SrTCM includes a flow generation device, a flow receiving device, and a test control device;
[0054] A traffic generating device is used to construct a set traffic flow and transmit it to a traffic receiving device through the network device under test; wherein a traffic token bucket based on a single-rate three-color marker algorithm runs on the network device under test;
[0055] The test control device is used to sample the processing data of the network device under test and the forwarding rate of the output interface of the network device under test during the process of setting the traffic to be transmitted through the network device under test to the traffic receiving device; the processing data includes the number of messages hit by the traffic token bucket and the marking status of the set traffic; and, based on the processing data, the forwarding rate and the sending rate of the set traffic, it is determined whether the test of the traffic token bucket of the single-speed three-color marker algorithm has passed.
[0056] In the above technical solution, a traffic generating device, a test control device and a traffic receiving device are used to construct a set traffic to be sent to the network device under test, and the set traffic includes constant rate traffic, burst traffic and excess burst traffic, etc., to sample the processing data of the network device under test and the forwarding rate of the output interface of the network device under test, and finally process the data, forwarding rate and sending rate of the set traffic to determine whether the test of the traffic token bucket of the single-speed three-color marker algorithm is passed. This embodiment is aimed at the implementation logic of the single-speed three-color marker algorithm, and the waveform generated by the traffic is specially and targetedly designed for the logic, rather than just using constant rate traffic for testing, so as to test the correctness of the algorithm's processing logic for burst traffic and excess burst traffic, and can test its algorithm logic more comprehensively and finely. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 A functional module diagram of a flow token bucket test system based on SrTCM provided in an embodiment of the present application;
[0059] Figure 2 A flow chart of the steps of a test method for a traffic token bucket based on SrTCM provided in an embodiment of the present application;
[0060] Figure 3 A first function curve graph satisfied by a traffic sending device generating a first traffic in a first scenario;
[0061] Figure 4 A second function curve graph satisfied by the traffic sending device generating the second traffic in the second scenario;
[0062] Figure 5 A third function curve graph satisfied by the traffic sending device in the third scenario to generate a third traffic;
[0063] Figure 6 A fourth function curve graph satisfied by the traffic sending device in the fourth scenario to generate a fourth traffic;
[0064] Figure 7 A fifth function curve graph satisfied by the traffic sending device generating a fifth traffic in the fifth scenario;
[0065] Figure 8 It is a function curve graph of the forwarding traffic rate in the fifth scenario.
[0066] Icon: 1-traffic generating device, 2-network device under test, 3-traffic receiving device, 4-test control device. DETAILED DESCRIPTION
[0067] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0068] Please refer to Figure 1 , Figure 1 A functional module diagram of a flow token bucket test system based on SrTCM provided in an embodiment of the present application, the system comprises a flow generating device 1, a flow receiving device 3 and a test control device 4;
[0069] The traffic generating device 1 is used to construct the set traffic and transmit it to the traffic receiving device 3 through the network device under test 2; wherein the traffic token bucket based on the single-speed three-color marker algorithm runs on the network device under test 2;
[0070] The test control device 4 is used to sample the processing data of the network device 2 under test and the forwarding rate of the output interface of the network device 2 under test during the process of setting the traffic to be transmitted through the network device 2 under test to the traffic receiving device 3; the processing data includes the number of messages hit by the traffic token bucket and the marking status of the set traffic; and, based on the processing data, the forwarding rate and the sending rate of the set traffic, it is determined whether the test of the traffic token bucket of the single-speed three-color marker algorithm has passed.
[0071] In the embodiment of the present application, a traffic generating device 1, a test control device 4 and a traffic receiving device 3 are used to construct a set traffic to be sent to the network device 2 under test, and the set traffic includes constant rate traffic, burst traffic and excess burst traffic, etc., and the processed data of the network device 2 under test and the forwarding rate of the outbound interface of the network device 2 under test are sampled, and finally the data, forwarding rate and sending rate of the set traffic are processed to determine whether the test of the traffic token bucket of the single-speed three-color marker algorithm is passed. This embodiment is aimed at the implementation logic of the single-speed three-color marker algorithm, and the waveform generated by the traffic is specially and targetedly designed for the logic, rather than just using constant rate traffic for testing, so as to test the correctness of the algorithm's processing logic for burst traffic and excess burst traffic, and its algorithm logic can be tested more comprehensively and finely.
[0072] Among them, the traffic generating device 1, the traffic receiving device 3 and the test control device 4 need to include the following initialization steps when initializing:
[0073] Initialize the automated test system and clear all interfering configurations;
[0074] The traffic generating device 1, the traffic receiving device 3, the test control device 4, and the network device under test 2 are configured respectively. The traffic generating device 1 and the traffic receiving device 3 can communicate with each other through the network device under test 2. The test control device 4 can remotely connect to the traffic generating device 1, the traffic receiving device 3, and the network device under test 2 to obtain corresponding messages;
[0075] On the tested network device 2, the relevant tested configuration of the traffic policing strategy of the traffic token bucket based on the single-speed three-color marker algorithm is performed, and the following parameters are configured respectively: CIR (Committed Information Rate): Committed information rate, which indicates the rate at which tokens are put into bucket C, that is, the average rate at which bucket C allows to transmit or forward messages; CBS (Committed Burst Size): Committed burst size, which indicates the capacity of bucket C, that is, the committed burst traffic that bucket C can pass instantly; EBS (Excess Burst Size): Excess burst size, which indicates the capacity of bucket E, that is, the excess burst traffic that bucket E can pass instantly.
[0076] Please refer to Figure 2 , Figure 2 A flow chart of the steps of a test method for a traffic token bucket based on SrTCM provided in an embodiment of the present application, the method is applicable to a traffic token bucket based on a single-speed three-color marker algorithm running in a network device 2 under test, the method comprising:
[0077] Step 100, the traffic generating device 1 constructs a set traffic and transmits it to the traffic receiving device 3 through the network device under test 2;
[0078] Step 200: In the process of setting the flow to be transmitted through the network device under test 2 to the flow receiving device 3, the test control device 4 samples the processing data of the network device under test 2 and the forwarding rate of the outbound interface of the network device under test 2; wherein the processing data includes the number of messages hit by the flow token bucket and the marking status of the set flow;
[0079] Step 300: The test control device 4 determines whether the test of the traffic token bucket of the single-rate three-color marker algorithm passes according to the processed data, the forwarding rate and the set traffic sending rate.
[0080] In the embodiment of the present application, for the implementation logic of the single-speed three-color marker algorithm, a special and targeted design is performed on the waveform generated by the traffic for the logic, rather than just testing with constant-rate traffic, in order to test the correctness of the algorithm's processing logic for burst traffic and excess burst traffic, and to test the algorithm logic in a more comprehensive and refined manner.
[0081] Specifically, methods for performing tests in five scenarios are provided below. It should be noted that the testing methods or systems in one or more embodiments of the present application are not limited to application in these five scenarios.
[0082] In the first scenario, all packets are marked green, where the traffic rate is equal to the CIR. This is designed as a constant rate scenario to ensure the effectiveness of its algorithm token consumption and replenishment functions.
[0083] Please refer to Figure 3 , Figure 3 A first function curve graph satisfied by the traffic sending device generating the first traffic in the first scenario: f1(t)=R1;
[0084] Wherein, t is time, R1=CIR, CIR is committed information rate, that is, the rate of traffic is equal to the committed information rate of the token bucket.
[0085] After the message of the first flow arrives at the tested firewall of the tested network device 2, due to the effect of the traffic supervision policy of the traffic token bucket of the single-speed three-color marker algorithm, the traffic should hit the policy and participate in the relevant scheduling of the traffic supervision policy of the traffic token bucket of the single-speed three-color marker algorithm. The traffic sending speed shall not exceed the CIR, and all messages of the traffic shall be marked green.
[0086] The test control device 4 obtains relevant information of the network device 2 under test periodically through a remote connection with a fixed time as the sampling period. If the number of policy hits is correct (equal to the number of all messages currently sent) and all messages of the traffic should be marked green, it is in line with expectations and the test continues. Otherwise, the test ends and the test fails directly.
[0087] The test control device 4 also obtains the forwarding rate of the outbound interface of the tested network device 2 periodically through a remote connection with a fixed time as the sampling period. If the forwarding rate is always equal to R1 and there is no packet loss, it is in line with expectations and the test continues. Otherwise, the test ends and the test fails directly. When there are no messages marked in red in the set traffic, if it is determined that the forwarding rate is inconsistent with the sending rate, the test is determined to fail.
[0088] In the second scenario, all packets are marked as green, where the traffic rate does not exceed the CIR and fluctuates periodically. This design is a traffic rate fluctuation of CIR and CIR / 2 to ensure the effectiveness of the algorithm's token consumption and replenishment functions under traffic fluctuations;
[0089] Please refer to Figure 4 , Figure 4 A second function curve graph satisfied by the traffic sending device generating the second traffic in the second scenario:
[0090]
[0091] Where t is time, R1 = CIR, CIR is the committed information rate;
[0092] The second function is a piecewise periodic function with time t as the horizontal axis, with a period of T, and T = 2T1; n is a natural number (0, 1, 2, ...); R1 = CIR is set in the second scenario. The first segment rate of the second function is R1 / 2, which is half of the committed information rate of the token bucket; the second segment rate of the second function is R1, that is, the rate of the traffic is equal to the committed information rate of the token bucket.
[0093] After the packets of the second flow arrive at the firewall under test, due to the traffic policing policy of the traffic token bucket of the single-rate three-color marker algorithm, the traffic should hit the policy and participate in the relevant scheduling of the traffic policing policy of the traffic token bucket of the single-rate three-color marker algorithm. Although the traffic sending rate fluctuates, it does not exceed the CIR in the entire cycle, and all packets of this flow should be marked green;
[0094] The test control device 4 obtains relevant information of the network device 2 under test periodically through a remote connection with a fixed time as the sampling period. If the number of policy hits is correct (equal to the number of all messages currently sent) and the above message is indeed marked green, it is in line with expectations and the test continues. Otherwise, the test ends and the test fails directly.
[0095] The test control device 4 obtains the forwarding rate of the outgoing interface of the tested network device 2 periodically through a remote connection with a fixed time as the sampling period. If the time domain waveform of this forwarding rate is consistent with the sending rate waveform and there is no packet loss, it meets expectations and the test continues. Otherwise, the test ends and the test fails directly.
[0096] In the third scenario, all packets are marked green, there is a burst in traffic, and the tokens in bucket C are exhausted. This design has a cycle of three stages:
[0097] a) In the first stage, since the tokens consumed are equal to the rate at which tokens are put into bucket C, all packets in this stage should be marked green;
[0098] b) The second stage: In this stage, the tokens in bucket C can be exhausted (the tokens in bucket E are not used). All messages in this stage should be marked green.
[0099] c) The third stage: no tokens are consumed in this stage, and bucket C is fully replenished.
[0100] This traffic waveform design increases the completeness of the test logic and covers the scenario where the C bucket token is just exhausted, which enhances the test purpose and improves the test accuracy.
[0101] Please refer to Figure 5 , Figure 5 The third function curve diagram satisfied by the traffic sending device in the third scenario to generate the third traffic:
[0102]
[0103] Wherein, t is time, f3(t) is a periodic function with a period of T=T1+T2+T3, R1=CIR, CIR is the committed information rate; T2=CBS / (R2-R1), CIR×T3=CBS;
[0104] That is to say, in a period T: the first segment rate is R1 (Mbps), the duration is T1, and the token consumption and token replenishment are equal in this stage; the second segment rate is R2 (Mbps), the duration is T2, and the C bucket tokens are just used up in this stage; the third segment rate is 0 (Mbps), the duration is T3, and the C bucket tokens are just filled in this stage.
[0105] After the third flow message is tested by the firewall, due to the effect of the traffic policing strategy of the traffic token bucket of the single-speed three-color marker algorithm, the traffic should hit the strategy and participate in the relevant scheduling of the traffic policing strategy of the traffic token bucket of the single-speed three-color marker algorithm in a period T:
[0106] In the first stage, since the tokens consumed are equal to the rate at which tokens are put into bucket C, all packets in this stage should be marked green.
[0107] The second stage: In this stage, the tokens in bucket C can be exhausted (the tokens in bucket E are not used). All packets in this stage should be marked green.
[0108] The third stage: no tokens are consumed in this stage, and bucket C is fully replenished.
[0109] The test control device 4 obtains relevant information of the network device 2 under test periodically through a remote connection with a fixed time as the sampling period. If the number of policy hits is correct (equal to the number of all messages currently sent) and the above message is indeed marked green, it is in line with expectations and the test continues. Otherwise, the test ends and the test fails directly.
[0110] The test control device 4 obtains the forwarding rate of the outgoing interface of the tested network device 2 periodically through a remote connection with a fixed time as the sampling period. If the time domain waveform of this forwarding rate is consistent with the sending rate waveform and there is no packet loss, it meets expectations and the test continues. Otherwise, the test ends and the test fails directly.
[0111] In the fourth scenario, some packets are marked green, some packets are marked yellow, traffic bursts occur, bucket C is used up, and bucket E is used up. This design has three stages in one cycle:
[0112] In the first stage, since the tokens consumed are equal to the rate at which tokens are put into bucket C, all packets in this stage should be marked green.
[0113] In the second stage, the tokens in bucket C and bucket E can be exhausted, and the proportion of green and yellow packets can be accurately calculated.
[0114] The third stage: no tokens are consumed in this stage, and bucket C is just full of tokens.
[0115] This traffic waveform design increases the completeness of the test logic and covers the scenario where the tokens in buckets C and E are just exhausted, which enhances the purpose of the test and improves the accuracy of the test.
[0116] Please refer to Figure 6 , Figure 6 The fourth function curve diagram satisfied by the traffic sending device generating the fourth traffic in the fourth scenario is as follows:
[0117]
[0118] Wherein, t is time, the set period T = T1 + T2 + T3, R1 = CIR, CIR is the committed information rate; T2 = (CBS + EBS) / (R2-R1), CIR × T3 = CBS + EBS; CBS is the committed burst size, EBS is the excess burst size;
[0119] That is to say, in a period T: the first segment rate is R1 (Mbps), the duration is T1, and the token consumption and token replenishment are equal in this stage; the second segment rate is R2 (Mbps), the duration is T2, and the tokens in buckets C and E are just used up in this stage; the third segment rate is 0 (Mbps), the duration is T3, and the tokens in buckets C and E are just filled in this stage.
[0120] After the message of the fourth flow arrives at the firewall under test, due to the effect of the traffic policing strategy of the traffic token bucket of the single-speed three-color marker algorithm, the traffic should hit the strategy and participate in the relevant scheduling of the traffic policing strategy of the traffic token bucket of the single-speed three-color marker algorithm in a period T:
[0121] In the first stage, since the tokens consumed are equal to the rate at which tokens are put into bucket C, all packets in this stage should be marked as green (the size of this traffic is: CIR×T1);
[0122] The second stage: In this stage, the tokens of bucket C and bucket E can be exhausted. The traffic that accounts for this stage is yellow (the size of this traffic is: R2×T2×[EBS / (CBS+EBS+CIR×T2)]), and the others are green (the size of this traffic is: R2×T2×[1-EBS / (CBS+EBS+CIR×T2)]);
[0123] In the third stage, no tokens are consumed. Bucket C is filled with tokens, and the overflowing tokens in bucket C also fill bucket E.
[0124] The test control device 4 obtains relevant information of the network device 2 under test periodically through a remote connection with a fixed time T=T1+T2+T3 as a sampling period. If the number of policy hits is correct (equal to the number of all messages currently sent), in the marked messages of a period T, the size of the traffic of the yellow message is: R2×T2×[EBS / (CBS+EBS+CIR×T2)], and the size of the traffic of the green message is: CIR×T1+R2×T2×[1-EBS / (CBS+EBS+CIR×T2)]), then it is in line with expectations and the test continues. Otherwise, the test ends and the test fails directly.
[0125] The test control device 4 obtains the forwarding rate of the outgoing interface of the tested network device 2 periodically through a remote connection with a fixed time as the sampling period. If the time domain waveform of this forwarding rate is consistent with the sending rate waveform and there is no packet loss, it meets expectations and the test continues. Otherwise, the test ends and the test fails directly.
[0126] In the fifth scenario, some packets are marked as green packets, some packets are marked as yellow packets, and some packets are marked as red packets. Bucket C is used up, and current limiting is applied after bucket E is used up. A cycle of this design is divided into three stages:
[0127] In the first stage, since the tokens consumed are equal to the rate at which tokens are put into bucket C, all packets in this stage should be marked green.
[0128] In the second stage, the tokens of bucket C and bucket E can be exhausted in the first period of time of this stage, and there are only green and yellow packets, and the proportion of green and yellow packets can be accurately calculated; in the period of time after this stage, there are only green and red packets, and the proportion of green and red packets can be calculated.
[0129] In the third stage, no tokens are consumed. Bucket C is fully replenished with tokens, and the overflowing tokens in bucket C also fill up bucket E.
[0130] In this scenario, the functional effectiveness of the single-rate three-color marker algorithm in dealing with burst default traffic can be tested.
[0131] Please refer to Figure 7 , Figure 7 The fifth function curve diagram satisfied by the traffic sending device generating the fifth traffic in the fifth scenario is as follows:
[0132]
[0133] Wherein, t is time, the set period T = T1 + T2 + T3 + T4, R1 = CIR, CIR is the committed information rate; T2 = (CBS + EBS) / (R2-R1), CIR × T4 = CBS + EBS; CBS is the committed burst size, EBS is the excess burst size;
[0134] That is to say, in a period T: the first segment rate is R1 (Mbps), the duration is T1, and the token consumption and token replenishment are equal in this stage; the second segment rate is R2 (Mbps), the duration is T2+T3, and the tokens in buckets C and E are exhausted in stage T2; the third segment rate is 0 (Mbps), the duration is T4, and the tokens in buckets C and E are just replenished in this stage.
[0135] After the message of the fifth flow arrives at the firewall under test, due to the effect of the traffic policing strategy of the traffic token bucket of the single-speed three-color marker algorithm, the flow should hit the strategy and participate in the relevant scheduling of the traffic policing strategy of the traffic token bucket of the single-speed three-color marker algorithm in a period T:
[0136] In the first stage, since the tokens consumed are equal to the rate at which tokens are put into bucket C, all packets in this stage should be marked as green (the size of this traffic is: CIR×T1);
[0137] The second stage, the first T2 time of this stage can exhaust the tokens of bucket C and bucket E. The traffic size of yellow packets in stage T2 is: R2×T2×[EBS / (CBS+EBS+CIR×T2)], the remaining packets should be marked as green, and the traffic size of green packets in stage T2 is: R2×T2×[1-EBS / (CBS+EBS+CIR×T2)]); in stage T3, the traffic size of green packets is: CIR×T3), the remaining should be marked as red, and the traffic size of red packets is: (R2-CIR)×T3.
[0138] In the third stage, no tokens are consumed. Bucket C is filled with tokens, and the overflowing tokens in bucket C also fill bucket E.
[0139] The test control device 4 obtains relevant information of the tested network device 2 periodically through a remote connection with a fixed time T=T1+T2+T3+T4 as a sampling period. If the number of policy hits is correct (equal to the number of all messages currently sent) and the message color stage statistics (yellow, green, and red are: yellow R2×T2×[EBS / (CBS+EBS+CIR×T2)], green CIR×T1+R2×T2×[1-EBS / (CBS+EBS+CIR×T2)]+CIR×T3, red (R2-CIR)×T3) are consistent with the standard, then it meets expectations and the test continues. Otherwise, the test ends and the test fails directly.
[0140] The test control device 4 obtains the forwarding rate of the outbound interface of the tested network device 2 periodically through a remote connection with a fixed time as the sampling period. If the waveform of this forwarding rate is as follows Figure 8 , if the packet loss flow size in one cycle is (R2-CIR)×T3, it is in line with expectations and the test continues; otherwise, the test ends and the test fails directly.
[0141] In the above scenarios, a single cycle can be used as a functional effectiveness test, or the traffic can be repeated periodically to test the stability of the single-rate three-color marker algorithm, making the test more complete. In actual testing, the test is considered passed only if all five scenarios pass.
[0142] In summary, the present application analyzes the implementation logic of the single-speed three-color marker algorithm, and specially designs the waveform of the traffic generation for the logic, rather than just using constant rate traffic for testing, to test the correctness of the algorithm for processing burst traffic and excess burst traffic. Compared with the prior art, the algorithm logic can be tested more comprehensively and finely. In this embodiment, the traffic design takes into account the critical point of token bucket consumption, such as token consumption and replenishment are equal, C bucket tokens are just exhausted, E bucket tokens are just exhausted, etc. The relevant test of this boundary value enhances the purpose of the test and improves the accuracy of the test; this embodiment respectively conducts targeted tests on five scenarios for expected green-marked messages, expected yellow-marked messages, and expected red-marked messages, with clear emphasis and complete logic coverage. In addition, this embodiment can judge the phased results of the validity of the traffic token bucket of the single-speed three-color marker algorithm in an automated manner, analyze in real time, and predict the results of the automated test in advance. If the test does not meet expectations in the middle, it can be predicted in advance to end the test and save test time.
[0143] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0144] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0145] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0146] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0147] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A test method for a traffic token bucket based on SrTCM, characterized in that: The method is applicable to a flow token bucket based on a single-speed three-color marker algorithm running in a network device under test, and the method comprises: The traffic generating device constructs a set traffic flow and transmits it to the traffic receiving device through the network device under test; the set traffic flow includes constant rate traffic flow, burst traffic flow and excess burst traffic flow; In the process of setting the flow to be transmitted through the network device under test to the flow receiving device, the test control device samples the processing data of the network device under test and the forwarding rate of the outbound interface of the network device under test; wherein the processing data includes the number of messages hit by the flow token bucket and the marking status of the set flow; According to the processed data, the forwarding rate and the sending rate of the set traffic, it is determined whether the test of the traffic token bucket of the single-rate three-color marker algorithm is passed.
2. The method according to claim 1, characterized in that The step of judging whether the flow token bucket test of the single-rate three-color marker algorithm passes according to the processed data, the forwarding rate and the set flow rate comprises: When there is no message marked in red in the set flow, if it is determined that the forwarding rate is inconsistent with the sending rate, the test is determined to have failed; When there are packets marked in red in the set traffic, if the determined packet loss traffic is inconsistent with the size of the traffic marked in red, the test is determined to have failed; wherein the packet loss traffic is calculated based on the forwarding rate waveform and the sending rate waveform.
3. The method according to claim 1, characterized in that The step of judging whether the flow token bucket test of the single-rate three-color marker algorithm passes according to the processed data, the forwarding rate and the set flow rate comprises: If it is determined that the number of hit messages is inconsistent with the number of messages sent by the current traffic generating device, the test is determined to have failed.
4. The method according to claim 1, wherein: in, The set flow rate is the first flow rate that satisfies the following function f 1(t): f 1(t) =R1; Where t is time, R1=CIR, CIR is the committed information rate; The step of judging whether the flow token bucket test of the single-rate three-color marker algorithm passes according to the processed data, the forwarding rate and the set flow rate comprises: If any of the hit messages is not marked green, the test is deemed to have failed.
5. The method according to claim 1, wherein The set flow rate is a second flow rate that satisfies the following function f 2(t): f 2(t)= Where t is time, R1=CIR, CIR is the committed information rate; The step of judging whether the flow token bucket test of the single-rate three-color marker algorithm passes according to the processed data, the forwarding rate and the set flow rate comprises: If any of the hit messages is not marked green, the test is deemed to have failed.
6. The method according to claim 1, wherein: The set flow rate is a third flow rate that satisfies the following function: f 3(t): f 3(t)= Where t is time, f 3(t) is a periodic function with period T=T1+T2+T3, R1=CIR, CIR is the committed information rate; T2=CBS / (R2-R1), CIR×T3=CBS; CBS is the committed burst size; The step of judging whether the flow token bucket test of the single-rate three-color marker algorithm passes according to the processed data, the forwarding rate and the set flow rate comprises: If any of the hit messages is not marked green, the test is deemed to have failed.
7. The method according to claim 1, characterized in that The period of the sending rate waveform of the set flow is the set period T; Before the test control device samples the processed data of the tested network device, the method further includes: setting a sampling period of the tested network device for the test control device to be a set period T.
8. The method according to claim 7, characterized in that The set flow rate is a fourth flow rate that satisfies the following function: f 4(t): f 4(t)= Where t is time, the set period T=T1+T2+T3, R1=CIR, CIR is the committed information rate; T2=(CBS+EBS) / (R2-R1), CIR×T3=CBS+EBS; CBS is the committed burst size, EBS is the excess burst size; The step of judging whether the flow token bucket test of the single-rate three-color marker algorithm passes according to the processed data, the forwarding rate and the set flow rate comprises: If the size of the traffic marked in green is determined to be inconsistent with CIR×T1+R2×T2×[1-EBS / (CBS+EBS+CIR×T2)], or the size of the traffic marked in yellow is determined to be inconsistent with R2×T2×EBS / (CBS+EBS+CIR×T2), the test is determined to fail.
9. The method according to claim 5, characterized in that The set flow rate is the fifth flow rate that satisfies the following function: f 5(t): f 5(t)= Where t is time, the set period T=T1+T2+T3+T4, R1=CIR, CIR is the committed information rate; T2=(CBS+EBS) / (R2-R1), CIR×T4=CBS+EBS; CBS is the committed burst size, EBS is the excess burst size; The step of judging whether the flow token bucket test of the single-rate three-color marker algorithm passes according to the processed data, the forwarding rate and the set flow rate comprises: If the size of the traffic marked as green is inconsistent with CIR×T1+R2×T2×[1-EBS / (CBS+EBS+CIR×T2)]+CIR×T3, or the size of the traffic marked as yellow is inconsistent with R2×T2×EBS / (CBS+EBS+CIR×T2), or the size of the traffic marked as red is inconsistent with (R2-CIR) ×T3, the test is judged to have failed.
10. A test system for a traffic token bucket based on SrTCM, characterized in that: Including flow generation equipment, flow receiving equipment and test control equipment; The traffic generating device is used to construct a set traffic flow and transmit it to the traffic receiving device through the network device under test; wherein a traffic token bucket based on a single-speed three-color marker algorithm runs on the network device under test; the set traffic flow includes constant rate traffic, burst traffic and excess burst traffic; The test control device is used to sample the processing data of the network device under test and the forwarding rate of the output interface of the network device under test during the process of setting the traffic to be transmitted through the network device under test to the traffic receiving device; the processing data includes the number of messages hit by the traffic token bucket and the marking status of the set traffic; and, based on the processing data, the forwarding rate and the sending rate of the set traffic, it is determined whether the test of the traffic token bucket of the single-speed three-color marker algorithm has passed.
Citation Information
Patent Citations
Network adaptive traffic shaping method and system
CN110572329A
Dynamic network flow control method
CN112838959A