-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvehiclecloud.tla
More file actions
1748 lines (1567 loc) · 97.7 KB
/
Copy pathvehiclecloud.tla
File metadata and controls
1748 lines (1567 loc) · 97.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
------------------------------ MODULE vehiclecloud ------------------------------
EXTENDS Naturals, TLC, Sequences, FiniteSets
CONSTANTS
(* All user IDs *)
ALL_USER_IDS
(* Used to indicate the absence of a user *)
NO_USER == 0
ASSUME
(* User IDs that are different from NO_USER must exist *)
Cardinality(ALL_USER_IDS) > 0 /\ \A id \in ALL_USER_IDS: id /= NO_USER
(* --algorithm VehicleCloud
variables
\* Set by the cloud in order to decide whether a client request is allowed
clientAuthorised = FALSE;
\* Determines whether the client is in the process of fetching data from the operations terminal (via the cloud)
clientViewingData = FALSE;
\* The ID of the user currently accessing the system via the client
clientCurrentUserId = NO_USER;
\* Determines whether the cloud have checked (or validated) the client id for some request (synchronisation variable)
\* Related to this, the variable 'clientAuthorised' indicates whether the client request is allowed.
interactiveCloudCheckedId = FALSE;
\* Determines whether the cloud has delived the firmware to the operations terminal
interactiveCloudDeliveredFirmware = FALSE;
\* Determines whether the cloud has sent a firmware acknowledgement to the client (synchronisation variable)
interactiveCloudFirmwareAckSent = FALSE;
\* True if location A (the only location that we model) is suspended, false otherwise
interactiveCloudLocationSuspended \in {TRUE, FALSE};
\* True if the ID of the client is trusted, false otherwise.
clientIdTrusted \in {TRUE, FALSE};
\* True when the service cloud has received new data from the operations terminal (synchronisation variable)
serviceCloudDataReceived = FALSE;
\* The most recent data that the service cloud has received from the operations terminal
serviceCloudDataSnapshot = FALSE;
\* Determines whether the gateway allows inwards communication
gatewayInwardsOpen = FALSE;
\* Determines whether the gateway has sent a firmware acknowledgement (synchronisation variable)
gatewayFirmwareAckSent = FALSE;
\* Determines whether the gateway has delivered the firmware to the operations terminal
gatewayDeliveredFirmware = FALSE;
\* True if the ID of the gateway is trusted, false otherwise.
gatewayIdTrusted \in {TRUE, FALSE};
\* Determines whether the operations terminal has sent a firmware acknowledgement to the cloud (synchronisation variable)
otFirmwareAckSent = FALSE;
\* The most recent data sent by the operations terminal.
\* The operations terminal simply toggles this variable every time data is sent.
\* This allows us to confirm that the service cloud receives different data
otLatestData = FALSE;
\* True if the operations terminal has sent new data to the service cloud (synchronisation variable)
otDataSentToServiceCloud = FALSE;
\* Determines whether the latest data has been signed by the operations terminal
otDataSigned = FALSE;
\* Used for storing (valid) firmware received from the client
otStorage = NO_FIRMWARE;
otDataRedirected = FALSE;
otDataTransmissionBlocked = FALSE;
\* A copy of the firmware used by the control network
otInstalledFirmware = LET timeStamp == 1
IN
<<timeStamp, ValidFirmware>>;
\* True if someone inserted a USB device and failed to provide the authorisation password within a safety time limit. False otherwise
otUsbUnauthorisedAccess = FALSE;
\* Determines whether the cloud has sent data to the client (synchronisation variable)
cloudDataSent = FALSE;
\* Firmware that the client will upload to the operations terminal
clientFirmware = NO_FIRMWARE;
controlNetworkDataSendToOT = FALSE;
controlNetworkLatestData = FALSE;
controlNetworkDataEncrypted = FALSE;
define
\* Processes
GATEWAY == 1
OT == 2
INTERACTIVE_CLOUD == 4
CLIENT == 5
SERVICE_CLOUD == 6
CONTROL_NETWORK == 7
\* Used to indicate the absence of client firmware
NO_FIRMWARE == <<>>
\* Set of all firmwares
AllFirmware == [ signatureValid : BOOLEAN, genuine : BOOLEAN, size : BOOLEAN ]
\* True if the client is sending firmware, false otherwise
ClientSendingFirmware == clientFirmware /= NO_FIRMWARE
\* Has any client request been sent?
ClientRequestSent == ClientSendingFirmware \/ clientViewingData
\* The firmware timestamp index
FirmwareTimestampIndex == 1
\* The firmware value index
FirmwareValueIndex == 2
\* For a piece of firmware to be considered valid it must have a valid signature, be genuine and fit the operations terminal storage
ValidFirmware == [signatureValid |-> TRUE, genuine |-> TRUE, size |-> TRUE]
\* Check that 'firmware' is valid
FirmwareValid(firmware) == firmware /= NO_FIRMWARE /\
firmware[FirmwareValueIndex].signatureValid /\
firmware[FirmwareValueIndex].genuine /\
firmware[FirmwareValueIndex].size
\* Check that firmware signature is valid
FirmwareHasValidSignature(firmware) == firmware[FirmwareValueIndex].signatureValid
\* Check that firmware is genuine
FirmwareIsGenuine(firmware) == firmware[FirmwareValueIndex].genuine
\* Check that the firmware fits the operations terminal storage
FirmwareFitsStorage(firmware) == firmware[FirmwareValueIndex].size
\* Compute next firmware timestamp
NextFirmwareTimestamp == LET currentTimeStamp == otInstalledFirmware[FirmwareTimestampIndex]
IN
IF currentTimeStamp = 1 THEN 2 ELSE 3
\* Determines whether the service cloud has waited too long for the operations terminal to deliver the data.
\* Since we don't model time explicitly, we simply say that the time limit has passed once the
\* data has been redirected to some sink
DataDeliveryTimeElapsed == otDataRedirected
end define
fair process client = CLIENT
variable
\* Used to store data fetched from the service cloud
clientData = FALSE
begin
ClientBegin:
with id \in ALL_USER_IDS do
clientCurrentUserId := id;
end with;
either ClientSendFirmwareUpdate:
\* Get firmware to send
with clientFirmwareToSend \in AllFirmware do
clientFirmware := <<NextFirmwareTimestamp, clientFirmwareToSend>>;
end with;
or ClientViewData:
\* Fetch newest data
clientViewingData := TRUE;
end either;
\* Wait for cloud to check id
ClientAwaitingIdCheck:
await interactiveCloudCheckedId;
if clientAuthorised then
\* Wait for firmware acknowledgement
if ClientSendingFirmware then
ClientAwaitingFirmwareAck:
await interactiveCloudFirmwareAckSent;
clientFirmware := NO_FIRMWARE;
elsif clientViewingData then
ClientUpdateData:
await cloudDataSent;
clientData := serviceCloudDataSnapshot;
cloudDataSent := FALSE;
end if;
end if;
end process
fair process serviceCloud = SERVICE_CLOUD
begin
ServiceCloudBegin:
await otDataSentToServiceCloud \/ DataDeliveryTimeElapsed;
if DataDeliveryTimeElapsed then
\* Security measure: prevent operations terminal from sending data
otDataTransmissionBlocked := TRUE;
goto ServiceCloudDone;
else
ServiceCloudReceiveData:
with oldData = serviceCloudDataSnapshot do
\* The data must be new
if otDataSigned /\ gatewayIdTrusted then
serviceCloudDataSnapshot := otLatestData;
end if;
\* If the data is not signed by the operations terminal the data snapshot will not be updated
assert (~otDataSigned) => (serviceCloudDataSnapshot = oldData);
serviceCloudDataReceived := TRUE;
otDataSentToServiceCloud := FALSE;
end with;
end if;
ServiceCloudEndCycle:
\* Repeat
goto ServiceCloudBegin;
ServiceCloudDone:
skip;
end process;
fair process interactiveCloud = INTERACTIVE_CLOUD
begin
InteractiveCloudBegin:
await ClientRequestSent;
if interactiveCloudLocationSuspended then
\* Location A is already suspended
clientAuthorised := FALSE;
interactiveCloudCheckedId := TRUE;
else
\* Location A is not suspended
if clientIdTrusted then
clientAuthorised := TRUE;
interactiveCloudCheckedId := TRUE;
if ClientSendingFirmware then
InteractiveCloudAttemptSendingFirmware:
\* Send firmware
interactiveCloudDeliveredFirmware := TRUE;
\* ACKFWUpdate
CloudAwaitingFirmwareAck:
await gatewayFirmwareAckSent;
InteractiveCloudRelayFirmwareAck:
interactiveCloudFirmwareAckSent := TRUE;
else
InteractiveCloudDeliverData:
assert clientViewingData;
cloudDataSent := TRUE;
\* The service cloud is responsible for fetching the most recent data from the operations terminal
end if
else
assert ~interactiveCloudLocationSuspended;
\* Location A is now suspended
interactiveCloudLocationSuspended := TRUE;
clientAuthorised := FALSE;
interactiveCloudCheckedId := TRUE;
end if;
end if;
end process;
fair process gateway = GATEWAY
begin
GatewayAwaitingFirmware:
\* Proceed once the firmware has been received, or when the client cloud has terminated.
\* If we proceed due to client cloud termination it simply means that the client was viewing data,
\* hence no client-to-vehicle communication is needed. In that case, the gateway can terminate.
await interactiveCloudDeliveredFirmware \/ pc[INTERACTIVE_CLOUD] = "Done";
if interactiveCloudDeliveredFirmware then
with b \in {TRUE, FALSE} do
gatewayInwardsOpen := b;
end with;
if gatewayInwardsOpen then
assert clientAuthorised;
gatewayDeliveredFirmware := TRUE;
GatewayAwaitingFirmwareAck:
await otFirmwareAckSent;
end if;
GatewayAwaitingOT:
gatewayFirmwareAckSent := TRUE;
end if;
end process;
fair process ot = OT
begin
OTBegin:
skip;
OTReceiveData:
await controlNetworkDataSendToOT;
\* The data has changed
assert otLatestData /= controlNetworkLatestData;
\* The raw data is received
assert ~controlNetworkDataEncrypted;
otLatestData := controlNetworkLatestData;
\* Encrypt the data received from the control network
controlNetworkDataEncrypted := TRUE;
controlNetworkDataSendToOT := FALSE;
OTSendData:
if ~otDataTransmissionBlocked then
\* Send data
with b \in {TRUE, FALSE} do
otDataSigned := b;
end with;
serviceCloudDataReceived := FALSE;
either OTSendToServiceCloud:
otDataSentToServiceCloud := TRUE;
assert ~otDataRedirected;
OTAwaitingServiceCloud:
await serviceCloudDataReceived;
or OTRedirectData:
otDataRedirected := TRUE;
assert ~otDataSentToServiceCloud;
end either;
OTFinishSendingData:
otDataRedirected := FALSE;
else
OTLogDataBlock:
skip;
end if;
OTReadUSB:
\* USB connected
\* Security log: USB connected
either OTUSBConnected:
either OTPasswordOK:
either OTUSBHasFirmware:
with usbFirmware \in AllFirmware do
with usbFirmwareTimestamped = <<NextFirmwareTimestamp, usbFirmware>> do
if FirmwareValid(usbFirmwareTimestamped) then
otStorage := usbFirmwareTimestamped;
end if;
end with;
end with;
or OTUSBHasNoFirmware:
\* Nothing to do
skip;
end either;
or OTPasswordNotOk:
otUsbUnauthorisedAccess := TRUE;
OTUsbSecurityEventReset:
otUsbUnauthorisedAccess := FALSE;
end either;
or OTUSBNotConnected:
skip;
end either;
OTReceiveFirmware:
if gatewayDeliveredFirmware then
if FirmwareValid(clientFirmware) then
otStorage := clientFirmware;
end if;
OTSendAck:
otFirmwareAckSent := TRUE;
\* Expect new firmware
interactiveCloudDeliveredFirmware := FALSE;
gatewayDeliveredFirmware := FALSE;
end if;
OTHandlePendingRequests:
goto OTBegin;
end process;
fair process controlNetwork = CONTROL_NETWORK
begin
ControlNetworkBegin:
skip;
ControlNetworkSendData:
\* At this point the control network data is not encrypted
controlNetworkDataEncrypted := FALSE;
controlNetworkLatestData := ~controlNetworkLatestData;
controlNetworkDataSendToOT := TRUE;
ControlNetworkAwaitingOT:
await ~controlNetworkDataSendToOT;
skip;
ControlNetworkHandlePendingRequests:
goto ControlNetworkBegin;
end process;
end algorithm; *)
\* BEGIN TRANSLATION
VARIABLES clientAuthorised, clientViewingData, clientCurrentUserId,
interactiveCloudCheckedId, interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent, interactiveCloudLocationSuspended,
clientIdTrusted, serviceCloudDataReceived, serviceCloudDataSnapshot,
gatewayInwardsOpen, gatewayFirmwareAckSent,
gatewayDeliveredFirmware, gatewayIdTrusted, otFirmwareAckSent,
otLatestData, otDataSentToServiceCloud, otDataSigned, otStorage,
otDataRedirected, otDataTransmissionBlocked, otInstalledFirmware,
otUsbUnauthorisedAccess, cloudDataSent, clientFirmware,
controlNetworkDataSendToOT, controlNetworkLatestData,
controlNetworkDataEncrypted, pc
(* define statement *)
GATEWAY == 1
OT == 2
INTERACTIVE_CLOUD == 4
CLIENT == 5
SERVICE_CLOUD == 6
CONTROL_NETWORK == 7
NO_FIRMWARE == <<>>
AllFirmware == [ signatureValid : BOOLEAN, genuine : BOOLEAN, size : BOOLEAN ]
ClientSendingFirmware == clientFirmware /= NO_FIRMWARE
ClientRequestSent == ClientSendingFirmware \/ clientViewingData
FirmwareTimestampIndex == 1
FirmwareValueIndex == 2
ValidFirmware == [signatureValid |-> TRUE, genuine |-> TRUE, size |-> TRUE]
FirmwareValid(firmware) == firmware /= NO_FIRMWARE /\
firmware[FirmwareValueIndex].signatureValid /\
firmware[FirmwareValueIndex].genuine /\
firmware[FirmwareValueIndex].size
FirmwareHasValidSignature(firmware) == firmware[FirmwareValueIndex].signatureValid
FirmwareIsGenuine(firmware) == firmware[FirmwareValueIndex].genuine
FirmwareFitsStorage(firmware) == firmware[FirmwareValueIndex].size
NextFirmwareTimestamp == LET currentTimeStamp == otInstalledFirmware[FirmwareTimestampIndex]
IN
IF currentTimeStamp = 1 THEN 2 ELSE 3
DataDeliveryTimeElapsed == otDataRedirected
VARIABLE clientData
vars == << clientAuthorised, clientViewingData, clientCurrentUserId,
interactiveCloudCheckedId, interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent, interactiveCloudLocationSuspended,
clientIdTrusted, serviceCloudDataReceived,
serviceCloudDataSnapshot, gatewayInwardsOpen,
gatewayFirmwareAckSent, gatewayDeliveredFirmware, gatewayIdTrusted,
otFirmwareAckSent, otLatestData, otDataSentToServiceCloud,
otDataSigned, otStorage, otDataRedirected,
otDataTransmissionBlocked, otInstalledFirmware,
otUsbUnauthorisedAccess, cloudDataSent, clientFirmware,
controlNetworkDataSendToOT, controlNetworkLatestData,
controlNetworkDataEncrypted, pc, clientData >>
ProcSet == {CLIENT} \cup {SERVICE_CLOUD} \cup {INTERACTIVE_CLOUD} \cup {GATEWAY} \cup {OT} \cup {CONTROL_NETWORK}
Init == (* Global variables *)
/\ clientAuthorised = FALSE
/\ clientViewingData = FALSE
/\ clientCurrentUserId = NO_USER
/\ interactiveCloudCheckedId = FALSE
/\ interactiveCloudDeliveredFirmware = FALSE
/\ interactiveCloudFirmwareAckSent = FALSE
/\ interactiveCloudLocationSuspended \in {TRUE, FALSE}
/\ clientIdTrusted \in {TRUE, FALSE}
/\ serviceCloudDataReceived = FALSE
/\ serviceCloudDataSnapshot = FALSE
/\ gatewayInwardsOpen = FALSE
/\ gatewayFirmwareAckSent = FALSE
/\ gatewayDeliveredFirmware = FALSE
/\ gatewayIdTrusted \in {TRUE, FALSE}
/\ otFirmwareAckSent = FALSE
/\ otLatestData = FALSE
/\ otDataSentToServiceCloud = FALSE
/\ otDataSigned = FALSE
/\ otStorage = NO_FIRMWARE
/\ otDataRedirected = FALSE
/\ otDataTransmissionBlocked = FALSE
/\ otInstalledFirmware = (LET timeStamp == 1
IN
<<timeStamp, ValidFirmware>>)
/\ otUsbUnauthorisedAccess = FALSE
/\ cloudDataSent = FALSE
/\ clientFirmware = NO_FIRMWARE
/\ controlNetworkDataSendToOT = FALSE
/\ controlNetworkLatestData = FALSE
/\ controlNetworkDataEncrypted = FALSE
(* Process client *)
/\ clientData = FALSE
/\ pc = [self \in ProcSet |-> CASE self = CLIENT -> "ClientBegin"
[] self = SERVICE_CLOUD -> "ServiceCloudBegin"
[] self = INTERACTIVE_CLOUD -> "InteractiveCloudBegin"
[] self = GATEWAY -> "GatewayAwaitingFirmware"
[] self = OT -> "OTBegin"
[] self = CONTROL_NETWORK -> "ControlNetworkBegin"]
ClientBegin == /\ pc[CLIENT] = "ClientBegin"
/\ \E id \in ALL_USER_IDS:
clientCurrentUserId' = id
/\ \/ /\ pc' = [pc EXCEPT ![CLIENT] = "ClientSendFirmwareUpdate"]
\/ /\ pc' = [pc EXCEPT ![CLIENT] = "ClientViewData"]
/\ UNCHANGED << clientAuthorised, clientViewingData,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted, serviceCloudDataReceived,
serviceCloudDataSnapshot, gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware, gatewayIdTrusted,
otFirmwareAckSent, otLatestData,
otDataSentToServiceCloud, otDataSigned,
otStorage, otDataRedirected,
otDataTransmissionBlocked, otInstalledFirmware,
otUsbUnauthorisedAccess, cloudDataSent,
clientFirmware, controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted, clientData >>
ClientSendFirmwareUpdate == /\ pc[CLIENT] = "ClientSendFirmwareUpdate"
/\ \E clientFirmwareToSend \in AllFirmware:
clientFirmware' = <<NextFirmwareTimestamp, clientFirmwareToSend>>
/\ pc' = [pc EXCEPT ![CLIENT] = "ClientAwaitingIdCheck"]
/\ UNCHANGED << clientAuthorised,
clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted,
otFirmwareAckSent, otLatestData,
otDataSentToServiceCloud,
otDataSigned, otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
cloudDataSent,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
ClientViewData == /\ pc[CLIENT] = "ClientViewData"
/\ clientViewingData' = TRUE
/\ pc' = [pc EXCEPT ![CLIENT] = "ClientAwaitingIdCheck"]
/\ UNCHANGED << clientAuthorised, clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted, serviceCloudDataReceived,
serviceCloudDataSnapshot, gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware, gatewayIdTrusted,
otFirmwareAckSent, otLatestData,
otDataSentToServiceCloud, otDataSigned,
otStorage, otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware, otUsbUnauthorisedAccess,
cloudDataSent, clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted, clientData >>
ClientAwaitingIdCheck == /\ pc[CLIENT] = "ClientAwaitingIdCheck"
/\ interactiveCloudCheckedId
/\ IF clientAuthorised
THEN /\ IF ClientSendingFirmware
THEN /\ pc' = [pc EXCEPT ![CLIENT] = "ClientAwaitingFirmwareAck"]
ELSE /\ IF clientViewingData
THEN /\ pc' = [pc EXCEPT ![CLIENT] = "ClientUpdateData"]
ELSE /\ pc' = [pc EXCEPT ![CLIENT] = "Done"]
ELSE /\ pc' = [pc EXCEPT ![CLIENT] = "Done"]
/\ UNCHANGED << clientAuthorised, clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted, otFirmwareAckSent,
otLatestData,
otDataSentToServiceCloud,
otDataSigned, otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
cloudDataSent, clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
ClientAwaitingFirmwareAck == /\ pc[CLIENT] = "ClientAwaitingFirmwareAck"
/\ interactiveCloudFirmwareAckSent
/\ clientFirmware' = NO_FIRMWARE
/\ pc' = [pc EXCEPT ![CLIENT] = "Done"]
/\ UNCHANGED << clientAuthorised,
clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted,
otFirmwareAckSent, otLatestData,
otDataSentToServiceCloud,
otDataSigned, otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
cloudDataSent,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
ClientUpdateData == /\ pc[CLIENT] = "ClientUpdateData"
/\ cloudDataSent
/\ clientData' = serviceCloudDataSnapshot
/\ cloudDataSent' = FALSE
/\ pc' = [pc EXCEPT ![CLIENT] = "Done"]
/\ UNCHANGED << clientAuthorised, clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted, serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen, gatewayFirmwareAckSent,
gatewayDeliveredFirmware, gatewayIdTrusted,
otFirmwareAckSent, otLatestData,
otDataSentToServiceCloud, otDataSigned,
otStorage, otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess, clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted >>
client == ClientBegin \/ ClientSendFirmwareUpdate \/ ClientViewData
\/ ClientAwaitingIdCheck \/ ClientAwaitingFirmwareAck
\/ ClientUpdateData
ServiceCloudBegin == /\ pc[SERVICE_CLOUD] = "ServiceCloudBegin"
/\ otDataSentToServiceCloud \/ DataDeliveryTimeElapsed
/\ IF DataDeliveryTimeElapsed
THEN /\ otDataTransmissionBlocked' = TRUE
/\ pc' = [pc EXCEPT ![SERVICE_CLOUD] = "ServiceCloudDone"]
ELSE /\ pc' = [pc EXCEPT ![SERVICE_CLOUD] = "ServiceCloudReceiveData"]
/\ UNCHANGED otDataTransmissionBlocked
/\ UNCHANGED << clientAuthorised, clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted, serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted, otFirmwareAckSent,
otLatestData, otDataSentToServiceCloud,
otDataSigned, otStorage, otDataRedirected,
otInstalledFirmware,
otUsbUnauthorisedAccess, cloudDataSent,
clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted, clientData >>
ServiceCloudReceiveData == /\ pc[SERVICE_CLOUD] = "ServiceCloudReceiveData"
/\ LET oldData == serviceCloudDataSnapshot IN
/\ IF otDataSigned /\ gatewayIdTrusted
THEN /\ serviceCloudDataSnapshot' = otLatestData
ELSE /\ TRUE
/\ UNCHANGED serviceCloudDataSnapshot
/\ Assert((~otDataSigned) => (serviceCloudDataSnapshot' = oldData),
"Failure of assertion at line 222, column 17.")
/\ serviceCloudDataReceived' = TRUE
/\ otDataSentToServiceCloud' = FALSE
/\ pc' = [pc EXCEPT ![SERVICE_CLOUD] = "ServiceCloudEndCycle"]
/\ UNCHANGED << clientAuthorised, clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted, gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted, otFirmwareAckSent,
otLatestData, otDataSigned,
otStorage, otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
cloudDataSent, clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
ServiceCloudEndCycle == /\ pc[SERVICE_CLOUD] = "ServiceCloudEndCycle"
/\ pc' = [pc EXCEPT ![SERVICE_CLOUD] = "ServiceCloudBegin"]
/\ UNCHANGED << clientAuthorised, clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted, otFirmwareAckSent,
otLatestData, otDataSentToServiceCloud,
otDataSigned, otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess, cloudDataSent,
clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
ServiceCloudDone == /\ pc[SERVICE_CLOUD] = "ServiceCloudDone"
/\ TRUE
/\ pc' = [pc EXCEPT ![SERVICE_CLOUD] = "Done"]
/\ UNCHANGED << clientAuthorised, clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted, serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen, gatewayFirmwareAckSent,
gatewayDeliveredFirmware, gatewayIdTrusted,
otFirmwareAckSent, otLatestData,
otDataSentToServiceCloud, otDataSigned,
otStorage, otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess, cloudDataSent,
clientFirmware, controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted, clientData >>
serviceCloud == ServiceCloudBegin \/ ServiceCloudReceiveData
\/ ServiceCloudEndCycle \/ ServiceCloudDone
InteractiveCloudBegin == /\ pc[INTERACTIVE_CLOUD] = "InteractiveCloudBegin"
/\ ClientRequestSent
/\ IF interactiveCloudLocationSuspended
THEN /\ clientAuthorised' = FALSE
/\ interactiveCloudCheckedId' = TRUE
/\ pc' = [pc EXCEPT ![INTERACTIVE_CLOUD] = "Done"]
/\ UNCHANGED interactiveCloudLocationSuspended
ELSE /\ IF clientIdTrusted
THEN /\ clientAuthorised' = TRUE
/\ interactiveCloudCheckedId' = TRUE
/\ IF ClientSendingFirmware
THEN /\ pc' = [pc EXCEPT ![INTERACTIVE_CLOUD] = "InteractiveCloudAttemptSendingFirmware"]
ELSE /\ pc' = [pc EXCEPT ![INTERACTIVE_CLOUD] = "InteractiveCloudDeliverData"]
/\ UNCHANGED interactiveCloudLocationSuspended
ELSE /\ Assert(~interactiveCloudLocationSuspended,
"Failure of assertion at line 270, column 13.")
/\ interactiveCloudLocationSuspended' = TRUE
/\ clientAuthorised' = FALSE
/\ interactiveCloudCheckedId' = TRUE
/\ pc' = [pc EXCEPT ![INTERACTIVE_CLOUD] = "Done"]
/\ UNCHANGED << clientViewingData,
clientCurrentUserId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted, otFirmwareAckSent,
otLatestData,
otDataSentToServiceCloud,
otDataSigned, otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
cloudDataSent, clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
InteractiveCloudAttemptSendingFirmware == /\ pc[INTERACTIVE_CLOUD] = "InteractiveCloudAttemptSendingFirmware"
/\ interactiveCloudDeliveredFirmware' = TRUE
/\ pc' = [pc EXCEPT ![INTERACTIVE_CLOUD] = "CloudAwaitingFirmwareAck"]
/\ UNCHANGED << clientAuthorised,
clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted,
otFirmwareAckSent,
otLatestData,
otDataSentToServiceCloud,
otDataSigned,
otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
cloudDataSent,
clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
CloudAwaitingFirmwareAck == /\ pc[INTERACTIVE_CLOUD] = "CloudAwaitingFirmwareAck"
/\ gatewayFirmwareAckSent
/\ pc' = [pc EXCEPT ![INTERACTIVE_CLOUD] = "InteractiveCloudRelayFirmwareAck"]
/\ UNCHANGED << clientAuthorised,
clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted,
otFirmwareAckSent, otLatestData,
otDataSentToServiceCloud,
otDataSigned, otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
cloudDataSent, clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
InteractiveCloudRelayFirmwareAck == /\ pc[INTERACTIVE_CLOUD] = "InteractiveCloudRelayFirmwareAck"
/\ interactiveCloudFirmwareAckSent' = TRUE
/\ pc' = [pc EXCEPT ![INTERACTIVE_CLOUD] = "Done"]
/\ UNCHANGED << clientAuthorised,
clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudLocationSuspended,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted,
otFirmwareAckSent,
otLatestData,
otDataSentToServiceCloud,
otDataSigned, otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
cloudDataSent,
clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
InteractiveCloudDeliverData == /\ pc[INTERACTIVE_CLOUD] = "InteractiveCloudDeliverData"
/\ Assert(clientViewingData,
"Failure of assertion at line 264, column 21.")
/\ cloudDataSent' = TRUE
/\ pc' = [pc EXCEPT ![INTERACTIVE_CLOUD] = "Done"]
/\ UNCHANGED << clientAuthorised,
clientViewingData,
clientCurrentUserId,
interactiveCloudCheckedId,
interactiveCloudDeliveredFirmware,
interactiveCloudFirmwareAckSent,
interactiveCloudLocationSuspended,
clientIdTrusted,
serviceCloudDataReceived,
serviceCloudDataSnapshot,
gatewayInwardsOpen,
gatewayFirmwareAckSent,
gatewayDeliveredFirmware,
gatewayIdTrusted,
otFirmwareAckSent, otLatestData,
otDataSentToServiceCloud,
otDataSigned, otStorage,
otDataRedirected,
otDataTransmissionBlocked,
otInstalledFirmware,
otUsbUnauthorisedAccess,
clientFirmware,
controlNetworkDataSendToOT,
controlNetworkLatestData,
controlNetworkDataEncrypted,
clientData >>
interactiveCloud == InteractiveCloudBegin
\/ InteractiveCloudAttemptSendingFirmware
\/ CloudAwaitingFirmwareAck
\/ InteractiveCloudRelayFirmwareAck
\/ InteractiveCloudDeliverData
GatewayAwaitingFirmware == /\ pc[GATEWAY] = "GatewayAwaitingFirmware"
/\ interactiveCloudDeliveredFirmware \/ pc[INTERACTIVE_CLOUD] = "Done"
/\ IF interactiveCloudDeliveredFirmware
THEN /\ \E b \in {TRUE, FALSE}:
gatewayInwardsOpen' = b
/\ IF gatewayInwardsOpen'
THEN /\ Assert(clientAuthorised,
"Failure of assertion at line 294, column 13.")
/\ gatewayDeliveredFirmware' = TRUE
/\ pc' = [pc EXCEPT ![GATEWAY] = "GatewayAwaitingFirmwareAck"]
ELSE /\ pc' = [pc EXCEPT ![GATEWAY] = "GatewayAwaitingOT"]
/\ UNCHANGED gatewayDeliveredFirmware
ELSE /\ pc' = [pc EXCEPT ![GATEWAY] = "Done"]
/\ UNCHANGED << gatewayInwardsOpen,
gatewayDeliveredFirmware >>
/\ UNCHANGED << clientAuthorised, clientViewingData,