Skip to content

easy-global-market/konem2m

Repository files navigation

OneM2M CLI app using Kotlin and GraalVM

Largely inspired by this blog post

Usage

./konem2m --help

Configuration

The following environment variables are availabe :

  • MOBIUS_HOST : Mobius host (defaults to 127.0.0.1:7579)
  • MOBIUS_CSEBASE : Mobius CSE Base (defaults to "/Mobius")

Samples

Create a ACP

./konem2m acp-create EgmAcp11 Cegm 63

Sample response :

ACP EgmAcp11 successfully created

Here is your generated RI : 4g814Kc5M8

Create an AE

./konem2m ae-create Cegm AE-Test 4g814Kc5M8

Sample response :

AE AE-Test successfully created under Mobius/AE-Test

List AEs

./konem2m ae-list

Sample response :

┌──────────────────────────────────────────────────────────────────────────────┐
│                                   AE name                                    │
├──────────────────────────────────────────────────────────────────────────────┤
│                                Mobius/AE-Test                                │
└──────────────────────────────────────────────────────────────────────────────┘

Show AE

./konem2m ae-show Cegm Mobius/AE-Test

Sample response :

{
  "m2m:ae":
    {
      "pi":"F39N5tdQ-", 
      "ri":"1oXrLz_I0x", 
      "ty":"2.0", 
      "ct":"20190620T140940", 
      "rn":"AE-Test", 
      "lt":"20190620T140940", 
      "et":"20220620T140940", 
      "acpi":["4g814Kc5M8"], 
      "api":"Cegm", 
      "aei":"Sgd2oMwPWpq", 
      "rr":true
    }
}

Create CNT

./konem2m cnt-create Cegm AE-Test SensorTemperature

Sample response :

CNT SensorTemperature successfully created under Mobius/AE-Test/SensorTemperature

List CNTs

./konem2m cnt-list

Sample response :

┌──────────────────────────────────────────────────────────────────────────────┐
│                                   CNT name                                   │
├──────────────────────────────────────────────────────────────────────────────┤
│                       Mobius/AE-Test/SensorTemperature                       │
└──────────────────────────────────────────────────────────────────────────────┘

Show a CNT

./konem2m cnt-show Cegm Mobius/AE-Test/SensorTemperature

Sample response :

{m2m:cnt={pi=1oXrLz_I0x, ri=hs7iqeuE57, ty=3.0, ct=20190620T141602, st=0.0, rn=SensorTemperature, lt=20190620T141602, et=20220620T141602, cr=Cegm, mni=3.1536E9, mbs=3.1536E9, mia=3.1536E7, cni=0.0, cbs=0.0}}

Delete a CNT

./konem2m cnt-delete Cegm AE-Test/SensorTemperature

Sample response :

{"m2m:cnt":{"pi":"CB2401PF9fX","ri":"Rxfc5iggQP","ty":3,"ct":"20191018T081537","st":0,"rn":"CO2","lt":"20191018T081537","et":"20221018T081537","cr":"CEtsiIotWeek","mni":3153600000,"mbs":3153600000,"mia":31536000,"cni":0,"cbs":0}}

Create a CI

./konem2m ci-create Cegm AE-Test/SensorTemperature 42 Temperature T°

Sample response :

CI Mobius/AE-Test/SensorTemperature/4-20190620142116190783742 with value 42;Temperature;T° successfully created under AE-Test/SensorTemperature

Create indefinitely new CIs under a CNT

./konem2m ci-create Cegm AE-Test/SensorTemperature 42 Temperature T° --repeat-interval=1000 --min-value=20 --max-value=78

Sample response :

CI Mobius/AE-Test/SensorTemperature/4-20191003045907129039109 with value 62.428228554923884 created under AE-Test/SensorTemperature
CI Mobius/AE-Test/SensorTemperature/4-20191003045908241520146 with value 49.02076602933088 created under AE-Test/SensorTemperature
CI Mobius/AE-Test/SensorTemperature/4-20191003045909291899061 with value 76.0406875224163 created under AE-Test/SensorTemperature
CI Mobius/AE-Test/SensorTemperature/4-20191003045910344814291 with value 32.475910975859904 created under AE-Test/SensorTemperature

Get last value of a CI

./konem2m ci-last Cegm Mobius/AE-Test/SensorTemperature

Sample response :

Latest value for Mobius/AE-Test/SensorTemperature is : 42

Subscribe to a CI

./konem2m sub-create Cegm AE-Test/SensorTemperature SubTemp http://localhost:6000 3

Sample response :

Sub SubTemp successfully created under Mobius/AE-Test/SensorTemperature/SubTemp

Building

Build the project

./gradlew build

Build a native image

gu install native-image
  • Set the paths
export PATH=~/tools/graalvm-ce-19.2.1/bin:$PATH
export JAVA_HOME=~/tools/graalvm-ce-19.2.1
  • Build the project
./gradlew clean build
  • Build the native image
native-image --report-unsupported-elements-at-runtime -jar build/libs/koneM2M-<version>.jar konem2m -H:Name=konem2m -H:+ReportUnsupportedElementsAtRuntime -H:EnableURLProtocols=http,https --no-server --enable-all-security-services -H:+JNI -J-Djava.library.path=~/tools/graalvm-ce-19.2.1/jre/lib/amd64

Releases

No releases published

Packages

 
 
 

Languages