Parse credit plans and associate them with agreements
[aquarium] / logic / src / test / resources / policy.yaml
index ad3787a..022488f 100644 (file)
@@ -1,4 +1,4 @@
-creditpolicy:
+aquariumpolicy:
   resources:
     - bandwidthup
     - bandwidthdown
@@ -9,8 +9,8 @@ creditpolicy:
     - price
     - volume
 
-  policies:
-    - policy: &defpolicy
+  algorithms:
+    - algorithm:
       name: default
       bandwidthup: $price times $volume
       bandwidthdown: $price times $volume
@@ -24,13 +24,13 @@ creditpolicy:
             end:   "00 00 20 * *"
         from: 0
         to: 124443
-    - policy: &freedisk
+    - algorithm:
       name: freedisk
       overrides: default
       diskspace: 0
 
   pricelists:
-    - pricelist: &defpricelist
+    - pricelist: 
       name: default
       bandwidthup: 0.01
       bandwidthdown: 0.02
@@ -38,7 +38,7 @@ creditpolicy:
       diskspace: 0.05
       effective:
         from: 0
-    - pricelist: &everyTue2
+    - pricelist: 
       name: everyTue2
       bandwidthup: 0.01
       bandwidthdown: 0.02
@@ -46,8 +46,8 @@ creditpolicy:
       diskspace: 0.05
       effective:
         repeat:
-          - start: "00 00 2 Tue *"
-            end:   "00 00 2 Wed *"
+          - start: "00 02 * * Tue"
+            end:   "00 02 * * Wed"
         from: 0
     - pricelist:
       name: foobar
@@ -57,22 +57,37 @@ creditpolicy:
       diskspace: 0.05
       effective:
         repeat:
-          - start: "00 00 12 * *"
-            end:   "00 00 14 * *"
-          - start: "00 00 18 * *"
-            end:   "00 00 20 * *"
+          - start: "00 12 * * *"
+            end:   "00 14 * * *"
+          - start: "00 18 * * *"
+            end:   "00 20 * * *"
+        from: 0
+
+  creditplans:
+    - creditplan:
+      name: default
+      credits: 100
+      at: "00 00 1 * *"
+      effective:
+        from: 0
+    - creditplan:
+      name: every10days
+      at: "00 00 1,10,20,30 * *"
+      credits: 20
+      effective:
         from: 0
 
   agreements:
     - agreement:
       name: default
-      policy: *defpolicy
-      pricelist: *defpricelist
+      algorithm: default
+      pricelist: default
+      creditplan: default
 
     - agreement:
       overrides: default
       name: scaledbandwidth
-      policy:
+      algorithm:
         bandwidthup: |
                 if $volume gt 15 then
                   $volume times $price
@@ -84,5 +99,11 @@ creditpolicy:
 
     - agreement:
       overrides: default
-      name: variablepricelist
+      name: onemonthexperiment
+      creditplan:
+        at: "00 00 * * *"
+        credits: 100
+        effective:
+          from: 1322061528 #Wed 23 Nov 2011 17:18
+          to: 1324661839 #Fri, 23 Dec 2011 17:37