- OpenDaylight Cookbook
- Mathieu Lemay Alexis de Talhou?t Jamie Goodyear Rashmi Pujar Mohamed El Serngawy Yrineu Rodrigues
- 418字
- 2021-07-02 21:38:42
How to do it...
Perform the following steps:
- Start your OpenDaylight distribution using the karaf script. Using this script will give you access to the Karaf CLI:
$ ./bin/karaf
- Install the user facing feature responsible for pulling in all dependencies needed to enable LACP functionalities:
opendaylight-user@root>feature:install odl-iotdm-onem2m
It might take a few minutes to complete the installation.
- Start your PostMan client and import the collection linked earlier and then follow these steps:
- At the top of the Postman window, click Import.
- From the pop up, select Import From Link.
- Paste https://www.getpostman.com/collections/f2a7e723ee6da44715e9.
- Click Import. You should see a message saying the collection was imported, and it will now be available from the sidebar:
- Click the top-right button, Show/Hide sidebar.
- Click on the Basic IOTDM CRUD Test folder. You now have all the REST APIs to test the application:

- Provision a Common Services Entity (CSE) named InCSE1:
- Type: POST
- Headers:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http:// localhost:8181/restconf/operations/onem2m:onem2m-cse-provisioning
- Payload:
{
"input":{
"onem2m-primitive":[
{
"name":"CSE_ID",
"value":"InCSE1"
},
{
"name":"CSE_TYPE",
"value":"IN-CSE"
}
]
}
}
- The Application Entity (AE) registers to its registrar CSE.
X-M2M-Origin represents the composer of the request and X-M2M-RI is the Request Identifier parameter:
- Type: POST
- Headers:
Content-Type: application/vnd.onem2m-res+json;ty=2
X-M2M-Origin: Test_AE_ID
X-M2M-RI: 12345
- URL: http:// localhost:8282/InCSE1
- Payload:
{
"m2m:ae":{
"api":"testAppId", /*Application ID*/
"apn":"testAppName", /*Application name*/
"rn":"TestAE", /*Resource name*/
"or":"http://ontology/ref", /*On topology reference*/
"rr":true /*Request reachability*/
}
}
- The AE is requested to send a create request to create a container named TestContainer:
- Type: POST
- Headers:
Content-Type: application/vnd.onem2m-res+json;ty=3
X-M2M-Origin: //iotsandbox.cisco.com:10000
X-M2M-RI: 12345
- URL: http://localhost:8282/InCSE1
- Payload:
{
"m2m:cnt":{
"rn":"TestContainer" /*Resource name*/
}
}
- Create a content instance named Cin2 in TestContainer:
- Type: POST
- Headers:
Content-Type: application/vnd.onem2m-res+json;ty=4
X-M2M-Origin: //iotsandbox.cisco.com:10000
X-M2M-RI: 12345
- URL: http://localhost:8282/InCSE1/TestContainer
- Payload:
{
"cin":{
"con":"CCDS", /*Content/*
"rn":"Cin1" /*Resource name*/
}
}
- Get all the children under the CSE InCSE1 created in step 4:
- Type: GET
- Headers:
Content-Type: application/vnd.onem2m-res+json
X-M2M-Origin: //iotsandbox.cisco.com:10000
X-M2M-RI: 12345
- URL: http://localhost:8282/InCSE1?fu=1
This will retrieve all information about the CSE, and its enclosing children, the AE, the container, and the content instance. It also has default access control policies.
- Get a given number of children located under CSE InCSE1:
- Type: GET
- Headers:
Content-Type: application/vnd.onem2m-res+json
X-M2M-Origin: //iotsandbox.cisco.com:10000
X-M2M-RI: 12345
- URL: http://localhost:8282/InCSE1?fu=1&lim=2
The limit in this request is set to 2. See the lim parameter in the URL. You can increase or decrease this number to retrieve the desired number of elements.
- Create a subscription to get notified of changes happening in a given container located in the CSE InCSE1:
- Type: POST
- Headers:
Content-Type: application/vnd.onem2m-res+json;ty=23
X-M2M-Origin: //iotsandbox.cisco.com:10000
X-M2M-RI: 12345
- URL: http://localhost:8282/InCSE1/TestContainer
- ASP.NET Web API:Build RESTful web applications and services on the .NET framework
- Visual FoxPro程序設計教程(第3版)
- Python自動化運維快速入門(第2版)
- Git高手之路
- R語言編程指南
- 微信公眾平臺開發:從零基礎到ThinkPHP5高性能框架實踐
- NGINX Cookbook
- 深入剖析Java虛擬機:源碼剖析與實例詳解(基礎卷)
- 深度探索Go語言:對象模型與runtime的原理特性及應用
- JavaScript機器人編程指南
- Hacking Android
- 從零開始學Python大數據與量化交易
- 軟件開發中的決策:權衡與取舍
- MySQL數據庫教程(視頻指導版)
- ASP.NET jQuery Cookbook(Second Edition)