Showing
19 changed files
with
2045 additions
and
6 deletions
@@ -22,6 +22,7 @@ import io.jsonwebtoken.Claims; | @@ -22,6 +22,7 @@ import io.jsonwebtoken.Claims; | ||
22 | import io.jsonwebtoken.Header; | 22 | import io.jsonwebtoken.Header; |
23 | import io.jsonwebtoken.Jwt; | 23 | import io.jsonwebtoken.Jwt; |
24 | import io.jsonwebtoken.Jwts; | 24 | import io.jsonwebtoken.Jwts; |
25 | +import lombok.Getter; | ||
25 | import lombok.extern.slf4j.Slf4j; | 26 | import lombok.extern.slf4j.Slf4j; |
26 | import org.apache.commons.lang3.RandomStringUtils; | 27 | import org.apache.commons.lang3.RandomStringUtils; |
27 | import org.apache.commons.lang3.StringUtils; | 28 | import org.apache.commons.lang3.StringUtils; |
@@ -120,7 +121,7 @@ public abstract class AbstractWebTest { | @@ -120,7 +121,7 @@ public abstract class AbstractWebTest { | ||
120 | protected String refreshToken; | 121 | protected String refreshToken; |
121 | protected String username; | 122 | protected String username; |
122 | 123 | ||
123 | - private TenantId tenantId; | 124 | + protected TenantId tenantId; |
124 | 125 | ||
125 | @SuppressWarnings("rawtypes") | 126 | @SuppressWarnings("rawtypes") |
126 | private HttpMessageConverter mappingJackson2HttpMessageConverter; | 127 | private HttpMessageConverter mappingJackson2HttpMessageConverter; |
@@ -32,7 +32,8 @@ import java.util.Arrays; | @@ -32,7 +32,8 @@ import java.util.Arrays; | ||
32 | "org.thingsboard.server.transport.*.attributes.updates.sql.*Test", | 32 | "org.thingsboard.server.transport.*.attributes.updates.sql.*Test", |
33 | "org.thingsboard.server.transport.*.attributes.request.sql.*Test", | 33 | "org.thingsboard.server.transport.*.attributes.request.sql.*Test", |
34 | "org.thingsboard.server.transport.*.claim.sql.*Test", | 34 | "org.thingsboard.server.transport.*.claim.sql.*Test", |
35 | - "org.thingsboard.server.transport.*.provision.sql.*Test" | 35 | + "org.thingsboard.server.transport.*.provision.sql.*Test", |
36 | + "org.thingsboard.server.transport.lwm2m.*Test" | ||
36 | }) | 37 | }) |
37 | public class TransportSqlTestSuite { | 38 | public class TransportSqlTestSuite { |
38 | 39 |
application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.transport.lwm2m; | ||
17 | + | ||
18 | +import com.fasterxml.jackson.core.type.TypeReference; | ||
19 | +import org.apache.commons.io.IOUtils; | ||
20 | +import org.junit.After; | ||
21 | +import org.junit.Assert; | ||
22 | +import org.junit.Before; | ||
23 | +import org.thingsboard.common.util.JacksonUtil; | ||
24 | +import org.thingsboard.server.common.data.DeviceProfile; | ||
25 | +import org.thingsboard.server.common.data.DeviceProfileProvisionType; | ||
26 | +import org.thingsboard.server.common.data.DeviceProfileType; | ||
27 | +import org.thingsboard.server.common.data.DeviceTransportType; | ||
28 | +import org.thingsboard.server.common.data.ResourceType; | ||
29 | +import org.thingsboard.server.common.data.TbResource; | ||
30 | +import org.thingsboard.server.common.data.device.profile.DefaultDeviceProfileConfiguration; | ||
31 | +import org.thingsboard.server.common.data.device.profile.DeviceProfileData; | ||
32 | +import org.thingsboard.server.common.data.device.profile.DisabledDeviceProfileProvisionConfiguration; | ||
33 | +import org.thingsboard.server.common.data.device.profile.Lwm2mDeviceProfileTransportConfiguration; | ||
34 | +import org.thingsboard.server.controller.AbstractWebsocketTest; | ||
35 | +import org.thingsboard.server.controller.TbTestWebSocketClient; | ||
36 | +import org.thingsboard.server.dao.service.DaoSqlTest; | ||
37 | + | ||
38 | +import java.util.Base64; | ||
39 | +import java.util.concurrent.Executors; | ||
40 | +import java.util.concurrent.ScheduledExecutorService; | ||
41 | + | ||
42 | +@DaoSqlTest | ||
43 | +public class AbstractLwM2MIntegrationTest extends AbstractWebsocketTest { | ||
44 | + | ||
45 | + protected DeviceProfile deviceProfile; | ||
46 | + protected ScheduledExecutorService executor; | ||
47 | + protected TbTestWebSocketClient wsClient; | ||
48 | + | ||
49 | + @Before | ||
50 | + public void beforeTest() throws Exception { | ||
51 | + executor = Executors.newScheduledThreadPool(10); | ||
52 | + loginTenantAdmin(); | ||
53 | + | ||
54 | + String[] resources = new String[]{"0.xml", "1.xml", "2.xml", "3.xml"}; | ||
55 | + for (String resourceName : resources) { | ||
56 | + TbResource lwModel = new TbResource(); | ||
57 | + lwModel.setResourceType(ResourceType.LWM2M_MODEL); | ||
58 | + lwModel.setTitle(resourceName); | ||
59 | + lwModel.setFileName(resourceName); | ||
60 | + lwModel.setTenantId(tenantId); | ||
61 | + byte[] bytes = IOUtils.toByteArray(AbstractLwM2MIntegrationTest.class.getClassLoader().getResourceAsStream("lwm2m/" + resourceName)); | ||
62 | + lwModel.setData(Base64.getEncoder().encodeToString(bytes)); | ||
63 | + lwModel = doPostWithTypedResponse("/api/resource", lwModel, new TypeReference<>(){}); | ||
64 | + Assert.assertNotNull(lwModel); | ||
65 | + } | ||
66 | + wsClient = buildAndConnectWebSocketClient(); | ||
67 | + } | ||
68 | + | ||
69 | + protected void createDeviceProfile(String transportConfiguration) throws Exception { | ||
70 | + deviceProfile = new DeviceProfile(); | ||
71 | + | ||
72 | + deviceProfile.setName("LwM2M No Security"); | ||
73 | + deviceProfile.setType(DeviceProfileType.DEFAULT); | ||
74 | + deviceProfile.setTenantId(tenantId); | ||
75 | + deviceProfile.setTransportType(DeviceTransportType.LWM2M); | ||
76 | + deviceProfile.setProvisionType(DeviceProfileProvisionType.DISABLED); | ||
77 | + deviceProfile.setDescription(deviceProfile.getName()); | ||
78 | + | ||
79 | + DeviceProfileData deviceProfileData = new DeviceProfileData(); | ||
80 | + deviceProfileData.setConfiguration(new DefaultDeviceProfileConfiguration()); | ||
81 | + deviceProfileData.setProvisionConfiguration(new DisabledDeviceProfileProvisionConfiguration(null)); | ||
82 | + deviceProfileData.setTransportConfiguration(JacksonUtil.fromString(transportConfiguration, Lwm2mDeviceProfileTransportConfiguration.class)); | ||
83 | + deviceProfile.setProfileData(deviceProfileData); | ||
84 | + | ||
85 | + deviceProfile = doPost("/api/deviceProfile", deviceProfile, DeviceProfile.class); | ||
86 | + Assert.assertNotNull(deviceProfile); | ||
87 | + } | ||
88 | + | ||
89 | + @After | ||
90 | + public void after() { | ||
91 | + executor.shutdownNow(); | ||
92 | + wsClient.close(); | ||
93 | + } | ||
94 | + | ||
95 | +} |
application/src/test/java/org/thingsboard/server/transport/lwm2m/NoSecLwM2MIntegrationTest.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.transport.lwm2m; | ||
17 | + | ||
18 | +import org.jetbrains.annotations.NotNull; | ||
19 | +import org.junit.Assert; | ||
20 | +import org.junit.Test; | ||
21 | +import org.thingsboard.common.util.JacksonUtil; | ||
22 | +import org.thingsboard.server.common.data.Device; | ||
23 | +import org.thingsboard.server.common.data.query.EntityData; | ||
24 | +import org.thingsboard.server.common.data.query.EntityDataPageLink; | ||
25 | +import org.thingsboard.server.common.data.query.EntityDataQuery; | ||
26 | +import org.thingsboard.server.common.data.query.EntityKey; | ||
27 | +import org.thingsboard.server.common.data.query.EntityKeyType; | ||
28 | +import org.thingsboard.server.common.data.query.SingleEntityFilter; | ||
29 | +import org.thingsboard.server.common.data.security.DeviceCredentials; | ||
30 | +import org.thingsboard.server.common.data.security.DeviceCredentialsType; | ||
31 | +import org.thingsboard.server.service.telemetry.cmd.TelemetryPluginCmdsWrapper; | ||
32 | +import org.thingsboard.server.service.telemetry.cmd.v2.EntityDataCmd; | ||
33 | +import org.thingsboard.server.service.telemetry.cmd.v2.EntityDataUpdate; | ||
34 | +import org.thingsboard.server.service.telemetry.cmd.v2.LatestValueCmd; | ||
35 | +import org.thingsboard.server.transport.lwm2m.client.LwM2MTestClient; | ||
36 | +import org.thingsboard.server.transport.lwm2m.secure.credentials.LwM2MCredentials; | ||
37 | +import org.thingsboard.server.transport.lwm2m.secure.credentials.NoSecClientCredentialsConfig; | ||
38 | + | ||
39 | +import java.util.Collections; | ||
40 | +import java.util.List; | ||
41 | + | ||
42 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
43 | + | ||
44 | +public class NoSecLwM2MIntegrationTest extends AbstractLwM2MIntegrationTest { | ||
45 | + | ||
46 | + protected final String TRANSPORT_CONFIGURATION = "{\n" + | ||
47 | + " \"type\": \"LWM2M\",\n" + | ||
48 | + " \"observeAttr\": {\n" + | ||
49 | + " \"keyName\": {\n" + | ||
50 | + " \"/3_1.0/0/9\": \"batteryLevel\"\n" + | ||
51 | + " },\n" + | ||
52 | + " \"observe\": [],\n" + | ||
53 | + " \"attribute\": [\n" + | ||
54 | + " ],\n" + | ||
55 | + " \"telemetry\": [\n" + | ||
56 | + " \"/3_1.0/0/9\"\n" + | ||
57 | + " ],\n" + | ||
58 | + " \"attributeLwm2m\": {}\n" + | ||
59 | + " },\n" + | ||
60 | + " \"bootstrap\": {\n" + | ||
61 | + " \"servers\": {\n" + | ||
62 | + " \"binding\": \"UQ\",\n" + | ||
63 | + " \"shortId\": 123,\n" + | ||
64 | + " \"lifetime\": 300,\n" + | ||
65 | + " \"notifIfDisabled\": true,\n" + | ||
66 | + " \"defaultMinPeriod\": 1\n" + | ||
67 | + " },\n" + | ||
68 | + " \"lwm2mServer\": {\n" + | ||
69 | + " \"host\": \"localhost\",\n" + | ||
70 | + " \"port\": 5685,\n" + | ||
71 | + " \"serverId\": 123,\n" + | ||
72 | + " \"securityMode\": \"NO_SEC\",\n" + | ||
73 | + " \"serverPublicKey\": \"\",\n" + | ||
74 | + " \"bootstrapServerIs\": false,\n" + | ||
75 | + " \"clientHoldOffTime\": 1,\n" + | ||
76 | + " \"bootstrapServerAccountTimeout\": 0\n" + | ||
77 | + " },\n" + | ||
78 | + " \"bootstrapServer\": {\n" + | ||
79 | + " \"host\": \"localhost\",\n" + | ||
80 | + " \"port\": 5687,\n" + | ||
81 | + " \"serverId\": 111,\n" + | ||
82 | + " \"securityMode\": \"NO_SEC\",\n" + | ||
83 | + " \"serverPublicKey\": \"\",\n" + | ||
84 | + " \"bootstrapServerIs\": true,\n" + | ||
85 | + " \"clientHoldOffTime\": 1,\n" + | ||
86 | + " \"bootstrapServerAccountTimeout\": 0\n" + | ||
87 | + " }\n" + | ||
88 | + " },\n" + | ||
89 | + " \"clientLwM2mSettings\": {\n" + | ||
90 | + " \"clientOnlyObserveAfterConnect\": 1\n" + | ||
91 | + " }\n" + | ||
92 | + "}"; | ||
93 | + | ||
94 | + @NotNull | ||
95 | + private Device createDevice(String deviceAEndpoint) throws Exception { | ||
96 | + Device device = new Device(); | ||
97 | + device.setName("Device A"); | ||
98 | + device.setDeviceProfileId(deviceProfile.getId()); | ||
99 | + device.setTenantId(tenantId); | ||
100 | + device = doPost("/api/device", device, Device.class); | ||
101 | + Assert.assertNotNull(device); | ||
102 | + | ||
103 | + DeviceCredentials deviceCredentials = | ||
104 | + doGet("/api/device/" + device.getId().getId().toString() + "/credentials", DeviceCredentials.class); | ||
105 | + Assert.assertEquals(device.getId(), deviceCredentials.getDeviceId()); | ||
106 | + deviceCredentials.setCredentialsType(DeviceCredentialsType.LWM2M_CREDENTIALS); | ||
107 | + | ||
108 | + deviceCredentials.setCredentialsId(deviceAEndpoint); | ||
109 | + | ||
110 | + LwM2MCredentials noSecCredentials = new LwM2MCredentials(); | ||
111 | + noSecCredentials.setClient(new NoSecClientCredentialsConfig()); | ||
112 | + deviceCredentials.setCredentialsValue(JacksonUtil.toString(noSecCredentials)); | ||
113 | + doPost("/api/device/credentials", deviceCredentials).andExpect(status().isOk()); | ||
114 | + return device; | ||
115 | + } | ||
116 | + | ||
117 | + @Test | ||
118 | + public void testConnectAndObserveTelemetry() throws Exception { | ||
119 | + createDeviceProfile(TRANSPORT_CONFIGURATION); | ||
120 | + | ||
121 | + String deviceAEndpoint = "deviceAEndpoint"; | ||
122 | + | ||
123 | + Device device = createDevice(deviceAEndpoint); | ||
124 | + | ||
125 | + SingleEntityFilter sef = new SingleEntityFilter(); | ||
126 | + sef.setSingleEntity(device.getId()); | ||
127 | + LatestValueCmd latestCmd = new LatestValueCmd(); | ||
128 | + latestCmd.setKeys(Collections.singletonList(new EntityKey(EntityKeyType.TIME_SERIES, "batteryLevel"))); | ||
129 | + EntityDataQuery edq = new EntityDataQuery(sef, new EntityDataPageLink(1, 0, null, null), | ||
130 | + Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); | ||
131 | + | ||
132 | + EntityDataCmd cmd = new EntityDataCmd(1, edq, null, latestCmd, null); | ||
133 | + TelemetryPluginCmdsWrapper wrapper = new TelemetryPluginCmdsWrapper(); | ||
134 | + wrapper.setEntityDataCmds(Collections.singletonList(cmd)); | ||
135 | + | ||
136 | + wsClient.send(mapper.writeValueAsString(wrapper)); | ||
137 | + wsClient.waitForReply(); | ||
138 | + | ||
139 | + wsClient.registerWaitForUpdate(); | ||
140 | + LwM2MTestClient client = new LwM2MTestClient(executor, deviceAEndpoint); | ||
141 | + client.init(); | ||
142 | + String msg = wsClient.waitForUpdate(); | ||
143 | + | ||
144 | + EntityDataUpdate update = mapper.readValue(msg, EntityDataUpdate.class); | ||
145 | + Assert.assertEquals(1, update.getCmdId()); | ||
146 | + List<EntityData> eData = update.getUpdate(); | ||
147 | + Assert.assertNotNull(eData); | ||
148 | + Assert.assertEquals(1, eData.size()); | ||
149 | + Assert.assertEquals(device.getId(), eData.get(0).getEntityId()); | ||
150 | + Assert.assertNotNull(eData.get(0).getLatest().get(EntityKeyType.TIME_SERIES)); | ||
151 | + var tsValue = eData.get(0).getLatest().get(EntityKeyType.TIME_SERIES).get("batteryLevel"); | ||
152 | + Assert.assertEquals(42, Long.parseLong(tsValue.getValue())); | ||
153 | + client.destroy(); | ||
154 | + } | ||
155 | + | ||
156 | +} |
application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.transport.lwm2m.client; | ||
17 | + | ||
18 | +import lombok.Data; | ||
19 | +import lombok.extern.slf4j.Slf4j; | ||
20 | +import org.eclipse.californium.core.network.config.NetworkConfig; | ||
21 | +import org.eclipse.californium.elements.Connector; | ||
22 | +import org.eclipse.californium.scandium.DTLSConnector; | ||
23 | +import org.eclipse.californium.scandium.config.DtlsConnectorConfig; | ||
24 | +import org.eclipse.californium.scandium.dtls.ClientHandshaker; | ||
25 | +import org.eclipse.californium.scandium.dtls.DTLSSession; | ||
26 | +import org.eclipse.californium.scandium.dtls.HandshakeException; | ||
27 | +import org.eclipse.californium.scandium.dtls.Handshaker; | ||
28 | +import org.eclipse.californium.scandium.dtls.ResumingClientHandshaker; | ||
29 | +import org.eclipse.californium.scandium.dtls.ResumingServerHandshaker; | ||
30 | +import org.eclipse.californium.scandium.dtls.ServerHandshaker; | ||
31 | +import org.eclipse.californium.scandium.dtls.SessionAdapter; | ||
32 | +import org.eclipse.leshan.client.californium.LeshanClient; | ||
33 | +import org.eclipse.leshan.client.californium.LeshanClientBuilder; | ||
34 | +import org.eclipse.leshan.client.engine.DefaultRegistrationEngineFactory; | ||
35 | +import org.eclipse.leshan.client.object.Server; | ||
36 | +import org.eclipse.leshan.client.observer.LwM2mClientObserver; | ||
37 | +import org.eclipse.leshan.client.resource.ObjectsInitializer; | ||
38 | +import org.eclipse.leshan.client.servers.ServerIdentity; | ||
39 | +import org.eclipse.leshan.core.ResponseCode; | ||
40 | +import org.eclipse.leshan.core.californium.DefaultEndpointFactory; | ||
41 | +import org.eclipse.leshan.core.model.LwM2mModel; | ||
42 | +import org.eclipse.leshan.core.model.ObjectLoader; | ||
43 | +import org.eclipse.leshan.core.model.ObjectModel; | ||
44 | +import org.eclipse.leshan.core.model.StaticModel; | ||
45 | +import org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeDecoder; | ||
46 | +import org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeEncoder; | ||
47 | +import org.eclipse.leshan.core.request.BindingMode; | ||
48 | +import org.eclipse.leshan.core.request.BootstrapRequest; | ||
49 | +import org.eclipse.leshan.core.request.DeregisterRequest; | ||
50 | +import org.eclipse.leshan.core.request.RegisterRequest; | ||
51 | +import org.eclipse.leshan.core.request.UpdateRequest; | ||
52 | + | ||
53 | +import java.util.ArrayList; | ||
54 | +import java.util.List; | ||
55 | +import java.util.concurrent.ScheduledExecutorService; | ||
56 | + | ||
57 | +import static org.eclipse.leshan.client.object.Security.noSec; | ||
58 | +import static org.eclipse.leshan.core.LwM2mId.DEVICE; | ||
59 | +import static org.eclipse.leshan.core.LwM2mId.SECURITY; | ||
60 | +import static org.eclipse.leshan.core.LwM2mId.SERVER; | ||
61 | + | ||
62 | +@Slf4j | ||
63 | +@Data | ||
64 | +public class LwM2MTestClient { | ||
65 | + | ||
66 | + private final ScheduledExecutorService executor; | ||
67 | + private final String endpoint; | ||
68 | + private LeshanClient client; | ||
69 | + | ||
70 | + public void init() { | ||
71 | + String[] resources = new String[]{"0.xml", "1.xml", "2.xml", "3.xml"}; | ||
72 | + List<ObjectModel> models = new ArrayList<>(); | ||
73 | + for (String resourceName : resources) { | ||
74 | + models.addAll(ObjectLoader.loadDdfFile(LwM2MTestClient.class.getClassLoader().getResourceAsStream("lwm2m/" + resourceName), resourceName)); | ||
75 | + } | ||
76 | + LwM2mModel model = new StaticModel(models); | ||
77 | + ObjectsInitializer initializer = new ObjectsInitializer(model); | ||
78 | + initializer.setInstancesForObject(SECURITY, noSec("coap://localhost:5685", 123)); | ||
79 | + initializer.setInstancesForObject(SERVER, new Server(123, 300, BindingMode.U, false)); | ||
80 | + initializer.setInstancesForObject(DEVICE, new SimpleLwM2MDevice()); | ||
81 | + | ||
82 | + NetworkConfig coapConfig = new NetworkConfig(); | ||
83 | + coapConfig.setString("COAP_PORT", Integer.toString(5685)); | ||
84 | + | ||
85 | + DtlsConnectorConfig.Builder dtlsConfig = new DtlsConnectorConfig.Builder(); | ||
86 | + dtlsConfig.setRecommendedCipherSuitesOnly(true); | ||
87 | + | ||
88 | + DefaultRegistrationEngineFactory engineFactory = new DefaultRegistrationEngineFactory(); | ||
89 | + engineFactory.setReconnectOnUpdate(false); | ||
90 | + engineFactory.setResumeOnConnect(true); | ||
91 | + | ||
92 | + DefaultEndpointFactory endpointFactory = new DefaultEndpointFactory(endpoint) { | ||
93 | + @Override | ||
94 | + protected Connector createSecuredConnector(DtlsConnectorConfig dtlsConfig) { | ||
95 | + | ||
96 | + return new DTLSConnector(dtlsConfig) { | ||
97 | + @Override | ||
98 | + protected void onInitializeHandshaker(Handshaker handshaker) { | ||
99 | + handshaker.addSessionListener(new SessionAdapter() { | ||
100 | + | ||
101 | + @Override | ||
102 | + public void handshakeStarted(Handshaker handshaker) throws HandshakeException { | ||
103 | + if (handshaker instanceof ServerHandshaker) { | ||
104 | + log.info("DTLS Full Handshake initiated by server : STARTED ..."); | ||
105 | + } else if (handshaker instanceof ResumingServerHandshaker) { | ||
106 | + log.info("DTLS abbreviated Handshake initiated by server : STARTED ..."); | ||
107 | + } else if (handshaker instanceof ClientHandshaker) { | ||
108 | + log.info("DTLS Full Handshake initiated by client : STARTED ..."); | ||
109 | + } else if (handshaker instanceof ResumingClientHandshaker) { | ||
110 | + log.info("DTLS abbreviated Handshake initiated by client : STARTED ..."); | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | + @Override | ||
115 | + public void sessionEstablished(Handshaker handshaker, DTLSSession establishedSession) | ||
116 | + throws HandshakeException { | ||
117 | + if (handshaker instanceof ServerHandshaker) { | ||
118 | + log.info("DTLS Full Handshake initiated by server : SUCCEED, handshaker {}", handshaker); | ||
119 | + } else if (handshaker instanceof ResumingServerHandshaker) { | ||
120 | + log.info("DTLS abbreviated Handshake initiated by server : SUCCEED, handshaker {}", handshaker); | ||
121 | + } else if (handshaker instanceof ClientHandshaker) { | ||
122 | + log.info("DTLS Full Handshake initiated by client : SUCCEED, handshaker {}", handshaker); | ||
123 | + } else if (handshaker instanceof ResumingClientHandshaker) { | ||
124 | + log.info("DTLS abbreviated Handshake initiated by client : SUCCEED, handshaker {}", handshaker); | ||
125 | + } | ||
126 | + } | ||
127 | + | ||
128 | + @Override | ||
129 | + public void handshakeFailed(Handshaker handshaker, Throwable error) { | ||
130 | + /** get cause */ | ||
131 | + String cause; | ||
132 | + if (error != null) { | ||
133 | + if (error.getMessage() != null) { | ||
134 | + cause = error.getMessage(); | ||
135 | + } else { | ||
136 | + cause = error.getClass().getName(); | ||
137 | + } | ||
138 | + } else { | ||
139 | + cause = "unknown cause"; | ||
140 | + } | ||
141 | + | ||
142 | + if (handshaker instanceof ServerHandshaker) { | ||
143 | + log.info("DTLS Full Handshake initiated by server : FAILED [{}]", cause); | ||
144 | + } else if (handshaker instanceof ResumingServerHandshaker) { | ||
145 | + log.info("DTLS abbreviated Handshake initiated by server : FAILED [{}]", cause); | ||
146 | + } else if (handshaker instanceof ClientHandshaker) { | ||
147 | + log.info("DTLS Full Handshake initiated by client : FAILED [{}]", cause); | ||
148 | + } else if (handshaker instanceof ResumingClientHandshaker) { | ||
149 | + log.info("DTLS abbreviated Handshake initiated by client : FAILED [{}]", cause); | ||
150 | + } | ||
151 | + } | ||
152 | + }); | ||
153 | + } | ||
154 | + }; | ||
155 | + } | ||
156 | + }; | ||
157 | + | ||
158 | + LeshanClientBuilder builder = new LeshanClientBuilder(endpoint); | ||
159 | + builder.setLocalAddress("0.0.0.0", 11000); | ||
160 | + builder.setObjects(initializer.createAll()); | ||
161 | + builder.setCoapConfig(coapConfig); | ||
162 | + builder.setDtlsConfig(dtlsConfig); | ||
163 | + builder.setRegistrationEngineFactory(engineFactory); | ||
164 | + builder.setEndpointFactory(endpointFactory); | ||
165 | + builder.setSharedExecutor(executor); | ||
166 | + builder.setDecoder(new DefaultLwM2mNodeDecoder(true)); | ||
167 | + builder.setEncoder(new DefaultLwM2mNodeEncoder(true)); | ||
168 | + client = builder.build(); | ||
169 | + | ||
170 | + LwM2mClientObserver observer = new LwM2mClientObserver() { | ||
171 | + @Override | ||
172 | + public void onBootstrapStarted(ServerIdentity bsserver, BootstrapRequest request) { | ||
173 | + log.info("ClientObserver -> onBootstrapStarted..."); | ||
174 | + } | ||
175 | + | ||
176 | + @Override | ||
177 | + public void onBootstrapSuccess(ServerIdentity bsserver, BootstrapRequest request) { | ||
178 | + log.info("ClientObserver -> onBootstrapSuccess..."); | ||
179 | + } | ||
180 | + | ||
181 | + @Override | ||
182 | + public void onBootstrapFailure(ServerIdentity bsserver, BootstrapRequest request, ResponseCode responseCode, String errorMessage, Exception cause) { | ||
183 | + log.info("ClientObserver -> onBootstrapFailure..."); | ||
184 | + } | ||
185 | + | ||
186 | + @Override | ||
187 | + public void onBootstrapTimeout(ServerIdentity bsserver, BootstrapRequest request) { | ||
188 | + log.info("ClientObserver -> onBootstrapTimeout..."); | ||
189 | + } | ||
190 | + | ||
191 | + @Override | ||
192 | + public void onRegistrationStarted(ServerIdentity server, RegisterRequest request) { | ||
193 | +// log.info("ClientObserver -> onRegistrationStarted... EndpointName [{}]", request.getEndpointName()); | ||
194 | + } | ||
195 | + | ||
196 | + @Override | ||
197 | + public void onRegistrationSuccess(ServerIdentity server, RegisterRequest request, String registrationID) { | ||
198 | + log.info("ClientObserver -> onRegistrationSuccess... EndpointName [{}] [{}]", request.getEndpointName(), registrationID); | ||
199 | + } | ||
200 | + | ||
201 | + @Override | ||
202 | + public void onRegistrationFailure(ServerIdentity server, RegisterRequest request, ResponseCode responseCode, String errorMessage, Exception cause) { | ||
203 | + log.info("ClientObserver -> onRegistrationFailure... ServerIdentity [{}]", server); | ||
204 | + } | ||
205 | + | ||
206 | + @Override | ||
207 | + public void onRegistrationTimeout(ServerIdentity server, RegisterRequest request) { | ||
208 | + log.info("ClientObserver -> onRegistrationTimeout... RegisterRequest [{}]", request); | ||
209 | + } | ||
210 | + | ||
211 | + @Override | ||
212 | + public void onUpdateStarted(ServerIdentity server, UpdateRequest request) { | ||
213 | +// log.info("ClientObserver -> onUpdateStarted... UpdateRequest [{}]", request); | ||
214 | + } | ||
215 | + | ||
216 | + @Override | ||
217 | + public void onUpdateSuccess(ServerIdentity server, UpdateRequest request) { | ||
218 | +// log.info("ClientObserver -> onUpdateSuccess... UpdateRequest [{}]", request); | ||
219 | + } | ||
220 | + | ||
221 | + @Override | ||
222 | + public void onUpdateFailure(ServerIdentity server, UpdateRequest request, ResponseCode responseCode, String errorMessage, Exception cause) { | ||
223 | + | ||
224 | + } | ||
225 | + | ||
226 | + @Override | ||
227 | + public void onUpdateTimeout(ServerIdentity server, UpdateRequest request) { | ||
228 | + | ||
229 | + } | ||
230 | + | ||
231 | + @Override | ||
232 | + public void onDeregistrationStarted(ServerIdentity server, DeregisterRequest request) { | ||
233 | + log.info("ClientObserver ->onDeregistrationStarted... DeregisterRequest [{}]", request.getRegistrationId()); | ||
234 | + | ||
235 | + } | ||
236 | + | ||
237 | + @Override | ||
238 | + public void onDeregistrationSuccess(ServerIdentity server, DeregisterRequest request) { | ||
239 | + log.info("ClientObserver ->onDeregistrationSuccess... DeregisterRequest [{}]", request.getRegistrationId()); | ||
240 | + | ||
241 | + } | ||
242 | + | ||
243 | + @Override | ||
244 | + public void onDeregistrationFailure(ServerIdentity server, DeregisterRequest request, ResponseCode responseCode, String errorMessage, Exception cause) { | ||
245 | + log.info("ClientObserver ->onDeregistrationFailure... DeregisterRequest [{}] [{}]", request.getRegistrationId(), request.getRegistrationId()); | ||
246 | + } | ||
247 | + | ||
248 | + @Override | ||
249 | + public void onDeregistrationTimeout(ServerIdentity server, DeregisterRequest request) { | ||
250 | + log.info("ClientObserver ->onDeregistrationTimeout... DeregisterRequest [{}] [{}]", request.getRegistrationId(), request.getRegistrationId()); | ||
251 | + } | ||
252 | + }; | ||
253 | + this.client.addObserver(observer); | ||
254 | + | ||
255 | + client.start(); | ||
256 | + } | ||
257 | + | ||
258 | + public void destroy() { | ||
259 | + client.stop(false); | ||
260 | + } | ||
261 | + | ||
262 | +} |
application/src/test/java/org/thingsboard/server/transport/lwm2m/client/SimpleLwM2MDevice.java
0 → 100644
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.thingsboard.server.transport.lwm2m.client; | ||
17 | + | ||
18 | +import lombok.extern.slf4j.Slf4j; | ||
19 | +import org.eclipse.leshan.client.resource.BaseInstanceEnabler; | ||
20 | +import org.eclipse.leshan.client.servers.ServerIdentity; | ||
21 | +import org.eclipse.leshan.core.model.ObjectModel; | ||
22 | +import org.eclipse.leshan.core.model.ResourceModel; | ||
23 | +import org.eclipse.leshan.core.node.LwM2mResource; | ||
24 | +import org.eclipse.leshan.core.response.ExecuteResponse; | ||
25 | +import org.eclipse.leshan.core.response.ReadResponse; | ||
26 | +import org.eclipse.leshan.core.response.WriteResponse; | ||
27 | + | ||
28 | +import javax.security.auth.Destroyable; | ||
29 | +import java.text.SimpleDateFormat; | ||
30 | +import java.util.Arrays; | ||
31 | +import java.util.Calendar; | ||
32 | +import java.util.HashMap; | ||
33 | +import java.util.List; | ||
34 | +import java.util.Map; | ||
35 | +import java.util.Random; | ||
36 | +import java.util.TimeZone; | ||
37 | + | ||
38 | +@Slf4j | ||
39 | +public class SimpleLwM2MDevice extends BaseInstanceEnabler implements Destroyable { | ||
40 | + | ||
41 | + | ||
42 | + private static final Random RANDOM = new Random(); | ||
43 | + private static final List<Integer> supportedResources = Arrays.asList(0, 1, 2, 3 | ||
44 | +// , 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21 | ||
45 | + ); | ||
46 | + | ||
47 | + @Override | ||
48 | + public ReadResponse read(ServerIdentity identity, int resourceid) { | ||
49 | + if (!identity.isSystem()) | ||
50 | + log.info("Read on Device resource /{}/{}/{}", getModel().id, getId(), resourceid); | ||
51 | + switch (resourceid) { | ||
52 | + case 0: | ||
53 | + return ReadResponse.success(resourceid, getManufacturer()); | ||
54 | + case 1: | ||
55 | + return ReadResponse.success(resourceid, getModelNumber()); | ||
56 | + case 2: | ||
57 | + return ReadResponse.success(resourceid, getSerialNumber()); | ||
58 | + case 3: | ||
59 | + return ReadResponse.success(resourceid, getFirmwareVersion()); | ||
60 | + case 9: | ||
61 | + return ReadResponse.success(resourceid, getBatteryLevel()); | ||
62 | + case 10: | ||
63 | + return ReadResponse.success(resourceid, getMemoryFree()); | ||
64 | + case 11: | ||
65 | + Map<Integer, Long> errorCodes = new HashMap<>(); | ||
66 | + errorCodes.put(0, getErrorCode()); | ||
67 | + return ReadResponse.success(resourceid, errorCodes, ResourceModel.Type.INTEGER); | ||
68 | + case 14: | ||
69 | + return ReadResponse.success(resourceid, getUtcOffset()); | ||
70 | + case 15: | ||
71 | + return ReadResponse.success(resourceid, getTimezone()); | ||
72 | + case 16: | ||
73 | + return ReadResponse.success(resourceid, getSupportedBinding()); | ||
74 | + case 17: | ||
75 | + return ReadResponse.success(resourceid, getDeviceType()); | ||
76 | + case 18: | ||
77 | + return ReadResponse.success(resourceid, getHardwareVersion()); | ||
78 | + case 19: | ||
79 | + return ReadResponse.success(resourceid, getSoftwareVersion()); | ||
80 | + case 20: | ||
81 | + return ReadResponse.success(resourceid, getBatteryStatus()); | ||
82 | + case 21: | ||
83 | + return ReadResponse.success(resourceid, getMemoryTotal()); | ||
84 | + default: | ||
85 | + return super.read(identity, resourceid); | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public ExecuteResponse execute(ServerIdentity identity, int resourceid, String params) { | ||
91 | + String withParams = null; | ||
92 | + if (params != null && params.length() != 0) { | ||
93 | + withParams = " with params " + params; | ||
94 | + } | ||
95 | + log.info("Execute on Device resource /{}/{}/{} {}", getModel().id, getId(), resourceid, withParams != null ? withParams : ""); | ||
96 | + return ExecuteResponse.success(); | ||
97 | + } | ||
98 | + | ||
99 | + @Override | ||
100 | + public WriteResponse write(ServerIdentity identity, int resourceid, LwM2mResource value) { | ||
101 | + log.info("Write on Device resource /{}/{}/{}", getModel().id, getId(), resourceid); | ||
102 | + | ||
103 | + switch (resourceid) { | ||
104 | + case 13: | ||
105 | + return WriteResponse.notFound(); | ||
106 | + case 14: | ||
107 | + setUtcOffset((String) value.getValue()); | ||
108 | + fireResourcesChange(resourceid); | ||
109 | + return WriteResponse.success(); | ||
110 | + case 15: | ||
111 | + setTimezone((String) value.getValue()); | ||
112 | + fireResourcesChange(resourceid); | ||
113 | + return WriteResponse.success(); | ||
114 | + default: | ||
115 | + return super.write(identity, resourceid, value); | ||
116 | + } | ||
117 | + } | ||
118 | + | ||
119 | + private String getManufacturer() { | ||
120 | + return "Leshan Demo Device"; | ||
121 | + } | ||
122 | + | ||
123 | + private String getModelNumber() { | ||
124 | + return "Model 500"; | ||
125 | + } | ||
126 | + | ||
127 | + private String getSerialNumber() { | ||
128 | + return "LT-500-000-0001"; | ||
129 | + } | ||
130 | + | ||
131 | + private String getFirmwareVersion() { | ||
132 | + return "1.0.0"; | ||
133 | + } | ||
134 | + | ||
135 | + private long getErrorCode() { | ||
136 | + return 0; | ||
137 | + } | ||
138 | + | ||
139 | + private int getBatteryLevel() { | ||
140 | + return 42; | ||
141 | + } | ||
142 | + | ||
143 | + private long getMemoryFree() { | ||
144 | + return Runtime.getRuntime().freeMemory() / 1024; | ||
145 | + } | ||
146 | + | ||
147 | + private String utcOffset = new SimpleDateFormat("X").format(Calendar.getInstance().getTime()); | ||
148 | + | ||
149 | + private String getUtcOffset() { | ||
150 | + return utcOffset; | ||
151 | + } | ||
152 | + | ||
153 | + private void setUtcOffset(String t) { | ||
154 | + utcOffset = t; | ||
155 | + } | ||
156 | + | ||
157 | + private String timeZone = TimeZone.getDefault().getID(); | ||
158 | + | ||
159 | + private String getTimezone() { | ||
160 | + return timeZone; | ||
161 | + } | ||
162 | + | ||
163 | + private void setTimezone(String t) { | ||
164 | + timeZone = t; | ||
165 | + } | ||
166 | + | ||
167 | + private String getSupportedBinding() { | ||
168 | + return "U"; | ||
169 | + } | ||
170 | + | ||
171 | + private String getDeviceType() { | ||
172 | + return "Demo"; | ||
173 | + } | ||
174 | + | ||
175 | + private String getHardwareVersion() { | ||
176 | + return "1.0.1"; | ||
177 | + } | ||
178 | + | ||
179 | + private String getSoftwareVersion() { | ||
180 | + return "1.0.2"; | ||
181 | + } | ||
182 | + | ||
183 | + private int getBatteryStatus() { | ||
184 | + return RANDOM.nextInt(7); | ||
185 | + } | ||
186 | + | ||
187 | + private long getMemoryTotal() { | ||
188 | + return Runtime.getRuntime().totalMemory() / 1024; | ||
189 | + } | ||
190 | + | ||
191 | + @Override | ||
192 | + public List<Integer> getAvailableResourceIds(ObjectModel model) { | ||
193 | + return supportedResources; | ||
194 | + } | ||
195 | + | ||
196 | + @Override | ||
197 | + public void destroy() { | ||
198 | + } | ||
199 | +} |
@@ -9,13 +9,15 @@ | @@ -9,13 +9,15 @@ | ||
9 | 9 | ||
10 | <!-- <logger name="org.thingsboard.server.service.subscription" level="TRACE"/>--> | 10 | <!-- <logger name="org.thingsboard.server.service.subscription" level="TRACE"/>--> |
11 | <logger name="org.thingsboard.server.controller.TbTestWebSocketClient" level="INFO"/> | 11 | <logger name="org.thingsboard.server.controller.TbTestWebSocketClient" level="INFO"/> |
12 | - <logger name="org.thingsboard.server" level="WARN"/> | 12 | + <logger name="org.thingsboard.server" level="DEBUG"/> |
13 | <logger name="org.springframework" level="WARN"/> | 13 | <logger name="org.springframework" level="WARN"/> |
14 | <logger name="org.springframework.boot.test" level="WARN"/> | 14 | <logger name="org.springframework.boot.test" level="WARN"/> |
15 | <logger name="org.apache.cassandra" level="WARN"/> | 15 | <logger name="org.apache.cassandra" level="WARN"/> |
16 | <logger name="org.cassandraunit" level="INFO"/> | 16 | <logger name="org.cassandraunit" level="INFO"/> |
17 | + <logger name="org.eclipse.leshan" level="TRACE"/> | ||
17 | 18 | ||
18 | - <root level="WARN"> | 19 | + |
20 | + <root level="INFO"> | ||
19 | <appender-ref ref="console"/> | 21 | <appender-ref ref="console"/> |
20 | </root> | 22 | </root> |
21 | 23 |
application/src/test/resources/lwm2m/0.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | + | ||
3 | +<!-- | ||
4 | +FILE INFORMATION | ||
5 | + | ||
6 | +OMA Permanent Document | ||
7 | + File: OMA-SUP-XML_0-V1_2-20201110-A.xml | ||
8 | + Path: http://www.openmobilealliance.org/release/ObjLwM2M_Security/ | ||
9 | + | ||
10 | +OMNA LwM2M Registry | ||
11 | + Path: https://github.com/OpenMobileAlliance/lwm2m-registry | ||
12 | + Name: 0.xml | ||
13 | + | ||
14 | +NORMATIVE INFORMATION | ||
15 | + | ||
16 | + Information about this file can be found in the latest revision of | ||
17 | + | ||
18 | + OMA-TS-LightweightM2M_Core-V1_2 | ||
19 | + | ||
20 | + This is available at http://www.openmobilealliance.org/release/LightweightM2M/ | ||
21 | + | ||
22 | + Send comments to https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues | ||
23 | + | ||
24 | +LEGAL DISCLAIMER | ||
25 | + | ||
26 | + Copyright 2020 Open Mobile Alliance. | ||
27 | + | ||
28 | + Redistribution and use in source and binary forms, with or without | ||
29 | + modification, are permitted provided that the following conditions | ||
30 | + are met: | ||
31 | + | ||
32 | + 1. Redistributions of source code must retain the above copyright | ||
33 | + notice, this list of conditions and the following disclaimer. | ||
34 | + 2. Redistributions in binary form must reproduce the above copyright | ||
35 | + notice, this list of conditions and the following disclaimer in the | ||
36 | + documentation and/or other materials provided with the distribution. | ||
37 | + 3. Neither the name of the copyright holder nor the names of its | ||
38 | + contributors may be used to endorse or promote products derived | ||
39 | + from this software without specific prior written permission. | ||
40 | + | ||
41 | + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
42 | + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
43 | + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
44 | + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
45 | + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
46 | + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
47 | + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
49 | + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
50 | + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
51 | + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
52 | + POSSIBILITY OF SUCH DAMAGE. | ||
53 | + | ||
54 | + The above license is used as a license under copyright only. Please | ||
55 | + reference the OMA IPR Policy for patent licensing terms: | ||
56 | + https://www.omaspecworks.org/about/intellectual-property-rights/ | ||
57 | + | ||
58 | +--> | ||
59 | + | ||
60 | +<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd"> | ||
61 | + <Object ObjectType="MODefinition"> | ||
62 | + <Name>LWM2M Security</Name> | ||
63 | + <Description1><![CDATA[This LwM2M Object provides the keying material of a LwM2M Client appropriate to access a specified LwM2M Server. One Object Instance SHOULD address a LwM2M Bootstrap-Server. | ||
64 | +These LwM2M Object Resources MUST only be changed by a LwM2M Bootstrap-Server or Bootstrap from Smartcard and MUST NOT be accessible by any other LwM2M Server.]]></Description1> | ||
65 | + <ObjectID>0</ObjectID> | ||
66 | + <ObjectURN>urn:oma:lwm2m:oma:0:1.2</ObjectURN> | ||
67 | + <LWM2MVersion>1.1</LWM2MVersion> | ||
68 | + <ObjectVersion>1.2</ObjectVersion> | ||
69 | + <MultipleInstances>Multiple</MultipleInstances> | ||
70 | + <Mandatory>Mandatory</Mandatory> | ||
71 | + <Resources> | ||
72 | + <Item ID="0"> | ||
73 | + <Name>LWM2M Server URI</Name> | ||
74 | + <Operations></Operations> | ||
75 | + <MultipleInstances>Single</MultipleInstances> | ||
76 | + <Mandatory>Mandatory</Mandatory> | ||
77 | + <Type>String</Type> | ||
78 | + <RangeEnumeration>0..255</RangeEnumeration> | ||
79 | + <Units></Units> | ||
80 | + <Description><![CDATA[Uniquely identifies the LwM2M Server or LwM2M Bootstrap-Server. The format of the CoAP URI is defined in Section 6 of RFC 7252.]]></Description> | ||
81 | + </Item> | ||
82 | + <Item ID="1"> | ||
83 | + <Name>Bootstrap-Server</Name> | ||
84 | + <Operations></Operations> | ||
85 | + <MultipleInstances>Single</MultipleInstances> | ||
86 | + <Mandatory>Mandatory</Mandatory> | ||
87 | + <Type>Boolean</Type> | ||
88 | + <RangeEnumeration></RangeEnumeration> | ||
89 | + <Units></Units> | ||
90 | + <Description><![CDATA[Determines if the current instance concerns a LwM2M Bootstrap-Server (true) or a standard LwM2M Server (false)]]></Description> | ||
91 | + </Item> | ||
92 | + <Item ID="2"> | ||
93 | + <Name>Security Mode</Name> | ||
94 | + <Operations></Operations> | ||
95 | + <MultipleInstances>Single</MultipleInstances> | ||
96 | + <Mandatory>Mandatory</Mandatory> | ||
97 | + <Type>Integer</Type> | ||
98 | + <RangeEnumeration>0..4</RangeEnumeration> | ||
99 | + <Units></Units> | ||
100 | + <Description><![CDATA[Determines which security mode is used | ||
101 | +0: Pre-Shared Key mode | ||
102 | +1: Raw Public Key mode | ||
103 | +2: Certificate mode | ||
104 | +3: NoSec mode | ||
105 | +4: Certificate mode with EST]]></Description> | ||
106 | + </Item> | ||
107 | + <Item ID="3"> | ||
108 | + <Name>Public Key or Identity</Name> | ||
109 | + <Operations></Operations> | ||
110 | + <MultipleInstances>Single</MultipleInstances> | ||
111 | + <Mandatory>Mandatory</Mandatory> | ||
112 | + <Type>Opaque</Type> | ||
113 | + <RangeEnumeration></RangeEnumeration> | ||
114 | + <Units></Units> | ||
115 | + <Description><![CDATA[Stores the LwM2M Client's certificate, public key (RPK mode) or PSK Identity (PSK mode).]]></Description> | ||
116 | + </Item> | ||
117 | + <Item ID="4"> | ||
118 | + <Name>Server Public Key</Name> | ||
119 | + <Operations></Operations> | ||
120 | + <MultipleInstances>Single</MultipleInstances> | ||
121 | + <Mandatory>Mandatory</Mandatory> | ||
122 | + <Type>Opaque</Type> | ||
123 | + <RangeEnumeration></RangeEnumeration> | ||
124 | + <Units></Units> | ||
125 | + <Description><![CDATA[Stores the LwM2M Server's, respectively LwM2M Bootstrap-Server's, certificate, public key (RPK mode) or trust anchor. The Certificate Mode Resource determines the content of this resource.]]></Description> | ||
126 | + </Item> | ||
127 | + <Item ID="5"> | ||
128 | + <Name>Secret Key</Name> | ||
129 | + <Operations></Operations> | ||
130 | + <MultipleInstances>Single</MultipleInstances> | ||
131 | + <Mandatory>Mandatory</Mandatory> | ||
132 | + <Type>Opaque</Type> | ||
133 | + <RangeEnumeration></RangeEnumeration> | ||
134 | + <Units></Units> | ||
135 | + <Description><![CDATA[Stores the secret key (PSK mode) or private key (RPK or certificate mode).]]></Description> | ||
136 | + </Item> | ||
137 | + <Item ID="6"> | ||
138 | + <Name>SMS Security Mode</Name> | ||
139 | + <Operations></Operations> | ||
140 | + <MultipleInstances>Single</MultipleInstances> | ||
141 | + <Mandatory>Optional</Mandatory> | ||
142 | + <Type>Integer</Type> | ||
143 | + <RangeEnumeration>0..255</RangeEnumeration> | ||
144 | + <Units></Units> | ||
145 | + <Description><![CDATA[Determines which SMS security mode is used: | ||
146 | +0: Reserved for future use | ||
147 | +1: DTLS mode (Device terminated) PSK mode assumed | ||
148 | +2: Secure Packet Structure mode (Smartcard terminated) | ||
149 | +3: NoSec mode | ||
150 | +4: Reserved mode (DTLS mode with multiplexing Security Association support) | ||
151 | +5-203 : Reserved for future use | ||
152 | +204-255: Proprietary modes]]></Description> | ||
153 | + </Item> | ||
154 | + <Item ID="7"> | ||
155 | + <Name>SMS Binding Key Parameters</Name> | ||
156 | + <Operations></Operations> | ||
157 | + <MultipleInstances>Single</MultipleInstances> | ||
158 | + <Mandatory>Optional</Mandatory> | ||
159 | + <Type>Opaque</Type> | ||
160 | + <RangeEnumeration>6</RangeEnumeration> | ||
161 | + <Units></Units> | ||
162 | + <Description><![CDATA[Stores the KIc, KID, SPI and TAR.]]></Description> | ||
163 | + </Item> | ||
164 | + <Item ID="8"> | ||
165 | + <Name>SMS Binding Secret Key(s)</Name> | ||
166 | + <Operations></Operations> | ||
167 | + <MultipleInstances>Single</MultipleInstances> | ||
168 | + <Mandatory>Optional</Mandatory> | ||
169 | + <Type>Opaque</Type> | ||
170 | + <RangeEnumeration>16,32,48</RangeEnumeration> | ||
171 | + <Units></Units> | ||
172 | + <Description><![CDATA[Stores the values of the key(s) for the SMS binding.]]></Description> | ||
173 | + </Item> | ||
174 | + <Item ID="9"> | ||
175 | + <Name>LwM2M Server SMS Number</Name> | ||
176 | + <Operations></Operations> | ||
177 | + <MultipleInstances>Single</MultipleInstances> | ||
178 | + <Mandatory>Optional</Mandatory> | ||
179 | + <Type>String</Type> | ||
180 | + <RangeEnumeration></RangeEnumeration> | ||
181 | + <Units></Units> | ||
182 | + <Description><![CDATA[MSISDN used by the LwM2M Client to send messages to the LwM2M Server via the SMS binding.]]></Description> | ||
183 | + </Item> | ||
184 | + <Item ID="10"> | ||
185 | + <Name>Short Server ID</Name> | ||
186 | + <Operations></Operations> | ||
187 | + <MultipleInstances>Single</MultipleInstances> | ||
188 | + <Mandatory>Optional</Mandatory> | ||
189 | + <Type>Integer</Type> | ||
190 | + <RangeEnumeration>1..65534</RangeEnumeration> | ||
191 | + <Units></Units> | ||
192 | + <Description><![CDATA[This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. | ||
193 | +This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. | ||
194 | +The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server.]]></Description> | ||
195 | + </Item> | ||
196 | + <Item ID="11"> | ||
197 | + <Name>Client Hold Off Time</Name> | ||
198 | + <Operations></Operations> | ||
199 | + <MultipleInstances>Single</MultipleInstances> | ||
200 | + <Mandatory>Optional</Mandatory> | ||
201 | + <Type>Integer</Type> | ||
202 | + <RangeEnumeration></RangeEnumeration> | ||
203 | + <Units>s</Units> | ||
204 | + <Description><![CDATA[The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. | ||
205 | +In case client initiated bootstrap is supported by the LwM2M Client, this resource MUST be supported. This information is relevant for use with a Bootstrap-Server only.]]></Description> | ||
206 | + </Item> | ||
207 | + <Item ID="12"> | ||
208 | + <Name>Bootstrap-Server Account Timeout</Name> | ||
209 | + <Operations></Operations> | ||
210 | + <MultipleInstances>Single</MultipleInstances> | ||
211 | + <Mandatory>Optional</Mandatory> | ||
212 | + <Type>Integer</Type> | ||
213 | + <RangeEnumeration></RangeEnumeration> | ||
214 | + <Units>s</Units> | ||
215 | + <Description><![CDATA[The LwM2M Client MUST purge the LwM2M Bootstrap-Server Account after the timeout value given by this resource. The lowest timeout value is 1. | ||
216 | +If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.]]></Description> | ||
217 | + </Item> | ||
218 | + <Item ID="13"> | ||
219 | + <Name>Matching Type</Name> | ||
220 | + <Operations></Operations> | ||
221 | + <MultipleInstances>Single</MultipleInstances> | ||
222 | + <Mandatory>Optional</Mandatory> | ||
223 | + <Type>Integer</Type> | ||
224 | + <RangeEnumeration>0..3</RangeEnumeration> | ||
225 | + <Units></Units> | ||
226 | + <Description><![CDATA[The Matching Type Resource specifies how the certificate or raw public key in in the Server Public Key is presented. Four values are currently defined: | ||
227 | + 0: Exact match. This is the default value and also corresponds to the functionality of LwM2M v1.0. Hence, if this resource is not present then the content of the Server Public Key Resource corresponds to this value. | ||
228 | + 1: SHA-256 hash [RFC6234] | ||
229 | + 2: SHA-384 hash [RFC6234] | ||
230 | + 3: SHA-512 hash [RFC6234]]]></Description> | ||
231 | + </Item> | ||
232 | + <Item ID="14"> | ||
233 | + <Name>SNI</Name> | ||
234 | + <Operations></Operations> | ||
235 | + <MultipleInstances>Single</MultipleInstances> | ||
236 | + <Mandatory>Optional</Mandatory> | ||
237 | + <Type>String</Type> | ||
238 | + <RangeEnumeration></RangeEnumeration> | ||
239 | + <Units></Units> | ||
240 | + <Description><![CDATA[This resource holds the value of the Server Name Indication (SNI) value to be used during the TLS handshake. When this resource is present then the LwM2M Server URI acts as the address of the service while the SNI value is used for matching a presented certificate, or PSK identity.]]></Description> | ||
241 | + </Item> | ||
242 | + <Item ID="15"> | ||
243 | + <Name>Certificate Usage</Name> | ||
244 | + <Operations></Operations> | ||
245 | + <MultipleInstances>Single</MultipleInstances> | ||
246 | + <Mandatory>Optional</Mandatory> | ||
247 | + <Type>Integer</Type> | ||
248 | + <RangeEnumeration>0..3</RangeEnumeration> | ||
249 | + <Units></Units> | ||
250 | + <Description><![CDATA[The Certificate Usage Resource specifies the semantic of the certificate or | ||
251 | + raw public key stored in the Server Public Key Resource, which is used to match | ||
252 | + the certificate presented in the TLS/DTLS handshake. The currently defined values are | ||
253 | + 0 for "CA constraint", 1 for "service certificate constraint", 2 for "trust anchor | ||
254 | + assertion", and 3 for "domain-issued certificate". When this resource is absent, | ||
255 | + value (3) for domain issued certificate mode is assumed. More details about the | ||
256 | + semantic of each value can be found in the security consideration section of the | ||
257 | + LwM2M specification.]]></Description> | ||
258 | + </Item> | ||
259 | + <Item ID="16"> | ||
260 | + <Name>DTLS/TLS Ciphersuite</Name> | ||
261 | + <Operations></Operations> | ||
262 | + <MultipleInstances>Multiple</MultipleInstances> | ||
263 | + <Mandatory>Optional</Mandatory> | ||
264 | + <Type>Integer</Type> | ||
265 | + <RangeEnumeration></RangeEnumeration> | ||
266 | + <Units></Units> | ||
267 | + <Description><![CDATA[When this resource is present it instructs the TLS/DTLS client to propose the indicated ciphersuite(s) in the ClientHello of the handshake. A ciphersuite is indicated as a 32-bit integer value. The IANA TLS ciphersuite registry is maintained at https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml. As an example, the TLS_PSK_WITH_AES_128_CCM_8 ciphersuite is represented with the following string "0xC0,0xA8". To form an integer value the two values are concatenated. In this example, the value is 0xc0a8 or 49320.]]></Description> | ||
268 | + </Item> | ||
269 | + <Item ID="17"><Name>OSCORE Security Mode</Name> | ||
270 | + <Operations></Operations> | ||
271 | + <MultipleInstances>Single</MultipleInstances> | ||
272 | + <Mandatory>Optional</Mandatory> | ||
273 | + <Type>Objlnk</Type> | ||
274 | + <RangeEnumeration></RangeEnumeration> | ||
275 | + <Units></Units> | ||
276 | + <Description><![CDATA[If this resource is defined, it provides a link to the OSCORE Object Instance and OSCORE MUST be used by the LwM2M Client with the linked OSCORE Object Instance.]]></Description> | ||
277 | + </Item> | ||
278 | + <Item ID="18"> | ||
279 | + <Name>Groups To Use by Client</Name> | ||
280 | + <Operations></Operations> | ||
281 | + <MultipleInstances>Multiple</MultipleInstances> | ||
282 | + <Mandatory>Optional</Mandatory> | ||
283 | + <Type>Integer</Type> | ||
284 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
285 | + <Units></Units> | ||
286 | + <Description><![CDATA[If this resource is defined, it indicates what groups the LwM2M Client should use with a LwM2M Server/LwM2M Bootstrap-Server (ordered from most preferred to least preferred). Resource instance 0 indicates the most preferred group. The values are taken from Section 4.2.7 of RFC 8446. An example is secp256r1 (0x0017).]]></Description> | ||
287 | + </Item> | ||
288 | + <Item ID="19"> | ||
289 | + <Name>Signature Algorithms Supported by Server</Name> | ||
290 | + <Operations></Operations> | ||
291 | + <MultipleInstances>Multiple</MultipleInstances> | ||
292 | + <Mandatory>Optional</Mandatory> | ||
293 | + <Type>Integer</Type> | ||
294 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
295 | + <Units></Units> | ||
296 | + <Description><![CDATA[If this resource is defined, it indicates what signature algorithms the LwM2M Server/LwM2M Bootstrap-Server supports. The values are taken from Section 4.2.3 of RFC 8446. An example is ecdsa_secp256r1_sha256(0x0403).]]></Description> | ||
297 | + </Item> | ||
298 | + <Item ID="20"><Name>Signature Algorithms To Use by Client</Name> | ||
299 | + <Operations></Operations> | ||
300 | + <MultipleInstances>Multiple</MultipleInstances> | ||
301 | + <Mandatory>Optional</Mandatory> | ||
302 | + <Type>Integer</Type> | ||
303 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
304 | + <Units></Units> | ||
305 | + <Description><![CDATA[If this resource is defined, it indicates what signature algorithms the LwM2M Client should use with a LwM2M Server/LwM2M Bootstrap-Server (ordered from most preferred to least preferred). Resource instance 0 indicates the most preferred group. The values are taken from Section 4.2.3 of RFC 8446. An example is ecdsa_secp256r1_sha256(0x0403).]]></Description> | ||
306 | + </Item> | ||
307 | + <Item ID="21"> | ||
308 | + <Name>Signature Algorithm Certs Supported by Server</Name> | ||
309 | + <Operations></Operations> | ||
310 | + <MultipleInstances>Multiple</MultipleInstances> | ||
311 | + <Mandatory>Optional</Mandatory> | ||
312 | + <Type>Integer</Type> | ||
313 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
314 | + <Units></Units> | ||
315 | + <Description><![CDATA[If this resource is defined, it indicates what certificate-specific signature algorithms the the LwM2M Server/LwM2M Bootstrap-Server supports. The values are taken from Section 4.2.3 of RFC 8446. An example is ecdsa_secp256r1_sha256(0x0403).]]></Description> | ||
316 | + </Item> | ||
317 | + <Item ID="22"> | ||
318 | + <Name>TLS 1.3 Features To Use by Client</Name> | ||
319 | + <Operations></Operations> | ||
320 | + <MultipleInstances>Single</MultipleInstances> | ||
321 | + <Mandatory>Optional</Mandatory> | ||
322 | + <Type>Integer</Type> | ||
323 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
324 | + <Units></Units> | ||
325 | + <Description><![CDATA[If this resource is defined, it indicates which features the LwM2M Client should use with the respective LwM2M Server/LwM2M Bootstrap-Server. The bitmask values listed below are defined. A bit value of '0' means the feature should not be used. bit(0) - PSK Plain, bit(1) - 0-RTT, bit(2) - PSK with PFS, bit(3) - Certificate-based Authentication. Bit(4) to bit(31) are reserved.]]></Description> | ||
326 | + </Item> | ||
327 | + <Item ID="23"> | ||
328 | + <Name>TLS Extensions Supported by Server</Name> | ||
329 | + <Operations></Operations> | ||
330 | + <MultipleInstances>Single</MultipleInstances> | ||
331 | + <Mandatory>Optional</Mandatory> | ||
332 | + <Type>Integer</Type> | ||
333 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
334 | + <Units></Units> | ||
335 | + <Description><![CDATA[If this resource is defined, it indicates what extensions the LwM2M Server/LwM2M Bootstrap-Server supports in form of a bitmap. The following values are defined: bit(0) - Server Name Indication (RFC 6066), bit (1) - Max Fragment Length (RFC 6066), bit (2) - Status Request (RFC 6066), bit (3) - Heartbeat (RFC 6520), bit (4) - Application Layer Protocol Negotiation (RFC 7301), bit (5) - Signed Certificate Timestamp (RFC 6962), bit (6) - Certificate Compression (draft-ietf-tls-certificate-compression), bit (7) - Record Size Limit (RFC 8449), bit (8) - Ticket Pinning (draft-ietf-tls-pinning-ticket), bit (9) - Certificate Authorities (RFC 8446), bit (10) - OID Filters (RFC 8446), bit (11) - Post Handshake Auth (RFC 8446), bit (12) - Connection ID (draft-ietf-tls-dtls-connection-id/draft-ietf-tls-dtls13). Bit(13) to bit(31) are reserved. ]]></Description> | ||
336 | + </Item> | ||
337 | + <Item ID="24"> | ||
338 | + <Name>TLS Extensions To Use by Client</Name> | ||
339 | + <Operations></Operations> | ||
340 | + <MultipleInstances>Single</MultipleInstances> | ||
341 | + <Mandatory>Optional</Mandatory> | ||
342 | + <Type>Integer</Type> | ||
343 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
344 | + <Units></Units> | ||
345 | + <Description><![CDATA[If this resource is defined, it indicates what extensions the LwM2M Client should use with the LwM2M Server/LwM2M Bootstrap-Server in form of a bitmap. The following values are defined: bit(0) - Server Name Indication (RFC 6066), bit (1) - Max Fragment Length (RFC 6066), bit (2) - Status Request (RFC 6066), bit (3) - Heartbeat (RFC 6520), bit (4) - Application Layer Protocol Negotiation (RFC 7301), bit (5) - Signed Certificate Timestamp (RFC 6962), bit (6) - Certificate Compression (draft-ietf-tls-certificate-compression), bit (7) - Record Size Limit (RFC 8449), bit (8) - Ticket Pinning (draft-ietf-tls-pinning-ticket), bit (9) - Certificate Authorities (RFC 8446), bit (10) - OID Filters (RFC 8446), bit (11) - Post Handshake Auth (RFC 8446), bit (12) - Connection ID (draft-ietf-tls-dtls-connection-id/draft-ietf-tls-dtls13). Bit(13) to bit(31) are reserved. ]]></Description> | ||
346 | + </Item> | ||
347 | + <Item ID="25"> | ||
348 | + <Name>Secondary LwM2M Server URI</Name> | ||
349 | + <Operations></Operations> | ||
350 | + <MultipleInstances>Multiple</MultipleInstances> | ||
351 | + <Mandatory>Optional</Mandatory> | ||
352 | + <Type>String</Type> | ||
353 | + <RangeEnumeration>0..255</RangeEnumeration> | ||
354 | + <Units></Units> | ||
355 | + <Description><![CDATA[If this resource is present then the LwM2M Server URI in the Security Object, Resource ID 0, is augmented with information about further LwM2M Server URIs that can be used with the same security information found in the LwM2M Security Object. This is useful when a LwM2M Server is reachable via two different transport bindings (i.e. URIs). For example when the same server is reachable with two different URIs, such as a "coaps" and a "coaps+tcp" URI scheme.]]></Description> | ||
356 | + </Item> | ||
357 | + <Item ID="26"><Name>MQTT Server</Name> | ||
358 | + <Operations></Operations> | ||
359 | + <MultipleInstances>Single</MultipleInstances> | ||
360 | + <Mandatory>Optional</Mandatory> | ||
361 | + <Type>Objlnk</Type> | ||
362 | + <RangeEnumeration></RangeEnumeration> | ||
363 | + <Units></Units> | ||
364 | + <Description><![CDATA[If this resource is defined, it provides a link to a MQTT Server Object Instance, which offers additional configuration information for use with this MQTT server. This Resource is used only when the URI scheme in the LwM2M Server URI Resource indicates the use of MQTT.]]></Description> | ||
365 | + </Item> | ||
366 | + <Item ID="27"><Name>LwM2M COSE Security</Name> | ||
367 | + <Operations></Operations> | ||
368 | + <MultipleInstances>Multiple</MultipleInstances> | ||
369 | + <Mandatory>Optional</Mandatory> | ||
370 | + <Type>Objlnk</Type> | ||
371 | + <RangeEnumeration></RangeEnumeration> | ||
372 | + <Units></Units> | ||
373 | + <Description><![CDATA[If this resource is defined, it provides a links to LwM2M COSE Object Instances, which contain security-relevant configuration information for use with COSE.]]></Description> | ||
374 | + </Item> | ||
375 | + <Item ID="28"><Name>RDS Destination Port</Name> | ||
376 | + <Operations></Operations> | ||
377 | + <MultipleInstances>Single</MultipleInstances> | ||
378 | + <Mandatory>Optional</Mandatory> | ||
379 | + <Type>Integer</Type> | ||
380 | + <RangeEnumeration>0..15</RangeEnumeration> | ||
381 | + <Units></Units> | ||
382 | + <Description><![CDATA[This resource provides the default RDS Destination Port Number (as defined in 3GPP TS 24.250) to use for contacting the LwM2M or Bootstrap Server when communicating through the SCEF across the Non-IP binding.]]></Description> | ||
383 | + </Item> | ||
384 | + <Item ID="29"><Name>RDS Source Port</Name> | ||
385 | + <Operations></Operations> | ||
386 | + <MultipleInstances>Single</MultipleInstances> | ||
387 | + <Mandatory>Optional</Mandatory> | ||
388 | + <Type>Integer</Type> | ||
389 | + <RangeEnumeration>0..15</RangeEnumeration> | ||
390 | + <Units></Units> | ||
391 | + <Description><![CDATA[This resource provides the default RDS Source Port Number (as defined in 3GPP TS 24.250) to use for contacting the LwM2M or Bootstrap Server when communicating through the SCEF across the Non-IP binding.]]></Description> | ||
392 | + </Item> | ||
393 | + <Item ID="30"><Name>RDS Application ID</Name> | ||
394 | + <Operations></Operations> | ||
395 | + <MultipleInstances>Single</MultipleInstances> | ||
396 | + <Mandatory>Optional</Mandatory> | ||
397 | + <Type>String</Type> | ||
398 | + <RangeEnumeration></RangeEnumeration> | ||
399 | + <Units></Units> | ||
400 | + <Description><![CDATA[This resource provides the Application ID (as defined in 3GPP TS 24.250) to use for querying the SCEF for the source and destination port numbers for contacting the LwM2M or Bootstrap Server when communicating through the SCEF across the Non-IP binding.]]></Description> | ||
401 | + </Item> | ||
402 | + </Resources> | ||
403 | + <Description2><![CDATA[]]></Description2> | ||
404 | + </Object> | ||
405 | +</LWM2M> |
application/src/test/resources/lwm2m/1.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | + | ||
3 | +<!-- | ||
4 | +FILE INFORMATION | ||
5 | + | ||
6 | +OMA Permanent Document | ||
7 | + File: OMA-SUP-XML_1-V1_2-20201110-A.xml | ||
8 | + Path: http://www.openmobilealliance.org/release/ObjLwM2M_Server/ | ||
9 | + | ||
10 | +OMNA LwM2M Registry | ||
11 | + Path: https://github.com/OpenMobileAlliance/lwm2m-registry | ||
12 | + Name: 1.xml | ||
13 | + | ||
14 | +NORMATIVE INFORMATION | ||
15 | + | ||
16 | + Information about this file can be found in the latest revision of | ||
17 | + | ||
18 | + OMA-TS-LightweightM2M_Core-V1_2 | ||
19 | + | ||
20 | + This is available at http://www.openmobilealliance.org/release/LightweightM2M/ | ||
21 | + | ||
22 | + Send comments to https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues | ||
23 | + | ||
24 | +LEGAL DISCLAIMER | ||
25 | + | ||
26 | + Copyright 2020 Open Mobile Alliance. | ||
27 | + | ||
28 | + Redistribution and use in source and binary forms, with or without | ||
29 | + modification, are permitted provided that the following conditions | ||
30 | + are met: | ||
31 | + | ||
32 | + 1. Redistributions of source code must retain the above copyright | ||
33 | + notice, this list of conditions and the following disclaimer. | ||
34 | + 2. Redistributions in binary form must reproduce the above copyright | ||
35 | + notice, this list of conditions and the following disclaimer in the | ||
36 | + documentation and/or other materials provided with the distribution. | ||
37 | + 3. Neither the name of the copyright holder nor the names of its | ||
38 | + contributors may be used to endorse or promote products derived | ||
39 | + from this software without specific prior written permission. | ||
40 | + | ||
41 | + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
42 | + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
43 | + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
44 | + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
45 | + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
46 | + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
47 | + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
49 | + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
50 | + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
51 | + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
52 | + POSSIBILITY OF SUCH DAMAGE. | ||
53 | + | ||
54 | + The above license is used as a license under copyright only. Please | ||
55 | + reference the OMA IPR Policy for patent licensing terms: | ||
56 | + https://www.omaspecworks.org/about/intellectual-property-rights/ | ||
57 | + | ||
58 | +--> | ||
59 | + | ||
60 | +<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd"> | ||
61 | + <Object ObjectType="MODefinition"> | ||
62 | + <Name>LwM2M Server</Name> | ||
63 | + <Description1><![CDATA[This LwM2M Objects provides the data related to a LwM2M Server. A Bootstrap-Server has no such an Object Instance associated to it.]]></Description1> | ||
64 | + <ObjectID>1</ObjectID> | ||
65 | + <ObjectURN>urn:oma:lwm2m:oma:1:1.2</ObjectURN> | ||
66 | + <LWM2MVersion>1.2</LWM2MVersion> | ||
67 | + <ObjectVersion>1.2</ObjectVersion> | ||
68 | + <MultipleInstances>Multiple</MultipleInstances> | ||
69 | + <Mandatory>Mandatory</Mandatory> | ||
70 | + <Resources> | ||
71 | + <Item ID="0"> | ||
72 | + <Name>Short Server ID</Name> | ||
73 | + <Operations>R</Operations> | ||
74 | + <MultipleInstances>Single</MultipleInstances> | ||
75 | + <Mandatory>Mandatory</Mandatory> | ||
76 | + <Type>Integer</Type> | ||
77 | + <RangeEnumeration>1..65534</RangeEnumeration> | ||
78 | + <Units></Units> | ||
79 | + <Description><![CDATA[Used as link to associate server Object Instance.]]></Description> | ||
80 | + </Item> | ||
81 | + <Item ID="1"> | ||
82 | + <Name>Lifetime</Name> | ||
83 | + <Operations>RW</Operations> | ||
84 | + <MultipleInstances>Single</MultipleInstances> | ||
85 | + <Mandatory>Mandatory</Mandatory> | ||
86 | + <Type>Integer</Type> | ||
87 | + <RangeEnumeration></RangeEnumeration> | ||
88 | + <Units>s</Units> | ||
89 | + <Description><![CDATA[Specify the lifetime of the registration in seconds (see Client Registration Interface). If the value is set to 0, the lifetime is infinite.]]></Description> | ||
90 | + </Item> | ||
91 | + <Item ID="2"> | ||
92 | + <Name>Default Minimum Period</Name> | ||
93 | + <Operations>RW</Operations> | ||
94 | + <MultipleInstances>Single</MultipleInstances> | ||
95 | + <Mandatory>Optional</Mandatory> | ||
96 | + <Type>Integer</Type> | ||
97 | + <RangeEnumeration></RangeEnumeration> | ||
98 | + <Units>s</Units> | ||
99 | + <Description><![CDATA[The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. | ||
100 | +If this Resource doesn’t exist, the default value is 0.]]></Description> | ||
101 | + </Item> | ||
102 | + <Item ID="3"> | ||
103 | + <Name>Default Maximum Period</Name> | ||
104 | + <Operations>RW</Operations> | ||
105 | + <MultipleInstances>Single</MultipleInstances> | ||
106 | + <Mandatory>Optional</Mandatory> | ||
107 | + <Type>Integer</Type> | ||
108 | + <RangeEnumeration></RangeEnumeration> | ||
109 | + <Units>s</Units> | ||
110 | + <Description><![CDATA[The default value the LwM2M Client should use for the Maximum Period of an Observation in the absence of this parameter being included in an Observation.]]></Description> | ||
111 | + </Item> | ||
112 | + <Item ID="4"> | ||
113 | + <Name>Disable</Name> | ||
114 | + <Operations>E</Operations> | ||
115 | + <MultipleInstances>Single</MultipleInstances> | ||
116 | + <Mandatory>Optional</Mandatory> | ||
117 | + <Type></Type> | ||
118 | + <RangeEnumeration></RangeEnumeration> | ||
119 | + <Units></Units> | ||
120 | + <Description><![CDATA[If this Resource is executed, this LwM2M Server Object is disabled for a certain period defined in the Disabled Timeout Resource. After receiving "Execute" operation, LwM2M Client MUST send response of the operation and perform de-registration process, and underlying network connection between the Client and Server MUST be disconnected to disable the LwM2M Server account. | ||
121 | +After the above process, the LwM2M Client MUST NOT send any message to the Server and ignore all the messages from the LwM2M Server for the period.]]></Description> | ||
122 | + </Item> | ||
123 | + <Item ID="5"> | ||
124 | + <Name>Disable Timeout</Name> | ||
125 | + <Operations>RW</Operations> | ||
126 | + <MultipleInstances>Single</MultipleInstances> | ||
127 | + <Mandatory>Optional</Mandatory> | ||
128 | + <Type>Integer</Type> | ||
129 | + <RangeEnumeration></RangeEnumeration> | ||
130 | + <Units>s</Units> | ||
131 | + <Description><![CDATA[A period to disable the Server. After this period, the LwM2M Client MUST perform registration process to the Server. If this Resource is not set, a default timeout value is 86400 (1 day).]]></Description> | ||
132 | + </Item> | ||
133 | + <Item ID="6"> | ||
134 | + <Name>Notification Storing When Disabled or Offline</Name> | ||
135 | + <Operations>RW</Operations> | ||
136 | + <MultipleInstances>Single</MultipleInstances> | ||
137 | + <Mandatory>Mandatory</Mandatory> | ||
138 | + <Type>Boolean</Type> | ||
139 | + <RangeEnumeration></RangeEnumeration> | ||
140 | + <Units></Units> | ||
141 | + <Description><![CDATA[If true, the LwM2M Client stores "Notify" operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored "Notify" operations to the Server. | ||
142 | +If false, the LwM2M Client discards all the "Notify" operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. | ||
143 | +The default value is true. | ||
144 | +The maximum number of storing Notifications per Server is up to the implementation.]]></Description> | ||
145 | + </Item> | ||
146 | + <Item ID="7"> | ||
147 | + <Name>Binding</Name> | ||
148 | + <Operations>RW</Operations> | ||
149 | + <MultipleInstances>Single</MultipleInstances> | ||
150 | + <Mandatory>Mandatory</Mandatory> | ||
151 | + <Type>String</Type> | ||
152 | + <RangeEnumeration></RangeEnumeration> | ||
153 | + <Units></Units> | ||
154 | + <Description><![CDATA[The possible values are those listed in the LwM2M Core Specification. This Resource defines the transport binding configured for the LwM2M Client. | ||
155 | +If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode.]]></Description> | ||
156 | + </Item> | ||
157 | + <Item ID="8"> | ||
158 | + <Name>Registration Update Trigger</Name> | ||
159 | + <Operations>E</Operations> | ||
160 | + <MultipleInstances>Single</MultipleInstances> | ||
161 | + <Mandatory>Mandatory</Mandatory> | ||
162 | + <Type></Type> | ||
163 | + <RangeEnumeration></RangeEnumeration> | ||
164 | + <Units></Units> | ||
165 | + <Description><![CDATA[If this Resource is executed the LwM2M Client MUST perform an "Update" operation with this LwM2M Server. The LwM2M Client can use a transport binding supported in the Current Binding Mode, Preferred Transport resource or the transport specified as an argument in the Registration Update Trigger.]]></Description> | ||
166 | + </Item> | ||
167 | + <Item ID="9"> | ||
168 | + <Name>Bootstrap-Request Trigger</Name> | ||
169 | + <Operations>E</Operations> | ||
170 | + <MultipleInstances>Single</MultipleInstances> | ||
171 | + <Mandatory>Optional</Mandatory> | ||
172 | + <Type></Type> | ||
173 | + <RangeEnumeration></RangeEnumeration> | ||
174 | + <Units></Units> | ||
175 | + <Description><![CDATA[When this Resource is executed the LwM2M Client MUST initiate a "Client Initiated Bootstrap" procedure in using the LwM2M Bootstrap-Server Account.]]></Description> | ||
176 | + </Item> | ||
177 | + <Item ID="10"> | ||
178 | + <Name>APN Link</Name> | ||
179 | + <Operations>RW</Operations> | ||
180 | + <MultipleInstances>Single</MultipleInstances> | ||
181 | + <Mandatory>Optional</Mandatory> | ||
182 | + <Type>Objlnk</Type> | ||
183 | + <RangeEnumeration></RangeEnumeration> | ||
184 | + <Units></Units> | ||
185 | + <Description><![CDATA[If this resource is defined, it provides a link to the APN connection profile Object Instance (OMNA registered Object ID:11) to be used to communicate with this server.]]></Description> | ||
186 | + </Item> | ||
187 | + <Item ID="11"> | ||
188 | + <Name>TLS-DTLS Alert Code</Name> | ||
189 | + <Operations>R</Operations> | ||
190 | + <MultipleInstances>Single</MultipleInstances> | ||
191 | + <Mandatory>Optional</Mandatory> | ||
192 | + <Type>Integer</Type> | ||
193 | + <RangeEnumeration>0..255</RangeEnumeration> | ||
194 | + <Units></Units> | ||
195 | + <Description><![CDATA[If this resource is defined, it contains the most recent TLS / DTLS alert message received from the LwM2M Server respective represented by the AlertDescription defined in Section 7.2 of RFC 5246. This resource set by the LwM2M Client may help the LwM2M Bootstrap-Server to determine the cause of TLS/DTLS connection failure with the respective LwM2M Server.]]></Description> | ||
196 | + </Item> | ||
197 | + <Item ID="12"> | ||
198 | + <Name>Last Bootstrapped</Name> | ||
199 | + <Operations>R</Operations> | ||
200 | + <MultipleInstances>Single</MultipleInstances> | ||
201 | + <Mandatory>Optional</Mandatory> | ||
202 | + <Type>Time</Type> | ||
203 | + <RangeEnumeration></RangeEnumeration> | ||
204 | + <Units></Units> | ||
205 | + <Description><![CDATA[If this resource is defined, it represents the last time that the bootstrap server updated this LwM2M Server Account. The LwM2M Client is responsible for updating this value. When the Bootstrap Server detects that this LwM2M Server Account is "out-of-date", the Bootstrap Server can update the LwM2M Server Account as represented by the LwM2M Server object instance.]]></Description> | ||
206 | + </Item> | ||
207 | + <Item ID="13"> | ||
208 | + <Name>Registration Priority Order</Name> | ||
209 | + <Operations>R</Operations> | ||
210 | + <MultipleInstances>Single</MultipleInstances> | ||
211 | + <Mandatory>Optional</Mandatory> | ||
212 | + <Type>Integer</Type> | ||
213 | + <RangeEnumeration></RangeEnumeration> | ||
214 | + <Units></Units> | ||
215 | + <Description><![CDATA[The LwM2M Client sequences the LwM2M Server registrations in increasing order of this value. If this value is not defined, registration attempts to this server are not impacted by other server registrations.]]></Description> | ||
216 | + </Item> | ||
217 | + <Item ID="14"> | ||
218 | + <Name>Initial Registration Delay Timer</Name> | ||
219 | + <Operations>RW</Operations> | ||
220 | + <MultipleInstances>Single</MultipleInstances> | ||
221 | + <Mandatory>Optional</Mandatory> | ||
222 | + <Type>Integer</Type> | ||
223 | + <RangeEnumeration></RangeEnumeration> | ||
224 | + <Units>s</Units> | ||
225 | + <Description><![CDATA[The delay, in seconds, before registration is attempted for this LwM2M Server based upon the completion of registration of the previous LwM2M Server in the registration order. This is only applied until the first successful registration after a successful bootstrapping sequence.]]></Description> | ||
226 | + </Item> | ||
227 | + <Item ID="15"> | ||
228 | + <Name>Registration Failure Block</Name> | ||
229 | + <Operations>R</Operations> | ||
230 | + <MultipleInstances>Single</MultipleInstances> | ||
231 | + <Mandatory>Optional</Mandatory> | ||
232 | + <Type>Boolean</Type> | ||
233 | + <RangeEnumeration></RangeEnumeration> | ||
234 | + <Units></Units> | ||
235 | + <Description><![CDATA[When set to true and registration to this LwM2M server fails, the LwM2M Client blocks registration to other servers in the order. When set to false, the LwM2M Client proceeds with registration to the next server in the order.]]></Description> | ||
236 | + </Item> | ||
237 | + <Item ID="16"> | ||
238 | + <Name>Bootstrap on Registration Failure</Name> | ||
239 | + <Operations>R</Operations> | ||
240 | + <MultipleInstances>Single</MultipleInstances> | ||
241 | + <Mandatory>Optional</Mandatory> | ||
242 | + <Type>Boolean</Type> | ||
243 | + <RangeEnumeration></RangeEnumeration> | ||
244 | + <Units></Units> | ||
245 | + <Description><![CDATA[If set to true, this indicates that the LwM2M Client should re-bootstrap when either registration is explicitly rejected by the LwM2M Server or registration is considered as failing as dictated by the other resource settings. If set to false, the LwM2M Client will continue with the registration attempts as dictated by the other resource settings.]]></Description> | ||
246 | + </Item> | ||
247 | + <Item ID="17"> | ||
248 | + <Name>Communication Retry Count</Name> | ||
249 | + <Operations>RW</Operations> | ||
250 | + <MultipleInstances>Single</MultipleInstances> | ||
251 | + <Mandatory>Optional</Mandatory> | ||
252 | + <Type>Integer</Type> | ||
253 | + <RangeEnumeration></RangeEnumeration> | ||
254 | + <Units></Units> | ||
255 | + <Description><![CDATA[The number of successive communication attempts before which a communication sequence is considered as failed.]]></Description> | ||
256 | + </Item> | ||
257 | + <Item ID="18"> | ||
258 | + <Name>Communication Retry Timer</Name> | ||
259 | + <Operations>RW</Operations> | ||
260 | + <MultipleInstances>Single</MultipleInstances> | ||
261 | + <Mandatory>Optional</Mandatory> | ||
262 | + <Type>Integer</Type> | ||
263 | + <RangeEnumeration></RangeEnumeration> | ||
264 | + <Units>s</Units> | ||
265 | + <Description><![CDATA[The delay, in seconds, between successive communication attempts in a communication sequence. This value is multiplied by two to the power of the communication retry attempt minus one (2**(retry attempt-1)) to create an exponential back-off.]]></Description> | ||
266 | + </Item> | ||
267 | + <Item ID="19"> | ||
268 | + <Name>Communication Sequence Delay Timer</Name> | ||
269 | + <Operations>RW</Operations> | ||
270 | + <MultipleInstances>Single</MultipleInstances> | ||
271 | + <Mandatory>Optional</Mandatory> | ||
272 | + <Type>Integer</Type> | ||
273 | + <RangeEnumeration></RangeEnumeration> | ||
274 | + <Units>s</Units> | ||
275 | + <Description><![CDATA[The delay, in seconds, between successive communication sequences. A communication sequence is defined as the exhaustion of the Communication Retry Count and Communication Retry Timer values. A communication sequence can be applied to server registrations or bootstrapping attempts. MAX_VALUE means do not perform another communication sequence.]]></Description> | ||
276 | + </Item> | ||
277 | + <Item ID="20"> | ||
278 | + <Name>Communication Sequence Retry Count</Name> | ||
279 | + <Operations>RW</Operations> | ||
280 | + <MultipleInstances>Single</MultipleInstances> | ||
281 | + <Mandatory>Optional</Mandatory> | ||
282 | + <Type>Integer</Type> | ||
283 | + <RangeEnumeration></RangeEnumeration> | ||
284 | + <Units></Units> | ||
285 | + <Description><![CDATA[The number of successive communication sequences before which a registration attempt is considered as failed.]]></Description> | ||
286 | + </Item> | ||
287 | + <Item ID="21"> | ||
288 | + <Name>Trigger</Name> | ||
289 | + <Operations>RW</Operations> | ||
290 | + <MultipleInstances>Single</MultipleInstances> | ||
291 | + <Mandatory>Optional</Mandatory> | ||
292 | + <Type>Boolean</Type> | ||
293 | + <RangeEnumeration></RangeEnumeration> | ||
294 | + <Units></Units> | ||
295 | + <Description><![CDATA[Using the Trigger Resource a LwM2M Client can indicate whether it is reachable over SMS (value set to 'true') or not (value set to 'false'). The default value (resource not present) is 'false'. When set to 'true' the LwM2M Server MAY, for example, request the LwM2M Client to perform operations, such as the "Update" operation by sending an "Execute" operation on "Registration Update Trigger" Resource via SMS. No SMS response is expected for such a message.]]></Description> | ||
296 | + </Item> | ||
297 | + <Item ID="22"> | ||
298 | + <Name>Preferred Transport</Name> | ||
299 | + <Operations>RW</Operations> | ||
300 | + <MultipleInstances>Single</MultipleInstances> | ||
301 | + <Mandatory>Optional</Mandatory> | ||
302 | + <Type>String</Type> | ||
303 | + <RangeEnumeration>The possible values are those listed in the LwM2M Core Specification</RangeEnumeration> | ||
304 | + <Units></Units> | ||
305 | + <Description><![CDATA[Only a single transport binding SHALL be present. When the LwM2M client supports multiple transports, it MAY use this transport to initiate a connection. This resource can also be used to switch between multiple transports e.g. a non-IP device can switch to UDP transport to perform firmware updates.]]></Description> | ||
306 | + </Item> | ||
307 | + <Item ID="23"><Name>Mute Send</Name> | ||
308 | + <Operations>RW</Operations> | ||
309 | + <MultipleInstances>Single</MultipleInstances> | ||
310 | + <Mandatory>Optional</Mandatory> | ||
311 | + <Type>Boolean</Type> | ||
312 | + <RangeEnumeration></RangeEnumeration> | ||
313 | + <Units></Units> | ||
314 | + <Description><![CDATA[If true or the Resource is not present, the LwM2M Client Send command capability is de-activated. | ||
315 | +If false, the LwM2M Client Send Command capability is activated.]]></Description> | ||
316 | + </Item> | ||
317 | + <Item ID="24"> | ||
318 | + <Name>Alternate APN Links</Name> | ||
319 | + <Operations>RW</Operations> | ||
320 | + <MultipleInstances>Multiple</MultipleInstances> | ||
321 | + <Mandatory>Optional</Mandatory> | ||
322 | + <Type>Objlnk</Type> | ||
323 | + <RangeEnumeration></RangeEnumeration> | ||
324 | + <Units></Units> | ||
325 | + <Description><![CDATA[If this resource is defined, it provides links to alternate APN connection profile Object Instance (OMNA registered Object ID:11) to be used to communicate with this server if Resource 10 has configuration conflicts.]]></Description> | ||
326 | + </Item> | ||
327 | + <Item ID="25"> | ||
328 | + <Name>Supported Server Versions</Name> | ||
329 | + <Operations>RW</Operations> | ||
330 | + <MultipleInstances>Multiple</MultipleInstances> | ||
331 | + <Mandatory>Optional</Mandatory> | ||
332 | + <Type>String</Type> | ||
333 | + <RangeEnumeration></RangeEnumeration> | ||
334 | + <Units></Units> | ||
335 | + <Description><![CDATA[This resource provides the supported enabler versions of the server to the client as a set of strings. Format for each string is 1*DIGIT"."1*DIGIT"."1*DIGIT where the third DIGIT is optional.]]></Description> | ||
336 | + </Item> | ||
337 | + <Item ID="26"> | ||
338 | + <Name>Default Notification Mode</Name> | ||
339 | + <Operations>RW</Operations> | ||
340 | + <MultipleInstances>Single</MultipleInstances> | ||
341 | + <Mandatory>Optional</Mandatory> | ||
342 | + <Type>Integer</Type> | ||
343 | + <RangeEnumeration>0..1</RangeEnumeration> | ||
344 | + <Units></Units> | ||
345 | + <Description><![CDATA[This resource indicates the default mode for observations to be sent: 0 = Non-Confirmable, 1 = Confirmable.]]></Description> | ||
346 | + </Item> | ||
347 | + <Item ID="27"> | ||
348 | + <Name>Profile ID Hash Algorithm</Name> | ||
349 | + <Operations>RW</Operations> | ||
350 | + <MultipleInstances>Single</MultipleInstances> | ||
351 | + <Mandatory>Optional</Mandatory> | ||
352 | + <Type>Integer</Type> | ||
353 | + <RangeEnumeration>0..255</RangeEnumeration> | ||
354 | + <Units/> | ||
355 | + <Description><![CDATA[If this resource is defined, it contains the hash algorithm the LwM2M Server would prefer the LwM2M Client to use with the dynamically generated mode of creating Profile IDs. The numerical ID value of the 'Suite Identifiers' registered by RFC 6920 is used in this Resource.]]></Description> | ||
356 | + </Item> | ||
357 | + </Resources> | ||
358 | + <Description2></Description2> | ||
359 | + </Object> | ||
360 | +</LWM2M> |
application/src/test/resources/lwm2m/2.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | + | ||
3 | +<!-- | ||
4 | +FILE INFORMATION | ||
5 | + | ||
6 | +OMA Permanent Document | ||
7 | + File: OMA-SUP-XML_2-V1_1-20201110-A.xml | ||
8 | + Path: http://www.openmobilealliance.org/release/ObjLwM2M_ACL/ | ||
9 | + | ||
10 | +OMNA LwM2M Registry | ||
11 | + Path: https://github.com/OpenMobileAlliance/lwm2m-registry | ||
12 | + Name: 2.xml | ||
13 | + | ||
14 | +NORMATIVE INFORMATION | ||
15 | + | ||
16 | + Information about this file can be found in the latest revision of | ||
17 | + | ||
18 | + OMA-TS-LightweightM2M_Core-V1_2 | ||
19 | + | ||
20 | + This is available at http://www.openmobilealliance.org/release/LightweightM2M/ | ||
21 | + | ||
22 | + Send comments to https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues | ||
23 | + | ||
24 | +LEGAL DISCLAIMER | ||
25 | + | ||
26 | + Copyright 2020 Open Mobile Alliance. | ||
27 | + | ||
28 | + Redistribution and use in source and binary forms, with or without | ||
29 | + modification, are permitted provided that the following conditions | ||
30 | + are met: | ||
31 | + | ||
32 | + 1. Redistributions of source code must retain the above copyright | ||
33 | + notice, this list of conditions and the following disclaimer. | ||
34 | + 2. Redistributions in binary form must reproduce the above copyright | ||
35 | + notice, this list of conditions and the following disclaimer in the | ||
36 | + documentation and/or other materials provided with the distribution. | ||
37 | + 3. Neither the name of the copyright holder nor the names of its | ||
38 | + contributors may be used to endorse or promote products derived | ||
39 | + from this software without specific prior written permission. | ||
40 | + | ||
41 | + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
42 | + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
43 | + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
44 | + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
45 | + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
46 | + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
47 | + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
49 | + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
50 | + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
51 | + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
52 | + POSSIBILITY OF SUCH DAMAGE. | ||
53 | + | ||
54 | + The above license is used as a license under copyright only. Please | ||
55 | + reference the OMA IPR Policy for patent licensing terms: | ||
56 | + https://www.omaspecworks.org/about/intellectual-property-rights/ | ||
57 | +--> | ||
58 | + | ||
59 | +<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.openmobilealliance.org/tech/profiles/LWM2M.xsd"> | ||
60 | + <Object ObjectType="MODefinition"> | ||
61 | + <Name>LwM2M Access Control</Name> | ||
62 | + <Description1><![CDATA[Access Control Object is used to check whether the LwM2M Server has access right for performing an operation.]]></Description1> | ||
63 | + <ObjectID>2</ObjectID> | ||
64 | + <ObjectURN>urn:oma:lwm2m:oma:2:1.1</ObjectURN> | ||
65 | + <LWM2MVersion>1.0</LWM2MVersion> | ||
66 | + <ObjectVersion>1.1</ObjectVersion> | ||
67 | + <MultipleInstances>Multiple</MultipleInstances> | ||
68 | + <Mandatory>Optional</Mandatory> | ||
69 | + <Resources> | ||
70 | + <Item ID="0"> | ||
71 | + <Name>Object ID</Name> | ||
72 | + <Operations>R</Operations> | ||
73 | + <MultipleInstances>Single</MultipleInstances> | ||
74 | + <Mandatory>Mandatory</Mandatory> | ||
75 | + <Type>Integer</Type> | ||
76 | + <RangeEnumeration>1..65534</RangeEnumeration> | ||
77 | + <Units></Units> | ||
78 | + <Description><![CDATA[Resources 0 and 1 point to the Object Instance for which the Instances of the ACL Resource of that Access Control Object Instance are applicable.]]></Description> | ||
79 | + </Item> | ||
80 | + <Item ID="1"> | ||
81 | + <Name>Object Instance ID</Name> | ||
82 | + <Operations>R</Operations> | ||
83 | + <MultipleInstances>Single</MultipleInstances> | ||
84 | + <Mandatory>Mandatory</Mandatory> | ||
85 | + <Type>Integer</Type> | ||
86 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
87 | + <Units></Units> | ||
88 | + <Description><![CDATA[See above]]></Description> | ||
89 | + </Item> | ||
90 | + <Item ID="2"> | ||
91 | + <Name>ACL</Name> | ||
92 | + <Operations>RW</Operations> | ||
93 | + <MultipleInstances>Multiple</MultipleInstances> | ||
94 | + <Mandatory>Optional</Mandatory> | ||
95 | + <Type>Integer</Type> | ||
96 | + <RangeEnumeration>0..31</RangeEnumeration> | ||
97 | + <Units></Units> | ||
98 | + <Description><![CDATA[The Resource Instance ID MUST be the Short Server ID of a certain LwM2M Server for which associated access rights are contained in the Resource Instance value. | ||
99 | +The Resource Instance ID 0 is a specific ID, determining the ACL Instance which contains the default access rights. | ||
100 | +Each bit set in the Resource Instance value, grants an access right to the LwM2M Server to the corresponding operation. | ||
101 | +The bit order is specified as below. | ||
102 | +1st LSB: R(Read, Observe, Write-Attributes) | ||
103 | +2nd LSB: W(Write) | ||
104 | +3rd LSB: E(Execute) | ||
105 | +4th LSB: D(Delete) | ||
106 | +5th LSB: C(Create) | ||
107 | +Other bits are reserved for future use.]]></Description> | ||
108 | + </Item> | ||
109 | + <Item ID="3"> | ||
110 | + <Name>Access Control Owner</Name> | ||
111 | + <Operations>RW</Operations> | ||
112 | + <MultipleInstances>Single</MultipleInstances> | ||
113 | + <Mandatory>Mandatory</Mandatory> | ||
114 | + <Type>Integer</Type> | ||
115 | + <RangeEnumeration>0..65535</RangeEnumeration> | ||
116 | + <Units></Units> | ||
117 | + <Description><![CDATA[Short Server ID of a certain LwM2M Server; only such an LwM2M Server can manage the Resources of this Object Instance. | ||
118 | +The specific value MAX_ID=65535 means this Access Control Object Instance is created and modified during a Bootstrap phase only.]]></Description> | ||
119 | + </Item> | ||
120 | + </Resources> | ||
121 | + <Description2><![CDATA[]]></Description2> | ||
122 | + </Object> | ||
123 | +</LWM2M> |
application/src/test/resources/lwm2m/3.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | + | ||
3 | +<!-- | ||
4 | +FILE INFORMATION | ||
5 | + | ||
6 | +OMA Permanent Document | ||
7 | + File: OMA-SUP-XML_3-V1_2-20201110-A.xml | ||
8 | + Path: http://www.openmobilealliance.org/release/ObjLwM2M_Device/ | ||
9 | + | ||
10 | +OMNA LwM2M Registry | ||
11 | + Path: https://github.com/OpenMobileAlliance/lwm2m-registry | ||
12 | + Name: 3.xml | ||
13 | + | ||
14 | +NORMATIVE INFORMATION | ||
15 | + | ||
16 | + Information about this file can be found in the latest revision of | ||
17 | + | ||
18 | + OMA-TS-LightweightM2M_Core-V1_2 | ||
19 | + | ||
20 | + This is available at http://www.openmobilealliance.org/release/LightweightM2M/ | ||
21 | + | ||
22 | + Send comments to https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues | ||
23 | + | ||
24 | +LEGAL DISCLAIMER | ||
25 | + | ||
26 | + Copyright 2020 Open Mobile Alliance. | ||
27 | + | ||
28 | + Redistribution and use in source and binary forms, with or without | ||
29 | + modification, are permitted provided that the following conditions | ||
30 | + are met: | ||
31 | + | ||
32 | + 1. Redistributions of source code must retain the above copyright | ||
33 | + notice, this list of conditions and the following disclaimer. | ||
34 | + 2. Redistributions in binary form must reproduce the above copyright | ||
35 | + notice, this list of conditions and the following disclaimer in the | ||
36 | + documentation and/or other materials provided with the distribution. | ||
37 | + 3. Neither the name of the copyright holder nor the names of its | ||
38 | + contributors may be used to endorse or promote products derived | ||
39 | + from this software without specific prior written permission. | ||
40 | + | ||
41 | + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
42 | + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
43 | + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
44 | + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
45 | + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
46 | + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
47 | + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
49 | + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
50 | + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
51 | + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
52 | + POSSIBILITY OF SUCH DAMAGE. | ||
53 | + | ||
54 | + The above license is used as a license under copyright only. Please | ||
55 | + reference the OMA IPR Policy for patent licensing terms: | ||
56 | + https://www.omaspecworks.org/about/intellectual-property-rights/ | ||
57 | + | ||
58 | +--> | ||
59 | + | ||
60 | +<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd"> | ||
61 | + <Object ObjectType="MODefinition"> | ||
62 | + <Name>Device</Name> | ||
63 | + <Description1><![CDATA[This LwM2M Object provides a range of device related information which can be queried by the LwM2M Server, and a device reboot and factory reset function.]]></Description1> | ||
64 | + <ObjectID>3</ObjectID> | ||
65 | + <ObjectURN>urn:oma:lwm2m:oma:3:1.0</ObjectURN> | ||
66 | + <LWM2MVersion>1.1</LWM2MVersion> | ||
67 | + <ObjectVersion>1.0</ObjectVersion> | ||
68 | + <MultipleInstances>Single</MultipleInstances> | ||
69 | + <Mandatory>Mandatory</Mandatory> | ||
70 | + <Resources> | ||
71 | + <Item ID="0"> | ||
72 | + <Name>Manufacturer</Name> | ||
73 | + <Operations>R</Operations> | ||
74 | + <MultipleInstances>Single</MultipleInstances> | ||
75 | + <Mandatory>Optional</Mandatory> | ||
76 | + <Type>String</Type> | ||
77 | + <RangeEnumeration></RangeEnumeration> | ||
78 | + <Units></Units> | ||
79 | + <Description><![CDATA[Human readable manufacturer name]]></Description> | ||
80 | + </Item> | ||
81 | + <Item ID="1"> | ||
82 | + <Name>Model Number</Name> | ||
83 | + <Operations>R</Operations> | ||
84 | + <MultipleInstances>Single</MultipleInstances> | ||
85 | + <Mandatory>Optional</Mandatory> | ||
86 | + <Type>String</Type> | ||
87 | + <RangeEnumeration></RangeEnumeration> | ||
88 | + <Units></Units> | ||
89 | + <Description><![CDATA[A model identifier (manufacturer specified string)]]></Description> | ||
90 | + </Item> | ||
91 | + <Item ID="2"> | ||
92 | + <Name>Serial Number</Name> | ||
93 | + <Operations>R</Operations> | ||
94 | + <MultipleInstances>Single</MultipleInstances> | ||
95 | + <Mandatory>Optional</Mandatory> | ||
96 | + <Type>String</Type> | ||
97 | + <RangeEnumeration></RangeEnumeration> | ||
98 | + <Units></Units> | ||
99 | + <Description><![CDATA[Serial Number]]></Description> | ||
100 | + </Item> | ||
101 | + <Item ID="3"> | ||
102 | + <Name>Firmware Version</Name> | ||
103 | + <Operations>R</Operations> | ||
104 | + <MultipleInstances>Single</MultipleInstances> | ||
105 | + <Mandatory>Optional</Mandatory> | ||
106 | + <Type>String</Type> | ||
107 | + <RangeEnumeration></RangeEnumeration> | ||
108 | + <Units></Units> | ||
109 | + <Description><![CDATA[Current firmware version of the Device.The Firmware Management function could rely on this resource.]]></Description> | ||
110 | + </Item> | ||
111 | + <Item ID="4"> | ||
112 | + <Name>Reboot</Name> | ||
113 | + <Operations>E</Operations> | ||
114 | + <MultipleInstances>Single</MultipleInstances> | ||
115 | + <Mandatory>Mandatory</Mandatory> | ||
116 | + <Type></Type> | ||
117 | + <RangeEnumeration></RangeEnumeration> | ||
118 | + <Units></Units> | ||
119 | + <Description><![CDATA[Reboot the LwM2M Device to restore the Device from unexpected firmware failure.]]></Description> | ||
120 | + </Item> | ||
121 | + <Item ID="5"> | ||
122 | + <Name>Factory Reset</Name> | ||
123 | + <Operations>E</Operations> | ||
124 | + <MultipleInstances>Single</MultipleInstances> | ||
125 | + <Mandatory>Optional</Mandatory> | ||
126 | + <Type></Type> | ||
127 | + <RangeEnumeration></RangeEnumeration> | ||
128 | + <Units></Units> | ||
129 | + <Description><![CDATA[Perform factory reset of the LwM2M Device to make the LwM2M Device to go through initial deployment sequence where provisioning and bootstrap sequence is performed. This requires client ensuring post factory reset to have minimal information to allow it to carry out one of the bootstrap methods specified in section 5.2.3. | ||
130 | +When this Resource is executed, "De-register" operation MAY be sent to the LwM2M Server(s) before factory reset of the LwM2M Device.]]></Description> | ||
131 | + </Item> | ||
132 | + <Item ID="6"> | ||
133 | + <Name>Available Power Sources</Name> | ||
134 | + <Operations>R</Operations> | ||
135 | + <MultipleInstances>Multiple</MultipleInstances> | ||
136 | + <Mandatory>Optional</Mandatory> | ||
137 | + <Type>Integer</Type> | ||
138 | + <RangeEnumeration>0..7</RangeEnumeration> | ||
139 | + <Units></Units> | ||
140 | + <Description><![CDATA[0: DC power | ||
141 | +1: Internal Battery | ||
142 | +2: External Battery | ||
143 | +3: Fuel Cell | ||
144 | +4: Power over Ethernet | ||
145 | +5: USB | ||
146 | +6: AC (Mains) power | ||
147 | +7: Solar | ||
148 | +The same Resource Instance ID MUST be used to associate a given Power Source (Resource ID:6) with its Present Voltage (Resource ID:7) and its Present Current (Resource ID:8)]]></Description> | ||
149 | + </Item> | ||
150 | + <Item ID="7"> | ||
151 | + <Name>Power Source Voltage</Name> | ||
152 | + <Operations>R</Operations> | ||
153 | + <MultipleInstances>Multiple</MultipleInstances> | ||
154 | + <Mandatory>Optional</Mandatory> | ||
155 | + <Type>Integer</Type> | ||
156 | + <RangeEnumeration></RangeEnumeration> | ||
157 | + <Units></Units> | ||
158 | + <Description><![CDATA[Present voltage for each Available Power Sources Resource Instance. The unit used for this resource is in mV.]]></Description> | ||
159 | + </Item> | ||
160 | + <Item ID="8"> | ||
161 | + <Name>Power Source Current</Name> | ||
162 | + <Operations>R</Operations> | ||
163 | + <MultipleInstances>Multiple</MultipleInstances> | ||
164 | + <Mandatory>Optional</Mandatory> | ||
165 | + <Type>Integer</Type> | ||
166 | + <RangeEnumeration></RangeEnumeration> | ||
167 | + <Units></Units> | ||
168 | + <Description><![CDATA[Present current for each Available Power Source. The unit used for this resource is in mA.]]></Description> | ||
169 | + </Item> | ||
170 | + <Item ID="9"> | ||
171 | + <Name>Battery Level</Name> | ||
172 | + <Operations>R</Operations> | ||
173 | + <MultipleInstances>Single</MultipleInstances> | ||
174 | + <Mandatory>Optional</Mandatory> | ||
175 | + <Type>Integer</Type> | ||
176 | + <RangeEnumeration>0..100</RangeEnumeration> | ||
177 | + <Units>/100</Units> | ||
178 | + <Description><![CDATA[Contains the current battery level as a percentage (with a range from 0 to 100). This value is only valid for the Device internal Battery if present (one Available Power Sources Resource Instance is 1).]]></Description> | ||
179 | + </Item> | ||
180 | + <Item ID="10"> | ||
181 | + <Name>Memory Free</Name> | ||
182 | + <Operations>R</Operations> | ||
183 | + <MultipleInstances>Single</MultipleInstances> | ||
184 | + <Mandatory>Optional</Mandatory> | ||
185 | + <Type>Integer</Type> | ||
186 | + <RangeEnumeration></RangeEnumeration> | ||
187 | + <Units></Units> | ||
188 | + <Description><![CDATA[Estimated current available amount of storage space which can store data and software in the LwM2M Device (expressed in kilobytes). Note: 1 kilobyte corresponds to 1000 bytes.]]></Description> | ||
189 | + </Item> | ||
190 | + <Item ID="11"> | ||
191 | + <Name>Error Code</Name> | ||
192 | + <Operations>R</Operations> | ||
193 | + <MultipleInstances>Multiple</MultipleInstances> | ||
194 | + <Mandatory>Mandatory</Mandatory> | ||
195 | + <Type>Integer</Type> | ||
196 | + <RangeEnumeration>0..32</RangeEnumeration> | ||
197 | + <Units></Units> | ||
198 | + <Description><![CDATA[0=No error | ||
199 | +1=Low battery power | ||
200 | +2=External power supply off | ||
201 | +3=GPS module failure | ||
202 | +4=Low received signal strength | ||
203 | +5=Out of memory | ||
204 | +6=SMS failure | ||
205 | +7=IP connectivity failure | ||
206 | +8=Peripheral malfunction | ||
207 | +9..15=Reserved for future use | ||
208 | +16..32=Device specific error codes | ||
209 | + | ||
210 | +When the single Device Object Instance is initiated, there is only one error code Resource Instance whose value is equal to 0 that means no error. When the first error happens, the LwM2M Client changes error code Resource Instance to any non-zero value to indicate the error type. When any other error happens, a new error code Resource Instance is created. When an error associated with a Resource Instance is no longer present, that Resource Instance is deleted. When the single existing error is no longer present, the LwM2M Client returns to the original no error state where Instance 0 has value 0. | ||
211 | +This error code Resource MAY be observed by the LwM2M Server. How to deal with LwM2M Client’s error report depends on the policy of the LwM2M Server. Error codes in between 16 and 32 are specific to the Device and may have different meanings among implementations.]]></Description> | ||
212 | + </Item> | ||
213 | + <Item ID="12"> | ||
214 | + <Name>Reset Error Code</Name> | ||
215 | + <Operations>E</Operations> | ||
216 | + <MultipleInstances>Single</MultipleInstances> | ||
217 | + <Mandatory>Optional</Mandatory> | ||
218 | + <Type></Type> | ||
219 | + <RangeEnumeration></RangeEnumeration> | ||
220 | + <Units></Units> | ||
221 | + <Description><![CDATA[Delete all error code Resource Instances and create only one zero-value error code that implies no error, then re-evaluate all error conditions and update and create Resources Instances to capture all current error conditions.]]></Description> | ||
222 | + </Item> | ||
223 | + <Item ID="13"> | ||
224 | + <Name>Current Time</Name> | ||
225 | + <Operations>RW</Operations> | ||
226 | + <MultipleInstances>Single</MultipleInstances> | ||
227 | + <Mandatory>Optional</Mandatory> | ||
228 | + <Type>Time</Type> | ||
229 | + <RangeEnumeration></RangeEnumeration> | ||
230 | + <Units></Units> | ||
231 | + <Description><![CDATA[Current UNIX time of the LwM2M Client. | ||
232 | +The LwM2M Client should be responsible to increase this time value as every second elapses. | ||
233 | +The LwM2M Server is able to write this Resource to make the LwM2M Client synchronized with the LwM2M Server.]]></Description> | ||
234 | + </Item> | ||
235 | + <Item ID="14"> | ||
236 | + <Name>UTC Offset</Name> | ||
237 | + <Operations>RW</Operations> | ||
238 | + <MultipleInstances>Single</MultipleInstances> | ||
239 | + <Mandatory>Optional</Mandatory> | ||
240 | + <Type>String</Type> | ||
241 | + <RangeEnumeration></RangeEnumeration> | ||
242 | + <Units></Units> | ||
243 | + <Description><![CDATA[Indicates the UTC offset currently in effect for this LwM2M Device. UTC+X [ISO 8601].]]></Description> | ||
244 | + </Item> | ||
245 | + <Item ID="15"> | ||
246 | + <Name>Timezone</Name> | ||
247 | + <Operations>RW</Operations> | ||
248 | + <MultipleInstances>Single</MultipleInstances> | ||
249 | + <Mandatory>Optional</Mandatory> | ||
250 | + <Type>String</Type> | ||
251 | + <RangeEnumeration></RangeEnumeration> | ||
252 | + <Units></Units> | ||
253 | + <Description><![CDATA[Indicates in which time zone the LwM2M Device is located, in IANA Timezone (TZ) database format.]]></Description> | ||
254 | + </Item> | ||
255 | + <Item ID="16"> | ||
256 | + <Name>Supported Binding and Modes</Name> | ||
257 | + <Operations>R</Operations> | ||
258 | + <MultipleInstances>Single</MultipleInstances> | ||
259 | + <Mandatory>Mandatory</Mandatory> | ||
260 | + <Type>String</Type> | ||
261 | + <RangeEnumeration></RangeEnumeration> | ||
262 | + <Units></Units> | ||
263 | + <Description><![CDATA[Indicates which bindings and modes are supported in the LwM2M Client. The possible values are those listed in the LwM2M Core Specification.]]></Description> | ||
264 | + </Item> | ||
265 | + <Item ID="17"><Name>Device Type</Name> | ||
266 | + <Operations>R</Operations> | ||
267 | + <MultipleInstances>Single</MultipleInstances> | ||
268 | + <Mandatory>Optional</Mandatory> | ||
269 | + <Type>String</Type> | ||
270 | + <RangeEnumeration></RangeEnumeration> | ||
271 | + <Units></Units> | ||
272 | + <Description><![CDATA[Type of the device (manufacturer specified string: e.g. smart meters / dev Class / ...)]]></Description> | ||
273 | + </Item> | ||
274 | + <Item ID="18"><Name>Hardware Version</Name> | ||
275 | + <Operations>R</Operations> | ||
276 | + <MultipleInstances>Single</MultipleInstances> | ||
277 | + <Mandatory>Optional</Mandatory> | ||
278 | + <Type>String</Type> | ||
279 | + <RangeEnumeration></RangeEnumeration> | ||
280 | + <Units></Units> | ||
281 | + <Description><![CDATA[Current hardware version of the device]]></Description> | ||
282 | + </Item> | ||
283 | + <Item ID="19"><Name>Software Version</Name> | ||
284 | + <Operations>R</Operations> | ||
285 | + <MultipleInstances>Single</MultipleInstances> | ||
286 | + <Mandatory>Optional</Mandatory> | ||
287 | + <Type>String</Type> | ||
288 | + <RangeEnumeration></RangeEnumeration> | ||
289 | + <Units></Units> | ||
290 | + <Description><![CDATA[Current software version of the device (manufacturer specified string). On elaborated LwM2M device, SW could be split in 2 parts: a firmware one and a higher level software on top. | ||
291 | +Both pieces of Software are together managed by LwM2M Firmware Update Object (Object ID 5)]]></Description> | ||
292 | + </Item> | ||
293 | + <Item ID="20"><Name>Battery Status</Name> | ||
294 | + <Operations>R</Operations> | ||
295 | + <MultipleInstances>Single</MultipleInstances> | ||
296 | + <Mandatory>Optional</Mandatory> | ||
297 | + <Type>Integer</Type> | ||
298 | + <RangeEnumeration>0..6</RangeEnumeration> | ||
299 | + <Units></Units> | ||
300 | + <Description><![CDATA[This value is only valid for the Device Internal Battery if present (one Available Power Sources Resource Instance value is 1). | ||
301 | +Battery | ||
302 | +Status Meaning Description | ||
303 | +0 Normal The battery is operating normally and not on power. | ||
304 | +1 Charging The battery is currently charging. | ||
305 | +2 Charge Complete The battery is fully charged and still on power. | ||
306 | +3 Damaged The battery has some problem. | ||
307 | +4 Low Battery The battery is low on charge. | ||
308 | +5 Not Installed The battery is not installed. | ||
309 | +6 Unknown The battery information is not available.]]></Description> | ||
310 | + </Item> | ||
311 | + <Item ID="21"><Name>Memory Total</Name> | ||
312 | + <Operations>R</Operations> | ||
313 | + <MultipleInstances>Single</MultipleInstances> | ||
314 | + <Mandatory>Optional</Mandatory> | ||
315 | + <Type>Integer</Type> | ||
316 | + <RangeEnumeration></RangeEnumeration> | ||
317 | + <Units></Units> | ||
318 | + <Description><![CDATA[Total amount of storage space which can store data and software in the LwM2M Device (expressed in kilobytes). Note: 1 kilobyte corresponds to 1000 bytes.]]></Description> | ||
319 | + </Item> | ||
320 | + <Item ID="22"><Name>ExtDevInfo</Name> | ||
321 | + <Operations>R</Operations> | ||
322 | + <MultipleInstances>Multiple</MultipleInstances> | ||
323 | + <Mandatory>Optional</Mandatory> | ||
324 | + <Type>Objlnk</Type> | ||
325 | + <RangeEnumeration></RangeEnumeration> | ||
326 | + <Units></Units> | ||
327 | + <Description><![CDATA[Reference to external "Device" object instance containing information. For example, such an external device can be a Host Device, which is a device into which the Device containing the LwM2M client is embedded. This Resource may be used to retrieve information about the Host Device.]]></Description> | ||
328 | + </Item></Resources> | ||
329 | + <Description2></Description2> | ||
330 | + </Object> | ||
331 | +</LWM2M> |
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
1 | package org.thingsboard.server.transport.lwm2m.secure.credentials; | 16 | package org.thingsboard.server.transport.lwm2m.secure.credentials; |
2 | 17 | ||
3 | import org.eclipse.leshan.core.util.Hex; | 18 | import org.eclipse.leshan.core.util.Hex; |
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
1 | package org.thingsboard.server.transport.lwm2m.secure.credentials; | 16 | package org.thingsboard.server.transport.lwm2m.secure.credentials; |
2 | 17 | ||
3 | import com.fasterxml.jackson.annotation.JsonIgnore; | 18 | import com.fasterxml.jackson.annotation.JsonIgnore; |
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
1 | package org.thingsboard.server.transport.lwm2m.secure.credentials; | 16 | package org.thingsboard.server.transport.lwm2m.secure.credentials; |
2 | 17 | ||
3 | import lombok.Data; | 18 | import lombok.Data; |
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
1 | package org.thingsboard.server.transport.lwm2m.secure.credentials; | 16 | package org.thingsboard.server.transport.lwm2m.secure.credentials; |
2 | 17 | ||
3 | import org.eclipse.leshan.core.SecurityMode; | 18 | import org.eclipse.leshan.core.SecurityMode; |
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
1 | package org.thingsboard.server.transport.lwm2m.secure.credentials; | 16 | package org.thingsboard.server.transport.lwm2m.secure.credentials; |
2 | 17 | ||
3 | import lombok.Data; | 18 | import lombok.Data; |
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
1 | package org.thingsboard.server.transport.lwm2m.secure.credentials; | 16 | package org.thingsboard.server.transport.lwm2m.secure.credentials; |
2 | 17 | ||
3 | import org.eclipse.leshan.core.SecurityMode; | 18 | import org.eclipse.leshan.core.SecurityMode; |
1 | +/** | ||
2 | + * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
1 | package org.thingsboard.server.transport.lwm2m.secure.credentials; | 16 | package org.thingsboard.server.transport.lwm2m.secure.credentials; |
2 | 17 | ||
3 | import lombok.Data; | 18 | import lombok.Data; |
@@ -646,8 +646,7 @@ public class DefaultLwM2MTransportMsgHandler implements LwM2mTransportMsgHandler | @@ -646,8 +646,7 @@ public class DefaultLwM2MTransportMsgHandler implements LwM2mTransportMsgHandler | ||
646 | */ | 646 | */ |
647 | private void updateResourcesValue(Registration registration, LwM2mResource lwM2mResource, String path) { | 647 | private void updateResourcesValue(Registration registration, LwM2mResource lwM2mResource, String path) { |
648 | LwM2mClient lwM2MClient = clientContext.getOrRegister(registration); | 648 | LwM2mClient lwM2MClient = clientContext.getOrRegister(registration); |
649 | - if (lwM2MClient.saveResourceValue(path, lwM2mResource, this.config | ||
650 | - .getModelProvider())) { | 649 | + if (lwM2MClient.saveResourceValue(path, lwM2mResource, this.config.getModelProvider())) { |
651 | if (FR_PATH_RESOURCE_VER_ID.equals(convertPathFromIdVerToObjectId(path)) && | 650 | if (FR_PATH_RESOURCE_VER_ID.equals(convertPathFromIdVerToObjectId(path)) && |
652 | lwM2MClient.getFrUpdate().getCurrentFwVersion() != null | 651 | lwM2MClient.getFrUpdate().getCurrentFwVersion() != null |
653 | && !lwM2MClient.getFrUpdate().getCurrentFwVersion().equals(lwM2MClient.getFrUpdate().getClientFwVersion()) | 652 | && !lwM2MClient.getFrUpdate().getCurrentFwVersion().equals(lwM2MClient.getFrUpdate().getClientFwVersion()) |