Method for searching route and device
Technical field
The present invention relates to the communications field, in particular to a kind of method for searching route and device.
Background technology
At present; when using routing inquiry interface to issue routing inquiry request in various network; usually subsidiary much constraints; such as: strict get rid of and loose eliminating, share, seize, must through constraintss such as the strict coupling of, link protection type and backward compatible couplings, to meet different routing inquiry demands.Be example with ASON (Automatic Switched OpticalNetwork, ASON), due to increasing of constraints during routing inquiry, the routing inquiry efficiency of ASON reduced gradually.
As in ASON, when taking shortest path as the constraints of routing inquiry, it retrains formula SPF module mainly through CSPF (Constrained Shortest Path First, SPF) and realizes.CSPF module adopts Dijkstra (Di Jiesitela) algorithm to calculate shortest path, and a kind of algorithm asking single source shortest path that dijkstra's algorithm is industry to be commonly used, namely from a point to the shortest path of every other point, its general principle is: the point that each new expansion distance is the shortest, upgrade the distance of the point be adjacent, when all limits weight is all timing, due to the shorter point do not propagated through of a distance can not be there is, so the distance of this point is changed never again, thus ensure that the correctness of algorithm.
If on the basis of shortest path, also require in routing inquiry about backward compatible matching constraint after the first strict coupling of link protection type, as shown in Figure 1, ASON issues the shortest path of inquiry 1-4 point, suppose that the inquiry request that ASON issues also requires that the first strict of link protection type mates rear backward compatible coupling, namely the link protection type on shortest path is preferably mated completely with the protect types of business, if there is no such path, link protection type on shortest path also can be the protect types Incomplete matching with business, but the protect types of all links on path is higher than the protect types of business.Now, the routing inquiry process that traditional CSPF module utilization dijkstra's algorithm realizes this constraints is as follows:
(1), the shortest path that the link protection type returning all links is mated completely with service protection type, otherwise path query failure.
(2), when the path query failure of (1), again inquire about, the shortest path that the link protection type returning the link of also not all is mated completely with service protection type, otherwise path query failure.
Visible, in above-mentioned path query process, when the shortest path not having link protection type to mate completely with service protection type, need to carry out at least twice inquiry through readjustment to CSPF module and just can find the route meeting this constraint.And when after readjustment, all available and and the link protection type of the link of not all and the shortest path that service protection type is mated completely have many time, then also repeatedly to inquire about and could finally determine to meet the route retrained.This makes when carrying out the routing inquiry of Problem with Some Constrained Conditions, and route query times are more, and search efficiency is lower.
Summary of the invention
Main purpose of the present invention is to provide a kind of method for searching route and device, and above-mentioned when carrying out the routing inquiry of Problem with Some Constrained Conditions at least to solve, route query times are more, the problem that search efficiency is lower.
According to an aspect of the present invention, provide a kind of method for searching route, comprise: when carrying out routing inquiry with the rear backward compatible coupling of first strict coupling of service attribute for constraints, for the service attribute existed in multilink to be checked arranges the first link indicia with the link that the service attribute in constraints mates completely, the link for Incomplete matching arranges the second link indicia; The route meeting constraints is determined according to the first link indicia and the second link indicia.
According to a further aspect in the invention, provide a kind of routing inquiring device, comprise: module is set, for when carrying out routing inquiry with the rear backward compatible coupling of first strict coupling of service attribute for constraints, for the service attribute existed in multilink to be checked arranges the first link indicia with the link that the service attribute in constraints mates completely, the link for Incomplete matching arranges the second link indicia; Enquiry module, for determining according to the first link indicia and the second link indicia the route meeting constraints.
Pass through the present invention, be adopted as the link mated completely and the first link indicia is set, link for Incomplete matching arranges the second link indicia, make when carrying out the routing inquiry of Problem with Some Constrained Conditions, the route of mating completely can be first judged whether according to link indicia, if do not have, then select according to the first link indicia and the second link indicia the route meeting constraints, and inquiry need not be adjusted back, thus it is more to solve route query times, the problem that search efficiency is lower, and then reach and only need one query just can obtain the route meeting constraints, inquiry times is reduced, considerably improve the effect of routing inquiry efficiency.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, and form a application's part, schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is according to the route schematic diagram in a kind of method for searching route of correlation technique;
Fig. 2 is the flow chart of steps of a kind of method for searching route according to the embodiment of the present invention one;
Fig. 3 is according to the flow chart of steps in a kind of method for searching route of the embodiment of the present invention two;
Fig. 4 is according to the route schematic diagram in a kind of method for searching route of the embodiment of the present invention three;
Fig. 5 is according to the route schematic diagram in a kind of method for searching route of the embodiment of the present invention four;
Fig. 6 is the structured flowchart of a kind of routing inquiring device according to the embodiment of the present invention five.
Embodiment
Hereinafter also describe the present invention in detail with reference to accompanying drawing in conjunction with the embodiments.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.
With reference to Fig. 2, show the flow chart of steps of a kind of method for searching route according to the embodiment of the present invention one, comprise the following steps:
Step S202: when carrying out routing inquiry with the rear backward compatible coupling of first strict coupling of service attribute for constraints, for the service attribute existed in multilink to be checked arranges the first link indicia with the link that the service attribute in constraints mates completely, the link for Incomplete matching arranges the second link indicia;
The routing inquiry that it is constraints that the present embodiment is applicable to the rear backward compatible coupling of first strict coupling of service attribute.By carrying out in routing inquiry process, need from multiple node, select the route satisfied condition, and all can there is a link between any two nodes be directly connected, then multilink is there is between multiple node, in this step, for the link of those service attributes existed in multilink completely the same with the service attribute in constraints (namely mating completely) arranges the first link indicia, for the link of not quite identical (i.e. Incomplete matching) arranges the second link indicia.
Wherein, service attribute when service attribute can be Route Selection suitable arbitrarily, as link protection type, or, as the level of security etc. of link.
Step S204: determine the route meeting constraints according to the first link indicia and the second link indicia.
In this step, according to the link indicia arranged, comprise the first link indicia and the second link indicia, determine the route of the constraints of the rear backward compatible coupling of first strict coupling meeting service attribute.As, because a route may comprise multiple link, so in multiple available route, wherein that all link indicia is selected to be that route of the first link indicia, as the route meeting constraints, if there is no such route, then from all available routes, according to setting rules selection one, as the minimum rule of link cost etc.
In correlation technique, when carrying out the routing inquiry of Problem with Some Constrained Conditions, when the route of not mating completely, need readjustment again again to inquire about, thus inquiry times is more, and search efficiency is lower.Pass through the present embodiment, be adopted as the link mated completely and the first link indicia is set, link for Incomplete matching arranges the second link indicia, make when carrying out the routing inquiry of Problem with Some Constrained Conditions, the route of mating completely can be first judged whether according to link indicia, if do not have, then select according to the first link indicia and the second link indicia the route meeting constraints, and inquiry need not be adjusted back, thus it is more to solve route query times, the problem that search efficiency is lower, and then reach and only need one query just can obtain the route meeting constraints, inquiry times is reduced, considerably improve the effect of routing inquiry efficiency.
With reference to Fig. 3, show the flow chart of steps of a kind of method for searching route according to the embodiment of the present invention two.In the present embodiment, for the defect that ASON restricted shortest path footpath query time is long, the shortest path providing the Problem with Some Constrained Conditions that a kind of ASON of raising applies looks into the method for searching route of road efficiency, can return identical result when making ASON carry out the inquiry of restricted shortest path footpath in the shorter time.
The method for searching route of the present embodiment comprises the following steps:
Step S302: when source node carries out routing inquiry, increases a complete match flag of link protection type according in the full mesh topology database that this node is preserved by the protect types of ASON issuing service newly on every bar link.
Such as, if the protect types of link is consistent with the protect types of business, then the complete match flag of link protection type of this link is set to 0; If the protect types of the protect types of link and business is inconsistent, but the link protection type of this link is greater than the protect types of business, then the complete match flag of link protection type of this link is set to 1; If the protect types of the protect types of link and business is inconsistent; and the protect types of link is less than the protect types of business; then the complete match flag of link protection type of this link can not be arranged; also can careless settings, but this value should be this link can be set to disabled value in traditional CSPF.By complete for link protection type match flag is set to 0; the complete match flag of link protection type link protection type being greater than the protect types of business is set to 1; when carrying out the complete matched and searched of link protection type; need be only whether 0 can determine whether to mate completely according to the complete match flag of link protection type of this route; be very easy to and search, improve search efficiency.
It should be noted that; also complete for link protection type match flag can be set to other value; at this moment; when judging whether to mate completely; only need know the number of the link mated completely; judge whether the complete match flag sum of the link protection type of route equals the product of the value of link number and setting, can determine whether to mate completely.
Step S304: using the root node of source node as shortest path tree.
Time initial, source node is the root node of shortest path tree.Now; each comparing unit is all 0 (wherein; comparing unit is for obtaining metric (degree) value of next node and this node be connected with this node; such as source node is to total metric value in next-hop node path; or the weighted value etc. of source node and next-hop node; in the present embodiment, can be the summation etc. of the link protection type matching mark in step S302).
Because initial, so now next-hop node is still this node.
Step S306: according to the complete match flag of link protection type, uses dijkstra's algorithm to obtain next-hop node.
In the present embodiment, if this node is with the link of the next-hop node be connected, there is the complete match flag of link protection type to be the link of 0, then choose that node be connected with this node in this link.
It should be noted that; when using dijkstra's algorithm to obtain next-hop node; traditional comparative approach compares successively according to the priority orders of the comparison strategy of setting; if link protection type priority level is higher than link cost priority; then first carry out Route Selection according to link protection type; if the route selected has multiple, then select according to link cost in the route selected.And in the present embodiment, it is then the practical application scene according to each comparing unit, not that strict priority traditionally compares when each comparing unit compares, but when certain comparing unit arrives to a certain degree, reduce priority-level and carry out ensuing comparison.(e.g., for the comparison of link protection type, when the link protection type summation of two paths is all more than or equal to 1; during as being all 2, thinking that this two paths is identical, now the weight of this two paths being compared; select cost less, that paths that namely weighted value is less.)
Step S308: repeat step S306, obtains the shortest path tree arriving destination node.
Pass through the present embodiment; realizing details breaches traditional CSPF for the comparative approach of each constraints (comparing unit) by fixed priority order; but compare according to the practical application scene adjustment priority of constraints; improve the method that traditional C/S PF module realizes link protection type matching, improve the routing inquiry efficiency that ASON carries out Problem with Some Constrained Conditions.
With reference to Fig. 4, show according to the route schematic diagram in a kind of method for searching route of the embodiment of the present invention three.In Fig. 4, the protect types link that black thin representative is mated completely with routing inquiry request, heavy black line section represents can compatible routing inquiry request protect types link, the digitized representation link weight on line segment.
The method for searching route of the present embodiment comprises the following steps:
Step S402:ASON issues the route requests of query node 1 to the Problem with Some Constrained Conditions of node 4 to CSPF, and this constraints is: link protection type is the rear backward compatible coupling of strict coupling first.
Whether step S404:CSPF mates with the link protection type in constraints completely according to link protection type, stamps link indicia to link, and whether mark this link is mate completely.
In the present embodiment, the link indicia of setting node 1-2 is 1, and the link indicia of node 1-3 is 0, and the link indicia of node 2-3 is 1, and the link indicia of node 2-4 is 0, and the link indicia of node 3-4 is 0.Wherein, 0 represents and mates completely, and 1 represents that Incomplete matching and link protection type are higher than the link protection type in constraints.
Step S406: node 1 is cumulative to the link protection type matching mark of all links in node 4 route.
In the present embodiment, node 1 has four available routes to node 4, respectively: node 1-2-4, and node 1-3-4, node 1-2-3-4, node 1-3-2-4.Wherein, the cumulative sum of the link protection type matching mark of node 1-2-4 is 1; the cumulative sum of the link protection type matching mark of node 1-3-4 is 0; the cumulative sum of the link protection type matching mark of node 1-2-3-4 is 2, and the cumulative sum of the link protection type matching mark of node 1-3-2-4 is 1.
Step S408: the link protection type matching cumulative sum comparing route, determines optimum route results.
In the present embodiment, the cumulative sum of the link protection type mark of route 1-3-4 is 0, represents that link protection type is mated completely.Suppose that link protection type matching priority is higher than other routing strategy priority, then determine that route 1-3-4 is optimum route results.
Pass through the present embodiment; CSPF module is 0 by arranging the link protection type identification mated completely; by judging whether the cumulative sum of link protection type mark is 0, can judge whether there is the shortest path meeting constraints fast, thus considerably improve ASON look into road efficiency.
With reference to Fig. 5, show according to the route schematic diagram in a kind of method for searching route of the embodiment of the present invention four.In Fig. 5, the protect types link that black thin representative is mated completely with routing inquiry request, heavy black line section represents can compatible routing inquiry request protect types link, the digitized representation link weight on line segment.
The method for searching route of the present embodiment comprises the following steps:
Step S502:ASON issues the route requests of query node 1 to the Problem with Some Constrained Conditions of node 4 to CSPF, and this constraints is: link protection type is the rear backward compatible coupling of strict coupling first.
Whether step S504:CSPF mates with the link protection type in constraints completely according to link protection type, stamps link indicia to link, and whether mark this link is mate completely.
In the present embodiment, the link indicia of setting node 1-2 is 1, and the link indicia of node 1-3 is 0, and the link indicia of node 2-3 is 1, and the link indicia of node 2-4 is 0, and the link indicia of node 3-4 is 1.Wherein, 0 represents and mates completely, and 1 represents that Incomplete matching and link protection type are higher than the link protection type in constraints.
Step S506: node 1 is cumulative to the link protection type matching mark of all links in node 4 route.
In the present embodiment, node 1 has four available routes to node 4, respectively: node 1-2-4, and node 1-3-4, node 1-2-3-4, node 1-3-2-4.Wherein, the cumulative sum of the link protection type matching mark of node 1-2-4 is 1; the cumulative sum of the link protection type matching mark of node 1-3-4 is 1; the cumulative sum of the link protection type matching mark of node 1-2-3-4 is 3, and the cumulative sum of the link protection type matching mark of node 1-3-2-4 is 1.
Step S508: the link protection type matching cumulative sum comparing route, determines optimum route results.
In the present embodiment; article four, in route, all do not have link protection type to mate completely; now; then reduce link protection type matching priority; namely the comparison (just thinking to have when 0 during link protection type matching adds up just to compare) of link protection type matching is no longer carried out; but continue to select route according to the routing rules of setting; with the link cost of more each route; namely from multiple route, inquire about the minimum route of link cost is example; then continue the weight summation comparing four routes; according to comparative result, it is optimum route results that CSPF returns 1-2-3-4.
In this case, if constraints requires the link comprised in mulitpath more than 1 backward compatible coupling of link protection type, and when not considering other constraintss, mulitpath is considered as identical.Now, qualified path can finally be selected according to other constraintss from mulitpath again.With current CSPF the interface that provides to outside retrained for link protection type matching or mate completely; or backward compatible coupling; if the routing inquiry that ASON issues requires that link protection type matching retrains first strict coupling; if not, during backward compatible coupling; must inquire about to CSPF and just can return route for twice and compare; the ASON of the present embodiment only needs once namely can the route of the first strict backward lower compatibility of return link protect types coupling to CSPF inquiry; and inquiry need not be adjusted back; decrease inquiry times, improve search efficiency.
Certainly, during the route all not having link protection type to mate completely in all routes, those skilled in the art also can set other comparison condition, and to select suitable route, the present invention is not restricted this.
With reference to Fig. 6, show the structured flowchart of a kind of routing inquiring device according to the embodiment of the present invention five, comprising:
Module 602 is set, for when carrying out routing inquiry with the rear backward compatible coupling of first strict coupling of service attribute for constraints, for the service attribute existed in multilink to be checked arranges the first link indicia with the link that the service attribute in constraints mates completely, the link for Incomplete matching arranges the second link indicia; Enquiry module 604, for determining according to the first link indicia and the second link indicia the route meeting constraints.
Preferably, service attribute is link protection type; Module 602 is set and is Incomplete matching and link protection type arranges the second link indicia higher than the link of the link protection type in constraints.
Preferably, enquiry module 604 comprises: judge module 6042, for judging, in all available routes, whether to there is the route that all link indicia are the first link indicia; Executive Module 6044, if be yes for the judged result of judge module 6042, then determines that this route is the route meeting constraints; If the judged result of judge module 6042 is no, then from all available routes, determine a route, for meeting the route of constraints according to the rule preset.
Preferably, the above-mentioned rule preset is the minimum rule of link cost.
Preferably, enquiry module 604 also comprises: select module, if comprise multiple for the route meeting constraints determined, then from multiple route, selects one according to the rule of setting.Preferably, the rule of this setting is routing selection PRI rule, and routing selection PRI rule is used for carrying out Route Selection according to the different priorities of multiple routing strategy.
Preferably, the first link indicia is set to 0, and the second link indicia is set to 1; Judge module 6042 is for judging, in all available routes, whether to there is the route that link indicia sum is zero; If Executive Module 6044 is yes for the judged result of judge module 6042, then determine that this route is the route meeting constraints; If the judged result of judge module 6044 is no, then from all available routes, determine a route, for meeting the route of constraints according to the rule preset.
It should be noted that, multiple embodiment of the present invention is all for ASON, but method for searching route of the present invention and device, be not only applicable to ASON network, be applicable to the network that other uses routing inquiry yet.In addition; constraints in multiple embodiment of the present invention is all for backward compatible coupling after the first strict coupling of link protection type; but be not limited thereto; all all applicable method and apparatus of the present invention of constraints requiring the first rear backward compatible coupling of strict coupling, the present invention is not restricted this.Further, multiple embodiment of the present invention uses dijkstra's algorithm to search shortest path, but is not limited thereto, and those skilled in the art can also according to actual needs, and select the shortest path finding algorithm that other is suitable, the present invention is not also restricted this.
The present invention is directed to the belt restraining routing inquiry time in prior art long, inquiry times is many, the defect that search efficiency is low, provides a kind of routing inquiry scheme of Problem with Some Constrained Conditions.The program is when carrying out query routing, require that the service attribute of all links of the route returned preferably mates completely with the service attribute in constraints, if there is no such path, on path the service attribute of some link also can with the service attribute Incomplete matching of constraints.The mode realizing this constraints traditionally, then need readjustment just can inquire the path met the demands twice about after the first strict coupling of service attribute during backward compatible matching constraint in routing inquiry.And by technical scheme of the present invention, one query can be realized and just can return to the path meeting constraints, route query times are reduced, considerably improves and look into road efficiency.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus, they can be stored and be performed by calculation element in the storage device, and in some cases, step shown or described by can performing with the order be different from herein, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.