Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental discovery implementation using mDNS, DNS-SD and MongoDB #5

Closed
tksuzuki0604 opened this issue Mar 12, 2020 · 5 comments
Closed

Comments

@tksuzuki0604
Copy link

I experimentally implemented discovery by combining existing technologies (mDNS, DNS-DS and MongDB).
The method is very similar to "Two-Phase Directory-Based Discovery".

Use-case

  • Using appliances in smart home
  • These appliances and a controller is located in the same network
    • The controller has a TD directory
    • All devices retrieve IP address from a DHCP server
      • Also the DHCP server is located in the network
  • All TDs are registered to the directory
    • Implemented three ways to register TDs to the directory
      • a) The directory discovers Things and retrieves TDs from each device
      • b) Things discover the directory and register TDs by themselves
      • c) Human discover the directory and register TDs manually
  • Users retrieve all TDs from the directory and select desired appliances in the local network

Requirements

  • Needs to set each device's URL(ip address or resolvable hostname) in its TD (hrefs or base)
    • Things set URLs by themselves (case 'a' and 'b')
    • Human set URLs to TDs manually (case 'c')
  • Needs to search Things and the directory in the same network
  • The directory needs to know how to retrieve TD from Things for the case 'a'
  • Human and Things needs to know how to register TD to the directory for case 'b' and 'c'
  • Users need to know how to retrieve TDs from the directory
  • Needs a TD directory implementation

Implementation

  • Set unique hostnames to all devices (Things and the directory)
  • Set <hostname>.local as a resolvable hostname in TDs for all cases
  • Used mDNS and DNS-SD to discover things and directories
  • Used DNS-SD to advertise the way to retrieve or register TDs
  • Used mDNS to resolve hostname in TDs
  • Used Mongo DB as a backend of directories
  • Made a python script to cooperate mDNS+DNS-SD with MongoDB
    • The script aloso provides REST APIs to register and retrieve TDs from the directory
@k-toumura
Copy link
Contributor

I created sequence diagrams for this implementation to better understanding.
Are all those figures correct?

The directory discovers Things and retrieves TDs from each device
Things discover the directory and register TDs by themselves
Interact with the Thing

@tksuzuki0604
Copy link
Author

tksuzuki0604 commented Mar 16, 2020

Thank you for writing diagrams.
Sequences are almost correct, but there are some implementation level differences from my experiment.

  • Instead of using different types, I used sub-type to classify Things and directories
    Because, I thought both of them are WoT related services by mean of DNS-SD's service type. (But I don't know which way is better...)
  • Instead of using well-known paths, Things and directories advertise their API information by DNS-SD
    Because, there are no standard way to retrieve and register TDs in the WoT

To be more specific, followings are examples of mDNS+DNS-SD settings.

  • Thing
Service type: _wot._tcp
Sub type: _device._sub._wot._tcp
Port: 10080
Text record: "retrieve=/Things"
  • Directory
Service type: _wot._tcp
Sub type: _directory._sub._wot._tcp
Port: 80
Text record: “retrieve=/Things“ “register=/Things/register”

@k-toumura
Copy link
Contributor

I'd updated diagrams based on your information.
This concrete example of discovery mechanism may be helpful for discussion.
Also, it is useful for (virtual) plugfest because it makes easier to install devices on plugfest environment.

@mmccool
Copy link
Contributor

mmccool commented Apr 6, 2020

Can this be captured and put into an MD file and submitted to the repo? That way we are sure what the current, "correct" description is.

@mmccool
Copy link
Contributor

mmccool commented Jul 12, 2021

Already incorporated into an MD file, can consider this closed now

@mmccool mmccool closed this as completed Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants