-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from OSGP/feature/FDP-1961-PSK-change-flow
FDP-1961: psk change flow
- Loading branch information
Showing
40 changed files
with
778 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: Contributors to the GXF project | ||
SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
# Sng Crest Device Simulator | ||
|
||
The simulator acts as a coap device, sends alarm messages and is able to handling a PSK set command. | ||
|
||
## Flow | ||
|
||
1. The simulator sends a coap alarm message to the coap-http proxy, from a `while(true)` loop | ||
in a separate virtual thread, started from the `Simulator.kt` class, that | ||
extends `CommandLineRunner`. | ||
2. If the response received contains a `PSK:SET` command, then: | ||
1. Handle the PSK change: | ||
1. The new key is saved with status `PENDING`. | ||
2. Send a success message. | ||
3. The pending key gets status `ACTIVE` and the previous active key gets status `INACTIVE`. | ||
2. If an error occurs during the PSK change handling: | ||
1. Send a failure message. | ||
2. If a pending key was already saved, set the status of this key as `INVALID`. | ||
3. The thread sleeps for `simulatorProperties.sleepDuration` seconds and then the flow starts | ||
again. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
application/src/integrationTest/resources/messages/psk-change-failure-message.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"ID": 867787050253370, | ||
"MID": 1, | ||
"IMSI": 460023210226023, | ||
"EID": "89001012012341234012345678901224", | ||
"ICCID": "89882280666074936745", | ||
"TS": 1687522333, | ||
"TSL": 1687522333, | ||
"CON": "A", | ||
"FW": 2100, | ||
"TEL": 20416, | ||
"cID": 7020155, | ||
"PWR": 0, | ||
"BAT": 3533, | ||
"CSQ": 25, | ||
"RSRQ": -210, | ||
"RSRP": -99, | ||
"SNR": 22, | ||
"TRY": 1, | ||
"MSI": 0, | ||
"URC": [ | ||
"PSK:EQER", | ||
{ | ||
"DL": "!PSK:SET" | ||
} | ||
], | ||
"A": [ | ||
3, | ||
16, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0 | ||
], | ||
"MEM": 7, | ||
"UPT": 32, | ||
"RLY": 0, | ||
"T1": [ | ||
265 | ||
], | ||
"H1": [ | ||
402 | ||
], | ||
"D": 9, | ||
"P1": [ | ||
12 | ||
], | ||
"P2": [ | ||
12 | ||
], | ||
"FMC": 0 | ||
} |
54 changes: 54 additions & 0 deletions
54
application/src/integrationTest/resources/messages/psk-change-success-message.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"ID": 867787050253370, | ||
"MID": 1, | ||
"IMSI": 460023210226023, | ||
"EID": "89001012012341234012345678901224", | ||
"ICCID": "89882280666074936745", | ||
"TS": 1687522333, | ||
"TSL": 1687522333, | ||
"CON": "A", | ||
"FW": 2100, | ||
"TEL": 20416, | ||
"cID": 7020155, | ||
"PWR": 0, | ||
"BAT": 3533, | ||
"CSQ": 25, | ||
"RSRQ": -210, | ||
"RSRP": -99, | ||
"SNR": 22, | ||
"TRY": 1, | ||
"MSI": 0, | ||
"URC": [ | ||
"PSK:SET", | ||
{ | ||
"DL": "!PSK:SET" | ||
} | ||
], | ||
"A": [ | ||
3, | ||
16, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0 | ||
], | ||
"MEM": 7, | ||
"UPT": 32, | ||
"RLY": 0, | ||
"T1": [ | ||
265 | ||
], | ||
"H1": [ | ||
402 | ||
], | ||
"D": 9, | ||
"P1": [ | ||
12 | ||
], | ||
"P2": [ | ||
12 | ||
], | ||
"FMC": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/coap/CoapClientService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.../src/main/kotlin/org/gxf/crestdevicesimulator/simulator/data/entity/PreSharedKeyStatus.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-FileCopyrightText: Contributors to the GXF project | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.gxf.crestdevicesimulator.simulator.data.entity | ||
|
||
enum class PreSharedKeyStatus { | ||
ACTIVE, | ||
INACTIVE, | ||
PENDING, | ||
INVALID | ||
} |
Oops, something went wrong.