The present invention relates to the field of network communications, and in particular, to a method for generating an entry, a method for receiving a message, a stream forwarding apparatus, a control plane apparatus, and a communications system.
A network architecture in which controlling and forwarding functions are separated is a new network architecture. The network architecture includes a stream forwarding apparatus and a control plane apparatus. The stream forwarding apparatus processes a received packet according to a flow table. The control plane apparatus controls the stream forwarding apparatus through a control channel.
The stream forwarding apparatus searches the flow table for a flow entry matching the received packet. To obtain an exact matching entry corresponding to the packet, the stream forwarding apparatus needs to send the packet or a packet header to the control plane apparatus, so that the control plane apparatus generates the exact matching entry and delivers the exact matching entry to the stream forwarding apparatus.
The inventor finds that the prior art has the following technical problems:
to obtain the exact matching entry, the stream forwarding apparatus needs to interact with the control plane apparatus through the control channel, which occupies a bandwidth of the control channel.
Embodiments of the present invention provide a method for generating an entry, a method for receiving a message, a stream forwarding apparatus, a control plane apparatus and a communications system, where the stream forwarding apparatus may obtain an exact matching entry without interacting with the control plane apparatus through a control channel.
In one aspect, an embodiment of the present invention provides a method for generating an entry, including:
receiving, by a stream forwarding apparatus, a first packet, where the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated;
searching, by the stream forwarding apparatus, a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set; and
generating, by the stream forwarding apparatus, a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set.
In another aspect, an embodiment of the present invention provides a method for receiving a message, including: receiving, by a control plane apparatus, a first message sent by a stream forwarding apparatus through a control channel, where the control plane apparatus is a control plane apparatus in a network architecture in which controlling and forwarding are separated, the first message includes a second entry, and the second entry is obtained by the following means: the stream forwarding apparatus receives a first packet, where the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated; the stream forwarding apparatus searches a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set; the stream forwarding apparatus generates a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set; and
storing, by the control plane apparatus, the second entry.
In another aspect, an embodiment of the present invention further provides a stream forwarding apparatus, where the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated, and the stream forwarding apparatus includes:
a first receiver, a searching unit and an entry generating unit;
the first receiver is configured to receive a first packet;
the searching unit is configured to search a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set; and
the entry generating unit is configured to generate a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set.
In another aspect, an embodiment of the present invention further provides a control plane apparatus, where the control plane apparatus is a control plane apparatus in a network architecture in which controlling and forwarding are separated, and the control plane apparatus includes:
a second receiver and a saving unit;
the second receiver is configured to receive a first message sent by a stream forwarding apparatus through a control channel, where the first message includes a second entry, and the second entry is obtained by the following means: the stream forwarding apparatus receives a first packet, where the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated; the stream forwarding apparatus searches a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set; the stream forwarding apparatus generates a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set; and
the saving unit is configured to save the second entry.
In another aspect, an embodiment of the present invention further provides a communications system, including:
a stream forwarding apparatus and a control plane apparatus, where the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated; and the control plane apparatus is a control plane apparatus in a network architecture in which controlling and forwarding are separated;
the stream forwarding apparatus includes a first receiver, a searching unit, an entry generating unit and a transmitter;
the first receiver is configured to receive a first packet;
the searching unit is configured to search a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set;
the entry generating unit is configured to generate a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set; and
the transmitter is configured to send a first message to the control plane apparatus through a control channel, where the first message includes the second entry;
the control plane apparatus includes a second receiver and a saving unit;
the second receiver is configured to receive the first message through a control channel; and
the saving unit is configured to save the second entry in the control plane apparatus.
It can be seen that, with the embodiments of the present invention, a stream forwarding apparatus may generate a second entry according to a first entry that matches a received packet without interacting with a control plane apparatus, reducing an occupied bandwidth of a control channel between the stream forwarding apparatus and the control plane apparatus.
To describe the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings in the following description show merely some embodiments of the present invention, and a person of ordinary skill in the art may still derive other drawings according to these accompanying drawings without creative efforts.
The following clearly describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the embodiments to be described are merely a part rather than all of the embodiments of the present invention. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
Embodiments of the present invention relate to a network architecture in which controlling and forwarding are separated. The network architecture in which controlling and forwarding are separated includes a stream forwarding apparatus and a control plane apparatus. The stream forwarding apparatus processes a received packet according to a flow table. The control plane apparatus controls the stream forwarding apparatus through a control channel.
In the network architecture in which controlling and forwarding are separated, that controlling and forwarding are separated indicates that the stream forwarding apparatus and the control plane apparatus are separated, where the stream forwarding apparatus transfers a part of or all functions of a control plane to the control plane apparatus, and the stream forwarding apparatus is capable of communicating with the control plane apparatus. The stream forwarding apparatus may communicate with the control plane apparatus through the control channel.
The stream forwarding apparatus may forward the received packet according to the flow table. In specific implementation, forwarding a packet may be layer 2 forwarding, and may also be layer 3 forwarding. For details about layer 2 and layer 3, reference is made to an open systems interconnection model (Open Systems Interconnection model, OSI model).
In specific implementation, the stream forwarding apparatus may be a switch or a router.
The stream forwarding apparatus may specifically be an OpenFlow Switch (OpenFlow Switch) when the stream forwarding apparatus is a switch. For the OpenFlow Switch, reference is made to an OpenFlow Switch specification 1.0 (OpenFlow Switch Specification 1.0) issued by the openflow networking foundation (OpenFlow Networking Foundation, OFN), a standard formulation organization.
In specific implementation, the control plane apparatus may be an OpenFlow Controller (OpenFlow Controller). For the OpenFlow Controller, reference is made to the OpenFlow Switch specification 1.0 issued by the openflow networking foundation, a standard formulation organization.
In specific implementation, the control channel may be a secure channel (Secure Channel) for interaction between the OpenFlow Switch and the OpenFlow Controller. For specific information, reference is made to the OpenFlow Switch specification 1.0 issued by the openflow networking foundation, a standard formulation organization.
An embodiment of the present invention provides a method for generating an entry, and a stream forwarding apparatus may obtain an exact matching entry without interacting with a control plane apparatus. As shown in
101: A stream forwarding apparatus receives a first packet, where the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated.
In specific implementation, the stream forwarding apparatus may be an OpenFlow Switch.
In specific implementation, the first packet may be an internet protocol packet (Internet Protocol Packet, IP packet), or a media access control (Media Access Control, MAC) protocol frame (Frame).
102: The stream forwarding apparatus searches a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set.
The flow table (Flow Table) is saved in the stream forwarding apparatus, and includes the first entry. The first entry may specifically be implemented as follows: The control plane apparatus generates the first entry, and sends the first entry to the stream forwarding apparatus.
The flow table may include multiple flow entries (Flow Entry).
Referring to
If all fields in the match fields of the flow entry match corresponding fields in the first packet, the flow entry matches the packet. The first entry is the flow entry matching the first packet; therefore, all fields in the match fields of the first entry match corresponding fields in the first packet.
It should be noted that, if the match fields of the flow entry include an inbound interface, that an inbound interface actually used by the stream forwarding apparatus when receiving a packet matches the inbound interface in the match fields is a necessary condition for the flow entry to match the packet.
The first set is a set formed by fields that are in the first entry and match the first packet. Therefore, the first set includes all the fields in the match fields of the first entry.
103: The stream forwarding apparatus generates a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set.
The second entry is similar to the first entry in specific implementation. For details, reference is made to the description about the first entry in 102.
The second entry is a flow table entry matching the first packet. The second set is a set formed by fields that are in the second entry and match the first packet. The match fields in the second entry include multiple fields. The second set is formed of multiple fields in the match fields of the second entry.
The first set is a subset of the second set, and the first set is not equal to the second set. That is to say, the number of elements in the second set is greater than the number of elements in the first set.
In specific implementation, generating the second entry according to the first entry may be:
parsing the first packet, and extracting a field from a packet header of the first packet, where the foregoing field may be one or more fields, and is a field other than fields included in the match fields of the first entry, and
copying content of the first entry, and storing the copied content in a storage space corresponding to the second entry to be generated, where the copied content is consistent with the first entry, and the copied content includes the match fields, and adding the field extracted from the packet header of the first packet to the match fields, so as to obtain the second entry, where the number of fields in the match fields of the second entry is greater than the number of fields in the match fields of the first entry.
Generating the second entry according to the first entry may also be implemented in another manner. For example, the content of the first entry is copied first, and then the field extracted from the first packet is added to the copied content. In addition, the fields other than the match fields of the second entry may be inconsistent with the fields other than the match fields of the first entry.
It can be seen that, with the method provided in the embodiment, a stream forwarding apparatus may generate the second entry according to a first entry matching a received packet. The stream forwarding apparatus does not need to interact with a control plane apparatus, reducing an occupied bandwidth of a control channel between the stream forwarding apparatus and the control plane apparatus.
Optionally,
after the stream forwarding apparatus generates the second entry according to the first entry, the method further includes:
104: The stream forwarding apparatus processes the first packet according to the second entry.
Processing the first packet may be determining an outbound interface for forwarding the first packet, encapsulating the first packet, sending the first packet to the control plane apparatus, or discarding the first packet. In specific implementation, the second entry may include the instructions, and for details, reference may be made to
Optionally,
after the stream forwarding apparatus generates the second entry according to the first entry, the method further includes:
105: The stream forwarding apparatus sends the second entry to the control plane apparatus through the control channel, where the control plane apparatus is a control plane apparatus in a network architecture in which controlling and forwarding are separated.
In specific implementation, the control plane apparatus may be an Openflow Controller.
In implementation, the control channel may be a secure channel for interaction between the OpenFlow Controller and the Openflow Switch.
In specific implementation, the sending, by the stream forwarding apparatus, the second entry may be:
defining a new packet type in a communication protocol of the stream forwarding apparatus and the control plane apparatus, where the packet type is used to identify that the packet carries an exact matching entry generated by the stream forwarding apparatus. When receiving the packet, the control plane apparatus may identify that the packet carries an exact matching entry generated by the stream forwarding apparatus according to a packet header. The stream forwarding apparatus may encapsulate the second entry in the packet according to the new packet type, and send the packet to the control plane apparatus through the control channel.
After receiving the second entry, the control plane apparatus may save the second entry.
The control plane apparatus may obtain, according to the saved second entry, the number of packets that is received by the stream forwarding apparatus and matches the second entry.
In specific implementation, the process may be:
the stream forwarding apparatus may calculate the number of packets that is received by the stream forwarding apparatus and matches the second entry through a counter, and record a calculation result. Referring to
Optionally,
after the stream forwarding apparatus generates the second entry according to the first entry, the method further includes the following steps.
106: The stream forwarding apparatus receives a second packet.
107: The stream forwarding apparatus determines whether the second entry matches the second packet, and when the second entry matches the second packet, the stream forwarding apparatus processes the second packet according to the second entry.
Compared with the first entry, the second entry is an exact matching entry. If a packet received by the stream forwarding apparatus matches the second entry, the packet is sure to match the first entry.
Through the solution, the stream forwarding apparatus may process, according to the second entry, a packet that matches both the first entry and the second entry.
Optionally,
108: When the second entry does not match the second packet, the stream forwarding apparatus determines whether the first entry matches the second packet; and when the first entry matches the second packet, the stream forwarding apparatus processes the second packet according to the first entry.
Through the solution, the stream forwarding apparatus may process, according to the first entry, a packet that matches the first entry but does not match the second entry.
An embodiment of the present invention provides a method for receiving a message, and a control plane apparatus may obtain an exact matching entry sent by a stream forwarding apparatus. In a process of obtaining an exact matching entry, the stream forwarding apparatus does not need to interact with the control plane apparatus. As shown in
501: The control plane apparatus receives, through a control channel, a first message sent by the stream forwarding apparatus, where the control plane apparatus is a control plane apparatus in a network architecture in which controlling and forwarding are separated, the first message includes a second entry, and the second entry is obtained by the following means: the stream forwarding apparatus receives a first packet, where the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated; the stream forwarding apparatus searches a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set; the stream forwarding apparatus generates a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set.
For specific implementation of the second entry, reference is made to 101, 102, and 103 in Embodiment 1, which is not described herein again.
In specific implementation, the control plane apparatus may be an OpenFlow Controller.
In implementation, the control channel may be a secure channel for interaction between an Openflow Switch and the OpenFlow Controller.
The stream forwarding apparatus sends the second entry to the control plane apparatus. The second entry may be encapsulated in a Packet In packet. For details about the Packet In packet, reference is made to openflow switch specification 1.0.
502: The control plane apparatus stores the second entry.
After receiving the second entry, the control plane apparatus may save the second entry.
The control plane apparatus may obtain, according to the saved second entry, the number of packets that is received by the stream forwarding apparatus and matches the second entry.
In specific implementation, the process may be:
the stream forwarding apparatus may calculate the number of packets that is received by the stream forwarding apparatus and matches the second entry through a counter, and record a calculation result. Referring to
It can be seen that, with the method provided in the embodiment, the control plane apparatus may obtain an exact matching entry generated by a stream forwarding apparatus. The exact matching entry is generated by the stream forwarding apparatus according to the first entry matching the received packet. In a process of generating an exact matching entry, the stream forwarding apparatus does not need to interact with the control plane apparatus. Therefore, the method provided in the embodiment reduces an occupied bandwidth of the control channel between the stream forwarding apparatus and the control plane apparatus.
An embodiment of the present invention provides a stream forwarding apparatus, and the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated. In a process of obtaining an exact matching entry, the stream forwarding apparatus does not need to interact with a control plane apparatus. The stream forwarding apparatus provided in the embodiment may be implemented in the method for generating an entry provided in Embodiment 1. As shown in
a first receiver 601, a searching unit 602 and an entry generating unit 603;
the first receiver 601 is configured to receive a first packet;
the searching unit 602 is configured to search a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set; and
the entry generating unit 603 is configured to generate a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set.
For specific implementation of the first receiver 601, reference is made to 101 in Embodiment 1.
For specific implementation of the searching unit 602, reference is made to 102 in Embodiment 1.
For specific implementation of the entry generating unit 603, reference is made to 103 in Embodiment 1.
It can be seen that, with the stream forwarding apparatus provided in the embodiment, the second entry may be generated according to the first entry matching a received packet. The stream forwarding apparatus does not need to interact with a control plane apparatus, reducing an occupied bandwidth of a control channel between the stream forwarding apparatus and the control plane apparatus.
Optionally,
the apparatus further includes a processing unit, where the processing unit is configured to process the first packet according to the second entry.
For specific implementation of the processing unit, reference is made to 104 in Embodiment 1.
Optionally,
the apparatus further includes a transmitter, where the transmitter is configured to send the second entry to a control plane apparatus through a control channel, and the control plane apparatus is a control plane apparatus in a network architecture in which controlling and forwarding are separated.
For specific implementation of the transmitter, reference is made to 105 in Embodiment 1.
Optionally,
the first receiver 601 is further configured to receive a second packet after the stream forwarding apparatus generates the second entry according to the first entry;
the searching unit 602 is further configured to determine whether the second entry matches the second packet; and
the processing unit is further configured to process, by the stream forwarding apparatus, the second packet according to the second entry when the second entry matches the second packet.
For specific implementation of the first receiver 601, reference is made to 106 in Embodiment 1.
For specific implementation of the searching unit 602, reference is made to 107 in Embodiment 1.
For specific implementation of the processing unit, reference is made to 107 in Embodiment 1.
Compared with the first entry, the second entry is an exact matching entry. If a packet received by the stream forwarding apparatus matches the second entry, the packet is sure to match the first entry.
In the solution, it may be implemented that a packet that matches both the first entry and the second entry is processed according to the second entry.
Optionally,
the searching unit 602 is further configured to determine whether the first entry matches the second packet when the second entry does not match the second packet; and
the processing unit is further configured to process the second packet according to the first entry when the first entry matches the second packet.
For specific implementation of the searching unit 602, reference is made to 108 in Embodiment 1.
For specific implementation of the processing unit, reference is made to 108 in Embodiment 1.
In the solution, it may be implemented that a packet that matches the first entry but does not match the second entry is processed according to the first entry.
An embodiment of the present invention provides a control plane apparatus, and the control plane apparatus is a control plane apparatus in a network architecture in which controlling and forwarding are separated. The control plane apparatus may obtain an exact matching entry sent by a stream forwarding apparatus. In a process of obtaining an exact matching entry, the stream forwarding apparatus does not need to interact with the control plane apparatus. The control plane apparatus provided in the embodiment may be implemented by using the method for receiving a message provided in Embodiment 2. As shown in
a second receiver 701 and a saving unit 702;
the second receiver 701 is configured to receive a first message sent by the stream forwarding apparatus through a control channel, where the first message includes a second entry, and the second entry is obtained by the following means: the stream forwarding apparatus receives a first packet; the stream forwarding apparatus searches a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set; the stream forwarding apparatus generates a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set; and
the saving unit 702 is configured to save the second entry.
For specific implementation of the second receiver 701, reference is made to 201 in Embodiment 2.
For specific implementation of the saving unit 702, reference is made to 202 in Embodiment 2.
It can be seen that, with the technical solution provided in the embodiment, the control plane apparatus may obtain the exact matching entry generated by the stream forwarding apparatus. The exact matching entry is generated by the stream forwarding apparatus according to a first entry matching a received packet. In a process of generating an exact matching entry, the stream forwarding apparatus does not need to interact with the control plane apparatus. Therefore, the technical solution provided in the embodiment reduces an occupied bandwidth of the control channel between the stream forwarding apparatus and the control plane apparatus.
An embodiment of the present invention provides a communications system, including a stream forwarding apparatus and a control plane apparatus. In a process of obtaining an exact matching entry, the stream forwarding apparatus does not need to interact with the control plane apparatus. As shown in
a stream forwarding apparatus 801 and a control plane apparatus 802, where the stream forwarding apparatus is a stream forwarding apparatus in a network architecture in which controlling and forwarding are separated; and the control plane apparatus 802 is a control plane apparatus in a network architecture in which controlling and forwarding are separated;
the stream forwarding apparatus 801 includes a first receiver, a searching unit, an entry generating unit and a transmitter;
the first receiver is configured to receive a first packet;
the searching unit is configured to search a flow table for a first entry matching the first packet, where a set formed by fields that are in the first entry and match the first packet is a first set;
the entry generating unit is configured to generate a second entry according to the first entry, where a set formed by fields that are in the second entry and match the first packet is a second set, the first set is a subset of the second set, and the first set is not equal to the second set; and
the transmitter is configured to send a first message to the control plane apparatus through a control channel, where the first message includes the second entry;
the control plane apparatus 802 includes a second receiver and a saving unit;
the second receiver is configured to receive the first message through the control channel; and the saving unit is configured to save the second entry in the control plane apparatus.
The stream forwarding apparatus 801 may be implemented by using the method for generating the entry provided in Embodiment 1.
Specifically, the first receiver in the stream forwarding apparatus 801 may be implemented through 601 in Embodiment 3. The searching unit in the stream forwarding apparatus 801 may be implemented through 602 in Embodiment 3. The entry generating unit in the stream forwarding apparatus 801 may be implemented through 603 in Embodiment 3.
The control plane apparatus 802 may be implemented by using the method for receiving a message provided in Embodiment 2.
Specifically, the second receiver in the control plane apparatus 802 may be implemented through 701 in Embodiment 4. The saving unit in the control plane apparatus 802 may be implemented through 702 in Embodiment 4.
It can be seen that, with the communications system provided in the embodiment, the control plane apparatus may obtain an exact matching entry generated by the stream forwarding apparatus. The exact matching entry is generated by the stream forwarding apparatus according to the first entry matching a received packet. In a process of generating an exact matching entry, the stream forwarding apparatus does not need to interact with the control plane apparatus. Therefore, the technical solution provided in the embodiment reduces an occupied bandwidth of the control channel between the stream forwarding apparatus and the control plane apparatus.
A person of ordinary skill in the art may understand that all or a part of the processes of the methods in the foregoing embodiments may be implemented by computer program instructing relevant hardware. The program may be stored in a computer readable storage medium. When the program runs, the processes of the method embodiments are performed. The storage medium may be a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), and so on.
The foregoing discloses merely exemplary embodiments of the present invention, but is certainly not intended to limit the scope of the claims of the present invention. Therefore, any equivalent variation made according to the claims of the present invention should still fall within the scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
201110412195.7 | Dec 2011 | CN | national |
This application is a continuation of International Application No. PCT/CN2012/083268, filed on Oct. 22, 2012, which claims priority to Chinese Patent Application No. 201110412195.7, filed on Dec. 12, 2011, both of which are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2012/083268 | Oct 2012 | US |
Child | 14300532 | US |