[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [leshan-dev] Wakaama & Leshan bootstrap setup
|
Hi
The only way, to add config to leshan-bs-server is to directly use
REST API. We are working on a very simple web ui. Waiting this one
was available, I use this kind of python script.
# This is an example to boostrap a device "testsecure" to the leshan
sandbox with no credential. (no_sec mode)
import requests
import json
BASE_URL = "http://localhost:8083/"
url = "" + "api/bootstrap/testsecure" # here your endpoint
name
data = "" {"0": {"shortId": 123,
"lifetime": 20,
"defaultMinPeriod": 1,
"defaultMaxPeriod": None,
"disableTimeout": None,
"notifIfDisabled": True,
"binding": "U"}},
"security": {"0":{"uri": "coap://leshan.eclipse.org:5683",
"bootstrapServer": False,
"securityMode": "NO_SEC",
"publicKeyOrId": [],
"serverPublicKeyOrId" : [],
"secretKey": [],
"smsSecurityMode": "NO_SEC",
"smsBindingKeyParam" : [],
"smsBindingKeySecret" : [],
"serverSmsNumber" : "+3343577464",
"serverId" : 123,
"clientOldOffTime" : 1},
"1":{"uri": "coap://127.0.0.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="" headers=headers)
print r.status_code
print r.content
I join another example to bootstrap to a local device management
server with psk.
HTH
Simon
Le 03/12/2015 07:43, Ricky Liu a
écrit :
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 doc that explain how
to fill this file? Is there any example
"data/bootstrap.data" for wakaama setting?
Thank you in advance.
_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev
|
import requests
import json
BASE_URL = "http://localhost:8083/"
url = BASE_URL + "api/bootstrap/testsecureclient"
data = {"servers": {"0": {"shortId": 123,
"lifetime": 20,
"defaultMinPeriod": 1,
"defaultMaxPeriod": None,
"disableTimeout": None,
"notifIfDisabled": True,
"binding": "U"}},
"security": {"0":{"uri": "coaps://localhost:5784",
"bootstrapServer": False,
"securityMode": "PSK",
"publicKeyOrId": [115,101,99,117,114,101,95,99,108,105,101,110,116,95,105,100], #binary represenation of "secure_client_id"
"serverPublicKeyOrId" : [],
"secretKey": [112,114,105,118,97,116,101,95,107,101,121], #binary representation of "private_key", the hexa value is 707269766174655f6b6579
"smsSecurityMode": "NO_SEC",
"smsBindingKeyParam" : [],
"smsBindingKeySecret" : [],
"serverSmsNumber" : "+3343577464",
"serverId" : 123,
"clientOldOffTime" : 1},
"1":{"uri": "coap://localhost: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