Skip to content
/ MBP Public
forked from rkperes/connde

Multi-purpose Binding and Provisioning Platform (MBP) for IoT devices

Notifications You must be signed in to change notification settings

hirmerpl/MBP

 
 

Repository files navigation

Multi-purpose Binding and Provisioning Platform (MBP)

This platform enables means for (i) automated binding of IoT devices in order to access their sensors and actuators, and (ii) automated software provisioning.

Installation and Configuration

see User Manual

REST API

A REST API for the management of devices, sensors and actuators is provided.

Devices

creating a new device:

POST /api/devices/ HTTP/1.1
Content-Type: application/json
accept: application/json

{
  "name": "Raspberry Pi",
  "macAddress": "123456789067",
  "ipAddress": "192.168.0.34",
  "formattedMacAddress": "12-34-56-78-90-67"
}

HTTP/1.1 201 Created
location: http://localhost:8080/MBP/api/devices/5a033094c27074e37bbb198b
content-type: application/json;charset=UTF-8

{
  "id": "5a033094c27074e37bbb198b",
  "name": "Raspberry Pi",
  "macAddress": "123456789067",
  "ipAddress": "192.168.0.34",
  "date": null,
  ...
}

The id of the newly created device can be parsed from the response header location or from the response body, which is in json format.

retrieving all devices:

GET /api/devices/ HTTP/1.1

HTTP/1.1 200 OK

[
  {
    "macAddress": "123456789067",
    "ipAddress": "192.168.0.34",
    "name": "Raspberry Pi",
    "id": "596c7a7d4f0c58688e5aa6b1",
    "date": null,
  }, ...
]

retrieving single device (e.g., for id 596c7a7d4f0c58688e5aa6b1):

GET /api/devices/596c7a7d4f0c58688e5aa6b1 HTTP/1.1

HTTP/1.1 200 OK

{
  "macAddress": "123456789067",
  "ipAddress": "192.168.0.34",
  "name": "Raspberry Pi",
  "id": "596c7a7d4f0c58688e5aa6b1",
  "date": null,
}

updating single device (e.g., for id 596c7a7d4f0c58688e5aa6b1):

PUT /api/devices/596c7a7d4f0c58688e5aa6b1 HTTP/1.1

{
  "name": "Raspberry Pi",
  "macAddress": "127556789067",
  "ipAddress": "192.168.0.75",
  "formattedMacAddress": "12-75-56-78-90-67"
}

HTTP/1.1 204 No Content

delete single device (e.g., for id 596c7a7d4f0c58688e5aa6b1):

DELETE /api/devices/596c7a7d4f0c58688e5aa6b1 HTTP/1.1

HTTP/1.1 204 No Content

Adapter Types

An adapter is the required software (e.g., python script) to bind sensors and actuators to the MBP.

creating a new adapter type:

POST /api/types/ HTTP/1.1
Content-Type: application/json
accept: application/json

{
  "name": "TemperatureSensorAdapter",
  "description": "An adapter for the LK temperature sensor",
  "service": {
    "name": "service-stub.conf",
    "content": "stub conf"
  },
  "routines": [{
    "name": "service-stub.py",
    "content": "service code"
  }]
}

HTTP/1.1 201 Created
location: http://localhost:8080/MBP/api/types/5a0336ba972ca8734022d67c
content-type: application/json;charset=UTF-8

{
  "id": "5a0336ba972ca8734022d67c",
  "name": "TemperatureSensorAdapter",
  "description": "An adapter for the LK temperature sensor",
  ...
}

The id of the newly created adapter type can be parsed from the response header location or from the response body, which is in json format.

retrieving all adapter types:

GET /api/types/ HTTP/1.1

HTTP/1.1 200 OK

[
  {
    "name": "TemperatureSensorAdapter",
    "id": "596c7c344f0c58688e5aa6b3",
    "description": "An adapter for the LK temperature sensor"
  }, ...
]

retrieving single adapter type (e.g., for id 596c7c344f0c58688e5aa6b3):

GET /api/types/596c7c344f0c58688e5aa6b3 HTTP/1.1

HTTP/1.1 200 OK

{
  "name": "TemperatureSensorAdapter",
  "id": "596c7c344f0c58688e5aa6b3",
  "description": "An adapter for the LK temperature sensor"
}

