From f320a65ac7928a4a1c8315443880dce1d7afc997 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Javier=20Garc=C3=ADa?= Date: Thu, 24 Jul 2014 13:25:24 +0200 Subject: [PATCH] Updated code to work with SLA-Collector module (local instance) --- myslice/settings.py | 12 +- .../queryupdater/static/js/queryupdater.js | 8 +- sla/slaclient/restclient.py | 71 ++++--- .../service/fed4fire/fed4fireservice.py | 57 +++--- sla/slaclient/service/fed4fire/jsonparser.py | 2 - sla/slaclient/templates/fed4fire/fed4fire.py | 16 +- sla/slaclient/wsag_model.py | 42 ++-- sla/slaclient/xmlconverter.py | 39 ++-- sla/slicetabsla.py | 78 ++++++-- sla/templates/slice-tab-sla.html | 179 +++++++----------- sla/urls.py | 13 +- 11 files changed, 272 insertions(+), 245 deletions(-) diff --git a/myslice/settings.py b/myslice/settings.py index 235a18ca..1f5f662d 100644 --- a/myslice/settings.py +++ b/myslice/settings.py @@ -278,7 +278,8 @@ LOGGING = { } } -AUTHENTICATION_BACKENDS = ( 'auth.manifoldbackend.ManifoldBackend','django.contrib.auth.backends.ModelBackend' ) +AUTHENTICATION_BACKENDS = ('auth.manifoldbackend.ManifoldBackend', + 'django.contrib.auth.backends.ModelBackend') ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests # without this setting django will return a 403 forbidden error, which is fine @@ -292,6 +293,9 @@ CSRF_FAILURE_VIEW = 'manifoldapi.manifoldproxy.csrf_failure' ####SLA##### -SLA_MANAGER_URL = "http://157.193.215.125:4000/sla-service" -SLA_MANAGER_USER = "normal_user" -SLA_MANAGER_PASSWORD = "password" \ No newline at end of file +#SLA_MANAGER_URL = "http://157.193.215.125:4000/sla-service" +# SLA_MANAGER_USER = "normal_user" +# SLA_MANAGER_PASSWORD = "password" +SLA_MANAGER_URL = "http://172.24.76.98:8080/sla" +SLA_MANAGER_USER = "" +SLA_MANAGER_PASSWORD = "" diff --git a/plugins/queryupdater/static/js/queryupdater.js b/plugins/queryupdater/static/js/queryupdater.js index 3057cf5b..5d017b9d 100644 --- a/plugins/queryupdater/static/js/queryupdater.js +++ b/plugins/queryupdater/static/js/queryupdater.js @@ -135,7 +135,7 @@ { flagDouble = true; promt.append('

Testbed guarantees 0.99 Uptime rate for 0.99 rate of the WiLab2 resources during the sliver lifetime

'); - promt.append(wilabForm); + //promt.append(wilabForm); promt.append('
'); } if(flagVW) @@ -143,7 +143,7 @@ //promt.append(wallmessage); flagDouble = true; promt.append('

Testbed guarantees 0.99 Uptime rate for 0.99 rate of the VirtualWall resources during the sliver lifetime

