Network topology obtaining method and device based on Software Defined Network (SDN)
Technical Field
The invention relates to the technical field of information communication, in particular to a network topology acquisition method and device based on a Software Defined Network (SDN).
Background
At present, the application of the three-layer network structure is very extensive and mature, but as the technology develops, the bottleneck of the three-layer network structure is continuously emerging, so that the network engineer in the networking design gradually chooses to abandon the network with the structure. With the maximization of the utility and the utilization rate of the data center sought by more and more enterprises, the mainstream three-layer network topology structure can not meet the demand more and more, and the flow is increased rapidly, so that the traditional three-layer network structure has very obvious performance attenuation. The problem can be effectively solved by the leaf ridge network topological structure, a layer of transverse network structure parallel to the longitudinal network structure of the backbone is added, a corresponding switching network is added on the layer of transverse interface, and the spanning tree mode cannot be realized by a three-layer network structure. The leaf-ridge network topology structure provides a transmission bottleneck for solving the transverse network connection, and provides high expansibility, and the leaf-ridge network topology structure can almost adapt to all large, medium and small data centers. IT is expected that all enterprises' IT construction is moving towards convergent and high-level virtualized spine network structures.
However, the leaf-ridge network topology also has the disadvantage that when the number of switching nodes is large, the leaf-ridge network topology becomes very complex. In the SDN power controller Opendayl light existing topology discovery time test, under the condition of the same number of switching nodes, the time for discovering the topology of the leaf ridge network is more than 4 times that of a linear topology structure and a ring topology structure. With the continuous increase of the scale of the network controlled by the SDN, a new method is needed to effectively improve the real-time performance of the SDN controller for the topology discovery of the leaf-ridge network.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for acquiring a network topology based on a software defined network SDN, so as to solve the problem in the prior art that the network topology is not easily acquired when the network scale is large.
Therefore, the embodiment of the invention provides the following technical scheme:
the embodiment of the invention provides a network topology acquisition method based on a Software Defined Network (SDN), which is applied to an SDN controller and comprises the following steps: acquiring linear topology and/or ring topology among SDN switches in an SDN network; and superposing the linear topology and/or the ring topology to obtain the whole network topology of the SDN network.
Optionally, the obtaining a linear topology and/or a ring topology between SDN switches in the SDN network includes: numbering all SDN switches in the SDN network; and acquiring a linear topology and/or a ring topology between any at least two SDN switches in the SDN according to each numbered SDN switch.
Optionally, the at least two SDN switches include two SDN switches or three SDN switches.
Optionally, the obtaining a linear topology and/or a ring topology between SDN switches in the SDN network includes: sending packet _ out messages packaged with first LLDP messages to any three SDN switches in the SDN network according to the numbered SDN switches; wherein SDN switches in the SDN network other than the three SDN switches are considered disconnected; receiving packet _ in messages encapsulated with second LLDP messages from the three SDN switches respectively; wherein the second LLDP message is used to indicate topology information between any one of the three SDN switches and other SDN switches in the three SDN switches; and acquiring a linear topology and/or a ring topology among the three SDN switches according to the packet _ in message encapsulated with the second LLDP message.
Optionally, the second LLDP message is obtained by any one of the three SDN switches receiving the first LLDP message broadcast by other SDN switches in the three SDN switches.
Optionally, after obtaining a linear topology and/or a ring topology between SDN switches in an SDN network, before superimposing the linear topology and/or the ring topology to obtain a whole network topology of the SDN network, the method further includes: storing the linear topology and/or the ring topology.
The embodiment of the invention also provides a network topology acquisition device based on the Software Defined Network (SDN), which is applied to the SDN controller and comprises the following steps: the first acquisition module is used for acquiring linear topology and/or ring topology among SDN switches in the SDN network; and the second obtaining module is used for superposing the linear topology and/or the ring topology to obtain the whole network topology of the SDN.
Optionally, the first obtaining module includes: a numbering unit, configured to number all SDN switches in the SDN network; a first obtaining unit, configured to obtain, according to each numbered SDN switch, a linear topology and/or a ring topology between any at least two SDN switches in the SDN network.
Optionally, the at least two SDN switches include two SDN switches or three SDN switches.
Optionally, the first obtaining module further includes: a sending unit, configured to send packet _ out packets encapsulating first LLDP packets to any three SDN switches in the SDN network according to each SDN switch after numbering; wherein SDN switches in the SDN network other than the three SDN switches are considered disconnected; a receiving unit, configured to receive packet _ in packets encapsulated with second LLDP packets from the three SDN switches, respectively; wherein the second LLDP message is used to indicate topology information between any one of the three SDN switches and other SDN switches in the three SDN switches; and the second obtaining unit is used for obtaining the linear topology and/or the ring topology among the three SDN switches according to the packet _ in message encapsulated with the second LLDP message.
Optionally, the second LLDP message is obtained by any one of the three SDN switches receiving the first LLDP message broadcast by other SDN switches in the three SDN switches.
Optionally, the apparatus further comprises: the storage module is configured to store a linear topology and/or a ring topology before the second acquisition module superimposes the linear topology and/or the ring topology to obtain a whole network topology of the SDN network after the first acquisition module acquires the linear topology and/or the ring topology between SDN switches in the SDN network.
The technical scheme of the embodiment of the invention has the following advantages:
the embodiment of the invention provides a network topology obtaining method and device based on a Software Defined Network (SDN), which are applied to an SDN controller to obtain a linear topology and/or a ring topology among SDN switches in an SDN network, for example, the SDN controller can rapidly obtain the linear topology among two SDN switches and can also rapidly obtain the linear topology or the ring topology among three SDN switches, and the obtained linear topology and/or the ring topology among all the SDN switches under the SDN controller are overlapped to obtain the whole network topology of the SDN network, for example, a complex leaf-ridge network is overlapped through the linear topology and/or the ring topology among the SDN switches, so that the problem of low efficiency in directly obtaining the topology structure of the complex network in the prior art is solved, the discovery speed of the complex network topology and the real-time of obtaining the whole network view of the complex network structure are improved, meanwhile, the flexibility of network topology acquisition is increased.
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 description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a network topology acquisition method based on SDN according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of obtaining a network topology according to an embodiment of the invention;
fig. 3 is a block diagram of a network topology obtaining apparatus based on SDN according to an embodiment of the present invention;
FIG. 4 is a block diagram of a first obtaining module according to an embodiment of the invention;
fig. 5 is another structural block diagram of the first acquisition module according to an embodiment of the present invention;
fig. 6 is another block diagram of a network topology obtaining apparatus based on SDN according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; the two elements may be directly connected or indirectly connected through an intermediate medium, or may be communicated with each other inside the two elements, or may be wirelessly connected or wired connected. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In addition, the technical features involved in the different embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
Example 1
In this embodiment, a network topology obtaining method based on a software defined network SDN is provided, for example, the method may be applied to a SDN switch under an SDN framework to find a leaf-ridge network topology, fig. 1 is a flowchart of the network topology obtaining method based on the SDN according to an embodiment of the present invention, and as shown in fig. 1, the flowchart includes the following steps:
step S11, acquiring linear topology and/or ring topology among SDN switches in the SDN network; for example, the SDN controller may quickly acquire a linear topology between two SDN switches, and may also quickly acquire a linear topology or a ring topology between three SDN switches;
step S12, superposing the linear topology and/or the ring topology to obtain the whole network topology of the SDN network; complex leaf networks are overlaid, for example, through linear and/or ring topologies between SDN switches.
Through the steps, the SDN controller firstly acquires the linear topology and/or the ring topology among all the SDN switches under the SDN controller, and the acquired linear topology and/or ring topology among the SDN switches are overlapped to discover the whole network topology of the SDN. For a topology discovery mechanism of the SDN controller, the linear topology and the ring topology can be quickly acquired, so that the efficiency of acquiring the network topology is improved by the optional embodiment of the present invention. Compared with the prior art, when the number of SDN controller nodes is large and the network scale is large, the network topology structure is very complex, and in this case, if the network topology is directly acquired, much time is consumed. The embodiment of the invention solves the problem of low efficiency of directly acquiring the topological structure of the complex network in the prior art, improves the discovery speed of the complex network topology and the real-time acquisition of the whole network view of the complex network structure, and simultaneously increases the flexibility of acquiring the network topology.
In order to conveniently acquire the linear topology and/or the ring topology of all SDN switches under the SDN controller, in an optional embodiment, all SDN switches in the SDN network are numbered, and the linear topology and/or the ring topology between any at least two SDN switches in the SDN network are acquired according to each numbered SDN switch. Since the network topology relationship between two or three SDN switches is relatively simple, the topology relationship between two SDN switches may only be a linear topology, and the topology relationship between three SDN switches may be a linear topology or a ring topology, in an optional embodiment, any at least two SDN switches include two SDN switches or three SDN switches.
In a case that any at least two SDN switches include three SDN switches, in an optional embodiment, packet _ out messages encapsulating first LLDP messages are sent to any three SDN switches in the SDN network according to each numbered SDN switch, where SDN switches except the three SDN switches in the SDN network are regarded as disconnected, and packet _ in messages encapsulating second LLDP messages are received from the three SDN switches respectively; the second LLDP message is used to indicate topology information between any one of the three SDN switches and other SDN switches in the three SDN switches, and obtain a linear topology and/or a ring topology between the three SDN switches according to the packet _ in message encapsulated with the second LLDP message. Specifically, the second LLDP message is obtained by any one of the three SDN switches receiving the first LLDP message broadcast by other SDN switches in the three SDN switches.
In the following, a detailed description is given by taking "every three nodes" as an example to obtain the topology structure, by using a specific alternative embodiment.
(1) Upon discovering access by an SDN switch (hereinafter referred to as a network node), the SDN controller sequentially numbers the network nodes, such as A, B, C … …, according to the discovery process.
(2) The SDN controller obtains the topology structure by taking every three nodes as a unit according to the numbering sequence, namely, the LLDP message is packaged to enter OpenFlow through a packet _ out message and is distributed to the switches of the three nodes, and at the moment, other nodes except the three nodes are defaulted to be disconnected by the controller. Since any connection or topology generated by the three nodes is a linear topology or a ring topology, the linear topology and the ring topology are very fast to acquire for a topology discovery mechanism of the SDN controller.
(3) The packet _ out message contains actions: and the distributed LLDP is forwarded out from each port of the switch, so that the three nodes forward the LLDP message to the opposite-end switch according to the actual topological connection.
(4) And if the switch which receives the LLDP message in the three nodes cannot process the forwarding rule of the LLDP message by itself according to the characteristics of the SDN switch, the LLDP message is packaged into a packet _ in message and is uploaded to the controller.
(5) And the SDN controller acquires the topological structure information of the three nodes according to the packet _ in messages sent by the three nodes.
(6) Any three-node topology information can be acquired at the same time, and the SDN controller sends a packet _ out message to the next three nodes without waiting for the packet _ in information of the previous three nodes to be sent to the SDN controller.
(7) And the SDN controller continuously repeats the three-node topology acquisition process according to the serial number, and stores the acquired three-node topology information into a cache.
(8) After all the node topologies are acquired, the SDN controller extracts topology information of all the nodes from the cache, and superposes the topology information to acquire complete topology information.
(9) The SDN controller periodically numbers nodes in the network, obtains topology and superposes the topology, and the change of the network topology is updated in time.
The description will be made by taking the acquisition of a 8-node leaf-spine network topology as an example, as shown in fig. 2.
When the SDN controller discovers 8 SDN switches, 8 nodes will be numbered first, i.e. A, B, C, D, E, F, G, H S1.
S2, the SDN controller sends a packet _ out message which encapsulates the LLDP to the network node with the number A, B, C by taking every three nodes as a unit, and the packet _ out message contains the actions of: the distribution LLDP is forwarded out from each port of the switch. At this point, the controller defaults D, E, F, G, H to off. The network node with the number A sends the LLDP to the node B or the node C according to the actual connection, the network node with the number B sends the LLDP to the node A or the node C according to the actual connection, and the network node with the number C sends the LLDP to the node A or the node B according to the actual connection.
And S3, if the forwarding rule of the LLDP cannot be processed by the A, B, C three nodes due to the characteristics of the SDN switch, packaging the LLDP into a packet _ in message, and uploading the packet _ in message to the SDN controller.
And S4, after the SDN controller acquires the LLDP, acquiring A, B, C network topology of three nodes.
S5: the same operation is applied to the topology of any other three-node permutation and combination, and all the three-node topology information is superposed to obtain the whole network topology with the leaf-ridge network topology characteristic.
In a case that any two SDN switches include two SDN switches, in an optional embodiment, packet _ out messages encapsulating first LLDP messages are sent to any two SDN switches in the SDN network according to each SDN switch after numbering; the SDN switches except the two SDN switches in the SDN are regarded as disconnected, and packet _ in messages packaged with second LLDP messages are received from the two SDN switches respectively; the second LLDP message is used to indicate topology information between one SDN switch and another SDN switch in the two SDN switches, and obtain a linear topology and/or a ring topology between the two SDN switches according to a packet _ in message encapsulated with the second LLDP message, so as to obtain a linear topology between all SDN switches under an SDN controller. Specifically, the second LLDP message is obtained by one of the two SDN switches receiving the first LLDP message broadcast by the other SDN switch.
According to the optional embodiment of the invention, the complex structure of the leaf-ridge topology is split into a plurality of linear topologies or ring topologies in the SDN controller, and the three-section topologies are obtained and superposed by using the packet _ out message and the packet _ in message of the packed LLDP, so that the topology structure of the whole network is obtained. The method can effectively improve the discovering speed of the leaf ridge network topology, improve the real-time property of acquiring the whole network view of the complex network structure and simultaneously increase the flexibility of acquiring the network topology.
In order to obtain all linear topologies and ring topologies under the SDN controller and then superimpose the linear topologies and the ring topologies, in an optional embodiment, after obtaining the linear topologies and/or the ring topologies between SDN switches in the SDN network, before superimposing the linear topologies and/or the ring topologies to obtain the entire network topology of the SDN network, the linear topologies and/or the ring topologies are stored, so that the accuracy of the entire network topology of the SDN network obtained by superimposing is ensured.
Example 2
In this embodiment, a network topology obtaining device based on a software defined network SDN is further provided, and the device is used to implement the foregoing embodiments and preferred embodiments, and details of which have been already described are omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 3 is a block diagram of a network topology obtaining apparatus based on SDN according to an embodiment of the present invention, applied to an SDN controller, and as shown in fig. 3, the apparatus includes: a first obtaining module 31, configured to obtain a linear topology and/or a ring topology between SDN switches in an SDN network; a second obtaining module 32, configured to superimpose the linear topology and/or the ring topology to obtain an entire network topology of the SDN network.
Through the above steps, the first obtaining module 31 first obtains the linear topology and/or the ring topology among all the SDN switches thereunder, and the second obtaining module 32 superimposes the obtained linear topology and/or the ring topology among the SDN switches to discover the entire network topology of the SDN network. For a topology discovery mechanism of the SDN controller, the linear topology and the ring topology can be quickly acquired, so that the efficiency of acquiring the network topology is improved by the optional embodiment of the present invention. Compared with the prior art, when the number of SDN controller nodes is large and the network scale is large, the network topology structure is very complex, and in this case, if the network topology is directly acquired, much time is consumed. The embodiment of the invention solves the problem of low efficiency of directly acquiring the topological structure of the complex network in the prior art, improves the discovery speed of the complex network topology and the real-time acquisition of the whole network view of the complex network structure, and simultaneously increases the flexibility of acquiring the network topology.
Fig. 4 is a block diagram of a first obtaining module according to an embodiment of the present invention, and as shown in fig. 4, the first obtaining module 31 includes: a numbering unit 311, configured to number all SDN switches in the SDN network; a first obtaining unit 312, configured to obtain, according to each numbered SDN switch, a linear topology and/or a ring topology between any at least two SDN switches in the SDN network.
Optionally, the at least two SDN switches include two SDN switches or three SDN switches.
Fig. 5 is another structural block diagram of the first obtaining module according to the embodiment of the present invention, and as shown in fig. 5, the first obtaining module 31 further includes: a sending unit 313, configured to send, according to each numbered SDN switch, a packet _ out packet encapsulating a first LLDP packet to any three SDN switches in the SDN network; wherein SDN switches in the SDN network except the three SDN switches are regarded as disconnected; a receiving unit 314, configured to receive packet _ in packets encapsulated with second LLDP packets from the three SDN switches respectively; wherein the second LLDP message is used to indicate topology information between any one of the three SDN switches and other SDN switches in the three SDN switches; a second obtaining unit 315, configured to obtain, according to the packet _ in packet encapsulated with the second LLDP packet, a linear topology and/or a ring topology among the three SDN switches.
Optionally, the second LLDP message is obtained by any one of the three SDN switches receiving the first LLDP message broadcast by other SDN switches in the three SDN switches.
Fig. 6 is another structural block diagram of an SDN-based network topology obtaining apparatus according to an embodiment of the present invention, and as shown in fig. 6, the apparatus further includes: a storing module 61, configured to, after the first obtaining module obtains a linear topology and/or a ring topology between SDN switches in the SDN network, store the linear topology and/or the ring topology before the second obtaining module superimposes the linear topology and/or the ring topology to obtain a whole network topology of the SDN network.
Further functional descriptions of the modules are the same as those of the corresponding embodiments, and are not repeated herein.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be understood that the above examples are only for clarity of illustration and are not intended to limit the embodiments. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. And obvious variations or modifications therefrom are within the scope of the invention.