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

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
主站蜘蛛池模板: 岑巩县| 朝阳区| 拜泉县| 上蔡县| 建水县| 白朗县| 富顺县| 威海市| 永泰县| 双城市| 营口市| 巴楚县| 恩平市| 石狮市| 佛学| 舞阳县| 邢台县| 太康县| 精河县| 汽车| 临颍县| 弥勒县| 大方县| 平陆县| 崇阳县| 齐河县| 拜城县| 大宁县| 榆中县| 监利县| 安吉县| 大洼县| 哈尔滨市| 佛教| 长治县| 德兴市| 安乡县| 邹平县| 龙口市| 兴安盟| 石嘴山市|