官术网_书友最值得收藏!

  • 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:

  1. Start your OpenDaylight distribution using the karaf script. Using this script will give you access to the Karaf CLI:
$ ./bin/karaf 
  1. 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.

  1. Start your PostMan client and import the collection linked earlier and then follow these steps:
    1. At the top of the Postman window, click Import.
    2. From the pop up, select Import From Link.
    3. Paste https://www.getpostman.com/collections/f2a7e723ee6da44715e9.
    1. Click Import. You should see a message saying the collection was imported, and it will now be available from the sidebar:
    1. Click the top-right button, Show/Hide sidebar.
    2. Click on the Basic IOTDM CRUD Test folder. You now have all the REST APIs to test the application:
  1. 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"
}
]
}
}
  1. 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*/
}
}
  1. 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*/
}
}
  1. 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*/
}
}
  1. 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.

  1. 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.

  1. 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
主站蜘蛛池模板: 且末县| 阿拉善盟| 乃东县| 高雄县| 广元市| 唐山市| 伊金霍洛旗| 洛南县| 麻江县| 兴安盟| 玉门市| 旺苍县| 辽宁省| 哈巴河县| 什邡市| 怀柔区| 来宾市| 农安县| 眉山市| 巴彦淖尔市| 无极县| 镇巴县| 乌兰察布市| 葫芦岛市| 兴海县| 开鲁县| 长丰县| 东兰县| 卢龙县| 嫩江县| 滨州市| 额敏县| 家居| 铜鼓县| 炎陵县| 连平县| 敦煌市| 屏边| 崇文区| 丹阳市| 扎兰屯市|