Mimicry controller and communication method, device and medium of external equipment
By introducing a protocol proxy into the mimicry controller, establishing a communication connection, and hiding the characteristics of multiple controller actuators, a single data interaction between the mimicry controller and external devices is achieved, improving defense capabilities and the effectiveness of data interaction.
Patent Information
- Application Number
- CN202311264807.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-09-26
AI Technical Summary
The existing mimicry controllers lack effective data interaction with external devices and are vulnerable to attacks that could lead to network paralysis.
Introducing a protocol proxy into the mimicry controller establishes a communication connection through a listening port, determines the port address of the target external device, and establishes communication connections separately according to the different roles of the controller executors, thereby hiding the characteristics of multiple controller executors and realizing data interaction of a single controller instance.
It improves the active defense capability of the mimicry controller, reduces the effectiveness of unknown vulnerabilities and attacks, ensures the effectiveness of data interaction, and facilitates the effective implementation of mimicry solutions.
Smart Images

Figure CN117319477B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet communication technology, and in particular to a method, apparatus, device, and medium for communication between a mimicry controller and an external device. Background Technology
[0002] P4Runtime is a set of control plane specifications based on Protobuf (Protocol Buffer, a cross-language, cross-platform, and scalable method for serializing structured data) and gRPC (Google Remote Procedure Call, a remote procedure call framework developed by Google). It is used to control data plane entities of devices or programs defined by P4 programs. The P4Runtime protocol starts a gRPC server listening on the switch device, with the controller acting as a gRPC client connecting to the switch device. The P4Runtime protocol mainly includes the following message types: Write, Read, SetForwardingPipelineConfig, GetForwardingPipelineConfig, StreamChannel, and Capabilities request and response messages; among them, StreamChannel also includes the MasterArbitrationUpdate message type. The various message types of the P4Runtime protocol enable local or remote entities to load pipes / P4 programs, send / receive data packets, arbitrate master control, read and write forwarding table entries, counters, and other P4 entities. P4Runtime uses streaming channels for session management.
[0003] Traditional ONOS (Open Network Operating System) controllers generally lack firewalls, antivirus software, and other security measures against malicious attacks. Furthermore, they are riddled with potential vulnerabilities. Once an attacker gains control of the ONOS controller, they can launch large-scale man-in-the-middle attacks to steal or tamper with sensitive data, potentially causing widespread network outages. Mimicry devices offer a novel solution. The mimicry ONOS controller incorporates multiple heterogeneous and redundant controller executors in its architecture. Through policies or periodic scheduling of these executors, it exhibits unpredictable changes in characteristics. By adjudicating the flow table entries generated by each controller executor, a consensus flow table is generated. With this differentiated design, the probability of different controller executors having identical vulnerabilities or backdoors is extremely low. Even if an attacker gains control of some controller executors, the mimicry adjudication mechanism will identify their malicious behavior, significantly improving the mimicry device's ability to defend against network attacks.
[0004] In summary, how to establish a link between the mimicry controller and external devices to ensure the effectiveness of data interaction between the controllers in the mimicry controller and external devices, and to facilitate the effective implementation of mimicry schemes in network defense, is a problem that needs to be solved. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a communication method, apparatus, device, and medium between a mimic controller and an external device, which can establish a link between the mimic controller and the external device to ensure the effectiveness of data interaction between the controller actuators in the mimic controller and the external device, thus facilitating the effective implementation of mimicry schemes in network defense. The specific solution is as follows:
[0006] In a first aspect, this application discloses a communication method between a mimicry controller and an external device, applied to a protocol proxy in the mimicry controller, the method comprising:
[0007] The connection establishment request sent by the target controller executor in the mimicry controller is obtained through the target listening port, and a first communication connection is established with the target controller executor.
[0008] Determine the target external device port address that matches the target listening port;
[0009] If the target controller executor is the main controller executor, then a second communication connection is established with the target external device corresponding to the port address of the target external device, so as to realize the communication between the main controller executor and the target external device through the first communication connection and the second communication connection;
[0010] If the target controller executor is a slave controller executor, then determine whether the target external device corresponding to the target external device port address has established the second communication connection;
[0011] If yes, then the slave controller executor communicates with the target external device through the first communication connection and the second communication connection; if no, then a preset waiting operation is performed so that after the second communication connection is established, the slave controller executor communicates with the target external device through the first communication connection and the second communication connection.
[0012] Optionally, determining the target external device port address that matches the target listening port includes:
[0013] The target external device port address that matches the target listening port is determined from a pre-established mapping relationship configuration table; the mapping relationship configuration table stores the mapping relationship between listening port addresses and device port addresses.
[0014] Optionally, before obtaining the connection establishment request sent by the target controller executor in the mimicry controller through the target listening port, the method further includes:
[0015] Determine the server device port address configured in the connection establishment request by the target controller execution unit;
[0016] Determine the target listening port address that matches the server device port address from the mapping relationship configuration table;
[0017] In the target controller execution unit, the server device port address in the connection establishment request is converted to the target listening port address based on the network address translation mechanism, so as to obtain the connection establishment request through the target listening port corresponding to the target listening port address.
[0018] Optionally, after establishing a second communication connection with the target external device corresponding to the target external device port address, the method further includes:
[0019] Store the target external device port address as a key in a preset device connection list;
[0020] Accordingly, determining whether the target external device corresponding to the target external device port address has established the second communication connection includes:
[0021] Determine whether a keyword corresponding to the port address of the target external device exists in the device connection list;
[0022] If the connection exists, it is determined that the target external device corresponding to the target external device port address has established the second communication connection; if the connection does not exist, it is determined that the target external device corresponding to the target external device port address has not established the second communication connection.
[0023] Optionally, after the first communication connection and the second communication connection are established, the method further includes:
[0024] The request message sent by the target controller executor is obtained through the first communication connection;
[0025] Based on the message type of the request message, determine whether to send the request message to the target external device through the second communication connection, and determine the response message corresponding to the request message, so as to send the response message to the target controller execution unit.
[0026] Optionally, the protocol proxy is a P4Runtime protocol proxy.
[0027] Optionally, determining whether to send the request message to the target external device through the second communication connection based on the message type of the request message, and determining the response message corresponding to the request message, and sending the response message to the target controller execution unit, includes:
[0028] If the message type of the request message is a first preset type, then it is determined whether the target controller execution body is the master controller execution body; the first preset type is MasterArbitrationUpdate;
[0029] If the target controller executor is the main controller executor, then the request message is sent to the target external device through the second communication connection, and the response message returned by the target external device is stored in the first preset message cache list;
[0030] If the target controller executor is a slave controller executor, then the response message corresponding to the request message is obtained from the first preset message cache list, and the target field in the response message is updated using the feature information of the target controller executor, so as to send the updated response message to the target controller executor.
[0031] Optionally, determining whether to send the request message to the target external device through the second communication connection based on the message type of the request message, and determining the response message corresponding to the request message, and sending the response message to the target controller execution unit, includes:
[0032] If the message type of the request message is the second preset type, then all request messages of the controller execution body are sent to the exception arbitrator so that the target request message can be determined from all the request messages based on the arbitrator's decision; the second preset type is Write or SetForwardingPipelineConfig;
[0033] The target field in the target request message is updated using the characteristic information of the main controller execution body, and the updated target request message is sent to the target external device through the second communication connection, so as to modify the configuration information and forwarding table of the target external device using the target request message;
[0034] The response message returned by the target external device is obtained, and the response message is updated using the flow identifier corresponding to each controller execution body, so as to send the updated response message to each controller execution body.
[0035] Optionally, determining whether to send the request message to the target external device through the second communication connection based on the message type of the request message, and determining the response message corresponding to the request message, and sending the response message to the target controller execution unit, includes:
[0036] If the message type of the request message is a third preset type, then the response message corresponding to the request message is obtained from the second preset message cache list, and the response message is processed using the flow identifier corresponding to the target controller execution body, so as to send the processed response message to the target controller execution body; the third preset type is any one of GetForwardingPipelineConfig, Capabilities, and Read;
[0037] The second preset message cache list is used to store the response messages returned by the target external device after the P4Runtime protocol proxy periodically sends the third preset type of request message to the target external device at a preset time.
[0038] Optionally, the process of retrieving the response message corresponding to the request message from the second preset message cache list further includes:
[0039] If there is no response message corresponding to the request message in the second preset message cache list, the request message is updated using the current flow identifier of the P4Runtime protocol proxy, so as to send the updated request message to the target external device and obtain the response message returned by the target external device.
[0040] Secondly, this application discloses a communication device between a mimicry controller and an external device, used as a protocol proxy in the mimicry controller, the device comprising:
[0041] The first communication connection establishment module is used to obtain the connection establishment request sent by the target controller executor in the mimicry controller through the target listening port, and establish a first communication connection with the target controller executor.
[0042] A port address determination module is used to determine the port address of a target external device that matches the target listening port.
[0043] The second communication connection establishment module is used to establish a second communication connection with the target external device corresponding to the port address of the target external device if the target controller executor is the main controller executor, so as to realize the communication between the main controller executor and the target external device through the first communication connection and the second communication connection;
[0044] The communication connection confirmation module is used to determine whether the target external device corresponding to the target external device port address has established the second communication connection if the target controller executor is a slave controller executor.
[0045] The communication module is configured to, if yes, enable communication between the slave controller executor and the target external device through the first communication connection and the second communication connection; otherwise, execute a preset waiting operation to enable communication between the slave controller executor and the target external device through the first communication connection and the second communication connection after the second communication connection is established.
[0046] Thirdly, this application discloses an electronic device, including:
[0047] Memory, used to store computer programs;
[0048] A processor is used to execute the computer program to implement the steps of the aforementioned disclosed method for communicating between a mimicry controller and an external device.
[0049] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned disclosed method for communication between a mimicry controller and an external device.
[0050] As can be seen, the P4Runtime protocol proxy in the mimicry controller obtains the connection establishment request sent by the target controller executor in the mimicry controller through the target listening port, and establishes a first communication connection with the target controller executor; determines the target external device port address matching the target listening port; if the target controller executor is the master controller executor, then establishes a second communication connection with the target external device corresponding to the target external device port address, so as to realize communication between the master controller executor and the target external device through the first communication connection and the second communication connection; if the target controller executor is the slave controller executor, then determines whether the target external device corresponding to the target external device port address has established the second communication connection; if yes, then realize communication between the slave controller executor and the target external device through the first communication connection and the second communication connection; if no, then executes a preset waiting operation, so that after the second communication connection is established, the slave controller executor and the target external device can communicate through the first communication connection and the second communication connection.
[0051] Therefore, this application establishes a protocol proxy within the mimicry controller to facilitate connection establishment and subsequent data interaction between each controller executor within the mimicry controller and external devices. A connection establishment request is initiated by the target controller executor within the mimicry controller. Upon receiving this request, the protocol proxy establishes a first communication connection with the target controller executor. Further, the protocol proxy determines the target external device port address matching the target listening port. When the target controller executor is the master controller executor, it proactively establishes a second communication connection with the target external device corresponding to the target external device port address. Thus, communication between the master controller executor and the target external device can be achieved through the first and second communication connections. Furthermore, if the target controller executor is a slave controller executor, it first determines whether the target external device corresponding to the target external device port address has already established the aforementioned second communication connection. If so, communication between the slave controller executor and the target external device can be achieved through the first and second communication connections. If the second communication connection is not established, it is necessary to wait for the second communication connection to be established before communication between the slave controller executor and the target external device can be achieved through the first and second communication connections. In other words, in this application, the protocol proxy establishes a first communication connection with each controller executor in the mimicry controller. Only when the main controller executor initiates a connection establishment request does the protocol proxy establish a second communication connection with the external device. In this way, by setting up the protocol proxy, the multiple controller executors in the mimicry controller appear to the outside world as a single controller executor establishing a connection with the external device. That is, the external device can only discover one controller instance and establish a communication connection with it, thereby hiding the characteristic that there are multiple controller executors in the mimicry controller. This greatly reduces the effectiveness of reconnaissance or attack against unknown vulnerabilities, defects, trapdoors or backdoors of the mimicry controller node, improves the active defense capability of the mimicry controller, ensures the effectiveness of data interaction between each controller executor in the mimicry controller and the external device, and facilitates the effective implementation of mimicry schemes in network defense. Attached Figure Description
[0052] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0053] Figure 1 This is a flowchart of a communication method between a mimicry controller and an external device disclosed in this application;
[0054] Figure 2This is a schematic diagram of the structure of a mimicry ONOS controller disclosed in this application;
[0055] Figure 3 This is a schematic diagram of the system architecture of a P4 device, a P4Runtime protocol agent, and various controller executors disclosed in this application.
[0056] Figure 4 This application discloses a flowchart of a method for processing different types of request messages sent by a P4Runtime protocol proxy to various controller executors.
[0057] Figure 5 This is a flowchart of a specific communication method between a mimic controller and an external device disclosed in this application;
[0058] Figure 6 This is a schematic diagram of a port address mapping relationship disclosed in this application;
[0059] Figure 7 This application discloses a network topology diagram for an SDN network application using a P4Runtime protocol proxy.
[0060] Figure 8 This is a schematic diagram of the communication device between a mimicry controller and an external device disclosed in this application.
[0061] Figure 9 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0062] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0063] Currently, traditional ONOS controllers generally lack security measures such as firewalls and antivirus software to protect against malicious attacks, and they have numerous potential vulnerabilities. Once an attacker gains control of the ONOS controller device, they can launch large-scale man-in-the-middle attacks to steal or tamper with sensitive data, or even cause large-scale paralysis of the switch network. Mimicry devices offer a new solution. Mimicry ONOS controllers introduce multiple heterogeneous and redundant controller execution units into their architecture. Through policies or periodic scheduling of different controller execution units, they exhibit uncertain changes in characteristics. By adjudicating the flow table entries generated by each controller execution unit, a consensus flow table is generated. Under the premise of differentiated design, the probability of different controller execution units having the same vulnerabilities or backdoors is extremely low. Even if an attacker gains control of some controller execution units, the mimicry adjudication mechanism will identify their malicious behavior, greatly improving the mimicry device's ability to cope with network attacks. Therefore, this application discloses a communication method, apparatus, device, and medium between a mimicry controller and external devices, enabling the establishment of a link between the mimicry controller and external devices to ensure the effectiveness of data interaction between the controller execution units in the mimicry controller and external devices, facilitating the effective implementation of mimicry schemes in network defense.
[0064] See Figure 1 As shown in the figure, this application discloses a communication method between a mimicry controller and an external device, applied to a protocol proxy in the mimicry controller. The method includes:
[0065] Step S11: Obtain the connection establishment request sent by the target controller executor in the mimicry controller through the target listening port, and establish a first communication connection with the target controller executor.
[0066] In this embodiment, the mimicry controller is specifically a mimicry ONOS controller. The structure of the mimicry ONOS controller is as follows: Figure 2 As shown, the mimicry ONOS controller includes a scheduler, an exception adjudicator, an input / output protocol agent, and multiple controller executors. Each controller executor is a controller entity that supports the P4Runtime protocol; the number of controller executors is not limited in this embodiment. The scheduler is responsible for managing the online status of each controller executor. The exception adjudicator is connected to the input / output protocol agent and is used to read the configuration / forwarding table information issued by each controller from the agent, thereby determining whether there are any exceptions in the configuration / flow table issued by the controller executor.
[0067] In this embodiment, the protocol proxy set in the mimicry controller is specifically the P4Runtime protocol proxy. Figure 2Part of the input / output protocol proxy, it also connects and interacts with the scheduling manager and decision controller to establish connections between the controller executors in the mimicry controller and external devices, and to facilitate subsequent P4Runtime protocol data interaction via the P4Runtime protocol proxy. It should be noted that the controller executors in the mimicry controller consist of a master controller executor and multiple slave controller executors arranged in parallel. Each controller executor in the mimicry controller acts as a client of P4Runtime; external devices act as servers of P4Runtime; and the P4Runtime protocol proxy acts as both a client and a server of P4Runtime. Specifically, the external devices are P4 devices, such as P4 switches, which are programmable switches based on the P4 language architecture. The system architecture of the P4 devices, the P4Runtime protocol proxy, and the controller executors is as follows: Figure 3 As shown in the image.
[0068] When the P4Runtime protocol proxy acts as a server, a connection establishment request is initiated by the target controller executor in the mimic controller. Upon receiving this request, the target listening port of the P4Runtime protocol proxy establishes a first communication connection with the target controller executor. In a specific implementation, the target listening port is either a TCP (Transmission Control Protocol) listening port or a TLS (Transport Layer Security) listening port, and the first communication connection is specifically an HTTP / 2 (Hypertext Transfer Protocol 2.0) connection. That is, the target listening port receives connection establishment requests from multiple controller executors and establishes HTTP / 2 connections with them, maintaining the P4Runtime session relationship between the controller executor and the P4Runtime protocol proxy. It also processes and forwards P4Runtime request messages sent by the controller executor to the P4 switch via the P4Runtime channel through this HTTP / 2 connection.
[0069] Step S12: Determine the target external device port address that matches the target listening port.
[0070] In this embodiment, the P4Runtime protocol proxy needs to further determine the target external device port address that matches the target listening port. It can be understood that when the executor of the mimic controller acts as a client, multiple P4 switches can be configured as servers. In order to distinguish different servers and better manage the servers, the P4Runtime protocol proxy sets the listening port address and the target external device port address to a one-to-one correspondence. The target external device port address is the port address of the P4 switch.
[0071] Step S13: If the target controller executor is the main controller executor, then a second communication connection is established with the target external device corresponding to the port address of the target external device, so as to realize the communication between the main controller executor and the target external device through the first communication connection and the second communication connection.
[0072] In this embodiment, when the target controller executor is the main controller executor, the P4Runtime protocol proxy actively establishes a second communication connection with the target external device corresponding to the target external device's port address. This allows communication between the main controller executor and the target external device to be achieved through both the first and second communication connections. It should be noted that the aforementioned second communication connection is specifically an HTTP / 2 connection. That is, when the P4Runtime protocol proxy acts as a client and receives a connection establishment request from the main controller executor, it actively initiates a connection establishment request to establish an HTTP / 2 connection with the P4 switch, maintains the session information for the connection with the switch, and distributes the response message returned by the P4 switch to the controller executor that sent the request through this HTTP / 2 connection.
[0073] Furthermore, it should be noted that after establishing a second communication connection with the target external device corresponding to the target external device port address, the process further includes: storing the target external device port address as a key in a preset device connection list. That is, after the HTTP / 2 connection is successfully established, the connection needs to be stored in the preset device connection list using the P4 switch address and port as the key; specifically, this device connection list is the P4 switch connection list.
[0074] Step S14: If the target controller executor is a slave controller executor, then determine whether the target external device corresponding to the target external device port address has established the second communication connection.
[0075] In this embodiment, if the target controller executor is a slave controller executor, it is first determined whether the target external device corresponding to the target external device port address has established the second communication connection mentioned above. That is, before the slave controller executor sends the connection establishment request, whether the master controller executor has already sent the connection establishment request and completed the connection establishment between the P4Runtime protocol proxy and the target external device.
[0076] In a specific implementation, determining whether the target external device corresponding to the target external device port address has established the second communication connection includes: determining whether a keyword corresponding to the target external device port address exists in the device connection list; if it exists, then determining that the target external device corresponding to the target external device port address has established the second communication connection; if it does not exist, then determining that the target external device corresponding to the target external device port address has not established the second communication connection. That is, when determining whether the target external device corresponding to the target external device port address has established the second communication connection, the system searches the device connection list for a keyword corresponding to the target external device port address. If it exists, it indicates that the second communication connection has been established; otherwise, it has not been established.
[0077] Step S15: If yes, then the slave controller executor communicates with the target external device through the first communication connection and the second communication connection; if no, then a preset waiting operation is performed so that after the second communication connection is established, the slave controller executor communicates with the target external device through the first communication connection and the second communication connection.
[0078] In this embodiment, if the second communication connection has been established, communication between the controller executor and the target external device can be achieved through the first and second communication connections. If the second communication connection has not been established, it is necessary to wait for the second communication connection to be established before the first and second communication connections can be used to achieve communication between the controller executor and the target external device. That is, if an HTTP / 2 connection has been established between the P4Runtime protocol proxy and the target external device, messages sent from the controller executor to the target external device will be sent directly using this HTTP / 2 connection; if it has not been established, a waiting operation will be performed until the HTTP / 2 connection is successfully established. In other words, in this application, the P4Runtime protocol proxy establishes a corresponding first communication connection with each controller executor in the mimicry controller. Only when the main controller executor initiates a connection establishment request does the P4Runtime protocol proxy establish a second communication connection with the external device. In this way, by setting the P4Runtime protocol proxy, the multiple controller executors in the mimicry controller appear to the outside world as a single controller executor establishing a connection with the external device. That is, the external device can only discover one controller instance and establish a communication connection with it, thereby hiding the characteristic that there are multiple controller executors in the mimicry controller. This greatly reduces the effectiveness of reconnaissance or attack against unknown vulnerabilities, defects, trapdoors or backdoors of the mimicry controller node, improves the active defense capability of the mimicry controller, and facilitates the effective implementation of mimicry schemes in network defense.
[0079] Therefore, this application establishes a protocol proxy within the mimicry controller to facilitate connection establishment and subsequent data interaction between each controller executor within the mimicry controller and external devices. A connection establishment request is initiated by the target controller executor within the mimicry controller. Upon receiving this request, the target listening port of the P4Runtime protocol proxy establishes a first communication connection with the target controller executor. Further, the protocol proxy determines the target external device port address matching the target listening port. When the target controller executor is the master controller executor, it proactively establishes a second communication connection with the target external device corresponding to the target external device port address. Thus, communication between the master controller executor and the target external device can be achieved through the first and second communication connections. Furthermore, if the target controller executor is a slave controller executor, it first determines whether the target external device corresponding to the target external device port address has already established the aforementioned second communication connection. If so, communication between the slave controller executor and the target external device can be achieved through the first and second communication connections. If the second communication connection is not established, it is necessary to wait for the second communication connection to be established before communication between the slave controller executor and the target external device can be achieved through the first and second communication connections. In other words, in this application, the protocol proxy establishes a first communication connection with each controller executor in the mimicry controller. Only when the main controller executor initiates a connection establishment request does the protocol proxy establish a second communication connection with the external device. In this way, by setting up the protocol proxy, the multiple controller executors in the mimicry controller appear to the outside world as a single controller executor establishing a connection with the external device. That is, the external device can only discover one controller instance and establish a communication connection with it, thereby hiding the characteristic that there are multiple controller executors in the mimicry controller. This greatly reduces the effectiveness of reconnaissance or attack against unknown vulnerabilities, defects, trapdoors or backdoors of the mimicry controller node, improves the active defense capability of the mimicry controller, ensures the effectiveness of data interaction between each controller executor in the mimicry controller and the external device, and facilitates the effective implementation of mimicry schemes in network defense.
[0080] See Figure 4 As shown in the embodiments of this application, a method for processing different types of request messages sent by the P4Runtime protocol proxy to each controller executor is also disclosed. Therefore, after the first communication connection and the second communication connection are established, the method further includes:
[0081] Step S21: Obtain the request message sent by the target controller executor through the first communication connection.
[0082] In this embodiment, after the first communication connection and the second communication connection are established, the request message sent by the target controller executor is obtained through the first communication connection.
[0083] Step S22: Based on the message type of the request message, determine whether to send the request message to the target external device through the second communication connection, and determine the response message corresponding to the request message, so as to send the response message to the target controller execution unit.
[0084] In this embodiment, for P4Runtime protocol messages from each controller executor, it is determined whether to forward the P4Runtime protocol message to the target external device based on the message type of the request message, and a response message corresponding to the request message is determined so as to send the response message to the target controller executor.
[0085] In a first specific implementation, if the message type of the request message is a first preset type, then it is determined whether the target controller executor is a master controller executor; the first preset type is MasterArbitrationUpdate; if the target controller executor is a master controller executor, then the request message is sent to the target external device through the second communication connection, and the response message returned by the target external device is stored in the first preset message cache list; if the target controller executor is a slave controller executor, then the response message corresponding to the request message is obtained from the first preset message cache list, and the target field in the response message is updated using the feature information of the target controller executor, so as to send the updated response message to the target controller executor.
[0086] First, it should be noted that the mimic controller opens a bidirectional streaming channel to the P4Runtime server via StreamChannel messages for session management. When the controller execution body initiates the bidirectional streaming channel of StreamChannel, the P4Runtime protocol agent creates a bidirectional streaming channel with the P4 switch, completes the role arbitration request and response processing of StreamChannel messages, and the P4Runtime session is successfully established.
[0087] When the StreamChannel message type is MasterArbitrationUpdate, it is determined whether the target controller executor is the master controller executor. If the target controller executor is the master controller executor, the request message is sent to the target external device through the second communication connection, and the response message returned by the target external device is stored in the first preset message cache list. If the target controller executor is the slave controller executor, the response message corresponding to the request message is obtained from the first preset message cache list, and the target field in the response message is updated using the characteristic information of the target controller executor, so as to send the updated response message to the target controller executor.
[0088] In other words, when the message type is MasterArbitrationUpdate, only the request message from the master controller executor is sent to the P4 switch to arbitrate master control. After the P4 switch returns the master control arbitration response message to the P4Runtime protocol agent, the P4Runtime protocol agent caches its role in the first preset message cache list. When the slave controller executor initiates a MasterArbitrationUpdate request, the previously cached response message is reassembled, mainly by replacing the `election_id` field in the request message. That is, the characteristic information of the `election_id` field in the request message is used to update the `election_id` field in the response message, and the updated response message is returned to the slave controller executor that sent the request. It is important to note that for messages of the first preset type, the P4Runtime protocol agent only sends the request message sent by the master controller executor to the target external device, and then obtains the response message returned by the target external device. Therefore, if the slave controller executor sends a message of the first preset type before the master controller executor, the corresponding response message will not exist in the first preset message cache list. In this case, the slave controller executor's request is invalid. Only after the master controller sends the first preset type message will the slave controller executor's request message be valid, meaning it can obtain a response message. It should be noted that the `election_id` field generated by different controller executors is inconsistent. The P4Runtime protocol proxy can pre-cache the `election_id` information of each executor to facilitate the replacement of the `election_id` field in subsequent messages, such as `Write` messages.
[0089] In the second specific implementation, if the message type of the request message is a second preset type, then all request messages of the controller executors are sent to the exception arbitrator so that the target request message can be determined from all the request messages based on the arbitrator's decision; the second preset type is Write or SetForwardingPipelineConfig; the target field in the target request message is updated using the feature information of the main controller executor, and the updated target request message is sent to the target external device through the second communication connection so that the configuration information and forwarding table of the target external device can be modified using the target request message; the response message returned by the target external device is obtained, and the response message is updated using the flow identifier corresponding to each controller executor so that the updated response message is sent to each controller executor.
[0090] In other words, for request messages of type Write or SetForwardingPipelineConfig, the request messages of each controller execution body are sent to the exception arbitrator for adjudication to determine the correct result. The P4Runtime protocol proxy then repackages the correct target request message, for example, replacing the `election_id` field of the Write type message with the `election_id` of the main execution body, and sends the updated target request message to the P4 switch, thereby modifying the P4 switch configuration and forwarding table information. The P4Runtime protocol proxy receives the response message from the P4 switch and updates the response message using the stream identifier (i.e., stream ID) corresponding to each controller execution body, and then sends the updated response message to each controller execution body.
[0091] In the third specific implementation, if the message type of the request message is a third preset type, then the response message corresponding to the request message is obtained from the second preset message cache list, and the response message is processed using the flow identifier corresponding to the target controller execution body, so as to send the processed response message to the target controller execution body; the third preset type is any one of GetForwardingPipelineConfig, Capabilities, and Read; wherein, the second preset message cache list is used to store the response message returned by the target external device after the P4Runtime protocol proxy periodically sends the request message of the third preset type to the target external device at a preset time.
[0092] In other words, for request messages of type GetForwardingPipelineConfig, Capabilities, or Read, the P4Runtime protocol proxy retrieves the corresponding response message from the second preset message cache list, reassembles the response message by setting the stream ID to the stream ID sent by the target controller executor, and then sends the processed response message to the target controller executor. It should be noted that the P4Runtime protocol proxy periodically sends GetForwardingPipelineConfig / Capabilities / Read request messages to the target external device at preset time intervals, and stores the corresponding response messages returned by the target external device in the second preset message cache list. This facilitates different executors sending the same request information to retrieve data from the second preset message cache list, reducing the interaction between the P4Runtime protocol proxy and external devices.
[0093] Furthermore, the process of obtaining the response message corresponding to the request message from the second preset message cache list also includes: if there is no response message corresponding to the request message in the second preset message cache list, then the request message is updated using the current flow identifier of the P4Runtime protocol proxy, so as to send the updated request message to the target external device and obtain the response message returned by the target external device. Understandably, if the second preset message cache list does not contain a response message corresponding to the request message, the P4Runtime protocol proxy re-encapsulates the request message and sends it to the P4 switch. At the same time, it stores the request message, the stream ID of the controller executor, the controller executor information corresponding to the request message, and the stream ID of the protocol proxy's sent message as information in the second preset message cache list. When the target external device returns a response message, the response message stream ID is parsed, and the controller executor corresponding to the request and the stream ID sent by the controller executor are found through the stream ID. The message is then re-encapsulated and sent to the requesting controller executor. That is, the response message is updated using the stream ID of the target controller executor, so that the updated response message is sent to the target controller executor.
[0094] It should also be noted that the P4Runtime protocol proxy sets up a connection management library, managing the mapping between the P4Runtime protocol proxy and external devices, as well as the mapping between the P4Runtime protocol proxy and each controller executor's HTTP / 2 connections. The P4Runtime protocol proxy maintains stream ID management for each external device connection; for that connection, the stream ID value increments by 1 with each message sent. It also maintains the mapping between the stream IDs sent by the protocol proxy and the stream IDs of the messages sent by the controller executors, facilitating the processing of response messages returned by the P4 switch to find the corresponding executor that sent the request. In the HTTP / 2 connection, the stream IDs of the request and response messages maintain consistency. Multiple controller executors appear as a single node externally, but internally, multiple controller executors execute in parallel.
[0095] Additionally, the P4Runtime protocol agent subscribes to messages from the scheduler. If the state of a controller executor changes, the scheduler sends a notification to the P4Runtime protocol agent, informing it of the controller executor's status information. Upon receiving a controller executor's online / offline notification from the scheduler, the P4Runtime protocol agent disconnects all links between all controller executors and itself, ensuring the consistency of state across all controller executors. The link between the main controller executor and the P4Runtime protocol agent remains unchanged, as does the link between the P4Runtime protocol agent and external devices. In this way, external devices are unaware of changes in the state of internal controller executors.
[0096] In this way, the present invention provides multiple parallel-executing controller entities that appear as a single node. Each controller can obtain device-related information from external devices, but the external devices can only discover one controller instance and establish a connection with it, thus hiding the characteristics of multiple controllers in the device. Through role scheduling and anomaly judgment functions, heterogeneous redundancy and external uncertainty are introduced into the controller node, greatly reducing the effectiveness of reconnaissance or attacks against unknown vulnerabilities, defects, trapdoors, or backdoors of the controller node, and improving the proactive defense capability of the controller node.
[0097] See Figure 5 As shown, this application discloses a specific communication method between a mimicry controller and an external device. Compared to the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically, it includes:
[0098] Step S31: Determine the server device port address configured in the connection establishment request by the target controller executor, and determine the target listening port address that matches the server device port address from the pre-established mapping relationship configuration table; the mapping relationship configuration table stores the mapping relationship between listening port addresses and device port addresses.
[0099] In this embodiment, it is first necessary to determine the server device port address configured in the connection establishment request of the target controller executor, and then determine the target listening port address that matches the server device port address from the pre-established mapping relationship configuration table. It can be understood that the server device port address configured in each controller executor is the port address of the P4 switch, and the P4Runtime protocol proxy sets a one-to-one correspondence between the listening port address and the P4 switch port address, storing the mapping relationship in a list data structure in the mapping relationship configuration table. The parameters in the table mainly include: the listening port address of the P4Runtime protocol proxy and the port address of the P4 switch. The specific correspondence can be as follows: Figure 6 As shown in the image.
[0100] Step S32: In the target controller execution body, the server device port address in the connection establishment request is converted into the target listening port address based on the network address translation mechanism, so as to obtain the connection establishment request through the target listening port corresponding to the target listening port address.
[0101] In this embodiment, since the server device port address configured in the controller execution body is the port address of the P4 switch, in order for the P4Runtime protocol proxy to intercept the P4Runtime protocol messages of the controller execution body, this application introduces a Network Address Translation (NAT) mechanism. The message sent to the P4 switch port address is translated by NAT to the listening port address of the P4Runtime protocol proxy corresponding to that P4 switch port address in the mapping configuration table, so that the message is handed over to the P4Runtime protocol proxy for processing. After processing, the P4Runtime protocol proxy sends the message back to the P4 switch. In other words, the server device port address in the connection establishment request is converted to the target listening port address, so that the connection establishment request can be intercepted through the target listening port corresponding to the target listening port address.
[0102] Step S33: Obtain the connection establishment request sent by the target controller executor in the mimicry controller through the target listening port, and establish a first communication connection with the target controller executor.
[0103] Step S34: Determine the target external device port address that matches the target listening port from the mapping relationship configuration table.
[0104] In this embodiment, after the first communication connection is successfully established, the P4Runtime protocol proxy searches the mapping relationship configuration table according to the target listening port to match the corresponding target external device port address, that is, the address port of the P4 switch to be connected.
[0105] Step S35: If the target controller executor is the main controller executor, then a second communication connection is established with the target external device corresponding to the port address of the target external device, so as to realize the communication between the main controller executor and the target external device through the first communication connection and the second communication connection.
[0106] Step S36: If the target controller executor is a slave controller executor, then determine whether the target external device corresponding to the target external device port address has established the second communication connection.
[0107] Step S37: If yes, then the slave controller executor communicates with the target external device through the first communication connection and the second communication connection; if no, then a preset waiting operation is performed so that after the second communication connection is established, the slave controller executor communicates with the target external device through the first communication connection and the second communication connection.
[0108] For more detailed processing procedures regarding steps S35, S36, and S37, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0109] As can be seen, in this embodiment, since the server device port address configured for the controller execution body is the port address of the P4 switch, in order for the P4Runtime protocol proxy to intercept the P4Runtime protocol messages of the controller execution body, the P4Runtime protocol proxy in this application sets a one-to-one correspondence between the listening port address and the port address of the P4 switch, stores the mapping relationship in a mapping relationship configuration table using a list data structure, and introduces a network address translation mechanism to convert the server device port address in the connection establishment request into the target listening port address, so as to intercept the connection establishment request through the target listening port corresponding to the target listening port address, thereby establishing a first communication connection with the target controller execution body. After the first communication connection is successfully established, the P4Runtime protocol proxy searches the mapping relationship configuration table according to the target listening port to match the corresponding target external device port address, so as to subsequently complete the establishment of a second communication connection with the target external device.
[0110] See Figure 7 As shown, this application discloses a method for processing the P4Runtime protocol proxy of a mimicry ONOS controller, applied in an SDN (Software Defined Network) network scenario:
[0111] First, both R1 and R2 in the SDN network run the P4Runtime protocol. R1 is a mimic controller device, which in this example includes four controller executors and input / output agents, as well as one management scheduler and one exception arbitrator; R2 is a P4 switch.
[0112] Each controller execution unit configures the server address and port, that is, configures the port and address of the P4 switch (switch_ip_port); the P4Runtime protocol proxy configures the mapping relationship between the local listening port address (proxy_ip_port) and the port address of the P4 switch (switch_ip_port); and configures NAT translation to translate packets sent to the P4 switch (switch_ip_port) to the listening port address (proxy_ip_port) of the P4Runtime protocol proxy.
[0113] The P4Runtime protocol proxy starts listening based on the configured listening port address `proxy_ip_port`. The main controller execution unit 1 initiates an HTTP / 2 connection to the P4 switch. Due to NAT translation, packets destined for the `proxy_ip_port` address are processed by the P4Runtime protocol proxy at `proxy_ip_port`. The P4Runtime protocol proxy then establishes a connection with the main controller execution unit (i.e.,...). Figure 7 After successful connection A1, the P4Runtime protocol proxy initiates an HTTP / 2 connection establishment with the P4 switch by looking up the mapping configuration table, thus completing the HTTP / 2 connection with the switch. Figure 7 Established in S1).
[0114] Each of the controller execution units 2, 3, and 4 initiates an HTTP / 2 connection to the P4 switch. Due to NAT translation, the destination port address packet is converted to the P4Runtime protocol proxy for processing, and a connection is established with the P4Runtime protocol proxy (i.e., Figure 7 Connections A2, A3, and A4 were successfully established. The P4Runtime protocol agent saves the connection S1 and P4Runtime connections A1, A2, A3, and A4 to the connection management library, using switch_ip_port as the key to distinguish between connections established with different P4 switches.
[0115] The main controller executor sends a StreamChannel message. The P4Runtime protocol proxy processes this locally, replacing the Stream ID in the HTTP / 2 message, and then sends it to the P4 switch via link S1 between the P4 switch and the P4Runtime protocol proxy. The P4 switch returns a role-based response message, which is then processed by the P4Runtime protocol proxy. The P4Runtime protocol proxy stores the role, device ID, and election ID of the response message in the first preset cache message list, thus completing the P4Runtime session establishment.
[0116] When a StreamChannel type role request message is sent from the controller execution body, the P4Runtime protocol proxy looks up the execution id in the cached message list, replaces the execution id with the execution id of the request message, and returns the response message to the execution body table of the request, thus completing the P4Runtime session establishment.
[0117] For subsequent P4Runtime messages returned by the P4 switch to the mimic controller, the P4Runtime protocol proxy needs to replace the Stream ID in the HTTP2 message and send it to each controller execution unit using the HTTP2 connection (1 / 2 / 3 / 4) between the P4Runtime protocol proxy and the controller execution unit.
[0118] For subsequent P4Runtime messages sent by the controller execution body to the P4 switch, the P4Runtime protocol proxy replaces the Stream ID in the P4Runtime message and sends it using the HTTP2 connection S1 between the P4Runtime protocol proxy and the P4Runtime switch.
[0119] The mimic controller configures forwarding table information. After each controller execution unit generates a forwarding table, it sends it to the P4Runtime protocol agent. The P4Runtime protocol agent sends the flow table information of each controller execution unit to the exception arbitrator. After the exception arbitrator makes a judgment, the P4Runtime protocol agent selects the forwarding table with the correct judgment and sends it to the P4 switch to guide the forwarding of the P4 switch.
[0120] See Figure 8 As shown in the figure, this application discloses a communication device between a mimicry controller and an external device, which is used as a protocol proxy in the mimicry controller. The device includes:
[0121] The first communication connection establishment module 11 is used to obtain the connection establishment request sent by the target controller executor in the mimicry controller through the target listening port, and establish a first communication connection with the target controller executor.
[0122] Port address determination module 12 is used to determine the port address of a target external device that matches the target listening port;
[0123] The second communication connection establishment module 13 is used to establish a second communication connection with the target external device corresponding to the port address of the target external device if the target controller execution body is the main controller execution body, so as to realize the communication between the main controller execution body and the target external device through the first communication connection and the second communication connection;
[0124] The communication connection confirmation module 14 is used to determine whether the target external device corresponding to the target external device port address has established the second communication connection if the target controller executor is a slave controller executor.
[0125] The communication module 15 is configured to, if yes, enable communication between the slave controller executor and the target external device through the first communication connection and the second communication connection; otherwise, execute a preset waiting operation to enable communication between the slave controller executor and the target external device through the first communication connection and the second communication connection after the second communication connection is established.
[0126] Since the embodiments of the device part correspond to the embodiments described above, please refer to the embodiments described in the method part for the embodiments of the device part, and they will not be repeated here.
[0127] Therefore, this application establishes a protocol proxy within the mimicry controller to facilitate connection establishment and subsequent data interaction between each controller executor within the mimicry controller and external devices. The target controller executor initiates a connection establishment request. Upon receiving this request at the target listening port of the protocol proxy, the P4Runtime protocol proxy establishes a first communication connection with the target controller executor. Further, the protocol proxy determines the target external device port address matching the target listening port. When the target controller executor is the master controller executor, it proactively establishes a second communication connection with the target external device corresponding to the target external device port address. Thus, communication between the master controller executor and the target external device can be achieved through the first and second communication connections. Furthermore, if the target controller executor is a slave controller executor, it first determines whether the target external device corresponding to the target external device port address has already established the aforementioned second communication connection. If so, communication between the slave controller executor and the target external device can be achieved through the first and second communication connections. If the second communication connection is not established, it is necessary to wait for the second communication connection to be established before communication between the slave controller executor and the target external device can be achieved through the first and second communication connections. In other words, in this application, the protocol proxy establishes a first communication connection with each controller executor in the mimicry controller. Only when the main controller executor initiates a connection establishment request does the protocol proxy establish a second communication connection with the external device. In this way, by setting up the protocol proxy, the multiple controller executors in the mimicry controller appear to the outside world as a single controller executor establishing a connection with the external device. That is, the external device can only discover one controller instance and establish a communication connection with it, thereby hiding the characteristic that there are multiple controller executors in the mimicry controller. This greatly reduces the effectiveness of reconnaissance or attack against unknown vulnerabilities, defects, trapdoors or backdoors of the mimicry controller node, improves the active defense capability of the mimicry controller, ensures the effectiveness of data interaction between each controller executor in the mimicry controller and the external device, and facilitates the effective implementation of mimicry schemes in network defense.
[0128] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the communication method between the mimicry controller and external devices disclosed in any of the foregoing embodiments.
[0129] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0130] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0131] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored on it include operating system 221, computer program 222 and data 223, etc., and the storage method can be temporary storage or permanent storage.
[0132] The operating system 221 manages and controls the various hardware devices on the electronic device 20 and the computer program 222 to enable the processor 21 to perform calculations and processing on the massive amount of data 223 in the memory 22. It can be Windows, Unix, Linux, etc. The computer program 222, in addition to including a computer program capable of performing the communication method between the mimicry controller and external devices as disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data 223 may include data received by the electronic device from external devices, as well as data collected by its own input / output interface 25.
[0133] Furthermore, embodiments of this application also disclose a computer-readable storage medium storing a computer program. When the computer program is loaded and executed by a processor, it implements the communication method steps between the mimicry controller and external devices disclosed in any of the foregoing embodiments.
[0134] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0135] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0136] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art.
[0137] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0138] The foregoing has provided a detailed description of the communication method, apparatus, device, and storage medium between a mimicry controller and an external device provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A communication method between a mimicry controller and an external device, characterized in that, A protocol proxy applied in a mimicry controller, the method comprising: The connection establishment request sent by the target controller executor in the mimicry controller is obtained through the target listening port, and a first communication connection is established with the target controller executor. Determine the target external device port address that matches the target listening port; If the target controller executor is the main controller executor, then a second communication connection is established with the target external device corresponding to the port address of the target external device, so as to realize the communication between the main controller executor and the target external device through the first communication connection and the second communication connection; If the target controller executor is a slave controller executor, then determine whether the target external device corresponding to the target external device port address has established the second communication connection; If yes, then the slave controller executor communicates with the target external device through the first communication connection and the second communication connection; if no, then a preset waiting operation is performed so that after the second communication connection is established, the slave controller executor communicates with the target external device through the first communication connection and the second communication connection.
2. The communication method between the mimicry controller and external devices according to claim 1, characterized in that, Determining the target external device port address that matches the target listening port includes: The target external device port address that matches the target listening port is determined from a pre-established mapping relationship configuration table; the mapping relationship configuration table stores the mapping relationship between listening port addresses and device port addresses.
3. The communication method between the mimicry controller and external devices according to claim 2, characterized in that, Before obtaining the connection establishment request sent by the target controller executor in the mimicry controller through the target listening port, the method further includes: Determine the server device port address configured in the connection establishment request by the target controller execution unit; Determine the target listening port address that matches the server device port address from the mapping relationship configuration table; In the target controller execution unit, the server device port address in the connection establishment request is converted to the target listening port address based on the network address translation mechanism, so as to obtain the connection establishment request through the target listening port corresponding to the target listening port address.
4. The communication method between the mimicry controller and external devices according to claim 1, characterized in that, After establishing a second communication connection with the target external device corresponding to the target external device port address, the method further includes: Store the target external device port address as a key in a preset device connection list; Accordingly, determining whether the target external device corresponding to the target external device port address has established the second communication connection includes: Determine whether a keyword corresponding to the port address of the target external device exists in the device connection list; If the connection exists, it is determined that the target external device corresponding to the target external device port address has established the second communication connection; if the connection does not exist, it is determined that the target external device corresponding to the target external device port address has not established the second communication connection.
5. The communication method between the mimicry controller and an external device according to any one of claims 1 to 4, characterized in that, After the first communication connection and the second communication connection are established, the following steps are also included: The request message sent by the target controller executor is obtained through the first communication connection; Based on the message type of the request message, determine whether to send the request message to the target external device through the second communication connection, and determine the response message corresponding to the request message, so as to send the response message to the target controller execution unit.
6. The communication method between the mimicry controller and external devices according to claim 5, characterized in that, The protocol proxy is the P4Runtime protocol proxy.
7. The communication method between the mimicry controller and external devices according to claim 6, characterized in that, The step of determining whether to send the request message to the target external device through the second communication connection based on the message type of the request message, and determining the response message corresponding to the request message, and sending the response message to the target controller execution unit, includes: If the message type of the request message is a first preset type, then it is determined whether the target controller execution body is the master controller execution body; the first preset type is MasterArbitrationUpdate; If the target controller executor is the main controller executor, then the request message is sent to the target external device through the second communication connection, and the response message returned by the target external device is stored in the first preset message cache list; If the target controller executor is a slave controller executor, then the response message corresponding to the request message is obtained from the first preset message cache list, and the target field in the response message is updated using the feature information of the target controller executor, so as to send the updated response message to the target controller executor.
8. The communication method between the mimicry controller and external devices according to claim 6, characterized in that, The step of determining whether to send the request message to the target external device through the second communication connection based on the message type of the request message, and determining the response message corresponding to the request message, and sending the response message to the target controller execution unit, includes: If the message type of the request message is the second preset type, then all request messages of the controller execution body are sent to the exception arbitrator so that the target request message can be determined from all the request messages based on the arbitrator's decision; the second preset type is Write or SetForwardingPipelineConfig; The target field in the target request message is updated using the characteristic information of the main controller execution body, and the updated target request message is sent to the target external device through the second communication connection, so as to modify the configuration information and forwarding table of the target external device using the target request message; The response message returned by the target external device is obtained, and the response message is updated using the flow identifier corresponding to each controller execution body, so as to send the updated response message to each controller execution body.
9. The communication method between the mimicry controller and external devices according to claim 6, characterized in that, The step of determining whether to send the request message to the target external device through the second communication connection based on the message type of the request message, and determining the response message corresponding to the request message, and sending the response message to the target controller execution unit, includes: If the message type of the request message is a third preset type, then the response message corresponding to the request message is obtained from the second preset message cache list, and the response message is processed using the flow identifier corresponding to the target controller execution body, so as to send the processed response message to the target controller execution body; the third preset type is any one of GetForwardingPipelineConfig, Capabilities, and Read; The second preset message cache list is used to store the response messages returned by the target external device after the P4Runtime protocol proxy periodically sends the third preset type of request message to the target external device at a preset time.
10. The communication method between the mimicry controller and an external device according to claim 9, characterized in that, The process of retrieving the response message corresponding to the request message from the second preset message cache list also includes: If there is no response message corresponding to the request message in the second preset message cache list, the request message is updated using the current flow identifier of the P4Runtime protocol proxy, so as to send the updated request message to the target external device and obtain the response message returned by the target external device.
11. A communication device between a mimicry controller and an external device, characterized in that, The device, used as a protocol proxy in a mimicry controller, comprises: The first communication connection establishment module is used to obtain the connection establishment request sent by the target controller executor in the mimicry controller through the target listening port, and establish a first communication connection with the target controller executor. A port address determination module is used to determine the port address of a target external device that matches the target listening port. The second communication connection establishment module is used to establish a second communication connection with the target external device corresponding to the port address of the target external device if the target controller executor is the main controller executor, so as to realize the communication between the main controller executor and the target external device through the first communication connection and the second communication connection; The communication connection confirmation module is used to determine whether the target external device corresponding to the target external device port address has established the second communication connection if the target controller executor is a slave controller executor. The communication module is configured to, if yes, enable communication between the slave controller executor and the target external device through the first communication connection and the second communication connection; otherwise, execute a preset waiting operation to enable communication between the slave controller executor and the target external device through the first communication connection and the second communication connection after the second communication connection is established.
12. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the communication method between the mimicry controller and an external device as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the communication method between the mimicry controller and an external device as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Open shortest path first message processing method and mimicry equipment
CN112187865A
Implementation method and system for http mimicry middleware based on mimicry defense thought
CN116260633A