-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added versions of NRP fault tolerance example.
- Loading branch information
1 parent
38cec27
commit a1213c7
Showing
7 changed files
with
1,123 additions
and
0 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,36 @@ | ||
/** | ||
* This version of NRP_FD simply has the primary (node1) failing after 5 seconds and the backup | ||
* (node2) failing at at 15s. The backup detects simultaneous loss of the heartbeat on both networks | ||
* and hence assumes that the primary has failed rather than there being a network failure. Switch 1 | ||
* remains the NRP. | ||
* | ||
* @author Edward A. Lee | ||
* @author Marjan Sirjani | ||
*/ | ||
target C { | ||
coordination: decentralized, | ||
timeout: 1000 hours | ||
} | ||
import Switch, Node from "NRP_FD.lf" | ||
|
||
federated reactor(heartbeat_period: time = 1 s, delay: time = 10 ms) { | ||
node1 = new Node(heartbeat_period=heartbeat_period, id=1) | ||
node2 = new Node(heartbeat_period=heartbeat_period, id=2) | ||
|
||
switch1 = new Switch(id=1) | ||
switch2 = new Switch(id=2) | ||
switch3 = new Switch(id=3) | ||
switch4 = new Switch(id=4) | ||
|
||
node1.out -> switch1.in1, switch3.in1 after delay | ||
switch1.out1, switch3.out1 -> node1.in after delay | ||
|
||
switch1.out2 -> switch2.in2 after delay | ||
switch2.out2 -> switch1.in2 after delay | ||
|
||
switch2.out1, switch4.out1 -> node2.in after delay | ||
node2.out -> switch2.in1, switch4.in1 after delay | ||
|
||
switch3.out2 -> switch4.in2 after delay | ||
switch4.out2 -> switch3.in2 after delay | ||
} |
Oops, something went wrong.