'); - promt.append(wallForm); + //promt.append(wallForm); promt.append('
'); } @@ -203,11 +203,11 @@ "user": username, "expiration_time": new Date().toISOString() }); - + $('#slamodal-wilab2').modal('hide'); accepted_sla["wilab2"] = true; - manifold.raise_event(self.options.query_uuid, RUN_UPDATE); + //manifold.raise_event(self.options.query_uuid, RUN_UPDATE); } $('#modal-body').empty(); }); diff --git a/sla/slaclient/restclient.py b/sla/slaclient/restclient.py index c00ca2f5..5d1641f7 100755 --- a/sla/slaclient/restclient.py +++ b/sla/slaclient/restclient.py @@ -12,13 +12,13 @@ from django.conf import settings """REST client to SLA Manager. -Contains a generic rest client and wrappers over this generic client +Contains a generic rest client and wrappers over this generic client for each resource. Each resource client implements business-like() functions, but returns a tuple (output, requests.Response) -The resource clients are initialized with the rooturl and a path, which +The resource clients are initialized with the rooturl and a path, which are combined to build the resource url. The path is defaulted to the known resource path. So, for example, to create a agreements client: @@ -32,21 +32,19 @@ c = restclient.Factory.agreements() """ -_PROVIDERS_PATH = "providerso" -_AGREEMENTS_PATH = "agreementso" -_TEMPLATES_PATH = "templateso" -_VIOLATIONS_PATH = "violationso" +_PROVIDERS_PATH = "providers" +_AGREEMENTS_PATH = "agreements" +_TEMPLATES_PATH = "templates" +_VIOLATIONS_PATH = "violations" _ENFORCEMENTJOBS_PATH = "enforcements" rooturl = settings.SLA_MANAGER_URL -# SLA_MANAGER_USER = "normal_user" -# SLA_MANAGER_PASSWORD = "password" class Factory(object): @staticmethod def agreements(): - """Returns aREST client for Agreements + """Returns a REST client for Agreements :rtype : Agreements """ @@ -54,7 +52,7 @@ class Factory(object): @staticmethod def providers(): - """Returns aREST client for Providers + """Returns a REST client for Providers :rtype : Providers """ @@ -62,7 +60,7 @@ class Factory(object): @staticmethod def violations(): - """Returns aREST client for Violations + """Returns a REST client for Violations :rtype : Violations """ @@ -70,7 +68,7 @@ class Factory(object): @staticmethod def templates(): - """Returns aREST client for Violations + """Returns a REST client for Violations :rtype : Violations """ @@ -78,12 +76,13 @@ class Factory(object): @staticmethod def enforcements(): - """Returns aREST client for Enforcements jobs + """Returns a REST client for Enforcements jobs :rtype : Enforcements """ return Enforcements(rooturl) + class Client(object): def __init__(self, root_url): @@ -104,22 +103,28 @@ class Client(object): Returns a requests.Response :rtype : request.Response - :param str path: remaining path from root url; + :param str path: remaining path from root url; empty if desired path equal to rooturl. :param kwargs: arguments to requests.get - - Example: + + Example: c = Client("http://localhost:8080/service") c.get("/resource", headers = { "accept": "application/json" }) """ url = _buildpath_(self.rooturl, path) - kwargs["auth"] = HTTPBasicAuth(settings.SLA_MANAGER_USER, settings.SLA_MANAGER_PASSWORD) + url = url + "?testbed=iminds" # TODO remove hardcoded string + #kwargs['params']['testbed'] = 'iminds' + + if "headers" not in kwargs: + kwargs["headers"] = {"accept": "application/xml"} + # kwargs["auth"] = HTTPBasicAuth(settings.SLA_MANAGER_USER, + # settings.SLA_MANAGER_PASSWORD) result = requests.get(url, **kwargs) - print "GET {} {} {}".format( - result.url, result.status_code, result.text[0:70]) + #print "GET {} {} {}".format( + # result.url, result.status_code, result.text[0:70]) return result - + def post(self, path, data=None, **kwargs): """Just a wrapper over request.post, just in case @@ -140,7 +145,12 @@ class Client(object): ) """ url = _buildpath_(self.rooturl, path) - kwargs["auth"] = HTTPBasicAuth(settings.SLA_MANAGER_USER, settings.SLA_MANAGER_PASSWORD) + url = url + "?testbed=iminds" # TODO remove hardcoded string + # kwargs["auth"] = HTTPBasicAuth(settings.SLA_MANAGER_USER, + # settings.SLA_MANAGER_PASSWORD) + if "headers" not in kwargs: + kwargs = {"accept": "application/xml", + "content-type": "application/xml"} result = requests.post(url, data, **kwargs) location = result.headers["location"] \ if "location" in result.headers else "" @@ -148,7 +158,6 @@ class Client(object): result.url, result.status_code, location) return result - class _Resource(object): @@ -184,7 +193,7 @@ class _Resource(object): content_type = r.headers.get('content-type', '') - print("content-type = " + content_type) + #print("content-type = " + content_type) if content_type == 'application/json': result = r.json() elif content_type == 'application/xml': @@ -282,11 +291,11 @@ class Agreements(object): r = self.res.client.get(path, headers={'accept': 'application/json'}) json_obj = r.json() - + status = wsag_model.AgreementStatus.json_decode(json_obj) return status, r - + def create(self, agreement): """Create a new agreement @@ -294,6 +303,7 @@ class Agreements(object): """ return self.res.create(agreement) + class Templates(object): def __init__(self, root_url, path=_TEMPLATES_PATH): @@ -328,6 +338,7 @@ class Templates(object): """ self.res.create(template) + class Providers(object): def __init__(self, root_url, path=_PROVIDERS_PATH): @@ -363,6 +374,7 @@ class Providers(object): body = provider.to_xml() return self.res.create(body) + class Violations(object): def __init__(self, root_url, path=_VIOLATIONS_PATH): @@ -397,6 +409,7 @@ class Violations(object): violations from all terms will be returned :rtype: list[wsag_model.Violation] """ + return self.res.get( {"agreementId": agreement_id, "guaranteeTerm": term}) @@ -424,10 +437,10 @@ class Enforcements(object): """Get the enforcement of an agreement. :param str agreement_id: - + :rtype: list[wsag_model.Enforcement] """ - return self.res.getbyid(agreement_id) + return self.res.getbyid(agreement_id) def _buildpath_(*paths): @@ -440,7 +453,6 @@ def main(): # global rooturl rooturl = "http://127.0.0.1:8080/sla-service" - c = Factory.templates() #r = c.getall() @@ -450,12 +462,9 @@ def main(): #r = c.getbyconsumer('RandomClient') r = c.getbyid("template02") - print r if __name__ == "__main__": main() - - diff --git a/sla/slaclient/service/fed4fire/fed4fireservice.py b/sla/slaclient/service/fed4fire/fed4fireservice.py index caecf26e..f11e8a1c 100755 --- a/sla/slaclient/service/fed4fire/fed4fireservice.py +++ b/sla/slaclient/service/fed4fire/fed4fireservice.py @@ -5,9 +5,9 @@ to sla manager. It is intended as backend service for a rest interface. The json input must work together with the templates to form a valid template - or agreement for Xifi (be careful!) + or agreement for fed4fire (be careful!) -This (very simple) service is coupled to the way xifi is interpreting +This (very simple) service is coupled to the way fed4fire is interpreting ws-agreement. @@ -18,10 +18,13 @@ from sla.slaclient import wsag_model from sla.slaclient import restclient from sla.slaclient.templates.fed4fire.django.factory import Factory as TemplateFactory import sla.slaclient.templates.fed4fire as fed4fire -from time import localtime, strftime +#from time import localtime, strftime import uuid +import dateutil.parser + + class ServiceContext(object): - def __init__(self, restfactory = None, templatefactory=None): + def __init__(self, restfactory=None, templatefactory=None): """ :type restfactory: restclient.Factory """ @@ -109,30 +112,36 @@ def createagreement(json_data, context): client_agreements = context.restfactory.agreements() return client_agreements.create(slaagreement) - + def createagreementsimplified(template_id, user, expiration_time): - context = ServiceContext( - restclient.Factory(), - TemplateFactory() - ) - - agreement = { - "agreement_id": str(uuid.uuid4()), - "template_id": template_id, - "expiration_time": expiration_time, - "consumer": user, - } - - json_data = json.dumps(agreement) - - return createagreement(json_data, context) - + context = ServiceContext( + restclient.Factory(), + TemplateFactory() + ) + + print "Expiration time: ", expiration_time + + time = dateutil.parser.parse(expiration_time) + print "ISO FORMAT: ", time.strftime('%Y-%m-%dT%H:%M:%S%Z') + + agreement = { + "agreement_id": str(uuid.uuid4()), + "template_id": template_id, + "expiration_time": time.strftime('%Y-%m-%dT%H:%M:%S%Z'), + "consumer": user, + } + + json_data = json.dumps(agreement) + + return createagreement(json_data, context) + + def main(): - createagreementsimplified("iMindsServiceWiLab2", "virtualwall", "2014-04-34T23:12:12") + createagreementsimplified("iMindsServiceWiLab2", + "virtualwall", + "2014-04-34T23:12:12") if __name__ == "__main__": main() - - diff --git a/sla/slaclient/service/fed4fire/jsonparser.py b/sla/slaclient/service/fed4fire/jsonparser.py index 3dc8fca3..04d01a8e 100755 --- a/sla/slaclient/service/fed4fire/jsonparser.py +++ b/sla/slaclient/service/fed4fire/jsonparser.py @@ -69,8 +69,6 @@ def agreementinput_from_json(json_data): } """ d = json.loads(json_data) - if "expiration_time" in d: - d["expiration_time"] = dateutil.parser.parse(d["expiration_time"]) t = AgreementInput( agreement_id=d.get("agreement_id", None), diff --git a/sla/slaclient/templates/fed4fire/fed4fire.py b/sla/slaclient/templates/fed4fire/fed4fire.py index efb939c7..c98e43c0 100755 --- a/sla/slaclient/templates/fed4fire/fed4fire.py +++ b/sla/slaclient/templates/fed4fire/fed4fire.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -"""Template system for xifi project. +"""Template system for fed4fire project. The specific template system is configured with the factory module variable. @@ -32,7 +32,7 @@ Usage: data = sla.slaclient.templates.fed4fire.TemplateInput(template_id="template-test") slatemplate_xml = sla.slaclient.templates.fed4fire.render_slatemplate(data) -Notes about agreements in XiFi: +Notes about agreements in fed4fire: The ws-agreement specification does not address where to place the name/id of the service (as known outside SLA) being defined in the agreement/template xml. So, it has been defined an element @@ -43,7 +43,7 @@ Notes about agreements in XiFi: The guarantee terms, service description terms, etc, use the attribute serviceName to reference (internally in the xml) the service. So, there could be more than one serviceName in a xml (as opposed to the former - serviceId). In Xifi, there is only one service per agreement, so we + serviceId). In fed4fire, there is only one service per agreement, so we can give serviceId and serviceName the same value. A ServiceReference defines how a serviceName is known externally: a @@ -68,7 +68,7 @@ Notes about agreements in XiFi: (they are used to describe the service to be instantiated), so we can extrapolate the location as the "abstract location of the metric". - In summary, in XiFi, the service properties will hold the metrics being + In summary, in fed4fire, the service properties will hold the metrics being monitored for a service. And the guarantee terms hold the constraints that are being enforced for @@ -88,11 +88,11 @@ Notes about agreements in XiFi: - * Name is a name for the guarantee term. In Xifi, the name will have the + * Name is a name for the guarantee term. In fed4fire, the name will have the value "GT_" * ServiceName is an internal reference in the agreement to the service being enforced, as an agreement can created for more than one service. - In Xifi, to my knowledge, one service: one agreement, so this service + In fed4fire, to my knowledge, one service: one agreement, so this service name is not really important. * KpiName is a name given to the constraint, and I am using the same name as the service property used in the constraint. This makes more sense @@ -133,7 +133,7 @@ def render_slaagreement(data): print "render_slaagreement" template = _getfactory().slaagreement() #pdb.set_trace() - rendered = template.render(data) + rendered = template.render(data) return rendered @@ -248,7 +248,7 @@ class AgreementInput(object): self.template_id = template_id self.expiration_time = expiration_time self.expiration_time_iso = \ - expiration_time.isoformat() if expiration_time else None + expiration_time if expiration_time else None self.service_properties = service_properties self.guarantee_terms = guarantee_terms diff --git a/sla/slaclient/wsag_model.py b/sla/slaclient/wsag_model.py index f141d6ad..271a8f5c 100755 --- a/sla/slaclient/wsag_model.py +++ b/sla/slaclient/wsag_model.py @@ -1,4 +1,6 @@ from datetime import datetime +from dateutil import tz +import dateutil.parser """Contains the bean models for the SlaManager xml/json types """ @@ -23,7 +25,7 @@ class Agreement(object): repr(self.provider), repr(self.consumer), repr(self.service)) - + def service_formatted(self): return self.service.replace('_', ' ') @@ -31,8 +33,11 @@ class Agreement(object): return self.template_id.replace('Service', ' - ') def time_formatted(self): - import dateutil.parser + from_zone = tz.tzutc() + to_zone = tz.tzlocal() time = dateutil.parser.parse(self.expirationtime) + time = time.replace(tzinfo=from_zone) + time = time.astimezone(to_zone) return time.strftime('%d-%m-%Y at %H:%M:%S') class Property(object): @@ -43,7 +48,8 @@ class Agreement(object): self.location = "" def __repr__(self): - str_ = "" + str_ = "" return str_.format( repr(self.name), repr(self.servicename), @@ -69,7 +75,8 @@ class Agreement(object): self.customservicelevel = "" def __repr__(self): - s = "" + s = "" return s.format( repr(self.kpiname), repr(self.customservicelevel) @@ -113,7 +120,6 @@ class Agreement(object): class Template(Agreement): - #egarrido this code has been copied from xifi and has not beeing tested def __init__(self): super(Template, self).__init__() self.template_id = "" @@ -140,7 +146,8 @@ class Enforcement(object): return ("".format( self.agreement_id, self.enabled) - ) + ) + class AgreementStatus(object): @@ -167,9 +174,9 @@ class AgreementStatus(object): return ( "").format( - self.agreement_id, - self.guaranteestatus, - repr(self.guaranteeterms)) + self.agreement_id, + self.guaranteestatus, + repr(self.guaranteeterms)) @staticmethod def json_decode(json_obj): @@ -191,23 +198,25 @@ class Violation(object): self.uuid = "" self.contract_uuid = "" self.service_scope = "" + self.service_name = "" self.metric_name = "" self.datetime = datetime.utcnow() self.actual_value = 0 def __repr__(self): - return ("".format( + return ("\n".format( self.uuid, + self.datetime, self.contract_uuid, + self.service_name, self.service_scope, self.metric_name, - self.datetime, self.actual_value) - ) + ) def format_time(self): - # return datetime.strptime(self.datetime.datetime.utcnow,'%Y-%m-%d %H:%M:%S') # return str(datetime.fromtimestamp(self.datetime)) return str(self.datetime) @@ -222,7 +231,8 @@ class Provider(object): return ("".format( self.uuid, self.name) - ) + ) + def to_xml(self): xml = "{}{}""".format( self.uuid, @@ -240,4 +250,4 @@ class Provider(object): out = wsag_model.Provider.from_dict(json_obj) """ result = Provider(d["uuid"], d["name"]) - return result + return result diff --git a/sla/slaclient/xmlconverter.py b/sla/slaclient/xmlconverter.py index 831df53c..54b365ef 100755 --- a/sla/slaclient/xmlconverter.py +++ b/sla/slaclient/xmlconverter.py @@ -9,7 +9,7 @@ to a more-friendly POJO instances. The converters are designed to be pluggable: see ListConverter. -Usage: +Usage: c = AnyConverter() or c = ListConverter(AnyOtherConverter()) @@ -22,8 +22,12 @@ c.convert(root.getroot()) """ -from xml.etree import ElementTree -from xml.etree.ElementTree import Element +try: + # Much faster and lighter library (C implementation) + from xml.etree import cElementTree as ElementTree +except ImportError: + from xml.etree import ElementTree + import dateutil.parser from wsag_model import Agreement @@ -81,7 +85,13 @@ class ListConverter(Converter): def convert(self, xmlroot): result = [] - for item in xmlroot.find("items"): # loop through "items" children + # Converter for the old xml structure + # for item in xmlroot.find("items"): # loop through "items" children + # inner = self.innerconverter.convert(item) + # result.append(inner) + # return result + + for item in xmlroot: # loop through children inner = self.innerconverter.convert(item) result.append(inner) return result @@ -132,17 +142,19 @@ class EnforcementConverter(Converter): result.enabled = xmlroot.find("enabled").text return result + class ViolationConverter(Converter): """Converter for a violation. Input: - ce0e148f-dfac-4492-bb26-ad2e9a6965ec - agreement04 - - Performance - 2014-01-14T11:28:22Z - 0.09555700123360344 + 1d94627e-c318-41ba-9c45-42c95b67cc32 + 26e5d5b6-f5a1-4eb3-bc91-606e8f24fb09 + servicename1 + test1 + UpTime + 2014-07-17T09:32:00+02:00 + 0.0 Output: @@ -155,11 +167,13 @@ class ViolationConverter(Converter): result = Violation() result.uuid = xmlroot.find("uuid").text result.contract_uuid = xmlroot.find("contract_uuid").text + result.service_name = xmlroot.find("service_name").text result.service_scope = xmlroot.find("service_scope").text result.metric_name = xmlroot.find("metric_name").text result.actual_value = xmlroot.find("actual_value").text dt_str = xmlroot.find("datetime").text result.datetime = dateutil.parser.parse(dt_str) + return result @@ -168,10 +182,9 @@ class AgreementConverter(Converter): """Converter for an ws-agreement agreement or template. """ super(AgreementConverter, self).__init__() - self._namespaces = { + self._namespaces = { "wsag": "http://www.ggf.org/namespaces/ws-agreement", "sla": "http://sla.atos.eu", - "xifi": "http://sla.xifi.eu" } self.agreement_tags = ( "{{{}}}Agreement".format(self._namespaces["wsag"]), @@ -341,7 +354,7 @@ def _get_attribute(element, attrname): isns = (attrname[0] == '{') # - # Handle qnamed request: + # Handle qnamed request: # attrname = {uri}name # if isns: diff --git a/sla/slicetabsla.py b/sla/slicetabsla.py index 19655404..b220af13 100755 --- a/sla/slicetabsla.py +++ b/sla/slicetabsla.py @@ -20,6 +20,7 @@ from django.http import HttpResponse import json import traceback +from math import ceil class Rol: @@ -93,29 +94,66 @@ class SLAView (FreeAccessView, ThemeView): agreement_id = None enforcements = {} violations = {} + keys = ['provider','agreement','date','status','result','ok'] + ag_info = [] filter_ = None form = FilterForm(request.GET) if form.is_valid(): - print "IS VALID" - filter_ = _get_filter_from_form(form) + filter_ = _get_filter_from_form(form) consumer_id = _get_consumer_id(request) - + agreements = _get_agreements(agreement_id, consumer_id=consumer_id, filter_=filter_) - + for agreement in agreements: + row = [] + row.append(agreement.context.provider) # Provider + row.append(agreement) # Agreement + row.append(agreement.context.time_formatted()) # Date + enf = _get_enforcement(agreement.agreement_id) + if enf.enabled == 'true': - enforcements[agreement.agreement_id] = "ACTIVE" - else: - enforcements[agreement.agreement_id] = "UNACTIVE" - violations_list = _get_agreement_violations(agreement.agreement_id, "GT_Performance") - - if len(violations_list): - violations[agreement.agreement_id] = float(violations_list[0]["actualValue"])*100 + row.append('Evaluating') # Status + row.append('') # Result + row('') # Ok else: - violations[agreement.agreement_id] = 100 + if agreement.guaranteestatus == "NON_DETERMINED": + row.append('Provisioned') # Status + row.append('') # Result + row.append('') # Ok + + else: + row.append('Finished') # Status + + violations_list = _get_agreement_violations(agreement.agreement_id, "GT_Performance") + + if len(violations_list) > 0: + value = '%.2f'%float(violations_list[0].actual_value) + row.append('%d'%(float(value)*100)) # Result + else: + row.append('100') # Result + + if agreement.guaranteestatus == "VIOLATED": + row.append('false') # Ok + + if agreement.guaranteestatus == "FULFILLED": + row.append('true') # Ok + + ag_info.append(dict(zip(keys,row))) + + # enf = _get_enforcement(agreement.agreement_id) + # if enf.enabled == 'true': + # enforcements[agreement.agreement_id] = "ACTIVE" + # else: + # enforcements[agreement.agreement_id] = "UNACTIVE" + # violations_list = _get_agreement_violations(agreement.agreement_id, "GT_Performance") + + # if len(violations_list): + # violations[agreement.agreement_id] = float(violations_list[0]["actualValue"])*100 + # else: + # violations[agreement.agreement_id] = 100 template_env = {} # write something of our own instead @@ -126,13 +164,15 @@ class SLAView (FreeAccessView, ThemeView): template_env['slicename'] = slicename template_env['enforcements'] = enforcements template_env['last_violation_list'] = violations - + template_env['ag_info'] = ag_info + + # the prelude object in page contains a summary of the requirements() for all plugins # define {js,css}_{files,chunks} prelude_env = page.prelude_env() template_env.update(prelude_env) - - return render_to_response (self.template_name, template_env, context_instance=RequestContext(request)) + + return render_to_response(self.template_name, template_env, context_instance=RequestContext(request)) class AgreementsFilter(object): @@ -231,11 +271,7 @@ def agreement_term_violations(request, agreement_id, guarantee_name): except EmptyPage: # If page is out of range (e.g. 9999), deliver first page. violation_page = paginator.page(1) - - print "\n******************" - print violations[-1] - print "******************\n" - + context = { 'agreement_id': agreement_id, 'guarantee_term': agreement.guaranteeterms[guarantee_name], @@ -342,7 +378,7 @@ class AgreementSimple(APIView): #import pdb; pdb.set_trace() print "------------------------------------------------1" data = {} - for key, value in request.DATA.items(): + for key, value in request.DATA.items(): # jgarcia review this new_key = key data[new_key] = value diff --git a/sla/templates/slice-tab-sla.html b/sla/templates/slice-tab-sla.html index f09aa8de..e0b36ecf 100755 --- a/sla/templates/slice-tab-sla.html +++ b/sla/templates/slice-tab-sla.html @@ -4,31 +4,12 @@
- - - - - - - - + - - - - - - - {% for a in agreements %} - +{% for row in ag_info %} -
Provider
iMinds