A FC abnormal scenario reproduction method based on message content analysis and storage medium

By saving and replaying interactive messages from FC switches in the FC network environment and dynamically replacing FCID and exchange ID, the problem of the inability to reproduce abnormal communication scenarios in the FC network is solved, and intelligent playback of FC frames and abnormal scene reproduction are realized.

CN119743449BActive Publication Date: 2025-06-06TIANJIN BINHAI NEW AREA INFORMATION TECH INNOVATION CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510239189.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-06-06
Estimated Expiration
2045-03-03

AI Technical Summary

Technical Problem

In the FC network environment, abnormal communication scenarios cannot be reproduced by directly playing back the messages saved by history. This is mainly because FC communication requires the FC device login message command identification interaction process first, and the exchange ID dynamic allocation cannot be predicted and specified.

Method used

By saving interactive messages between the FC switch and the side card or the side FC switch, generate message saving files and playback these files. The packet is parsed, the FC device login message command identifier or FC response message command identifier is constructed, the FCID allocation and acquisition is completed, and the FCID and FC source exchange ID fields in the target FC message frame header are dynamically replaced according to the FC source exchange ID of the exchange initiator, and the request frame and response frame are constructed to realize intelligent playback of FC frames.

Benefits of technology

It realizes the reproduction of abnormal communication scenarios without restarting the communication process in the FC network environment, and solves the reproduction difficulties caused by dynamic allocation of FCID and exchange IDs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743449B_ABST
    Figure CN119743449B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and storage medium for reproducing FC abnormal scenes based on message content analysis, comprising: saving interactive messages between an FC switch and an end-side card or an opposite-end FC switch, generating a message saving file; replaying the message saving file and initializing a to-be-replayed FC frame linked list; parsing the message saving file, constructing an FC device login message command identifier or an FC response message command identifier to complete FCID allocation and acquisition, dynamically replacing the FCID and FC source exchange ID fields in a target FC message frame header according to an FC source exchange ID of an exchange initiator to construct a request frame and a response frame, and adding the replaced FC message to the to-be-replayed FC frame linked list; sequentially processing the nodes of the to-be-replayed FC frame linked list, replaying the FC historical communication scenes, and facilitating the reproduction of the FC historical communication abnormal scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of FC networks, and in particular to a method and a storage medium for reproducing FC abnormal scenarios based on message content analysis. Background Art

[0002] In a complex network device environment, when users need to save the frame content of the interaction between two devices, they usually use the Linux system tool tcpdump to achieve it. If there is an exception in the interaction process, you can use a message parsing tool such as wireshark to view it. By analyzing the protocol keywords (such as IP address and port number), you can locate the device where the exception occurred and the cause of the exception. When the cause of the communication exception may be related to the historical message interaction, you need to restart the communication process to reproduce the abnormal scenario.

[0003] In a real network environment, it may not be easy to reproduce abnormal scenarios by restarting the communication process. In an Ethernet network environment, you can modify the IP address, MAC and other specified fields of the captured Ethernet message through the tcpreplay tool without restarting the communication process to replay it, thus reproducing the abnormal communication scenario.

[0004] The tcpreplay tool can achieve many functions in an Ethernet network environment, but it is not applicable in a FC network environment. In a FC network environment, although users can use tcpdump and wireshark tools to save and view FC communication packets, they cannot reproduce abnormal communication scenarios by directly replaying historically saved packets due to the following two reasons:

[0005] 1. FC communication needs to complete the FC device login message command identifier interaction process first. After F Port successfully allocates FCID to N Port, N Port can use the FCID to interact with F Port. The FCID allocated by F Port may be inconsistent with the FCID allocated in the previous communication process and cannot be predicted. Therefore, it cannot be directly specified before the message playback;

[0006] 2. FC frame interaction is based on exchange. The exchange IDs of the request frame and the response frame must match to achieve normal interaction. The exchange ID is dynamically allocated by the exchange initiator during the communication process and cannot be predicted. Therefore, it cannot be directly specified before the message is played back. Summary of the invention

