Skip to content

A couple of Jupyter notebooks to explain how to create, access and manage oneM2M resources

License

Notifications You must be signed in to change notification settings

oneM2M/onem2m-jupyter-notebooks

 
 

Repository files navigation

oneM2M Jupyter Notebooks

This repository contains a number of Jupyter Notebooks that give a practical introduction to programmatically interacting with a oneM2M CSE. The notebooks explain how to access a CSE, add and update resources, and more.

Binder Twitter

images/jupyter-lab.jpg

Installation and Configuration

Caution

Python 3.12 is not fully supported yet. Please stick to version 3.10.x or 3.11.x for the moment.

oneM2M Notebooks and Python Packages

  • Download or clone this repository to a local directory.

  • Install the necessary Python packages with the following command. You might want to consider to use a virtual environment, such as pyenv to keep your system installation clean.

      pip3 install -r requirements.txt
    

Configuration

Note
Changing these configurations is only necessary when you run your own CSE and Notification Server instead the one provided with the notebooks.

Please change the configuration in the file config.py according to your setup.

CSE Configuration

  • cseRN : The resource name of the CSE.
  • host : The URL of the CSE we want to connect to in the examples in the notebooks.
  • defaultOriginator : Originator ID to access the CSE.
  • upperTester : The full URL to access the CSE's Upper Tester interface , or None if not defined.

Notification Server Configuration

  • notificationURLBase : The base URL for the Notification Server.
  • notificationPort : The port for Notification Server.

Proxy Configuration

(Only necessary if your CSE / Notification Server can only be reached through a proxy server)

  • httpProxy : URL of your local network's http proxy server, or None.
  • httpsProxy : URL of your local network's https proxy, or None.

oneM2M CSE

The notebooks have been tested with the ACME oneM2M CSE.

These notebooks include the CSE runtime in the directory tools/ACME. It needs to be started via the separate notebook start-cse.ipynb

Notification Server

The Notification server is a separate notebook start-notificationServer.ipynb that implements a simple notification server. The executable script can be found here: tools/NotificationServer/NotificationServer.py .

Running the Notebooks

The local installation of Jupyter Notebooks can be run with one of the following commands:

  • Running with Jupyter Labs (preferred):

      jupyter lab --NotebookApp.token='' __START__.ipynb
    
  • Running with Jupyter Notebook (classic):

      jupyter notebook --NotebookApp.token='' __START__.ipynb
    

A web page with the start-up notebook opens from which you can select the exercises.

Some browsers are not able to connect to the kernel service. See the following Troubleshooting section.

Troubleshooting

When you open a notebook in your web browser you might get an error message about a "failed connection". In this case you might try another browser. When starting the Jupyter Notebook server you see a message in the console with a URL that you can paste in a browser, for example: http://localhost:8888/?token=<a long token> .

If you run the Jupyter Notebook server without authentication token (see the --NotebookApp.token option above), just use, for example http://localhost:8888 .

If you enabled the authentication token (which is the default for Jupyter) then you must use this URL including the token, because this authenticates the connection to the local Jupiter Notebook server.

Working with the Exercises

You can run the notebooks in any order. Each notebook has an init cell that initializes the notebook and creates the oneM2M resource structure for the exercises. Please execute this code cell when starting with a notebook and before executing any of the other code cells.

You may always execute the first code cell of a notebook again to re-initialize the resource tree.

CSE & Notification Server Notebooks

oneM2M Notebooks & Exercises

Running online with Binder

The oneM2M Jupyter notebooks can be run online with binder.

License

These Notebooks are available under the BSD 3-Clause License.

About

A couple of Jupyter notebooks to explain how to create, access and manage oneM2M resources

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 78.7%
  • Jupyter Notebook 9.0%
  • JavaScript 5.5%
  • CSS 4.9%
  • HTML 1.0%
  • AngelScript 0.8%
  • Other 0.1%