We have created a decentralised IoT solution consisting of a central IN-CSE and 3 MN-CSEs. This type of architecture is easily scalable for large scale systems such as Smart City and enables seamless interaction between heterogeneous applications independent of underlying communication technologies.
$ git clone https://github.com/shubham-mante/oneM2M-hackathon-2021.git
- Go to oneM2M_platform directory
- To create the resource tree, first initialise the IN-CSE and then the three MN-CSEs by executing the "start.bat" script on Windows or "start.sh" on Linux and Mac OS.
- Open the following URL in your browser and access the oneM2M platform web interface (IN-CSE): http://127.0.0.1:8080/webpage
- Go to python_scripts directory which contains all the necessary source codes to create the resource tree
- Install the "requests" and "json" modules (skip this step if already installed)
- Run in_cse_tree.py file to create the application entities under IN-CSE
- Run $ python3 mn_cse1_tree.py file to create the application entities under MN-CSE1
- Run $ python3 mn_cse2_tree.py file to create the application entities under MN-CSE2
- Run $ python3 mn_cse3_tree.py file to create the application entities under MN-CSE3
Note-1: New resources can be created under a CSE with the help of oneM2M_functions.py file.
Note-2: Labels are added to the resources which will be used during the Discovery based data retrieval.
Note-3: Containers are used to store the descriptor content instances which helps add meaning to the data users due to the provision of added semantics.
Note-4: Flex containers are used as data containers to provide flexible key-value pairs.
- An IPE is developed and integrated with the oneM2M platform for communication between a non-oneM2M device and oneM2M platform
- The IPE parses required value from a non-oneM2M data model and store it as a content instance as per oneM2M data model.
- non-oneM2M data model
- oneM2M data model storing CO value as a content instance
- To start the IPE (inside MN-CSE1 in this case), enter start 49 in the MN-CSE1 terminal. A message Starting Sample Ipe will appear on the terminal.
- New content instances will be created under Data container of AE_WS as shown below
- To stop the IPE, enter stop 49
Step-5: Update access control policies (ACPs) to allow read access to allowed application entities (AEs) and other applications with the help of ACP creation rule
-
Run $ python3 update_acp_mn_cse1.py file to update the privilages of acp_admin of MN-CSE1
-
Similarly, run $ python3 update_acp_mn_cse2.py file to update the privilages of acp_admin of MN-CSE2
-
Similarly, $ python3 update_acp_mn_cse3.py file to update the privilages of acp_admin of MN-CSE3
- To test the setup, run the http_server.py ($ python3 http_server.py) file on the terminal. INFO:root:Starting httpd... message will appear on the terminal. This will initialize a simple listner server (http://127.0.0.1:1400/) that responds to notifications received from the oneM2M platform.
- The listner is used as point of access (poa) of AEs during the testing phase. Later, the POA should be changed as per the application's poa.
- As the ACPs are updated previously, therefore only authorised applications can access the data
- Run $ python3 subscribe_mn_cse1.py file to create subscription resource under the data containers of MN-CSE1
- Subscription resource creation inside same CSE
- Subscription resource creation for a AE hosted under remote CSE
- Similarly, run $ python3 subscribe_mn_cse2.py file to create subscription resource under the data containers of MN-CSE2
- Similarly, run $ python3 subscribe_mn_cse3.py file to create subscription resource under the data containers of MN-CSE3
Note: As, the http_server is used as listener for the validation of subscription resource creation, below message will appear on the server's terminal.
- Go to the directory, ESP8266_codes and use the sensing nodes' and actuating nodes' codes for the monitoring and actuating applications respectively.
- Data Security : The vulnerability of weak passwords can be exploited by an attacker to access information from the resource tree. To provide further data confidentiality and privacy, encryption is performed on the sensed data before pushing it to OM2M. Elliptic Curve Cryptography (ECC) is a public key-based cryptosystem suitable for resource constrained devices. A 160-bit ECC offers the same level of security as compared to a 1024 –bit RS algorithm thus ECC is chosen for encrypting the sensed data sent from the air quality sensor nodes to OM2M. Arduino library, tinyECC has been used on theESP8266 microcontroller.
- Go to the directory, Dashboard and use the code of the dashboard application for data visualization.