[0007] To achieve the above-mentioned purpose and other related purposes, the present invention discloses a method for reproducing FC abnormal scenarios based on message content analysis, comprising:

[0008] S1: Saves the interactive messages between the FC switch and the end-side card or the opposite FC switch, and generates a message saving file;

[0009] S2: Playback message save file and initialize the FC frame list to be played back;

[0010] S3: Parse the message storage file, construct an FC device login message command identifier or an FC response message command identifier to complete FCID allocation and acquisition, dynamically replace the FCID and FC source exchange ID fields in the target FC message frame header according to the FC source exchange ID of the exchange initiator to construct a request frame and a response frame, and add the replaced FC message to the FC frame list to be replayed;

[0011] S4: Process the nodes of the linked list of FC frames to be played back in sequence.

[0012] Furthermore, the step S3 includes:

[0013] S301: parse the FC frame header in the current message to determine whether the local end is an F Port. If yes, jump to S302; otherwise, jump to S303;

[0014] S302: Determine whether the beginning of the FC source communication device ID in the FC frame header is a preset character, if yes, jump to S304, otherwise jump to S306;

[0015] S303: Determine whether the beginning of the FC destination communication device ID in the FC frame header is a preset character, if yes, jump to S304, otherwise jump to S305;

[0016] S304: Parse the F_CTL field in the FC frame header to determine whether the local end is the switching initiator. If yes, directly insert the frame into the pending list and jump to S308; otherwise, directly jump to S308;

[0017] S305: Determine whether the frame is an FC response message command identifier for the FC device login message command identifier. If yes, obtain the FCID assigned by the peer end from the FC response message command identifier and record it, and jump to S306; otherwise, directly jump to S306;

[0018] S306: Parse the F_CTL field in the FC frame header to determine whether the local end is the exchange responder. If yes, jump to S307; otherwise, jump to S308.

[0019] S307: Parse the payload part in the current message, obtain the corresponding command word, mark it as to be received, and construct a sub-linked list node. According to the FC destination communication device ID and FC source switch ID in the frame header, search for the response message corresponding to the message in the message storage file, and insert the response message into the sub-linked list node;

[0020] S308: If all the messages in the message storage file have been parsed, jump to S4; otherwise, jump to S301.

[0021] Further, the sequentially processing the nodes of the linked list of FC frames to be played back includes:

[0022] S401: Process the current node of the FC frame linked list to be played back. If the current node can be sent directly, directly send the FC frame pointed to by the current node to the other end, and jump to step S403;

[0023] S402: cyclically wait for the peer end to send an FC frame with a specific command word. If an FC frame marked as to be received is received, the corresponding response frame is obtained from the sub-linked list corresponding to the node, and the FC destination communication device ID and FC source exchange ID fields in the original response frame are replaced according to the FC source communication device ID and FC source exchange ID in the received FC frame header. After recalculating CRC, the modified response is sent to the peer end.

[0024] S403: If the processing of the linked list of FC frames to be replayed is completed, the processing ends; otherwise, the process jumps to S308.

[0025] Furthermore, the preset characters are: characters starting with FF.

[0026] Furthermore, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the above method when executed by a processor.

[0027] By adopting the above technical solution, by saving the interactive frame content between the communication devices at both ends of the FC as a message save file, and replaying the message save file, the FC device login message command identifier or the FC response message command identifier is constructed to complete the FCID allocation and acquisition, and the FCID, FC source exchange ID and other fields in the target FC message frame header are dynamically replaced according to the FC source exchange ID of the exchange initiator to construct the request frame and response frame. By simulating the F Port or N Port behavior, the intelligent playback of the FC frame is realized, and the purpose of reproducing the abnormal communication scenario is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, among which:

[0029] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0031] Reference Figure 1 The embodiment of the present invention provides a method for reproducing an FC abnormal scenario based on message content analysis, comprising the following steps:

[0032] S1: Saves the interactive messages between the FC switch and the end-side card or the peer FC switch, and generates a message saving file.

