WO2016197917A1 - Flow entry issuing method, flow entry storage method, relevant apparatus and system - Google Patents

Flow entry issuing method, flow entry storage method, relevant apparatus and system Download PDF

Info

Publication number
WO2016197917A1
WO2016197917A1 PCT/CN2016/085130 CN2016085130W WO2016197917A1 WO 2016197917 A1 WO2016197917 A1 WO 2016197917A1 CN 2016085130 W CN2016085130 W CN 2016085130W WO 2016197917 A1 WO2016197917 A1 WO 2016197917A1
Authority
WO
WIPO (PCT)
Prior art keywords
network device
flow entry
controller
reserved
free space
Prior art date
Application number
PCT/CN2016/085130
Other languages
French (fr)
Chinese (zh)
Inventor
胡士辉
侯杰
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP16806815.3A priority Critical patent/EP3300321B1/en
Publication of WO2016197917A1 publication Critical patent/WO2016197917A1/en
Priority to US15/837,811 priority patent/US10469388B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/64Routing or path finding of packets in data switching networks using an overlay routing layer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • H04L45/036Updating the topology between route computation elements, e.g. between OpenFlow controllers

Definitions

  • the present invention relates to the field of communications, and in particular, to a method for delivering a flow entry, a method for saving a flow entry, and a related device and system.
  • the controller sends a flow entry to the network device, so that the network device can perform corresponding functions, such as forwarding, discarding, and the like according to the obtained flow entry.
  • the controller needs to send one or more flow entries related to the function to the network device.
  • a network device generally allocates a dedicated storage space for the flow table entry delivered by the controller.
  • the controller does not consider the storage state of the storage space used by the network device to store the flow entry.
  • the controller may still send a flow entry to the network device in order to enable the network device to perform a certain function in the case that the storage space of the network device storage flow entry is insufficient. Because the network device does not have enough storage space at this time, it cannot save or only save some of the received flow entry. The function of the network device fails to be implemented.
  • an embodiment of the present invention provides a method for sending a flow entry, a method for saving a flow entry, a related device, and a system, so that the controller is smaller than the free space in the free space.
  • the flow entry is not sent to the network device in the total capacity, which improves the success rate of the flow entry sent by the controller.
  • an embodiment of the present invention provides a method for delivering a flow entry, where the method includes:
  • the controller acquires at least one flow entry for implementing a function on the network device and a device identifier of the network device;
  • the controller obtains, by the controller, the storage information of the network device according to the device identifier, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
  • the controller compares the total capacity of the free space and the at least one flow entry
  • controller sends the at least one flow entry to the network device according to the device identifier, if the free space is greater than or equal to the total capacity;
  • the controller does not deliver the at least one flow entry to the network device if the free space is smaller than the total capacity.
  • the free space in the storage space for storing the flow entry specifically includes a reserved free space and a non-reserved free space, where the at least one flow entry is further Having a corresponding user identifier, the method further includes:
  • the controller compares the total capacity of the free space and the at least one flow entry, including:
  • the controller compares the total capacity of the reserved subspace and the at least one flow entry
  • the controller sends the at least one flow entry to the network device according to the device identifier;
  • the controller compares the non-reserved free space with the total capacity
  • controller sends the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
  • the controller does not go to the network device The at least one flow entry is delivered.
  • the controller determines, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier.
  • ,Also includes:
  • the controller compares the non-reserved free space with the total capacity
  • controller sends the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
  • the controller does not deliver the at least one flow entry to the network device, if the non-reserved free space is smaller than the total capacity.
  • the controller acquires, according to the device identifier, the storage information of the network device, including :
  • the controller acquires the storage information of the network device from the response message.
  • the request message is an extended Multipart request message of an OpenFlow protocol, where the extended Multipart request message includes a Type field and a request body a field, the Type field carrying a type value indicating that the information is stored, the request body field is empty or carrying the device identifier;
  • the response message is an extended Multipart response message of the OpenFlow protocol
  • the Multipart response message includes the Type field and a response Body field
  • the response Body field carries the storage information of the network device.
  • the method further includes:
  • the controller When the controller sends the at least one flow entry to the network device, or receives a flow entry deletion notification sent by the network device, the controller updates the storage information, and the flow entry deletion notification is And including a flow entry capacity deleted by the network device and a location where the deleted flow entry is stored in the storage space before being deleted.
  • the embodiment of the present invention provides a flow entry delivery device, where the flow entry delivery device includes:
  • An obtaining unit configured to acquire at least one flow entry for implementing a function on the network device, and a device identifier of the network device;
  • a searching unit configured to acquire, according to the device identifier, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
  • a comparison unit configured to compare the total capacity of the free space and the at least one flow entry
  • the trigger sending unit sends the at least one flow entry to the network device according to the device identifier
  • the sending unit does not trigger the sending of the at least one flow entry to the network device.
  • the free space in the storage space for storing the flow entry specifically includes a reserved free space and a non-reserved free space, where the at least one flow entry is further Has a corresponding user ID, and also includes:
  • a determining unit configured to determine, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space;
  • the first comparison subunit is configured to compare the total capacity of the reserved subspace and the at least one flow entry
  • the sending unit is configured to send the at least one flow entry to the network device according to the device identifier;
  • the second comparison subunit is configured to compare the non-reserved free space with the total capacity
  • the method further includes:
  • the second comparison subunit is triggered
  • the searching unit further includes:
  • a sending subunit configured to send a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device;
  • a receiving subunit configured to receive a response message that is sent by the network device according to the request message, where the response message is used to notify the controller of the storage information on the network device;
  • the request message is an extended multipart Multipart request message of an OpenFlow OpenFlow protocol, where the extended Multipart request message includes a type. a Type field and a request body Body field, the Type field carrying a type value indicating that the information is stored, the request Body field is empty or carrying the device identifier;
  • the response message is an extended Multipart response message of the OpenFlow protocol
  • the Multipart response message includes the Type field and a response Body field, the response body
  • the field carries the storage information of the network device.
  • the method further includes:
  • an update unit configured to: when the at least one flow entry is sent to the network device, or the flow entry deletion notification sent by the network device is received, the storage information is updated, and the flow entry is deleted.
  • the notification includes a flow entry capacity deleted by the network device and a location in the storage space before the deleted flow entry is deleted.
  • an embodiment of the present invention provides a method for saving a flow entry, where the method includes:
  • the network device sends the storage information of the network device to the controller, where the storage information includes a free space in the storage space used by the network device to store the flow entry;
  • the network device saves the at least one flow entry in a storage space.
  • the method before the sending, by the network device, the storage information of the network device to the controller, the method further includes:
  • the network device returns a response message to the controller according to the request message, where the response message is used to notify the controller of the stored information on the network device.
  • the request message is an extended multipart Multipart request message of an OpenFlow OpenFlow protocol, where the extended Multipart request message includes a type. a Type field and a request body Body field, the Type field carrying a type value indicating that the information is stored, the request Body field is empty or carrying the device identifier;
  • the response message is an extended Multipart response message of the OpenFlow protocol
  • the Multipart response message includes the Type field and a response Body field, the response body
  • the field carries the storage information of the network device.
  • the embodiment of the present invention provides a flow entry storage device, including:
  • a sending unit configured to send, to the controller, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
  • a receiving unit configured to receive at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device;
  • a saving unit configured to save the at least one flow entry in the storage space.
  • the receiving unit is further configured to: before the triggering the sending unit, acquire a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device;
  • the sending unit is specifically configured to: reply, according to the request message, a response message to the controller, where the response message is used to notify the controller of the stored information on the network device.
  • the request message is an extended multi-part Multipart request message of an OpenFlow OpenFlow protocol, where the extended Multipart request message includes a type. a Type field and a request body Body field, the Type field carrying a type value indicating that the information is stored, the request Body field is empty or carrying the device identifier;
  • the response message is an extended Multipart response message of the OpenFlow protocol
  • the Multipart response message includes the Type field and a response Body field
  • the response Body field carries the storage information of the network device.
  • an embodiment of the present invention provides a flow entry delivery system, where the system includes a controller and a network device:
  • the controller is configured to acquire at least one flow entry for implementing a function on a network device, and a device identifier of the network device, and acquire, according to the device identifier, storage information of the network device, where the storage information includes
  • the network device is configured to store a free space in a storage space of the flow entry; compare the total capacity of the free space and the at least one flow entry; if the free space is greater than or equal to the total capacity, according to the The device identifier sends the at least one piece to the network device a flow entry; if the free space is smaller than the total capacity, the at least one flow entry is not sent to the network device;
  • the network device is configured to send the storage information of the network device to the controller, where the storage information includes a free space in the storage space of the network device for storing the flow entry; and receiving at least the issued by the controller A flow entry, the at least one flow entry being used to implement a function on the network device; and storing the at least one flow entry in a storage space.
  • the controller compares the at least one stream before the controller sends the at least one flow entry corresponding to the function to the network device, in order to enable the network device to implement a function.
  • the total capacity of the entry and the storage information of the network device, and the comparison result indicates whether the network device has sufficient free storage space to store the at least one flow entry.
  • the network device has a storage space that is greater than or equal to the flow entry, the at least one flow entry is sent, and the at least one flow entry is not sent when the network device does not have a storage space for storing the flow entry. , the success rate of the flow entry under the controller is improved.
  • Figure 1a is a schematic diagram of a first case of a downstream flow entry
  • FIG. 1b is a schematic diagram of a second case of a downstream flow entry
  • FIG. 1 is a flowchart of a method for sending a flow entry according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for storing information according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a method for sending a flow entry according to an embodiment of the present disclosure
  • FIG. 4 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention.
  • FIG. 5 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention.
  • FIG. 6 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention.
  • FIG. 7 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention.
  • FIG. 8 is a flowchart of a method for saving a flow entry according to an embodiment of the present disclosure
  • FIG. 9 is a flowchart of a method for saving a flow entry according to an embodiment of the present invention.
  • FIG. 10 is a structural diagram of a device for saving a flow entry according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of hardware of a controller according to an embodiment of the present disclosure.
  • FIG. 12 is a schematic structural diagram of hardware of a network device according to an embodiment of the present invention.
  • the controller sends a flow entry to the network device, so that the network device can implement the function by using the received flow entry.
  • the controller does not consider the storage state of the storage space used by the network device to store the flow entry.
  • the controller may still send a flow entry to the network device in order to enable the network device to perform a certain function in the case that the storage space of the network device storage flow entry is insufficient. Because the network device does not have enough storage space at this time, it cannot save or only save some of the received flow entry. As a result, the network device cannot implement the function through the flow entry.
  • FIG. 1a is a schematic diagram of the first case of the lower flow entry.
  • the application English: Application, abbreviation: APP
  • the controller needs to send four flow entries to the network device 1, that is, as shown in FIG. In the storage space where the network device 1 is used to store the flow entry, only the free space for storing three flow entries is stored.
  • the network device 1 can only store at most three of the four flow entries, and the network device 1 cannot implement the function 1 and wastes The storage resource of the network device 1.
  • FIG. 1b is a schematic diagram of a second case of a downstream flow entry.
  • the controller in order for the network device 2 to implement the function 2, the controller needs to send the three flow entry items to the network device 2, that is, the flow entry 2 to be sent, as shown in FIG. 1b;
  • the controller also needs to send the three flow entries to the network device 2, that is, the flow entry 3 to be sent, as shown in FIG. 1b, and the network device 2 is configured to store the storage of the flow entry. There is only free space in the space where four flow entries are stored.
  • FIG. 1b In the case of FIG.
  • the controller simultaneously delivers the to-be-sent flow entry 2 and the pending flow entry 3 to the network device 2, it is possible that the network device 2 uses two of the original free spaces. And storing two of the three flow entries in the to-be-sent flow entry 2, and using the other two of the original free space to store two of the three flow entries in the flow-sending entry 3 . As a result, the network device 2 cannot implement the function 2 and cannot implement the function 3, and wastes the storage resources of the network device 2.
  • the embodiment of the present invention provides a method for sending a flow entry, a method for saving a flow entry, and a related device, and a system, and when the controller implements a function for the network device, the corresponding device is sent to the network device.
  • the controller compares the total capacity of the at least one flow entry with the storage information of the network device, and determines whether the network device has sufficient free storage storage by comparing the results.
  • the at least one flow entry When the network device has a storage space that is greater than or equal to the flow entry, the at least one flow entry is sent, and the at least one flow entry is not sent when the network device does not have a storage space for storing the flow entry. , the success rate of the flow entry under the controller is improved.
  • the storage space of the network device may also allocate specific reserved spaces for specific functions that need to be performed, such as functions with high priority or specific users that need to implement functions on the network device, such as important users or important applications.
  • specific functions such as functions with high priority or specific users that need to implement functions on the network device, such as important users or important applications.
  • the storage space There is reserved storage space dedicated to storing the above flow table entries.
  • the flow table entry may be stored in the non-reserved free space when the non-reserved free space of the storage space is sufficient. Therefore, the probability that the important flow entry can be stored by the network device is ensured as much as possible, and the use efficiency of the storage space is improved.
  • FIG. 1 is a flowchart of a method for sending a flow entry according to an embodiment of the present disclosure, where the method includes:
  • the controller acquires at least one flow entry for implementing a function on the network device and a device identifier of the network device.
  • the flow entry described in the embodiment of the present invention can be understood as being constructed when a user or an application wants to implement a function on the network device.
  • the controller needs to send the flow entry to the network device that is required to be delivered, and the flow entry to be delivered may be at least one flow entry. .
  • the network device may be according to the at least one The flow entry implements the described functionality.
  • the network device may be a forwarding device for performing route forwarding.
  • a forwarding device for performing route forwarding.
  • it may be a switch, a router, or the like that supports the OpenFlow protocol.
  • the controller acquires storage information of the network device according to the device identifier, where the storage information includes a free space in a storage space used by the network device to store a flow entry.
  • the controller may perform a local search by using the device identifier to find the storage information of the corresponding device identifier.
  • the controller may send a request message to the network device according to the device identifier, for requesting to acquire storage information of the network device, and receiving The network device obtains the storage information of the network device carried in the response message according to the response message returned by the request message, and may use the obtained storage information to update the locally stored storage information.
  • the controller may send a request message to the network device according to the device identifier, to request to acquire storage information of the network device, and receive the The network device obtains the response message according to the response message returned by the request message.
  • Storage information of the network device carried in the network can also automatically upload its own storage information to the controller periodically.
  • the storage information may be a parameter for identifying a storage space storage condition specifically used for storing a flow entry in the network device, where the storage space that has been used and the unused storage space may be included. .
  • the main concern in the embodiments of the present invention is the parameters of the free storage space that have not been used for storage.
  • the request message and the response message may be a set new message, or may be a new type defined on the basis of an existing message by extending the protocol.
  • 2 is a flowchart of a method for acquiring a storage information according to an embodiment of the present invention, where the method includes:
  • the controller sends a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device.
  • the controller receives a response message that is sent by the network device according to the request message, where the response message is used to notify the controller of the stored information on the network device.
  • the controller acquires the storage information of the network device from the response message.
  • the embodiment of the present invention further provides that the request message and the response message are obtained by defining a new type on the basis of an existing message by extending the protocol.
  • Multipart Messages can be used between the controller and the network device to transmit status information of the network device.
  • the controller may request to obtain status information of the network device by sending a multipart request message (English: Multipart request) to the network device, and after receiving the Multipart request message, the network device returns a multipart response message to the controller ( English: Multipart reply), and carry the required status message in the Multipart response message.
  • the type value may be set by the type field: "uint16_t type; /*One of the OFPMP_* constants.*/", and different type values correspond to different state information.
  • the type field in the Multipart request message sent by the controller to the network device may be set to the type value 1 corresponding to the status information 1, and if the status information 2 is required, The type field may be set to a class corresponding to the status information 2 Type value 2. That is to say, the content carried in the Multipart request message and the Multipart response message can be controlled by setting the type field.
  • the current OpenFlow protocol does not support the controller to obtain the storage information of the network device from the network device through the Multipart message.
  • the embodiment of the present invention extends the OpenFlow protocol, and defines a new type value for the Multipart request message and the Multipart response message: the storage information (STORAGE), as follows:
  • storage information is defined as a type value, the value of the type value is 14, the body of the Multipart request message having this type value is empty, and the response body field of the Multipart response message has the ofp_storage structure.
  • the ofp_storage structure includes a total capacity and a free capacity of a storage space used by the network device to store a flow entry.
  • the request message in the embodiment corresponding to FIG. 2 may be an extended Multipart request message of the OpenFlow protocol, the extension.
  • the Multipart request message includes a type Type field and a request body field, the Type field carrying a type value indicating storage information, the request The field is empty or carries the device identifier.
  • a function such as verification may be implemented by using the device identifier in the request field.
  • the response message is an extended Multipart response message of the OpenFlow protocol
  • the Multipart response message includes the Type field and a response Body field
  • the response Body field carries the storage information of the network device.
  • the network device when the network device receives the Multipart request message, the network device identifies, by using a type value of the Multipart request message Type field, that the Multipart request message is a request message for requesting to acquire storage information.
  • the network device may generate a Multipart response message corresponding to the Multipart request message, and carry the storage information of the Multipart response message in the response body field of the Multipart response message.
  • the controller When the controller acquires the Multipart response message sent by the network device, the controller identifies, by using a type value of the Multipart response message Type field, the Multipart response message as a response message carrying the storage information, The controller obtains the required storage information from a response body field of the Multipart response message.
  • the controller compares the total capacity of the free space and the at least one flow entry.
  • the comparison is mainly used to determine whether the remaining storage space of the network device is sufficient to store the at least one flow entry. Since the capacity of the flow entry is substantially the same, the storage space can be expressed in units of flow entries. For example, the free space is specifically a unit of three flow entries, and the total capacity of the at least one flow entry is specifically two flow entries, and the comparison result is that the free space is greater than the total capacity.
  • the controller sends the at least one flow entry to the network device according to the device identifier, if the free space is greater than or equal to the total capacity.
  • the controller does not deliver the at least one flow entry to the network device, if the free space is smaller than the total capacity.
  • the controller sends the at least one flow entry to the network device to be stored in the storage space by the network device under normal circumstances.
  • the network device is capable of implementing the function by using the at least one flow entry.
  • the free space is smaller than the total capacity, it can be understood that the free space in the storage space of the network device is insufficient, and the condition for storing the at least one flow entry is not available. In this case, even if the controller sends the at least one flow entry to the network device, the network device cannot save the at least one flow entry or the at least one flow under normal conditions. In the case where there are multiple entries, it is only possible to save at most a part of the at least one flow entry.
  • the network device can save only one of the at least one flow entry, for example, when the at least one flow entry is specifically three flow entries, the network device can only save two of the flow entries, the network The device cannot implement the function that is required to be implemented by the three flow entries according to the saved part of the at least one flow entry, for example, the two flow entries.
  • This situation is in the perspective of the controller, which can be understood as the failure of the downstream flow entry.
  • the at least one flow entry is not sent to the network device, and the network device cannot store the at least one flow entry, or only the at least one flow entry can be stored.
  • the part of the flow table fails to be sent, or the number of occurrences of the failed flow entry cannot be reduced.
  • the storage information may be updated by the controller.
  • the controller When the controller sends the at least one flow entry to the network device, or receives a flow entry deletion notification sent by the network device, the controller updates the storage information, and the flow entry deletion notification is And including a flow entry capacity deleted by the network device and a location where the deleted flow entry is stored in the storage space before being deleted.
  • the controller sends the at least one flow entry to the network device by using the comparison, the controller will correspondingly update the storage information corresponding to the network device, and reduce the free space.
  • the total capacity of the at least one flow entry is increased, and the non-free space or the used space is increased by the total capacity of the at least one flow entry.
  • the controller adds the deleted space entry capacity to the free space, and reduces the non-free space to the deletion.
  • Flow table entry capacity By updating the stored information, the accuracy of the judgment and the comparison can be improved, and the function of improving the success rate of the flow entry under the controller can be improved.
  • the controller compares the total capacity of the at least one flow entry with the at least one flow entry corresponding to the function.
  • the storage information of the network device is used to compare whether the network device has sufficient free storage space to store the at least one flow entry.
  • the at least one flow entry is sent, and the at least one flow entry is not sent when the network device does not have a storage space for storing the flow entry. , the success rate of the flow entry under the controller is improved.
  • FIG. 3 is a flowchart of a method for sending a flow entry according to an embodiment of the present invention.
  • the method includes:
  • the controller acquires at least one flow entry for implementing a function on the network device and a device identifier of the network device, where the at least one flow entry further has a corresponding user identifier.
  • the user identifier may be used to identify that the at least one flow entry is generated by a user or an application configuration, or the user identifier may also be used to identify the at least one flow.
  • the user may refer to a user who uses the network device, for example, a tenant in a data center scenario.
  • the controller searches for the storage information of the network device according to the identifier of the device, where the storage information includes a free space in a storage space used by the network device to store a flow entry, where the storage is used to store a flow.
  • the free space in the storage space of the entry specifically includes reserved free space and non-reserved free space.
  • the reservation described in the embodiment of the present invention may be understood as: in the storage space, a part of the free space is reserved in advance as a reserved space, and the reserved space is used to specifically save the flow entry corresponding to the user identifier.
  • the reserved free space can be understood as a space in the reserved space that has not been used yet.
  • the non-reserved free space can be understood as the reserved space except the reserved space. Other free space outside the free space.
  • the controller determines, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space.
  • the reserved subspace is described as 304.
  • the reserved space may include one or more subspaces.
  • the user identifier A and the user identifier B have a reserved space in the storage space, wherein the portion of the reserved space dedicated to the user identifier A can be understood as the subspace A corresponding to the user identifier A.
  • the portion of the reserved space dedicated to the user identification B can be understood as the subspace B corresponding to the user identification B.
  • the reserved subspace specifically refers to a free space in the subspace reserved for the user identifier that has not been used.
  • the subspace corresponding to the user identifier in the reserved space may be specifically used for storage.
  • the user or the application constructs the generated flow table entry.
  • the subspace corresponding to the user identifier in the reserved space may be specifically used for storage to enable the network device to implement A flow entry for the function.
  • the controller compares the total capacity of the reserved subspace and the at least one flow entry; if the reserved subspace is greater than or equal to the total capacity, performing 305; if the reserved subspace 306 is performed less than the total capacity.
  • the controller sends the at least one flow entry to the network device according to the device identifier.
  • the controller sends the at least one flow entry to the network device, which may be stored by the network device to the In the reserved subspace of the storage space.
  • the network device is capable of implementing the function by using the at least one flow entry.
  • the reserved subspace is smaller than the total capacity, it may be understood that there is not enough free space in the reserved space reserved for the user identifier in the storage space of the network device for storing the at least one piece.
  • Flow entry it may be further determined by comparing whether the non-reserved free space has a condition for storing the at least one flow entry.
  • the controller compares the non-reserved free space with the total capacity; if the non-reserved free space is greater than or equal to the total capacity, perform 305.
  • the flow entry with the corresponding subspace in the reserved space may be further stored in the non-reserved idle if the corresponding subspace does not have sufficient free space.
  • the non-reserved free space can be understood as a free area in the public space of the storage flow entry, that is, the user identifier of the flow entry stored in the non-reserved free space is not limited or limited.
  • the controller has a condition for delivering the at least one flow entry to the network device.
  • controller in 306 passes the comparison, if the non-reserved free space is less than the total capacity, 307 is performed.
  • the controller does not send the at least one flow entry to the network device.
  • not sending the at least one flow entry to the network device may effectively avoid the network.
  • the device cannot store the at least one flow entry, or only a part of the at least one flow entry may cause the failure of the flow entry to be delivered, or the number of occurrences of the failed flow entry may be effectively reduced.
  • the storage space of the network device may also be some specific functions that need to be performed, such as a function having a high priority or a specific user who needs to implement a function on the network device, for example, an important user.
  • the user or the important application allocates a dedicated reservation space, so that the flow entry related to the foregoing, for example, the flow entry related to the specific function, the flow entry generated by the specific user, or the flow entry generated by the important application needs to be delivered to the flow entry.
  • the storage space has a reserved storage space dedicated to storing the flow entry. Moreover, even if the free space of the reserved storage space is insufficient, the flow table entry may be stored in the non-reserved free space when the non-reserved free space of the storage space is sufficient. Therefore, the probability that the important flow entry can be stored by the network device is ensured as much as possible, and the use efficiency of the storage space is improved.
  • the storage information may be used by the controller. Update.
  • the controller When the controller sends the at least one flow entry to the network device, or receives a flow entry deletion notification sent by the network device, the controller updates the storage information, and the flow entry deletion notification is And including a flow entry capacity deleted by the network device and a location where the deleted flow entry is stored in the storage space before being deleted.
  • the corresponding update of the controller corresponds to the storage information of the network device according to different situations.
  • the controller sends the at least one flow entry to the network device if the reserved subspace is greater than or equal to the total capacity, the controller reduces the reserved subspace by the total capacity.
  • the controller If the controller sends the at least one flow entry to the network device, the controller reduces the non-reserved free space if the non-reserved free space is greater than or equal to the total capacity. The total capacity.
  • the controller may update the storage information according to the location of the deleted flow entry stored in the storage space before being deleted. . For example, when the deleted flow entry is stored in the storage space before the deletion, specifically, the corresponding subspace in the reserved space, the controller may increase the reserved subspace of the subspace.
  • the deleted flow entry capacity For example, when the deleted flow entry is deleted before being deleted When the location stored in the storage space is specifically in the non-reserved space, the controller may increase the capacity of the deleted flow entry by adding the unreserved free space.
  • FIG. 4 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present disclosure, where the flow entry sending device 400 includes:
  • the obtaining unit 401 is configured to acquire at least one flow entry for implementing a function on the network device and a device identifier of the network device.
  • the flow entry described in the embodiment of the present invention can be understood as being constructed when a user or an application wants to implement a function on the network device.
  • the controller needs to send the flow entry to the network device that is required to be delivered, and the flow entry to be delivered may be at least one flow entry. .
  • the network device may be according to the at least one The flow entry implements the described functionality.
  • the network device may be a forwarding device for performing route forwarding.
  • the network device may be a switch, a router, or the like that supports the OpenFlow protocol.
  • the searching unit 402 is configured to search, according to the device identifier, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry.
  • the searching unit 402 may perform a local search by using the device identifier to find the storage information of the corresponding device identifier.
  • the searching unit 402 may send a request message to the network device according to the device identifier, for requesting to acquire storage information of the network device. Receiving, by the network device, a response message returned by the request message, to obtain the storage of the network device carried in the response message.
  • the information is stored and the stored information stored locally can be updated with the stored information.
  • the searching unit 402 may send a request message to the network device according to the device identifier, to request to acquire storage information of the network device, and receive The network device obtains the storage information of the network device carried in the response message according to the response message returned by the request message. It should also be noted that the network device can also automatically upload its own storage information to the controller periodically.
  • the storage information may be a parameter for identifying a storage space storage condition specifically used for storing a flow entry in the network device, where the storage space that has been used and the unused storage space may be included. .
  • the main concern in the embodiments of the present invention is the parameters of the free storage space that have not been used for storage.
  • FIG. 5 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention, where the searching unit 402 in the flow entry sending device 400 further include:
  • the sending sub-unit 501 is configured to send a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device.
  • the receiving sub-unit 502 is configured to receive a response message that is sent by the network device according to the request message, where the response message is used to notify the controller of the stored information on the network device.
  • the obtaining subunit 503 is configured to obtain the storage information of the network device from the response message.
  • the embodiment of the present invention further provides that the request message and the response message are obtained by defining a new type on the basis of an existing message by extending the protocol.
  • Multipart messages can be used between the controller and the network device to transmit status information of the network device.
  • the controller may request to obtain status information of the network device by sending a Multipart request message to the network device, and after receiving the Multipart request message, the network device returns a Multipart response message to the controller, and carries the Multipart response message in the Multipart response message.
  • the required status message The Multipart request message and the Multipart response message
  • the type value can be set by the type field: "uint16_t type; /*One of the OFPMP_* constants.*/", and different type values correspond to different state information.
  • the type field in the Multipart request message sent by the controller to the network device may be set to the type value 1 corresponding to the status information 1, and if the status information 2 is required, The type field may be set to correspond to the type value 2 of the status information 2. That is to say, the content carried in the Multipart request message and the Multipart response message can be controlled by setting the type field.
  • the current OpenFlow protocol does not support the controller to obtain the storage information of the network device from the network device through the Multipart message.
  • the embodiment of the present invention extends the OpenFlow protocol, and defines a new type value for the Multipart request message and the Multipart response message: the storage information (STORAGE), as follows:
  • the ofp_storage structure includes The network device is configured to store a total capacity and a free capacity of a storage space of the flow entry.
  • the request message in the embodiment corresponding to FIG. 2 may be an extended Multipart request message of the OpenFlow protocol, the extension.
  • the Multipart request message includes a Type Type field and a Request Body field, the Type field carrying a type value indicating storage information, the request field being empty or carrying the device identification.
  • a function such as verification may be implemented by using the device identifier in the request field.
  • the response message is an extended Multipart response message of the OpenFlow protocol
  • the Multipart response message includes the Type field and a response Body field
  • the response Body field carries the storage information of the network device.
  • the network device when the network device receives the Multipart request message, the network device identifies, by using a type value of the Multipart request message Type field, that the Multipart request message is a request message for requesting to acquire storage information.
  • the network device may generate a Multipart response message corresponding to the Multipart request message, and carry the storage information of the Multipart response message in the response body field of the Multipart response message.
  • the controller When the controller acquires the Multipart response message sent by the network device, the controller identifies, by using a type value of the Multipart response message Type field, the Multipart response message as a response message carrying the storage information, The controller obtains the required storage information from a response body field of the Multipart response message.
  • the comparison unit 403 is configured to compare the total capacity of the free space and the at least one flow entry.
  • the comparison is mainly used to determine whether the remaining storage space of the network device is sufficient to store the at least one flow entry. Since the capacity of the flow entry is substantially the same, the storage space can be expressed in units of flow entries. For example, the free space is specifically a unit of three flow entries, and the total capacity of the at least one flow entry is specifically two flow entries, and the comparison result is that the free space is greater than the total capacity.
  • the trigger sending unit 404 is configured according to the device.
  • the identifier sends the at least one flow entry to the network device.
  • the sending unit 404 does not trigger the sending of the at least one flow entry to the network device.
  • the sending unit 404 sends the at least one flow entry to the network device, which can be stored in the storage space by the network device under normal circumstances.
  • the network device is capable of implementing the function by using the at least one flow entry.
  • the free space is smaller than the total capacity, it can be understood that the free space in the storage space of the network device is insufficient, and the condition for storing the at least one flow entry is not available. In this case, even if the sending unit 404 sends the at least one flow entry to the network device, the network device cannot save the at least one flow entry or the at least one in a normal situation. In the case where there are multiple flow entries, it is only possible to save at most a part of the at least one flow entry.
  • the network device can save only one of the at least one flow entry, for example, when the at least one flow entry is specifically three flow entries, the network device can only save two of the flow entries, the network The device cannot implement the function that is required to be implemented by the three flow entries according to the saved part of the at least one flow entry, for example, the two flow entries.
  • This situation is in the perspective of the controller, which can be understood as the failure of the downstream flow entry.
  • the at least one flow entry is not sent to the network device, and the network device cannot store the at least one flow entry, or only the at least one flow entry can be stored.
  • the part of the flow table fails to be sent, or the number of occurrences of the failed flow entry cannot be reduced.
  • FIG. 6 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention.
  • the flow entry sending device 400 further includes:
  • the updating unit 601 is configured to: when the at least one flow entry is sent to the network device, or when the flow entry deletion notification sent by the network device is received, update the storage information,
  • the flow entry deletion notification includes a flow entry capacity deleted by the network device and a location where the deleted flow entry is stored in the storage space before being deleted.
  • the update unit 601 associates the corresponding update with the storage information of the network device, and is idle.
  • the space reduces the total capacity of the at least one flow entry, and increases the non-free space or the used space by the total capacity of the at least one flow entry.
  • the update unit 601 adds the deleted space entry capacity to the free space, and reduces the deleted traffic entry capacity by the non-free space.
  • the controller compares the total capacity of the at least one flow entry with the at least one flow entry corresponding to the function.
  • the storage information of the network device is used to compare whether the network device has sufficient free storage space to store the at least one flow entry.
  • the at least one flow entry is sent, and the at least one flow entry is not sent when the network device does not have a storage space for storing the flow entry. , the success rate of the flow entry under the controller is improved.
  • the free space in the storage space for storing the flow entry specifically includes a reserved free space and a non-reserved free space, and the at least one flow entry further has a corresponding user identifier.
  • the reservation described in the embodiment of the present invention may be understood as: in the storage space, a part of the free space is reserved in advance as a reserved space, and the reserved space is used to specifically save the flow entry corresponding to the user identifier.
  • the reserved free space can be understood as a space in the reserved space that has not been used yet.
  • the non-reserved free space can be understood as other free space in the free space except the reserved free space.
  • the user identifier may be used to identify that the at least one flow entry is determined by a certain A user or an application configuration is generated, or the user identifier may also be used to identify the function corresponding to the at least one flow entry.
  • the user may refer to a user who uses the network device, for example, a tenant in a data center scenario.
  • FIG. 7 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention.
  • the controller 400 further includes:
  • the determining unit 701 is configured to determine, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space.
  • the reserved space may include one or more subspaces.
  • the user identifier A and the user identifier B have a reserved space in the storage space, wherein the portion of the reserved space dedicated to the user identifier A can be understood as the subspace A corresponding to the user identifier A.
  • the portion of the reserved space dedicated to the user identification B can be understood as the subspace B corresponding to the user identification B.
  • the reserved subspace specifically refers to a free space in the subspace reserved for the user identifier that has not been used.
  • the subspace corresponding to the user identifier in the reserved space may be specifically used for storage.
  • the user or the application constructs the generated flow table entry.
  • the subspace corresponding to the user identifier in the reserved space may be specifically used for storage to enable the network device to implement A flow entry for the function.
  • the first comparison subunit 702 included in the comparison unit 403 is triggered.
  • the first comparison sub-unit 702 is configured to compare the total capacity of the reserved subspace and the at least one flow entry.
  • the sending unit 404 is configured to send the at least one flow entry to the network device according to the device identifier.
  • the sending unit 404 sends the at least one flow entry to the network device, which can be stored by the network device in the reserved subspace of the storage space under normal circumstances.
  • the network device is capable of implementing the function by using the at least one flow entry.
  • the reserved subspace is smaller than the total capacity, it may be understood that there is not enough free space in the reserved space reserved for the user identifier in the storage space of the network device for storing the at least one piece.
  • Flow entry it may be further determined by comparing whether the non-reserved free space has a condition for storing the at least one flow entry.
  • the second comparison subunit included in the comparison unit 403 is triggered. 703,
  • the second comparison sub-unit 703 is configured to compare the non-reserved free space with the total capacity.
  • the sending unit 404 is configured to send the at least one flow entry to the network device according to the device identifier.
  • the flow entry with the corresponding subspace in the reserved space may be further stored in the non-reserved idle if the corresponding subspace does not have sufficient free space.
  • the non-reserved free space can be understood as a free area in the public space of the storage flow entry, that is, the user identifier of the flow entry stored in the non-reserved free space is not limited or limited.
  • the sending unit 404 has a condition for delivering the at least one flow entry to the network device.
  • the sending unit 404 does not trigger the sending of the at least one flow entry to the network device.
  • the at least one flow entry may not be sent to the network device.
  • the failure of the network device to store the at least one flow entry, or only the part of the at least one flow entry may cause the failure of the flow entry to be delivered, or the flow entry may be effectively reduced. The number of occurrences of failure.
  • the storage space of the network device may also allocate specific reserved spaces for specific functions that need to be performed, such as functions with high priority or specific users that need to implement functions on the network device, such as important users or important applications.
  • specific functions such as functions with high priority or specific users that need to implement functions on the network device, such as important users or important applications.
  • the storage space There is reserved storage space dedicated to storing the above flow table entries.
  • the flow table entry may be stored in the non-reserved free space when the non-reserved free space of the storage space is sufficient. Therefore, the probability that the important flow entry can be stored by the network device is ensured as much as possible, and the use efficiency of the storage space is improved.
  • the following further describes how the storage information is used by the update unit when the storage space has a reserved space and a non-reserved space, and the storage information is saved in the controller. 601 is updated.
  • the update unit 601 sends the at least one flow entry to the network device, or receives the flow entry deletion notification sent by the network device, the update information is updated, and the flow entry is deleted.
  • the notification includes a flow entry capacity deleted by the network device and a location in the storage space before the deleted flow entry is deleted.
  • the update unit 601 correspondingly updates the storage information corresponding to the network device according to different situations.
  • the sending unit 304 sends the at least one flow entry to the network device if the reserved subspace is greater than or equal to the total capacity, and the updating unit 401 reduces the reserved subspace.
  • the total capacity The total capacity.
  • the sending unit 404 sends the at least one flow entry to the network device, and the update unit 401 stores the non-reserved idle. Space reduces the total capacity.
  • the update unit 601 may perform the storage information according to the location of the deleted flow entry stored in the storage space before being deleted. Update. For example, when the deleted flow entry is stored in the storage space before the deletion, specifically, the corresponding subspace in the reserved space, the update unit 601 may reserve the subspace of the subspace. Increase the capacity of the deleted flow entry. For example, when the deleted flow entry is specifically stored in the non-reserved space before being deleted, the update unit 601 may add the unreserved free space to the deleted flow. Entry capacity. By updating the stored information, the accuracy of the judgment and the comparison can be improved, and the function of improving the success rate of the flow entry under the controller can be improved.
  • FIG. 8 is a flowchart of a method for saving a flow entry according to an embodiment of the present disclosure, where the method includes:
  • the network device sends, to the controller, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry.
  • the network device receives at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device.
  • the network device saves the at least one flow entry in a storage space.
  • FIG. 9 is a flowchart of a method for saving a flow entry according to an embodiment of the present disclosure, including:
  • the network device acquires a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device.
  • the network device sends a response message to the controller according to the request message, where the response message is used to notify the controller of the storage information on the network device.
  • the network device receives at least one flow entry that is sent by the controller, where the at least one A flow entry is used to implement a function on the network device.
  • the network device saves the at least one flow entry in a storage space.
  • the request message is an extended Multipart request message of the OpenFlow protocol, where the extended Multipart request message includes a Type field and a request Body field, where the Type field carries a type value indicating that the information is stored, the request Body field Empty or carry the device identification;
  • the response message is an extended Multipart response message of the OpenFlow protocol
  • the Multipart response message includes the Type field and a response Body field
  • the response Body field carries the storage information of the network device.
  • FIG. 10 is a structural diagram of a device for saving a flow entry according to an embodiment of the present invention.
  • the flow entry storage device 1000 includes:
  • the sending unit 1001 is configured to send, to the controller, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry.
  • the receiving unit 1002 is configured to receive at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device.
  • the saving unit 1003 is configured to save the at least one flow entry in the storage space.
  • the receiving unit 1002 is further configured to: before the triggering the sending unit 1001, acquire a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device.
  • the sending unit 1001 is specifically configured to reply a response message to the controller according to the request message, where the response message is used to notify the controller of the storage information on the network device.
  • the request message is an extended Multipart request message of the OpenFlow protocol, where the extended Multipart request message includes a Type field and a request Body field, where the Type field carries a type value indicating that the information is stored, the request Body field Empty or carry the device identification;
  • the response message is an extended Multipart response message of the OpenFlow protocol
  • the Multipart response message includes the Type field and a response Body field
  • the response Body field carries the storage information of the network device.
  • the embodiment of the invention further provides a flow entry delivery system, where the system includes a controller and a network device:
  • the controller is configured to acquire at least one flow entry for implementing a function on a network device, and a device identifier of the network device, and acquire, according to the device identifier, storage information of the network device, where the storage information includes
  • the network device is configured to store a free space in a storage space of the flow entry; compare the total capacity of the free space and the at least one flow entry; if the free space is greater than or equal to the total capacity, according to the The device identifier sends the at least one flow entry to the network device; if the free space is smaller than the total capacity, the at least one flow entry is not sent to the network device.
  • the network device is configured to send the storage information of the network device to the controller, where the storage information includes a free space in the storage space of the network device for storing the flow entry; and receiving at least the issued by the controller A flow entry, the at least one flow entry being used to implement a function on the network device; and storing the at least one flow entry in a storage space.
  • FIG. 11 is a schematic diagram of a hardware structure of a controller according to an embodiment of the present invention.
  • the controller 1100 includes a memory 1101, a receiver 1102, and a transmitter 1103, and the receiving and the receiving, respectively.
  • the processor 1104 is connected to the processor 1104.
  • the memory 1101 is configured to store a set of program instructions, and the processor 1104 is configured to invoke the program instructions stored by the memory 1101 to perform the following operations:
  • the storage information includes a free space in a storage space used by the network device to store a flow entry
  • the transmitter 1103 is configured to send the at least one flow entry to the network device according to the device identifier;
  • the transmitter 1103 is not triggered to deliver the at least one flow entry to the network device.
  • the processor 1104 may be a central processing unit (CPU), and the memory 1101 may be an internal memory of a random access memory (RAM) type, the receiver 1102 and The transmitter 1103 may include a common physical interface, and the physical interface may be an Ethernet interface or an Asynchronous Transfer Mode (ATM) interface.
  • the processor 1104, the transmitter 1103, the receiver 1102, and the memory 1101 may be integrated into one or more independent circuits or hardware, such as an Application Specific Integrated Circuit (ASIC).
  • ASIC Application Specific Integrated Circuit
  • FIG. 12 is a schematic diagram of a hardware structure of a network device according to an embodiment of the present invention.
  • the network device 1200 includes a memory 1201, a receiver 1202, and a transmitter 1203, and the receiving and the receiving, respectively.
  • the processor 1204 is connected to the processor 1203.
  • the memory 1201 is configured to store a set of program instructions.
  • the processor 1204 is configured to invoke the program instructions stored by the memory 1201 to perform the following operations:
  • the transmitter 1203 is configured to receive at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device;
  • the at least one flow entry is saved in the storage space.
  • the processor 1204 may be a CPU, and the memory 1201 may be a RAM type.
  • the internal memory, the receiver 1202 and the transmitter 1203 may comprise a common physical interface, and the physical interface may be an Ethernet interface or an ATM interface.
  • the processor 1204, the transmitter 1203, the receiver 1202, and the memory 1201 may be integrated into one or more separate circuits or hardware, such as an ASIC.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Disclosed are a flow entry issuing method, a flow entry storage method, a relevant apparatus and a system. The flow entry storage method comprises: a controller acquiring at least one flow entry for realizing a function on a network device and a device identifier of the network device; the controller acquiring storage information about the network device according to the device identifier, wherein the storage information comprises a free space in a storage space of the network device for storing flow entries; the controller comparing the free space with the total capacity of the at least one flow entry; and determining whether the network device has enough free storage space to store the at least one flow entry according to a comparison result. When the network device has a storage space greater than or equal to the flow entry, the at least one flow entry is issued; and when the network device does not have storage space for storing flow entries, the at least one flow entry is not issued, thereby improving the success rate for issuing a flow entry by the controller.