updating single adapter type (e.g., for id 596c7c344f0c58688e5aa6b3):

PUT /api/types/596c7c344f0c58688e5aa6b3 HTTP/1.1

{
  "name": "TemperatureSensorAdapter",
  "description": "An adapter for the LK temperature sensor",
  "service": {
    "name": "service-stub.conf",
    "content": "..."
  },
  "routines": [{
    "name": "service-stub.py",
    "content": "..."
  }]
}

HTTP/1.1 204 No Content

delete single adapter type (e.g., for id 596c7c344f0c58688e5aa6b3):

DELETE /api/types/596c7c344f0c58688e5aa6b3 HTTP/1.1

HTTP/1.1 204 No Content

Sensors

To register a sensor, it is necessary to register first:
(i) the device to which the sensor is connected to, and
(ii) the adapter type, i.e., the required software (e.g., python script) to bind the sensor to the MBP.

creating a new sensor:

The following example uses the previously registered adapter type (id = 596c7c344f0c58688e5aa6b3) and device (id = 596c7a7d4f0c58688e5aa6b1):

POST /api/sensors/ HTTP/1.1
Content-Type: application/json
accept: application/json

{
  "name": "Temperature Sensor",
  "type": "<URL>/api/types/596c7c344f0c58688e5aa6b3",
  "device": "<URL>/api/devices/596c7a7d4f0c58688e5aa6b1",
}

HTTP/1.1 201 Created
location: http://localhost:8080/MBP/api/sensors/596c7a974f0c58688e5aa6b2
content-type: application/json;charset=UTF-8

{
  "id": "596c7a974f0c58688e5aa6b2",
  "name": "test_sensor",
  ...
}

The id of the newly created sensor can be parsed from the response header location or from the response body, which is in json format.

retrieving all sensors:

GET /api/sensors/ HTTP/1.1

HTTP/1.1 200 OK

[
  {
    "id": "596c7a974f0c58688e5aa6b2",
    "name": "test_sensor",
    "_embedded": {
      "device": {
        "macAddress": "111111111111",
        "ipAddress": null,
        "name": "Test_Device",
        "id": "596c7a7d4f0c58688e5aa6b1",
        "date": null
      }
    }
  }, ...
]

retrieving single sensor (e.g., for id 596c7a974f0c58688e5aa6b2):

GET /api/sensors/596c7a974f0c58688e5aa6b2 HTTP/1.1

HTTP/1.1 200 OK

{
  "id": "596c7a974f0c58688e5aa6b2",
  "name": "test_sensor",
  "_embedded": {
    "device": {
      "macAddress": "111111111111",
      "ipAddress": null,
      "name": "Test_Device",
      "id": "596c7a7d4f0c58688e5aa6b1",
      "date": null
    }
  }
}

updating single sensor (e.g., for id 596c7a974f0c58688e5aa6b2):

PUT /api/sensors/596c7a974f0c58688e5aa6b2 HTTP/1.1

{
  "name": "Temperature Sensor",
  "type": "<URL>/api/types/596c7c344f0c58688e5aa6b3",
  "device": "<URL>/api/devices/596c7a7d4f0c58688e5aa6b1",
}

HTTP/1.1 204 No Content

delete single sensor (e.g., for id 596c7a974f0c58688e5aa6b2):

DELETE /api/sensors/596c7a974f0c58688e5aa6b2 HTTP/1.1

HTTP/1.1 204 No Content

Actuators

see REST calls for sensors, replace /sensors with /actuators

Repository Structure

  • Java Projects (contains both web and the old base project that implemented the services)

  • Python Scripts (contains all python services and sensor scripts)

  • RSA Key (key that should be installed in each RPi in order to use SSH access)

  • Diagram (domain diagram for the java project)

Packets and others

Upstart packet on client machine

Run sudo apt-get install upstart, reboot after installation.

This is used to set up services on the system.

To set a service (%name% stands for any name):

  • create a %name%.conf file in /etc/init
  • run sudo initctl reload-configuration
  • run sudo service %name% start

WinPCap on server machine (Windows only - not needed on Linux dists)

Compliments Scapy library.

About

Multi-purpose Binding and Provisioning Platform (MBP) for IoT devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 82.5%
  • CSS 9.7%
  • HTML 5.0%
  • Java 1.4%
  • Python 1.3%
  • Shell 0.1%