[0033] As described above, in this embodiment, the interactive messages between the FC switch and the end-side card or the opposite FC switch are saved by executing the tcpdump command, and the message saving file is fc.dump, and the file format of the message saving file is pcap.

[0034] S2: Playback the message to save the file and initialize the FC frame list to be played back.

[0035] As mentioned above, when replaying the message saved file, use the fcreplay command to replay the message saved file on a machine that can execute FC simulation communication.

[0036] S3: Parse the message saving file, construct an FC device login message command identifier or an FC response message command identifier to complete FCID allocation and acquisition, dynamically replace the FCID and FC source exchange ID fields in the target FC message frame header according to the FC source exchange ID of the exchange initiator to construct a request frame and a response frame, and add the replaced FC message to the FC frame linked list to be replayed.

[0037] The above S3 includes:

[0038] S301: parse the FC frame header in the current message to determine whether the local end is an F Port. If yes, jump to S302; otherwise, jump to S303.

[0039] As mentioned above, in FC communication, F Port and N Port are two different types of ports, and their roles and functions in the network are different:

[0040] Among them, F Port (Fabric Port) is a port connected to the FC switch (Fabric Switch). It is used to connect the links between FC switches or connect to devices that support F Port services. F Port is responsible for managing the logical topology of the FC network, including the routing and forwarding of frames. In the Fibre Channel network, F Port is responsible for allocating FCID (FabricID), which is a unique identifier used to identify devices in the network. F Port is also responsible for processing frame switching and flow control.

[0041] N Port (Node Port) is a port connected to a node device in a FC network, such as a storage array, server, or disk drive. It is used to connect to a single node device, not a switch. N Port is not responsible for frame routing and forwarding, but communicates directly with F Port. N Port uses FCID to interact with F Port during communication. This FCID is assigned by F Port during the FC device login message command identification (Fabric Login) process. N Port is responsible for handling data transmission and protocol processing related to node devices.

[0042] S302: Determine whether the beginning of the FC source communication device ID in the FC frame header is a preset character, if yes, jump to S304, otherwise jump to S306.

[0043] S303: Determine whether the beginning of the FC destination communication device ID in the FC frame header is a preset character, if yes, jump to S304, otherwise jump to S305.

[0044] In the above, the FC source communication device ID is SID, the FC destination communication device ID is DID, and the preset characters are characters starting with FF. When the SID or DID starts with FF, it is a special field in FC communication.

[0045] S304: Parse the F_CTL field in the FC frame header to determine whether the local end is the switching initiator. If so, directly insert the frame into the to-be-processed linked list and jump to S308; otherwise, directly jump to S308.

[0046] S305: Determine whether the frame is an FC response message command identifier for the FC device login message command identifier. If yes, obtain the FCID allocated by the other end from the FC response message command identifier and record it, and jump to S306; otherwise, jump directly to S306.

[0047] S306: Parse the F_CTL field in the FC frame header to determine whether the local end is the exchange responder. If yes, jump to S307; otherwise, jump to S308.

[0048] S307: Parse the payload part in the current message, obtain the corresponding command word, mark it as to be received, and construct a sub-linked list node. According to the FC destination communication device ID and FC source exchange ID in the frame header, search for the response message corresponding to the message in the message storage file, and insert the response message into the sub-linked list node.

[0049] S308: If all the messages in the message storage file have been parsed, jump to S4; otherwise, jump to S301.

[0050] S4: Process the nodes of the linked list of FC frames to be played back in sequence.

[0051] Specifically, S4 includes:

[0052] S401: Process the current node of the linked list of FC frames to be played back. If the current node can be sent directly, directly send the FC frame pointed to by the current node to the other end, and jump to step S403.

[0053] S402: Wait in a loop for the peer end to send an FC frame with a specific command word. If an FC frame marked as to be received is received, obtain the corresponding response frame from the sub-linked list corresponding to the node, and replace the FC destination communication device ID and FC source exchange ID fields in the original response frame according to the FC source communication device ID and FC source exchange ID in the received FC frame header. After recalculating CRC, send the modified response to the peer end.

[0054] S403: If the processing of the linked list of FC frames to be replayed is completed, the processing ends; otherwise, the process jumps to S308.

[0055] By adopting the above technical solution, the interactive frame content between the communication devices at both ends of the FC is saved as an ordinary pcap file by using the tcpdump tool, and the file is parsed by the fcreplay command similar to tcpreplay, and the FC device login message command identifier or FC response message command identifier is constructed to complete the FCID allocation and acquisition. The FCID, FC source exchange ID and other fields in the target FC message frame header are dynamically replaced according to the FC source exchange ID of the exchange initiator to construct the request frame and response frame. By simulating the F Port or N Port behavior, the FC frame intelligent playback is realized to achieve the purpose of reproducing the abnormal communication scenario.

[0056] Those skilled in the art will appreciate that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined.

[0057] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0058] It can be known from the description of the above implementation modes that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute the methods described in the various implementation modes of the present application or certain parts of the implementation modes.

[0059] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for reproducing FC abnormal scenarios based on message content analysis, characterized in that: include: S1: Saves the interactive messages between the FC switch and the end-side card or the opposite FC switch, and generates a message saving file; S2: Playback message save file and initialize the FC frame list to be played back; S3: Parse the message storage file, construct an FC device login message command identifier or an FC response message command identifier to complete FCID allocation and acquisition, dynamically replace the FCID and FC source exchange ID fields in the target FC message frame header according to the FC source exchange ID of the exchange initiator to construct a request frame and a response frame, and add the replaced FC message to the FC frame list to be replayed; The step S3 comprises: S301: parse the FC frame header in the current message to determine whether the local end is an F Port. If yes, jump to S302; otherwise, jump to S303; S302: Determine whether the beginning of the FC source communication device ID in the FC frame header is a preset character, if yes, jump to S304, otherwise jump to S306; S303: Determine whether the beginning of the FC destination communication device ID in the FC frame header is a preset character, if yes, jump to S304, otherwise jump to S305; S304: Parse the F_CTL field in the FC frame header to determine whether the local end is the switching initiator. If yes, directly insert the frame into the pending list and jump to S308; otherwise, directly jump to S308; S305: Determine whether the frame is an FC response message command identifier for the FC device login message command identifier. If yes, obtain the FCID assigned by the peer end from the FC response message command identifier and record it, and jump to S306; otherwise, directly jump to S306; S306: Parse the F_CTL field in the FC frame header to determine whether the local end is the exchange responder. If yes, jump to S307; otherwise, jump to S308. S307: Parse the payload part in the current message, obtain the corresponding command word, mark it as to be received, and construct a sub-linked list node. According to the FC destination communication device ID and FC source switch ID in the frame header, search for the response message corresponding to the message in the message storage file, and insert the response message into the sub-linked list node; S308: If all messages in the message storage file are parsed, jump to S4, otherwise jump to S301; S4: Process the nodes of the linked list of FC frames to be played back in sequence.

2. The method according to claim 1, characterized in that The sequentially processing of the nodes of the linked list of FC frames to be played back includes: S401: Process the current node of the FC frame linked list to be played back. If the current node can be sent directly, directly send the FC frame pointed to by the current node to the other end, and jump to step S403; S402: Waiting in a loop for the peer end to send an FC frame of the command word. If an FC frame marked as to be received is received, the corresponding response frame is obtained from the sub-linked list corresponding to the node, and the FC destination communication device ID and FC source exchange ID fields in the original response frame are replaced according to the FC source communication device ID and FC source exchange ID in the received FC frame header. After recalculating CRC, the modified response is sent to the peer end. S403: If the processing of the linked list of FC frames to be replayed is completed, the processing ends; otherwise, the process jumps to S308.

3. The method according to claim 1, characterized in that The preset characters are: characters starting with FF.

4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • N-port proxy method, N-port proxy device and network equipment

    CN102883235A

  • Network intercommunication method and network intercommunication equipment

    CN105471692A