Summary of the invention
In view of this, the present invention proposes a kind of topology discovery method and system, must utilize upper-layer protocol could determine the technical problem of Link State in the network to solve topology discovery method.
For reaching this purpose, the present invention by the following technical solutions:
A kind of topology discovery method comprises:
The neighbours that receiving equipment receives the transmitting apparatus transmission find message;
Receiving equipment judges according to first neighbor entry of receiving equipment whether transmitting apparatus is neighbours;
If, receiving equipment and transmitting apparatus receive topological list item and set up message, second neighbor entry according to first neighbor entry and transmitting apparatus is set up line, neighbor device in first neighbor entry that line is passed to and second neighbor entry except that receiving equipment and transmitting apparatus is set up topological list item;
Topological list item is safeguarded, upgraded to receiving equipment.
Preferably, according to first neighbor entry of receiving equipment, judge that whether transmitting apparatus is neighbours, comprising:
Judge according to first neighbor entry whether transmitting apparatus is neighbours, if then abandon neighbours and find message;
If not, then add transmitting apparatus for neighbours, and abandon neighbours and find message;
Receiving equipment sends neighbours and finds response message;
Transmitting apparatus receives neighbours and finds response message, and allows receiving equipment to be added to neighbours.
Preferably, also comprise: if receiving equipment and transmitting apparatus are neighbours, then in the default time period, whether send neighbours' maintenance request message, judge neighbor state according to MAC small device in receiving equipment and the transmitting apparatus;
If not, then delete the MAC small device;
If then the bigger device replied neighbours of MAC safeguard the answer message in receiving equipment and the transmitting apparatus, keep neighborhood.
Preferably, set up line, comprise according to first neighbor entry and second neighbor entry
Set up line according to the source node in first neighbor entry and the destination node of second neighbor entry.
Preferably, receiving equipment safeguards that topological list item comprises:
If receiving equipment does not receive that in the default time topological list item establishment message, neighbours' maintenance request message and neighbours that transmitting apparatus sends safeguard any one of replying in the message, then in first neighbor entry, delete transmitting apparatus, and send the neighbor device except that transmitting apparatus in topology table entry deletion message to the first neighbor entry;
Neighbor device in first neighbor entry except that transmitting apparatus is deleted transmitting apparatus in neighbor entry, and the deletion topological list item relevant with transmitting apparatus.
A kind of Topology Discovery system comprises,
Receiving equipment is used to receive neighbours and finds message, according to first neighbor entry of receiving equipment, judges whether transmitting apparatus is neighbours;
If, receive topological list item and set up message, set up line, the neighbor device in first neighbor entry that line is passed to except that transmitting apparatus according to second neighbor entry of first neighbor entry and transmitting apparatus, set up topological list item, safeguard, upgrade topological list item;
Transmitting apparatus is used to send neighbours and finds message;
Receive topological list item and set up message, set up line, line is passed to the neighbor device except that receiving equipment in second neighbor entry according to first neighbor entry of second neighbor entry and receiving equipment.
Preferably, receiving equipment comprises:
Neighbours' judge module is used for judging at first neighbor entry whether transmitting apparatus is neighbours, if then abandon neighbours and find message;
If not, then add transmitting apparatus for neighbours, and abandon neighbours and find message;
Transmitting apparatus sends neighbours and finds response message.
Preferably, transmitting apparatus comprises:
Add neighbours' module, be used to receive neighbours and find response message, and allow receiving equipment to be added to neighbours.
Preferably, also comprise: the neighbor entry maintenance module, be used in the default time period, whether sending neighbours' maintenance request message according to MAC small device in receiving equipment and the transmitting apparatus, judge neighbor state;
If not, then delete the MAC small device;
If then the device replied neighbours that MAC is bigger safeguard the answer message, keep neighborhood.
Preferably, receiving equipment comprises: topological list item maintenance module, be used for not creating any one that message, neighbours' maintenance request message and neighbours safeguard the answer message if receiving equipment is received the topological list item that transmitting apparatus sends in the default time, then in first neighbor entry, delete transmitting apparatus, and send the neighbor device except that transmitting apparatus in topology table entry deletion message to the first neighbor entry.
By a kind of topology discovery method disclosed by the invention and system, can realize not relying on upper-layer protocol, find the Link State in the whole network, and check the Link State of miscellaneous equipment on any equipment in network.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment only is the application's part embodiment, rather than whole embodiment.Based on the embodiment among the application, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the application's protection.
Be cheer and bright describing, english abbreviation implication and message that the embodiment of the invention relates to are as follows:
SrcPoint: source node, comprise following attribute: MAC (Media Access Control address), Name(title), Vlan(Virtual Local Area Network, VLAN), IP (Internet Protocol, the agreement that interconnects between the network), Port (port);
Source MAC: source Media Access Control address;
Destnation MAC: purpose Media Access Control address;
TYPE: type;
LEN: string length;
RESERVED: reserve;
Value: contents value;
DstPoint: destination node comprises following attribute: MAC, Name, Vlan, IP, Port;
OPTIONS: option;
Neighbours find that message is: topology-neighbor-discover-request;
Neighbours find that response message is: topology-neighbor-discover-reply;
Neighbours' maintenance request message is: neighbor-keep-alive-request;
Neighbours safeguard that replying message is: neighbor-keep-alive-reply;
The topology list item is set up message: topology-line-create;
Topology table entry deletion message: topology-link-delete.
Among the embodiment one to four below the present invention, receiving equipment and transmitting apparatus are the switch of having opened the Topology Discovery agreement.
Embodiment one
Consult accompanying drawing 1, the embodiment of the invention one discloses a kind of topology discovery method, comprising:
The neighbours that step S101, receiving equipment receive the transmitting apparatus transmission find message;
Step S102, receiving equipment judge according to first neighbor entry of receiving equipment whether transmitting apparatus is neighbours;
Step S103, if, receiving equipment and transmitting apparatus receive topological list item and set up message, second neighbor entry according to first neighbor entry and transmitting apparatus is set up line (Line), neighbor device in first neighbor entry that line is passed to and second neighbor entry except that receiving equipment and transmitting apparatus is set up topological list item;
Step S104, receiving equipment safeguard, upgrade topological list item.
In the step S102 of the embodiment of the invention one,, judge that whether transmitting apparatus is neighbours, comprising according to first neighbor entry of receiving equipment:
Judge in first neighbor entry whether transmitting apparatus is neighbours, if then abandon neighbours and find message;
If not, then add transmitting apparatus for neighbours, and abandon neighbours and find message;
Receiving equipment sends neighbours and finds response message;
Transmitting apparatus receives neighbours and finds response message, and allows receiving equipment to be added to neighbours.
Need to prove, in the embodiment of the invention one, use Layer 2 Multicast message carrying neighbours to find message.
Concrete, the topology-neighbor-discover-request message structure is as follows:
Decimal number 0,8,16,24 in the above-mentioned message structure is respectively the start bit (bit) of first, second, third, fourth byte (Byte).
Wherein, OPTIONS comprises TYPE, LEN and Value.
TYPE(01): represent MAC, length is 6 bytes, and structure TYPE(01) is as follows:
TYPE(02): represent IP, length is 4 bytes, and structure TYPE(02) is as follows:
TYPE(03): represent Vlan, length is unfixing; TYPE(03) structure is as follows
TYPE(04): represent Port, length is unfixing, and structure TYPE(04) is as follows:
TYPE(05): represent Name, length is unfixing, and structure TYPE(05) is as follows:
Concrete, the topology-neighbor-discover-reply message structure is as follows:
Need to prove that the option of topology-neighbor-discover-reply message is than topology-neighbor-discover-request message, many TYPE (10).
TYPE (10): represent purpose MAC, length is 6 characters, and TYPE (10) structure is as follows:
In step S103, set up line according to first neighbor entry and second neighbor entry, comprise
Set up line (Line) according to the source node in first neighbor entry and the destination node of second neighbor entry.Concrete, in neighbor entry except output port) (OutPort is destination node (DstPoint).OutPort in the neighbor entry, and the Vlan at OutPort place, Vlan MAC (virtual local area network address), Vlan IP (virtual local area fidonetFido), the Name of equipment has formed SrcPoint.SrcPoint and DstPoint have formed a line, are exactly line (Line).
After setting up neighbor entry, can be notified to all lines in the neighbor entry and the irrelevant neighbours of line, so just allow all neighbours in the neighbor entry all learn topological list item.If equipment has been certain bar line from certain neighbor device study, this equipment just should not reinform the information of this line to this neighbor device so.
Same, the Topology-line-create message also uses the Layer 2 Multicast message to carry.
Concrete, the structure of Topology-line-create message is as follows:
Shown in OPTIONS is classified as follows:
TYPE (01): representative be srcPoint, length the unknown, TYPE (01) comprises following sub-option.
SubTYPE (source option) (01), representative be the srcMAC(source address), length is 6 bytes; The structure of SubTYPE (source option) (01) is as follows:
SubTYPE (02): representative be the srcIP(source protocol), length is 4 bytes, structure is as follows:
SubTYPE (03): representative be the srcName(source name), length the unknown; SubTYPE (03) structure is as follows:
SubTYPE (04): representative be srcVlan(source VLAN), length the unknown, SubTYPE (04) structure is as follows:
SubTYPE (05): representative be srcPort (source port), length the unknown; SubTYPE (05) structure is as follows:
That TYPE (02) represents is DstPoint, and length the unknown comprises following sub-option.
SubTYPE (06), representative be dstMAC (destination address), length is 6, structure is as follows:
SubTYPE (07): representative be dstIP(purpose agreement), length is 4 bytes, SubTYPE (07) structure is as follows:
SubTYPE (08): representative be dstName(purpose title), length the unknown; SubTYPE (08) structure is as follows:
SubTYPE (09): representative be dstVlan(purpose VLAN), length the unknown, the structure of SubTYPE (09) is as follows:
SubTYPE (10): representative be the dstPort(destination interface), length the unknown, SubTYPE (10):
Structure is as follows:
What TYPE (03) represented is the equipment that sends the topology-line-create message, and type is MAC,
Structure is as follows:
In step S104, receiving equipment safeguards that topological list item comprises:
Receiving equipment does not receive that in the default time topological list item establishment message, neighbours' maintenance request message and neighbours that transmitting apparatus sends safeguard any one of replying in the message, then in first neighbor entry, delete transmitting apparatus, and send the neighbor device except that transmitting apparatus in topology table entry deletion message to the first neighbor entry;
Neighbor device in first neighbor entry except that transmitting apparatus is deleted transmitting apparatus in neighbor entry, and the deletion topological list item relevant with transmitting apparatus.
Concrete, certain neighbour's interface disconnects in detecting network, then these neighbours is changed to unreachable neighbours.If this port does not connect in the default time, then delete these neighbours and send other neighbours' deletion of topology-link-delete message notifying topological list item relevant with these neighbours.
If this port couples together in the default time, then these neighbours are changed to can reach neighbours and send the neighbor-keep-alive-request message whether detect these neighbours normal, if do not receive the neighbor-keep-alive-reply message at the appointed time, then delete these neighbours and send other neighbours' deletion of topology-link-delete message notifying topological list item relevant with these neighbours.
When in the default time, receiving the topology-link-delete message, check and oneself have or not this topology list item, if have then detect the legitimacy of this message, if it is legal, then delete corresponding topological list item, other neighbours of send topology-link-delete message notifying delete this list item then.If do not change topological list item, then abandon this message.If this message is illegal, then abandon this message.
Need to prove, in step S104, safeguard that topological list item comprises owing to work as receiving equipment:
Receiving equipment does not receive that in the default time topological list item that transmitting apparatus sends creates message, neighbours' maintenance request message and neighbours and safeguard and reply one or more in the message, then in first neighbor entry, delete transmitting apparatus, and send the neighbor device except that transmitting apparatus in topology table entry deletion message to the first neighbor entry;
Neighbor device in first neighbor entry except that transmitting apparatus is deleted transmitting apparatus in neighbor entry, and the deletion topological list item relevant with transmitting apparatus.
When topological list item lost efficacy, then learn to carry out deletion action on all devices of this topology list item, so do not need topological list item carried out other attended operation.
By the embodiment of the invention one disclosed a kind of topology discovery method, can realize not relying on upper-layer protocol, find the Link State in the whole network, and check the Link State of miscellaneous equipment on any equipment in network.
Embodiment two
The embodiment of the invention one discloses a kind of topology discovery method, the embodiment of the invention two discloses a kind of topology discovery method, on the basis of a kind of topology discovery method that the embodiment of the invention one discloses, also comprises:
Step S201 is if receiving equipment and transmitting apparatus are neighbours;
Whether step S202 then in the default time period, sends neighbours' maintenance request message according to MAC small device in receiving equipment and the transmitting apparatus, judges neighbor state;
Step S203 if not, then deletes the MAC small device;
Step S204 if then the bigger device replied neighbours of MAC safeguard the answer message in receiving equipment and the transmitting apparatus, keeps neighborhood.
Same, neighbours' maintenance request message is carried by the Layer 2 Multicast message.
Need to prove, be provided with a timer in neighbor entry, do not receive neighbours' maintenance request message in the default time period, the neighbours that send neighbours' maintenance request message will be deleted in neighbor list, and the default time period is 30 seconds.
The equipment that MAC is bigger in receiving equipment and the transmitting apparatus is replied the neighbor-keep-alive-reply message after receiving neighbours' maintenance request message.
Wherein, use the Layer 2 Multicast message to carry neighbours' maintenance request message.
The structure of Neighbor-keep-alive-request message is as follows:
Wherein, OPTIONS classification:
TYPE01 represents the srcMAC(source address), length is 6 characters, the TYPE01 structure is as follows:
TYPE04: represent the srcPort(source port), length is unfixing; The structure of TYPE04 is as follows:
TYPE11: represent dstMAC, length is unfixing, and structure is as follows:
TYPE12 represents dstPort, and length is unfixing, and structure is as follows:
Concrete, the structure of Neighbor-keep-alive-reply message is as follows:
Wherein, neighbours safeguard occupied near the OPTIONS that replys message the maintenance request message many a TYPE (10):
TYPE (10) represents purpose MAC, and length is 6 bytes; TYPE (10) structure is as follows:
Disclose a kind of topology discovery method by the embodiment of the invention two, can realize not relying on upper-layer protocol, found the Link State in the whole network, and checked the Link State of miscellaneous equipment on any equipment in network.
Embodiment three
The embodiment of the invention one discloses a kind of topology discovery method, and is corresponding with it, and the embodiment of the invention three discloses a kind of Topology Discovery device, as shown in Figure 3.
A kind of Topology Discovery device comprises, receiving equipment 1 is used to receive neighbours and finds message, according to first neighbor entry of receiving equipment, judges whether transmitting apparatus 2 is neighbours;
If, receive topological list item and set up message, set up line, the neighbor device in first neighbor entry that line is passed to except that transmitting apparatus according to second neighbor entry of first neighbor entry and transmitting apparatus 2, set up topological list item, safeguard, upgrade topological list item;
Transmitting apparatus 2 is used to send neighbours and finds message;
Receive topological list item and set up message, set up line, line is passed to the neighbor device except that receiving equipment 1 in second neighbor entry according to first neighbor entry of second neighbor entry and receiving equipment 1.
In the embodiment of the invention three, receiving equipment 1 comprises:
Neighbours' judge module 11 is used for judging at first neighbor entry whether transmitting apparatus 2 is neighbours, if then abandon neighbours and find message;
If not, then add transmitting apparatus 2 and be neighbours, and abandon neighbours and find message;
Transmitting apparatus 2 sends neighbours and finds response message.
In the embodiment of the invention three, transmitting apparatus 2 comprises:
Add neighbours' module 21, be used to receive neighbours and find response message, and allow receiving equipment 1 to be added to neighbours.
In the embodiment of the invention three, receiving equipment 1 comprises: topological list item maintenance module 12, be used for receiving equipment 1 and do not receive that in the default time topological list item establishment message, neighbours' maintenance request message and the neighbours of transmitting apparatus 2 transmissions safeguard any one of replying message, then in first neighbor entry, delete transmitting apparatus, and send the neighbor device except that transmitting apparatus 2 in topology table entry deletion message to the first neighbor entry.
By the embodiment of the invention three disclosed a kind of Topology Discovery devices, can realize not relying on upper-layer protocol, find the Link State in the whole network, and check the Link State of miscellaneous equipment on any equipment in network.
Embodiment four
Shown in Figure 4, the embodiment of the invention four discloses a kind of Topology Discovery device, discloses in the embodiment of the invention three on a kind of basis of Topology Discovery device, also comprises:
Also comprise: neighbor entry maintenance module 3, be used in the default time period, according to neighbours' maintenance request message that MAC small device in receiving equipment 1 and the transmitting apparatus 2 sends, judge neighbor state;
If not, then delete the MAC small device;
If then the device replied neighbours that MAC is bigger safeguard the answer message, keep neighborhood.
By the embodiment of the invention four disclosed a kind of Topology Discovery devices, can realize not relying on upper-layer protocol, find the Link State in the whole network, and check the Link State of miscellaneous equipment on any equipment in network.
Obviously, those skilled in the art should be understood that, above-mentioned each module of the present invention or each step can realize with the general calculation device, they can concentrate on the single calculation element, perhaps be distributed on the network that a plurality of calculation element forms, alternatively, they can realize with the executable program code of computer installation, carry out by calculation element thereby they can be stored in the storage device, perhaps they are made into each integrated circuit modules respectively, perhaps a plurality of modules in them or step are made into the single integrated circuit module and realize.Like this, the present invention is not restricted to the combination of any specific hardware and software.
Be the preferred embodiments of the present invention only below, be not limited to the present invention, to those skilled in the art, the present invention can have various changes and variation.All any modifications of within spirit of the present invention and principle, being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.