Message information acquisition method and apparatus, storage medium and electronic apparatus

By configuring the target template and processing module on the IPFIX device, the problem that the IPFIX acquisition method in the prior art cannot meet the MPLS message collection and statistics needs, and the effective acquisition of the tag stack network action and auxiliary data information in the MPLS message is achieved.

WO2025066115A1PCT designated stage expired Publication Date: 2025-04-03ZTE CORP
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/089170
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-26
Filing Date
2024-04-22
Publication Date
2025-04-03

AI Technical Summary

Technical Problem

The IPFIX acquisition method in the prior art cannot meet the collection and statistical needs of MPLS packets, especially in terms of the acquisition of network actions and auxiliary data information carried in the tag stack.

Method used

By configuring a target template on the IPFIX device for outputting IPFIX devices, the target element information is obtained for obtaining the target information in the MPLS message, and the MPLS message is processed based on this information to obtain the required target information.

Benefits of technology

It realizes effective collection and statistics of network actions and auxiliary data information in the tag stack in MPLS packets, and meets the complex needs of message information acquisition in modern networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024089170_03042025_PF_FP_ABST
    Figure CN2024089170_03042025_PF_FP_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide a message information acquisition method and apparatus, a storage medium and an electronic apparatus. The method comprises: acquiring a target template configured on an IP flow information export (IPFIX) device in advance, wherein the target template carries target element information used for acquiring target information in a multi-protocol label switching (MPLS) message; and, on the basis of the target element information, processing the MPLS message to acquire the target information.
Need to check novelty before this filing date? Find Prior Art

Description

Method and device for obtaining message information, storage medium and electronic device

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] The present disclosure is based on Chinese patent application CN 202311258037.X filed on September 26, 2023, entitled “Method and device for obtaining message information, storage medium and electronic device”, and claims the priority of the patent application, and all the contents disclosed therein are incorporated into the present disclosure by reference. Technical Field

[0003] The embodiments of the present disclosure relate to the field of communications, and in particular, to a method and device for acquiring message information, a storage medium, and an electronic device. Background Art

[0004] The key to MPLS (Multi-Protocol Label Switching) technology is the introduction of the label concept, which maps IP (Internet Protocol) addresses into simple, fixed-length labels for use with various packet forwarding and switching technologies. Upon receiving a data packet, an edge device in an MPLS network analyzes the packet's contents, selects an appropriate label for it, and encapsulates the packet within the label before sending it into the MPLS network. All routers in the MPLS network use this short, fixed-length label, replacing the IP header, as the basis for forwarding. When the packet ultimately leaves the MPLS network, the label is stripped off by the edge device. Using MPLS technology to forward data packets improves data forwarding efficiency.

[0005] In the related IPFIX (IP Flow Information Export) technology, the way to collect MPLS messages is very limited, and the related MPLS elements are still defined with reference to the most original MPLS model. However, the MPLS model in the related technology is no longer just the original MPLS model. The content carried in the label stack, such as the entropy label and other structures, are not the same as the original MPLS. All 32 bits are meaningful. In addition to the user payload, the label stack can also carry special structures such as the GACH header for specific functions. On the other hand, with the evolution of the network and the development of new services, more and more services require network instructions and / or auxiliary data information to be carried in or after the MPLS label stack to guide the equipment to process the message. However, the collection method of IPFIX in the related technology can no longer meet the needs of MPLS message collection and statistics.

[0006] With respect to the above-mentioned problems existing in the related technologies, no effective solution has been proposed yet.

[0007] Summary of the Invention

[0008] The embodiments of the present disclosure provide a method and device for acquiring message information, a storage medium, and an electronic device, so as to at least solve the problem in the related art that the IPFIX collection method cannot meet the requirements of MPLS message collection and statistics.

[0009] According to one embodiment of the present disclosure, a method for obtaining message information is provided, comprising: obtaining a target template pre-configured on an IP flow information output IPFIX device, wherein the target template carries target element information for obtaining target information in a Multi-Protocol Label Switching (MPLS) message; and processing the MPLS message based on the target element information to obtain the target information.

[0010] According to another embodiment of the present disclosure, a device for acquiring message information is provided, including: an acquisition module, configured to acquire a target template pre-configured on an IP flow information output IPFIX device, wherein the target template carries target element information for acquiring target information in a multi-protocol label switching (MPLS) message; and a processing module, configured to process the MPLS message based on the target element information to acquire the target information.

[0011] According to another embodiment of the present disclosure, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.

[0012] According to another embodiment of the present disclosure, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] FIG1 is a schematic diagram of the format of mplsTopLabelStackSection in the related art;

[0014] 2 is a hardware structure block diagram of a network device of a method for obtaining message information according to an embodiment of the present disclosure;

[0015] FIG3 is a flow chart of a method for acquiring message information according to an embodiment of the present disclosure;

[0016] FIG4 is a schematic diagram of MPLS packets to be collected according to a specific embodiment of the present disclosure;

[0017] FIG5 is a schematic diagram of an IPFIX template according to a specific embodiment of the present disclosure;

[0018] FIG6 is a schematic diagram of an IPFIX message according to a specific embodiment of the present disclosure;

[0019] FIG7 is a schematic diagram of network action profile elements according to a second specific embodiment of the present disclosure;

[0020] FIG8 is a schematic diagram of a message to be sampled according to a second specific embodiment of the present disclosure;

[0021] FIG9 is a schematic diagram of an IPFIX template according to a second specific embodiment of the present disclosure;

[0022] FIG10 is a schematic diagram of an IPFIX message according to a second specific embodiment of the present disclosure;

[0023] FIG11 is a structural block diagram of a device for acquiring message information according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings and in conjunction with embodiments.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0026] First, the terms and technologies involved in this disclosure are explained:

[0027] The IPFIX protocol is a protocol for analyzing data flow characteristics and outputting data in a template-based format. The format defined by IPFIX is based on the Cisco Netflow Version 9 data output format, which enables IP flow information to be transmitted from an exporter to a collector. IPFIX unifies traffic monitoring standards and simplifies the flow output architecture by using a single, consistent model. IPFIX can be used for traffic billing, traffic engineering, attack monitoring, network service quality monitoring, etc. IPFIX devices refer to devices that export IPFIX information, which can be switches, routers, and other devices.

[0028] IPFIX outputs flow information in a templated manner by defining standardized information elements (hereinafter referred to as "elements"). Information elements generally include the types shown in Table 1:

[0029] Table 1

[0030] In current IPFIX technology, the methods for collecting MPLS packets are very limited. The relevant MPLS elements are still defined based on the original MPLS model, that is, MPLS packets consist of an MPLS label stack and service payload. Forwarding devices forward only based on the top-level label of the label stack. Each LSE (Label Stack Entry) in the label stack consists of 20 label bits + 3 Exp bits + 1 bottom-of-stack identifier S + 8 TTL (Time To Live). Based on this model, the MPLS elements defined in IPFIX include:

