Add DSL field to describe different instances for complex resources
[aquarium] / src / test / resources / policy.yaml
1 aquariumpolicy:
2   resources:
3     - resource:
4       name: bandwidthup
5       unit: MB
6       complex: false
7       costpolicy: diff
8     - resource:
9       name: bandwidthdown
10       unit: MB
11       complex: false
12       costpolicy: diff
13     - resource:
14       name: vmtime
15       unit: Hour
16       complex: true
17       costpolicy: onoff
18       descriminatorfield: vmid
19     - resource:
20       name: diskspace
21       unit: MB
22       complex: false
23       costpolicy: diff
24
25   implicitvars:
26     - price
27     - volume
28
29   algorithms:
30     - algorithm:
31       name: default
32       bandwidthup: $price times $volume
33       bandwidthdown: $price times $volume
34       vmtime: $price times $volume
35       diskspace: $price times $volume
36       effective:
37         from: 0
38     - algorithm:
39       name: freedisk
40       overrides: default
41       diskspace: 0
42       effective:
43         repeat:
44           - start: "00 00 12 * *"
45             end:   "00 00 14 * *"
46           - start: "00 00 18 * *"
47             end:   "00 00 20 * *"
48         from: 0
49         to: 124443
50
51   pricelists:
52     - pricelist: 
53       name: default
54       bandwidthup: 0.01
55       bandwidthdown: 0.02
56       vmtime: 0.1
57       diskspace: 0.05
58       effective:
59         from: 0
60     - pricelist: 
61       name: everyTue2
62       overrides: default
63       bandwidthup: 0.01
64       bandwidthdown: 0.02
65       vmtime: 0.1
66       diskspace: 0.05
67       effective:
68         repeat:
69           - start: "00 02 * * Tue"
70             end:   "00 02 * * Wed"
71         from: 0
72     - pricelist:
73       name: foobar
74       overrides: default
75       bandwidthup: 0.04
76       bandwidthdown: 0.04
77       vmtime: 0.6
78       diskspace: 0.05
79       effective:
80         repeat:
81           - start: "00 12 * * *"
82             end:   "00 14 * * *"
83           - start: "00 18 * * *"
84             end:   "00 20 * * *"
85         from: 0
86
87   creditplans:
88     - creditplan:
89       name: default
90       credits: 100
91       at: "00 00 1 * *"
92       effective:
93         from: 0
94     - creditplan:
95       name: every10days
96       at: "00 00 1,10,20,30 * *"
97       credits: 20
98       effective:
99         from: 0
100
101   agreements:
102     - agreement:
103       name: default
104       algorithm: default
105       pricelist: default
106       creditplan: default
107
108     - agreement:
109       overrides: default
110       name: scaledbandwidth
111       pricelist: foobar
112       algorithm:
113         bandwidthup: |
114                 if $volume gt 15 then
115                   $volume times $price
116                 elsif $volume gt 15 and volume lt 30 then
117                   $volume times $price times 1.2
118                 else
119                   $volume times price times 1.4
120                 end
121
122     - agreement:
123       overrides: default
124       name: onemonthexperiment
125       creditplan:
126         at: "00 00 * * *"
127         credits: 100
128         effective:
129           from: 1322061528 #Wed 23 Nov 2011 17:18
130           to: 1324661839 #Fri, 23 Dec 2011 17:37
131