Description

一种流表项下发方法、流表项保存方法、相关装置和系统Flow table item delivery method, flow table item storage method, related device and system
本申请要求于2015年6月12日提交中国专利局、申请号为CN 201510323801.6、发明名称为“一种流表项下发方法、流表项保存方法、相关装置和系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims to be submitted to the Chinese Patent Office on June 12, 2015, the application number is CN 201510323801.6, and the invention name is “a flow table item delivery method, flow table item preservation method, related device and system”. Priority is hereby incorporated by reference in its entirety.
技术领域Technical field
本发明涉及通信领域,特别是涉及一种流表项下发方法、流表项保存方法、相关装置和系统。The present invention relates to the field of communications, and in particular, to a method for delivering a flow entry, a method for saving a flow entry, and a related device and system.
背景技术Background technique
控制器为网络设备下发流表项,使得网络设备可以根据获取的流表项执行相应的功能例如转发、丢弃报文等。为了能够让网络设备实现某一项功能,控制器需要向所述网络设备下发与该功能相关的一条或者多条流表项。网络设备一般会划定专用的存储空间专门用于存储控制器下发的流表项。The controller sends a flow entry to the network device, so that the network device can perform corresponding functions, such as forwarding, discarding, and the like according to the obtained flow entry. In order to enable the network device to implement a certain function, the controller needs to send one or more flow entries related to the function to the network device. A network device generally allocates a dedicated storage space for the flow table entry delivered by the controller.
现有技术在控制器向网络设备下发流表项的过程中,控制器并不会考虑该网络设备用于存储流表项的存储空间的存储状况。可能会出现在网络设备存储流表项的存储空间不足的情况下,控制器依然为了使该网络设备执行某一功能向该网络设备下发流表项。由于这时该网络设备没有足够存储空间,无法保存或只能保存部分接收到的流表项。导致该网络设备无法实现该功能,造成控制器下发流表项失败。In the prior art, in the process of the controller sending a flow entry to the network device, the controller does not consider the storage state of the storage space used by the network device to store the flow entry. The controller may still send a flow entry to the network device in order to enable the network device to perform a certain function in the case that the storage space of the network device storage flow entry is insufficient. Because the network device does not have enough storage space at this time, it cannot save or only save some of the received flow entry. The function of the network device fails to be implemented.
提高控制器下发流表项的成功率是需要解决的技术问题。Increasing the success rate of the flow entry under the controller is a technical problem that needs to be solved.
发明内容Summary of the invention
为了解决上述技术问题,本发明实施例提供了一种流表项下发方法、流表项保存方法、相关装置和系统,以使得控制器在在所述空闲空间小于所述 总容量时不向所述网络设备下发所述流表项,提高了控制器下发流表项的成功率。In order to solve the above technical problem, an embodiment of the present invention provides a method for sending a flow entry, a method for saving a flow entry, a related device, and a system, so that the controller is smaller than the free space in the free space. The flow entry is not sent to the network device in the total capacity, which improves the success rate of the flow entry sent by the controller.
第一方面,本发明实施例提供了一种流表项下发方法,所述方法包括:In a first aspect, an embodiment of the present invention provides a method for delivering a flow entry, where the method includes:
控制器获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识;The controller acquires at least one flow entry for implementing a function on the network device and a device identifier of the network device;
所述控制器根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;Obtaining, by the controller, the storage information of the network device according to the device identifier, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
所述控制器比对所述空闲空间与所述至少一条流表项的总容量;The controller compares the total capacity of the free space and the at least one flow entry;
若所述空闲空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项;And the controller sends the at least one flow entry to the network device according to the device identifier, if the free space is greater than or equal to the total capacity;
若所述空闲空间小于所述总容量,所述控制器不向所述网络设备下发所述至少一条流表项。The controller does not deliver the at least one flow entry to the network device if the free space is smaller than the total capacity.
在第一方面的第一种可能的实现方式中,所述用于存储流表项的存储空间中的空闲空间具体包括预留空闲空间和非预留空闲空间,所述至少一条流表项还具有对应的用户标识,所述方法还包括:In a first possible implementation manner of the first aspect, the free space in the storage space for storing the flow entry specifically includes a reserved free space and a non-reserved free space, where the at least one flow entry is further Having a corresponding user identifier, the method further includes:
所述控制器根据所述用户标识判断所述存储空间中是否具有所述用户标识对应的预留子空间,所述预留子空间为部分或全部所述预留空闲空间;Determining, by the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space;
若具有所述预留子空间,所述控制器比对所述空闲空间与所述至少一条流表项的总容量,包括:If the reserved subspace is available, the controller compares the total capacity of the free space and the at least one flow entry, including:
所述控制器比对所述预留子空间与所述至少一条流表项的总容量;The controller compares the total capacity of the reserved subspace and the at least one flow entry;
若所述预留子空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项;If the reserved subspace is greater than or equal to the total capacity, the controller sends the at least one flow entry to the network device according to the device identifier;
若所述预留子空间小于所述总容量,所述控制器比对所述非预留空闲空间与所述总容量;If the reserved subspace is smaller than the total capacity, the controller compares the non-reserved free space with the total capacity;
若所述非预留空闲空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项;And the controller sends the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
若所述非预留空闲空间小于所述总容量,所述控制器不向所述网络设备 下发所述至少一条流表项。If the non-reserved free space is less than the total capacity, the controller does not go to the network device The at least one flow entry is delivered.
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中,所述控制器根据所述用户标识判断所述存储空间中是否具有所述用户标识对应的预留子空间,还包括:With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the controller determines, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier. ,Also includes:
若不具有所述预留子空间,所述控制器比对所述非预留空闲空间与所述总容量;If the reserved subspace is not provided, the controller compares the non-reserved free space with the total capacity;
若所述非预留空闲空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项;And the controller sends the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
若所述非预留空闲空间小于所述总容量,所述控制器不向所述网络设备下发所述至少一条流表项。The controller does not deliver the at least one flow entry to the network device, if the non-reserved free space is smaller than the total capacity.
结合第一方面或者第一方面的第一种或第二种可能的实现方式,在第三种可能的实现方式中,所述控制器根据所述设备标识获取所述网络设备的存储信息,包括:With reference to the first aspect, or the first or the second possible implementation manner of the first aspect, in a third possible implementation manner, the controller acquires, according to the device identifier, the storage information of the network device, including :
所述控制器根据所述设备标识向所述网络设备发送请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息;Sending, by the controller, a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device;
所述控制器接收所述网络设备根据所述请求消息回复的应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息;Receiving, by the controller, a response message that is replied by the network device according to the request message, where the response message is used to notify the controller of the storage information on the network device;
所述控制器从所述应答消息中获取所述网络设备的所述存储信息。The controller acquires the storage information of the network device from the response message.
结合第一方面的第三种可能的实现方式,在第四种可能的实现方式中,所述请求消息是OpenFlow协议的扩展的Multipart请求消息,所述扩展的Multipart请求消息包括Type字段和请求Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;With reference to the third possible implementation manner of the foregoing aspect, in a fourth possible implementation manner, the request message is an extended Multipart request message of an OpenFlow protocol, where the extended Multipart request message includes a Type field and a request body a field, the Type field carrying a type value indicating that the information is stored, the request body field is empty or carrying the device identifier;
相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
结合第一方面或者第一方面的第一种或第二种或第三种或第四种可能的实现方式,在第五种可能的实现方式中,还包括: In combination with the first aspect or the first or second or the third or the fourth possible implementation of the first aspect, in a fifth possible implementation, the method further includes:
所述控制器在向所述网络设备下发所述至少一条流表项,或者接收到所述网络设备发送的流表项删除通知时,相应更新所述存储信息,所述流表项删除通知包括所述网络设备删除的流表项容量和所述删除的流表项在被删除前在所述存储空间中所存储的位置。When the controller sends the at least one flow entry to the network device, or receives a flow entry deletion notification sent by the network device, the controller updates the storage information, and the flow entry deletion notification is And including a flow entry capacity deleted by the network device and a location where the deleted flow entry is stored in the storage space before being deleted.
第二方面,本发明实施例提供了一种流表项下发装置,所述流表项下发装置包括:In a second aspect, the embodiment of the present invention provides a flow entry delivery device, where the flow entry delivery device includes:
获取单元,用于获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识;An obtaining unit, configured to acquire at least one flow entry for implementing a function on the network device, and a device identifier of the network device;
查找单元,用于根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;a searching unit, configured to acquire, according to the device identifier, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
比对单元,用于比对所述空闲空间与所述至少一条流表项的总容量;a comparison unit, configured to compare the total capacity of the free space and the at least one flow entry;
若所述空闲空间大于等于所述总容量,触发发送单元根据所述设备标识向所述网络设备下发所述至少一条流表项;If the vacant space is greater than or equal to the total capacity, the trigger sending unit sends the at least one flow entry to the network device according to the device identifier;
若所述空闲空间小于所述总容量,不触发所述发送单元向所述网络设备下发所述至少一条流表项。If the free space is smaller than the total capacity, the sending unit does not trigger the sending of the at least one flow entry to the network device.
在第二方面的第一种可能的实现方式中,所述用于存储流表项的存储空间中的空闲空间具体包括预留空闲空间和非预留空闲空间,所述至少一条流表项还具有对应的用户标识,还包括:In a first possible implementation manner of the second aspect, the free space in the storage space for storing the flow entry specifically includes a reserved free space and a non-reserved free space, where the at least one flow entry is further Has a corresponding user ID, and also includes:
判断单元,用于根据所述用户标识判断所述存储空间中是否具有所述用户标识对应的预留子空间,所述预留子空间为部分或全部所述预留空闲空间;a determining unit, configured to determine, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space;
若具有所述预留子空间,触发所述比对单元所包括的第一比对子单元,If the reserved subspace is provided, triggering the first comparison subunit included in the comparison unit,
所述第一比对子单元,用于比对所述预留子空间与所述至少一条流表项的总容量;The first comparison subunit is configured to compare the total capacity of the reserved subspace and the at least one flow entry;
若所述预留子空间大于等于所述总容量,触发所述发送单元根据所述设备标识向所述网络设备下发所述至少一条流表项;If the reserved subspace is greater than or equal to the total capacity, the sending unit is configured to send the at least one flow entry to the network device according to the device identifier;
若所述预留子空间小于所述总容量,触发所述比对单元所包括的第二比对子单元, If the reserved subspace is smaller than the total capacity, triggering a second comparison subunit included in the comparison unit,
所述第二比对子单元,用于比对所述非预留空闲空间与所述总容量;The second comparison subunit is configured to compare the non-reserved free space with the total capacity;
若所述非预留空闲空间大于等于所述总容量,触发所述发送单元根据所述设备标识向所述网络设备下发所述至少一条流表项;And sending, by the sending unit, the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
若所述非预留空闲空间小于所述总容量,不触发所述发送单元向所述网络设备下发所述至少一条流表项。And sending, by the sending unit, the at least one flow entry to the network device, if the non-reserved free space is smaller than the total capacity.
结合第二方面的第一种可能的实现方式,在第二种可能的实现方式中,还包括:In conjunction with the first possible implementation of the second aspect, in a second possible implementation manner, the method further includes:
若所述判断单元的判断结果为不具有所述预留子空间,触发所述第二比对子单元;If the judgment result of the determining unit is that the reserved subspace is not provided, the second comparison subunit is triggered;
若所述非预留空闲空间大于等于所述总容量,触发所述发送单元根据所述设备标识向所述网络设备下发所述至少一条流表项;And sending, by the sending unit, the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
若所述非预留空闲空间小于所述总容量,不触发所述发送单元向所述网络设备下发所述至少一条流表项。And sending, by the sending unit, the at least one flow entry to the network device, if the non-reserved free space is smaller than the total capacity.
结合第二方面或者第二方面的第一种或第二种可能的实现方式,在第三种可能的实现方式中,所述查找单元还包括:With reference to the second aspect, or the first or the second possible implementation manner of the second aspect, in a third possible implementation, the searching unit further includes:
发送子单元,用于根据所述设备标识向所述网络设备发送请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息;a sending subunit, configured to send a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device;
接收子单元,用于接收所述网络设备根据所述请求消息回复的应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息;a receiving subunit, configured to receive a response message that is sent by the network device according to the request message, where the response message is used to notify the controller of the storage information on the network device;
获取子单元,用于从所述应答消息中获取所述网络设备的所述存储信息。And obtaining a subunit, configured to acquire the storage information of the network device from the response message.
结合第二方面的第三种可能的实现方式,在第四种可能的实现方式中,所述请求消息是开放流OpenFlow协议的扩展的多部分Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求主体Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner, the request message is an extended multipart Multipart request message of an OpenFlow OpenFlow protocol, where the extended Multipart request message includes a type. a Type field and a request body Body field, the Type field carrying a type value indicating that the information is stored, the request Body field is empty or carrying the device identifier;
相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body 字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, and the Multipart response message includes the Type field and a response Body field, the response body The field carries the storage information of the network device.
结合第二方面或者第二方面的第一种或第二种或第三种或第四种可能的实现方式,在第五种可能的实现方式中,还包括:With reference to the second aspect or the first or second or the third or the fourth possible implementation manner of the second aspect, in a fifth possible implementation manner, the method further includes:
更新单元,用于在向所述网络设备下发所述至少一条流表项,或者接收到所述网络设备发送的流表项删除通知时,相应更新所述存储信息,所述流表项删除通知包括所述网络设备删除的流表项容量和所述删除的流表项在被删除前在所述存储空间中所存储的位置。And an update unit, configured to: when the at least one flow entry is sent to the network device, or the flow entry deletion notification sent by the network device is received, the storage information is updated, and the flow entry is deleted. The notification includes a flow entry capacity deleted by the network device and a location in the storage space before the deleted flow entry is deleted.
第三方面,本发明实施例提供了一种流表项保存方法,所述方法包括:In a third aspect, an embodiment of the present invention provides a method for saving a flow entry, where the method includes:
网络设备向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;The network device sends the storage information of the network device to the controller, where the storage information includes a free space in the storage space used by the network device to store the flow entry;
所述网络设备接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能;Receiving, by the network device, at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device;
所述网络设备将所述至少一条流表项保存在存储空间中。The network device saves the at least one flow entry in a storage space.
在第三方面的第一种可能的实现方式中,在所述网络设备向控制器发送所述网络设备的存储信息之前,还包括:In a first possible implementation manner of the third aspect, before the sending, by the network device, the storage information of the network device to the controller, the method further includes:
所述网络设备获取所述控制器发送的请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息;Obtaining, by the network device, a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device;
所述网络设备向控制器发送所述网络设备的存储信息,包括:Sending, by the network device, the storage information of the network device to the controller, including:
所述网络设备根据所述请求消息向所述控制器回复应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息。And the network device returns a response message to the controller according to the request message, where the response message is used to notify the controller of the stored information on the network device.
结合第三方面的第一种可能的实现方式,在第二种可能的实现方式中,所述请求消息是开放流OpenFlow协议的扩展的多部分Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求主体Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;With reference to the first possible implementation manner of the third aspect, in a second possible implementation manner, the request message is an extended multipart Multipart request message of an OpenFlow OpenFlow protocol, where the extended Multipart request message includes a type. a Type field and a request body Body field, the Type field carrying a type value indicating that the information is stored, the request Body field is empty or carrying the device identifier;
相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body 字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, and the Multipart response message includes the Type field and a response Body field, the response body The field carries the storage information of the network device.
第四方面,本发明实施例提供了一种流表项保存装置,包括:In a fourth aspect, the embodiment of the present invention provides a flow entry storage device, including:
发送单元,用于向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;a sending unit, configured to send, to the controller, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
接收单元,用于接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能;a receiving unit, configured to receive at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device;
保存单元,用于将所述至少一条流表项保存在存储空间中。And a saving unit, configured to save the at least one flow entry in the storage space.
在第四方面的第一种可能的实现方式中,In a first possible implementation of the fourth aspect,
所述接收单元还用于在触发所述发送单元之前,获取所述控制器发送的请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息;The receiving unit is further configured to: before the triggering the sending unit, acquire a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device;
所述发送单元具体用于根据所述请求消息向所述控制器回复应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息。The sending unit is specifically configured to: reply, according to the request message, a response message to the controller, where the response message is used to notify the controller of the stored information on the network device.
结合第四方面的第一种可能的实现方式,在第二种可能的实现方式中,所述请求消息是开放流OpenFlow协议的扩展的多部分Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求主体Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;With reference to the first possible implementation manner of the fourth aspect, in a second possible implementation manner, the request message is an extended multi-part Multipart request message of an OpenFlow OpenFlow protocol, where the extended Multipart request message includes a type. a Type field and a request body Body field, the Type field carrying a type value indicating that the information is stored, the request Body field is empty or carrying the device identifier;
相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
第五方面,本发明实施例提供了一种流表项下发系统,所述系统包括控制器和网络设备:In a fifth aspect, an embodiment of the present invention provides a flow entry delivery system, where the system includes a controller and a network device:
所述控制器用于获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识;根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;比对所述空闲空间与所述至少一条流表项的总容量;若所述空闲空间大于等于所述总容量,根据所述设备标识向所述网络设备下发所述至少一条 流表项;若所述空闲空间小于所述总容量,不向所述网络设备下发所述至少一条流表项;The controller is configured to acquire at least one flow entry for implementing a function on a network device, and a device identifier of the network device, and acquire, according to the device identifier, storage information of the network device, where the storage information includes The network device is configured to store a free space in a storage space of the flow entry; compare the total capacity of the free space and the at least one flow entry; if the free space is greater than or equal to the total capacity, according to the The device identifier sends the at least one piece to the network device a flow entry; if the free space is smaller than the total capacity, the at least one flow entry is not sent to the network device;
所述网络设备用于向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能;将所述至少一条流表项保存在存储空间中。The network device is configured to send the storage information of the network device to the controller, where the storage information includes a free space in the storage space of the network device for storing the flow entry; and receiving at least the issued by the controller A flow entry, the at least one flow entry being used to implement a function on the network device; and storing the at least one flow entry in a storage space.
由上述技术方案可以看出,当控制器为了使得网络设备实现一项功能,向所述网络设备下发对应所述功能的至少一条流表项之前,所述控制器比对所述至少一条流表项的总容量和网络设备的存储信息,通过比对结果明确所述网络设备是否具有足够的空闲存储空间存储所述至少一条流表项。在所述网络设备具有大于等于所述流表项的存储空间时下发所述至少一条流表项,在所述网络设备不具有存储流表项的存储空间时不下发所述至少一条流表项,提高了控制器下发流表项的成功率。According to the foregoing technical solution, the controller compares the at least one stream before the controller sends the at least one flow entry corresponding to the function to the network device, in order to enable the network device to implement a function. The total capacity of the entry and the storage information of the network device, and the comparison result indicates whether the network device has sufficient free storage space to store the at least one flow entry. When the network device has a storage space that is greater than or equal to the flow entry, the at least one flow entry is sent, and the at least one flow entry is not sent when the network device does not have a storage space for storing the flow entry. , the success rate of the flow entry under the controller is improved.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any inventive labor.
图1a为下发流表项的第一种情况示意图;Figure 1a is a schematic diagram of a first case of a downstream flow entry;
图1b为下发流表项的第二种情况示意图;FIG. 1b is a schematic diagram of a second case of a downstream flow entry;
图1为本发明实施例提供的一种流表项下发方法的方法流程图;FIG. 1 is a flowchart of a method for sending a flow entry according to an embodiment of the present invention;
图2为本发明实施例提供的一种存储信息获取方法的方法流程图;2 is a flowchart of a method for storing information according to an embodiment of the present invention;
图3为本发明实施例提供的一种流表项下发方法的方法流程图;FIG. 3 is a flowchart of a method for sending a flow entry according to an embodiment of the present disclosure;
图4为本发明实施例提供的一种流表项下发装置的装置结构图;4 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention;
图5为本发明实施例提供的一种流表项下发装置的装置结构图;FIG. 5 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention;
图6为本发明实施例提供的一种流表项下发装置的装置结构图; FIG. 6 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention;
图7为本发明实施例提供的一种流表项下发装置的装置结构图;FIG. 7 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention;
图8为本发明实施例提供的一种流表项保存方法的方法流程图;FIG. 8 is a flowchart of a method for saving a flow entry according to an embodiment of the present disclosure;
图9为本发明实施例提供的一种流表项保存方法的方法流程图;FIG. 9 is a flowchart of a method for saving a flow entry according to an embodiment of the present invention;
图10为本发明实施例提供的一种流表项保存装置的装置结构图;FIG. 10 is a structural diagram of a device for saving a flow entry according to an embodiment of the present disclosure;
图11为本发明实施例提供的一种控制器的硬件结构示意图;FIG. 11 is a schematic structural diagram of hardware of a controller according to an embodiment of the present disclosure;
图12为本发明实施例提供的一种网络设备的硬件结构示意图。FIG. 12 is a schematic structural diagram of hardware of a network device according to an embodiment of the present invention.
具体实施方式detailed description
控制器通过向网络设备下发流表项,使得网络设备可以通过接收的流表项实现功能。在控制器向网络设备下发流表项的过程中,控制器并不会考虑该网络设备用于存储流表项的存储空间的存储状况。可能会出现在网络设备存储流表项的存储空间不足的情况下,控制器依然为了使该网络设备执行某一功能向该网络设备下发流表项。由于这时该网络设备没有足够存储空间,无法保存或只能保存部分接收到的流表项。导致该网络设备无法通过流表项实现该功能,造成控制器下发流表项失败。The controller sends a flow entry to the network device, so that the network device can implement the function by using the received flow entry. During the process of sending a flow entry to the network device by the controller, the controller does not consider the storage state of the storage space used by the network device to store the flow entry. The controller may still send a flow entry to the network device in order to enable the network device to perform a certain function in the case that the storage space of the network device storage flow entry is insufficient. Because the network device does not have enough storage space at this time, it cannot save or only save some of the received flow entry. As a result, the network device cannot implement the function through the flow entry.
进一步以具体场景为例,通过附图说明传统方式存在的问题,图1a为下发流表项的第一种情况示意图。在图1a中,应用程序(英文:Application,缩写:APP)1为了使网络设备1实现功能1,需要让控制器向网络设备1下发四条流表项即如1a中所示的待下发流表项1,而网络设备1用于存储流表项的存储空间中只有存储三条流表项的空闲空间。图1a的情况下,如控制器下发所述待下发流表项1,网络设备1最多只能存储四条流表项其中的三个,既无法让网络设备1实现功能1,也浪费了网络设备1的存储资源。Taking the specific scenario as an example, the problem existing in the conventional mode is illustrated by the following figure, and FIG. 1a is a schematic diagram of the first case of the lower flow entry. In FIG. 1a, the application (English: Application, abbreviation: APP) 1 is required to enable the network device 1 to implement the function 1. The controller needs to send four flow entries to the network device 1, that is, as shown in FIG. In the storage space where the network device 1 is used to store the flow entry, only the free space for storing three flow entries is stored. In the case of FIG. 1a, if the controller sends the flow entry 1 to be sent, the network device 1 can only store at most three of the four flow entries, and the network device 1 cannot implement the function 1 and wastes The storage resource of the network device 1.
图1b为下发流表项的第二种情况示意图。在图1b中,APP2为了使网络设备2实现功能2,需要让控制器向网络设备2下发三条流表项即如1b中所示的待下发流表项2;于此同时,APP3为了使网络设备2实现功能3,也需要让控制器向网络设备2下发三条流表项即如1b中所示的待下发流表项3,而网络设备2用于存储流表项的存储空间中只有存储四条流表项的空闲空间。 在图1b的情况下,若控制器同时向网络设备2下发所述待下发流表项2和待下发流表项3,有可能会出现网络设备2使用原空闲空间中的两个来存储所述待下发流表项2中三条流表项中的两个,使用原空闲空间中的另外两个来存储所述待下发流表项3中三条流表项中的两个。由此导致网络设备2即无法实现功能2也无法实现功能3,又浪费了网络设备2的存储资源。FIG. 1b is a schematic diagram of a second case of a downstream flow entry. In FIG. 1b, in order for the network device 2 to implement the function 2, the controller needs to send the three flow entry items to the network device 2, that is, the flow entry 2 to be sent, as shown in FIG. 1b; For the network device 2 to implement the function 3, the controller also needs to send the three flow entries to the network device 2, that is, the flow entry 3 to be sent, as shown in FIG. 1b, and the network device 2 is configured to store the storage of the flow entry. There is only free space in the space where four flow entries are stored. In the case of FIG. 1b, if the controller simultaneously delivers the to-be-sent flow entry 2 and the pending flow entry 3 to the network device 2, it is possible that the network device 2 uses two of the original free spaces. And storing two of the three flow entries in the to-be-sent flow entry 2, and using the other two of the original free space to store two of the three flow entries in the flow-sending entry 3 . As a result, the network device 2 cannot implement the function 2 and cannot implement the function 3, and wastes the storage resources of the network device 2.
为此,本发明实施例提供了一种流表项下发方法、流表项保存方法、相关装置和系统,当控制器为了使得网络设备实现一项功能,向所述网络设备下发对应所述功能的至少一条流表项之前,所述控制器比对所述至少一条流表项的总容量和网络设备的存储信息,通过比对结果明确所述网络设备是否具有足够的空闲存储空间存储所述至少一条流表项。在所述网络设备具有大于等于所述流表项的存储空间时下发所述至少一条流表项,在所述网络设备不具有存储流表项的存储空间时不下发所述至少一条流表项,提高了控制器下发流表项的成功率。To this end, the embodiment of the present invention provides a method for sending a flow entry, a method for saving a flow entry, and a related device, and a system, and when the controller implements a function for the network device, the corresponding device is sent to the network device. Before the at least one flow entry of the function, the controller compares the total capacity of the at least one flow entry with the storage information of the network device, and determines whether the network device has sufficient free storage storage by comparing the results. The at least one flow entry. When the network device has a storage space that is greater than or equal to the flow entry, the at least one flow entry is sent, and the at least one flow entry is not sent when the network device does not have a storage space for storing the flow entry. , the success rate of the flow entry under the controller is improved.
所述网络设备的存储空间中还可以为一些需要执行的特定功能例如具有高优先级的功能或者需要在所述网络设备上实现功能的特定用户例如重要用户或者重要App分配专用的预留空间,使得与上述相关的流表项例如与特定功能相关的流表项、由特定用户生成的流表项或者由重要应用生成的流表项需要下发到所述网络设备中时,所述存储空间中有专门用于存储上述流表项的预留存储空间。而且即使预留存储空间的空闲空间不足,可以将上述流表项在所述存储空间的非预留空闲空间足够时存储在非预留空闲空间中。由此尽量保证了重要流表项能够被所述网络设备存储的几率,提高了所述存储空间的使用效率。The storage space of the network device may also allocate specific reserved spaces for specific functions that need to be performed, such as functions with high priority or specific users that need to implement functions on the network device, such as important users or important applications. When the flow entry related to the foregoing, for example, a flow entry related to a specific function, a flow entry generated by a specific user, or a flow entry generated by an important application needs to be delivered to the network device, the storage space There is reserved storage space dedicated to storing the above flow table entries. Moreover, even if the free space of the reserved storage space is insufficient, the flow table entry may be stored in the non-reserved free space when the non-reserved free space of the storage space is sufficient. Therefore, the probability that the important flow entry can be stored by the network device is ensured as much as possible, and the use efficiency of the storage space is improved.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整的描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
实施例一 Embodiment 1
图1为本发明实施例提供的一种流表项下发方法的方法流程图,所述方法包括:FIG. 1 is a flowchart of a method for sending a flow entry according to an embodiment of the present disclosure, where the method includes:
101:控制器获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识。101: The controller acquires at least one flow entry for implementing a function on the network device and a device identifier of the network device.
本发明实施例中所述的流表项可以理解为是用户或者某一项应用希望能在网络设备上实现一项功能时构造生成的。为了网络设备能够实现一项功能需要控制器为该网络设备下发与该功能相关的所有需要下发的流表项,这里所述的所有需要下发的流表项可以为至少一条流表项。当所述至少一条流表项全部成功下发到所述网络设备中或者说被所述网络设备存储到专门用于存储流表项的存储空间后,所述网络设备将可以根据所述至少一条流表项实现所述功能。The flow entry described in the embodiment of the present invention can be understood as being constructed when a user or an application wants to implement a function on the network device. For the network device to implement a function, the controller needs to send the flow entry to the network device that is required to be delivered, and the flow entry to be delivered may be at least one flow entry. . After the at least one flow entry is successfully delivered to the network device or stored by the network device to a storage space dedicated to storing a flow entry, the network device may be according to the at least one The flow entry implements the described functionality.
在本发明实施例中,优选的应用于部署了软件定义网络(英文:Software Defined Network,缩写:SDN)技术的网络中。所述网络设备可以是用于进行路由转发的转发设备。例如可以为支持OpenFlow协议的交换机、路由器等设备。In the embodiment of the present invention, it is preferably applied to a network in which a software defined network (English: Software Defined Network, SDN) technology is deployed. The network device may be a forwarding device for performing route forwarding. For example, it may be a switch, a router, or the like that supports the OpenFlow protocol.
102:所述控制器根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间。102: The controller acquires storage information of the network device according to the device identifier, where the storage information includes a free space in a storage space used by the network device to store a flow entry.
举例说明,若所述控制器在本地已经存储了所述存储信息,那么所述控制器可以通过所述设备标识在本地进行查找,以查找到对应的所述设备标识的所述存储信息。或者,若所述控制器在本地虽然存储了所述存储信息,但所述控制器可以根据所述设备标识向所述网络设备发送请求消息,用于请求获取所述网络设备的存储信息,接收所述网络设备根据所述请求消息返回的应答消息,以此获取所述应答消息中携带的所述网络设备的存储信息并可以用获取的该存储信息来对本地存储的所述存储信息进行更新。或者,若所述控制器在本地并没有存储所述存储信息,所述控制器可以根据所述设备标识向所述网络设备发送请求消息,用于请求获取所述网络设备的存储信息,接收所述网络设备根据所述请求消息返回的应答消息,以此获取所述应答消息 中携带的所述网络设备的存储信息。还需要注意的是,所述网络设备也可以周期性的自动将自身的存储信息上传到所述控制器。For example, if the controller has stored the storage information locally, the controller may perform a local search by using the device identifier to find the storage information of the corresponding device identifier. Alternatively, if the controller stores the storage information locally, the controller may send a request message to the network device according to the device identifier, for requesting to acquire storage information of the network device, and receiving The network device obtains the storage information of the network device carried in the response message according to the response message returned by the request message, and may use the obtained storage information to update the locally stored storage information. . Or, if the controller does not store the storage information locally, the controller may send a request message to the network device according to the device identifier, to request to acquire storage information of the network device, and receive the The network device obtains the response message according to the response message returned by the request message. Storage information of the network device carried in the network. It should also be noted that the network device can also automatically upload its own storage information to the controller periodically.
所述存储信息可以为一种用于标识所述网络设备中专门用于存储流表项的存储空间存储状况的参数,其中可以包括已被使用的存储空间和未被使用的空闲存储空间的参数。在本发明实施例中主要关注的是尚未被用于存储的空闲存储空间的参数。The storage information may be a parameter for identifying a storage space storage condition specifically used for storing a flow entry in the network device, where the storage space that has been used and the unused storage space may be included. . The main concern in the embodiments of the present invention is the parameters of the free storage space that have not been used for storage.
所述请求消息和所述应答消息可以为设定出的一种新的消息,或者也可以为通过对协议的扩展在已有消息的基础上定义出新的类型。图2为本发明实施例提供了一种存储信息获取方法的方法流程图,所述方法包括:The request message and the response message may be a set new message, or may be a new type defined on the basis of an existing message by extending the protocol. 2 is a flowchart of a method for acquiring a storage information according to an embodiment of the present invention, where the method includes:
201:所述控制器根据所述设备标识向所述网络设备发送请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息。201: The controller sends a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device.
202:所述控制器接收所述网络设备根据所述请求消息回复的应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息。202: The controller receives a response message that is sent by the network device according to the request message, where the response message is used to notify the controller of the stored information on the network device.
203:所述控制器从所述应答消息中获取所述网络设备的所述存储信息。203: The controller acquires the storage information of the network device from the response message.
可选的,本发明实施例还提供了一种通过对协议的扩展在已有消息的基础上定义出新的类型的方式得到所述请求消息和应答消息。Optionally, the embodiment of the present invention further provides that the request message and the response message are obtained by defining a new type on the basis of an existing message by extending the protocol.
在OpenFlow协议中,控制器和网络设备之间可以使用多部分消息(Multipart Messages)来传输网络设备的状态信息。控制器可以通过向网络设备发送多部分请求消息(英文:Multipart request)来请求获得该网络设备的状态信息等,该网络设备在收到Multipart请求消息后,向该控制器返回多部分应答消息(英文:Multipart reply),并在该Multipart应答消息中携带所需的状态消息。所述Multipart请求消息和Multipart应答消息的OpenFlow协议格式中,可以通过类型字段:“uint16_t type;/*One of the OFPMP_* constants.*/”设置类型值,不同的类型值对应不同的状态信息。例如若控制器需要从网络设备获取状态信息1,控制器向网络设备发送的Multipart请求消息中的所述类型(Type)字段可以设置为对应状态信息1的类型值1,若需要状态信息2,所述类型字段可以设置为对应状态信息2的类 型值2。也就是说,可以通过对所述类型字段的设置来控制所述Multipart请求消息和Multipart应答消息中携带的内容。但是当前OpenFlow协议中并不支持控制器通过Multipart消息从网络设备获取网络设备的存储信息。In the OpenFlow protocol, Multipart Messages can be used between the controller and the network device to transmit status information of the network device. The controller may request to obtain status information of the network device by sending a multipart request message (English: Multipart request) to the network device, and after receiving the Multipart request message, the network device returns a multipart response message to the controller ( English: Multipart reply), and carry the required status message in the Multipart response message. In the OpenFlow protocol format of the Multipart request message and the Multipart response message, the type value may be set by the type field: "uint16_t type; /*One of the OFPMP_* constants.*/", and different type values correspond to different state information. For example, if the controller needs to obtain the status information 1 from the network device, the type field in the Multipart request message sent by the controller to the network device may be set to the type value 1 corresponding to the status information 1, and if the status information 2 is required, The type field may be set to a class corresponding to the status information 2 Type value 2. That is to say, the content carried in the Multipart request message and the Multipart response message can be controlled by setting the type field. However, the current OpenFlow protocol does not support the controller to obtain the storage information of the network device from the network device through the Multipart message.
为了实现控制器从网络设备获取网络设备的存储信息这一功能。本发明实施例对OpenFlow协议进行了扩展,为所述Multipart请求消息和Multipart应答消息定义了一种新的类型值:存储信息(STORAGE),具体如下:In order to realize the function that the controller acquires the storage information of the network device from the network device. The embodiment of the present invention extends the OpenFlow protocol, and defines a new type value for the Multipart request message and the Multipart response message: the storage information (STORAGE), as follows:
/*Storage description./*Storage description.
*The request body is empty.*The request body is empty.
*The reply body is struct ofp_storage.*/*The reply body is struct ofp_storage.*/
OFPMP_STORAGE=14,OFPMP_STORAGE=14,
其中ofp_storage:Where ofp_storage:
/*Body of reply to OFPMP_STORAGE request.*//*Body of reply to OFPMP_STORAGE request.*/
struct ofp_storage{Struct ofp_storage{
uint32_t total_size;/*Total flow table entry size of the switch.*/Uint32_t total_size;/*Total flow table entry size of the switch.*/
uint32_t idle_size;/*Unused size of the flow table entry.*/Uint32_t idle_size;/*Unused size of the flow table entry.*/
};};
OFP_ASSERT(sizeof(struct ofp_desc)==8);OFP_ASSERT(sizeof(struct ofp_desc)==8);
可以理解为,定义了“存储信息”作为类型值,类型值的值为14,具有这个类型值的Multipart请求报文的请求主体(body)字段为空,Multipart应答消息的应答body字段具有ofp_storage结构,该ofp_storage结构包括所述网络设备用于存储流表项的存储空间的总容量和空闲容量。It can be understood that "storage information" is defined as a type value, the value of the type value is 14, the body of the Multipart request message having this type value is empty, and the response body field of the Multipart response message has the ofp_storage structure. The ofp_storage structure includes a total capacity and a free capacity of a storage space used by the network device to store a flow entry.
若在所述控制器和网络设备使用上述新定义出的类型值为“STORAGE”Multipart消息,图2所对应实施例中的所述请求消息可以是OpenFlow协议的扩展的Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求Body字段,所述Type字段携带指示存储信息的类型值,所述请 求字段为空或者携带所述设备标识。在所述Multipart请求消息的请求字段为携带所述设备标识的情况下,可以通过所述请求字段中的所述设备标识实现校验等功能。If the controller and the network device use the newly defined type value as a "STORAGE" Multipart message, the request message in the embodiment corresponding to FIG. 2 may be an extended Multipart request message of the OpenFlow protocol, the extension. The Multipart request message includes a type Type field and a request body field, the Type field carrying a type value indicating storage information, the request The field is empty or carries the device identifier. In the case that the request field of the Multipart request message is carrying the device identifier, a function such as verification may be implemented by using the device identifier in the request field.
相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
举例说明,当所述网络设备接收到所述Multipart请求消息,所述网络设备通过所述Multipart请求消息Type字段的类型值识别所述Multipart请求消息为请求获取存储信息的请求消息。所述网络设备可以生成对应所述Multipart请求消息的Multipart应答消息,在所述Multipart应答消息的应答Body字段中携带自身的所述存储信息。For example, when the network device receives the Multipart request message, the network device identifies, by using a type value of the Multipart request message Type field, that the Multipart request message is a request message for requesting to acquire storage information. The network device may generate a Multipart response message corresponding to the Multipart request message, and carry the storage information of the Multipart response message in the response body field of the Multipart response message.
当所述控制器获取所述网络设备发送的所述Multipart应答消息,所述控制器通过所述Multipart应答消息Type字段的类型值识别所述Multipart应答消息为携带了所述存储信息的应答消息,所述控制器从所述Multipart应答消息的应答Body字段中获取所需的所述存储信息。When the controller acquires the Multipart response message sent by the network device, the controller identifies, by using a type value of the Multipart response message Type field, the Multipart response message as a response message carrying the storage information, The controller obtains the required storage information from a response body field of the Multipart response message.
103:所述控制器比对所述空闲空间与所述至少一条流表项的总容量。103: The controller compares the total capacity of the free space and the at least one flow entry.
举例说明,所述比对主要是用来确定所述网络设备剩余的存储空间是否足够存储所述至少一条流表项。由于流表项的容量大小基本差不多,故所述存储空间可以以流表项为单位表示。例如所述空闲空间具体为三条流表项单位,所述至少一条流表项的总容量具体为两条流表项,那么比对结果就是所述空闲空间大于所述总容量。For example, the comparison is mainly used to determine whether the remaining storage space of the network device is sufficient to store the at least one flow entry. Since the capacity of the flow entry is substantially the same, the storage space can be expressed in units of flow entries. For example, the free space is specifically a unit of three flow entries, and the total capacity of the at least one flow entry is specifically two flow entries, and the comparison result is that the free space is greater than the total capacity.
104:若所述空闲空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项。The controller sends the at least one flow entry to the network device according to the device identifier, if the free space is greater than or equal to the total capacity.
105:若所述空闲空间小于所述总容量,所述控制器不向所述网络设备下发所述至少一条流表项。The controller does not deliver the at least one flow entry to the network device, if the free space is smaller than the total capacity.
举例说明,若所述空闲空间大于等于所述总容量,可以理解为所述网络设备的所述存储空间中具有足够的空闲空间用于保存所述至少一条流表项。 这种情况下,所述控制器向所述网络设备下发所述至少一条流表项在正常情况下可以被所述网络设备存储到所述存储空间中。所述网络设备能够通过所述至少一条流表项实现所述功能。For example, if the free space is greater than or equal to the total capacity, it can be understood that the storage space of the network device has sufficient free space for saving the at least one flow entry. In this case, the controller sends the at least one flow entry to the network device to be stored in the storage space by the network device under normal circumstances. The network device is capable of implementing the function by using the at least one flow entry.
若所述空闲空间小于所述总容量,可以理解为所述网络设备的所述存储空间中的空闲空间不足,不具备存储所述至少一条流表项的条件。这种情况下,即使所述控制器向所述网络设备下发所述至少一条流表项,所述网络设备在正常情况下也无法保存所述至少一条流表项或者在所述至少一条流表项为多个的情况下最多只可能保存所述至少一条流表项的一部分。即使在能够保存所述至少一条流表项的一部分例如当所述至少一条流表项具体为三条流表项时,所述网络设备只能保存其中两条流表项的情况下,所述网络设备无法根据所保存的所述至少一条流表项的一部分例如所述两条流表项实现原本需要所述三条流表项才能实现的所述功能。这种情况站在所述控制器的角度上,可以理解为下发流表项失败。在这种情况下不向所述网络设备下发所述至少一条流表项可以有效避免由于所述网络设备无法存储所述至少一条流表项,或者只能存储所述至少一条流表项中的一部分导致下发流表项失败情况的出现,或者可以有效减少下发流表项失败的出现次数。If the free space is smaller than the total capacity, it can be understood that the free space in the storage space of the network device is insufficient, and the condition for storing the at least one flow entry is not available. In this case, even if the controller sends the at least one flow entry to the network device, the network device cannot save the at least one flow entry or the at least one flow under normal conditions. In the case where there are multiple entries, it is only possible to save at most a part of the at least one flow entry. Even if the network device can save only one of the at least one flow entry, for example, when the at least one flow entry is specifically three flow entries, the network device can only save two of the flow entries, the network The device cannot implement the function that is required to be implemented by the three flow entries according to the saved part of the at least one flow entry, for example, the two flow entries. This situation is in the perspective of the controller, which can be understood as the failure of the downstream flow entry. In this case, the at least one flow entry is not sent to the network device, and the network device cannot store the at least one flow entry, or only the at least one flow entry can be stored. The part of the flow table fails to be sent, or the number of occurrences of the failed flow entry cannot be reduced.
需要注意的是,若所述存储信息保存在所述控制器中,可选的,所述存储信息可以由所述控制器进行更新。It should be noted that if the storage information is saved in the controller, optionally, the storage information may be updated by the controller.
所述控制器在向所述网络设备下发所述至少一条流表项,或者接收到所述网络设备发送的流表项删除通知时,相应更新所述存储信息,所述流表项删除通知包括所述网络设备删除的流表项容量和所述删除的流表项在被删除前在所述存储空间中所存储的位置。When the controller sends the at least one flow entry to the network device, or receives a flow entry deletion notification sent by the network device, the controller updates the storage information, and the flow entry deletion notification is And including a flow entry capacity deleted by the network device and a location where the deleted flow entry is stored in the storage space before being deleted.
举例说明,若所述控制器通过比对,向所述网络设备下发了所述至少一条流表项,所述控制器将相应的更新对应所述网络设备的存储信息,将空闲空间减少所述至少一条流表项的总容量,将非空闲空间或者说已使用空间增加所述至少一条流表项的总容量。若接收到所述流表项删除通知,所述控制器将所述空闲空间增加所述删除的流表项容量,将非空闲空间减少所述删除 的流表项容量。通过更新所述存储信息,可以提高判断、比对的准确率,进而起到帮助提高控制器下发流表项的成功率的作用。For example, if the controller sends the at least one flow entry to the network device by using the comparison, the controller will correspondingly update the storage information corresponding to the network device, and reduce the free space. The total capacity of the at least one flow entry is increased, and the non-free space or the used space is increased by the total capacity of the at least one flow entry. If the flow entry deletion notification is received, the controller adds the deleted space entry capacity to the free space, and reduces the non-free space to the deletion. Flow table entry capacity. By updating the stored information, the accuracy of the judgment and the comparison can be improved, and the function of improving the success rate of the flow entry under the controller can be improved.
可见,当控制器为了使得网络设备实现一项功能,向所述网络设备下发对应所述功能的至少一条流表项之前,所述控制器比对所述至少一条流表项的总容量和网络设备的存储信息,通过比对结果明确所述网络设备是否具有足够的空闲存储空间存储所述至少一条流表项。在所述网络设备具有大于等于所述流表项的存储空间时下发所述至少一条流表项,在所述网络设备不具有存储流表项的存储空间时不下发所述至少一条流表项,提高了控制器下发流表项的成功率。It can be seen that, before the controller sends the network device to perform a function, the controller compares the total capacity of the at least one flow entry with the at least one flow entry corresponding to the function. The storage information of the network device is used to compare whether the network device has sufficient free storage space to store the at least one flow entry. When the network device has a storage space that is greater than or equal to the flow entry, the at least one flow entry is sent, and the at least one flow entry is not sent when the network device does not have a storage space for storing the flow entry. , the success rate of the flow entry under the controller is improved.
实施例二Embodiment 2
在图1所对应实施例的基础上,图3为本发明实施例提供的一种流表项下发方法的方法流程图。所述方法包括:On the basis of the corresponding embodiment of FIG. 1, FIG. 3 is a flowchart of a method for sending a flow entry according to an embodiment of the present invention. The method includes:
301:控制器获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识,所述至少一条流表项还具有对应的用户标识。301: The controller acquires at least one flow entry for implementing a function on the network device and a device identifier of the network device, where the at least one flow entry further has a corresponding user identifier.
举例说明,所述用户标识可以理解为用于标识所述至少一条流表项由某一用户或者某一项应用构造生成的,或者所述用户标识也可以理解为用于标识所述至少一条流表项所对应的所述功能。所述用户可以是指使用所述网络设备的用户,例如,数据中心场景中的租户。For example, the user identifier may be used to identify that the at least one flow entry is generated by a user or an application configuration, or the user identifier may also be used to identify the at least one flow. The function corresponding to the entry. The user may refer to a user who uses the network device, for example, a tenant in a data center scenario.
302:所述控制器根据所设备述标识查找到所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间,所述用于存储流表项的存储空间中的空闲空间具体包括预留空闲空间和非预留空闲空间。302: The controller searches for the storage information of the network device according to the identifier of the device, where the storage information includes a free space in a storage space used by the network device to store a flow entry, where the storage is used to store a flow. The free space in the storage space of the entry specifically includes reserved free space and non-reserved free space.
举例说明,本发明实施例中所述的预留可以理解为在所述存储空间中,预先保留一部分空闲空间作为预留空间,所述预留空间用于专门保存与用户标识对应的流表项。所述预留空闲空间可以理解为所述预留空间中还未被使用的空间。所述非预留空闲空间可以理解为所述空闲空间中除了所述预留空 闲空间外的其他空闲空间。For example, the reservation described in the embodiment of the present invention may be understood as: in the storage space, a part of the free space is reserved in advance as a reserved space, and the reserved space is used to specifically save the flow entry corresponding to the user identifier. . The reserved free space can be understood as a space in the reserved space that has not been used yet. The non-reserved free space can be understood as the reserved space except the reserved space. Other free space outside the free space.
303:所述控制器根据所述用户标识判断所述存储空间中是否具有所述用户标识对应的预留子空间,所述预留子空间为部分或全部所述预留空闲空间,若具有所述预留子空间,执行304。303: The controller determines, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space. The reserved subspace is described as 304.
举例说明,所述预留空间可以包括一个或多个子空间。例如用户标识A和用户标识B在所述存储空间中均具有预留的空间,其中,所述预留空间中专门用于用户标识A的部分可以理解为对应用户标识A的子空间A,所述预留空间中专门用于用户标识B的部分可以理解为对应用户标识B的子空间B。在本发明实施例中,所述预留子空间特指为所述用户标识预留的子空间中尚未被使用的空闲空间。For example, the reserved space may include one or more subspaces. For example, the user identifier A and the user identifier B have a reserved space in the storage space, wherein the portion of the reserved space dedicated to the user identifier A can be understood as the subspace A corresponding to the user identifier A. The portion of the reserved space dedicated to the user identification B can be understood as the subspace B corresponding to the user identification B. In the embodiment of the present invention, the reserved subspace specifically refers to a free space in the subspace reserved for the user identifier that has not been used.
若所述用户标识用于标识所述至少一条流表项由某一用户或者某一项应用构造生成,则所述预留空间中与所述用户标识对应的子空间可以专门用于存储由该用户或该应用构造生成的流表项。若所述用户标识用于标识所述至少一条流表项所对应的所述功能,则所述预留空间中与所述用户标识对应的子空间可以专门用于存储使得所述网络设备实现所述功能的流表项。If the user identifier is used to identify that the at least one flow entry is generated by a user or an application configuration, the subspace corresponding to the user identifier in the reserved space may be specifically used for storage. The user or the application constructs the generated flow table entry. If the user identifier is used to identify the function corresponding to the at least one flow entry, the subspace corresponding to the user identifier in the reserved space may be specifically used for storage to enable the network device to implement A flow entry for the function.
需要注意的是,可选的,在303中,若所述控制器根据所述用户标识判断发现所述存储空间中不具有所述预留子空间,执行306。具体实施内容参见306部分的相关描述。It is noted that, in 303, if the controller determines, according to the user identifier, that the storage space does not have the reserved subspace, perform 306. For details of implementation, see the related description in Section 306.
304:所述控制器比对所述预留子空间与所述至少一条流表项的总容量;若所述预留子空间大于等于所述总容量,执行305;若所述预留子空间小于所述总容量,执行306。304: The controller compares the total capacity of the reserved subspace and the at least one flow entry; if the reserved subspace is greater than or equal to the total capacity, performing 305; if the reserved subspace 306 is performed less than the total capacity.
305:所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项。305. The controller sends the at least one flow entry to the network device according to the device identifier.
举例说明,若所述预留子空间大于等于所述总容量,则可以理解为所述网络设备的所述存储空间中为所述用户标识预留的预留空间中具有足够的空闲空间用于保存所述至少一条流表项。这种情况下,所述控制器向所述网络设备下发所述至少一条流表项在正常情况下可以被所述网络设备存储到所述 存储空间的所述预留子空间中。所述网络设备能够通过所述至少一条流表项实现所述功能。For example, if the reserved subspace is greater than or equal to the total capacity, it can be understood that there is enough free space in the reserved space reserved for the user identifier in the storage space of the network device. The at least one flow entry is saved. In this case, the controller sends the at least one flow entry to the network device, which may be stored by the network device to the In the reserved subspace of the storage space. The network device is capable of implementing the function by using the at least one flow entry.
若所述预留子空间小于所述总容量,可以理解为所述网络设备的所述存储空间中为所述用户标识预留的预留空间中没有足够的空闲空间用于存储所述至少一条流表项。这种情况下,可以进一步通过比对判断所述非预留空闲空间中是否具有存储所述至少一条流表项的条件。If the reserved subspace is smaller than the total capacity, it may be understood that there is not enough free space in the reserved space reserved for the user identifier in the storage space of the network device for storing the at least one piece. Flow entry. In this case, it may be further determined by comparing whether the non-reserved free space has a condition for storing the at least one flow entry.
306:所述控制器比对所述非预留空闲空间与所述总容量;若所述非预留空闲空间大于等于所述总容量,执行305。306: The controller compares the non-reserved free space with the total capacity; if the non-reserved free space is greater than or equal to the total capacity, perform 305.
也就是说,对于所述用户标识在所述预留空间中具有对应的子空间的流表项,可以在对应的子空间中不具有足够空闲空间的情况下,进一步具有存储在非预留空闲空间中的可能。所述非预留空闲空间可以理解为存储流表项的公共空间中的空闲区域,也就是说不限制、不限定保存在所述非预留空闲空间中流表项的用户标识。That is to say, the flow entry with the corresponding subspace in the reserved space may be further stored in the non-reserved idle if the corresponding subspace does not have sufficient free space. Possible in space. The non-reserved free space can be understood as a free area in the public space of the storage flow entry, that is, the user identifier of the flow entry stored in the non-reserved free space is not limited or limited.
若所述非预留空闲空间大于等于所述总容量,可以理解为所述网络设备的所述存储空间中的非预留空闲空间中具有足够的空闲空间用于保存所述至少一条流表项。所述控制器具有向所述网络设备下发所述至少一条流表项的条件。If the non-reserved free space is greater than or equal to the total capacity, it may be understood that the unreserved free space in the storage space of the network device has sufficient free space for saving the at least one flow entry. . The controller has a condition for delivering the at least one flow entry to the network device.
需要注意的是,当306中所述控制器通过比对,若所述非预留空闲空间小于所述总容量,执行307。It should be noted that when the controller in 306 passes the comparison, if the non-reserved free space is less than the total capacity, 307 is performed.
307:所述控制器不向所述网络设备下发所述至少一条流表项。307: The controller does not send the at least one flow entry to the network device.
举例说明,在所述网络设备的所述存储空间不具备完全存储所述至少一条流表项的情况下,不向所述网络设备下发所述至少一条流表项可以有效避免由于所述网络设备无法存储所述至少一条流表项,或者只能存储所述至少一条流表项中的一部分导致下发流表项失败情况的出现,或者可以有效减少下发流表项失败的出现次数。For example, in a case where the storage space of the network device does not have the at least one flow entry being completely stored, not sending the at least one flow entry to the network device may effectively avoid the network. The device cannot store the at least one flow entry, or only a part of the at least one flow entry may cause the failure of the flow entry to be delivered, or the number of occurrences of the failed flow entry may be effectively reduced.
所述网络设备的存储空间中还可以为一些需要执行的特定功能例如具有高优先级的功能或者需要在所述网络设备上实现功能的特定用户例如重要用 户或者重要App分配专用的预留空间,使得与上述相关的流表项例如与特定功能相关的流表项、由特定用户生成的流表项或者由重要应用生成的流表项需要下发到所述网络设备中时,所述存储空间中有专门用于存储上述流表项的预留存储空间。而且即使预留存储空间的空闲空间不足,可以将上述流表项在所述存储空间的非预留空闲空间足够时存储在非预留空闲空间中。由此尽量保证了重要流表项能够被所述网络设备存储的几率,提高了所述存储空间的使用效率。The storage space of the network device may also be some specific functions that need to be performed, such as a function having a high priority or a specific user who needs to implement a function on the network device, for example, an important user. The user or the important application allocates a dedicated reservation space, so that the flow entry related to the foregoing, for example, the flow entry related to the specific function, the flow entry generated by the specific user, or the flow entry generated by the important application needs to be delivered to the flow entry. In the network device, the storage space has a reserved storage space dedicated to storing the flow entry. Moreover, even if the free space of the reserved storage space is insufficient, the flow table entry may be stored in the non-reserved free space when the non-reserved free space of the storage space is sufficient. Therefore, the probability that the important flow entry can be stored by the network device is ensured as much as possible, and the use efficiency of the storage space is improved.
可选的,接下来进一步说明在所述存储空间具有预留空间和非预留空间的情况下,且所述存储信息保存在所述控制器中时,所述存储信息可以由所述控制器进行更新。Optionally, it is further explained that, when the storage space has a reserved space and a non-reserved space, and the storage information is saved in the controller, the storage information may be used by the controller. Update.
所述控制器在向所述网络设备下发所述至少一条流表项,或者接收到所述网络设备发送的流表项删除通知时,相应更新所述存储信息,所述流表项删除通知包括所述网络设备删除的流表项容量和所述删除的流表项在被删除前在所述存储空间中所存储的位置。When the controller sends the at least one flow entry to the network device, or receives a flow entry deletion notification sent by the network device, the controller updates the storage information, and the flow entry deletion notification is And including a flow entry capacity deleted by the network device and a location where the deleted flow entry is stored in the storage space before being deleted.
根据不同的情况举例说明所述控制器相应的更新对应所述网络设备的存储信息。The corresponding update of the controller corresponds to the storage information of the network device according to different situations.
若在所述预留子空间大于等于所述总容量的情况下所述控制器向所述网络设备下发所述至少一条流表项,所述控制器将所述预留子空间减少所述总容量。If the controller sends the at least one flow entry to the network device if the reserved subspace is greater than or equal to the total capacity, the controller reduces the reserved subspace by the total capacity.
若在所述非预留空闲空间大于等于所述总容量的情况下所述控制器向所述网络设备下发所述至少一条流表项,所述控制器将所述非预留空闲空间减少所述总容量。If the controller sends the at least one flow entry to the network device, the controller reduces the non-reserved free space if the non-reserved free space is greater than or equal to the total capacity. The total capacity.
若所述控制器接收到所述流表项删除通知,所述控制器可以根据所述删除的流表项在被删除前在所述存储空间中所存储的位置,对所述存储信息进行更新。例如当所述删除的流表项在被删除前在所述存储空间中所存储的位置具体在预留空间中对应的子空间时,所述控制器可以将该子空间的预留子空间增加所述删除的流表项容量。例如当所述删除的流表项在被删除前在所 述存储空间中所存储的位置具体在非预留空间中时,所述控制器可以将非预留空闲空间增加所述删除的流表项容量。通过更新所述存储信息,可以提高判断、比对的准确率,进而起到帮助提高控制器下发流表项的成功率的作用。If the controller receives the flow entry deletion notification, the controller may update the storage information according to the location of the deleted flow entry stored in the storage space before being deleted. . For example, when the deleted flow entry is stored in the storage space before the deletion, specifically, the corresponding subspace in the reserved space, the controller may increase the reserved subspace of the subspace. The deleted flow entry capacity. For example, when the deleted flow entry is deleted before being deleted When the location stored in the storage space is specifically in the non-reserved space, the controller may increase the capacity of the deleted flow entry by adding the unreserved free space. By updating the stored information, the accuracy of the judgment and the comparison can be improved, and the function of improving the success rate of the flow entry under the controller can be improved.
实施例三Embodiment 3
图4为本发明实施例提供的一种流表项下发装置的装置结构图,所述流表项下发装置400包括:FIG. 4 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present disclosure, where the flow entry sending device 400 includes:
获取单元401,用于获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识。The obtaining unit 401 is configured to acquire at least one flow entry for implementing a function on the network device and a device identifier of the network device.
本发明实施例中所述的流表项可以理解为是用户或者某一项应用希望能在网络设备上实现一项功能时构造生成的。为了网络设备能够实现一项功能需要控制器为该网络设备下发与该功能相关的所有需要下发的流表项,这里所述的所有需要下发的流表项可以为至少一条流表项。当所述至少一条流表项全部成功下发到所述网络设备中或者说被所述网络设备存储到专门用于存储流表项的存储空间后,所述网络设备将可以根据所述至少一条流表项实现所述功能。The flow entry described in the embodiment of the present invention can be understood as being constructed when a user or an application wants to implement a function on the network device. For the network device to implement a function, the controller needs to send the flow entry to the network device that is required to be delivered, and the flow entry to be delivered may be at least one flow entry. . After the at least one flow entry is successfully delivered to the network device or stored by the network device to a storage space dedicated to storing a flow entry, the network device may be according to the at least one The flow entry implements the described functionality.
在本发明实施例中,优选的应用于部署了SDN技术的网络中。所述网络设备可以是用于进行路由转发的转发设备。例如可以为支持OpenFlow协议的交换机、路由器等设备。In the embodiment of the present invention, it is preferably applied to a network in which the SDN technology is deployed. The network device may be a forwarding device for performing route forwarding. For example, it may be a switch, a router, or the like that supports the OpenFlow protocol.
查找单元402,用于根据所述设备标识查找到所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间。The searching unit 402 is configured to search, according to the device identifier, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry.
举例说明,若所述控制器在本地已经存储了所述存储信息,那么所述查找单元402可以通过所述设备标识在本地进行查找,以查找到对应的所述设备标识的所述存储信息。或者,若所述控制器在本地虽然存储了所述存储信息,但所述查找单元402可以根据所述设备标识向所述网络设备发送请求消息,用于请求获取所述网络设备的存储信息,接收所述网络设备根据所述请求消息返回的应答消息,以此获取所述应答消息中携带的所述网络设备的存 储信息并可以用获取的该存储信息来对本地存储的所述存储信息进行更新。或者,若所述控制器在本地并没有存储所述存储信息,所述查找单元402可以根据所述设备标识向所述网络设备发送请求消息,用于请求获取所述网络设备的存储信息,接收所述网络设备根据所述请求消息返回的应答消息,以此获取所述应答消息中携带的所述网络设备的存储信息。还需要注意的是,所述网络设备也可以周期性的自动将自身的存储信息上传到所述控制器。For example, if the controller has stored the storage information locally, the searching unit 402 may perform a local search by using the device identifier to find the storage information of the corresponding device identifier. Alternatively, if the controller stores the storage information locally, the searching unit 402 may send a request message to the network device according to the device identifier, for requesting to acquire storage information of the network device. Receiving, by the network device, a response message returned by the request message, to obtain the storage of the network device carried in the response message The information is stored and the stored information stored locally can be updated with the stored information. Or, if the controller does not store the storage information locally, the searching unit 402 may send a request message to the network device according to the device identifier, to request to acquire storage information of the network device, and receive The network device obtains the storage information of the network device carried in the response message according to the response message returned by the request message. It should also be noted that the network device can also automatically upload its own storage information to the controller periodically.
所述存储信息可以为一种用于标识所述网络设备中专门用于存储流表项的存储空间存储状况的参数,其中可以包括已被使用的存储空间和未被使用的空闲存储空间的参数。在本发明实施例中主要关注的是尚未被用于存储的空闲存储空间的参数。The storage information may be a parameter for identifying a storage space storage condition specifically used for storing a flow entry in the network device, where the storage space that has been used and the unused storage space may be included. . The main concern in the embodiments of the present invention is the parameters of the free storage space that have not been used for storage.
所述请求消息和所述应答消息可以为设定出的一种新的消息,或者也可以为通过对协议的扩展在已有消息的基础上定义出新的类型。在图4所对应实施例的基础上,图5为本发明实施例提供的一种流表项下发装置的装置结构图,所述流表项下发装置400中的所述查找单元402还包括:The request message and the response message may be a set new message, or may be a new type defined on the basis of an existing message by extending the protocol. On the basis of the corresponding embodiment of FIG. 4, FIG. 5 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention, where the searching unit 402 in the flow entry sending device 400 further include:
发送子单元501,用于根据所述设备标识向所述网络设备发送请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息。The sending sub-unit 501 is configured to send a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device.
接收子单元502,用于接收所述网络设备根据所述请求消息回复的应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息。The receiving sub-unit 502 is configured to receive a response message that is sent by the network device according to the request message, where the response message is used to notify the controller of the stored information on the network device.
获取子单元503,用于从所述应答消息中获取所述网络设备的所述存储信息。The obtaining subunit 503 is configured to obtain the storage information of the network device from the response message.
可选的,本发明实施例还提供了一种通过对协议的扩展在已有消息的基础上定义出新的类型的方式得到所述请求消息和应答消息。Optionally, the embodiment of the present invention further provides that the request message and the response message are obtained by defining a new type on the basis of an existing message by extending the protocol.
在OpenFlow协议中,控制器和网络设备之间可以使用Multipart消息来传输网络设备的状态信息。控制器可以通过向网络设备发送Multipart请求消息来请求获得该网络设备的状态信息等,该网络设备在收到Multipart请求消息后,向该控制器返回Multipart应答消息,并在该Multipart应答消息中携带所需的状态消息。所述Multipart请求消息和Multipart应答消息 的OpenFlow协议格式中,可以通过类型字段:“uint16_t type;/*One of the OFPMP_* constants.*/”设置类型值,不同的类型值对应不同的状态信息。例如若控制器需要从网络设备获取状态信息1,控制器向网络设备发送的Multipart请求消息中的所述类型(Type)字段可以设置为对应状态信息1的类型值1,若需要状态信息2,所述类型字段可以设置为对应状态信息2的类型值2。也就是说,可以通过对所述类型字段的设置来控制所述Multipart请求消息和Multipart应答消息中携带的内容。但是当前OpenFlow协议中并不支持控制器通过Multipart消息从网络设备获取网络设备的存储信息。In the OpenFlow protocol, Multipart messages can be used between the controller and the network device to transmit status information of the network device. The controller may request to obtain status information of the network device by sending a Multipart request message to the network device, and after receiving the Multipart request message, the network device returns a Multipart response message to the controller, and carries the Multipart response message in the Multipart response message. The required status message. The Multipart request message and the Multipart response message In the OpenFlow protocol format, the type value can be set by the type field: "uint16_t type; /*One of the OFPMP_* constants.*/", and different type values correspond to different state information. For example, if the controller needs to obtain the status information 1 from the network device, the type field in the Multipart request message sent by the controller to the network device may be set to the type value 1 corresponding to the status information 1, and if the status information 2 is required, The type field may be set to correspond to the type value 2 of the status information 2. That is to say, the content carried in the Multipart request message and the Multipart response message can be controlled by setting the type field. However, the current OpenFlow protocol does not support the controller to obtain the storage information of the network device from the network device through the Multipart message.
为了实现控制器从网络设备获取网络设备的存储信息这一功能。本发明实施例对OpenFlow协议进行了扩展,为所述Multipart请求消息和Multipart应答消息定义了一种新的类型值:存储信息(STORAGE),具体如下:In order to realize the function that the controller acquires the storage information of the network device from the network device. The embodiment of the present invention extends the OpenFlow protocol, and defines a new type value for the Multipart request message and the Multipart response message: the storage information (STORAGE), as follows:
/*Storage description./*Storage description.
*The request body is empty.*The request body is empty.
*The reply body is struct ofp_storage.*/*The reply body is struct ofp_storage.*/
OFPMP_STORAGE=14,OFPMP_STORAGE=14,
其中ofp_storage:Where ofp_storage:
/*Body of reply to OFPMP_STORAGE request.*//*Body of reply to OFPMP_STORAGE request.*/
struct ofp_storage{Struct ofp_storage{
uint32_t total_size;/*Total flow table entry size of the switch.*/Uint32_t total_size;/*Total flow table entry size of the switch.*/
uint32_t idle_size;/*Unused size of the flow table entry.*/Uint32_t idle_size;/*Unused size of the flow table entry.*/
};};
OFP_ASSERT(sizeof(struct ofp_desc)==8);OFP_ASSERT(sizeof(struct ofp_desc)==8);
可以理解为,定义了“存储信息”作为类型值,类型值的值为14,具有这个类型值的Multipart请求报文的请求主体(body)字段为空,Multipart应答消息的应答body字段具有ofp_storage结构,该ofp_storage结构包括 所述网络设备用于存储流表项的存储空间的总容量和空闲容量。It can be understood that "storage information" is defined as a type value, the value of the type value is 14, the body of the Multipart request message having this type value is empty, and the response body field of the Multipart response message has the ofp_storage structure. , the ofp_storage structure includes The network device is configured to store a total capacity and a free capacity of a storage space of the flow entry.
若在所述控制器和网络设备使用上述新定义出的类型值为“STORAGE”Multipart消息,图2所对应实施例中的所述请求消息可以是OpenFlow协议的扩展的Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求Body字段,所述Type字段携带指示存储信息的类型值,所述请求字段为空或者携带所述设备标识。在所述Multipart请求消息的请求字段为携带所述设备标识的情况下,可以通过所述请求字段中的所述设备标识实现校验等功能。If the controller and the network device use the newly defined type value as a "STORAGE" Multipart message, the request message in the embodiment corresponding to FIG. 2 may be an extended Multipart request message of the OpenFlow protocol, the extension. The Multipart request message includes a Type Type field and a Request Body field, the Type field carrying a type value indicating storage information, the request field being empty or carrying the device identification. In the case that the request field of the Multipart request message is carrying the device identifier, a function such as verification may be implemented by using the device identifier in the request field.
相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
举例说明,当所述网络设备接收到所述Multipart请求消息,所述网络设备通过所述Multipart请求消息Type字段的类型值识别所述Multipart请求消息为请求获取存储信息的请求消息。所述网络设备可以生成对应所述Multipart请求消息的Multipart应答消息,在所述Multipart应答消息的应答Body字段中携带自身的所述存储信息。For example, when the network device receives the Multipart request message, the network device identifies, by using a type value of the Multipart request message Type field, that the Multipart request message is a request message for requesting to acquire storage information. The network device may generate a Multipart response message corresponding to the Multipart request message, and carry the storage information of the Multipart response message in the response body field of the Multipart response message.
当所述控制器获取所述网络设备发送的所述Multipart应答消息,所述控制器通过所述Multipart应答消息Type字段的类型值识别所述Multipart应答消息为携带了所述存储信息的应答消息,所述控制器从所述Multipart应答消息的应答Body字段中获取所需的所述存储信息。When the controller acquires the Multipart response message sent by the network device, the controller identifies, by using a type value of the Multipart response message Type field, the Multipart response message as a response message carrying the storage information, The controller obtains the required storage information from a response body field of the Multipart response message.
比对单元403,用于比对所述空闲空间与所述至少一条流表项的总容量。The comparison unit 403 is configured to compare the total capacity of the free space and the at least one flow entry.
举例说明,所述比对主要是用来确定所述网络设备剩余的存储空间是否足够存储所述至少一条流表项。由于流表项的容量大小基本差不多,故所述存储空间可以以流表项为单位表示。例如所述空闲空间具体为三条流表项单位,所述至少一条流表项的总容量具体为两条流表项,那么比对结果就是所述空闲空间大于所述总容量。For example, the comparison is mainly used to determine whether the remaining storage space of the network device is sufficient to store the at least one flow entry. Since the capacity of the flow entry is substantially the same, the storage space can be expressed in units of flow entries. For example, the free space is specifically a unit of three flow entries, and the total capacity of the at least one flow entry is specifically two flow entries, and the comparison result is that the free space is greater than the total capacity.
若所述空闲空间大于等于所述总容量,触发发送单元404根据所述设备 标识向所述网络设备下发所述至少一条流表项。If the free space is greater than or equal to the total capacity, the trigger sending unit 404 is configured according to the device. The identifier sends the at least one flow entry to the network device.
若所述空闲空间小于所述总容量,不触发所述发送单元404向所述网络设备下发所述至少一条流表项。If the free space is smaller than the total capacity, the sending unit 404 does not trigger the sending of the at least one flow entry to the network device.
举例说明,若所述空闲空间大于等于所述总容量,可以理解为所述网络设备的所述存储空间中具有足够的空闲空间用于保存所述至少一条流表项。这种情况下,所述发送单元404向所述网络设备下发所述至少一条流表项在正常情况下可以被所述网络设备存储到所述存储空间中。所述网络设备能够通过所述至少一条流表项实现所述功能。For example, if the free space is greater than or equal to the total capacity, it can be understood that the storage space of the network device has sufficient free space for saving the at least one flow entry. In this case, the sending unit 404 sends the at least one flow entry to the network device, which can be stored in the storage space by the network device under normal circumstances. The network device is capable of implementing the function by using the at least one flow entry.
若所述空闲空间小于所述总容量,可以理解为所述网络设备的所述存储空间中的空闲空间不足,不具备存储所述至少一条流表项的条件。这种情况下,即使所述发送单元404向所述网络设备下发所述至少一条流表项,所述网络设备在正常情况下也无法保存所述至少一条流表项或者在所述至少一条流表项为多个的情况下最多只可能保存所述至少一条流表项的一部分。即使在能够保存所述至少一条流表项的一部分例如当所述至少一条流表项具体为三条流表项时,所述网络设备只能保存其中两条流表项的情况下,所述网络设备无法根据所保存的所述至少一条流表项的一部分例如所述两条流表项实现原本需要所述三条流表项才能实现的所述功能。这种情况站在所述控制器的角度上,可以理解为下发流表项失败。在这种情况下不向所述网络设备下发所述至少一条流表项可以有效避免由于所述网络设备无法存储所述至少一条流表项,或者只能存储所述至少一条流表项中的一部分导致下发流表项失败情况的出现,或者可以有效减少下发流表项失败的出现次数。If the free space is smaller than the total capacity, it can be understood that the free space in the storage space of the network device is insufficient, and the condition for storing the at least one flow entry is not available. In this case, even if the sending unit 404 sends the at least one flow entry to the network device, the network device cannot save the at least one flow entry or the at least one in a normal situation. In the case where there are multiple flow entries, it is only possible to save at most a part of the at least one flow entry. Even if the network device can save only one of the at least one flow entry, for example, when the at least one flow entry is specifically three flow entries, the network device can only save two of the flow entries, the network The device cannot implement the function that is required to be implemented by the three flow entries according to the saved part of the at least one flow entry, for example, the two flow entries. This situation is in the perspective of the controller, which can be understood as the failure of the downstream flow entry. In this case, the at least one flow entry is not sent to the network device, and the network device cannot store the at least one flow entry, or only the at least one flow entry can be stored. The part of the flow table fails to be sent, or the number of occurrences of the failed flow entry cannot be reduced.
需要注意的是,若所述存储信息保存在所述控制器中,可选的,所述存储信息可以由更新单元601进行更新。在图4所对应实施例的基础上,图6为本发明实施例提供的一种流表项下发装置的装置结构图,所述流表项下发装置400还包括:It should be noted that, if the storage information is saved in the controller, optionally, the storage information may be updated by the update unit 601. On the basis of the corresponding embodiment of FIG. 4, FIG. 6 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention. The flow entry sending device 400 further includes:
更新单元601,用于在向所述网络设备下发所述至少一条流表项,或者接收到所述网络设备发送的流表项删除通知时,相应更新所述存储信息,所述 流表项删除通知包括所述网络设备删除的流表项容量和所述删除的流表项在被删除前在所述存储空间中所存储的位置。The updating unit 601 is configured to: when the at least one flow entry is sent to the network device, or when the flow entry deletion notification sent by the network device is received, update the storage information, The flow entry deletion notification includes a flow entry capacity deleted by the network device and a location where the deleted flow entry is stored in the storage space before being deleted.
举例说明,若所述比对单元403通过比对,向所述网络设备下发了所述至少一条流表项,所述更新单元601将相应的更新对应所述网络设备的存储信息,将空闲空间减少所述至少一条流表项的总容量,将非空闲空间或者说已使用空间增加所述至少一条流表项的总容量。若接收到所述流表项删除通知,所述更新单元601将所述空闲空间增加所述删除的流表项容量,将非空闲空间减少所述删除的流表项容量。通过更新所述存储信息,可以提高判断、比对的准确率,进而起到帮助提高控制器下发流表项的成功率的作用。For example, if the comparison unit 403 sends the at least one flow entry to the network device by using the comparison, the update unit 601 associates the corresponding update with the storage information of the network device, and is idle. The space reduces the total capacity of the at least one flow entry, and increases the non-free space or the used space by the total capacity of the at least one flow entry. If the flow entry deletion notification is received, the update unit 601 adds the deleted space entry capacity to the free space, and reduces the deleted traffic entry capacity by the non-free space. By updating the stored information, the accuracy of the judgment and the comparison can be improved, and the function of improving the success rate of the flow entry under the controller can be improved.
可见,当控制器为了使得网络设备实现一项功能,向所述网络设备下发对应所述功能的至少一条流表项之前,所述控制器比对所述至少一条流表项的总容量和网络设备的存储信息,通过比对结果明确所述网络设备是否具有足够的空闲存储空间存储所述至少一条流表项。在所述网络设备具有大于等于所述流表项的存储空间时下发所述至少一条流表项,在所述网络设备不具有存储流表项的存储空间时不下发所述至少一条流表项,提高了控制器下发流表项的成功率。It can be seen that, before the controller sends the network device to perform a function, the controller compares the total capacity of the at least one flow entry with the at least one flow entry corresponding to the function. The storage information of the network device is used to compare whether the network device has sufficient free storage space to store the at least one flow entry. When the network device has a storage space that is greater than or equal to the flow entry, the at least one flow entry is sent, and the at least one flow entry is not sent when the network device does not have a storage space for storing the flow entry. , the success rate of the flow entry under the controller is improved.
实施例四Embodiment 4
在实施例三的基础上,所述用于存储流表项的存储空间中的空闲空间具体包括预留空闲空间和非预留空闲空间,所述至少一条流表项还具有对应的用户标识。On the basis of the third embodiment, the free space in the storage space for storing the flow entry specifically includes a reserved free space and a non-reserved free space, and the at least one flow entry further has a corresponding user identifier.
举例说明,本发明实施例中所述的预留可以理解为在所述存储空间中,预先保留一部分空闲空间作为预留空间,所述预留空间用于专门保存与用户标识对应的流表项。所述预留空闲空间可以理解为所述预留空间中还未被使用的空间。所述非预留空闲空间可以理解为所述空闲空间中除了所述预留空闲空间外的其他空闲空间。For example, the reservation described in the embodiment of the present invention may be understood as: in the storage space, a part of the free space is reserved in advance as a reserved space, and the reserved space is used to specifically save the flow entry corresponding to the user identifier. . The reserved free space can be understood as a space in the reserved space that has not been used yet. The non-reserved free space can be understood as other free space in the free space except the reserved free space.
举例说明,所述用户标识可以理解为用于标识所述至少一条流表项由某 一用户或者某一项应用构造生成的,或者所述用户标识也可以理解为用于标识所述至少一条流表项所对应的所述功能。所述用户可以是指使用所述网络设备的用户,例如,数据中心场景中的租户。For example, the user identifier may be used to identify that the at least one flow entry is determined by a certain A user or an application configuration is generated, or the user identifier may also be used to identify the function corresponding to the at least one flow entry. The user may refer to a user who uses the network device, for example, a tenant in a data center scenario.
在图4所对应实施例的基础上,图7为本发明实施例提供的一种流表项下发装置的装置结构图,所述控制器400还包括:On the basis of the corresponding embodiment of FIG. 4, FIG. 7 is a structural diagram of a device for delivering a flow entry according to an embodiment of the present invention. The controller 400 further includes:
判断单元701,用于根据所述用户标识判断所述存储空间中是否具有所述用户标识对应的预留子空间,所述预留子空间为部分或全部所述预留空闲空间。The determining unit 701 is configured to determine, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space.
举例说明,所述预留空间可以包括一个或多个子空间。例如用户标识A和用户标识B在所述存储空间中均具有预留的空间,其中,所述预留空间中专门用于用户标识A的部分可以理解为对应用户标识A的子空间A,所述预留空间中专门用于用户标识B的部分可以理解为对应用户标识B的子空间B。在本发明实施例中,所述预留子空间特指为所述用户标识预留的子空间中尚未被使用的空闲空间。For example, the reserved space may include one or more subspaces. For example, the user identifier A and the user identifier B have a reserved space in the storage space, wherein the portion of the reserved space dedicated to the user identifier A can be understood as the subspace A corresponding to the user identifier A. The portion of the reserved space dedicated to the user identification B can be understood as the subspace B corresponding to the user identification B. In the embodiment of the present invention, the reserved subspace specifically refers to a free space in the subspace reserved for the user identifier that has not been used.
若所述用户标识用于标识所述至少一条流表项由某一用户或者某一项应用构造生成,则所述预留空间中与所述用户标识对应的子空间可以专门用于存储由该用户或该应用构造生成的流表项。若所述用户标识用于标识所述至少一条流表项所对应的所述功能,则所述预留空间中与所述用户标识对应的子空间可以专门用于存储使得所述网络设备实现所述功能的流表项。If the user identifier is used to identify that the at least one flow entry is generated by a user or an application configuration, the subspace corresponding to the user identifier in the reserved space may be specifically used for storage. The user or the application constructs the generated flow table entry. If the user identifier is used to identify the function corresponding to the at least one flow entry, the subspace corresponding to the user identifier in the reserved space may be specifically used for storage to enable the network device to implement A flow entry for the function.
若具有所述预留子空间,触发所述比对单元403所包括的第一比对子单元702,If the reserved subspace is provided, the first comparison subunit 702 included in the comparison unit 403 is triggered,
所述第一比对子单元702,用于比对所述预留子空间与所述至少一条流表项的总容量。The first comparison sub-unit 702 is configured to compare the total capacity of the reserved subspace and the at least one flow entry.
若所述预留子空间大于等于所述总容量,触发所述发送单元404根据所述设备标识向所述网络设备下发所述至少一条流表项。If the reserved subspace is greater than or equal to the total capacity, the sending unit 404 is configured to send the at least one flow entry to the network device according to the device identifier.
举例说明,若所述预留子空间大于等于所述总容量,则可以理解为所述网络设备的所述存储空间中为所述用户标识预留的预留空间中具有足够的空 闲空间用于保存所述至少一条流表项。这种情况下,所述发送单元404向所述网络设备下发所述至少一条流表项在正常情况下可以被所述网络设备存储到所述存储空间的所述预留子空间中。所述网络设备能够通过所述至少一条流表项实现所述功能。For example, if the reserved subspace is greater than or equal to the total capacity, it may be understood that the reserved space reserved for the user identifier in the storage space of the network device is sufficiently empty. The free space is used to save the at least one flow entry. In this case, the sending unit 404 sends the at least one flow entry to the network device, which can be stored by the network device in the reserved subspace of the storage space under normal circumstances. The network device is capable of implementing the function by using the at least one flow entry.
若所述预留子空间小于所述总容量,可以理解为所述网络设备的所述存储空间中为所述用户标识预留的预留空间中没有足够的空闲空间用于存储所述至少一条流表项。这种情况下,可以进一步通过比对判断所述非预留空闲空间中是否具有存储所述至少一条流表项的条件。If the reserved subspace is smaller than the total capacity, it may be understood that there is not enough free space in the reserved space reserved for the user identifier in the storage space of the network device for storing the at least one piece. Flow entry. In this case, it may be further determined by comparing whether the non-reserved free space has a condition for storing the at least one flow entry.
若所述预留子空间小于所述总容量;或者,若所述判断单元701的判断结果为不具有所述预留子空间,触发所述比对单元403所包括的第二比对子单元703,If the reserved subspace is smaller than the total capacity; or if the determining result of the determining unit 701 is that the reserved subspace is not provided, the second comparison subunit included in the comparison unit 403 is triggered. 703,
所述第二比对子单元703,用于比对所述非预留空闲空间与所述总容量。The second comparison sub-unit 703 is configured to compare the non-reserved free space with the total capacity.
若所述非预留空闲空间大于等于所述总容量,触发所述发送单元404根据所述设备标识向所述网络设备下发所述至少一条流表项。If the non-reserved free space is greater than or equal to the total capacity, the sending unit 404 is configured to send the at least one flow entry to the network device according to the device identifier.
也就是说,对于所述用户标识在所述预留空间中具有对应的子空间的流表项,可以在对应的子空间中不具有足够空闲空间的情况下,进一步具有存储在非预留空闲空间中的可能。所述非预留空闲空间可以理解为存储流表项的公共空间中的空闲区域,也就是说不限制、不限定保存在所述非预留空闲空间中流表项的用户标识。That is to say, the flow entry with the corresponding subspace in the reserved space may be further stored in the non-reserved idle if the corresponding subspace does not have sufficient free space. Possible in space. The non-reserved free space can be understood as a free area in the public space of the storage flow entry, that is, the user identifier of the flow entry stored in the non-reserved free space is not limited or limited.
若所述非预留空闲空间大于等于所述总容量,可以理解为所述网络设备的所述存储空间中的非预留空闲空间中具有足够的空闲空间用于保存所述至少一条流表项。所述发送单元404具有向所述网络设备下发所述至少一条流表项的条件。If the non-reserved free space is greater than or equal to the total capacity, it may be understood that the unreserved free space in the storage space of the network device has sufficient free space for saving the at least one flow entry. . The sending unit 404 has a condition for delivering the at least one flow entry to the network device.
若所述非预留空闲空间小于所述总容量,不触发所述发送单元404向所述网络设备下发所述至少一条流表项。If the non-reserved free space is smaller than the total capacity, the sending unit 404 does not trigger the sending of the at least one flow entry to the network device.
举例说明,在所述网络设备的所述存储空间不具备完全存储所述至少一条流表项的情况下,不向所述网络设备下发所述至少一条流表项可以有效避 免由于所述网络设备无法存储所述至少一条流表项,或者只能存储所述至少一条流表项中的一部分导致下发流表项失败情况的出现,或者可以有效减少下发流表项失败的出现次数。For example, if the storage space of the network device does not have the at least one flow entry being completely stored, the at least one flow entry may not be sent to the network device. The failure of the network device to store the at least one flow entry, or only the part of the at least one flow entry may cause the failure of the flow entry to be delivered, or the flow entry may be effectively reduced. The number of occurrences of failure.
所述网络设备的存储空间中还可以为一些需要执行的特定功能例如具有高优先级的功能或者需要在所述网络设备上实现功能的特定用户例如重要用户或者重要App分配专用的预留空间,使得与上述相关的流表项例如与特定功能相关的流表项、由特定用户生成的流表项或者由重要应用生成的流表项需要下发到所述网络设备中时,所述存储空间中有专门用于存储上述流表项的预留存储空间。而且即使预留存储空间的空闲空间不足,可以将上述流表项在所述存储空间的非预留空闲空间足够时存储在非预留空闲空间中。由此尽量保证了重要流表项能够被所述网络设备存储的几率,提高了所述存储空间的使用效率。The storage space of the network device may also allocate specific reserved spaces for specific functions that need to be performed, such as functions with high priority or specific users that need to implement functions on the network device, such as important users or important applications. When the flow entry related to the foregoing, for example, a flow entry related to a specific function, a flow entry generated by a specific user, or a flow entry generated by an important application needs to be delivered to the network device, the storage space There is reserved storage space dedicated to storing the above flow table entries. Moreover, even if the free space of the reserved storage space is insufficient, the flow table entry may be stored in the non-reserved free space when the non-reserved free space of the storage space is sufficient. Therefore, the probability that the important flow entry can be stored by the network device is ensured as much as possible, and the use efficiency of the storage space is improved.
可选的,接下来进一步说明在所述存储空间具有预留空间和非预留空间的情况下,且所述存储信息保存在所述控制器中时,所述存储信息如何由所述更新单元601进行更新。Optionally, the following further describes how the storage information is used by the update unit when the storage space has a reserved space and a non-reserved space, and the storage information is saved in the controller. 601 is updated.
所述更新单元601在向所述网络设备下发所述至少一条流表项,或者接收到所述网络设备发送的流表项删除通知时,相应更新所述存储信息,所述流表项删除通知包括所述网络设备删除的流表项容量和所述删除的流表项在被删除前在所述存储空间中所存储的位置。When the update unit 601 sends the at least one flow entry to the network device, or receives the flow entry deletion notification sent by the network device, the update information is updated, and the flow entry is deleted. The notification includes a flow entry capacity deleted by the network device and a location in the storage space before the deleted flow entry is deleted.
根据不同的情况举例说明所述更新单元601相应的更新对应所述网络设备的存储信息。The update unit 601 correspondingly updates the storage information corresponding to the network device according to different situations.
若在所述预留子空间大于等于所述总容量的情况下所述发送单元304向所述网络设备下发所述至少一条流表项,所述更新单元401将所述预留子空间减少所述总容量。The sending unit 304 sends the at least one flow entry to the network device if the reserved subspace is greater than or equal to the total capacity, and the updating unit 401 reduces the reserved subspace. The total capacity.
若在所述非预留空闲空间大于等于所述总容量的情况下所述发送单元404向所述网络设备下发所述至少一条流表项,所述更新单元401将所述非预留空闲空间减少所述总容量。 If the non-reserved free space is greater than or equal to the total capacity, the sending unit 404 sends the at least one flow entry to the network device, and the update unit 401 stores the non-reserved idle. Space reduces the total capacity.
若所述控制器接收到所述流表项删除通知,所述更新单元601可以根据所述删除的流表项在被删除前在所述存储空间中所存储的位置,对所述存储信息进行更新。例如当所述删除的流表项在被删除前在所述存储空间中所存储的位置具体在预留空间中对应的子空间时,所述更新单元601可以将该子空间的预留子空间增加所述删除的流表项容量。例如当所述删除的流表项在被删除前在所述存储空间中所存储的位置具体在非预留空间中时,所述更新单元601可以将非预留空闲空间增加所述删除的流表项容量。通过更新所述存储信息,可以提高判断、比对的准确率,进而起到帮助提高控制器下发流表项的成功率的作用。If the controller receives the flow entry deletion notification, the update unit 601 may perform the storage information according to the location of the deleted flow entry stored in the storage space before being deleted. Update. For example, when the deleted flow entry is stored in the storage space before the deletion, specifically, the corresponding subspace in the reserved space, the update unit 601 may reserve the subspace of the subspace. Increase the capacity of the deleted flow entry. For example, when the deleted flow entry is specifically stored in the non-reserved space before being deleted, the update unit 601 may add the unreserved free space to the deleted flow. Entry capacity. By updating the stored information, the accuracy of the judgment and the comparison can be improved, and the function of improving the success rate of the flow entry under the controller can be improved.
实施例五Embodiment 5
图8为本发明实施例提供的一种流表项保存方法的方法流程图,所述方法包括:FIG. 8 is a flowchart of a method for saving a flow entry according to an embodiment of the present disclosure, where the method includes:
801:网络设备向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间。801: The network device sends, to the controller, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry.
本步骤的内容请参见图1所对应实施例中102的相关描述以及图2所对应实施例的相关描述,这里不再赘述。For the content of this step, refer to the related description of 102 in the corresponding embodiment of FIG. 1 and the related description of the corresponding embodiment of FIG. 2, and details are not described herein again.
802:所述网络设备接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能。802: The network device receives at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device.
803:所述网络设备将所述至少一条流表项保存在存储空间中。803. The network device saves the at least one flow entry in a storage space.
可选的,在图8所对应实施例的基础上,图9为本发明实施例提供的一种流表项保存方法的方法流程图,包括:Optionally, on the basis of the corresponding embodiment of FIG. 8, FIG. 9 is a flowchart of a method for saving a flow entry according to an embodiment of the present disclosure, including:
901:所述网络设备获取所述控制器发送的请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息。901: The network device acquires a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device.
902:所述网络设备根据所述请求消息向所述控制器回复应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息。902: The network device sends a response message to the controller according to the request message, where the response message is used to notify the controller of the storage information on the network device.
903:所述网络设备接收所述控制器下发的至少一条流表项,所述至少一 条流表项用于在所述网络设备上实现一项功能。903: The network device receives at least one flow entry that is sent by the controller, where the at least one A flow entry is used to implement a function on the network device.
904:所述网络设备将所述至少一条流表项保存在存储空间中。904: The network device saves the at least one flow entry in a storage space.
可选的,所述请求消息是OpenFlow协议的扩展的Multipart请求消息,所述扩展的Multipart请求消息包括Type字段和请求Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;Optionally, the request message is an extended Multipart request message of the OpenFlow protocol, where the extended Multipart request message includes a Type field and a request Body field, where the Type field carries a type value indicating that the information is stored, the request Body field Empty or carry the device identification;
相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
实施例六Embodiment 6
图10为本发明实施例提供的一种流表项保存装置的装置结构图,所述流表项保存装置1000包括:FIG. 10 is a structural diagram of a device for saving a flow entry according to an embodiment of the present invention. The flow entry storage device 1000 includes:
发送单元1001,用于向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间。The sending unit 1001 is configured to send, to the controller, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry.
接收单元1002,用于接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能。The receiving unit 1002 is configured to receive at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device.
保存单元1003,用于将所述至少一条流表项保存在存储空间中。The saving unit 1003 is configured to save the at least one flow entry in the storage space.
可选的,所述接收单元1002还用于在触发所述发送单元1001之前,获取所述控制器发送的请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息。Optionally, the receiving unit 1002 is further configured to: before the triggering the sending unit 1001, acquire a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device.
所述发送单元1001具体用于根据所述请求消息向所述控制器回复应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息。The sending unit 1001 is specifically configured to reply a response message to the controller according to the request message, where the response message is used to notify the controller of the storage information on the network device.
可选的,所述请求消息是OpenFlow协议的扩展的Multipart请求消息,所述扩展的Multipart请求消息包括Type字段和请求Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识; Optionally, the request message is an extended Multipart request message of the OpenFlow protocol, where the extended Multipart request message includes a Type field and a request Body field, where the Type field carries a type value indicating that the information is stored, the request Body field Empty or carry the device identification;
相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
实施例七Example 7
本发明实施例还提供了一种流表项下发系统,所述系统包括控制器和网络设备:The embodiment of the invention further provides a flow entry delivery system, where the system includes a controller and a network device:
所述控制器用于获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识;根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;比对所述空闲空间与所述至少一条流表项的总容量;若所述空闲空间大于等于所述总容量,根据所述设备标识向所述网络设备下发所述至少一条流表项;若所述空闲空间小于所述总容量,不向所述网络设备下发所述至少一条流表项。The controller is configured to acquire at least one flow entry for implementing a function on a network device, and a device identifier of the network device, and acquire, according to the device identifier, storage information of the network device, where the storage information includes The network device is configured to store a free space in a storage space of the flow entry; compare the total capacity of the free space and the at least one flow entry; if the free space is greater than or equal to the total capacity, according to the The device identifier sends the at least one flow entry to the network device; if the free space is smaller than the total capacity, the at least one flow entry is not sent to the network device.
所述网络设备用于向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能;将所述至少一条流表项保存在存储空间中。The network device is configured to send the storage information of the network device to the controller, where the storage information includes a free space in the storage space of the network device for storing the flow entry; and receiving at least the issued by the controller A flow entry, the at least one flow entry being used to implement a function on the network device; and storing the at least one flow entry in a storage space.
实施例八Example eight
参阅图11,图11为本发明实施例提供的一种控制器的硬件结构示意图,所述控制器1100包括存储器1101、接收器1102和发送器1103,以及分别与所述存储器1101、所述接收器1102和所述发送器1103连接的处理器1104,所述存储器1101用于存储一组程序指令,所述处理器1104用于调用所述存储器1101存储的程序指令执行如下操作:Referring to FIG. 11, FIG. 11 is a schematic diagram of a hardware structure of a controller according to an embodiment of the present invention. The controller 1100 includes a memory 1101, a receiver 1102, and a transmitter 1103, and the receiving and the receiving, respectively. The processor 1104 is connected to the processor 1104. The memory 1101 is configured to store a set of program instructions, and the processor 1104 is configured to invoke the program instructions stored by the memory 1101 to perform the following operations:
触发所述接收器1102获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识; Triggering the receiver 1102 to acquire at least one flow entry for implementing a function on a network device and a device identifier of the network device;
根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;Obtaining the storage information of the network device according to the device identifier, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
比对所述空闲空间与所述至少一条流表项的总容量;Comparing the total capacity of the free space and the at least one flow entry;
若所述空闲空间大于等于所述总容量,触发所述发送器1103根据所述设备标识向所述网络设备下发所述至少一条流表项;If the free space is greater than or equal to the total capacity, the transmitter 1103 is configured to send the at least one flow entry to the network device according to the device identifier;
若所述空闲空间小于所述总容量,不触发所述发送器1103向所述网络设备下发所述至少一条流表项。If the vacant space is smaller than the total capacity, the transmitter 1103 is not triggered to deliver the at least one flow entry to the network device.
可选地,所述处理器1104可以为中央处理器(Central Processing Unit,CPU),所述存储器1101可以为随机存取存储器(Random Access Memory,RAM)类型的内部存储器,所述接收器1102和所述发送器1103可以包含普通物理接口,所述物理接口可以为以太(Ethernet)接口或异步传输模式(Asynchronous Transfer Mode,ATM)接口。所述处理器1104、发送器1103、接收器1102和存储器1101可以集成为一个或多个独立的电路或硬件,如:专用集成电路(Application Specific Integrated Circuit,ASIC)。Optionally, the processor 1104 may be a central processing unit (CPU), and the memory 1101 may be an internal memory of a random access memory (RAM) type, the receiver 1102 and The transmitter 1103 may include a common physical interface, and the physical interface may be an Ethernet interface or an Asynchronous Transfer Mode (ATM) interface. The processor 1104, the transmitter 1103, the receiver 1102, and the memory 1101 may be integrated into one or more independent circuits or hardware, such as an Application Specific Integrated Circuit (ASIC).
实施例九Example nine
参阅图12,图12为本发明实施例提供的一种网络设备的硬件结构示意图,所述网络设备1200包括存储器1201、接收器1202和发送器1203,以及分别与所述存储器1201、所述接收器1202和所述发送器1203连接的处理器1204,所述存储器1201用于存储一组程序指令,所述处理器1204用于调用所述存储器1201存储的程序指令执行如下操作:Referring to FIG. 12, FIG. 12 is a schematic diagram of a hardware structure of a network device according to an embodiment of the present invention. The network device 1200 includes a memory 1201, a receiver 1202, and a transmitter 1203, and the receiving and the receiving, respectively. The processor 1204 is connected to the processor 1203. The memory 1201 is configured to store a set of program instructions. The processor 1204 is configured to invoke the program instructions stored by the memory 1201 to perform the following operations:
触发所述接收器1202向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;Triggering the receiver 1202 to send, to the controller, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
触发所述发送器1203接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能;The transmitter 1203 is configured to receive at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device;
将所述至少一条流表项保存在存储空间中。The at least one flow entry is saved in the storage space.
可选地,所述处理器1204可以为CPU,所述存储器1201可以为RAM类型 的内部存储器,所述接收器1202和所述发送器1203可以包含普通物理接口,所述物理接口可以为Ethernet接口或ATM接口。所述处理器1204、发送器1203、接收器1202和存储器1201可以集成为一个或多个独立的电路或硬件,如:ASIC。Optionally, the processor 1204 may be a CPU, and the memory 1201 may be a RAM type. The internal memory, the receiver 1202 and the transmitter 1203 may comprise a common physical interface, and the physical interface may be an Ethernet interface or an ATM interface. The processor 1204, the transmitter 1203, the receiver 1202, and the memory 1201 may be integrated into one or more separate circuits or hardware, such as an ASIC.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质可以是下述介质中的至少一种:只读存储器(Read-Only Memory,ROM)、RAM、磁碟或者光盘等各种可以存储程序代码的介质。It can be understood by those skilled in the art that all or part of the steps of implementing the foregoing method embodiments may be performed by hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, and when executed, the program includes The foregoing steps of the method embodiment; and the foregoing storage medium may be at least one of the following: a read-only memory (ROM), a RAM, a magnetic disk, or an optical disk, and the like, which can store the program code. .
需要说明的是,本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于设备及系统实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的设备及系统实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。It is to be noted that the various embodiments in the present specification are described in a progressive manner, and the same similar parts between the various embodiments may be referred to each other, and each embodiment focuses on different embodiments from other embodiments. At the office. In particular, for the device and the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment. The apparatus and system embodiments described above are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without any creative effort.
以上所述仅是本发明的优选实施方式,并非用于限定本发明的保护范围。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。 The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of the present invention. It should be noted that a number of modifications and refinements may be made by those skilled in the art without departing from the principles of the invention, and such modifications and refinements are also considered to be within the scope of the invention.