[0031] 1) mplsTopLabelStackSection and mplsLabelStackSection2-10 collect MPLS labels at each layer. However, in the traditional MPLS model, by default, only the TTL of the top-of-stack label is forwarded and has practical significance. Therefore, these elements are only 24 bits long, as shown in Figure 1. Additional elements are defined to view the TTL of the top-of-stack label. For LSEs not on the top of the stack, only the first 24 bits can be viewed.

[0032] 2) mplsLabelStackSection: Used to extract a complete or partial label stack. Combined with the sectionOffset (e.g., value N) and sectionExportedOctets (e.g., value M), it extracts a data portion of length M starting at an offset of N bytes from the top of the stack. While theoretically, extracting 32-bit LSEs from a label stack requires combining the mplsLabelStackSection, sectionOffset, and sectionExportedOctets fields, extracting multiple, discontinuous LSEs requires complex configuration and a large amount of reported information. Furthermore, the combined use of these three fields is inconvenient and inefficient, particularly when extracting multiple, discontinuous LSEs.

[0033] 3) mplsPayloadPacketSection: This field is used to extract the content carried after the MPLS label stack. Combined with the sectionOffset and sectionExportedOctets fields, this field can be used to view the data portion (length M) starting at an offset N bytes after the bottom of the stack. However, this method is limited to simply extracting data. To understand the specific data carried after the stack, further analysis is required after data collection.

[0034] In order to meet the diverse needs of carrying information in MPLS, a new MPLS-based data plane format is defined in the embodiments of the present disclosure, including new information indication and carrying in MPLS. By defining a common structure, different network actions and data carrying requirements can be met, and multiple network actions can be carried simultaneously.

[0035] The network action and possible auxiliary data are carried in the label stack as follows:

[0036] 1) In the label stack, a special label is used to indicate the network action carried in the stack. The network action is carried immediately after the special label. The special label value corresponds to the network action type one by one.

[0037] 2) It is carried in a common structure in the new architecture, called the Network Action Sub-Stack (NAS). A specific special label value is used to identify the start of the NAS. A NAS can carry multiple network actions and related auxiliary data at the same time.

[0038] For the sake of distinction, in the embodiments of the present disclosure, the first method is referred to as non-NAS carrying method, and the second method is referred to as NAS carrying method.

[0039] The label stack is carried in the following ways:

[0040] In the label stack, a special label is used to indicate the network action carried after the stack. The special label value corresponds to the network action type one by one.

[0041] It is carried in a common structure in the new architecture, called the Post Stack Data Header (PSDHeader). The label stack may or may not contain an indicator indicating the data carried after the stack. The PSDHeader will carry information such as the type, length, and specific data of the network action. A PSDHeader structure may carry multiple network actions.

[0042] For the sake of convenience, in the embodiments of the present disclosure, the first method is referred to as a non-PSDHeader method, and the second method is referred to as a PSDHeader carrying method.

[0043] It should be noted that the above names are only exemplary and can be adjusted according to actual conditions in actual applications.

[0044] The present disclosure is described below with reference to embodiments:

[0045] The method embodiments provided in the embodiments of the present application can be executed in network devices, such as routers, switches, firewalls and other devices. Figure 2 is a block diagram of the hardware structure of the network device of the method for obtaining message information in the embodiment of the present disclosure. As shown in Figure 2, the device may include one or more (only one is shown in Figure 2) processors 202 (the processor 202 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 204 configured to store data, wherein the above-mentioned mobile terminal may also include a transmission device 206 and an input and output device 208 configured to have a communication function. It can be understood by those skilled in the art that the structure shown in Figure 2 is only for illustration, and it does not limit the structure of the above-mentioned network device. For example, the network device may also include more or fewer components than those shown in Figure 2, or have a configuration different from that shown in Figure 2.

[0046] The memory 204 can be configured to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for obtaining message information in the embodiment of the present disclosure. The processor 22 executes various functional applications and data processing by running the computer program stored in the memory 204, that is, implementing the above-mentioned method. The memory 204 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 204 may further include a memory remotely located relative to the processor 202, and these remote memories may be connected to the above-mentioned devices via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0047] The transmission device 206 is configured to receive or transmit data via a network. Specific examples of the aforementioned network may include a wireless network provided by a telecommunications provider. In one embodiment, the transmission device 206 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one embodiment, the transmission device 206 may be a radio frequency (RF) module configured to communicate with the Internet wirelessly.

[0048] In this embodiment, a method for obtaining message information is provided. FIG3 is a flow chart of the method for obtaining message information according to an embodiment of the present disclosure. As shown in FIG3 , the process includes the following steps:

[0049] Step S302: obtaining a target template pre-configured on an IP flow information output IPFIX device, wherein the target template carries target element information for obtaining target information in a Multi-Protocol Label Switching (MPLS) message;

[0050] Step S304: Process the MPLS message based on the target element information to obtain the target information.

[0051] Among them, the above steps may be performed by IPFIX devices, including but not limited to network devices such as routers, switches, and firewalls, or the above steps may be performed by some components of the IPFIX device or devices or systems that have an associated relationship with the IPFIX device, and other devices with similar processing capabilities may be obtained. This disclosure does not impose any restrictions on this.

[0052] In the above embodiment, the target template will carry target element information for obtaining the target information in the MPLS message, wherein the target element information processing includes the element information recorded in the relevant technology, and may also include some specific or newly defined element information. The target information in the above MPLS message can be the information in the label stack of the MPLS message, or the information after the label stack of the MPLS message. In addition, it can also be other information included in the MPLS that is allowed to be obtained. The content included in the above target template can be flexibly configured based on the information actually needed to be obtained.

[0053] In the above embodiment, the IPFIX device can obtain corresponding information (i.e., the information included in the above target information that needs to be obtained) by scanning and parsing the MPLS message according to the above target template. After obtaining the corresponding information, the IPFIX device will report the collected MPLS message information (i.e., the above corresponding information), wherein the reporting action is actually sent to a receiving end such as a network analyzer, a processor, a processing system, etc.

[0054] Through the above embodiment, a target template is pre-configured on the IPFIX device, and the target template carries target element information for obtaining target information in the MPLS message that needs to be collected and counted, thereby achieving the purpose of obtaining target information in the MPLS message based on the target template, and effectively solving the problem that the IPFIX collection method in the related art cannot meet the needs of MPLS message collection and statistics.

[0055] In an optional embodiment, the above-mentioned target information includes at least one of the following: one or more label stack entries LSE in the label stack of the MPLS message; information about the network action in the label stack of the MPLS message, wherein the network action is used to indicate the network instruction for processing the MPLS message, and the information about the network action includes type information of the network action; information about the network action after the label stack of the MPLS message, wherein the network action is used to indicate the network instruction for processing the MPLS message, and the information about the network action includes type information of the network action; information about the carrying unit of the network action in the label stack of the MPLS message, wherein the network action is used to indicate the network instruction for processing the MPLS message; information about the carrying unit of the network action after the label stack of the MPLS message, wherein the network action is used to indicate the network instruction for processing the MPLS message; information about the network action in any position in the MPLS message, wherein the network action is used to indicate the network instruction for processing the MPLS message.

