Updated code to work with SLA-Collector module (local instance)
[unfold.git] / sla / slaclient / templates / fed4fire / fed4fire.py
index efb939c..c98e43c 100755 (executable)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-\r
 # -*- coding: utf-8 -*-\r
-"""Template system for xifi project.\r
+"""Template system for fed4fire project.\r
 \r
 The specific template system is configured with the factory module variable.\r
 \r
 \r
 The specific template system is configured with the factory module variable.\r
 \r
@@ -32,7 +32,7 @@ Usage:
     data = sla.slaclient.templates.fed4fire.TemplateInput(template_id="template-test")\r
     slatemplate_xml = sla.slaclient.templates.fed4fire.render_slatemplate(data)\r
 \r
     data = sla.slaclient.templates.fed4fire.TemplateInput(template_id="template-test")\r
     slatemplate_xml = sla.slaclient.templates.fed4fire.render_slatemplate(data)\r
 \r
-Notes about agreements in XiFi:\r
+Notes about agreements in fed4fire:\r
     The ws-agreement specification does not address where to place the name/id\r
     of the service (as known outside SLA) being defined in the\r
     agreement/template xml. So, it has been defined an element\r
     The ws-agreement specification does not address where to place the name/id\r
     of the service (as known outside SLA) being defined in the\r
     agreement/template xml. So, it has been defined an element\r
@@ -43,7 +43,7 @@ Notes about agreements in XiFi:
     The guarantee terms, service description terms, etc, use the attribute\r
     serviceName to reference (internally in the xml) the service. So, there\r
     could be more than one serviceName in a xml (as opposed to the former\r
     The guarantee terms, service description terms, etc, use the attribute\r
     serviceName to reference (internally in the xml) the service. So, there\r
     could be more than one serviceName in a xml (as opposed to the former\r
-    serviceId). In Xifi, there is only one service per agreement, so we\r
+    serviceId). In fed4fire, there is only one service per agreement, so we\r
     can give serviceId and serviceName the same value.\r
 \r
     A ServiceReference defines how a serviceName is known externally: a\r
     can give serviceId and serviceName the same value.\r
 \r
     A ServiceReference defines how a serviceName is known externally: a\r
@@ -68,7 +68,7 @@ Notes about agreements in XiFi:
     (they are used to describe the service to be instantiated), so we can\r
     extrapolate the location as the "abstract location of the metric".\r
 \r
     (they are used to describe the service to be instantiated), so we can\r
     extrapolate the location as the "abstract location of the metric".\r
 \r
-    In summary, in XiFi, the service properties will hold the metrics being\r
+    In summary, in fed4fire, the service properties will hold the metrics being\r
     monitored for a service.\r
 \r
     And the guarantee terms hold the constraints that are being enforced for\r
     monitored for a service.\r
 \r
     And the guarantee terms hold the constraints that are being enforced for\r
@@ -88,11 +88,11 @@ Notes about agreements in XiFi:
             </wsag:ServiceLevelObjective>\r
         </wsag:GuaranteeTerm>\r
 \r
             </wsag:ServiceLevelObjective>\r
         </wsag:GuaranteeTerm>\r
 \r
-    * Name is a name for the guarantee term. In Xifi, the name will have the\r
+    * Name is a name for the guarantee term. In fed4fire, the name will have the\r
       value "GT_<metric_name>"\r
     * ServiceName is an internal reference in the agreement to the service\r
       being enforced, as an agreement can created for more than one service.\r
       value "GT_<metric_name>"\r
     * ServiceName is an internal reference in the agreement to the service\r
       being enforced, as an agreement can created for more than one service.\r
-      In Xifi, to my knowledge, one service: one agreement, so this service\r
+      In fed4fire, to my knowledge, one service: one agreement, so this service\r
       name is not really important.\r
     * KpiName is a name given to the constraint, and I am using the same name\r
       as the service property used in the constraint. This makes more sense\r
       name is not really important.\r
     * KpiName is a name given to the constraint, and I am using the same name\r
       as the service property used in the constraint. This makes more sense\r
@@ -133,7 +133,7 @@ def render_slaagreement(data):
     print "render_slaagreement"\r
     template = _getfactory().slaagreement()\r
     #pdb.set_trace()\r
     print "render_slaagreement"\r
     template = _getfactory().slaagreement()\r
     #pdb.set_trace()\r
-    rendered = template.render(data) \r
+    rendered = template.render(data)\r
     return rendered\r
 \r
 \r
     return rendered\r
 \r
 \r
@@ -248,7 +248,7 @@ class AgreementInput(object):
         self.template_id = template_id\r
         self.expiration_time = expiration_time\r
         self.expiration_time_iso = \\r
         self.template_id = template_id\r
         self.expiration_time = expiration_time\r
         self.expiration_time_iso = \\r
-            expiration_time.isoformat() if expiration_time else None\r
+            expiration_time if expiration_time else None\r
         self.service_properties = service_properties\r
         self.guarantee_terms = guarantee_terms\r
 \r
         self.service_properties = service_properties\r
         self.guarantee_terms = guarantee_terms\r
 \r