Second cut of the new policy configuration system
[aquarium] / src / main / resources / policy.scala
1 import gr.grnet.aquarium.charging.{ContinuousChargingBehavior, OnOffChargingBehavior, DiscreteChargingBehavior}
2 import gr.grnet.aquarium.policy.{EffectiveUnitPrice, EffectivePriceTable, FullPriceTable, ResourceType, StdPolicy}
3 import gr.grnet.aquarium.Timespan
4
5 // Definition of our standard policy in plain Scala
6 // This will be dynamically interpreted during Aquarium startup
7
8 StdPolicy(
9     id = "policy-1",
10     parentID = None,
11     validityTimespan = Timespan(0),
12     resourceTypes = Set(
13       ResourceType("bandwidth", "MB/Hr", DiscreteChargingBehavior),
14       ResourceType("vmtime",    "Hr",    OnOffChargingBehavior),
15       ResourceType("diskspace", "MB/Hr", ContinuousChargingBehavior)
16     ),
17     chargingBehaviorClasses = Set(
18       DiscreteChargingBehavior.getClass.getName,
19       OnOffChargingBehavior.getClass.getName,
20       ContinuousChargingBehavior.getClass.getName
21     ),
22     roleMapping = Map(
23       "default" -> FullPriceTable(Map(
24         "bandwidth" -> EffectivePriceTable(EffectiveUnitPrice(0.01, Nil) :: Nil),
25         "vmtime"    -> EffectivePriceTable(EffectiveUnitPrice(0.01, Nil) :: Nil),
26         "diskspace" -> EffectivePriceTable(EffectiveUnitPrice(0.01, Nil) :: Nil)
27       ))
28     )
29   )