[0056] In the above embodiment, the information of the network action in the label stack of the MPLS message includes at least the type information of the network action, and further, may also selectively include the offset of the network action carrying position and / or the length of the network action carrying unit. Similarly, the information of the network action after the label stack of the above MPLS message includes at least the type information of the network action, and further, may also selectively include the offset of the network action carrying position and / or the length of the network action carrying unit. The information of the network action at any position in the above MPLS message does not distinguish the specific position of the network action, that is, the network action information carried at any position can be obtained.

[0057] In an optional embodiment, when the target information includes one or more label stack entries (LSEs) in the label stack of the MPLS packet, processing the MPLS packet based on the target element information, and obtaining the target information includes: when the target element information is used to indicate the first element name of one or more LSEs in the label stack of the MPLS packet to be collected, obtaining the one or more LSEs in the label stack of the MPLS packet corresponding to the first element name according to a pre-configured correspondence between the element name and the element content, wherein the element content is used to indicate the location of the LSE. This optional embodiment is exemplarily described below in conjunction with specific embodiments:

[0058] Specific embodiment 1:

[0059] This embodiment describes the collection of LSE information in the MPLS stack:

[0060] To collect information carried in non-label form in the MPLS label stack, new elements are defined. Their meanings are as follows:

[0061] mplsLSEsection2: 32-bit unit immediately following the LSE at the top of the stack; type code TBA1-1;

[0062] mplsLSEsection3: A 32-bit unit immediately following mplsLSEsection2; type code TBA1-2;

[0063] mplsLSEsection4: 32-bit unit immediately following mplsLSEsection3; type code TBA1-3;

[0064] And so on.

[0065] Combined with this element, the specific information reporting process is as follows:

[0066] A configuration template (corresponding to the target module) is configured to collect MPLS label information for a particular flow. Based on this template, the IPFIX device extracts the LSE at the corresponding position from the label stack. This extraction method can start from the top of the stack, directly find the starting position of the target LSE, and then extract the 32 bits that follow. This record is then reported via IPFIX.

[0067] The following describes the specific steps:

[0068] Figure 4 shows an MPLS packet. To configure the template, the second and fourth LSEs in the label stack need to be collected.

[0069] The IPFIX device collects information about the specified message according to the configuration, and collects the content of the second LSE as LSE2 and the content of the fourth LSE as LSE4.

[0070] IPFIX reports MPLS message information, including template information and corresponding record information. The template information is shown in Figure 5. The type codes TBA1-1 and TBA1-3 respectively indicate that the template carries the elements mplsLSEsection2 and mplsLSEsection4.

[0071] The record information is shown in Figure 6. Each field corresponds to the template one by one. Like the IPFIX technology in related technologies, the receiver of the IPFIX message associates the message record with the corresponding template through the set ID (set identifier) ​​to obtain the corresponding meaning of each field.

[0072] In an optional embodiment, when the target information includes information about a network action in a label stack of the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: when the target element information is used to indicate type information of the network action carried in the label stack of the MPLS message, determining a carrying manner of the network action in the label stack of the MPLS message; when it is determined that the network action is indicated by a specific label, scanning the MPLS message, and when a first label value is scanned, determining the type information of the network action corresponding to the first label value, wherein the specific label includes at least one of the following: an MPLS special label SPL, an MPLS extended special label eSPL; when it is determined that the network action is indicated by a target field in the MPLS message, scanning the MPLS message, and when a second label value for identifying the start of the target field is scanned, continuing to read the target field in the MPLS message backward, and determining the type information of the network action carried in the target field. In this embodiment, specific label processing includes MPLS special labels (SPL) and MPLS extended special labels (eSPL). (It should be noted that SPL and eSPL are special value labels defined by the MPLS standard.) Other types of labels may also be included. In this embodiment, only SPL and eSPL are used as examples. In this embodiment, the method of using specific labels to indicate the carrying of network actions can also be referred to as the non-network action sub-stack (NAS) method, and the method of using the destination field in the MPLS message to indicate the carrying of network actions can also be referred to as the NAS method.

[0073] In an optional embodiment, determining the type information of the network action carried in the target field includes: when the target type information carried in the target field is used to identify that the LSE carries the network action in a bit-set indication manner, reading the set bit to obtain the type information of the network action; when the target type information carried in the target field is used to identify that the target type information directly indicates the type information of the network action, obtaining the type information of the network action directly indicated by the target type information. In this embodiment, the target type information may also include information such as a type code or a type field, for example, it may also be opcode information.

[0074] As described in the aforementioned embodiment, the network action information in the label stack of the MPLS packet may optionally include an offset of the network action carrying position and / or a length of the network action carrying unit. The following describes how to obtain this information:

[0075] In an optional embodiment, the method further includes: when the target element information also includes first element information for indicating the offset of the unit of the network action carried in the MPLS message label stack, scanning the MPLS message starting from the top of the label stack, and determining the length from the top of the label stack to the starting position of the unit scanned for carrying the network action as the offset of the unit of the network action carried in the MPLS message label stack.

[0076] In an optional embodiment, the method further includes: when the target element information also includes second element information for indicating the byte length of the unit of the network action carried in the MPLS message label stack, determining the byte length of the unit of the network action carried in the MPLS message label stack according to a pre-configured length (for example, byte length) corresponding to the second element information.

[0077] The following describes how to obtain network action information in the label stack of an MPLS packet with reference to a specific embodiment:

[0078] Specific embodiment 2:

[0079] This embodiment describes the collection of network action profiles in the MPLS stack:

[0080] First, it should be noted that the direct extraction of original messages has disadvantages: either full extraction results in redundant information, or precise knowledge of the message structure is required, such as the start and end locations of the information to be extracted. Furthermore, due to label stripping / pushing, business modifications, and other reasons, the extraction locations may vary on each node.

[0081] The method in the first embodiment can only ensure that complete LSE information can be collected, but the specific meaning of the collected LSE needs to be further analyzed according to the context after the collector collects it. This embodiment defines another reporting method that directly reflects the overview of the network actions carried in the stack.

[0082] To collect an overview of the network actions in the stack, the following are examples of newly defined elements:

[0083] Element type code: TBA2-1;

[0084] Element name: In Stack MPLS Network Action;

[0085] Element content: 32-bit flag field, each bit represents a type of information. As shown in Figure 7, from left to right, when bitU is set, it indicates that an unknown type of network action exists. When bitA is set, it indicates that network action A exists in the stack. When bitB is set, it indicates that network action B exists in the stack. And so on.

[0086] The process of collecting network action profile information in the stack is as follows:

[0087] 1) Configuration template, requiring extraction of network action profiles from the MPLS label stack of a specific flow;

[0088] 2) The IPFIX device starts scanning from the top of the label stack, which can be divided into two situations:

