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

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
主站蜘蛛池模板: 大埔区| 汤原县| 唐海县| 北海市| 大田县| 林甸县| 香河县| 恩平市| 清新县| 睢宁县| 麻江县| 淮北市| 宜兰市| 繁昌县| 邯郸县| 浮梁县| 桐梓县| 旅游| 厦门市| 广南县| 富锦市| 垦利县| 涪陵区| 定陶县| 凤山县| 玉屏| 白城市| 闽侯县| 江西省| 吉安县| 长泰县| 渝中区| 米易县| 长治县| 鄂伦春自治旗| 金山区| 禹城市| 枣庄市| 柳河县| 丰台区| 榆树市|