OM2M/one/Starting
Contents
Prerequisites
- JAVA 1.7 or later is required to run OM2M.
Configuration
Server (IN-CSE) configuration
- Go to the IN-CSE product directory: "om2m/org.eclipse.om2m/org.eclipse.om2m.site.in-cse/target/products/in-cse/<os>/<ws>/<arch>".
- Edit the file “configuration/config.ini” to configure the IN-CSE. (You can keep the current configuration for a local demo)
Parameter | Description | Example |
---|---|---|
org.eclipse.om2m.cseType | CSE type | IN |
org.eclipse.om2m.cseBaseAddress | IN-CSE ip address | 127.0.0.1 |
org.eclipse.equinox.http.jetty.http.port | IN-CSE HTTP listening port | 8080 |
org.eclipse.om2m.coap.port | IN-CSE CoAP listening port | 5683 |
org.eclipse.om2m.cseBaseContext | IN-CSE listening context | / |
org.eclipse.om2m.dbDriver | IN-CSE Database driver | org.h2.Driver |
org.eclipse.om2m.dbUrl | IN-CSE Database file location | jdbc:h2:./database/nscdb |
org.eclipse.om2m.dbUser | IN-CSE Database user name | om2m |
org.eclipse.om2m.dbPassword | IN-CSE Database password | om2m |
org.eclipse.om2m.dbReset | IN-CSE Database reset when starting | true |
org.eclipse.om2m.cseBaseId | IN-CSE CseBase resource id | in-cse |
org.eclipse.om2m.cseBaseName | IN-CSE CseBase resource name | in-name |
org.eclipse.om2m.cseBaseProtocol.default | IN-CSE Default communication protocol | http |
org.eclipse.om2m.maxNrOfInstances | Maximum number of content instances in a Container | 1000 |
org.eclipse.om2m.adminRequestingEntity | IN-CSE Default admin requesting entity. (username / password) | admin:admin |
org.eclipse.om2m.guestRequestingEntity | IN-CSE Default guest requesting entity. (username / password) | guest:guest |
Gateway (MN-CSE) configuration
- Go to the MN-CSE product directory: "om2m/org.eclipse.om2m/org.eclipse.om2m.site.mn-cse/target/products/mn-cse/<os>/<ws>/<arch>".
- Edit the file “configuration/config.ini” to configure the MN-CSE. (You can keep the current configuration for a local demo)
Parameter | Description | Example |
---|---|---|
org.eclipse.om2m.cseType | Cse type | MN |
org.eclipse.om2m.cseBaseAddress | MN ip address | 127.0.0.1 |
org.eclipse.equinox.http.jetty.http.port | MN listening port | 8181 |
org.eclipse.om2m.coap.port | MN CoAP listening port | 5684 |
org.eclipse.om2m.cseBaseContext | MN listening context | / |
org.eclipse.om2m.dbDriver | MN Database driver | org.h2.Driver |
org.eclipse.om2m.dbUrl | MN Database file location | jdbc:h2:./database/mncsedb |
org.eclipse.om2m.dbUser | MN Database user name | om2m |
org.eclipse.om2m.dbPassword | MN Database password | om2m |
org.eclipse.om2m.dbReset | MN Database reset when starting | true |
org.eclipse.om2m.cseBaseId | MN CseBase resource id | mn-cse |
org.eclipse.om2m.cseBaseName | MN CseBase resource Name | mn-name |
org.eclipse.om2m.cseBaseProtocol.default | MN default communication protocol | http |
org.eclipse.om2m.maxNrOfInstances | Maximum number of content instances in a Container | 1000 |
org.eclipse.om2m.adminRequestingEntity | Default MN-CSE admin requesting entity. (username / password) | admin:admin |
org.eclipse.om2m.guestRequestingEntity | Default MN-CSE guest requesting entity. (username / password) | guest:guest |
- The MN configuration file contains 5 additional parameters to specify the remote IN-CSE to which the MN should be authenticated.
Parameter | Description | Example |
---|---|---|
org.eclipse.om2m.remoteCseId | Remote MN Id | in-cse |
org.eclipse.om2m.remoteCseBaseName | in-name | |
org.eclipse.om2m.remoteCseAddress | Remote MN ip address | 127.0.0.1 |
org.eclipse.om2m.remoteCsePort | Remote MN listening port | 8080 |
org.eclipse.om2m.remoteCseContext | Remote MN listening context | / |
- You can configure MN-CSE and IN-CSE to work on distributed machines.
- You can configure multiple MN-CSEs by setting different identifiers.
Startup
IN-CSE startup
- Go to the IN-CSE product directory: "om2m/org.eclipse.om2m/org.eclipse.om2m.site.in-cse/target/products/in-cse/<os>/<ws>/<arch>".
- Start the IN-CSE by executing the "start.bat" script on windows or "start.sh" on Linux and Mac OS.
- Once the IN-CSE is started, you will see an OSGi console. You can type “ss” to report a summary status of all installed bundles. Type "exit" to shutdown.
- Open your browser and connect to the address "http://127.0.0.1:8080/webpage" to access the IN-CSE web interface.
- Enter username "admin" and password "admin" then click on login button to display the IN-CSE resource tree.
- After a successful authentication, the IN-CSE resource will be displayed. You can see the "in-cse" cseBase sub-resources and attributes.
- You can disconnect by clicking on the "Logout" button.
MN-CSE startup
- Go to the MN-CSE product directory: "om2m/org.eclipse.om2m/org.eclipse.om2m.site.mn-cse/target/products/mn-cse/<os>/<ws>/arch>".
- Start the MN-CSE by executing the "start.bat" script on windows or "start.sh" on Linux and Mac OS.
- Once the MN-CSE is started, you will see an OSGi console. You can type “ss” to report a summary status of all installed bundles.
- The MN-CSE automatically authenticate to the remote IN-CSE specified in the gateway configuration file. If the IN-CSE is not already running, the MN-CSE keep sending authentication requests (A request each 10 seconds).
- After a successful authentication, the “mn-cse” resource is added to the in-cse resource tree, and respectively the “in-cse” resource is added to the mn-cse resource tree. You can now access the registered MN-CSE resource from the IN-CSE web interface under the “/in-cse/in-name/mn-cse” uri.
- Using the In-CSE web interface you can seamlessly access to all authenticated gateways. You notice the existence of one authenticated MN-CSE with id "mn-cse".
- Click on the "mn-cse" resource to display remote MN-CSE sub-resources and attributes. You can click on the “mn-cse” button of the “link” attribute to connect to the MN-CSE resources tree.
- The MN-CSE resource tree will be displayed. At this moment, the IN-CSE will act as a proxy to retarget your requests to the MN-CSE.
- Initially, also the MN-CSE contains the CseBase resource (id=mn-cse), the AccessRight resource (id=acp_admin), and other empty collections.
Multiple gateways scenario
- Let's consider a simple M2M system composed of a server and two gateways as follows:
- Server IP: 192.168.0.2
- Gateway1 IP: 192.168.0.3
- Gateway2 IP: 192.168.0.4
- Of course, you can test the system locally in one machine by using the IP 127.0.0.1 for all products.
- After building the OM2M project normally, you will obtain 1 IN-CSE product, 1 MN-CSE product and 1 ADN-CSE product.
- You can configure the IN-CSE with the default configuration like this:
IN-CSE config.ini file:
org.eclipse.om2m.cseBaseId=IN-CSE org.eclipse.om2m.cseBaseName=in-name org.eclipse.om2m.cseBaseAddress=192.168.0.2 org.eclipse.equinox.http.jetty.http.port=8080
- Now, copy the MN-CSE product in another folder. You have now two separate MN-CSEs.
- Configure the first MN-CSE with the following configuration:
MN-CSE1 config.ini file:
org.eclipse.om2m.cseBaseId=MN-CSE1 org.eclipse.om2m.cseBaseName=mn-name1 org.eclipse.om2m.cseBaseAddress=192.168.0.3 org.eclipse.equinox.http.jetty.http.port=8181 org.eclipse.om2m.remoteCseId=IN-CSE org.eclipse.om2m.remoteCseName=in-name org.eclipse.om2m.remoteCseAddress=192.168.0.2 org.eclipse.om2m.remoteCsePort=8080
- Then, configure the second MN-CSE with the following configuration:
MN-CSE2 config.ini file:
org.eclipse.om2m.cseBaseId=MN-CSE2 org.eclipse.om2m.cseBaseName=mn-cse2 org.eclipse.om2m.cseBaseAddress=192.168.0.4 org.eclipse.equinox.http.jetty.http.port=8282 org.eclipse.om2m.remoteCseId=IN-CSE org.eclipse.om2m.remoteCseName=in-name org.eclipse.om2m.remoteCseddress=192.168.0.2 org.eclipse.om2m.remoteCsePort=8080
- You can start the system as follows:
- Start the IN-CSE product.
- Start the MN-CSE1 product.
- Start the MN-CSE2 product.
- Open the IN-CSE web interface on http://192.168.0.2:8080/webpage. You will find MN-CSE1 and MN-CSE2 authenticated.
- You can access now each authenticated MN-CSE by clicking on the MN-CSE.
- Click on the "link" button to access remotely the gateway resource tree.