[0089] a) For network actions carried in non-NAS mode, since each network action corresponds to a special tag value, the corresponding network action type can be directly obtained based on the scanned special tag value (the tag value can be pre-configured, conventional, or determined in the prior art). If an unrecognized special tag is scanned, bit U can be set (i.e., set to 1 to indicate that the network action cannot be recognized. The subsequent steps are similar and will not be repeated here).

[0090] b) For network actions carried in NAS mode, after scanning the special tag value that indicates the start of NAS, it is necessary to continue reading backward. If the opcode in NAS indicates that the LSE carries a network action in flag mode, read the flag bit to obtain the network action type. If the opcode directly indicates the network action type, no further analysis is required. For unrecognized flag bits and opcodes, set bit U;

[0091] 3) Report network action profile information according to the IPFIX template.

[0092] Another possible approach is to define two elements for network actions carried in NAS mode and network actions carried in non-NAS mode to facilitate differentiation. The specific operation is similar and will not be repeated here.

[0093] Furthermore, in this specific embodiment, offset information of the unit carrying the network action may also be collected to clarify the position of the network action in the label stack.

[0094] The corresponding new element definition example is as follows:

[0095] Element type code: TBD2-2;

[0096] Element name: MNAUnitOffset;

[0097] Element content: The number of bytes required to offset from the top of the MPLS label stack to the beginning of the network action carrying unit.

[0098] If there are multiple network action carrying units in an IPFIX template, multiple MNAUnitOffset elements can be carried accordingly, corresponding to the order of the network action carrying units, that is, the first MNAUnitOffset in the template corresponds to the first In Stack MPLS Network Action, and so on.

[0099] The difference between MNAUnitOffset and sectionOffset: sectionOffset is a pre-configured fixed value that specifies the location of the information to be collected; MNAUnitOffset is the value obtained after the device parses the message.

[0100] In addition to offset information, you can also define elements to collect the length of the network action unit. Generally speaking, the length of the network action unit carried in non-NAS mode is fixed. That is, based on the corresponding special tag value, the pre-agreed length is also obtained when the network action type is obtained. For example, in most cases, the network action unit consists of a 32-bit special tag followed by a 32-bit LSE that carries the network action-related data. Length information is mainly used in NAS mode because the NAS length is variable.

[0101] The following is an example of length element definition:

[0102] Element type code: TBD2-3;

[0103] Element name: MNAUnitOctets;

[0104] Element content: The byte length of the unit carried by this network action.

[0105] The method for collecting the unit length information carried by network actions is as follows:

[0106] Configure a template on the IPFIX device to collect the length information of the network action unit;

[0107] For NAS carrying mode, the length information is obtained by reading the length field in the NAS;

[0108] Reports MPLS message information, including network action unit length information.

[0109] The following is a detailed example of the collection method:

[0110] The MPLS message to be collected is shown in Figure 8. SPL1 is a specific special label value that identifies the start of NAS. LSE with opcode = 1 represents that it is followed by a network action identified by a flag. That is, the specific network type needs to be indicated according to the setting of the flag. The LSE also carries length information, indicating the length of the entire NAS. Opcode = 9 directly describes the specific network action type through the type code, such as IOAM. The data part that follows is the auxiliary data carried by the network action.

[0111] Configuration on the IPFIX device requires collecting the network action profile information in the stack in the message, as well as the offset and length information of the unit carried by the network action profile.

[0112] Based on the configuration, the IPFIX device scans the MPLS message starting from the top of the stack. After scanning SPL1, it detects the presence of a network action unit carried in NAS format. It then continues scanning the flag portion after opcode = 1 to determine which network actions are carried and the NAS length. It then continues scanning within this length and, using opcode 9, determines that a specific network action 9 is carried. It also records the number of bytes scanned from the top of the stack to SPL1 to obtain the NAS offset information.

[0113] IPFIX device reporting message template and message record. The message template is shown in Figure 9.

[0114] The message record is shown in Figure 10. Each part corresponds to the template one by one, and carries the following in turn:

[0115] The network action overview information in the stack sets the bit corresponding to the scanned network action;

[0116] The network action carries unit offset information: two LSEs, or 8 bytes;

[0117] Network action unit length information: The read NASL length information, which is 8 bytes in this example.

[0118] After obtaining the overview information, the user can further decide to extract the detailed information of the message for viewing. In this example, after obtaining the offset and length information, the method in specific embodiment 1 can be used to extract the content of LSE3 and LSE4 carrying the network action, that is, the detailed information carried by the network action.

[0119] In an optional embodiment, when the target information includes information about the network action after the label stack of the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: when the target element information is used to indicate the type information of the network action carried after the label stack of the MPLS message, determining the carrying manner of the network action after the label stack of the MPLS message; when it is determined that the network action is carried in the form of a post-stack data header, obtaining the type information of the network action by parsing the network action type code carried in the post-stack data header; when it is determined that the network action is carried in a non-post-stack data header, scanning the MPLS message label stack, and when a third label value carried in the MPLS message label stack is scanned, determining the type information of the network action corresponding to the third label value. In this embodiment, the post-stack data header can also be expressed as a PSD Header, where the post-stack data header refers to a data structure carried after the MPLS label stack for carrying network actions. There are two ways of indicating data: 1) This PSD Header carries a type code, indicating the type of data carried by this PSD; 2) The PSD Header carries a type code, indicating the type of data carried by the next PSD Header.

[0120] In an optional embodiment, the method further includes: scanning the MPLS message label stack to determine whether there is indication information in the MPLS message label stack corresponding to the network action carried after the MPLS message label stack; if it is determined that there is indication information, triggering the execution of the network action of scanning the part after the MPLS message label stack.

[0121] As described in the aforementioned embodiment, the network action information following the label stack of the MPLS packet may optionally include an offset of the network action carrying position and / or a length of the network action carrying unit. The following describes how to obtain this information:

[0122] In an optional embodiment, the method further includes:

[0123] In a case where the target element information also includes third element information for indicating the offset of the unit of the network action carried after the MPLS message label stack, the MPLS message is scanned, and the length from the bottom of the label of the MPLS message to the starting position of the unit for carrying the network action after scanning the MPLS message label stack is determined as the offset of the unit of the network action carried after the MPLS message label stack.

[0124] In an optional embodiment, the method further includes:

[0125] When the target element information also includes fourth element information for indicating the byte length of the unit of the network action carried after the MPLS message label stack, the byte length of the unit of the network action carried after the MPLS message label stack is determined according to the pre-configured length corresponding to the fourth element information.

[0126] The following describes how to obtain the network action information behind the label stack of an MPLS packet with reference to a specific embodiment:

[0127] Specific embodiment 3:

[0128] This embodiment describes the collection of network action profiles after the MPLS stack:

[0129] Similar to the above-mentioned specific embodiment 2, for the information after the MPLS label stack, a summary of the information after the stack can also be collected.

[0130] The following are examples of newly defined elements:

[0131] Element type: TBA3-1;