Claims (19)

  1. 一种流表项下发方法,其特征在于,所述方法包括:A method for delivering a flow entry, characterized in that the method includes:
    控制器获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识;The controller acquires at least one flow entry for implementing a function on the network device and a device identifier of the network device;
    所述控制器根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;Obtaining, by the controller, the storage information of the network device according to the device identifier, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
    所述控制器比对所述空闲空间与所述至少一条流表项的总容量;The controller compares the total capacity of the free space and the at least one flow entry;
    若所述空闲空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项;And the controller sends the at least one flow entry to the network device according to the device identifier, if the free space is greater than or equal to the total capacity;
    若所述空闲空间小于所述总容量,所述控制器不向所述网络设备下发所述至少一条流表项。The controller does not deliver the at least one flow entry to the network device if the free space is smaller than the total capacity.
  2. 根据权利要求1所述的方法,其特征在于,所述用于存储流表项的存储空间中的空闲空间具体包括预留空闲空间和非预留空闲空间,所述至少一条流表项还具有对应的用户标识,所述方法还包括:The method according to claim 1, wherein the free space in the storage space for storing the flow entry specifically includes a reserved free space and a non-reserved free space, and the at least one flow entry further has Corresponding user identifier, the method further includes:
    所述控制器根据所述用户标识判断所述存储空间中是否具有所述用户标识对应的预留子空间,所述预留子空间为部分或全部所述预留空闲空间;Determining, by the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space;
    若具有所述预留子空间,所述控制器比对所述空闲空间与所述至少一条流表项的总容量,包括:If the reserved subspace is available, the controller compares the total capacity of the free space and the at least one flow entry, including:
    所述控制器比对所述预留子空间与所述至少一条流表项的总容量;The controller compares the total capacity of the reserved subspace and the at least one flow entry;
    若所述预留子空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项;If the reserved subspace is greater than or equal to the total capacity, the controller sends the at least one flow entry to the network device according to the device identifier;
    若所述预留子空间小于所述总容量,所述控制器比对所述非预留空闲空间与所述总容量;If the reserved subspace is smaller than the total capacity, the controller compares the non-reserved free space with the total capacity;
    若所述非预留空闲空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项;And the controller sends the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
    若所述非预留空闲空间小于所述总容量,所述控制器不向所述网络设备 下发所述至少一条流表项。If the non-reserved free space is less than the total capacity, the controller does not go to the network device The at least one flow entry is delivered.
  3. 根据权利要求2所述的方法,其特征在于,所述控制器根据所述用户标识判断所述存储空间中是否具有所述用户标识对应的预留子空间,还包括:The method according to claim 2, wherein the controller determines, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, and further includes:
    若不具有所述预留子空间,所述控制器比对所述非预留空闲空间与所述总容量;If the reserved subspace is not provided, the controller compares the non-reserved free space with the total capacity;
    若所述非预留空闲空间大于等于所述总容量,所述控制器根据所述设备标识向所述网络设备下发所述至少一条流表项;And the controller sends the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
    若所述非预留空闲空间小于所述总容量,所述控制器不向所述网络设备下发所述至少一条流表项。The controller does not deliver the at least one flow entry to the network device, if the non-reserved free space is smaller than the total capacity.
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述控制器根据所述设备标识获取所述网络设备的存储信息,包括:The method according to any one of claims 1 to 3, wherein the controller acquires the storage information of the network device according to the device identifier, including:
    所述控制器根据所述设备标识向所述网络设备发送请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息;Sending, by the controller, a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device;
    所述控制器接收所述网络设备根据所述请求消息回复的应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息;Receiving, by the controller, a response message that is replied by the network device according to the request message, where the response message is used to notify the controller of the storage information on the network device;
    所述控制器从所述应答消息中获取所述网络设备的所述存储信息。The controller acquires the storage information of the network device from the response message.
  5. 根据权利要求4所述的方法,其特征在于,所述请求消息是开放流OpenFlow协议的扩展的多部分Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求主体Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;The method according to claim 4, wherein the request message is an extended multipart Multipart request message of an OpenFlow OpenFlow protocol, the extended Multipart request message including a Type Type field and a Request Body Body field, The Type field carries a type value indicating that the information is stored, and the request body field is empty or carries the device identifier.
    相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
  6. 根据权利要求1至5任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1 to 5, further comprising:
    所述控制器在向所述网络设备下发所述至少一条流表项,或者接收到所述网络设备发送的流表项删除通知时,相应更新所述存储信息,所述流表项删除通知包括所述网络设备删除的流表项容量和所述删除的流表项在被删除 前在所述存储空间中所存储的位置。When the controller sends the at least one flow entry to the network device, or receives a flow entry deletion notification sent by the network device, the controller updates the storage information, and the flow entry deletion notification is The flow entry entry volume deleted by the network device and the deleted flow entry are deleted. The location previously stored in the storage space.
  7. 一种流表项下发装置,其特征在于,所述流表项下发装置包括:A flow table item issuing device, wherein the flow table item issuing device includes:
    获取单元,用于获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识;An obtaining unit, configured to acquire at least one flow entry for implementing a function on the network device, and a device identifier of the network device;
    查找单元,用于根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;a searching unit, configured to acquire, according to the device identifier, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
    比对单元,用于比对所述空闲空间与所述至少一条流表项的总容量;a comparison unit, configured to compare the total capacity of the free space and the at least one flow entry;
    若所述空闲空间大于等于所述总容量,触发发送单元根据所述设备标识向所述网络设备下发所述至少一条流表项;If the vacant space is greater than or equal to the total capacity, the trigger sending unit sends the at least one flow entry to the network device according to the device identifier;
    若所述空闲空间小于所述总容量,不触发所述发送单元向所述网络设备下发所述至少一条流表项。If the free space is smaller than the total capacity, the sending unit does not trigger the sending of the at least one flow entry to the network device.
  8. 根据权利要求7所述的装置,其特征在于,所述用于存储流表项的存储空间中的空闲空间具体包括预留空闲空间和非预留空闲空间,所述至少一条流表项还具有对应的用户标识,还包括:The device according to claim 7, wherein the free space in the storage space for storing the flow entry specifically includes a reserved free space and a non-reserved free space, and the at least one flow entry further has The corresponding user ID also includes:
    判断单元,用于根据所述用户标识判断所述存储空间中是否具有所述用户标识对应的预留子空间,所述预留子空间为部分或全部所述预留空闲空间;a determining unit, configured to determine, according to the user identifier, whether the storage space has a reserved subspace corresponding to the user identifier, where the reserved subspace is part or all of the reserved free space;
    若具有所述预留子空间,触发所述比对单元所包括的第一比对子单元,If the reserved subspace is provided, triggering the first comparison subunit included in the comparison unit,
    所述第一比对子单元,用于比对所述预留子空间与所述至少一条流表项的总容量;The first comparison subunit is configured to compare the total capacity of the reserved subspace and the at least one flow entry;
    若所述预留子空间大于等于所述总容量,触发所述发送单元根据所述设备标识向所述网络设备下发所述至少一条流表项;If the reserved subspace is greater than or equal to the total capacity, the sending unit is configured to send the at least one flow entry to the network device according to the device identifier;
    若所述预留子空间小于所述总容量,触发所述比对单元所包括的第二比对子单元,If the reserved subspace is smaller than the total capacity, triggering a second comparison subunit included in the comparison unit,
    所述第二比对子单元,用于比对所述非预留空闲空间与所述总容量;The second comparison subunit is configured to compare the non-reserved free space with the total capacity;
    若所述非预留空闲空间大于等于所述总容量,触发所述发送单元根据所述设备标识向所述网络设备下发所述至少一条流表项;And sending, by the sending unit, the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
    若所述非预留空闲空间小于所述总容量,不触发所述发送单元向所述网 络设备下发所述至少一条流表项。If the non-reserved free space is smaller than the total capacity, the sending unit is not triggered to the network The network device delivers the at least one flow entry.
  9. 根据权利要求8所述的装置,其特征在于,还包括:The device according to claim 8, further comprising:
    若所述判断单元的判断结果为不具有所述预留子空间,触发所述第二比对子单元;If the judgment result of the determining unit is that the reserved subspace is not provided, the second comparison subunit is triggered;
    若所述非预留空闲空间大于等于所述总容量,触发所述发送单元根据所述设备标识向所述网络设备下发所述至少一条流表项;And sending, by the sending unit, the at least one flow entry to the network device according to the device identifier, if the non-reserved free space is greater than or equal to the total capacity;
    若所述非预留空闲空间小于所述总容量,不触发所述发送单元向所述网络设备下发所述至少一条流表项。And sending, by the sending unit, the at least one flow entry to the network device, if the non-reserved free space is smaller than the total capacity.
  10. 根据权利要求7至9任一项所述的装置,其特征在于,所述查找单元还包括:The device according to any one of claims 7 to 9, wherein the searching unit further comprises:
    发送子单元,用于根据所述设备标识向所述网络设备发送请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息;a sending subunit, configured to send a request message to the network device according to the device identifier, where the request message is used to request to acquire the storage information of the network device;
    接收子单元,用于接收所述网络设备根据所述请求消息回复的应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息;a receiving subunit, configured to receive a response message that is sent by the network device according to the request message, where the response message is used to notify the controller of the storage information on the network device;
    获取子单元,用于从所述应答消息中获取所述网络设备的所述存储信息。And obtaining a subunit, configured to acquire the storage information of the network device from the response message.
  11. 根据权利要求10所述的装置,其特征在于,所述请求消息是开放流OpenFlow协议的扩展的多部分Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求主体Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;The apparatus according to claim 10, wherein the request message is an extended multipart Multipart request message of an OpenFlow OpenFlow protocol, the extended Multipart request message including a Type Type field and a Request Body Body field, The Type field carries a type value indicating that the information is stored, and the request body field is empty or carries the device identifier.
    相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
  12. 根据权利要求7至11任一项所述的装置,其特征在于,还包括:The device according to any one of claims 7 to 11, further comprising:
    更新单元,用于在向所述网络设备下发所述至少一条流表项,或者接收到所述网络设备发送的流表项删除通知时,相应更新所述存储信息,所述流表项删除通知包括所述网络设备删除的流表项容量和所述删除的流表项在被删除前在所述存储空间中所存储的位置。 And an update unit, configured to: when the at least one flow entry is sent to the network device, or the flow entry deletion notification sent by the network device is received, the storage information is updated, and the flow entry is deleted. The notification includes a flow entry capacity deleted by the network device and a location in the storage space before the deleted flow entry is deleted.
  13. 一种流表项保存方法,其特征在于,所述方法包括:A method for saving a flow entry, characterized in that the method comprises:
    网络设备向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;The network device sends the storage information of the network device to the controller, where the storage information includes a free space in the storage space used by the network device to store the flow entry;
    所述网络设备接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能;Receiving, by the network device, at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device;
    所述网络设备将所述至少一条流表项保存在存储空间中。The network device saves the at least one flow entry in a storage space.
  14. 根据权利要求13所述的方法,其特征在于,在所述网络设备向控制器发送所述网络设备的存储信息之前,还包括:The method according to claim 13, wherein before the network device sends the storage information of the network device to the controller, the method further includes:
    所述网络设备获取所述控制器发送的请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息;Obtaining, by the network device, a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device;
    所述网络设备向控制器发送所述网络设备的存储信息,包括:Sending, by the network device, the storage information of the network device to the controller, including:
    所述网络设备根据所述请求消息向所述控制器回复应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息。And the network device returns a response message to the controller according to the request message, where the response message is used to notify the controller of the stored information on the network device.
  15. 根据权利要求14所述的方法,其特征在于,所述请求消息是开放流OpenFlow协议的扩展的多部分Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求主体Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;The method according to claim 14, wherein the request message is an extended multipart Multipart request message of an OpenFlow OpenFlow protocol, the extended Multipart request message including a Type Type field and a Request Body Body field, The Type field carries a type value indicating that the information is stored, and the request body field is empty or carries the device identifier.
    相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
  16. 一种流表项保存装置,其特征在于,包括:A flow entry storage device, comprising:
    发送单元,用于向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;a sending unit, configured to send, to the controller, storage information of the network device, where the storage information includes a free space in a storage space used by the network device to store a flow entry;
    接收单元,用于接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能;a receiving unit, configured to receive at least one flow entry that is sent by the controller, where the at least one flow entry is used to implement a function on the network device;
    保存单元,用于将所述至少一条流表项保存在存储空间中。And a saving unit, configured to save the at least one flow entry in the storage space.
  17. 根据权利要求16所述的装置,其特征在于, The device of claim 16 wherein:
    所述接收单元还用于在触发所述发送单元之前,获取所述控制器发送的请求消息,所述请求消息用于请求获取所述网络设备的所述存储信息;The receiving unit is further configured to: before the triggering the sending unit, acquire a request message sent by the controller, where the request message is used to request to acquire the storage information of the network device;
    所述发送单元具体用于根据所述请求消息向所述控制器回复应答消息,所述应答消息用于向所述控制器通告所述网络设备上的所述存储信息。The sending unit is specifically configured to: reply, according to the request message, a response message to the controller, where the response message is used to notify the controller of the stored information on the network device.
  18. 根据权利要求17所述的装置,其特征在于,所述请求消息是开放流OpenFlow协议的扩展的多部分Multipart请求消息,所述扩展的Multipart请求消息包括类型Type字段和请求主体Body字段,所述Type字段携带指示存储信息的类型值,所述请求Body字段为空或者携带所述设备标识;The apparatus according to claim 17, wherein the request message is an extended multipart Multipart request message of an OpenFlow OpenFlow protocol, the extended Multipart request message including a Type Type field and a Request Body Body field, The Type field carries a type value indicating that the information is stored, and the request body field is empty or carries the device identifier.
    相应地,所述应答消息是OpenFlow协议的扩展的Multipart应答消息,所述Multipart应答消息包括所述Type字段和应答Body字段,所述应答Body字段携带所述网络设备的存储信息。Correspondingly, the response message is an extended Multipart response message of the OpenFlow protocol, the Multipart response message includes the Type field and a response Body field, and the response Body field carries the storage information of the network device.
  19. 一种流表项下发系统,其特征在于,所述系统包括控制器和网络设备:A flow entry delivery system, characterized in that the system comprises a controller and a network device:
    所述控制器用于获取用于在网络设备上实现一项功能的至少一条流表项以及所述网络设备的设备标识;根据所述设备标识获取所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;比对所述空闲空间与所述至少一条流表项的总容量;若所述空闲空间大于等于所述总容量,根据所述设备标识向所述网络设备下发所述至少一条流表项;若所述空闲空间小于所述总容量,不向所述网络设备下发所述至少一条流表项;The controller is configured to acquire at least one flow entry for implementing a function on a network device, and a device identifier of the network device, and acquire, according to the device identifier, storage information of the network device, where the storage information includes The network device is configured to store a free space in a storage space of the flow entry; compare the total capacity of the free space and the at least one flow entry; if the free space is greater than or equal to the total capacity, according to the The device identifier sends the at least one flow entry to the network device; if the free space is smaller than the total capacity, the at least one flow entry is not sent to the network device;
    所述网络设备用于向控制器发送所述网络设备的存储信息,所述存储信息包括所述网络设备用于存储流表项的存储空间中的空闲空间;接收所述控制器下发的至少一条流表项,所述至少一条流表项用于在所述网络设备上实现一项功能;将所述至少一条流表项保存在存储空间中。 The network device is configured to send the storage information of the network device to the controller, where the storage information includes a free space in the storage space of the network device for storing the flow entry; and receiving at least the issued by the controller A flow entry, the at least one flow entry being used to implement a function on the network device; and storing the at least one flow entry in a storage space.
