Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wakaama-dev] Wakaama & Leshan bootstrap setup

Hi,

using the leshan bootstrap is a bit undocumented for the moment.
For adding bootstrap configuration you need to POST config using the JSON API.

I attached a example python script which does that.

--
Julien Vermillard

On Thu, Dec 3, 2015 at 4:44 AM, Ricky Liu <ieei.liu@xxxxxxxxx> wrote:
Hi,

I use wakaama client to connect leshan bs server. But get this error.

11:12:35.445 [pool-2-thread-4] ERROR org.eclipse.leshan.server.californium.impl.BootstrapResource - No bootstrap config for testlwm2mclient

I trace leshan code that default bootstrap info should be in "data/bootstrap.data" but it's empty.

Is there any example "data/bootstrap.data" for wakaama setting?

Thanks.

--
RickyLiu

_______________________________________________
wakaama-dev mailing list
wakaama-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/wakaama-dev

# coding: utf-8

# # Populate bootstrap config with leshan public DM server
# 
# With two security instances and one server instance (linked to one of th esecurity instances)

# In[10]:

import requests
import json

BASE_URL = "http://192.168.59.103:8080/";
url = BASE_URL + "api/bootstrap/testlwm2mclient"
data = {"servers": {"0": {"shortId": 123,
                          "lifetime": 20,
                          "defaultMinPeriod": 1,
                          "defaultMaxPeriod": None,
                          "disableTimeout": None,
                          "notifIfDisabled": True,
                          "binding": "U"}},
        "security": {"0":{"uri": "coap://54.246.90.121:5683",
                          "bootstrapServer": False,
                          "securityMode": "NO_SEC",
                          "publicKeyOrId": [],
                          "serverPublicKeyOrId" : [],
                          "secretKey": [],
                          "smsSecurityMode": "NO_SEC",
                          "smsBindingKeyParam" : [],
                          "smsBindingKeySecret" : [],
                          "serverSmsNumber" : "+3343577464",
                          "serverId" : 123,
                          "clientOldOffTime" : 1},
                     "1":{"uri": "coap://172.17.42.1:5683",
                          "bootstrapServer": True,
                          "securityMode": "NO_SEC",
                          "publicKeyOrId": [],
                          "serverPublicKeyOrId" : [],
                          "secretKey": [],
                          "smsSecurityMode": "NO_SEC",
                          "smsBindingKeyParam" : [],
                          "smsBindingKeySecret" : [],
                          "serverSmsNumber" : "+3343577911",
                          "serverId" : 911,
                          "clientOldOffTime" : 20}}}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)
print r.status_code
print r.content


# # Get bootstrap config

# In[12]:

import requests
import json

BASE_URL = "http://192.168.59.103:8080/";
endpoints_api_url = BASE_URL + "api/bootstrap"
response = requests.get(endpoints_api_url, verify=False)

print response.status_code
print response.headers
print response.content


# # Delete bootstrap config

# In[2]:

import requests
import json

BASE_URL = "http://192.168.59.103:8080/";
url = BASE_URL + "api/bootstrap/testlwm2mclient"
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.delete(url, data=json.dumps(data), headers=headers)
print r.status_code
print r.content


# # Bootstrap configuration with two DM servers
# 
# With three security instances and two server instances

# In[7]:

import requests
import json