[0132] Element name: MPLS PostStack Data;

[0133] Element content: 32-bit Flag field, each bit represents a type of information.

[0134] For the PSD header, the message information collection process is as follows:

[0135] 1) Configure the template to indicate that the network action profile information carried after the MPLS label stack needs to be collected;

[0136] 2) The IPFIX device parses the message to obtain specific information. For post-stack data carried in PSDHeader format, the network action type is determined by parsing the network action type code carried in the PSDHeader. For traditional methods that carry post-stack network actions in non-PSDHeader format, since special label values ​​correspond one-to-one with post-stack network actions, scanning the label stack and finding a special label value corresponding to a post-stack network action indicates that a corresponding network action exists in the post-stack.

[0137] In some scenarios, the label stack may carry instructions after parsing the stack but before the PSDHeader. This may also include scanning the MPLS label stack to find whether there is an indication of a network action after the stack. If so, the latter part of the stack is scanned. If not, it is assumed that the stack does not carry any network action.

[0138] 3) Report the collected MPLS message stack and network action overview information.

[0139] Similarly, the offset information and length information of the network action carrying unit after the stack can also be collected.

[0140] The elements that need to be defined are as follows:

[0141] Element type code: TBD3-2;

[0142] Element name: PSDOffset;

[0143] Element content: Starting from the bottom of the MPLS label, the offset of the network action carrying unit from the bottom of the label stack after reaching the stack.

[0144] Element type code: TBD3-3;

[0145] Element name: PSDOctets;

[0146] Element content: the length of the network action carrying part after the stack.

[0147] Similarly, for fixed-length network action carrying methods, the length is determined when the network action type is obtained. For variable-length network action carrying methods, the length field of the network action carrying unit needs to be parsed.

[0148] After obtaining the summary information, users can further decide to extract detailed information from the packet. In this example, after obtaining the offset and length information, the mplsPayloadPacketSection element can be used in conjunction with the sectionOffset and sectionExportedOctets fields to extract detailed information about the portion of the packet carried by the network action after the stack.

[0149] In an optional embodiment, when the target information includes information about a carrying unit of a network action in the label stack of the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: when the target element information is used to indicate information about a carrying unit of a network action in the label stack of the MPLS message, scanning the label stack of the MPLS message; when a fourth label value indicating a specific label is scanned, determining a position after the fourth label value as a first starting position of the carrying unit of the network action in the label stack of the MPLS message, wherein the specific label is used to indicate the carrying of the network action; and extracting content in the carrying unit of the network action in the label stack of the MPLS message starting from the first starting position.

[0150] The following is an exemplary description of how to obtain the information of the network action carrying unit in the label stack of the MPLS message with reference to a specific embodiment:

[0151] Specific embodiment 4:

[0152] This embodiment describes how to extract the network action carrying unit information in the stack:

[0153] By collecting network action profiles, the IPFIX receiver can obtain information about whether a message carries a specific network action. However, in some scenarios, it may be necessary to collect detailed information carried by the network action.

[0154] The newly defined elements are as follows:

[0155] Element type code: TBD4-1;

[0156] Element name: NASsection;

[0157] Element content: NAS portion of the label stack.

[0158] The specific process is as follows:

[0159] 1) Configuration on the IPFIX device requires extraction of the NAS portion carried in the label stack;

[0160] 2) The IPFIX device scans the label stack, searches for the special label indicating NAS, obtains the starting position of the network action carrying unit, which is immediately after the special label, and then reads the length of the NAS, starting from the starting position, extracts the corresponding length, and obtains the complete network action carrying unit;

[0161] 3) Report message information in IPFIX format, including the obtained network action carrying unit information.

[0162] In an optional embodiment, when the target information includes information of a carrying unit of a network action after the label stack of the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: when the target element information is used to indicate information of a carrying unit of a network action after the label stack of the MPLS message, scanning the label stack of the MPLS message; determining the starting position and byte length of the carrying unit of the network action after the label stack of the MPLS message based on the scanning result; and obtaining the carrying unit of the network action after the label stack of the MPLS message according to the starting position and byte length of the carrying unit of the network action after the label stack of the MPLS message.

[0163] In an optional embodiment, the method further includes: scanning the label stack of the MPLS message; and triggering the action of scanning the label stack of the MPLS message when a predetermined character of a carrying unit indicating a network action after searching for the label stack of the MPLS message is scanned.

[0164] The following is an exemplary description of how to obtain the information of the network action carrying unit after the label stack of the MPLS message with reference to a specific embodiment:

[0165] Specific embodiment 5:

[0166] This embodiment describes the network action carrying unit information after extracting the stack:

[0167] Similar to the aforementioned specific embodiment 4, in order to be able to report the network action carrying unit after the extracted label stack, the new IPFIX elements are defined as follows:

[0168] Element type code: TBD4-2;

[0169] Element name: PSDHeadersection;

[0170] Element content: the PSDHeader part after the tag stack.

[0171] Specific process:

[0172] 1) Configuration on the IPFIX device requires extracting the PSDHeader portion after the label stack;

[0173] 2) After scanning the label stack, the IPFIX device obtains the start and length of the PSD header and extracts the PSD header.

[0174] Before step 2), the following steps may also be included: scanning the label stack to search for an indication of PSDHeader after the stack. This indication may be a special label or a bit indication in the LSE. If the indication exists, the scan continues to the end of the label stack. If the indication does not exist, it is considered that the message does not carry PSDHeader.

[0175] 3) Report message information in IPFIX format, including the acquired post-stack network action carrying unit information.

[0176] In an optional embodiment, when the target information includes information about a network action in any position in the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: when the target element information is used to indicate information about a network action in any position in the MPLS message, determining a carrying method of the network action in the MPLS message; and extracting information about the network action in the MPLS message based on the carrying method of the network action in the MPLS message.

[0177] In an optional embodiment, based on the manner in which the network action is carried in the MPLS message, extracting the information of the network action in the MPLS message includes at least one of the following: in a case where the network action is indicated to be carried by a specific label in the label stack of the MPLS message, scanning the label stack to find a fifth label value for indicating the network action, and in a case where the fifth label value is found, extracting the information of the network action after the fifth label value, wherein the specific label includes at least one of the following: an MPLS special label SPL, an MPLS extended special label eSPL; in a case where the network action is indicated to be carried by a target field in the MPLS message in the label stack of the MPLS message, scanning the label stack to find a sixth label value for indicating the target field, and in a case where the sixth label value is found value, search for the information of the network action in the target field indicated by the sixth label value; when the network action is carried in a non-stack data header after the label stack of the MPLS message, scan the label stack to find the seventh label value used to indicate the network action, and when the seventh label value is found, extract the information of the network action from the bottom of the stack; when the network action is carried in a post-stack data header after the label stack of the MPLS message, for the post-stack data header with an indication in the stack, scan the label stack to find the indicator of the post-stack data header, and when the indicator is found, search for the information of the network action at the post-stack data header after the stack according to the type code; for the post-stack data header without an indication in the stack, directly search for the information of the network action at the post-stack data header after the stack.

[0178] The following describes how to obtain network action information at any location in an MPLS message with reference to a specific embodiment:

[0179] Specific embodiment 5:

[0180] This embodiment describes how to extract network action information at any location:

[0181] In this specific embodiment, the carrying position of the network action is not distinguished. By directly defining the elements of the network action that need to be extracted, the corresponding network action and the auxiliary data that may be carried are extracted. For example, for the carrying of the entropy label, it may be carried in the stack in NAS mode or in non-NAS mode. The entropy label information carried in the MPLS message can be extracted by directly defining the entropy label element.

[0182] For IPFIX devices, if the network action has only one carrying mode, data is extracted from the corresponding location according to the corresponding carrying mode, including:

[0183] 1) If the network action is carried in the stack in a non-NAS manner, the label stack is scanned to find the special label indicating the network action and the network action data is extracted after the special label. If the special label does not exist, it means that the network action does not exist.

[0184] 2) If the network action is carried in the stack as NAS, scan the label stack for a special label indicating NAS and search for the network action in NAS;

[0185] 3) If the network action is carried in a non-PSDHeader format at the end of the stack, the label stack is scanned for the special label indicating the network action. If it exists, the network action data is extracted from the bottom of the stack. If the special label does not exist, it means that the network action does not exist.

[0186] 4) If the network action is carried in the form of PSDHeader after the stack, for the PSDheader indicated in the stack, the label stack is scanned to find the indicator of PSDHeader (not necessarily a special label method, it may be a bit or field in the special label). If it exists, the PSDHeader after the stack searches for the corresponding network action data according to the type code; for the PSDheader without the stack indication, the PSDHeader after the stack searches directly for the corresponding network action data.

[0187] If the network action can be carried in multiple ways, the MPLS packet must be scanned for the corresponding network action data according to the possible carrying methods (i.e., one or more of 1), 2), 3), and 4). To avoid conflicts, the carrying methods can be prioritized, with the highest priority method taking precedence. Alternatively, the first network action found can be used as the first one and no further parsing is performed.

[0188] It should be noted that some of the "carrying methods" do not refer to methods that exist in the technical field, but rather to types of carrying methods supported by the device itself or specified through configuration. For example, entropy labels can be carried in the stack using either NAS or non-NAS methods. If a device only supports one of these methods, it will parse the message according to the supported method and generate the corresponding record for reporting.

[0189] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present disclosure.

[0190] This embodiment also provides a device for acquiring message information, which is used to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0191] FIG11 is a structural block diagram of a device for acquiring message information according to an embodiment of the present disclosure. As shown in FIG11 , the device includes:

[0192] an acquisition module 112 configured to acquire a target template pre-configured on an IP flow information output IPFIX device, wherein the target template carries target element information for acquiring target information in a Multi-Protocol Label Switching (MPLS) message;

[0193] The processing module 114 is configured to process the MPLS message based on the target element information to obtain the target information.

[0194] In an optional embodiment, the target information includes at least one of the following:

[0195] One or more label stack entries LSE in the label stack of the MPLS packet;

[0196] Information about a network action in the label stack of the MPLS packet, wherein the network action is used to indicate a network instruction for processing the MPLS packet, and the information about the network action includes type information of the network action;

[0197] Information about the network action following the label stack of the MPLS packet, wherein the network action is used to indicate a network instruction for processing the MPLS packet, and the information about the network action includes type information of the network action;

[0198] Information about a carrying unit of a network action in the label stack of the MPLS packet, wherein the network action is used to indicate a network instruction for processing the MPLS packet;

[0199] Information about a carrying unit of a network action following the label stack of the MPLS packet, wherein the network action is used to indicate a network instruction for processing the MPLS packet;

[0200] Information about a network action in any position in the MPLS message, wherein the network action is used to indicate a network instruction for processing the MPLS message.

[0201] In an optional embodiment, when the target information includes one or more label stack entries LSE in the label stack of the MPLS packet, the processing module 114 includes:

[0202] An acquisition unit is configured to, when the target element information is used to indicate the first element name of one or more LSEs in the label stack of the MPLS message that needs to be collected, obtain one or more LSEs in the label stack of the MPLS message corresponding to the first element name according to a pre-configured correspondence between the element name and the element content, wherein the element content is used to indicate the location of the LSE.

[0203] In an optional embodiment, when the target information includes information about a network action in a label stack of the MPLS packet, the processing module 114 includes:

[0204] A first determining unit is configured to determine a carrying mode of the network action in the label stack of the MPLS packet when the target element information is used to indicate type information of the network action carried in the label stack of the MPLS packet;

[0205] a second determining unit configured to, when determining that the network action is indicated and carried by a specific label, scan the MPLS packet and, when a first label value is scanned, determine type information of the network action corresponding to the first label value, wherein the specific label includes at least one of the following: an MPLS special label SPL, and an MPLS extended special label eSPL;

[0206] The third determination unit is configured to scan the MPLS message when it is determined that the network action is indicated by the target field in the MPLS message, and when a second label value for identifying the beginning of the target field is scanned, continue to read the target field in the MPLS message backward, and determine the type information of the network action carried in the target field.

[0207] In an optional embodiment, the third determining unit includes:

[0208] a reading subunit, configured to read the set bit in a case where the target type information carried in the target field is used to identify that the network action is carried in the LSE in a bit-set indication manner to obtain type information of the network action;

[0209] The acquiring subunit is configured to acquire the type information of the network action directly indicated by the target type information when the target type information carried in the target field is used to identify the type information of the network action directly indicated by the target type information.

[0210] In an optional embodiment, the processing module 114 further includes:

[0211] The fourth determination unit is configured to scan the MPLS message from the top of the label stack when the target element information also includes first element information for indicating the offset of the unit of the network action carried in the MPLS message label stack, and determine the length from the top of the label stack to the starting position of the unit scanned for carrying the network action as the offset of the unit of the network action carried in the MPLS message label stack.

[0212] In an optional embodiment, the processing module 114 further includes:

[0213] The fifth determination unit is configured to determine the byte length of the unit of the network action carried in the MPLS message label stack according to a pre-configured length corresponding to the second element information when the target element information also includes second element information for indicating the byte length of the unit of the network action carried in the MPLS message label stack.

[0214] In an optional embodiment, when the target information includes information about the network action following the label stack of the MPLS packet, the processing module 114 includes:

[0215] a sixth determining unit, configured to determine a carrying mode of the network action after the label stack of the MPLS packet when the target element information is used to indicate the type information of the network action carried after the label stack of the MPLS packet;

[0216] a seventh determining unit configured to, when determining that the network action is carried in a post-stack data header, obtain type information of the network action by parsing the network action type code carried in the post-stack data header;

[0217] The eighth determination unit is configured to scan the MPLS message label stack when it is determined that the network action is carried in a non-stacked data header manner, and when a third label value carried in the MPLS message label stack is scanned, determine the type information of the network action corresponding to the third label value.

[0218] In an optional embodiment, the processing module 114 further includes:

[0219] The ninth determination unit is configured to scan the MPLS message label stack to determine whether there is indication information corresponding to the network action carried after the MPLS message label stack in the MPLS message label stack; and, if it is determined that there is indication information, trigger the execution of the network action of scanning the part after the MPLS message label stack.

[0220] In an optional embodiment, the processing module 114 further includes:

[0221] The tenth determination unit is configured to scan the MPLS message when the target element information also includes third element information for indicating the offset of the unit of the network action carried after the MPLS message label stack, and determine the length from the bottom of the label of the MPLS message to the starting position of the unit for carrying the network action after scanning the MPLS message label stack as the offset of the unit of the network action carried after the MPLS message label stack.

[0222] In an optional embodiment, the processing module 114 further includes:

[0223] The eleventh determination unit is configured to determine the byte length of the unit of the network action carried after the MPLS message label stack according to a pre-configured length corresponding to the fourth element information when the target element information also includes the fourth element information for indicating the byte length of the unit of the network action carried after the MPLS message label stack.

[0224] In an optional embodiment, when the target information includes information about a carrying unit of a network action in a label stack of the MPLS packet, the processing module 114 includes:

[0225] A first scanning unit is configured to scan the label stack of the MPLS packet when the target element information is used to indicate information of a carrying unit of a network action in the label stack of the MPLS packet;

[0226] a twelfth determining unit configured to, when a fourth label value indicating a specific label is scanned, determine a position after the fourth label value as a first starting position of a unit carrying a network action in the label stack of the MPLS packet, wherein the specific label is used to indicate carrying the network action;

[0227] The first extraction unit is configured to extract the content of the carrying unit of the network action in the label stack of the MPLS message starting from the first starting position.

[0228] In an optional embodiment, when the target information includes information of a carrying unit of the network action following the label stack of the MPLS packet, the processing module 114 includes:

[0229] A second scanning unit is configured to scan the label stack of the MPLS message when the target element information is used to indicate information of a carrying unit of a network action after the label stack of the MPLS message;

[0230] a thirteenth determining unit, configured to determine, based on the scanning result, a starting position and a byte length of a carrying unit of a network action following the label stack of the MPLS message;

[0231] The second extraction unit is configured to obtain the carrying unit of the network action after the label stack of the MPLS message according to the starting position and byte length of the carrying unit of the network action after the label stack of the MPLS message.

[0232] In an optional embodiment, the processing module 114 further includes:

[0233] The third scanning unit is configured to scan the label stack of the MPLS message, and when a predetermined character of the carrying unit for indicating the network action of searching for the label stack of the MPLS message is scanned, it triggers the action of scanning the label stack of the MPLS message.

[0234] In an optional embodiment, when the target information includes information about a network action in any position in the MPLS message, the processing module 114 includes:

[0235] a fourteenth determining unit, configured to determine a carrying mode of the network action in the MPLS message when the target element information is used to indicate information of the network action in any position in the MPLS message;

[0236] The third extraction unit is configured to extract information about the network action in the MPLS message based on a carrying manner of the network action in the MPLS message.

[0237] In an optional embodiment, the third extraction unit includes at least one of the following:

[0238] A first extraction subunit is configured to, when the network action is indicated and carried by a specific label in the label stack of the MPLS message, scan the label stack to find a fifth label value indicating the network action, and when the fifth label value is found, extract information about the network action after the fifth label value, wherein the specific label includes at least one of the following: an MPLS special label SPL, an MPLS extended special label eSPL;

[0239] The second extraction subunit is configured to, when the network action is indicated by a destination field in the label stack of the MPLS packet, scan the label stack to search for a sixth label value indicating the destination field, and when the sixth label value is found, search for information about the network action in the destination field indicated by the sixth label value;

[0240] a third extraction subunit, configured to, when the network action is carried in a non-post-stack data header after the label stack of the MPLS packet, scan the label stack to search for a seventh label value indicating the network action, and, when the seventh label value is found, extract information about the network action from the bottom of the stack;

[0241] The fourth extraction subunit is configured to, when the network action is carried in the form of a post-stack data header after the label stack of the MPLS message, scan the label stack for the post-stack data header with an indication in the stack, and look for an indicator of the post-stack data header; when the indicator is found, look for information about the network action at the post-stack data header after the stack according to the type code; and when the post-stack data header is not indicated in the stack, directly look for information about the network action at the post-stack data header after the stack.

[0242] In an optional embodiment, the device further includes a reporting module configured to report the target information after acquiring the target information.

[0243] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0244] An embodiment of the present disclosure further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.

[0245] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0246] An embodiment of the present disclosure further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0247] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0248] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.

[0249] Obviously, those skilled in the art should understand that the modules or steps of the present disclosure described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present disclosure is not limited to any particular combination of hardware and software.

[0250] The foregoing description is merely a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Those skilled in the art will readily appreciate that various modifications and variations of the present disclosure are possible. Any modifications, equivalent substitutions, or improvements made within the principles of the present disclosure shall be included within the scope of protection of the present disclosure.

Claims

1. A method for obtaining message information, comprising: Acquire a target template pre-configured on an IP flow information output IPFIX device, wherein the target template carries target element information for acquiring target information in a multi-protocol label switching MPLS message; The MPLS message is processed based on the target element information to obtain the target information.

2. The method according to claim 1, wherein: The target information includes at least one of the following: One or more label stack entries LSE in the label stack of the MPLS message; Information about a network action in the label stack of the MPLS message, wherein the network action is used to indicate a network instruction for processing the MPLS message, and the information about the network action includes type information of the network action; Information about the network action after the label stack of the MPLS message, wherein the network action is used to indicate a network instruction for processing the MPLS message, and the information about the network action includes type information of the network action; Information about a carrying unit of a network action in the label stack of the MPLS message, wherein the network action is used to indicate a network instruction for processing the MPLS message; Information of a carrying unit of a network action after the label stack of the MPLS message, wherein the network action is used to indicate a network instruction for processing the MPLS message; Information about a network action in any position in the MPLS message, wherein the network action is used to indicate a network instruction for processing the MPLS message.

3. The method according to claim 2, wherein: In a case where the target information includes one or more label stack entries LSE in a label stack of the MPLS packet, processing the MPLS packet based on the target element information to obtain the target information includes: In the case where the target element information is used to indicate the first element name of one or more LSEs in the label stack of the MPLS message that needs to be collected, one or more LSEs in the label stack of the MPLS message corresponding to the first element name are obtained according to the pre-configured correspondence between the element name and the element content, wherein the element content is used to indicate the location of the LSE.

4. The method according to claim 2, wherein: In a case where the target information includes information about a network action in a label stack of the MPLS message, processing the MPLS message based on the target element information, and acquiring the target information includes: In a case where the target element information is used to indicate type information of the network action carried in the label stack of the MPLS message, determining a carrying manner of the network action in the label stack of the MPLS message; When it is determined that the network action is indicated by a specific label, the MPLS message is scanned, and when a first label value is scanned, type information of the network action corresponding to the first label value is determined, wherein the specific label includes at least one of the following: an MPLS special label SPL, an MPLS extended special label eSPL; In the case where it is determined that the network action is indicated by the target field in the MPLS message, The MPLS message is scanned, and when a second label value for identifying the start of the target field is scanned, the target field in the MPLS message is continued to be read backward, and the type information of the network action carried in the target field is determined.

5. The method according to claim 4, wherein: Determining the type information of the network action carried in the target field includes: The target type information carried in the target field is used to identify that, in the case where the LSE carries the network action in a bit setting indication mode, the set bit is read to obtain the type information of the network action; In a case where the target type information carried in the target field is used to identify that the target type information directly indicates type information of the network action, the type information of the network action directly indicated by the target type information is acquired.

6. The method according to claim 4, wherein: The method further comprises: In a case where the target element information also includes first element information for indicating the offset of the unit of the network action carried in the MPLS message label stack, the MPLS message is scanned starting from the top of the label stack, and the length from the top of the label stack to the starting position of the unit for carrying the network action is determined as the offset of the unit of the network action carried in the MPLS message label stack.

7. The method according to claim 4, wherein: The method further comprises: When the target element information also includes second element information for indicating the byte length of the unit of the network action carried in the MPLS message label stack, the byte length of the unit of the network action carried in the MPLS message label stack is determined according to a pre-configured length corresponding to the second element information.

8. The method according to claim 2, wherein: In a case where the target information includes information of a network action after a label stack of the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: In a case where the target element information is used to indicate type information of the network action carried after the label stack of the MPLS message, determining a carrying mode of the network action after the label stack of the MPLS message; When it is determined that the network action is carried in a post-stack data header, obtaining type information of the network action by parsing the network action type code carried in the post-stack data header; When it is determined that the network action is carried in a non-post-stack data header manner, the MPLS message label stack is scanned, and when a third label value carried in the MPLS message label stack is scanned, type information of the network action corresponding to the third label value is determined.

9. The method according to claim 8, wherein: The method further comprises: Scanning the MPLS message label stack to determine whether there is indication information corresponding to the network action carried after the MPLS message label stack in the MPLS message label stack; If it is determined that the label exists, a network action of performing a portion after scanning the label stack of the MPLS message is triggered.

10. The method according to claim 8, wherein: The method further comprises: In a case where the target element information also includes third element information for indicating the offset of a unit of the network action carried after the MPLS message label stack, the MPLS message is scanned, and the length from the bottom of the label of the MPLS message to the starting position of the unit for carrying the network action after scanning the MPLS message label stack is determined as the offset of the unit of the network action carried after the MPLS message label stack.

11. The method according to claim 8, wherein: The method further comprises: When the target element information also includes fourth element information for indicating the byte length of the unit of the network action carried after the MPLS message label stack, the byte length of the unit of the network action carried after the MPLS message label stack is determined according to the pre-configured length corresponding to the fourth element information.

12. The method according to claim 2, wherein: In a case where the target information includes information of a carrying unit of a network action in a label stack of the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: In a case where the target element information is used to indicate information of a carrying unit of a network action in a label stack of the MPLS message, scanning the label stack of the MPLS message; In the case where a fourth label value indicating a specific label is scanned, determining a position after the fourth label value as a first starting position of a carrying unit of a network action in a label stack of the MPLS message, wherein the specific label is used to indicate carrying the network action; Starting from the first starting position, content in a carrying unit of a network action in the label stack of the MPLS message is extracted.

13. The method according to claim 2, wherein: In a case where the target information includes information of a carrying unit of a network action after a label stack of the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: In a case where the target element information is used to indicate information of a carrying unit of a network action after the label stack of the MPLS message, scanning after the label stack of the MPLS message; Determine the starting position and byte length of the carrying unit of the network action after the label stack of the MPLS message based on the scanning result; The network action carrying unit after the label stack of the MPLS message is acquired according to the starting position and byte length of the network action carrying unit after the label stack of the MPLS message.

14. The method according to claim 13, wherein: The method further comprises: Scanning the label stack of the MPLS message; When a predetermined character of a carrying unit for indicating a network action of searching for a label stack behind the MPLS message is scanned, an action of scanning the label stack behind the MPLS message is triggered.

15. The method according to claim 2, wherein: In a case where the target information includes information of a network action in any position in the MPLS message, the MPLS message is processed based on the target element information, and obtaining the target information includes: In a case where the target element information is used to indicate information of a network action in any position in the MPLS message, determining a manner of carrying the network action in the MPLS message; Based on the carrying manner of the network action in the MPLS message, information of the network action in the MPLS message is extracted.

16. The method according to claim 15, wherein: Based on the carrying manner of the network action in the MPLS message, extracting the information of the network action in the MPLS message includes at least one of the following: In the case where the network action is indicated and carried by a specific label in the label stack of the MPLS message, the label stack is scanned to find a fifth label value indicating the network action, and in the case where the fifth label value is found, information about the network action is extracted after the fifth label value, wherein the specific label includes at least one of the following: an MPLS special label SPL, an MPLS extended special label eSPL; When the network action is indicated and carried by a target field in the MPLS message in the label stack of the MPLS message, scanning the label stack to find a sixth label value indicating the target field, and when the sixth label value is found, searching for information of the network action in the target field indicated by the sixth label value; In the case where the network action is carried in a non-post-stack data header after the label stack of the MPLS message, scanning the label stack to find a seventh label value indicating the network action, and in the case where the seventh label value is found, extracting information about the network action from the bottom of the stack; In the case where the network action is carried in the form of a post-stack data header after the label stack of the MPLS message, for the post-stack data header indicated in the stack, scan the label stack to find the indicator of the post-stack data header. When the indicator is found, search for the information of the network action at the post-stack data header after the stack according to the type code; for the post-stack data header not indicated in the stack, search directly for the information of the network action at the post-stack data header after the stack.

17. The method according to any one of claims 1 to 16, wherein: After acquiring the target information, the method further includes: Report the target information.

18. A device for acquiring message information, comprising: An acquisition module is configured to acquire a target template pre-configured on an IP flow information output IPFIX device, wherein the target template carries target element information for acquiring target information in a multi-protocol label switching MPLS message; The processing module is configured to process the MPLS message based on the target element information to obtain the target information.

19. A computer-readable storage medium having a computer program stored therein, wherein: When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 17 are implemented.

20. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 17 when executing the computer program.

Citation Information

Patent Citations

  • Method and apparatus for reporting network packet-losing message

    CN102204164A

  • Message screening device and method in IPFIX output device

    CN103916289A

  • Congestion information feedback method and apparatus, and gateway

    CN104521197A

  • Slice information determination method and device, storage medium and electronic device

    CN115484183A

  • Method and network device for tagging network traffic flows

    US20200366578A1