Message data conversion method and device, storage medium and electronic device
By analyzing and converting the reference stack head in the stacking system to obtain target exchange information, the problem of low packet data transmission efficiency between switching devices of different manufacturers is solved, and more efficient data transmission is achieved.
Patent Information
- Application Number
- CN202510684842.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-08-12
AI Technical Summary
In a stacking system, due to the differences in stacking protocols between switching devices of different manufacturers, the packet data transmission efficiency is low.
By looking for reference stacking headers in reference messages, the target conversion information is parsed to obtain target exchange information, and forwarding messages in the stacking system based on the target exchange information, realizing protocol conversion between switching devices of different manufacturers.
Improve the efficiency of packet data transmission between switching devices of different manufacturers in the stacking system.
Smart Images

Figure CN120475080A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a method and device for converting message data, a storage medium, and an electronic device. Background Art
[0002] Stacking refers to combining more than one switching device to provide as many ports as possible within a limited space. Multiple switching devices are stacked to form a stack system. Packets need to be transmitted between the switch chips deployed on the switching devices in the stack system. To meet this requirement, the switch chips on the switching devices must add stacking headers to the packets to indicate the packet forwarding status within the stack system. In some scenarios, customers want to build a stack system based on existing devices. However, these devices may come from different vendors, and the stacking protocols of the switch chips may differ. As a result, the switch chips cannot recognize the stacking headers carried in packets sent by switch chips using different stacking protocols and are unable to forward the packet data. This results in low packet data transmission efficiency between switching devices from different vendors in the stack system. Summary of the Invention
[0003] The embodiments of the present application provide a method and device for converting message data, a storage medium, and an electronic device to at least solve the problem of low message data transmission efficiency between switching devices of different manufacturers in a stacking system in the related art.
[0004] According to one embodiment of the present application, a method for converting message data is provided. A stacking system includes multiple switching devices in a stacking relationship with each other. The method is applied to a target switching chip deployed on a target switching device among the multiple switching devices. The method includes:
[0005] Searching for a reference stack header carried in a reference message, wherein the reference stack header is used to indicate a forwarding mode of the reference message in the stacking system, and the reference message is a message sent by other switching devices among the multiple switching devices except the target switching device;
[0006] When it is determined that the stacking protocol used by the reference stacking head is inconsistent with the stacking protocol used by the target switching device, parsing the reference stacking head according to the target conversion information to obtain target switching information, wherein the target conversion information records a conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device;
[0007] The reference message is forwarded according to the message switching mode indicated by the target switching information in the stacking system.
[0008] Optionally, parsing the reference stack header according to the target conversion information to obtain the target exchange information includes:
[0009] Extracting a reference field carried by the reference stack header from the reference stack header, wherein the reference field is a field indicating a message forwarding mode carried by the reference stack header;
[0010] The reference field is parsed according to the target conversion information to obtain the target exchange information.
[0011] Optionally, parsing the reference field according to the target conversion information to obtain the target exchange information includes:
[0012] Determining a field editing operation to be performed on the reference field according to the field editing information, wherein the target conversion information includes the field editing information, and the field editing information is used to indicate a field conversion mode of the reference field in a stacking protocol format of a target switching device;
[0013] The field editing operation is performed on the reference field to obtain a target field in a stacking protocol format of the target switching device, wherein the target switching information includes the target field.
[0014] Optionally, extracting the reference field carried by the reference stack header from the reference stack header includes:
[0015] Searching for field location information corresponding to a reference stacking protocol format of the reference switching device from a target cache space of the target switching device, wherein the field location information is used to indicate a distribution manner of the reference field in a stacking header under the reference stacking protocol format;
[0016] The reference field is extracted from the reference stack header according to the field distribution manner indicated by the field position information.
[0017] Optionally, the forwarding the reference message according to the message switching mode indicated by the target switching information in the stacking system includes:
[0018] Finding a candidate switching device in the stacking system to receive the reference message from target path information, wherein the target path information is used to indicate a transmission path of the reference message in the stacking system, and the target switching information includes the target path information;
[0019] Performing protocol conversion on the reference message according to the candidate stacking protocol of the candidate switching device to obtain a candidate message;
[0020] The candidate message is sent to the candidate switching device according to the message sending mode indicated by the target switching information.
[0021] Optionally, performing protocol conversion on the reference message according to the candidate stacking protocol of the candidate switching device to obtain the candidate message includes:
[0022] Searching for candidate conversion information corresponding to the candidate stacking protocol and the target stacking protocol of the target switching device from a target cache space of the target switching device, wherein the candidate conversion information is used to indicate a conversion relationship between the target stacking protocol and the candidate stacking protocol, and the target cache space is used to store conversion information between the target switching device and other switching devices;
[0023] The reference message is format-converted according to the candidate conversion information to obtain the candidate message.
[0024] Optionally, the performing format conversion on the reference message according to the candidate conversion information to obtain the candidate message includes:
[0025] extracting an initial field to be edited from the reference stack header;
[0026] Editing the initial field according to the field editing method indicated by the candidate conversion information to obtain a candidate field;
[0027] The candidate field is updated to a corresponding field position in a reference stack header of the reference message to obtain the candidate message.
[0028] According to another embodiment of the present application, a device for converting message data is provided, including:
[0029] A search module, configured to search for a reference stack header carried in a reference message, wherein the reference stack header is used to indicate a forwarding mode of the reference message in the stacking system, and the reference message is a message sent by other switching devices among the multiple switching devices except the target switching device;
[0030] a parsing module configured to, when determining that the stacking protocol used by the reference stacking head is inconsistent with the stacking protocol used by the target switching device, parse the reference stacking head according to target conversion information to obtain target switching information, wherein the target conversion information records a conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device;
[0031] The forwarding module is configured to forward the reference message according to a message switching mode in the stacking system indicated by the target switching information.
[0032] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned message data conversion method when running.
[0033] According to another aspect of an embodiment of the present application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the message data conversion method through the computer program.
[0034] In an embodiment of the present application, by searching for a reference stack header carried in a message sent by a switching device other than a target switching device among multiple switching devices, and determining that the stacking protocol used by the reference stack header is inconsistent with the stacking protocol used by the target switching device, the reference stack header is parsed based on the conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device to obtain target switching information, and then the reference message is forwarded based on the switching method of the message in the stacking system indicated by the target switching information. The above technical solution solves the problem of low message data transmission efficiency between switching devices of different manufacturers in a stacking system in the related art, and achieves the technical effect of improving message data transmission efficiency between switching devices of different manufacturers in the stacking system. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0037] Figure 1 This is a schematic diagram of the hardware environment of a method for converting message data according to an embodiment of the present application;
[0038] Figure 2 This is a flow chart of a method for converting message data according to an embodiment of the present application;
[0039] Figure 3 is a schematic diagram of a stacking head editing range according to an embodiment of the present application;
[0040] Figure 4 is a schematic diagram of a stacking header editing behavior according to an embodiment of the present application;
[0041] Figure 5 It is a structural block diagram of a message data conversion device according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0043] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0044] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal, a device terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 Schematic diagram of the hardware environment of a method for converting message data according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal may also include Figure 1 More or fewer components than shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 Shown are different configurations with more functionality.
[0045] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for sending message push in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 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 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal 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.
[0046] The transmission device 106 is used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by a computer terminal's communications provider. In one embodiment, the transmission device 106 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 another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0047] In this embodiment, a method for converting message data is provided, which is applied to the above-mentioned computer terminal. Figure 2 1 is a flow chart of a method for converting message data according to an embodiment of the present application, the process comprising the following steps:
[0048] Step S202: searching for a reference stack header carried in a reference message, wherein the reference stack header is used to indicate a forwarding mode of the reference message in the stacking system, and the reference message is a message sent by a switching device other than the target switching device among the multiple switching devices;
[0049] Step S204: If it is determined that the stacking protocol used by the reference stacking head is inconsistent with the stacking protocol used by the target switching device, the reference stacking head is parsed according to the target conversion information to obtain target switching information, wherein the target conversion information records the conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device;
[0050] Step S206: Forward the reference message according to the message switching mode indicated by the target switching information in the stacking system.
[0051] Through the above steps, by searching for a reference stack header carried in messages sent by multiple switching devices other than the target switching device, and when it is determined that the stacking protocol used by the reference stack header is inconsistent with the stacking protocol used by the target switching device, the reference stack header is parsed according to the conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device to obtain target switching information, and then the reference message is forwarded according to the message switching method indicated by the target switching information in the stacking system. The above technical solution solves the problem of low message data transmission efficiency between switching devices of different manufacturers in a stacking system in the related art, and achieves the technical effect of improving message data transmission efficiency between switching devices of different manufacturers in the stacking system.
[0052] In the technical solution provided in the above step S202, the reference stack header carries forwarding information indicating how the reference message is forwarded in the stacking system. The reference stack header may include but is not limited to information such as message type, chip ID, chip type, message priority, congestion status, etc. Based on the reference stack header, default forwarding, port redirection, sending to CPU, editing and other operations may be performed but are not limited to. This solution does not limit this.
[0053] Optionally, in an embodiment of the present application, searching for the reference stack header carried in the reference message may be by extracting message header information from the reference message, detecting whether there is a stack header identification field in the message header according to a predefined stack header format, and determining that the stack identification field is a reference stack header when it is detected that the message header contains a specific stack header identification field (such as a stack protocol type or a flag bit).
[0054] In the technical solution provided in the above step S204, when it is detected that the stacking header format carried in the reference message does not match the stacking protocol of the target switching device, the reference stacking header will be parsed according to the target conversion information. The target conversion information records the mapping relationship and conversion rules between the fields of different stacking protocols. Based on the target conversion information, the target switching device can accurately convert the extracted reference field into a format that can be parsed by the target switching device. The conversion method may include but is not limited to data type conversion, encoding format adjustment, and rearrangement of field positions.
[0055] Optionally, in an embodiment of the present application, the target conversion information may include, but is not limited to, a preconfigured stack header protocol mapping table, which records the field correspondence and conversion rules between different stack protocols. By looking up the mapping table, the system can identify the meaning of each field in the reference stack header and convert these fields into a format that can be recognized by the target switching device. After successfully parsing the reference stack header, the target switching information will be obtained. The target switching information is used to indicate the message forwarding information compatible with the stack protocol of the target switching device. The target switching information may include, but is not limited to, mapped and adjusted stack header fields, such as forwarding information, message type, chip ID, priority, and congestion status, so that the target switching device can correctly forward the reference message based on the target switching information.
[0056] Optionally, in an embodiment of the present application, a target memory for storing conversion information can be configured for the target switching chip on the target switching device. The target memory is used to store conversion information that records the conversion relationship between the stacking protocols of the target switching device and other switching devices. Then, when the target switching device receives the reference message, it can filter out the target conversion information containing the key field from the multiple conversion information stored in the target memory based on the key field in the reference stacking header. The key field is a field carried in the reference stacking header that represents the stacking protocol used when editing the reference stacking header.
[0057] In the technical solution provided in the above step S206, after obtaining the target switching information, the target switching device can forward the reference message according to the message forwarding mode in the stacking system indicated by the target switching information.
[0058] Optionally, in an embodiment of the present application, when the target switching device is preparing to forward a message to the next-hop device, it will first detect the stacking protocol adopted by the device, which can be done by sending a detection message and obtaining the stacking protocol information of the next-hop device from the response. If the target switching device detects that the stacking protocol of the next-hop device is different from its own, the target switching device will convert the stacking header in the message to be forwarded of the current target switching device into a format that can be recognized by the next-hop device according to the pre-stored protocol conversion rules. For example, the fields contained in the stacking header in the current message to be forwarded are converted into fields corresponding to the stacking protocol of the next-hop device.
[0059] As an optional embodiment, parsing the reference stack header according to the target conversion information to obtain the target exchange information includes:
[0060] Extracting a reference field carried by the reference stack header from the reference stack header, wherein the reference field is a field indicating a message forwarding mode carried by the reference stack header;
[0061] The reference field is parsed according to the target conversion information to obtain the target exchange information.
[0062] Optionally, in an embodiment of the present application, the reference field is used to indicate the forwarding method of the reference message in the stacking system. The reference field may include but is not limited to forwarding information, message type, chip ID, chip type, message priority, congestion status, etc.
[0063] Optionally, in an embodiment of the present application, the field format indicating the message forwarding method carried in the stacking header using different stacking protocols is different. Therefore, the reference field must be parsed according to the conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device, and the extracted reference field must be accurately converted into a format that can be parsed by the target switching device, and the meaning of each reference field in the reference stacking header is obtained to obtain the target switching information.
[0064] Optionally, in an embodiment of the present application, ACL rules corresponding to various stacking protocols are pre-configured on the target switching device, and these rules include matching conditions and action information for the message, such as the offset and length information of the reference field in the stacking header. When the target switching device receives a reference message with a reference stacking header, it finds the offset and length information of each reference field in the reference message by matching the ACL rules, thereby locating and extracting these fields, and then parses and converts the extracted reference fields according to the stacking protocol requirements of the target switching device, such as re-encoding the field content, adjusting the relationship between fields, or mapping fields to device-specific instructions. Through the target conversion information, the target switching device can generate message forwarding control information suitable for the target switching device according to its own protocol requirements, that is, target switching information.
[0065] As an optional embodiment, parsing the reference field according to the target conversion information to obtain the target exchange information includes:
[0066] Determining a field editing operation to be performed on the reference field according to the field editing information, wherein the target conversion information includes the field editing information, and the field editing information is used to indicate a field conversion mode of the reference field in a stacking protocol format of a target switching device;
[0067] The field editing operation is performed on the reference field to obtain a target field in a stacking protocol format of the target switching device, wherein the target switching information includes the target field.
[0068] Optionally, in an embodiment of the present application, the field editing information is used to indicate the field mapping rules and conversion methods of the reference field under the stacking protocol format of the target switching device. The field editing operation may include, but is not limited to, field position offset, field length adjustment, field content replacement, field encoding conversion and other operations. After determining the field editing operation indicated by the field editing information, the determined field editing operation is performed on the reference field to convert the field into a target field under the stacking protocol format of the target device. The specific operation methods may be: data bit operation (such as shift, AND operation, or operation), content replacement (replacing the original field content according to the specific value in the editing information), field length adjustment (expanding or compressing the field size to meet the requirements of the target protocol), encoding conversion (converting the field encoding from the format of the source protocol to the format of the target protocol), etc., which are not limited in this solution.
[0069] As an optional embodiment, extracting the reference field carried by the reference stack header from the reference stack header includes:
[0070] Searching for field location information corresponding to a reference stacking protocol format of the reference switching device from a target cache space of the target switching device, wherein the field location information is used to indicate a distribution manner of the reference field in a stacking header under the reference stacking protocol format;
[0071] The reference field is extracted from the reference stack header according to the field distribution manner indicated by the field position information.
[0072] Optionally, in an embodiment of the present application, a matching rule base is preconfigured in the target cache space of the target switching device. The matching rule base contains field location information corresponding to all recognizable stacking protocols, that is, the specific location and distribution of reference fields in the stack header under different stacking protocol formats. The target cache space can be, but is not limited to, a TCAM memory. The TCAM memory is capable of high-speed content addressing for rapid search and location of fields. Each rule corresponds to a specific stacking protocol format. By matching the stack header features of the message, a matching rule can be quickly found, thereby obtaining the distribution information of the reference fields under the stacking protocol.
[0073] Optionally, in an embodiment of the present application, when the target switching device receives a reference message and parses the reference stack header, it searches the TCAM memory for rules that match the reference stack protocol format, and then obtains the field position information of the reference field in the reference stack header, and accurately extracts the corresponding reference field from the reference stack header according to the field distribution indicated by the field position information.
[0074] As an optional embodiment, forwarding the reference message according to the message switching mode indicated by the target switching information in the stacking system includes:
[0075] Finding a candidate switching device in the stacking system to receive the reference message from target path information, wherein the target path information is used to indicate a transmission path of the reference message in the stacking system, and the target switching information includes the target path information;
[0076] Performing protocol conversion on the reference message according to the candidate stacking protocol of the candidate switching device to obtain a candidate message;
[0077] The candidate message is sent to the candidate switching device according to the message sending mode indicated by the target switching information.
[0078] Optionally, in an embodiment of the present application, the target path information is used to indicate the transmission path of the reference message in the stacking system. The target path information may include, but is not limited to, source destination information, stacking system topology, next device information, etc.
[0079] Optionally, in an embodiment of the present application, before forwarding a message to a candidate switching device, the target switching device will first detect the stacking header protocol used by the candidate switching device. When the stacking protocol used by the candidate switching device is inconsistent with the stacking protocol used by the target switching device, the reference message is subjected to protocol conversion according to the requirements of the candidate stacking protocol to obtain a candidate message. The specific conversion method can be to convert the field format in the stacking header in the reference message into a format that conforms to the stacking protocol of the candidate switching device, or to re-encode the control information carried in the reference message to ensure that the candidate switching device can accurately understand and perform corresponding operations. Finally, the converted candidate message is sent to the candidate switching device according to the message sending method indicated by the target switching information.
[0080] As an optional embodiment, performing protocol conversion on the reference message according to the candidate stacking protocol of the candidate switching device to obtain the candidate message includes:
[0081] Searching for candidate conversion information corresponding to the candidate stacking protocol and the target stacking protocol of the target switching device from a target cache space of the target switching device, wherein the candidate conversion information is used to indicate a conversion relationship between the target stacking protocol and the candidate stacking protocol, and the target cache space is used to store conversion information between the target switching device and other switching devices;
[0082] The reference message is format-converted according to the candidate conversion information to obtain the candidate message. Optionally, in an embodiment of the present application, the target cache space (e.g., TCAM memory) of the target switching device pre-stores the conversion relationship between different stacking protocols, and the conversion information includes field mapping, encoding conversion, and protocol-specific control command conversion rules, etc. After the target switching device determines the next-hop candidate switching device, it retrieves the candidate conversion information corresponding to the candidate stacking protocol and the target stacking protocol from the target cache space, and then performs format conversion on the reference message according to the candidate conversion information to ensure that it meets the protocol requirements of the candidate switching device. The conversion process may include, but is not limited to, reordering, content replacement, encoding adjustment, and other operations on the reference fields in the reference stack header of the reference message to obtain a candidate message that meets the format of the candidate stacking protocol.
[0083] As an optional embodiment, converting the format of the reference message according to the candidate conversion information to obtain the candidate message includes:
[0084] extracting an initial field to be edited from the reference stack header;
[0085] Editing the initial field according to the field editing method indicated by the candidate conversion information to obtain a candidate field;
[0086] The candidate field is updated to a corresponding field position in a reference stack header of the reference message to obtain the candidate message.
[0087] Optionally, in an embodiment of the present application, after receiving the reference message, the target switching device first parses the reference stack header information in the message, and based on the field position index provided in the candidate conversion information, accurately identifies and extracts the initial field to be edited. The target switching device then edits the extracted initial field according to the field editing rules indicated in the candidate conversion information. The editing operation may include, but is not limited to, replacement of field content, adjustment of encoding format, adaptation of field length, etc. For example, if the target stacking protocol uses a specific field encoding, and the candidate protocol requires a different encoding method, the system will automatically perform encoding conversion to ensure that the converted candidate field content meets the requirements of the candidate stacking protocol. After completing the field editing, the target switching device reinserts the candidate field into the reference stacking header, overwriting the original initial field position to generate the final candidate message.
[0088] In order to better understand the above process, the above process is described below in conjunction with optional embodiments, but it is not used to limit the technical solutions of the embodiments of the present application.
[0089] As an optional embodiment, the present application also provides a chip implementation solution for flexible editing of stacking heads. This solution proposes a chip-based stacking head matching and editing solution based on a full understanding of the stacking services of different manufacturers, which solves the problem of implementing editing functions of different types of stacking heads on mesh chips with only forwarding requirements, thereby enabling user-defined editing of stacking heads at the lowest cost and realizing stacking interoperability of switches from different manufacturers.
[0090] The basic idea of this method is as follows:
[0091] When parsing the stack header, the switch chip processes it based on whether it is from the same manufacturer. Switch chips from the same manufacturer use the default private protocol processing. Switch chips from different manufacturers are configured based on different business needs based on a full understanding of the protocol. The specific implementation method is as follows:
[0092] 1. Use ACL to search for stack headers:
[0093] ACL uses TCAM to ensure efficient search, avoiding the efficiency issues of SRAM-based software search methods. ACL can search and match the stacking header information, message information, and chip information analyzed by the parser.
[0094] 2. Editing behavior:
[0095] Figure 3 Schematic diagram of a stacking head editing range according to an embodiment of the present application, such as Figure 3 As shown in the figure, this design uses ACL to match flow information and specifies the starting position and editing content of the stack header. The stack header is edited with 8B as the granularity, and users can customize the 8B / 16B editing mode.
[0096] The editing behavior is similar to the ACL search, and also uses a mask to confirm that a certain part of the Stacking header is concerned. Figure 4 is a schematic diagram of a stack header editing behavior according to an embodiment of the present application, such as Figure 4 The edited behavior will only take effect on the masked part. Details are as follows:
[0097] 1. ACL edit behavior, data (ie Figure 4 The original message data in the ) represents the original message content, mask (i.e., the mask in 4) represents the field that the user wants to care about, edit (i.e. Figure 4 The edit code in ) indicates that the user edits the content, such as Figure 4 As shown, the user edits the fields that the user is concerned about.
[0098] 2. Chip implementation: The chip performs an OR operation on the original information and the editing results in order to edit only the fields that the user cares about.
[0099] 3. The chip replaces the stack header information with the final edit behavior generated in step 2 by using the offset + data (original message data) method.
[0100] This design improves the original method of sending packets to the CPU for processing via SRAM software to a search through ACL-Tcam and hardware-supported editing. This allows user-defined editing of stacking headers at minimal cost, enabling interoperability between switches from different manufacturers and providing a feasible solution for domestic chip replacement. Editing the stacking header is achieved by specifying the data, mask, and offset values of the corresponding fields in the ACL action. This method improves processing efficiency compared to traditional CPU processing, requiring only a small number of packets to be sent to the CPU for processing, significantly reducing the CPU burden. Furthermore, this method is not limited to specific chip manufacturers and has strong compatibility, reducing the difficulty of networking between different chip manufacturers.
[0101] 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 and the necessary general hardware platform. 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 application, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes 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 of each embodiment of the present application.
[0102] Figure 5 is a structural block diagram of a message data conversion device according to an embodiment of the present application; Figure 5 Shown, including:
[0103] A search module 502 is configured to search for a reference stack header carried in a reference message, wherein the reference stack header is used to indicate a forwarding mode of the reference message in the stacking system, and the reference message is a message sent by a switching device other than the target switching device among the multiple switching devices;
[0104] a parsing module 504 configured to, when it is determined that the stacking protocol used by the reference stacking header is inconsistent with the stacking protocol used by the target switching device, parse the reference stacking header according to the target conversion information to obtain target switching information, wherein the target conversion information records a conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device;
[0105] The forwarding module 506 is configured to forward the reference message according to the message switching mode in the stacking system indicated by the target switching information.
[0106] Through the above embodiment, by searching for a reference stack header carried in a message sent by a switching device other than the target switching device among multiple switching devices, and determining that the stacking protocol used by the reference stack header is inconsistent with the stacking protocol used by the target switching device, the reference stack header is parsed according to the conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device to obtain target switching information, and then the reference message is forwarded according to the switching method of the message in the stacking system indicated by the target switching information. The above technical solution solves the problem of low message data transmission efficiency between switching devices of different manufacturers in a stacking system in the related art, and achieves the technical effect of improving message data transmission efficiency between switching devices of different manufacturers in the stacking system.
[0107] Optionally, the parsing module includes:
[0108] an extraction unit, configured to extract a reference field carried by the reference stacking header from the reference stacking header, wherein the reference field is a field indicating a message forwarding mode carried in the reference stacking header;
[0109] A parsing unit is configured to parse the reference field according to the target conversion information to obtain the target exchange information.
[0110] Optionally, the parsing unit is further configured to:
[0111] Determining a field editing operation to be performed on the reference field according to the field editing information, wherein the target conversion information includes the field editing information, and the field editing information is used to indicate a field conversion mode of the reference field in a stacking protocol format of a target switching device;
[0112] The field editing operation is performed on the reference field to obtain a target field in a stacking protocol format of the target switching device, wherein the target switching information includes the target field.
[0113] Optionally, the parsing unit is further configured to:
[0114] Searching for field location information corresponding to a reference stacking protocol format of the reference switching device from a target cache space of the target switching device, wherein the field location information is used to indicate a distribution manner of the reference field in a stacking header under the reference stacking protocol format;
[0115] The reference field is extracted from the reference stack header according to the field distribution manner indicated by the field position information.
[0116] Optionally, the forwarding module includes:
[0117] a search unit, configured to search for a candidate switching device in the stacking system to receive the reference message from target path information, wherein the target path information is used to indicate a transmission path of the reference message in the stacking system, and the target switching information includes the target path information;
[0118] a conversion unit, configured to perform protocol conversion on the reference message according to a candidate stacking protocol of the candidate switching device to obtain a candidate message;
[0119] A sending unit is configured to send the candidate message to the candidate switching device according to the message sending mode indicated by the target switching information.
[0120] Optionally, the conversion unit is further configured to:
[0121] Searching for candidate conversion information corresponding to the candidate stacking protocol and the target stacking protocol of the target switching device from a target cache space of the target switching device, wherein the candidate conversion information is used to indicate a conversion relationship between the target stacking protocol and the candidate stacking protocol, and the target cache space is used to store conversion information between the target switching device and other switching devices;
[0122] The reference message is format-converted according to the candidate conversion information to obtain the candidate message.
[0123] Optionally, the conversion unit is further configured to:
[0124] extracting an initial field to be edited from the reference stack header;
[0125] Editing the initial field according to the field editing method indicated by the candidate conversion information to obtain a candidate field;
[0126] The candidate field is updated to a corresponding field position in a reference stack header of the reference message to obtain the candidate message.
[0127] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein when the program is run, any of the above-mentioned message data conversion methods is executed.
[0128] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0129] S1, searching for a reference stack header carried in a reference message, wherein the reference stack header is used to indicate a forwarding mode of the reference message in the stacking system, and the reference message is a message sent by other switching devices among the multiple switching devices except the target switching device;
[0130] S2, when it is determined that the stacking protocol used by the reference stacking head is inconsistent with the stacking protocol used by the target switching device, parsing the reference stacking head according to the target conversion information to obtain target switching information, wherein the target conversion information records the conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device;
[0131] S3: Forward the reference message according to the message switching mode indicated by the target switching information in the stacking system.
[0132] An embodiment of the present application further provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned message data conversion method embodiments.
[0133] Optionally, 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.
[0134] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0135] S1, searching for a reference stack header carried in a reference message, wherein the reference stack header is used to indicate a forwarding mode of the reference message in the stacking system, and the reference message is a message sent by other switching devices among the multiple switching devices except the target switching device;
[0136] S2, when it is determined that the stacking protocol used by the reference stacking head is inconsistent with the stacking protocol used by the target switching device, parsing the reference stacking head according to the target conversion information to obtain target switching information, wherein the target conversion information records the conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device;
[0137] S3: Forward the reference message according to the message switching mode indicated by the target switching information in the stacking system.
[0138] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: 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, and other media that can store program codes.
[0139] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0140] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. Alternatively, they can be implemented using program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than herein, or they can be made into separate integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0141] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for converting message data, characterized in that: The stacking system includes multiple switching devices in a stacking relationship with each other. The method is applied to a target switching chip deployed on a target switching device among the multiple switching devices. The method includes: Searching for a reference stack header carried in a reference message, wherein the reference stack header is used to indicate a forwarding mode of the reference message in the stacking system, and the reference message is a message sent by other switching devices among the multiple switching devices except the target switching device; When it is determined that the stacking protocol used by the reference stacking head is inconsistent with the stacking protocol used by the target switching device, parsing the reference stacking head according to the target conversion information to obtain target switching information, wherein the target conversion information records a conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device; The reference message is forwarded according to the message switching mode indicated by the target switching information in the stacking system.
2. The method according to claim 1, characterized in that The step of parsing the reference stack header according to the target conversion information to obtain target exchange information includes: Extracting a reference field carried by the reference stack header from the reference stack header, wherein the reference field is a field indicating a message forwarding mode carried by the reference stack header; The reference field is parsed according to the target conversion information to obtain the target exchange information.
3. The method according to claim 2, characterized in that The step of parsing the reference field according to the target conversion information to obtain the target exchange information includes: Determining a field editing operation to be performed on the reference field according to the field editing information, wherein the target conversion information includes the field editing information, and the field editing information is used to indicate a field conversion mode of the reference field in a stacking protocol format of a target switching device; The field editing operation is performed on the reference field to obtain a target field in a stacking protocol format of the target switching device, wherein the target switching information includes the target field.
4. The method according to claim 3, characterized in that The extracting, from the reference stack header, the reference field carried by the reference stack header includes: Searching for field location information corresponding to a reference stacking protocol format of the reference switching device from a target cache space of the target switching device, wherein the field location information is used to indicate a distribution manner of the reference field in a stacking header under the reference stacking protocol format; The reference field is extracted from the reference stack header according to the field distribution manner indicated by the field position information.
5. The method according to claim 1, wherein The forwarding of the reference message according to the message switching mode indicated by the target switching information in the stacking system includes: Finding a candidate switching device in the stacking system to receive the reference message from target path information, wherein the target path information is used to indicate a transmission path of the reference message in the stacking system, and the target switching information includes the target path information; Performing protocol conversion on the reference message according to the candidate stacking protocol of the candidate switching device to obtain a candidate message; The candidate message is sent to the candidate switching device according to the message sending mode indicated by the target switching information.
6. The method according to claim 5, characterized in that The performing protocol conversion on the reference message according to the candidate stacking protocol of the candidate switching device to obtain the candidate message includes: Searching for candidate conversion information corresponding to the candidate stacking protocol and the target stacking protocol of the target switching device from a target cache space of the target switching device, wherein the candidate conversion information is used to indicate a conversion relationship between the target stacking protocol and the candidate stacking protocol, and the target cache space is used to store conversion information between the target switching device and other switching devices; The reference message is format-converted according to the candidate conversion information to obtain the candidate message.
7. The method according to claim 6, characterized in that The converting the format of the reference message according to the candidate conversion information to obtain the candidate message includes: extracting an initial field to be edited from the reference stack header; Editing the initial field according to the field editing method indicated by the candidate conversion information to obtain a candidate field; The candidate field is updated to a corresponding field position in a reference stack header of the reference message to obtain the candidate message.
8. A message data conversion device, characterized in that: include: A search module, configured to search for a reference stack header carried in a reference message, wherein the reference stack header is used to indicate a forwarding mode of the reference message in the stacking system, and the reference message is a message sent by other switching devices among the multiple switching devices except the target switching device; a parsing module configured to, when determining that the stacking protocol used by the reference stacking head is inconsistent with the stacking protocol used by the target switching device, parse the reference stacking head according to target conversion information to obtain target switching information, wherein the target conversion information records a conversion relationship between the stacking protocol of the target switching device and the stacking protocol of the reference switching device; The forwarding module is configured to forward the reference message according to a message switching mode in the stacking system indicated by the target switching information.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
Citation Information
Cited By
Compatibility testing method and device for different intergenerational switching chips, electronic equipment and computer readable medium
CN122293547A