PCT/CN2016/085130 2015-06-12 2016-06-07 Flow entry issuing method, flow entry storage method, relevant apparatus and system WO2016197917A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP16806815.3A EP3300321B1 (en) 2015-06-12 2016-06-07 Flow entry issuing method, flow entry storage method, relevant apparatus and system
US15/837,811 US10469388B2 (en) 2015-06-12 2017-12-11 Flow entry delivering method, flow entry storage method, related apparatus, and related system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510323801.6 2015-06-12
CN201510323801.6A CN106302184B (en) 2015-06-12 2015-06-12 Flow entry issuing method, flow entry storing method, related device and system

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/837,811 Continuation US10469388B2 (en) 2015-06-12 2017-12-11 Flow entry delivering method, flow entry storage method, related apparatus, and related system

Publications (1)

Publication Number Publication Date
WO2016197917A1 true WO2016197917A1 (en) 2016-12-15

Family

ID=57502864

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/085130 WO2016197917A1 (en) 2015-06-12 2016-06-07 Flow entry issuing method, flow entry storage method, relevant apparatus and system

Country Status (4)

Country Link
US (1) US10469388B2 (en)
EP (1) EP3300321B1 (en)
CN (1) CN106302184B (en)
WO (1) WO2016197917A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11374859B2 (en) 2020-08-04 2022-06-28 Pensando Systems, Inc. Flow table programming using flow miss metadata and burst action assist via CPU offload
US11456952B2 (en) 2020-08-04 2022-09-27 Pensando Systems, Inc. Methods and systems for removing expired flow table entries using an extended packet processing pipeline

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102724112A (en) * 2012-05-31 2012-10-10 华为技术有限公司 Transmission method, receiving terminal equipment and system based on TCP (transmission control protocol)
CN102893577A (en) * 2010-06-17 2013-01-23 松下电器产业株式会社 Data transmission device and data transmission method
CN104219150A (en) * 2014-09-03 2014-12-17 杭州华三通信技术有限公司 Method and device for issuing flow tables
CN104426815A (en) * 2013-08-27 2015-03-18 中兴通讯股份有限公司 Flow table issuing method and system in software-defined network, open flow controller and open flow switch
EP2858329A1 (en) * 2013-08-31 2015-04-08 Huawei Technologies Co., Ltd. Method and device for processing operation request in storage system

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101808159A (en) * 2010-03-10 2010-08-18 宇龙计算机通信科技(深圳)有限公司 Method for copying mobile terminal information, system and mobile terminal
CA2814488A1 (en) * 2010-10-15 2012-04-19 Nec Corporation Switch system, and data forwarding method
US9001827B2 (en) * 2010-12-17 2015-04-07 Big Switch Networks, Inc. Methods for configuring network switches
CN102289453B (en) * 2011-06-20 2013-09-18 北京星网锐捷网络技术有限公司 TCAM (ternary content addressable memory) rule storing method, device and network equipment
US9548920B2 (en) * 2012-10-15 2017-01-17 Cisco Technology, Inc. System and method for efficient use of flow table space in a network environment
WO2015123853A1 (en) * 2014-02-21 2015-08-27 华为技术有限公司 Data flow processing method and apparatus
CN104077191A (en) * 2014-07-18 2014-10-01 广州金山网络科技有限公司 Method and device used for managing memory resources
KR102286882B1 (en) * 2015-03-06 2021-08-06 삼성전자 주식회사 Method and apparatus for managing quality of experience

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102893577A (en) * 2010-06-17 2013-01-23 松下电器产业株式会社 Data transmission device and data transmission method
CN102724112A (en) * 2012-05-31 2012-10-10 华为技术有限公司 Transmission method, receiving terminal equipment and system based on TCP (transmission control protocol)
CN104426815A (en) * 2013-08-27 2015-03-18 中兴通讯股份有限公司 Flow table issuing method and system in software-defined network, open flow controller and open flow switch
EP2858329A1 (en) * 2013-08-31 2015-04-08 Huawei Technologies Co., Ltd. Method and device for processing operation request in storage system
CN104219150A (en) * 2014-09-03 2014-12-17 杭州华三通信技术有限公司 Method and device for issuing flow tables

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3300321A4 *

