CN116303474B - Tunnel information statistical method, device, network equipment and storage medium - Google Patents

Tunnel information statistical method, device, network equipment and storage medium Download PDF

Info

Publication number
CN116303474B
CN116303474B CN202310532425.6A CN202310532425A CN116303474B CN 116303474 B CN116303474 B CN 116303474B CN 202310532425 A CN202310532425 A CN 202310532425A CN 116303474 B CN116303474 B CN 116303474B
Authority
CN
China
Prior art keywords
tunnel
index
target
array
statistical
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310532425.6A
Other languages
Chinese (zh)
Other versions
CN116303474A (en
Inventor
杨亚伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd
Original Assignee
New H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to CN202310532425.6A priority Critical patent/CN116303474B/en
Publication of CN116303474A publication Critical patent/CN116303474A/en
Application granted granted Critical
Publication of CN116303474B publication Critical patent/CN116303474B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/18Complex mathematical operations for evaluating statistical data, e.g. average values, frequency distributions, probability functions, regression analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Software Systems (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Operations Research (AREA)
  • Probability & Statistics with Applications (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Algebra (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application provides a tunnel information statistical method, a device, network equipment and a storage medium, and relates to the technical field of communication. The technical scheme of the embodiment of the application comprises the following steps: acquiring a target tunnel index of a tunnel to be counted, and then reading array elements corresponding to the target tunnel index from a first array recorded in a memory to obtain a target counting index corresponding to the target tunnel index; each array element included in the first array is used for storing a statistical index corresponding to one tunnel index. And then reading the tunnel statistical information corresponding to the target statistical index from the forwarding chip. Thereby reducing the influence of message forwarding statistics on other tunnel services.

Description

Tunnel information statistical method, device, network equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method, an apparatus, a network device, and a storage medium for tunnel information statistics.
Background
To meet the network requirements of operators for latency, bandwidth, reliability, etc., the network device may support a 32K IPv6 forwarding plane based segment routing Policy (Segment Routing IPv Policy, SRv Policy), and each path in the network supports multiple segment lists (segmentlists). At present, when analyzing network performance, message forwarding statistics can be performed based on segment lists, namely, the statistics is performed on the message quantity forwarded by each segment list; message forwarding statistics may also be performed based on the binding segment identifiers (Binding Segment Identifier, BSID), i.e., statistics may be performed on the amount of messages per BSID drain. Wherein, each segment list corresponds to one tunnel, each BSID can bind one or more SRv policies, and each BSID can correspond to one or more tunnels accordingly.
When the network device performs message forwarding statistics on a tunnel, tunnel information of the tunnel needs to be accessed to obtain tunnel software information of the tunnel, a statistical index is extracted from the tunnel software information, and then the quantity of messages forwarded through the tunnel is obtained from a forwarding chip by using the statistical index. When the network equipment accesses the tunnel information, locking processing is performed, so that other tunnel services cannot access the tunnel information, and the operation efficiency of other tunnel services is affected.
For example, when a link or a node in a network fails, a large number of SRv Policy may generate active-standby path switching, and at this time, it is required to access tunnel information and refresh a large number of forwarding entries of the tunnel quickly in a short time, and lock competition exists between performing packet forwarding statistics on the tunnel and refreshing the forwarding entries, so that refreshing of the forwarding entries is delayed, which results in that active-standby path switching cannot be completed in time, and service quality is affected.
Disclosure of Invention
The embodiment of the application aims to provide a tunnel information statistical method, a device, network equipment and a storage medium, so as to reduce the influence of message forwarding statistics on other tunnel services. The specific technical scheme is as follows:
In a first aspect of an embodiment of the present application, a method for counting tunnel information is provided, and the method is applied to a network device, and includes:
acquiring a target tunnel index of a tunnel to be counted;
reading array elements corresponding to the target tunnel index from a first array recorded in a memory to obtain a target statistical index corresponding to the target tunnel index; wherein, each array element included in the first array is used for storing a statistical index corresponding to a tunnel index;
and reading the tunnel statistical information corresponding to the target statistical index from the forwarding chip.
In some embodiments of the present application, after the tunnel statistics corresponding to the target statistics index are read from the forwarding chip, the method further includes:
reading array elements corresponding to the target statistical index from a second array recorded in the memory to obtain a tunnel index; wherein each array element included in the second array is used for storing a tunnel index corresponding to a statistic index;
if the read tunnel index is the same as the target tunnel index, taking the tunnel statistical information as the tunnel statistical information of the tunnel to be counted; or,
If the read tunnel index is different from the target tunnel index, taking the tunnel statistical information as the tunnel statistical information of the tunnel to which the read tunnel index belongs; or,
and if the array element corresponding to the target statistical index is in an invalid state, neglecting the read tunnel statistical information, wherein the array element corresponding to the target statistical index is in the invalid state, which means that the target statistical index is released and is not applied successfully by any tunnel at present.
In some embodiments of the present application, after the tunnel statistics corresponding to the target statistics index are read from the forwarding chip, the method further includes:
searching array elements corresponding to the target tunnel index from a third array recorded in a memory to obtain a target compensation value corresponding to the target tunnel index; each array element included in the third array is used for storing a compensation value corresponding to a tunnel index, and the target compensation value is the data quantity except the effective load in the single message forwarded by the tunnel to be counted;
and determining the statistical result of the tunnel to be counted according to the target compensation value and the tunnel statistical information corresponding to the target statistical index.
In some embodiments of the application, the method further comprises:
when the update of the preset dimension data corresponding to the target tunnel index is monitored, setting an array element corresponding to the target tunnel index as a first value in a fourth array of the memory record, wherein each array element included in the fourth array respectively represents the update state of one tunnel, and the preset dimension data comprises: counting indexes and tunnel data influencing a compensation value, wherein the compensation value is the data quantity except for a payload in a single message forwarded through a tunnel;
before the array element corresponding to the target tunnel index is read from the first array recorded in the slave memory, the method further includes:
checking whether an array element corresponding to the target tunnel index is a first value or not from a fourth array recorded in the memory;
if not, executing the step of reading the array element corresponding to the target tunnel index from the first array recorded in the memory;
if yes, searching the tunnel software information of the tunnel to be counted according to the target tunnel index, extracting the statistic index and the tunnel data of the tunnel to be counted from the tunnel software information, calculating a compensation value based on the extracted tunnel data, and reading the tunnel statistic information corresponding to the extracted statistic index from a forwarding chip.
In some embodiments of the present application, after the tunnel statistics corresponding to the extracted statistics index is read from the forwarding chip, the method further includes:
setting an array element corresponding to the target tunnel index in the first array as an extracted statistical index;
setting an array element corresponding to the target tunnel index in the fourth array to be a second value, wherein the second value indicates that the preset dimension data is not updated;
setting an array element corresponding to the target tunnel index in a third array recorded in a memory as a calculated compensation value; and each array element included in the third array is used for storing a compensation value corresponding to the tunnel index.
In a second aspect of an embodiment of the present application, there is provided a tunnel information statistics apparatus, applied to a network device, the apparatus including:
the acquisition module is used for acquiring a target tunnel index of the tunnel to be counted;
the reading module is used for reading the array elements corresponding to the target tunnel index from the first array recorded in the memory to obtain a target statistical index corresponding to the target tunnel index; wherein, each array element included in the first array is used for storing a statistical index corresponding to a tunnel index;
The reading module is further configured to read tunnel statistics information corresponding to the target statistics index from a forwarding chip.
In some embodiments of the application, the apparatus further comprises:
the reading module is further configured to, after the tunnel statistics information corresponding to the target statistics index is read from the forwarding chip, read an array element corresponding to the target statistics index from a second array recorded in the memory, and obtain a tunnel index; wherein each array element included in the second array is used for storing a tunnel index corresponding to a statistic index;
the determining module is used for taking the tunnel statistical information as the tunnel statistical information of the tunnel to be counted if the read tunnel index is the same as the target tunnel index; or,
the determining module is further configured to, if the read tunnel index is different from the target tunnel index, use the tunnel statistics information as the tunnel statistics information of the tunnel to which the read tunnel index belongs; or,
and the determining module is further configured to ignore the tunnel statistics information read at this time if the array element corresponding to the target statistics index is in an invalid state, where the array element corresponding to the target statistics index is in an invalid state, which indicates that the target statistics index is released and is not successfully applied by any tunnel at present.
In some embodiments of the application, the apparatus further comprises:
the searching module is used for searching array elements corresponding to the target tunnel index from a third array recorded in the memory after the tunnel statistical information corresponding to the target statistical index is read from the forwarding chip, so as to obtain a target compensation value corresponding to the target tunnel index; each array element included in the third array is used for storing a compensation value corresponding to a tunnel index, and the target compensation value is the data quantity except the effective load in the single message forwarded by the tunnel to be counted;
and the determining module is used for determining the statistical result of the tunnel to be counted according to the target compensation value and the tunnel statistical information corresponding to the target statistical index.
In some embodiments of the application, the apparatus further comprises:
the setting module is configured to set an array element corresponding to the target tunnel index to a first value in a fourth array of the memory record when it is monitored that preset dimension data corresponding to the target tunnel index is updated, where each array element included in the fourth array respectively represents an update state of a tunnel, and the preset dimension data includes: counting indexes and tunnel data influencing a compensation value, wherein the compensation value is the data quantity except for a payload in a single message forwarded through a tunnel;
The checking module is used for checking whether the array element corresponding to the target tunnel index is a first value or not from a fourth array recorded in the memory before the array element corresponding to the target tunnel index is read from the first array recorded in the memory;
the calling module is used for calling the reading module to execute the step of reading the array element corresponding to the target tunnel index from the first array recorded in the memory if the checking result of the checking module is no;
and the searching module is used for searching the tunnel software information of the tunnel to be counted according to the target tunnel index if the checking result of the checking module is yes, extracting the statistic index and the tunnel data of the tunnel to be counted from the tunnel software information, calculating a compensation value based on the extracted tunnel data, and reading the tunnel statistic information corresponding to the extracted statistic index from the forwarding chip.
In some embodiments of the application, the setting module is further configured to:
after the tunnel statistical information corresponding to the extracted statistical index is read from the forwarding chip, setting an array element corresponding to the target tunnel index in the first array as the extracted statistical index;
Setting an array element corresponding to the target tunnel index in the fourth array to be a second value, wherein the second value indicates that the preset dimension data is not updated;
setting an array element corresponding to the target tunnel index in a third array recorded in a memory as a calculated compensation value; and each array element included in the third array is used for storing a compensation value corresponding to the tunnel index.
In a third aspect of the embodiment of the present application, there is provided a network device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of the first aspects when executing a program stored on a memory.
In a fourth aspect of embodiments of the present application, there is provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the method steps of any of the first aspects.
A fifth aspect of an embodiment of the present application provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the tunnel information statistics method according to any of the first aspects described above.
The embodiment of the application has the beneficial effects that:
according to the tunnel information statistical method, device, network equipment and storage medium, the first array comprising the statistical indexes corresponding to the tunnel indexes is established in advance and stored in the memory, so that when the network equipment performs message forwarding statistics on the tunnel to be counted, an array element corresponding to the target tunnel index of the tunnel to be counted can be found out from the memory, the array element is the target statistical index corresponding to the target tunnel index, and further tunnel statistical information corresponding to the target statistical index can be obtained from the forwarding chip. Namely, when the embodiment of the application acquires the statistical index of the tunnel to be counted, the tunnel software information of the tunnel to be counted does not need to be accessed, so that lock competition between message forwarding statistics and other tunnel services is avoided, and the influence of the message forwarding statistics on the other tunnel services is reduced.
Of course, it is not necessary for any one product or method of practicing the application to achieve all of the advantages set forth above at the same time.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the application, and other embodiments may be obtained according to these drawings to those skilled in the art.
Fig. 1 is a flowchart of a method for counting tunnel information according to an embodiment of the present application;
fig. 2 is a flowchart of a method for determining a tunnel to which tunnel statistics information belongs according to an embodiment of the present application;
FIG. 3 is an exemplary schematic diagram of a business process and a statistical process according to an embodiment of the present application;
fig. 4 is a flowchart of another method for counting tunnel information according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a tunnel information statistics device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a network device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. Based on the embodiments of the present application, all other embodiments obtained by the person skilled in the art based on the present application are included in the scope of protection of the present application.
In order to reduce the influence of message forwarding statistics on other tunnel services, the embodiment of the application provides a tunnel information statistical method which is applied to network equipment, such as routers, switches and other equipment in a SRv network. As shown in fig. 1, the method comprises the steps of:
S101, acquiring a target tunnel index of a tunnel to be counted.
After SRv Policy is configured in the network device and enabling statistics is performed on the tunnels pointed by SRv Policy, each tunnel enabling statistics is a tunnel to be counted. Wherein, a plurality of SRv6 policies may be configured in the network device, for example, 32k SRv6 policies are configured in the network device, and 32k represents 32×1024.
S102, reading array elements corresponding to the target tunnel index from the first array recorded in the memory to obtain a target statistical index corresponding to the target tunnel index.
In the embodiment of the application, the first array is marked as g_auiStatIndex [ NID ], the array index of the first array is the tunnel index, and each array element included in the first array is used for storing a statistical index corresponding to the tunnel index.
For example, the first array is g_auistatndex [ NID ] = [10,20,30,40,50], and assuming that the array index starts from 0, g_auistatndex [1] =20 is obtained when the target tunnel index is 1.
S103, reading tunnel statistical information corresponding to the target statistical index from the forwarding chip.
The forwarding chip records the tunnel statistical information corresponding to the tunnel indexes, and then can search and read the tunnel statistical information corresponding to the target statistical index.
According to the tunnel information statistical method provided by the embodiment of the application, as the first array comprising the statistical indexes corresponding to the tunnel indexes is pre-established and stored in the memory, when the network equipment performs message forwarding statistics on the tunnel to be counted, the array element corresponding to the target tunnel index of the tunnel to be counted can be found from the memory, and the array element is the target statistical index corresponding to the target tunnel index, so that the tunnel statistical information corresponding to the target statistical index can be obtained from the forwarding chip. Namely, when the embodiment of the application acquires the statistical index of the tunnel to be counted, the tunnel software information of the tunnel to be counted does not need to be accessed, so that lock competition between message forwarding statistics and other tunnel services is avoided, and the influence of the message forwarding statistics on the other tunnel services is reduced.
The following describes the tunnel information statistical method provided by the embodiment of the present application in detail:
in some embodiments of the present disclosure, the network device may perform a packet forwarding statistics process at regular time, and may also perform a tunnel statistics management service process, where the two processes respectively use different thread processing. In this case, it may happen that the traffic flow is triggered periodically during the process of disabling statistics for tunnel 1, the packet forwarding statistics flow for tunnel 1.
The statistical index corresponding to the tunnel index read from the first array to the tunnel 1 in the message forwarding statistical flow is StatIndex. After the traffic flow releases the statistical index statndex of tunnel 1, statndex is applied as the statistical index by tunnel 2. Then, when the packet forwarding statistical flow acquires tunnel statistical information from the forwarding chip by using statndex, the acquired tunnel statistical information is actually tunnel statistical information of the tunnel 2. If the acquired tunnel statistics information is taken as the tunnel statistics information of the tunnel 1 at this time, statistics errors are caused.
In order to solve the problem, referring to fig. 2, after the tunnel statistics information corresponding to the target statistics index is read from the forwarding chip in S103, the embodiment of the present application may further execute the following steps:
s201, reading array elements corresponding to the target statistical index from a second array recorded in the memory to obtain a tunnel index.
In the embodiment of the application, the second array is marked as g_auiNid [ StatIndex ], and each array element included in the second array is used for storing a tunnel index corresponding to a statistic index. For example, a first array element of the second array is used to store a tunnel index corresponding to the first statistical index, a second array element of the second array is used to store a tunnel index corresponding to the second statistical index, and so on.
And S202, if the read tunnel index is the same as the target tunnel index, taking the tunnel statistical information as the tunnel statistical information of the tunnel to be counted.
The read tunnel index is the same as the target tunnel index, which means that the target statistics index always belongs to the tunnel to be counted in the process from reading the target statistics index from the first array to reading the tunnel statistics information from the forwarding chip, so that the counted tunnel statistics information can be used as the tunnel statistics information of the tunnel to be counted.
And S203, if the read tunnel index is different from the target tunnel index, taking the tunnel statistical information as the tunnel statistical information of the tunnel to which the read tunnel index belongs.
The read tunnel index is different from the target tunnel index, which means that in the process from reading the target statistical index from the first array to reading the tunnel statistical information from the forwarding chip, the target statistical index is changed to the statistical index of other tunnels, that is, the statistical index of the tunnel to which the tunnel index read in S201 belongs, so that the tunnel statistical information can be used as the tunnel statistical information of the tunnel to which the read tunnel index belongs.
The software system running on the central processing unit (Central Processing Unit, CPU) of the network device includes an application program and a driving module, and the driving module executes the statistical flow shown in fig. 1 and 2 when receiving the statistical instruction issued by the application program. And when the statistic mode is load statistic, the driving module stores the read tunnel statistic information into an array g_auiStatREs [ StatIndex ] before executing S201, and after determining the tunnel to which the tunnel statistic information belongs, reports the tunnel index of the tunnel to the application program, so that the application program obtains the tunnel statistic information from the g_auiStatREs [ StatIndex ], and takes the read tunnel statistic information as the tunnel statistic information corresponding to the received tunnel index. The tunnel statistical information comprises: the total amount of the payload of the message forwarded through the tunnel and the number of the messages.
It should be noted that, the statistical mode of the tunnel is divided into load statistics and whole packet statistics, and the statistical mode specifically used by the network device may be preset according to the actual service requirement.
It should be noted that if the array element corresponding to the read target statistics index is not in the invalid state, that is, in the valid state, S202 or S203 will be executed.
Optionally, when releasing the statistical index corresponding to the tunnel index, the network device may set the array element corresponding to the tunnel index to an invalid value. When the array element corresponding to the target statistical index is read in S201, whether the array element corresponding to the read target statistical index is an invalid value can be detected, if yes, the array element is determined to be in an invalid state, and if not, the array element is determined to be in a valid state. For example, the invalid value is "invalid" or "0", which is not particularly limited in the embodiment of the present application.
Or, when releasing the statistical index corresponding to the tunnel index, the network device may delete the array element corresponding to the tunnel index. When the array element corresponding to the target statistical index is read in S201, whether the array element corresponding to the read target statistical index is empty or not may be detected, if yes, the array element is determined to be in an invalid state, otherwise, the array element is determined to be in a valid state.
S204, if the array element corresponding to the target statistic index is in an invalid state, neglecting the read tunnel statistic information. The array elements corresponding to the target statistical index are in an invalid state, which indicates that the target statistical index is released and is not successfully applied by any tunnel.
The array element corresponding to the target statistical index is in an invalid state, which indicates that the target statistical index is released in the process of reading the tunnel statistical information from the second array to the forwarding chip, and the target statistical index is not the statistical index of any tunnel, so that the read tunnel statistical information is not the tunnel statistical information of any tunnel, and the read tunnel statistical information can be ignored.
When the driving module determines that the array element corresponding to the target statistical index is in an invalid state, the tunnel index may not be reported to the application program, or the report of the application program may be displayed with information of the current statistical flow.
By the method, after the tunnel statistical information is read, the tunnel index is reversely checked based on the statistical index, so that the tunnel to which the currently read tunnel statistical information belongs is further confirmed, the condition that the tunnel statistical information for one tunnel statistics does not actually belong to the tunnel is reduced, and the accuracy of message statistics on the tunnel is improved.
Referring to fig. 3, S301 to S310 in fig. 3 are traffic flows of tunnel statistics management, and S311 to S314 in fig. 3 are packet forwarding statistics flows. The following two processes are illustrated by taking a statistical mode as a load statistics as an example in combination with an actual application scenario:
s301, determining to enable the tunnel 1.
The software system running on the CPU of the network equipment comprises an application program and a driving module, and the driving module executes S301-S310 when receiving an enabling instruction issued by the application program, wherein the enabling instruction is used for indicating enabling statistics on the tunnel 1.
S302, reading array elements corresponding to nid1 from the first array to obtain a statistical index of the tunnel 1 as StatIndex, and reading and clearing tunnel statistical information corresponding to the StatIndex. Where nid1 is the tunnel index of tunnel 1.
And reading the tunnel statistical information corresponding to the StatIndex, namely reading the tunnel statistical information corresponding to the StatIndex from the forwarding chip, and resetting the tunnel statistical information corresponding to the StatIndex in the forwarding chip.
S303, setting g_auiStatIndex [ nid1] in the first array as invalid.
The g_auiStatIndex [ nid1] is set to be invalid, namely, in the first array, an array element corresponding to nid1 is set to be an invalid value.
S304, g_auiNid [ StatIndex ] in the second array is set to be invalid.
The setting g_auiNid [ StatIndex ] is invalid, that is, in the second array, the array element corresponding to StatIndex is set as an invalid value.
S305, release (free) StatIndex.
S306, determining to enable statistics on the tunnel 2.
S307, applying for the tunnel 2 to the StatIndex, and taking the StatIndex as a statistical index of the tunnel 2.
Since statndex is released, it can be applied by any tunnel as its own corresponding statistical index.
S308, issuing a statistical index corresponding to the tunnel 2 as StatIndex to a hardware table item.
S309, update g_auiinid [ statndex ] =nid2 in the second array. Where nid2 is the tunnel index of tunnel 2.
S310, update g_auistatndex [ nid2] =statndex in the first array.
S311, reading array elements corresponding to nid1 from the first array to obtain a statistical index corresponding to nid1 as StatIndex.
If S311 is performed prior to S303, then since the unset g_AuiStatIndex [ nid1] is invalid, the statistical flow may read the corresponding statistical index of nid1 as StatIndex from the first array normally.
S312, reading tunnel statistical information corresponding to the StatIndex from the forwarding chip.
If the tunnel statistics corresponding to statndex is read from the forwarding chip after S308, since statndex has become the statistics index of tunnel 2 at this time, the tunnel statistics obtained by the statistical flow through statndex is actually the tunnel statistics of tunnel 2.
S313, storing the tunnel statistical information in g_auiStatREs [ StatIndex ], and finding g_auiNid [ StatIndex ] =nid2 from the second array.
At this time, it is determined that the tunnel statistics in the array g_auistats [ statndex ] is the tunnel statistics of tunnel 2, i.e., g_auistats [ statndex ] =nid2.
S314, reporting nid2 to the CPU so that the CPU acquires the tunnel statistical information of the tunnel 2 from g_auiStatREs [ StatIndex ].
S311-S314 are message forwarding statistical processes, and when the driving module receives a statistical instruction issued by an application program aiming at the tunnel 1, the driving module executes S311-S314 and reports nid2 to the application program when executing S314.
Although the statistical flow of the tunnel 1 is triggered in this case, the actual statistics is the tunnel statistics information of the tunnel 2, the process can enable the tunnel identifier reported by the driving module to the application program to correspond to the tunnel statistics information in the array g_au stats [ statndex ], so that the situation that the reported tunnel identifier and the actual statistics information do not belong to the same tunnel is reduced, and therefore the accuracy of message forwarding statistics is improved.
The total payload and the number of the messages forwarded through the tunnel are generally recorded in the forwarding chip, that is, the tunnel statistical information obtained by the network device from the forwarding chip includes: the total amount of the payload of the message forwarded through the tunnel and the number of the messages. When the statistics mode is whole packet statistics, the number of the messages forwarded through the tunnel and the total data amount of the messages forwarded through the tunnel generally need to be counted. Since the message includes other data, such as the header of the message, in addition to the payload, the total data amount of the message forwarded through the tunnel needs to be determined by calculating the offset value. Wherein the compensation value is the data quantity except the payload in the single message forwarded by the tunnel.
Therefore, when the statistics mode is the whole packet statistics, in order to obtain the statistics result of the tunnel to be counted, the network device may further perform the following steps:
step one, searching array elements corresponding to the target tunnel index from a third array recorded in the memory to obtain a target compensation value corresponding to the target tunnel index.
The target compensation value is the data quantity except the effective load in the single message to be counted and forwarded by the tunnel. The compensation value of each message forwarded by the tunnel to be counted is the same and is the target compensation value.
In the embodiment of the present application, the third array is denoted as g_au_stats_compensate [ statndex ], and each array element included in the third array is used to store a compensation value corresponding to a tunnel index. For example, the third array includes a first array element for storing the compensation value corresponding to the first tunnel index, the third array includes a second array element for storing the compensation value corresponding to the second tunnel index, and so on.
The third array includes compensation values that are calculated for each tunnel in advance. For example, for each tunnel after enabling statistics, a compensation value corresponding to the tunnel may be calculated according to the SID layer number, the egress type and other data of the packet forwarded by the tunnel, and recorded in the third array.
And step two, determining the statistical result of the tunnel to be counted according to the tunnel statistical information corresponding to the target compensation value and the target statistical index.
The statistical result of the tunnel to be counted comprises: the number of messages forwarded through the tunnels to be counted and the total data amount of the messages forwarded through the tunnels to be counted. The number of the messages forwarded by the tunnel to be counted can be obtained from the tunnel counting information. And, the total payload of the message forwarded through the tunnel to be counted and the number of the messages forwarded through the tunnel to be counted in the tunnel counting information are calculated, and the calculated result is taken as the total data quantity of the messages forwarded through the tunnel to be counted.
The first step and the second step may be performed by a driving module in the network device, i.e. the driving module determines the statistics result of the tunnel to be counted. And then the driving module can store the statistical result in g_auiStatREs [ StatIndex ], report the target tunnel index of the tunnel to be counted to the corresponding program, enable the application program to read the statistical result from g_auiStatREs [ StatIndex ], and take the read statistical result as the statistical result corresponding to the received target tunnel index.
By the method, the compensation values corresponding to the tunnels can be determined in advance and recorded in the third array, so that the compensation values calculated in advance can be directly obtained from the third array when the message forwarding statistics is carried out on the tunnels, and the compensation values are not required to be calculated once in real time when the message forwarding statistics is carried out on one tunnel each time. It can be seen that the embodiments of the present disclosure reduce the cases where the compensation value is repeatedly calculated, and thus reduce the computational resources consumed in calculating the compensation value.
It should be noted that, the first step and the second step are determining the statistical result of the tunnel to be counted, so that the tunnel statistical information obtained in S103 is executed when the tunnel statistical information belongs to the tunnel to be counted; if the obtained tunnel statistics information is the tunnel to which the read tunnel index in S203 belongs, the statistics result of the tunnel may be determined according to the first and second steps.
Since the number of SID layers and the type of exit of the tunnel may change after the start of enabling statistics for the tunnel, and the change of the data may cause the change of the compensation value corresponding to the tunnel, if the same compensation value is used each time the message forwarding statistics is performed for the tunnel, the problem of inaccurate statistics results may occur due to inaccurate compensation values used.
In order to solve the problem, in the embodiment of the present application, when the electronic device monitors that the preset dimension data corresponding to the target tunnel index is updated, the electronic device may set an array element corresponding to the target tunnel index in the fourth array of the memory record to be a first value.
The fourth array is marked as g_abuiNidIsChange [ nid ], and each array element included in the fourth array respectively represents the updating state of one tunnel. Each array element in the fourth array may be a first value or a second value, where the first value indicates that the preset dimension data of the tunnel is updated, and the second value indicates that the preset dimension data of the tunnel is not updated. For example, the first value is "TRUE" and the second value is "FALSE".
The preset dimension data comprises: statistical index and tunnel data affecting the compensation value. The tunnel data affecting the compensation value includes the SID layer number and the exit type of the tunnel.
On this basis, the network device may further execute the following steps before reading the array element corresponding to the target tunnel index from the first array recorded in the memory in S102:
step 1, checking whether an array element corresponding to the target tunnel index is a first value or not from a fourth array recorded in the memory.
And step 2, if not, executing the step 102 of reading the array element corresponding to the target tunnel index from the first array recorded in the memory.
If the array element corresponding to the target tunnel index is the second value, it is indicated that the preset dimension data of the tunnel to be counted is not updated, so that the target statistic index corresponding to the target tunnel index recorded in the first array and the target compensation value corresponding to the target tunnel index recorded in the third array can be directly used, and the speed of acquiring the statistic index and the compensation value is improved.
And step 3, if so, searching tunnel software information of the tunnel to be counted according to the target tunnel index, extracting the statistic index and the tunnel data of the tunnel to be counted from the tunnel software information, calculating a compensation value based on the extracted tunnel data, and reading the tunnel statistic information corresponding to the extracted statistic index from the forwarding chip.
In the embodiment of the present application, when the statistical index of the tunnel changes and/or the tunnel data is updated, the network device sets the array element of the tunnel in the fourth array to the first value. Therefore, when the array element corresponding to the target tunnel index is the first value, it may be the statistical index update and/or the tunnel data update of the tunnel to be counted, so that at least one data of the statistical index and the tunnel data extracted from the software information by the network device is updated.
After the compensation value and the tunnel statistical information are obtained, the electronic device can also determine the statistical result of the tunnel to be counted according to the compensation value and the tunnel statistical information.
The above steps 1-3 may be performed by a driver module in the network device.
By the method, the embodiment of the application can flexibly select the mode of acquiring the tunnel statistical information and the compensation value according to the updating state of the tunnel, so that the network equipment can learn and decide autonomously, the message forwarding statistical efficiency is higher, and the network equipment performance is stronger.
When the preset dimension data of the tunnel is updated, the network equipment calculates the compensation value by using the tunnel software information and acquires the tunnel statistical information, so that the problems that the actual compensation value of the tunnel is different from the compensation value recorded in the third array and/or the actual statistical index of the tunnel is different from the statistical index of the tunnel recorded in the first array due to data updating are reduced, and the accuracy of determining the compensation value and the tunnel statistical information is improved.
On the other hand, under the condition that the preset dimension data of the tunnel is not updated, the actual statistical index of the tunnel is the same as the statistical index of the tunnel recorded in the first array, so that the embodiment of the application can directly acquire the target statistical index corresponding to the target tunnel index from the first array; and at the moment, the actual compensation value of the tunnel is the same as the compensation value of the tunnel recorded in the third array, so that the target compensation value corresponding to the target tunnel index can be obtained from the third array, the speed of obtaining the target statistic index and the target compensation value is improved, and the efficiency of message forwarding statistics is improved.
In the case that the array element corresponding to the target tunnel index is the first value, that is, the preset dimension data of the tunnel to be counted is updated, after the tunnel statistical information is obtained in the step 3, the driving module of the network device may further perform data update in three aspects as follows:
first aspect: and setting an array element corresponding to the target tunnel index in the first array as an extracted statistical index. Therefore, before the preset dimension data of the tunnel to be counted is updated next time, the network equipment can acquire the counting index of the tunnel to be counted from the first array.
Second aspect: and setting an array element corresponding to the target tunnel index in the fourth array as a second value, wherein the second value indicates that the preset dimension data is not updated. Therefore, the update state of each tunnel recorded in the fourth array has timeliness, and network equipment can conveniently know the update state of the tunnel in time through the fourth array.
Third aspect: and setting an array element corresponding to the target tunnel index in a third array recorded in the memory as a calculated compensation value. Therefore, before the preset dimension data of the tunnel to be counted is updated next time, the network equipment can acquire the compensation value of the tunnel to be counted from the third array.
Through the method, after the preset dimension data of the tunnel is updated, the array elements in the first array, the third array and the fourth array can be updated in time, so that before the data of the preset dimension is updated next time, the network equipment can directly acquire the data from the first array and the fourth array without acquiring the statistical index again and calculating the compensation value again, and the efficiency of message forwarding statistics can be improved.
Referring to fig. 4, taking statistics mode as whole packet statistics as an example, an overall flow of obtaining tunnel statistics information and compensation values by a network device is described below:
S401, locking critical sections in the message forwarding statistical flow.
Program fragments accessing critical resources in the message forwarding statistical flow are critical sections, wherein the critical resources comprise g_abuiNidIsChange [ nid ]. The driving module locks critical areas in the message forwarding statistical flow, so that g_abuiNidIsChange [ nid ] is protected from being operated concurrently.
S402, determine whether g_abuinidhischange [ nid1] is TRUE. If g_abuinidhischange [ nid1] =false, S403 is executed, and g_abuinidhischange [ nid1] =true is executed, S407 is executed. And nid1 is a tunnel identifier of the tunnel to be counted.
S403, reading array elements corresponding to the target tunnel indexes from the first array recorded in the memory to obtain target statistical indexes corresponding to the target tunnel indexes, and reading tunnel statistical information corresponding to the target statistical indexes from the forwarding chip.
S404, searching array elements corresponding to the target tunnel index from the third array recorded in the memory to obtain a target compensation value corresponding to the target tunnel index.
S405, determining the statistical result of the tunnel to be counted according to the tunnel statistical information and the target compensation value.
After the statistical result is determined, the statistical result can be reported to the statistical platform so as to analyze and display the statistical result in the statistical platform.
S406, unlocking the critical section.
S407, searching tunnel software information of the tunnel to be counted according to the target tunnel index, and extracting the statistic index and the tunnel data of the tunnel to be counted from the tunnel software information.
S408, reading tunnel statistical information corresponding to the extracted statistical index from the forwarding chip.
S409, calculating a compensation value based on the extracted tunnel data, and determining a statistical result according to the tunnel statistical information and the compensation value.
S410, setting g_auiStatIndex [ nid1] as an extracted statistical index in the first array.
S411, setting g_auiStatREsCompensate [ nid1] as the calculated compensation value in the third array.
S412, g_abuiNidIsChange [ nid1] =FALSE is set in the fourth array, and the critical section is unlocked.
When SRv6 Policy is deployed in a network device in a large scale and statistics are enabled for each tunnel aimed at by SRv6 Policy, data statistics of tens of K or even hundreds of K may be achieved. In the data statistics process, tunnel statistics information needs to be obtained from the forwarding chip, but K-level statistics can only be read from the forwarding chip in every second, so that the occupation of the forwarding chip by message forwarding statistics is excessive, and the cost is high. And when a plurality of forwarding chips exist in the network equipment, all forwarding chips need to be traversed when the tunnel statistical information is acquired, so that the statistical speed is further reduced. And when the message forwarding statistical period of the tunnel is shorter and the capability of the forwarding chip is smaller than the statistical reading requirement of the driving module, the CPU is continuously occupied by the message forwarding statistical flow, and the execution of other services by the network equipment is affected.
In the embodiment of the application, the application program issues the statistical instruction to the driving module to instruct the driving module to carry out the message forwarding statistics on the tunnel to be counted, and the driving module can acquire the target statistical index from the first array, so that the condition of accessing the tunnel software information to acquire the statistical index is reduced, the access competition with other tunnel services is reduced, and the acquisition speed of the statistical index is improved; moreover, the determining module can acquire the target compensation value from the third array, so that the situation of repeatedly calculating the compensation value is reduced, and the acquisition speed of the compensation value is improved. Therefore, the embodiment of the application can improve the speed of message forwarding statistics, thereby reducing the occupation of CPU resources.
Based on the same inventive concept, corresponding to the method embodiment, the embodiment of the present application further provides a tunnel information statistics device, where the device is applied to a network device, as shown in fig. 5, and the device includes: an acquisition module 501 and a reading module 502;
an obtaining module 501, configured to obtain a target tunnel index of a tunnel to be counted;
the reading module 502 is configured to read an array element corresponding to a target tunnel index from a first array recorded in the memory, to obtain a target statistical index corresponding to the target tunnel index; wherein, each array element included in the first array is used for storing a statistical index corresponding to a tunnel index;
The reading module 502 is further configured to read tunnel statistics information corresponding to the target statistics index from the forwarding chip.
In some embodiments of the application, the apparatus may further comprise:
the reading module 502 is further configured to, after reading the tunnel statistics information corresponding to the target statistics index from the forwarding chip, read an array element corresponding to the target statistics index from the second array recorded in the memory, and obtain a tunnel index; wherein, each group element included in the second group is used for storing a tunnel index corresponding to the statistic index;
the determining module is used for taking the tunnel statistical information as the tunnel statistical information of the tunnel to be counted if the read tunnel index is the same as the target tunnel index; or,
the determining module is further configured to, if the read tunnel index is different from the target tunnel index, use the tunnel statistics information as the tunnel statistics information of the tunnel to which the read tunnel index belongs; or,
the determining module is further configured to ignore the tunnel statistics information read at this time if the array element corresponding to the target statistics index is in an invalid state, where the array element corresponding to the target statistics index is in an invalid state, which indicates that the target statistics index is released and is not applied for success by any tunnel currently.
In some embodiments of the application, the apparatus may further comprise:
the searching module is used for searching array elements corresponding to the target tunnel index from the third array recorded in the memory after the tunnel statistical information corresponding to the target statistical index is read from the forwarding chip, so as to obtain a target compensation value corresponding to the target tunnel index; each array element included in the third array is used for storing a compensation value corresponding to a tunnel index, and the target compensation value is the data quantity except the effective load in a single message to be counted and forwarded by the tunnel;
and the determining module is used for determining the statistical result of the tunnel to be counted according to the tunnel statistical information corresponding to the target compensation value and the target statistical index.
In some embodiments of the application, the apparatus may further comprise:
the setting module is configured to set an array element corresponding to a target tunnel index to a first value in a fourth array of the memory record when it is monitored that preset dimension data corresponding to the target tunnel index is updated, where each array element included in the fourth array respectively represents an update state of a tunnel, and the preset dimension data includes: counting the index and tunnel data influencing a compensation value, wherein the compensation value is the data quantity except the effective load in a single message forwarded by a tunnel;
The checking module is used for checking whether the array element corresponding to the target tunnel index is a first value or not from the fourth array recorded in the memory before the array element corresponding to the target tunnel index is read from the first array recorded in the memory;
the calling module is used for calling the reading module 502 to execute the step of reading the array element corresponding to the target tunnel index from the first array recorded in the memory if the checking result of the checking module is no;
and the searching module is used for searching the tunnel software information of the tunnel to be counted according to the target tunnel index if the checking result of the checking module is yes, extracting the statistic index and the tunnel data of the tunnel to be counted from the tunnel software information, calculating the compensation value based on the extracted tunnel data, and reading the tunnel statistic information corresponding to the extracted statistic index from the forwarding chip.
In some embodiments of the application, the setting module is further configured to:
after the tunnel statistical information corresponding to the extracted statistical index is read from the forwarding chip, setting an array element corresponding to the target tunnel index in the first array as the extracted statistical index;
setting an array element corresponding to the target tunnel index in the fourth array as a second value, wherein the second value indicates that the preset dimension data is not updated;
Setting an array element corresponding to the target tunnel index in a third array recorded in the memory as a calculated compensation value; and each array element included in the third array is used for storing a compensation value corresponding to the tunnel index.
The embodiment of the present application also provides a network device, as shown in fig. 6, including a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the processor 601, the communication interface 602, and the memory 603 perform communication with each other through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to implement the method steps in the above-described method embodiment when executing the program stored in the memory 603.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the tunnel information statistics methods described above.
In yet another embodiment of the present application, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the tunnel information statistics methods of the above embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments in part.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (12)

1. A method of tunnel information statistics, applied to a network device, the method comprising:
acquiring a target tunnel index of a tunnel to be counted, wherein the tunnel to be counted is a tunnel which is enabled to count in a tunnel corresponding to SRv Policy in the network equipment;
reading array elements corresponding to the target tunnel index from a first array recorded in a memory to obtain a target statistical index corresponding to the target tunnel index; wherein, each array element included in the first array is used for storing a statistical index corresponding to a tunnel index;
and reading the tunnel statistical information corresponding to the target statistical index from the forwarding chip.
2. The method of claim 1, wherein after the reading the tunnel statistics corresponding to the target statistics index from the forwarding chip, the method further comprises:
reading array elements corresponding to the target statistical index from a second array recorded in the memory to obtain a tunnel index; wherein each array element included in the second array is used for storing a tunnel index corresponding to a statistic index;
If the read tunnel index is the same as the target tunnel index, taking the tunnel statistical information as the tunnel statistical information of the tunnel to be counted; or,
if the read tunnel index is different from the target tunnel index, taking the tunnel statistical information as the tunnel statistical information of the tunnel to which the read tunnel index belongs; or,
and if the array element corresponding to the target statistical index is in an invalid state, neglecting the read tunnel statistical information, wherein the array element corresponding to the target statistical index is in the invalid state, which means that the target statistical index is released and is not applied successfully by any tunnel at present.
3. The method of claim 1, wherein after the reading the tunnel statistics corresponding to the target statistics index from the forwarding chip, the method further comprises:
searching array elements corresponding to the target tunnel index from a third array recorded in a memory to obtain a target compensation value corresponding to the target tunnel index; each array element included in the third array is used for storing a compensation value corresponding to a tunnel index, and the target compensation value is the data quantity except the effective load in the single message forwarded by the tunnel to be counted;
And determining the statistical result of the tunnel to be counted according to the target compensation value and the tunnel statistical information corresponding to the target statistical index.
4. The method according to claim 1, wherein the method further comprises:
when the update of the preset dimension data corresponding to the target tunnel index is monitored, setting an array element corresponding to the target tunnel index as a first value in a fourth array of the memory record, wherein each array element included in the fourth array respectively represents the update state of one tunnel, and the preset dimension data comprises: counting indexes and tunnel data influencing a compensation value, wherein the compensation value is the data quantity except for a payload in a single message forwarded through a tunnel;
before the array element corresponding to the target tunnel index is read from the first array recorded in the slave memory, the method further includes:
checking whether an array element corresponding to the target tunnel index is a first value or not from a fourth array recorded in the memory;
if not, executing the step of reading the array element corresponding to the target tunnel index from the first array recorded in the memory;
If yes, searching the tunnel software information of the tunnel to be counted according to the target tunnel index, extracting the statistic index and the tunnel data of the tunnel to be counted from the tunnel software information, calculating a compensation value based on the extracted tunnel data, and reading the tunnel statistic information corresponding to the extracted statistic index from a forwarding chip.
5. The method of claim 4, wherein after reading tunnel statistics corresponding to the extracted statistics index from the forwarding chip, the method further comprises:
setting an array element corresponding to the target tunnel index in the first array as an extracted statistical index;
setting an array element corresponding to the target tunnel index in the fourth array to be a second value, wherein the second value indicates that the preset dimension data is not updated;
setting an array element corresponding to the target tunnel index in a third array recorded in a memory as a calculated compensation value; and each array element included in the third array is used for storing a compensation value corresponding to the tunnel index.
6. A tunnel information statistics apparatus, applied to a network device, the apparatus comprising:
The acquisition module is used for acquiring a target tunnel index of a tunnel to be counted, wherein the tunnel to be counted is a tunnel which is enabled to count in a tunnel corresponding to SRv Policy in the network equipment;
the reading module is used for reading the array elements corresponding to the target tunnel index from the first array recorded in the memory to obtain a target statistical index corresponding to the target tunnel index; wherein, each array element included in the first array is used for storing a statistical index corresponding to a tunnel index;
the reading module is further configured to read tunnel statistics information corresponding to the target statistics index from a forwarding chip.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the reading module is further configured to, after the tunnel statistics information corresponding to the target statistics index is read from the forwarding chip, read an array element corresponding to the target statistics index from a second array recorded in the memory, and obtain a tunnel index; wherein each array element included in the second array is used for storing a tunnel index corresponding to a statistic index;
the determining module is used for taking the tunnel statistical information as the tunnel statistical information of the tunnel to be counted if the read tunnel index is the same as the target tunnel index; or,
The determining module is further configured to, if the read tunnel index is different from the target tunnel index, use the tunnel statistics information as the tunnel statistics information of the tunnel to which the read tunnel index belongs; or,
and the determining module is further configured to ignore the tunnel statistics information read at this time if the array element corresponding to the target statistics index is in an invalid state, where the array element corresponding to the target statistics index is in an invalid state, which indicates that the target statistics index is released and is not successfully applied by any tunnel at present.
8. The apparatus of claim 6, wherein the apparatus further comprises:
the searching module is used for searching array elements corresponding to the target tunnel index from a third array recorded in the memory after the tunnel statistical information corresponding to the target statistical index is read from the forwarding chip, so as to obtain a target compensation value corresponding to the target tunnel index; each array element included in the third array is used for storing a compensation value corresponding to a tunnel index, and the target compensation value is the data quantity except the effective load in the single message forwarded by the tunnel to be counted;
And the determining module is used for determining the statistical result of the tunnel to be counted according to the target compensation value and the tunnel statistical information corresponding to the target statistical index.
9. The apparatus of claim 6, wherein the apparatus further comprises:
the setting module is configured to set an array element corresponding to the target tunnel index to a first value in a fourth array of the memory record when it is monitored that preset dimension data corresponding to the target tunnel index is updated, where each array element included in the fourth array respectively represents an update state of a tunnel, and the preset dimension data includes: counting indexes and tunnel data influencing a compensation value, wherein the compensation value is the data quantity except for a payload in a single message forwarded through a tunnel;
the checking module is used for checking whether the array element corresponding to the target tunnel index is a first value or not from a fourth array recorded in the memory before the array element corresponding to the target tunnel index is read from the first array recorded in the memory;
the calling module is used for calling the reading module to execute the step of reading the array element corresponding to the target tunnel index from the first array recorded in the memory if the checking result of the checking module is no;
And the searching module is used for searching the tunnel software information of the tunnel to be counted according to the target tunnel index if the checking result of the checking module is yes, extracting the statistic index and the tunnel data of the tunnel to be counted from the tunnel software information, calculating a compensation value based on the extracted tunnel data, and reading the tunnel statistic information corresponding to the extracted statistic index from the forwarding chip.
10. The apparatus of claim 9, wherein the setup module is further configured to:
after the tunnel statistical information corresponding to the extracted statistical index is read from the forwarding chip, setting an array element corresponding to the target tunnel index in the first array as the extracted statistical index;
setting an array element corresponding to the target tunnel index in the fourth array to be a second value, wherein the second value indicates that the preset dimension data is not updated;
setting an array element corresponding to the target tunnel index in a third array recorded in a memory as a calculated compensation value; and each array element included in the third array is used for storing a compensation value corresponding to the tunnel index.
11. The network equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
A memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1-5 when executing a program stored on a memory.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-5.
CN202310532425.6A 2023-05-09 2023-05-09 Tunnel information statistical method, device, network equipment and storage medium Active CN116303474B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310532425.6A CN116303474B (en) 2023-05-09 2023-05-09 Tunnel information statistical method, device, network equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310532425.6A CN116303474B (en) 2023-05-09 2023-05-09 Tunnel information statistical method, device, network equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116303474A CN116303474A (en) 2023-06-23
CN116303474B true CN116303474B (en) 2023-08-18

Family

ID=86817047

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310532425.6A Active CN116303474B (en) 2023-05-09 2023-05-09 Tunnel information statistical method, device, network equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116303474B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106027356A (en) * 2016-07-04 2016-10-12 杭州迪普科技有限公司 Tunnel identifier conversion method and device
CN107547311A (en) * 2017-08-29 2018-01-05 新华三技术有限公司 A kind of flow statistical method and device
CN110391961A (en) * 2018-04-18 2019-10-29 华为技术有限公司 A kind of tunnel binding method, equipment and system
CN112187556A (en) * 2019-07-01 2021-01-05 华为技术有限公司 Congestion measurement method and network node
CN112787921A (en) * 2019-11-08 2021-05-11 华为技术有限公司 Message transmission method, proxy node and storage medium
CN113783789A (en) * 2021-09-29 2021-12-10 新华三信息安全技术有限公司 Message speed limiting method and device
WO2023011149A1 (en) * 2021-07-31 2023-02-09 华为技术有限公司 Communication method based on segment routing over internet protocol version 6 (srv6)

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9225550B2 (en) * 2012-06-21 2015-12-29 International Business Machines Corporation Switch monitoring statistics gathering at servers and gateways for overlay networks

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106027356A (en) * 2016-07-04 2016-10-12 杭州迪普科技有限公司 Tunnel identifier conversion method and device
CN107547311A (en) * 2017-08-29 2018-01-05 新华三技术有限公司 A kind of flow statistical method and device
CN110391961A (en) * 2018-04-18 2019-10-29 华为技术有限公司 A kind of tunnel binding method, equipment and system
CN112187556A (en) * 2019-07-01 2021-01-05 华为技术有限公司 Congestion measurement method and network node
CN112787921A (en) * 2019-11-08 2021-05-11 华为技术有限公司 Message transmission method, proxy node and storage medium
WO2023011149A1 (en) * 2021-07-31 2023-02-09 华为技术有限公司 Communication method based on segment routing over internet protocol version 6 (srv6)
CN113783789A (en) * 2021-09-29 2021-12-10 新华三信息安全技术有限公司 Message speed limiting method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Optimal Deployment of SRv6 to Enable Network Interconnection Service;Bangbang Ren 等;ACM;第120-133页 *

Also Published As

Publication number Publication date
CN116303474A (en) 2023-06-23

Similar Documents

Publication Publication Date Title
US11005730B2 (en) System, method, and apparatus for high throughput ingestion for streaming telemetry data for network performance management
CN111641585B (en) DDoS attack detection method and device
CN111600807A (en) Flow control method and system based on API gateway equipment
CN109981737A (en) A kind of processing method of network request, device, terminal and storage medium
CN108616896B (en) Operator identification method and device and internet access system
CN110503297B (en) Service scene acquisition method and device, electronic equipment and medium
CN116303474B (en) Tunnel information statistical method, device, network equipment and storage medium
US20230315886A1 (en) Data use control method and system, electronic device and storage medium
CN115037653B (en) Service flow monitoring method, device, electronic equipment and storage medium
US11914540B2 (en) On-chip integrated circuit, data processing device, and data processing method
CN105656855B (en) The control method and device that resource accesses
CN111884932B (en) Link determining method, device, equipment and computer readable storage medium
US20220201462A1 (en) Protecting a user data repository (udr) from over-accumulation of subscription requests in a standalone 5g network
US10667121B2 (en) Control of self-organizing network functions
JP4946906B2 (en) Multicast address information processing apparatus and multicast address information processing program
WO2021093147A1 (en) Method, system and apparatus for i-smf event subscription and notification
WO2021121176A1 (en) Method and device for updating status information of sim card, and server
US20230021904A1 (en) Method and Apparatus for Signaling Session Terminations in a Communication Network
CN113810284A (en) Method and device for determining message sending path
CN109582595A (en) EMS memory management process, device, server and storage medium
CN111708689B (en) Method and device for modifying AB experiment and electronic equipment
CN111639089B (en) Transaction processing method, transaction processing device, electronic equipment and computer readable storage medium
CN113507441B (en) Secure resource expansion method, secure protection management platform and data node
CN116668343B (en) Stream following detection method, device, equipment and storage medium
CN115567365A (en) Optical transport network special line alarm method, equipment and customer network management platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant