sfp 0.2.1 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,80 +0,0 @@
1
- schema Machine {
2
- running is false
3
- address is ""
4
-
5
- procedure start {
6
- conditions {
7
- this.running is false
8
- }
9
- effects {
10
- this.running is true
11
- }
12
- }
13
-
14
- procedure stop {
15
- conditions {
16
- this.running is true
17
- }
18
- effects {
19
- this.running is false
20
- }
21
- }
22
- }
23
-
24
- schema VM extends Machine {
25
- created is false
26
-
27
- procedure start {
28
- conditions {
29
- this.created is true
30
- }
31
- effects {
32
- this.running is true
33
- }
34
- }
35
- procedure stop {
36
- conditions {
37
- this.created is true
38
- }
39
- effects {
40
- this.running is false
41
- }
42
- }
43
- }
44
-
45
- schema Cloud {
46
- running is false
47
-
48
- procedure create_vm(vm isref VM) {
49
- conditions {
50
- this.running is true
51
- vm.created is false
52
- }
53
- effects {
54
- vm.created is true
55
- }
56
- }
57
- procedure delete_vm(vm isref VM) {
58
- conditions {
59
- this.running is true
60
- vm.created is true
61
- }
62
- effects {
63
- vm.created is false
64
- }
65
- }
66
- }
67
-
68
- schema Client {
69
- refer isref Service
70
-
71
- procedure redirect (s isref Service) {
72
- conditions {
73
- }
74
- effects {
75
- this.refer is s
76
- }
77
- }
78
- }
79
-
80
-
@@ -1,22 +0,0 @@
1
- schema S {
2
- foo = true
3
-
4
- procedure change {
5
- conditions { }
6
- effects {
7
- this.foo is false
8
- }
9
- }
10
- }
11
-
12
- a isa S
13
- b isa S
14
-
15
- constraint goal {
16
- a.foo is false
17
- b.foo is false
18
- }
19
-
20
- constraint global {
21
- a.foo is false
22
- }
data/test/nd-cloud1.sfp DELETED
@@ -1,33 +0,0 @@
1
- include "service-schemas.sfp"
2
-
3
- // generate all possible states with constraint solver
4
- initial state {
5
- cloud1 isa Cloud {
6
- running either ( true, false )
7
- }
8
- cloud2 isa Cloud {
9
- running either ( true, false )
10
- }
11
-
12
- vm1 isa VM
13
- vm2 isa VM
14
-
15
- s1 isa Service
16
- s2 isa Service
17
- }
18
-
19
- goal constraint {
20
- s1 {
21
- running is true
22
- on_machine is vm1
23
- }
24
-
25
- s2 {
26
- running is true
27
- on_machine is vm2
28
- }
29
- }
30
-
31
- global constraint {
32
- if s2.running then s1.running
33
- }
data/test/nd-cloud2.sfp DELETED
@@ -1,41 +0,0 @@
1
- include "service-schemas.sfp"
2
-
3
- // generate all possible states with constraint solver
4
- initial state {
5
- cloud1 isa Cloud {
6
- running either ( true, false )
7
- }
8
- cloud2 isa Cloud {
9
- running either ( true, false )
10
- }
11
-
12
- vm1 isa VM
13
- vm2 isa VM
14
- vm3 isa VM
15
-
16
- lb isa Service
17
- ws isa Service
18
- db isa Service
19
- }
20
-
21
- goal constraint {
22
- lb {
23
- running is true
24
- on_machine is vm1
25
- }
26
-
27
- ws {
28
- running is true
29
- on_machine is vm2
30
- }
31
-
32
- db {
33
- running is true
34
- on_machine is vm3
35
- }
36
- }
37
-
38
- global constraint {
39
- if lb.running then ws.running
40
- if ws.running then db.running
41
- }
data/test/nd-cloud3.sfp DELETED
@@ -1,42 +0,0 @@
1
- include "service-schemas.sfp"
2
-
3
- // generate all possible states with constraint solver
4
- initial state {
5
- /*cloud1 isa Cloud {
6
- running either ( true, false )
7
- }
8
- cloud2 isa Cloud {
9
- running either ( true, false )
10
- }*/
11
- mycloud isa Cloud {
12
- running is true
13
- }
14
-
15
- vm1 isa VM
16
- vm2 isa VM
17
- vm3 isa VM
18
-
19
- lb1 isa LoadBalancer
20
- //ws1 isa WebService
21
- app1 isa AppService
22
- db1 isa DatabaseService
23
- }
24
-
25
- goal constraint {
26
- lb1 {
27
- installed is true
28
- on_machine is vm1
29
- }
30
- //ws1.installed is true
31
- app1 {
32
- installed is true
33
- on_machine is vm3
34
- }
35
- db1 {
36
- running is true
37
- on_machine is vm4
38
- }
39
- }
40
-
41
- global constraint {
42
- }
data/test/nd-service1.sfp DELETED
@@ -1,23 +0,0 @@
1
- include "service-schemas.sfp"
2
-
3
- initial state {
4
- s1 isa Service {
5
- installed is true
6
- running either (true, false)
7
- }
8
- s2 isa Service {
9
- installed is true
10
- running either (true, false)
11
- }
12
- pc isa Client {
13
- refer either (s1, s2)
14
- }
15
- }
16
- goal constraint {
17
- s1.running is false
18
- s2.running is true
19
- pc.refer is s2
20
- }
21
- global constraint {
22
- pc.refer.running is true
23
- }
data/test/nd-service2.sfp DELETED
@@ -1,27 +0,0 @@
1
- include "service-schemas.sfp"
2
-
3
- // generate all possible states with constraint solver
4
- initial state {
5
- s1 isa Service {
6
- installed is true
7
- running either (true, false)
8
- }
9
- s2 isa Service {
10
- installed is true
11
- running either (true, false)
12
- }
13
- s3 isa Service {
14
- installed is true
15
- running either (true, false)
16
- }
17
- pc isa Client {
18
- installed is true
19
- refer either (s1, s2)
20
- }
21
- }
22
- goal constraint {
23
- pc.refer.running is true
24
- }
25
- global constraint {
26
- pc.refer.running is true
27
- }
data/test/run.sh DELETED
@@ -1,53 +0,0 @@
1
- #!/bin/bash
2
-
3
- BASEDIR="$(dirname "$0")"
4
- CURRENTDIR=`pwd`
5
-
6
- # a function to check the execution status
7
- function test {
8
- "$@" 1>/dev/null
9
- status=$?
10
- if [ $status -ne 0 ]; then
11
- echo "$2 [Failed]"
12
- else
13
- echo "$2 [OK]"
14
- fi
15
- return $status
16
- }
17
-
18
- # go to test's base dir
19
- cd $BASEDIR
20
-
21
- ##
22
- # Tests use deterministic problem
23
- ##
24
- testcases[0]="test1.sfp"
25
- testcases[1]="test2.sfp"
26
- testcases[2]="test3.sfp"
27
- testcases[3]="test4.sfp"
28
-
29
- echo "Deterministic usecases..."
30
- for tc in "${testcases[@]}"
31
- do
32
- test ../bin/sfp $tc
33
- done
34
-
35
- ##
36
- # Tests use non-deterministic problems
37
- ##
38
- testcases[0]="nd-service1.sfp"
39
- testcases[1]="nd-service2.sfp"
40
- testcases[2]="nd-cloud1.sfp"
41
- testcases[3]="nd-cloud2.sfp"
42
- #testcases[4]="nd-cloud3.sfp"
43
-
44
- echo "Non-Deterministic usecases..."
45
- for tc in "${testcases[@]}"
46
- do
47
- test ../bin/sfp $tc
48
- done
49
-
50
- ##
51
- # Back to previous directory
52
- ##
53
- cd $CURRENTDIR
data/test/s.sfp DELETED
@@ -1,14 +0,0 @@
1
-
2
-
3
- b
4
-
5
- a {
6
- x is true
7
- refer is b
8
- }
9
-
10
- a.x is false
11
-
12
- a.refer is null
13
-
14
-
@@ -1,151 +0,0 @@
1
- include "cloud-schemas.sfp"
2
-
3
- schema Service {
4
- installed is false
5
- running is false
6
- on_machine isref Machine
7
-
8
- procedure install ( m isref Machine ) {
9
- conditions {
10
- m.running is true
11
- this.installed is false
12
- }
13
- effects {
14
- this.on_machine is m
15
- this.installed is true
16
- }
17
- }
18
- procedure uninstall {
19
- conditions {
20
- this.on_machine.running is true
21
- this.installed is true
22
- }
23
- effects {
24
- this.on_machine is null
25
- this.installed is false
26
- }
27
- }
28
-
29
- procedure start {
30
- conditions {
31
- this.installed is true
32
- this.running is false
33
- }
34
- effects {
35
- this.running is true
36
- }
37
- }
38
- procedure stop {
39
- conditions {
40
- this.installed is true
41
- this.running is true
42
- }
43
- effects {
44
- this.running is false
45
- }
46
- }
47
- }
48
-
49
- schema LoadBalancer extends Service {
50
- webs isset WebService
51
-
52
- procedure start {
53
- conditions {
54
- this.installed is true
55
- this.running is false
56
- exist (this.webs as web) {
57
- web.running is true
58
- }
59
- }
60
- effects {
61
- this.running is true
62
- }
63
- }
64
- }
65
-
66
- schema WebService extends Service {
67
- depend_on isref AppService
68
-
69
- procedure redirect ( app isref AppService ) {
70
- conditions {
71
- this.installed is true
72
- app.running is true
73
- }
74
- effects {
75
- this.depend_on is app
76
- }
77
- }
78
- procedure start {
79
- conditions {
80
- this.installed is true
81
- this.running is false
82
- this.depend_on.running is true
83
- }
84
- effects {
85
- this.running is true
86
- }
87
- }
88
- procedure stop {
89
- conditions {
90
- this.installed is true
91
- this.running is true
92
- forall (LoadBalancer as lb) {
93
- if lb.webs has this then lb.running is false
94
- }
95
- }
96
- effects {
97
- this.running is false
98
- }
99
- }
100
- }
101
-
102
- schema AppService extends Service {
103
- depend_on isref DatabaseService
104
-
105
- procedure redirect ( db isref DatabaseService ) {
106
- conditions {
107
- this.installed is true
108
- db.running is true
109
- }
110
- effects {
111
- this.depend_on is db
112
- }
113
- }
114
- procedure start {
115
- conditions {
116
- this.installed is true
117
- this.running is false
118
- this.depend_on.running is true
119
- }
120
- effects {
121
- this.running is true
122
- }
123
- }
124
- procedure stop {
125
- conditions {
126
- this.installed is true
127
- this.running is true
128
- forall (WebService as ws) {
129
- if ws.depend_on is this then ws.running is false
130
- }
131
- }
132
- effects {
133
- this.running is false
134
- }
135
- }
136
- }
137
-
138
- schema DatabaseService extends Service {
139
- procedure stop {
140
- conditions {
141
- this.installed is true
142
- this.running is true
143
- forall (AppService as app) {
144
- if app.depend_on is this then app.running is false
145
- }
146
- }
147
- effects {
148
- this.running is false
149
- }
150
- }
151
- }
Binary file
@@ -1,20 +0,0 @@
1
- schema S {
2
- foo is true
3
- procedure change {
4
- conditions {
5
- }
6
- effects {
7
- this.foo is false
8
- }
9
- }
10
- }
11
-
12
- initial state {
13
- a isa S
14
- b isa S
15
- }
16
-
17
- goal constraint {
18
- a.foo is false
19
- b.foo is false
20
- }
data/test/test1.inc DELETED
@@ -1,9 +0,0 @@
1
- class S {
2
- foo is true
3
- procedure change {
4
- conditions { }
5
- effects {
6
- this.foo is false
7
- }
8
- }
9
- }
data/test/test1.sfp DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env sfp
2
-
3
- include "test1.inc"
4
-
5
- initial state {
6
- a isa S
7
- b isa S
8
- }
9
-
10
- goal constraint {
11
- a.foo is false
12
- b.foo is false
13
- }
data/test/test2.sfp DELETED
@@ -1,20 +0,0 @@
1
- schema S {
2
- foo is true
3
- procedure change {
4
- conditions {
5
- }
6
- effects {
7
- this.foo is false
8
- }
9
- }
10
- }
11
-
12
- initial state {
13
- a isa S
14
- b isa S
15
- }
16
-
17
- goal constraint {
18
- a.foo is false
19
- b.foo is false
20
- }
data/test/test3.inc DELETED
@@ -1,40 +0,0 @@
1
- class Service {
2
- installed is false
3
- running is false
4
-
5
- procedure install {
6
- conditions {
7
- this.installed is false
8
- }
9
- effects {
10
- this.installed is true
11
- }
12
- }
13
- procedure uninstall {
14
- conditions {
15
- this.installed is true
16
- }
17
- effects {
18
- this.installed is false
19
- }
20
- }
21
-
22
- procedure start {
23
- conditions {
24
- this.installed is true
25
- this.running is false
26
- }
27
- effects {
28
- this.running is true
29
- }
30
- }
31
- procedure stop {
32
- conditions {
33
- this.installed is true
34
- this.running is true
35
- }
36
- effects {
37
- this.running is false
38
- }
39
- }
40
- }
data/test/test3.sfp DELETED
@@ -1,17 +0,0 @@
1
- include "test3.inc"
2
-
3
- // generate all possible states with constraint solver
4
- initial state {
5
- s1 isa Service
6
- s2 isa Service
7
- s3 isa Service
8
- }
9
- goal constraint {
10
- s1.running
11
- s2.running
12
- s3.running
13
- }
14
- global constraint {
15
- if s1.running then s2.running
16
- if s2.running then s3.running
17
- }
data/test/test4.inc DELETED
@@ -1,28 +0,0 @@
1
- schema Service {
2
- running is false
3
- procedure start {
4
- conditions {
5
- this.running is false
6
- }
7
- effects {
8
- this.running is true
9
- }
10
- }
11
- procedure stop {
12
- conditions {
13
- this.running is true
14
- }
15
- effects {
16
- this.running is false
17
- }
18
- }
19
- }
20
- schema Client {
21
- refer isref Service
22
- procedure redirect(s isref Service) {
23
- conditions { }
24
- effects {
25
- this.refer is s
26
- }
27
- }
28
- }
data/test/test4.sfp DELETED
@@ -1,22 +0,0 @@
1
- include "test4.inc"
2
-
3
- initial state {
4
- a isa Service {
5
- running is true
6
- }
7
-
8
- b isa Service // with "running" is false
9
-
10
- pc isa Client {
11
- refer is a
12
- }
13
- }
14
-
15
- goal constraint {
16
- pc.refer is b
17
- a.running is false
18
- }
19
-
20
- global constraint {
21
- pc.refer.running is true
22
- }