Also Published As

Publication number Publication date
US10469388B2 (en) 2019-11-05
CN106302184A (en) 2017-01-04
EP3300321A4 (en) 2018-05-30
US20180102974A1 (en) 2018-04-12
EP3300321B1 (en) 2020-09-30
CN106302184B (en) 2020-02-14
EP3300321A1 (en) 2018-03-28

Similar Documents

Publication Publication Date Title
US20220070095A1 (en) Data transmission method and apparatus, network adapter, and storage medium
KR101887581B1 (en) Flow-based packet transport device and packet management method thereof
WO2018090386A1 (en) Method, device and system for processing abnormities of nf modules
EP3179687B1 (en) Network flow information statistics method and apparatus
US9621412B2 (en) Method for guaranteeing service continuity in a telecommunication network and system thereof
CN109818917A (en) A kind of communication means and its device
WO2017071087A1 (en) Method, apparatus and equipment for transmission of information
WO2017036373A1 (en) Group call service processing method, terminal and core network element
US20130223424A1 (en) Management methods and related electronic devices and machine-readable storage mediums using the same
CN110633168A (en) Data backup method and system for distributed storage system
WO2016110078A1 (en) Data acquisition method and apparatus, and storage medium
US20170318521A1 (en) Method for realizing resource attribute notification, and common service entity
WO2016197917A1 (en) Flow entry issuing method, flow entry storage method, relevant apparatus and system
KR101920630B1 (en) System and method for assigining server to terminal and efficiently delivering messages to the terminal
CN111886843A (en) Low power consumption Bluetooth network maintenance method, electronic device, Bluetooth network and medium
WO2022111113A1 (en) Frequency channel switching method, terminal, base station, and storage medium
WO2017032110A1 (en) Application message processing system and method, and application device
WO2019091195A1 (en) Method for selecting service and session continuity mode, communication network element, and storage medium
WO2018082574A1 (en) Information sending method, unit and system
CN107689881B (en) Message processing method and device
US20090059840A1 (en) Wireless communication system and method for managing service flow identifier in the same
WO2015184610A1 (en) Method and device for sending packet
WO2018014708A1 (en) Data transmission method and device
CN113791733A (en) Information storage method, device, equipment and storage medium
CN107707480B (en) Message forwarding method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16806815

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2016806815

Country of ref document: EP