BASE_URL = "http://192.168.59.103:8080/";
url = BASE_URL + "api/bootstrap/testlwm2mclient"
data = {"servers": {"0": {"shortId": 123,
                          "lifetime": 300,
                          "defaultMinPeriod": 1,
                          "defaultMaxPeriod": None,
                          "disableTimeout": None,
                          "notifIfDisabled": True,
                          "binding": "U"},
                    "1": {"shortId": 456,
                          "lifetime": 30,
                          "defaultMinPeriod": 1,
                          "defaultMaxPeriod": None,
                          "disableTimeout": None,
                          "notifIfDisabled": True,
                          "binding": "U"}},
        "security": {"0":{"uri": "coap://54.246.90.121:5683",
                          "bootstrapServer": False,
                          "securityMode": "NO_SEC",
                          "publicKeyOrId": [],
                          "serverPublicKeyOrId" : [],
                          "secretKey": [],
                          "smsSecurityMode": "NO_SEC",
                          "smsBindingKeyParam" : [],
                          "smsBindingKeySecret" : [],
                          "serverSmsNumber" : "+3343577464",
                          "serverId" : 123,
                          "clientOldOffTime" : 1},
                     "1":{"uri": "coap://172.17.42.1:5683",
                          "bootstrapServer": True,
                          "securityMode": "NO_SEC",
                          "publicKeyOrId": [],
                          "serverPublicKeyOrId" : [],
                          "secretKey": [],
                          "smsSecurityMode": "NO_SEC",
                          "smsBindingKeyParam" : [],
                          "smsBindingKeySecret" : [],
                          "serverSmsNumber" : "+3343577911",
                          "serverId" : 911,
                          "clientOldOffTime" : 20},
                     "2":{"uri": "coap://127.0.0.1:5683",
                          "bootstrapServer": False,
                          "securityMode": "NO_SEC",
                          "publicKeyOrId": [],
                          "serverPublicKeyOrId" : [],
                          "secretKey": [],
                          "smsSecurityMode": "NO_SEC",
                          "smsBindingKeyParam" : [],
                          "smsBindingKeySecret" : [],
                          "serverSmsNumber" : "+3343577464",
                          "serverId" : 456,
                          "clientOldOffTime" : 1}}}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)
print r.status_code
print r.content


# # Bootstrap configuration with one DM server: wakaama server

# In[9]:

import requests
import json

BASE_URL = "http://192.168.59.103:8080/";
url = BASE_URL + "api/bootstrap/testlwm2mclient"
data = {"servers": {"0": {"shortId": 123,
                          "lifetime": 10,
                          "defaultMinPeriod": 1,
                          "defaultMaxPeriod": None,
                          "disableTimeout": None,
                          "notifIfDisabled": True,
                          "binding": "U"}},
        "security": {"0":{"uri": "coap://127.0.0.1:5683",
                          "bootstrapServer": False,
                          "securityMode": "NO_SEC",
                          "publicKeyOrId": [],
                          "serverPublicKeyOrId" : [],
                          "secretKey": [],
                          "smsSecurityMode": "NO_SEC",
                          "smsBindingKeyParam" : [],
                          "smsBindingKeySecret" : [],
                          "serverSmsNumber" : "+3343577464",
                          "serverId" : 123,
                          "clientOldOffTime" : 1},
                     "1":{"uri": "coap://172.17.42.1:5683",
                          "bootstrapServer": True,
                          "securityMode": "NO_SEC",
                          "publicKeyOrId": [],
                          "serverPublicKeyOrId" : [],
                          "secretKey": [],
                          "smsSecurityMode": "NO_SEC",
                          "smsBindingKeyParam" : [],
                          "smsBindingKeySecret" : [],
                          "serverSmsNumber" : "+3343577911",
                          "serverId" : 911,
                          "clientOldOffTime" : 20}}}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)
print r.status_code
print r.content


# In[8]:

import requests
import json

BASE_URL = "http://192.168.59.103:8080/";
url = BASE_URL + "api/bootstrap/testlwm2mclient"
data = {"servers": {"0": {"shortId": 123,
                          "lifetime": 10,
                          "defaultMinPeriod": 1,
                          "defaultMaxPeriod": None,
                          "disableTimeout": None,
                          "notifIfDisabled": True,
                          "binding": "U"}},
        "security": {"0":{"uri": "coap://127.0.0.1:5683",
                          "bootstrapServer": False,
                          "securityMode": "NO_SEC",
                          "publicKeyOrId": [],
                          "serverPublicKeyOrId" : [],
                          "secretKey": [],
                          "smsSecurityMode": "NO_SEC",
                          "smsBindingKeyParam" : [],
                          "smsBindingKeySecret" : [],
                          "serverSmsNumber" : "+3343577464",
                          "serverId" : 123,
                          "clientOldOffTime" : 1}}}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)
print r.status_code
print r.content


Back to the top