Abstract:
A network management method, device, and system used for network management and pertains to the communications field, where the method includes detecting bandwidth required by a first data flow, determining whether the bandwidth required by the first data flow is greater than a preset bandwidth value when the bandwidth required by the first data flow becomes higher, and allocating bandwidth to the first data flow when the bandwidth required by the first data flow is greater than the preset bandwidth value. Hence, a problem that a controller has relatively low efficiency when performing network management is resolved, thereby improving efficiency of performing network management by the controller.

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
       [0001]    This application is a continuation of International Patent Application No. PCT/CN2015/085589 filed on Jul. 30, 2015, which claims priority to Chinese Patent Application No. 201510039724.1 filed on Jan. 27, 2015. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties. 
     
    
     TECHNICAL FIELD 
       [0002]    The present disclosure relates to the communications field, and in particular, to a network management method, device, and system. 
       BACKGROUND 
       [0003]    With development of the Internet, people have an increasingly high requirement on network quality of service (QoS). However, workload on a router is relatively heavy because of enormous networks, diverse routing tables, and complex control algorithms, and consequently, network crashes frequently occur. 
         [0004]    As the OPENFLOW develops, an OPENFLOW-based QoS management system is proposed. The QoS management system includes a controller, a primary switch, and multiple ingress switches. There are multiple data flows on the multiple ingress switches. Further, the controller first constructs, according to QoS configuration information, a flow table including QoS information, constructs a bandwidth turnover information base (also referred to as a lent and borrowed bandwidth information base) of all data flows, and constructs a bandwidth sharing relationship. Then the controller sends the constructed flow table including the QoS information to switches corresponding to all the data flows, queries bandwidth occupied by each data flow, and generates, according to a flow table of all the data flows and the bandwidth occupied by each data flow, a lendable bandwidth information base corresponding to all the data flows. When receiving a data flow forwarded by an ingress switch, the primary switch queries bandwidth of the data flow. The primary switch forwards the data flow if the bandwidth of the data flow is greater than or equal to bandwidth required by the data flow, or the primary switch needs to detect whether a bandwidth borrowing failure flag is set on the data flow if the bandwidth of the data flow is less than bandwidth required by the data flow. The primary switch performs packet discarding processing on the data flow if the primary switch detects that a bandwidth borrowing failure flag is set on the data flow, or the primary switch generates a bandwidth request message according to the bandwidth required by the data flow, and sends the bandwidth request message to the controller if the primary switch detects that no bandwidth borrowing failure flag is set on the data flow, and the controller allocates bandwidth to the data flow according to the bandwidth request message. 
         [0005]    When the bandwidth of the data flow is less than the bandwidth required by the data flow, the primary switch needs to send the bandwidth request message to the controller in order to trigger the controller to allocate bandwidth to the data flow. Because a time period from a moment at which it is determined that the bandwidth of the data flow is less than the bandwidth required by the data flow to a moment at which the controller allocates bandwidth to the data flow is relatively long, the controller has relatively low efficiency when performing network management. 
       SUMMARY 
       [0006]    To resolve a problem that a controller has relatively low efficiency when performing network management, the present disclosure provides a network management method, device, and system. The technical solutions are as follows. 
         [0007]    According to a first aspect, a network management method is provided, where the network management method is applied to a controller in a network management system. The network management system includes the controller and multiple switches, where the multiple switches include a primary switch and multiple ingress switches, and there are multiple data flows on the multiple ingress switches, and the network management method includes detecting bandwidth required by a first data flow, where the first data flow is any one of the multiple data flows, determining whether the bandwidth required by the first data flow is greater than a preset bandwidth value when the bandwidth required by the first data flow becomes higher, and allocating bandwidth to the first data flow if the bandwidth required by the first data flow is greater than the preset bandwidth value. 
         [0008]    With reference to the first aspect, in a first possible implementation, before the detecting bandwidth required by a first data flow, the network management method further includes obtaining network QoS configuration information in the network management system, separately generating a shared bandwidth information tree, a bandwidth turnover information base, a flow table corresponding to each of the multiple data flows, and a correspondence between each of the multiple data flows and an ingress switch according to the QoS configuration information, where the shared bandwidth information tree records bandwidth corresponding to each of the multiple data flows, the bandwidth turnover information base records lent bandwidth corresponding to each of the multiple data flows and an identifier of a lending data flow, and borrowed bandwidth corresponding to each of the multiple data flows and an identifier of a borrowing data flow, and the flow table is used to indicate maximum bandwidth occupied by each of the multiple data flows, obtaining bandwidth occupied by each of the multiple data flows, determining, according to the bandwidth occupied by each of the multiple data flows and the flow table corresponding to each of the multiple data flows, lendable bandwidth corresponding to each of the multiple data flows, and generating a lendable bandwidth information base according to the lendable bandwidth corresponding to each of the multiple data flows, where the lendable bandwidth information base records the lendable bandwidth corresponding to each of the multiple data flows. 
         [0009]    With reference to the first possible implementation, in a second possible implementation, allocating bandwidth to the first data flow includes obtaining, from the bandwidth turnover information base, lent bandwidth corresponding to the first data flow, determining whether there is lent bandwidth on the first data flow according to the lent bandwidth corresponding to the first data flow, and allocating bandwidth to the first data flow according to a determining result of the lent bandwidth. 
         [0010]    With reference to the second possible implementation, in a third possible implementation, allocating bandwidth to the first data flow according to a determining result of the lent bandwidth includes obtaining, from the bandwidth turnover information base, an identifier of a lending data flow corresponding to the first data flow if there is lent bandwidth on the first data flow, obtaining, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the lending data flow, generating a first packet discard message according to the lent bandwidth corresponding to the first data flow, sending, according to the identifier of the ingress switch corresponding to the lending data flow, the first packet discard message to the ingress switch corresponding to the lending data flow such that the ingress switch corresponding to the lending data flow performs packet discarding according to the first packet discard message, and allocating the lent bandwidth to the first data flow. 
         [0011]    With reference to the second possible implementation, in a fourth possible implementation, allocating bandwidth to the first data flow according to a determining result of the lent bandwidth includes obtaining, from the lendable bandwidth information base, the lendable bandwidth corresponding to each of the multiple data flows if there is no lent bandwidth on the first data flow, determining, according to lendable bandwidth corresponding to other data flows other than the first data flow in the multiple data flows, whether there is lendable bandwidth on the other data flows, and allocating bandwidth to the first data flow according to a determining result of the lendable bandwidth. 
         [0012]    With reference to the fourth possible implementation, in a fifth possible implementation, allocating bandwidth to the first data flow according to a determining result of the lendable bandwidth includes selecting, from the other data flows and according to the bandwidth required by the first data flow and the lendable bandwidth corresponding to the other data flows, a data flow whose corresponding lendable bandwidth is greater than zero as a second data flow if there is lendable bandwidth on the other data flows, and allocating the lendable bandwidth corresponding to the second data flow to the first data flow. 
         [0013]    With reference to the fourth possible implementation, in a sixth possible implementation, allocating bandwidth to the first data flow according to a determining result of the lendable bandwidth includes obtaining priorities of all of the multiple data flows if there is no lendable bandwidth on the other data flows, obtaining, from the shared bandwidth information tree, bandwidth corresponding to the other data flows, selecting, from the other data flows and according to a priority of the first data flow, priorities of the other data flows, the bandwidth corresponding to the other data flows, and bandwidth required by a data flow on a first ingress switch, a data flow whose priority is lower than the priority of the first data flow as a third data flow, obtaining, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the third data flow, generating second packet discard message according to bandwidth corresponding to the third data flow, sending, according to the identifier of the ingress switch corresponding to the third data flow, the second packet discard message to the ingress switch corresponding to the third data flow such that the ingress switch corresponding to the third data flow performs packet discarding according to the second packet discard message, and allocating bandwidth corresponding to the third data flow to the first data flow. 
         [0014]    According to a second aspect, a network management device is provided, where the network management device is a controller, and the network management device includes a detection unit configured to detect bandwidth required by a first data flow, where the first data flow is any one of the multiple data flows, a judging unit configured to determine whether the bandwidth required by the first data flow is greater than a preset bandwidth value when the bandwidth required by the first data flow becomes higher, and an allocation unit configured to allocate bandwidth to the first data flow if the bandwidth required by the first data flow is greater than the preset bandwidth value. 
         [0015]    With reference to the second aspect, in a first possible implementation, the network management device further includes a first obtaining unit configured to obtain network QoS configuration information in the network management system, a first generation unit configured to separately generate a shared bandwidth information tree, a bandwidth turnover information base, a flow table corresponding to each of the multiple data flows, and a correspondence between each of the multiple data flows and an ingress switch according to the QoS configuration information, where the shared bandwidth information tree records bandwidth corresponding to each of the multiple data flows, the bandwidth turnover information base records lent bandwidth corresponding to each of the multiple data flows and an identifier of a lending data flow, and borrowed bandwidth corresponding to each of the multiple data flows and an identifier of a borrowing data flow, and the flow table is used to indicate maximum bandwidth occupied by each of the multiple data flows, a second obtaining unit configured to obtain bandwidth occupied by each of the multiple data flows, a determining unit configured to determine, according to the bandwidth occupied by each of the multiple data flows and the flow table corresponding to each of the multiple data flows, lendable bandwidth corresponding to each of the multiple data flows, and a second generation unit configured to generate a lendable bandwidth information base according to the lendable bandwidth corresponding to each of the multiple data flows, where the lendable bandwidth information base records the lendable bandwidth corresponding to each of the multiple data flows. 
         [0016]    With reference to the first possible implementation, in a second possible implementation, the allocation unit includes an obtaining module configured to obtain, from the bandwidth turnover information base, lent bandwidth corresponding to the first data flow, a determining module configured to determine whether there is lent bandwidth on the first data flow according to the lent bandwidth corresponding to the first data flow, and an allocation module configured to allocate bandwidth to the first data flow according to a determining result of the lent bandwidth. 
         [0017]    With reference to the second possible implementation, in a third possible implementation, the allocation module includes a first obtaining submodule configured to obtain, from the bandwidth turnover information base, an identifier of a lending data flow corresponding to the first data flow if there is lent bandwidth on the first data flow, a second obtaining submodule configured to obtain, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the lending data flow, a generation submodule configured to generate a first packet discard message according to the lent bandwidth corresponding to the first data flow, a sending submodule configured to send, according to the identifier of the ingress switch corresponding to the lending data flow, the first packet discard message to the ingress switch corresponding to the lending data flow such that the ingress switch corresponding to the lending data flow performs packet discarding according to the first packet discard message, and a first allocation submodule configured to allocate the lent bandwidth to the first data flow. 
         [0018]    With reference to the second possible implementation, in a fourth possible implementation, the allocation module includes a third obtaining submodule configured to obtain, from the lendable bandwidth information base, the lendable bandwidth corresponding to each of the multiple data flows if there is no lent bandwidth on the first data flow, a determining submodule configured to determine, according to lendable bandwidth corresponding to other data flows other than the first data flow in the multiple data flows, whether there is lendable bandwidth on the other data flows, and a second allocation submodule configured to allocate bandwidth to the first data flow according to a determining result of the lendable bandwidth. 
         [0019]    With reference to the fourth possible implementation, in a fifth possible implementation, the second allocation submodule is further configured to select, from the other data flows and according to the bandwidth required by the first data flow and the lendable bandwidth corresponding to the other data flows, a data flow whose corresponding lendable bandwidth is greater than zero as a second data flow if there is lendable bandwidth on the other data flows, and allocate the lendable bandwidth corresponding to the second data flow to the first data flow. 
         [0020]    With reference to the fourth possible implementation, in a sixth possible implementation, the second allocation submodule is further configured to obtain priorities of all of the multiple data flows if there is no lendable bandwidth on the other data flows, obtain, from the shared bandwidth information tree, bandwidth corresponding to the other data flows, select, from the other data flows and according to a priority of the first data flow, priorities of the other data flows, the bandwidth corresponding to the other data flows, and bandwidth required by a data flow on a first ingress switch, a data flow whose priority is lower than the priority of the first data flow as a third data flow, obtain, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the third data flow, generate second packet discard message according to bandwidth corresponding to the third data flow, send, according to the identifier of the ingress switch corresponding to the third data flow, the second packet discard message to the ingress switch corresponding to the third data flow such that the ingress switch corresponding to the third data flow performs packet discarding according to the second packet discard message, and allocate bandwidth corresponding to the third data flow to the first data flow. 
         [0021]    According to a third aspect, a network management system is provided, where the network management system includes any one of the foregoing network management devices. 
         [0022]    According to the network management method, device, and system that are provided in the present disclosure, a controller detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and allocates bandwidth to the first data flow when the bandwidth required by the first data flow is greater than the preset bandwidth value. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
     
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
         [0023]    To describe the technical solutions in the embodiments of the present disclosure more clearly, the following briefly describes the accompanying drawings required for describing the embodiments. The accompanying drawings in the following description show merely some embodiments of the present disclosure, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts. 
           [0024]      FIG. 1  is a schematic diagram of an architecture of a network management system according to an embodiment of the present disclosure; 
           [0025]      FIG. 2  is a flowchart of a network management method according to an embodiment of the present disclosure; 
           [0026]      FIG. 3  is a flowchart of another network management method according to an embodiment of the present disclosure; 
           [0027]      FIG. 4  is a flowchart of a bandwidth allocation method according to an embodiment of the present disclosure; 
           [0028]      FIG. 5  is a flowchart of a lent bandwidth allocation method according to an embodiment of the present disclosure; 
           [0029]      FIG. 6  is a flowchart of a lendable bandwidth allocation method according to an embodiment of the present disclosure; 
           [0030]      FIG. 7  is a flowchart of a method for allocating bandwidth of a ingress switch according to an embodiment of the present disclosure; 
           [0031]      FIG. 8  is a schematic structural diagram of a network management device according to an embodiment of the present disclosure; 
           [0032]      FIG. 9  is a schematic structural diagram of another network management device according to an embodiment of the present disclosure; 
           [0033]      FIG. 10  is a schematic structural diagram of an allocation unit according to an embodiment of the present disclosure; 
           [0034]      FIG. 11  is a schematic structural diagram of an allocation module according to an embodiment of the present disclosure; 
           [0035]      FIG. 12  is a schematic structural diagram of another allocation module according to an embodiment of the present disclosure; 
           [0036]      FIG. 13  is a schematic diagram of an architecture of a network management system according to an embodiment of the present disclosure; 
           [0037]      FIG. 14  is a schematic structural diagram of still another network management device according to an embodiment of the present disclosure; 
           [0038]      FIG. 15  is a schematic structural diagram of yet another network management device according to an embodiment of the present disclosure; and 
           [0039]      FIG. 16  is a schematic diagram of an architecture of another network management system according to an embodiment of the present disclosure. 
       
    
    
     DESCRIPTION OF EMBODIMENTS 
       [0040]    To make the objectives, technical solutions, and advantages of the present disclosure clearer, the following further describes the embodiments of the present disclosure in detail with reference to the accompanying drawings. 
         [0041]      FIG. 1  is a network management system  00  provided in an embodiment of the present disclosure. The network management system  00  may include a controller A and multiple switches. The multiple switches may include a primary switch B 4 , an ingress switch B 1 , an ingress switch B 2 , and an ingress switch B 3 . Multiple clients may include a client C 1 , a client C 2 , and a client C 3 . The client C 1  is connected to the ingress switch B 1 , the client C 2  is connected to the ingress switch B 2 , the client C 3  is connected to the ingress switch B 3 , and the ingress switch B 1 , the ingress switch B 2 , and the ingress switch B 3  are separately connected to the primary switch B 4 . The controller A can communicate with the multiple switches. Each client C 1 , C 2 , and C 3  can generate a data flow, an ingress switch connected to the client forwards the data flow to the primary switch B 4 , and the primary switch B 4  performs corresponding processing on the data flow. There may be multiple data flows on the multiple ingress switches. Particularly, an example in which the network management system  00  includes one primary switch and three ingress switches is used in  FIG. 1  for description. In actual application, neither a quantity of primary switches nor a quantity of ingress switches is limited. 
         [0042]    As shown in  FIG. 2 ,  FIG. 2  is a network management method provided in an embodiment of the present disclosure. The network management method is applied to a controller A in a network management system  00  in  FIG. 1 . The network management system may include a controller and multiple switches, the multiple switches may include a primary switch and multiple ingress switches, and there may be multiple data flows on the multiple ingress switches. The network management method may include the following steps. 
         [0043]    Step  201 : Detect bandwidth required by a first data flow, where the first data flow is any one of multiple data flows. 
         [0044]    Step  202 : When the bandwidth required by the first data flow becomes higher, determine whether the bandwidth required by the first data flow is greater than a preset bandwidth value. 
         [0045]    Step  203 : If the bandwidth required by the first data flow is greater than the preset bandwidth value, allocate bandwidth to the first data flow. 
         [0046]    In conclusion, according to the network management method provided in this embodiment of the present disclosure, a controller detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and allocates bandwidth to the first data flow when the bandwidth required by the first data flow is greater than the preset bandwidth value. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0047]    Further, before step  201 , the network management method may include obtaining network QoS configuration information in the network management system, and separately generating a shared bandwidth information tree, a bandwidth turnover information base, a flow table corresponding to each of the multiple data flows, and a correspondence between each of the multiple data flows and an ingress switch according to the QoS configuration information, where the shared bandwidth information tree records bandwidth corresponding to each of the multiple data flows, the bandwidth turnover information base records lent bandwidth corresponding to each of the multiple data flows and an identifier of a lending data flow, and borrowed bandwidth corresponding to each of the multiple data flows and an identifier of a borrowing data flow, and the flow table is used to indicate maximum bandwidth occupied by each of the multiple data flows, and obtaining bandwidth occupied by each of the multiple data flows, determining, according to the bandwidth occupied by each of the multiple data flows and the flow table corresponding to each of the multiple data flows, lendable bandwidth corresponding to each of the multiple data flows, and generating a lendable bandwidth information base according to the lendable bandwidth corresponding to each of the multiple data flows, where the lendable bandwidth information base records the lendable bandwidth corresponding to each of the multiple data flows. 
         [0048]    Further, step  203  may include obtaining, from the bandwidth turnover information base, lent bandwidth corresponding to the first data flow, determining whether there is lent bandwidth on the first data flow according to the lent bandwidth corresponding to the first data flow, and allocating bandwidth to the first data flow according to a determining result of the lent bandwidth. 
         [0049]    For example, allocating bandwidth to the first data flow according to a determining result of the lent bandwidth may include obtaining, from the bandwidth turnover information base, an identifier of a lending data flow corresponding to the first data flow if there is lent bandwidth on the first data flow, obtaining, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the lending data flow, generating a first packet discard message according to the lent bandwidth corresponding to the first data flow, sending, according to the identifier of the ingress switch corresponding to the lending data flow, the first packet discard message to the ingress switch corresponding to the lending data flow such that the ingress switch corresponding to the lending data flow performs packet discarding according to the first packet discard message, and allocating the lent bandwidth to the first data flow. 
         [0050]    Optionally, allocating bandwidth to the first data flow according to a determining result of the lent bandwidth may include obtaining, from the lendable bandwidth information base, the lendable bandwidth corresponding to each of the multiple data flows if there is no lent bandwidth on the first data flow, determining, according to lendable bandwidth corresponding to other data flows other than the first data flow in the multiple data flows, whether there is lendable bandwidth on the other data flows, and allocating bandwidth to the first data flow according to a determining result of the lendable bandwidth. 
         [0051]    Further, allocating bandwidth to the first data flow according to a determining result of the lendable bandwidth may include selecting, from the other data flows and according to the bandwidth required by the first data flow and the lendable bandwidth corresponding to the other data flows, a data flow whose corresponding lendable bandwidth is greater than zero as a second data flow if there is lendable bandwidth on the other data flows, and allocating the lendable bandwidth corresponding to the second data flow to the first data flow. 
         [0052]    For example, allocating bandwidth to the first data flow according to a determining result of the lendable bandwidth may include obtaining priorities of all of the multiple data flows if there is no lendable bandwidth on the other data flows, obtaining, from the shared bandwidth information tree, bandwidth corresponding to the other data flows, selecting, from the other data flows and according to a priority of the first data flow, priorities of the other data flows, the bandwidth corresponding to the other data flows, and bandwidth required by a data flow on the first ingress switch, a data flow whose priority is lower than the priority of the first data flow as a third data flow, obtaining, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the third data flow, generating second packet discard message according to bandwidth corresponding to the third data flow, sending, according to the identifier of the ingress switch corresponding to the third data flow, the second packet discard message to the ingress switch corresponding to the third data flow such that the ingress switch corresponding to the third data flow performs packet discarding according to the second packet discard message, and allocating bandwidth corresponding to the third data flow to the first data flow. 
         [0053]    In conclusion, according to the network management method provided in this embodiment of the present disclosure, a controller detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and when the bandwidth required by the first data flow is greater than the preset bandwidth value, allocates bandwidth to the first data flow. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0054]    As shown in  FIG. 3 , an embodiment of the present disclosure provides another network management method. The network management method may be applied to a network management system  00  in  FIG. 1 . The network management method may include the following steps. 
         [0055]    Step  301 : A controller detects bandwidth required by a first data flow, where the first data flow is any one of multiple data flows. 
         [0056]    For example, the controller may generate bandwidth detection information, obtain, from a correspondence that is between each of the multiple data flows and an ingress switch and that is stored in the controller, an identifier of an ingress switch corresponding to the first data flow, and send, according to the identifier of the ingress switch corresponding to the first data flow, the bandwidth detection information to the ingress switch corresponding to the first data flow. After receiving the bandwidth detection information, the ingress switch corresponding to the first data flow may generate a data flow bandwidth occupation message, and send the data flow bandwidth occupation message and an identifier of the first data flow to the controller. It should be noted that the data flow bandwidth occupation message may record the bandwidth required by the first data flow. 
         [0057]    Step  302 : When the bandwidth required by the first data flow becomes higher, the controller determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value. If the bandwidth required by the first data flow is greater than the preset bandwidth value, perform step  303 , or if the bandwidth required by the first data flow is not greater than the preset bandwidth value, perform step  304 . 
         [0058]    Further, when detecting that the bandwidth required by the first data flow becomes higher, the controller needs to determine whether the bandwidth that is required by the first data flow and that is detected in step  301  is greater than the preset bandwidth value. For example, the preset bandwidth value may be idle bandwidth on the first data flow. It should be noted that alternatively, the preset bandwidth value may be another value. This is not limited in this embodiment of the present disclosure. Optionally, when the controller detects that the bandwidth required by the first data flow becomes lower or remains unchanged, the controller may perform step  304 , that is, generate work instruction information used to instruct the ingress switch corresponding to the first data flow to forward the first data flow, and send the work instruction information to the ingress switch corresponding to the first data flow, and the ingress switch corresponding to the first data flow forwards the first data flow according to the work instruction information. 
         [0059]    Step  303 : The controller allocates bandwidth to the first data flow. 
         [0060]    For example, before step  301 , the controller may generate a shared bandwidth information tree, a bandwidth turnover information base, a lendable bandwidth information base, a flow table corresponding to each of the multiple data flows, and a correspondence between each of the multiple data flows and an ingress switch. The controller may allocate bandwidth to the first data flow according to the shared bandwidth information tree, the bandwidth turnover information base, the flow table corresponding to each of the multiple data flows, and the lendable bandwidth information base. 
         [0061]    A process in which the controller generates the shared bandwidth information tree, the bandwidth turnover information base, the flow table corresponding to each of the multiple data flows, and the correspondence between each of the multiple data flows and an ingress switch may be as follows. The controller may obtain QoS configuration information in the network management system, and separately generate, according to the QoS configuration information, the shared bandwidth information tree, the bandwidth turnover information base, the flow table corresponding to each of the multiple data flows, and the correspondence between each of the multiple data flows and an ingress switch. 
         [0062]    Further, the QoS configuration information may include identifiers of a primary switch and multiple ingress switches, an identifier of each data flow, bandwidth provided for each data flow, and information about lent and borrowed bandwidth on each of the multiple data flows. The controller may generate the shared bandwidth information tree and the flow table according to the identifier of each of the multiple data flows and the bandwidth provided for each of the multiple data flows. The shared bandwidth information tree records bandwidth corresponding to each of the multiple data flows. The flow table is used to indicate maximum bandwidth occupied by each of the multiple data flows. The controller may further generate the bandwidth turnover information base according to the information about the lent and borrowed bandwidth on each of the multiple data flows and the identifier of each of the multiple data flows. The bandwidth turnover information base records the lent bandwidth corresponding to each of the multiple data flows and an identifier of a lending data flow, and borrowed bandwidth corresponding to each of the multiple data flows and an identifier of a borrowed data flow. It should be noted that the controller may further send the flow table corresponding to each of the multiple data flows and that is generated by the controller to switches corresponding to each of the multiple data flows, and a switch that receives the flow table may forward a data flow when bandwidth required by the data flow on the switch is less than or equal to maximum bandwidth that is occupied by the data flow and that is indicated by the flow table. 
         [0063]    A process in which the controller generates the lendable bandwidth information base may be as follows. The controller obtains bandwidth occupied by each of the multiple data flows, and generates the lendable bandwidth information base according to the bandwidth occupied by each of the multiple data flows and the flow table corresponding to each of the multiple data flows. 
         [0064]    Further, for a method for obtaining, by the controller, the bandwidth occupied by each of the multiple data flows, refer to the method in step  301  in  FIG. 3  for detecting, by the controller, the bandwidth required by the first data flow. Details are not described in this embodiment of the present disclosure. The controller may subtract the bandwidth occupied by each of the multiple data flows from the maximum bandwidth that is occupied by each of the multiple data flows and that is indicated by the flow table corresponding to each of the multiple data flows in order to obtain the lendable bandwidth corresponding to each of the multiple data flows, and generate the lendable bandwidth information base according to the lendable bandwidth corresponding to each of the multiple data flows and the identifier of each of the multiple data flows, where the lendable bandwidth information base records the lendable bandwidth corresponding to each of the multiple data flows. 
         [0065]    For example, when maximum bandwidth that is indicated by a flow table corresponding to a data flow on an ingress switch B 1  and that is occupied by the data flow is 20 megabits per second (Mbps), and it is learned, by means of statistics collection, that bandwidth occupied by the data flow is 10 Mbps, the bandwidth 10 Mbps occupied by the data flow is subtracted from the maximum bandwidth 20 Mbps occupied by the data flow, and therefore, it is learned that lendable bandwidth of the data flow is 10 Mbps. 
         [0066]    Correspondingly, as shown in  FIG. 4 , step  303  may include the following steps. 
         [0067]    Step  3031 : The controller obtains, from a bandwidth turnover information base, lent bandwidth corresponding to the first data flow. 
         [0068]    The controller may obtain, from the bandwidth turnover information base established in step  302  and according to the identifier of the first data flow, the lent bandwidth corresponding to the first data flow. 
         [0069]    Step  3032 : The controller determines, according to the lent bandwidth of the first data flow, whether there is lent bandwidth on the first data flow. If there is lent bandwidth on the first data flow, perform step  3033 , or if there is no lent bandwidth on the first data flow, perform step  3034 . 
         [0070]    The controller may determine whether the lent bandwidth corresponding to the first data flow and that is obtained in step  3031  is greater than zero in order to determine whether there is lent bandwidth on the first data flow. If the lent bandwidth corresponding to the first data flow is greater than zero, the controller determines that there is lent bandwidth on the first data flow, and performs step  3033 , or if the lent bandwidth corresponding to the first data flow is not greater than zero, the controller determines that there is no lent bandwidth on the first data flow, and performs step  3034 . 
         [0071]    Step  3033 : The controller allocates the lent bandwidth corresponding to the first data flow to the first data flow. 
         [0072]    As shown in  FIG. 5 , step  3033  may include the following steps. 
         [0073]    Step  30331 : The controller generates a first packet discard message according to the lent bandwidth corresponding to the first data flow. 
         [0074]    For example, the first packet discard message may include a packet discard instruction and the lent bandwidth corresponding to the first data flow. The packet discard instruction is used to instruct an ingress switch to perform packet discarding according to the first packet discard message. 
         [0075]    Step  30332 : The controller obtains, from the bandwidth turnover information base, an identifier of a lending data flow corresponding to the first data flow. 
         [0076]    The controller may query, from the bandwidth turnover information base, the identifier of the lending data flow corresponding to the first data flow. It should be noted that there may be one or more lending data flows corresponding to the first data flow. Therefore, there may be one or more identifiers of the lending data flows corresponding to the first data flow. 
         [0077]    Step  30333 : The controller obtains, from a correspondence between each of the multiple data flows and an ingress switch according to the identifier of the lending data flow, an identifier of an ingress switch corresponding to the lending data flow. 
         [0078]    Step  30334 : The controller sends, according to the identifier of the ingress switch corresponding to the lending data flow, the first packet discard message to the ingress switch corresponding to the lending data flow. 
         [0079]    Further, the controller may send, according to the identifier that is of the ingress switch corresponding to the lending data flow and that is obtained in step  30333 , the first packet discard message generated in step  30331  to the ingress switch corresponding to the lending data flow. 
         [0080]    Step  30335 : The ingress switch corresponding to the lending data flow performs packet discarding according to the first packet discard message. 
         [0081]    For example, if the ingress switch corresponding to the lending data flow is an ingress switch B 2 , the lent bandwidth corresponding to the first data flow is 10 Mbps. After the ingress switch B 2  receives the first packet discard message, the ingress switch B 2  may perform packet discarding on data flows of 10 Mbps on the ingress switch B 2  according to the first packet discard message. 
         [0082]    Step  30336 : The controller allocates the lent bandwidth corresponding to the first data flow to the first data flow. 
         [0083]    After the ingress switch corresponding to the lending data flow performs packet discarding according to the packet discard instruction and the lent bandwidth corresponding to the first data flow that are in the first packet discard message, the controller may allocate the lent bandwidth corresponding to the first data flow to the first data flow, and update, according to the lent bandwidth corresponding to the first data flow, a flow table corresponding to a data flow on the first ingress switch. Optionally, the controller may further update the shared bandwidth information tree, the bandwidth turnover information base, and the lendable bandwidth information base that are in the controller. 
         [0084]    In one embodiment, after allocating the lent bandwidth corresponding to the first data flow to the first data flow, the controller may detect whether maximum bandwidth occupied by the first data flow after the bandwidth is allocated is less than the bandwidth required by the first data flow. If the maximum bandwidth occupied by the first data flow after the bandwidth is allocated is less than the bandwidth required by the first data flow, the controller performs step  3034  to allocate lendable bandwidth corresponding to other data flows other than the first data flow in the multiple data flows to the first data flow. 
         [0085]    Step  3034 : The controller obtains, from lendable bandwidth information base, lendable bandwidth corresponding to each of the multiple data flows. 
         [0086]    For example, the controller may obtain, from the generated lendable bandwidth information base, the lendable bandwidth corresponding to each of the multiple data flows. 
         [0087]    Step  3035 : The controller determines, according to lendable bandwidth corresponding to other data flows other than the first data flow in the multiple data flows, whether there is lendable bandwidth on the other data flows. If there is lendable bandwidth on the other data flows, perform step  3036 , or if there is no lendable bandwidth on the other data flows, perform step  3037 . 
         [0088]    The controller may obtain, according to the lendable bandwidth corresponding to the other data flows, the lendable bandwidth corresponding to the other data flows, and determine whether the lendable bandwidth corresponding to the other data flows is greater than zero. If the lendable bandwidth corresponding to the other data flows is greater than zero, there is lendable bandwidth on the other data flows, or if the lendable bandwidth corresponding to the other data flows is not greater than zero, there is no lendable bandwidth on the other data flows. 
         [0089]    Step  3036 : The controller allocates the lendable bandwidth to the first data flow. 
         [0090]    As shown in  FIG. 6 , step  3036  may include the following steps. 
         [0091]    Step  30361 : The controller selects, from the other data flows and according to the bandwidth required by the first data flow and the lendable bandwidth corresponding to the other data flows, a data flow whose corresponding lendable bandwidth is greater than zero as a second data flow. 
         [0092]    Further, if the bandwidth required by the first data flow is 30 Mbps, 30 Mbps bandwidth needs to be allocated to the first data flow. It is assumed that data flows that are in the other data flows other than the first data flow in the multiple data flows and whose corresponding lendable bandwidth is not zero are a data flow  1 , a data flow  2 , and a data flow  3 . 
         [0093]    If a sum of lendable bandwidth corresponding to the data flow  1 , the data flow  2 , and the data flow  3  is greater than the bandwidth required by the first data flow, data flows whose sum of corresponding lendable bandwidth is greater than or equal to the bandwidth required by the first data flow are selected from the data flow  1 , the data flow  2 , and the data flow  3  as the second data flow, or if a sum of lendable bandwidth corresponding to the data flow  1 , the data flow  2 , and the data flow  3  is equal to or less than a difference between the bandwidth required by the first data flow and the lendable bandwidth corresponding to the first data flow, each data flow whose corresponding lendable bandwidth is not zero is selected from the other data flows other than the first data flow in the multiple data flows as the second data flow, that is, the data flow  1 , the data flow  2 , and the data flow  3  are selected as the second data flow. 
         [0094]    Step  30362 : The controller allocates the lendable bandwidth corresponding to the second data flow to the first data flow. 
         [0095]    For example, the controller may allocate, according to the lendable bandwidth corresponding to the second data flow, the lendable bandwidth corresponding to the second data flow to the first data flow, update a flow table corresponding to the first data flow and the second data flow, and send an updated flow table corresponding to the first data flow and the second data flow to the ingress switch corresponding to the first data flow and an ingress switch corresponding to the second data flow. Optionally, the controller may further update the shared bandwidth information tree, the bandwidth turnover information base, and the lendable bandwidth information base that are in the controller. 
         [0096]    In one embodiment, after allocating the lendable bandwidth corresponding to the second data flow to the first data flow, the controller may detect whether maximum bandwidth occupied by the first data flow after the bandwidth is allocated is less than the bandwidth required by the first data flow. If the maximum bandwidth occupied by the first data flow after the bandwidth is allocated is less than the bandwidth required by the first data flow, the controller performs step  3037  to allocate bandwidth corresponding to a data flow that is in the multiple data flows and whose priority is lower than that of the first data flow to the first data flow. 
         [0097]    Step  3037 : The controller allocates bandwidth of a third data flow to the first data flow, where a priority of the third data flow is lower than a priority of the first data flow. 
         [0098]    As shown in  FIG. 7 , step  3037  may include the following steps. 
         [0099]    Step  30371 : The controller obtains priorities of all of the multiple data flows. 
         [0100]    It should be noted that the flow table corresponding to each of the multiple data flows generated by the controller may further include priority information corresponding to each of the multiple data flows. The controller may obtain, from the flow table corresponding to each of the multiple data flows, the priority information corresponding to each of the multiple data flows. The priority information of all of the multiple data flows may include priorities of all of the multiple data flows. 
         [0101]    Step  30372 : The controller obtains, from a shared bandwidth information tree, bandwidth corresponding to each of the other data flows other than the first data flow in the multiple data flows. 
         [0102]    For example, because the shared bandwidth information tree records the bandwidth corresponding to each of the multiple data flows, the controller may obtain, from the shared bandwidth information tree, the bandwidth corresponding to each of the other data flows other than the first data flow in the multiple data flows. 
         [0103]    Step  30373 : The controller selects, from the other data flows and according to priorities of all the data flows in the other data flows, the priority of the first data flow, the bandwidth corresponding to each of the other data flows, and the bandwidth required by the first data flow, a data flow whose data flow priority is lower than the priority of the first data flow as the third data flow. 
         [0104]    Further, if the bandwidth required by the first data flow is 30 Mbps, 30 Mbps bandwidth needs to be allocated to the first data flow. It is assumed that data flows that are in the other data flows other than the first data flow in the multiple data flows and whose priorities are lower than the priority of the first data flow are the data flow  1 , the data flow  2 , and the data flow  3 . 
         [0105]    If a sum of bandwidth corresponding to the data flow  1 , the data flow  2 , and the data flow  3  is greater than the bandwidth required by the first data flow, data flows whose sum of corresponding bandwidth is greater than or equal to the bandwidth required by the first data flow are selected from the data flow  1 , the data flow  2 , and the data flow  3  as the third data flow, or if a sum of bandwidth corresponding to the data flow  1 , the data flow  2 , and the data flow  3  is equal to or less than the bandwidth required by the first data flow, each of the other data flows other than the first data flow in the multiple data flows is selected as the third data flow, that is, the data flow  1 , the data flow  2 , and the data flow  3  are selected as the third data flow. 
         [0106]    Step  30374 : The controller generates second packet discard message according to bandwidth corresponding to the third data flow. 
         [0107]    For example, the second packet discard message may include a packet discard instruction and the bandwidth corresponding to the third data flow. The packet discard instruction is used to instruct an ingress switch to perform packet discarding according to the second packet discard message. 
         [0108]    Step  30375 : The controller obtains, from the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the third data flow. 
         [0109]    Step  30376 : The controller sends, according to the identifier of the ingress switch corresponding to the third data flow, the second packet discard message to the ingress switch corresponding to the third data flow. 
         [0110]    Further, the controller may send the second packet discard message generated in step  30374  to the ingress switch corresponding to the third data flow. 
         [0111]    Step  30377 : The ingress switch corresponding to the third data flow performs packet discarding according to the second packet discard message. 
         [0112]    For example, if the ingress switch corresponding to the third data flow is an ingress switch B 3 , the bandwidth corresponding to the third data flow is 10 Mbps. Therefore, after the ingress switch B 3  receives the second packet discard message, the ingress switch B 3  may perform packet discarding on data flows of 10 Mbps on the ingress switch B 3  according to the second packet discard message such that 10 Mbps bandwidth on a data flow on the ingress switch B 3  is in an idle state. 
         [0113]    Step  30378 : The controller allocates the bandwidth corresponding to the third data flow to the first data flow. 
         [0114]    For example, the controller may allocate, according to the bandwidth corresponding to the third data flow, the bandwidth corresponding to the third data flow to the first data flow, update a flow table corresponding to the first data flow and the third data flow, and send an updated flow table corresponding to the first data flow and the third data flow to the ingress switches corresponding to the first data flow and the third data flow. Optionally, the controller may further update the shared bandwidth information tree, the bandwidth turnover information base, and the lendable bandwidth information base that are in the controller. 
         [0115]    In one embodiment, after allocating the bandwidth corresponding to the third data flow to the first data flow, the controller may detect whether maximum bandwidth occupied by the first data flow after the bandwidth is allocated is less than the bandwidth required by the first data flow. If the maximum bandwidth occupied by the first data flow after the bandwidth is allocated is less than the bandwidth required by the first data flow, the controller performs packet discarding on the first data flow. In the prior art, the ingress switch corresponding to the first data flow forwards the first data flow to a primary switch, and the primary switch determines whether remaining bandwidth on the first data flow is less than the bandwidth required by the first data flow, and when the remaining bandwidth on the first data flow is less than the bandwidth required by the first data flow, performs packet discarding on the first data flow. Because the ingress switch corresponding to the first data flow forwards the first data flow to the primary switch, network resources are occupied. In the present disclosure, the controller directly performs determining, and performs corresponding processing according to a determining result such that the ingress switch corresponding to the first data flow does not need to forward the first data flow. Therefore, network resources are saved. 
         [0116]    Step  304 : The controller generates work instruction information. 
         [0117]    Further, if a determining result in step  302  is that the bandwidth required by the first data flow is not greater than the preset bandwidth value, the controller may generate a forward message. The forward message is used to instruct a switch to forward the first data flow. 
         [0118]    Step  305 : The controller obtains, from the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the first data flow. 
         [0119]    Step  306 : The controller sends, according to the identifier of the ingress switch corresponding to the first data flow, the work instruction information to the ingress switch corresponding to the first data flow. 
         [0120]    The controller may send, according to the identifier of the first data flow, the work instruction information to the ingress switch corresponding to the first data flow. 
         [0121]    Step  307 : The ingress switch corresponding to the first data flow forwards the first data flow according to the work instruction information. 
         [0122]    For example, the ingress switch corresponding to the first data flow may forward the first data flow to the primary switch, and the primary switch performs, according to information in the first data flow, corresponding processing on the first data flow. 
         [0123]    It should be noted that a sequence of the steps of the network management method provided in this embodiment of the present disclosure may be adjusted properly, and a step may also be added or removed according to a situation. All modified methods that may be readily figured out by any person skilled in the art without departing from the technical scope disclosed in the present disclosure shall fall within the protection scope of the present disclosure. Therefore, details are not described. 
         [0124]    In conclusion, according to the network management method provided in this embodiment of the present disclosure, a controller detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and when the bandwidth required by the first data flow is greater than the preset bandwidth value, allocates bandwidth to the first data flow. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0125]    As shown in  FIG. 8 , an embodiment of the present disclosure provides a network management device  80 . The network management device  80  may be a controller. The network management device  80  may include a detection unit  801  configured to detect bandwidth required by a first data flow, where the first data flow is any one of multiple data flows, a judging unit  802  configured to determine whether the bandwidth required by the first data flow is greater than a preset bandwidth value when the bandwidth required by the first data flow becomes higher, and an allocation unit  803  configured to allocate bandwidth to the first data flow if the bandwidth required by the first data flow is greater than the preset bandwidth value. 
         [0126]    In conclusion, according to the network management device  80  provided in this embodiment of the present disclosure, a detection unit  801  detects bandwidth required by a first data flow, a judging unit  802  determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and when the bandwidth required by the first data flow is greater than the preset bandwidth value, an allocation unit  803  allocates bandwidth to the first data flow. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0127]    As shown in  FIG. 9 , an embodiment of the present disclosure provides another network management device  80 . The network management device  80  may be a controller. The network management device  80  may include a detection unit  801  configured to detect bandwidth required by a first data flow, where the first data flow is any one of multiple data flows, a judging unit  802  configured to determine whether the bandwidth required by the first data flow is greater than a preset bandwidth value when the bandwidth required by the first data flow becomes higher, an allocation unit  803  configured to allocate bandwidth to the first data flow if the bandwidth required by the first data flow is greater than the preset bandwidth value, a first obtaining unit  804  configured to obtain network QoS configuration information in the network management system, a first generation unit  805  configured to separately generate a shared bandwidth information tree, a bandwidth turnover information base, a flow table corresponding to each of the multiple data flows, and a correspondence between each of the multiple data flows and an ingress switch according to the QoS configuration information, where the shared bandwidth information tree records bandwidth corresponding to each of the multiple data flows, the bandwidth turnover information base records lent bandwidth corresponding to each of the multiple data flows and an identifier of a lending data flow, and borrowed bandwidth corresponding to each of the multiple data flows and an identifier of a borrowing data flow, and the flow table is used to indicate maximum bandwidth occupied by each of the multiple data flows, a second obtaining unit  806  configured to obtain bandwidth occupied by each of the multiple data flows, a determining unit  807  configured to determine, according to the bandwidth occupied by each of the multiple data flows and the flow table corresponding to each of the multiple data flows, lendable bandwidth corresponding to each of the multiple data flows, and a second generation unit  808  configured to generate a lendable bandwidth information base according to the lendable bandwidth corresponding to each of the multiple data flows, where the lendable bandwidth information base records the lendable bandwidth corresponding to each of the multiple data flows. 
         [0128]    In conclusion, according to the network management device  80  provided in this embodiment of the present disclosure, a detection unit  801  detects bandwidth required by a first data flow, a judging unit  802  determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and when the bandwidth required by the first data flow is greater than the preset bandwidth value, an allocation unit  803  allocates bandwidth to the first data flow. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0129]    As shown in  FIG. 10 , the allocation unit  803  may include an obtaining module  8031  configured to obtain, from the bandwidth turnover information base, lent bandwidth corresponding to the first data flow, a determining module  8032  configured to determine whether there is lent bandwidth on the first data flow according to the lent bandwidth corresponding to the first data flow, and an allocation module  8033  configured to allocate bandwidth to the first data flow according to a determining result of the lent bandwidth. 
         [0130]    According to an embodiment, as shown in  FIG. 11 , the allocation module  8033  may include a first obtaining submodule  80331  configured to obtain, from the bandwidth turnover information base, an identifier of a lending data flow corresponding to the first data flow if there is lent bandwidth on the first data flow, a second obtaining submodule  80332  configured to obtain, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the lending data flow, a generation submodule  80333  configured to generate a first packet discard message according to the lent bandwidth corresponding to the first data flow, a sending submodule  80334  configured to send, according to the identifier of the ingress switch corresponding to the lending data flow, the first packet discard message to the ingress switch corresponding to the lending data flow such that the ingress switch corresponding to the lending data flow performs packet discarding according to the first packet discard message, and a first allocation submodule  80335  configured to allocate the lent bandwidth to the first data flow. 
         [0131]    According to another embodiment, as shown in  FIG. 12 , the allocation module  8033  may include a third obtaining submodule  80336  configured to obtain, from the lendable bandwidth information base, the lendable bandwidth corresponding to each of the multiple data flows if there is no lent bandwidth on the first data flow, a determining submodule  80337  configured to determine, according to lendable bandwidth corresponding to other data flows other than the first data flow in the multiple data flows, whether there is lendable bandwidth on the other data flows, and a second allocation submodule  80338  configured to allocate bandwidth to the first data flow according to a determining result of the lendable bandwidth. 
         [0132]    According to an aspect, the second allocation submodule  80338  is further configured to select, from the other data flows and according to the bandwidth required by the first data flow and the lendable bandwidth corresponding to the other data flows, a data flow whose corresponding lendable bandwidth is greater than zero as a second data flow if there is lendable bandwidth on the other data flows, and allocate the lendable bandwidth corresponding to the second data flow to the first data flow. 
         [0133]    According to another aspect, the second allocation submodule  80338  is further configured to obtain priorities of all of the multiple data flows if there is no lendable bandwidth on the other data flows, obtain, from the shared bandwidth information tree, bandwidth corresponding to the other data flows, select, from the other data flows and according to a priority of the first data flow, priorities of the other data flows, the bandwidth corresponding to the other data flows, and bandwidth required by a data flow on the first ingress switch, a data flow whose priority is lower than the priority of the first data flow as a third data flow, and obtain, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the third data flow, generate second packet discard message according to bandwidth corresponding to the third data flow, send, according to the identifier of the ingress switch corresponding to the third data flow, the second packet discard message to the ingress switch corresponding to the third data flow such that the ingress switch corresponding to the third data flow performs packet discarding according to the second packet discard message, and allocate bandwidth corresponding to the third data flow to the first data flow. 
         [0134]    In conclusion, according to the network management device  80  provided in this embodiment of the present disclosure, a detection unit  801  detects bandwidth required by a first data flow, a judging unit  802  determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and when the bandwidth required by the first data flow is greater than the preset bandwidth value, an allocation unit  803  allocates bandwidth to the first data flow. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0135]    As shown in  FIG. 13 , an embodiment of the present disclosure provides a network management system  130 . The network management system  130  may include a network management device  1301 . The network management device  1301  may be the network management device  80  shown in  FIG. 8  or  FIG. 9 . 
         [0136]    In conclusion, according to the network management system  130  provided in this embodiment of the present disclosure, a controller detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and when the bandwidth required by the first data flow is greater than the preset bandwidth value, allocates bandwidth to the first data flow. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0137]    As shown in  FIG. 14 , an embodiment of the present disclosure provides still another network management device  140 . The network management device  140  may be a controller. The network management device  140  may include a processor  1401  configured to detect bandwidth required by a first data flow, where the first data flow is any one of multiple data flows. 
         [0138]    The processor  1401  is further configured to determine whether the bandwidth required by the first data flow is greater than a preset bandwidth value when the bandwidth required by the first data flow becomes higher. 
         [0139]    The processor  1401  is further configured to allocate bandwidth to the first data flow if the bandwidth required by the first data flow is greater than the preset bandwidth value. 
         [0140]    In conclusion, according to the network management device  140  provided in this embodiment of the present disclosure, the processor  1401  detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and allocates bandwidth to the first data flow when the bandwidth required by the first data flow is greater than the preset bandwidth value. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0141]    As shown in  FIG. 15 , an embodiment of the present disclosure provides yet another network management device  150 . The network management device  150  may be a controller. The network management device  150  may include a processor  1501  configured to detect bandwidth required by a first data flow, where the first data flow is any one of multiple data flows. 
         [0142]    The processor  1501  is further configured to determine whether the bandwidth required by the first data flow is greater than a preset bandwidth value when the bandwidth required by the first data flow becomes higher. 
         [0143]    The processor  1501  is further configured to allocate bandwidth to the first data flow if the bandwidth required by the first data flow is greater than the preset bandwidth value. 
         [0144]    The processor  1501  is further configured to obtain network QoS configuration information in the network management system. 
         [0145]    The processor  1501  is further configured to separately generate a shared bandwidth information tree, a bandwidth turnover information base, a flow table corresponding to each of the multiple data flows, and a correspondence between each of the multiple data flows and an ingress switch according to the QoS configuration information, where the shared bandwidth information tree records bandwidth corresponding to each of the multiple data flows, the bandwidth turnover information base records lent bandwidth corresponding to each of the multiple data flows and an identifier of a lending data flow, and borrowed bandwidth corresponding to each of the multiple data flows and an identifier of a borrowing data flow, and the flow table is used to indicate maximum bandwidth occupied by each of the multiple data flows. 
         [0146]    The processor  1501  is further configured to obtain bandwidth occupied by each of the multiple data flows. 
         [0147]    The processor  1501  is further configured to determine, according to the bandwidth occupied by each of the multiple data flows and the flow table corresponding to each of the multiple data flows, lendable bandwidth corresponding to each of the multiple data flows. 
         [0148]    The processor  1501  is further configured to generate a lendable bandwidth information base according to the lendable bandwidth corresponding to each of the multiple data flows, where the lendable bandwidth information base records the lendable bandwidth corresponding to each of the multiple data flows. 
         [0149]    In conclusion, according to the network management device  150  provided in this embodiment of the present disclosure, the processor  1501  detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and allocates bandwidth to the first data flow when the bandwidth required by the first data flow is greater than the preset bandwidth value. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0150]    The processor  1501  is further configured to obtain, from the bandwidth turnover information base, lent bandwidth corresponding to the first data flow. 
         [0151]    The processor  1501  is further configured to determine whether there is lent bandwidth on the first data flow according to the lent bandwidth corresponding to the first data flow. 
         [0152]    The processor  1501  is further configured to allocate bandwidth to the first data flow according to a determining result of the lent bandwidth. 
         [0153]    The processor  1501  is further configured to obtain, from the bandwidth turnover information base, an identifier of a lending data flow corresponding to the first data flow if there is lent bandwidth on the first data flow. 
         [0154]    The processor  1501  is further configured to obtain, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the lending data flow. 
         [0155]    The processor  1501  is further configured to generate a first packet discard message according to the lent bandwidth corresponding to the first data flow. 
         [0156]    The processor  1501  is further configured to send, according to the identifier of the ingress switch corresponding to the lending data flow, the first packet discard message to the ingress switch corresponding to the lending data flow such that the ingress switch corresponding to the lending data flow performs packet discarding according to the first packet discard message. 
         [0157]    The processor  1501  is further configured to allocate the lent bandwidth to the first data flow. 
         [0158]    The processor  1501  is further configured to obtain, from the lendable bandwidth information base, the lendable bandwidth corresponding to each of the multiple data flows if there is no lent bandwidth on the first data flow. 
         [0159]    The processor  1501  is further configured to determine, according to lendable bandwidth corresponding to other data flows other than the first data flow in the multiple data flows, whether there is lendable bandwidth on the other data flows. 
         [0160]    The processor  1501  is further configured to allocate bandwidth to the first data flow according to a determining result of the lendable bandwidth. 
         [0161]    The processor  1501  is further configured to select, from the other data flows and according to the bandwidth required by the first data flow and the lendable bandwidth corresponding to the other data flows, a data flow whose corresponding lendable bandwidth is greater than zero as a second data flow if there is lendable bandwidth on the other data flows, and allocate the lendable bandwidth corresponding to the second data flow to the first data flow. 
         [0162]    The processor  1501  is further configured to obtain priorities of all of the multiple data flows if there is no lendable bandwidth on the other data flows, obtain, from the shared bandwidth information tree, bandwidth corresponding to the other data flows, select, from the other data flows and according to a priority of the first data flow, priorities of the other data flows, the bandwidth corresponding to the other data flows, and bandwidth required by a data flow on the first ingress switch, a data flow whose priority is lower than the priority of the first data flow as a third data flow, obtain, according to the correspondence between each of the multiple data flows and an ingress switch, an identifier of an ingress switch corresponding to the third data flow, generate second packet discard message according to bandwidth corresponding to the third data flow, send, according to the identifier of the ingress switch corresponding to the third data flow, the second packet discard message to the ingress switch corresponding to the third data flow such that the ingress switch corresponding to the third data flow performs packet discarding according to the second packet discard message, and allocate bandwidth corresponding to the third data flow to the first data flow. 
         [0163]    In conclusion, according to the network management device  150  provided in this embodiment of the present disclosure, the processor  1501  detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and allocates bandwidth to the first data flow when the bandwidth required by the first data flow is greater than the preset bandwidth value. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0164]    As shown in  FIG. 16 , an embodiment of the present disclosure provides another network management system  160 . The network management system  160  may include a network management device  1601 . The network management device  1601  may be the network management device  140  shown in  FIG. 14  or the network management device  150  shown in  FIG. 15 . 
         [0165]    In conclusion, according to the network management system  160  provided in this embodiment of the present disclosure, a network management device  140 ,  150  detects bandwidth required by a first data flow, determines whether the bandwidth required by the first data flow is greater than a preset bandwidth value, and allocates bandwidth to the first data flow when the bandwidth required by the first data flow is greater than the preset bandwidth value. In this process, the controller can directly detect the bandwidth required by the first data flow and allocate bandwidth to the first data flow according to a detection result such that a primary switch does not need to generate a bandwidth request message to trigger the controller to allocate bandwidth to the first data flow, thereby reducing time consumed in performing network management by the controller, and improving efficiency of performing network management by the controller. 
         [0166]    The foregoing descriptions are merely example embodiments of the present disclosure, but are not intended to limit the present disclosure. Any modification, equivalent replacement, and improvement made without departing from the spirit and principle of the present disclosure shall fall within the protection scope of the present disclosure.