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

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
主站蜘蛛池模板: 华池县| 黔西县| 海安县| 千阳县| 墨脱县| 云安县| 漠河县| 砚山县| 青州市| 鄂伦春自治旗| 江西省| 霍林郭勒市| 平陆县| 石嘴山市| 东源县| 土默特左旗| 扶余县| 六盘水市| 康平县| 涡阳县| 白沙| 绥化市| 东莞市| 平昌县| 昔阳县| 鄂托克前旗| 汤阴县| 长顺县| 阿克苏市| 繁峙县| 高密市| 济阳县| 海城市| 南城县| 惠州市| 韶关市| 富民县| 姚安县| 龙陵县| 怀集县| 泉州市|