git://git.onelab.eu
/
myslice.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5826fa4
)
Fixed sla creation calls and cleaned debug messages
author
Javier García
<javier.garcial.external@atos.net>
Fri, 24 Apr 2015 08:59:29 +0000
(10:59 +0200)
committer
Javier García
<javier.garcial.external@atos.net>
Fri, 24 Apr 2015 08:59:29 +0000
(10:59 +0200)
myslice/settings.py
patch
|
blob
|
history
plugins/sladialog/static/js/sladialog.js
patch
|
blob
|
history
sla/slaclient/restclient.py
patch
|
blob
|
history
sla/slaclient/xmlconverter.py
patch
|
blob
|
history
sla/slicetabsla.py
patch
|
blob
|
history
sla/templates/slice-tab-sla.html
patch
|
blob
|
history
sla/wsag_helper.py
patch
|
blob
|
history
diff --git
a/myslice/settings.py
b/myslice/settings.py
index
5fe2169
..
1581d39
100644
(file)
--- a/
myslice/settings.py
+++ b/
myslice/settings.py
@@
-360,5
+360,6
@@
CSRF_FAILURE_VIEW = 'manifoldapi.manifoldproxy.csrf_failure'
####SLA#####
SLA_COLLECTOR_URL = "http://157.193.215.125:4001/sla-collector/sla"
####SLA#####
SLA_COLLECTOR_URL = "http://157.193.215.125:4001/sla-collector/sla"
+#SLA_COLLECTOR_URL = "http://172.24.76.19:8000/sla"
SLA_COLLECTOR_USER = "portal"
SLA_COLLECTOR_PASSWORD = "password"
SLA_COLLECTOR_USER = "portal"
SLA_COLLECTOR_PASSWORD = "password"
diff --git
a/plugins/sladialog/static/js/sladialog.js
b/plugins/sladialog/static/js/sladialog.js
index
c118743
..
b76a23d
100644
(file)
--- a/
plugins/sladialog/static/js/sladialog.js
+++ b/
plugins/sladialog/static/js/sladialog.js
@@
-98,13
+98,14
@@
var urns = [];
var urns = [];
- record.resource.forEach(function(r) {
- if ($.inArray(r.component_id, record.resource) == -1) { // if not already selected
- urns.push(r.component_id);
- }
- });
+ if (record.resource.length != 0 && typeof record.resource[0] === "object") {
+
+ record.resource.forEach(function(r) {
+ if ($.inArray(r.component_id, record.resource) == -1) { // if not already selected
+ urns.push(r.component_id);
+ }
+ });
- if (record.resource.length != 0 && typeof record.resource[0] !== "undefined") {
var data = {
"SLIVER_INFO_AGGREGATE_URN": record.resource[0].component_manager_id,
"SLIVER_INFO_EXPIRATION": record.lease[0].end_time, // FIXME: only working with leases
var data = {
"SLIVER_INFO_AGGREGATE_URN": record.resource[0].component_manager_id,
"SLIVER_INFO_EXPIRATION": record.lease[0].end_time, // FIXME: only working with leases
diff --git
a/sla/slaclient/restclient.py
b/sla/slaclient/restclient.py
index
e6c516d
..
a344554
100755
(executable)
--- a/
sla/slaclient/restclient.py
+++ b/
sla/slaclient/restclient.py
@@
-126,7
+126,6
@@
class Client(object):
# for key, values in kwargs.iteritems():
# print key, values
# for key, values in kwargs.iteritems():
# print key, values
- logger.debug('SLA GET {}'.format(url))
result = requests.get(url, **kwargs)
logger.debug('SLA GET {} - result: {}'.format(result.url, result.status_code))
# print "GET {} {} {}".format(
result = requests.get(url, **kwargs)
logger.debug('SLA GET {} - result: {}'.format(result.url, result.status_code))
# print "GET {} {} {}".format(
@@
-170,7
+169,7
@@
class Client(object):
result = requests.post(url, data, **kwargs)
location = result.headers["location"] \
if "location" in result.headers else "<null>"
result = requests.post(url, data, **kwargs)
location = result.headers["location"] \
if "location" in result.headers else "<null>"
- print "POST {} {} Location: {}".format(
+ print "POST {} {}
-
Location: {}".format(
result.url, result.status_code, location)
return result
result.url, result.status_code, location)
return result
diff --git
a/sla/slaclient/xmlconverter.py
b/sla/slaclient/xmlconverter.py
index
1d3e22e
..
35dc58c
100755
(executable)
--- a/
sla/slaclient/xmlconverter.py
+++ b/
sla/slaclient/xmlconverter.py
@@
-201,9
+201,8
@@
class AgreementConverter(Converter):
:param Element xmlroot: root element of xml to convert.
:rtype: wsag_model.Agreement
"""
:param Element xmlroot: root element of xml to convert.
:rtype: wsag_model.Agreement
"""
- for name, value in xmlroot.attrib.items():
- logger.debug('SLA xmlconverter: {} = {}'.format(name, value))
- # print '{0}="{1}"'.format(name, value)
+ # for name, value in xmlroot.attrib.items():
+ # logger.debug('SLA xmlconverter: {} = {}'.format(name, value))
if xmlroot.tag in self.agreement_tags:
result = Agreement()
if xmlroot.tag in self.agreement_tags:
result = Agreement()
diff --git
a/sla/slicetabsla.py
b/sla/slicetabsla.py
index
5fcdc04
..
c9043f6
100755
(executable)
--- a/
sla/slicetabsla.py
+++ b/
sla/slicetabsla.py
@@
-3,6
+3,7
@@
from __future__ import print_function
# this somehow is not used anymore - should it not be ?
import ast
from datetime import datetime
# this somehow is not used anymore - should it not be ?
import ast
from datetime import datetime
+import json
import pytz
from django.template import RequestContext
from django.shortcuts import render_to_response
import pytz
from django.template import RequestContext
from django.shortcuts import render_to_response
@@
-117,7
+118,8
@@
class SLAView(FreeAccessView, ThemeView):
row.append(agreement.context.time_formatted()) # Date
enf = _get_enforcement(agreement.agreement_id, provider)
row.append(agreement.context.time_formatted()) # Date
enf = _get_enforcement(agreement.agreement_id, provider)
- logger.debug("SLA AAAAA: {}".format(agreement.guaranteestatus))
+ # logger.debug("SLA guarantee status {}: {}".format(agreement.agreement_id,
+ # agreement.guaranteestatus))
if enf.enabled == 'true':
row.append('Evaluating') # Status
if enf.enabled == 'true':
row.append('Evaluating') # Status
@@
-402,22
+404,30
@@
class CreateAgreement(LoginRequiredView, ThemeView):
pattern = re.compile(testbed_urn_regex)
testbed_urn = pattern.search(data["SLIVER_INFO_AGGREGATE_URN"]).group(1)
pattern = re.compile(testbed_urn_regex)
testbed_urn = pattern.search(data["SLIVER_INFO_AGGREGATE_URN"]).group(1)
- tstmp = data["SLIVER_INFO_EXPIRATION"]
+ # Fix for django QueryDict list parameters
+ slivers = data.getlist("SLIVER_INFO_URN[]")
+ data["SLIVER_INFO_URN"] = slivers
+ del data["SLIVER_INFO_URN[]"]
+ # Timestamp to ISO date + timezone
+ tstmp = data["SLIVER_INFO_EXPIRATION"]
dt = datetime.fromtimestamp(float(tstmp))
dt = datetime.fromtimestamp(float(tstmp))
- gmt_2 = pytz.timezone("Etc/GMT-2") # FIXME: hardcoded for demo purposes
- dlocal = gmt_2.localize(dt).isoformat()
-
+ # gmt_2 = pytz.timezone("Etc/GMT-2")
+
#
dlocal = gmt_2.localize(dt).isoformat()
+ dlocal = dt.isoformat() + "CET" # FIXME: hardcoded for demo purposes
data["SLIVER_INFO_EXPIRATION"] = dlocal
data["SLIVER_INFO_EXPIRATION"] = dlocal
- logger.debug("SLA Agreement parameters: {}".format(data))
+ # logger.debug("SLA Agreement parameters: {}".format(data.dict()))
+ # import pdb; pdb.set_trace()
try:
try:
- response = c.post("agreementslist/", data=data, testbed=testbed_urn)
+ response = c.post("agreementslist/", data=json.dumps(data),
+ headers={"accept": "application/json",
+ "content-type": "application/json"})
except Exception as e:
except Exception as e:
- import traceback, sys
-
- traceback.print_exc(file=sys.stdout)
- logger.debug("SLA E
RROR
{}".format(e.message))
+
#
import traceback, sys
+ #
+
#
traceback.print_exc(file=sys.stdout)
+ logger.debug("SLA E
rror: CreateAgreement
{}".format(e.message))
return HttpResponse(response.text, status=response.status_code)
return HttpResponse(response.text, status=response.status_code)
diff --git
a/sla/templates/slice-tab-sla.html
b/sla/templates/slice-tab-sla.html
index
91953b0
..
a737577
100755
(executable)
--- a/
sla/templates/slice-tab-sla.html
+++ b/
sla/templates/slice-tab-sla.html
@@
-32,13
+32,13
@@
<dt>Experimenter</dt>
<dd>{{ row.agreement.context.consumer|default:" " }}</dd>
<dt>Service</dt>
<dt>Experimenter</dt>
<dd>{{ row.agreement.context.consumer|default:" " }}</dd>
<dt>Service</dt>
- <dd>Testbed guarantees 0.99 Uptime rate for 0.99 rate of the
resources during the sliver lifetime
</dd>
+ <dd>Testbed guarantees 0.99 Uptime rate for 0.99 rate of the
selected resources
</dd>
<dt>Testbed</dt>
<dd>{{ row.agreement.context.testbed_formatted }}</dd>
<dt>Expiration date:</dt>
<dd>{{ row.date|default:" " }}</dd>
<dt>Testbed</dt>
<dd>{{ row.agreement.context.testbed_formatted }}</dd>
<dt>Expiration date:</dt>
<dd>{{ row.date|default:" " }}</dd>
- <dt>Covered
sliver
s:</dt>
+ <dt>Covered
resource
s:</dt>
{% for sliver in row.slivers %}
<dd>{{ sliver|default:" " }}</dd>
{% endfor %}
{% for sliver in row.slivers %}
<dd>{{ sliver|default:" " }}</dd>
{% endfor %}
diff --git
a/sla/wsag_helper.py
b/sla/wsag_helper.py
index
6c7887a
..
162e828
100755
(executable)
--- a/
sla/wsag_helper.py
+++ b/
sla/wsag_helper.py
@@
-105,8
+105,6
@@
class AgreementAnnotator(object):
"""
\r
a = agreement
\r
\r
"""
\r
a = agreement
\r
\r
- logger.debug("SLA STATUS: {}".format(status))
\r
-
\r
if status is not None:
\r
a.guaranteestatus = status.guaranteestatus
\r
a.statusclass = self._get_statusclass(status.guaranteestatus)
\r
if status is not None:
\r
a.guaranteestatus = status.guaranteestatus
\r
a.statusclass = self._get_statusclass(status.guaranteestatus)
\r