Method and device for multi-hop resource discovery
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for discovering resources through multiple hops.
Background
The machine-to-machine communication refers to data communication between machines without human participation, and is suitable for scenes such as traffic control management, remote meter reading, remote monitoring, medical monitoring, intelligent home control and the like. To provide a standardized interface between machines and devices of a machine communication system, the OneM2M standard organization defines a standard specification of the machine communication system.
In this specification, an initiator may initiate a resource discovery process, searching for resources on its registered platform. The resource discovery request may carry a filter to limit the range of the discovered result, and may also carry a result upper limit value to limit the size of the discovered result.
However, in the prior art, the initiator can only search and discover the resources on the platform which is registered or registered, and can not discover other platforms. This greatly limits the scope of search findings, affecting the comprehensiveness of the search findings.
Disclosure of Invention
The invention provides a method and a device for multi-hop resource discovery, which are used for solving the problem that a resource discovery initiator in the prior art can only search and discover resources on a platform registered or registered by the initiator and can not discover other platforms.
According to an aspect of the present invention, there is provided a method for multi-hop discovery of resources, including:
the method comprises the steps that a platform receives a resource discovery request which is sent by a previous hop platform and carries multi-hop discovery constraint condition information;
the platform only carries out resource discovery on the platform according to the multi-hop discovery constraint condition information, or modifies the discovery constraint condition information and sends a resource discovery request to a next-hop platform after the platform carries out resource discovery;
and the platform sends the acquired resource discovery result to the previous hop platform.
Optionally, in the method of the present invention, the discovering constraint condition information includes: discovery hop count limit information and/or discovery result upper limit information.
Optionally, in the method of the present invention, when the platform determines that the platform is the last hop according to discovery hop limit information carried in the resource discovery request, and/or when the number of resource results discovered by the platform is greater than or equal to an upper limit of results carried in the resource discovery request, the platform only performs resource discovery on the platform; otherwise, after the platform discovers the resources, the discovery constraint condition is modified, and a resource discovery request is sent to the next hop platform.
Optionally, in the method of the present invention, the modifying the discovery constraint information includes: and subtracting the discovery hop limit carried in the received resource discovery request by one, and/or subtracting the discovery result number searched by the platform from the discovery result upper limit carried in the received resource discovery request.
Optionally, in the method of the present invention, the sending, by the platform, the obtained resource discovery result to the previous hop platform specifically includes:
the platform directly sends the result found by searching in the platform to the previous hop platform; or after receiving the discovery result sent by the next hop platform, the platform sends the discovery results of the platform and the next hop platform to the previous hop platform.
In accordance with another aspect of the present invention, there is provided a resource discovery platform, comprising:
a request receiving unit, configured to receive a resource discovery request carrying multi-hop discovery constraint condition information sent by a previous-hop platform;
a resource discovery unit, configured to perform resource discovery only on the present platform according to the multi-hop discovery constraint condition information, or modify the discovery constraint condition information after performing resource discovery on the present platform, and send a resource discovery request to a next-hop platform;
and the result reporting unit is used for sending the acquired resource discovery result to the upper hop platform.
Optionally, in the resource discovery platform of the present invention, the discovery constraint information includes: discovery hop count limit information and/or discovery result upper limit information.
Optionally, in the resource discovery platform of the present invention, the resource discovery unit is specifically configured to determine that the platform is a last hop according to discovery hop limit information carried in the resource discovery request, and/or only perform resource discovery on the platform when the number of resource results discovered by the platform is greater than or equal to an upper limit of results carried in the resource discovery request; otherwise, after the platform discovers the resources, the discovery constraint condition is modified, and a resource discovery request is sent to the next hop platform.
Optionally, in the resource discovery platform of the present invention, the modifying, by the resource discovery unit, the discovery constraint condition information specifically includes: and subtracting the discovery hop limit carried in the received resource discovery request by one, and/or subtracting the discovery result number searched by the platform from the discovery result upper limit carried in the received resource discovery request.
Optionally, in the resource discovery platform of the present invention, the result reporting unit is specifically configured to directly send the result found by the search of the present platform to the next hop platform; or after receiving the discovery result sent by the next hop platform, the platform sends the discovery results of the platform and the next hop platform to the previous hop platform.
The invention has the following beneficial effects:
the invention provides a solution for searching and discovering resources on a plurality of platforms by carrying a multi-hop discovery constraint condition in a resource discovery request, and an initiator can acquire more and more complete resource information through multi-hop.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be 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 only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for multi-hop discovery of resources according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for multi-hop discovery of resources according to a second embodiment of the present invention;
fig. 3 is a flowchart of a method for multi-hop discovery of resources according to a third embodiment of the present invention;
fig. 4 is a block diagram of a resource discovery platform according to a fourth embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. 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.
Example one
An embodiment of the present invention provides a method for discovering resources in multiple hops, which is applied to a resource discovery platform side, and as shown in fig. 1, the method specifically includes the following steps:
step S101, a platform receives a resource discovery request which is sent by a previous hop platform and carries multi-hop discovery constraint condition information; and when the platform is the first hop platform, the previous hop platform is the resource discovery initiator.
Step S102, the platform only carries out resource discovery on the platform according to the multi-hop discovery constraint condition information, or modifies the discovery constraint condition information after the platform carries out resource discovery, and sends a resource discovery request to a next-hop platform;
and step S103, the platform sends the acquired resource discovery result to the previous hop platform.
Based on the above principle, several specific and preferred embodiments are given below to refine and optimize the functions of the method described in the embodiments of the present invention, so as to make the implementation of the scheme of the present invention more convenient and accurate. It should be noted that the following features may be arbitrarily combined with each other without conflict.
In the embodiment of the present invention, the discovery constraint condition information includes, but is not limited to: discovery hop count limit information and/or discovery result upper limit information.
Further, in the embodiment of the present invention, when the platform determines that the platform is the last hop according to the discovery hop limit information carried in the resource discovery request, and/or when the number of resource results discovered by the platform is greater than or equal to the upper limit of the results carried in the resource discovery request, the platform only performs resource discovery on the platform; otherwise, after the platform discovers the resources, the discovery constraint condition is modified, and a resource discovery request is sent to the next hop platform.
Further, in the embodiment of the present invention, the discovery constraint condition information is modified based on a principle of eliminating the local hop, specifically: and subtracting the discovery hop limit carried in the received resource discovery request by one, and/or subtracting the discovery result number searched by the platform from the discovery result upper limit carried in the received resource discovery request.
Further, in the embodiment of the present invention, the sending, by the platform, the obtained resource discovery result to the previous hop platform specifically includes:
the platform directly sends the result found by searching in the platform to the previous hop platform; or after receiving the discovery result sent by the next hop platform, the platform sends the discovery results of the platform and the next hop platform to the previous hop platform.
In summary, the present invention provides a solution for searching discovery resources on multiple platforms by carrying a multi-hop discovery constraint condition in a resource discovery request, and through multi-hop, an initiator can obtain more and more complete resource information.
Example two
The embodiment of the invention provides a method for multi-hop resource discovery, and the embodiment explains the implementation process of the method by disclosing a specific application example.
As shown in fig. 2, the method of this embodiment specifically includes the following steps:
step S201, the initiator sends a resource discovery request to the platform CSE1, where the resource discovery request carries a search discovery hop count limit N, that is, the search discovery is performed on several platforms at most, and if the hop count is 5, the search discovery is performed on 5 platforms at most.
Step S202, after receiving the request, the CSE1 detects whether the request carries a hop count limit, if the request does not carry the hop count limit, or the hop count limit is 1, it indicates that only the current platform is performing search to find the required resource, and if the request carries the hop count limit, and is greater than 1, it indicates that the platform is performing search to find the required resource, and temporarily stores the finding result, and at the same time, forwards the request, and makes a modification.
At step S203, CSE1 forwards the resource discovery request to CSE2 and decrements the hop count limit by 1.
In step S204, CSE2 receives the request and repeats the operation in step S202.
Step S205, the CSE2 forwards the resource discovery request to the CSE3 and subtracts 1 from the hop count carried in the request.
In step S206, the platform that receives the request repeats the operations in steps 202 and 203.
Step S207, after the last hop platform CSEN receives the resource discovery request, when the operation in step S202 is repeated, and it is detected that the hop count is limited to 1, only the current platform searches for and discovers the required resource, and reports the discovered result to the previous hop platform CSE (N-1).
And step S208, the platform receiving the discovery result aggregates the received discovery result and the discovery result temporarily stored by the platform and reports the aggregated discovery result to the last hop platform of the platform until the aggregated discovery result is finally sent to the initiator.
Example two
The embodiment of the invention provides a method for multi-hop resource discovery, and discloses another specific application example to explain the implementation process of the method.
As shown in fig. 3, the method of this embodiment specifically includes the following steps:
in step S301, the initiator sends a discovery request to the CSE1, where the result upper limit and the search discovery hop count limit N are carried, that is, discovery is performed on several platforms at most, and if the hop count is 5, discovery is performed on 5 platforms at most.
Step S302, after receiving the request, the CSE1 detects whether the request carries the hop count limitation, if the request does not carry the hop count limitation or the hop count limitation is 1, the CSE1 indicates that only the current platform is searched to find the required resource, if the CSE carries the hop count limitation and is greater than 1, the CSE indicates that the platform is searched to find the required resource, and if the found result is greater than or equal to the result upper limit, the CSE stops forwarding the request and returns the result to the last CSE; if the result is smaller than the upper limit result, the found result is temporarily stored, meanwhile, the request is forwarded, the hop limit is reduced by 1, and the result upper limit is modified, namely the result upper limit carried in the request is reduced by the result number found by the platform.
At step S303, CSE1 forwards the resource discovery request to the next hop platform (e.g., CSE 2).
And step S304, after the next hop platform receives the request, the operations in the steps S302 and S303 are repeated.
Step S305, after receiving the resource discovery request, when repeating step S302, if the hop count carried in the request is limited to 1 or the number of the discovered results is greater than the upper limit of the results carried in the request, the platform M stops forwarding the request, and returns the discovered results of the platform to the previous hop platform.
And step S306, the platform receiving the discovery result aggregates the received discovery result and the discovery result temporarily stored by the platform and reports the aggregated discovery result to the last hop platform of the platform until the aggregated discovery result is finally sent to the initiator.
Example four
An embodiment of the present invention provides a resource discovery platform, as shown in fig. 4, specifically including:
a request receiving unit 410, configured to receive a resource discovery request carrying multi-hop discovery constraint condition information sent by a previous-hop platform;
a resource discovery unit 420, configured to perform resource discovery only on the present platform according to the multi-hop discovery constraint condition information, or modify the discovery constraint condition information after performing resource discovery on the present platform, and send a resource discovery request to a next-hop platform;
a result reporting unit 430, configured to send the obtained resource discovery result to the previous hop platform.
Based on the structural framework and the implementation principle, a few specific and preferred embodiments under the structure are given below to refine and optimize the functions of the resource discovery platform of the invention, so that the implementation of the scheme of the invention is more convenient and accurate. The method specifically comprises the following steps:
in this embodiment, the discovery constraint condition information includes: discovery hop count limit information and/or discovery result upper limit information.
Further, in this embodiment, the resource discovery unit 420 is specifically configured to determine that the platform is the last hop according to the discovery hop limit information carried in the resource discovery request, and/or only perform resource discovery on the platform when the number of resource results discovered by the platform is greater than or equal to the upper limit of the results carried in the resource discovery request; otherwise, after the platform discovers the resources, the discovery constraint condition is modified, and a resource discovery request is sent to the next hop platform.
Further, in this embodiment, the modifying, by the resource discovery unit 420, the discovery constraint condition information specifically includes: and subtracting the discovery hop limit carried in the received resource discovery request by one, and/or subtracting the discovery result number searched by the platform from the discovery result upper limit carried in the received resource discovery request.
Further, in this embodiment, the result reporting unit 420 is specifically configured to directly send the result found by the search of the platform to the previous hop platform; or after receiving the discovery result sent by the next hop platform, the platform sends the discovery results of the platform and the next hop platform to the previous hop platform.
In summary, it can be seen that the present invention provides a solution for searching discovery resources on multiple platforms by carrying a multi-hop discovery constraint condition in a resource discovery request, and through multi-hop, an initiator can obtain more and more complete resource information.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.