Add scoring engines to database and API layers

A Scoring Module needs to expose a list of available
scoring engines through API and Watcher CLI. This list
is stored in database and synchronized by Decision Engine.

Partially-Implements: blueprint scoring-module
Change-Id: I32168adeaf34fd12a731204c5b58fe68434ad087
APIImpact
This commit is contained in:
Tomasz Kaczynski
2016-06-15 11:41:37 +00:00
parent b2656b92c4
commit 26d84e353e
17 changed files with 1416 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ class Collection(base.APIBase):
"""Return whether collection has more items."""
return len(self.collection) and len(self.collection) == limit
def get_next(self, limit, url=None, **kwargs):
def get_next(self, limit, url=None, marker_field="uuid", **kwargs):
"""Return a link to the next subset of the collection."""
if not self.has_next(limit):
return wtypes.Unset
@@ -44,7 +44,7 @@ class Collection(base.APIBase):
q_args = ''.join(['%s=%s&' % (key, kwargs[key]) for key in kwargs])
next_args = '?%(args)slimit=%(limit)d&marker=%(marker)s' % {
'args': q_args, 'limit': limit,
'marker': getattr(self.collection[-1], "uuid")}
'marker': getattr(self.collection[-1], marker_field)}
return link.Link.make_link('next', pecan.request.host_url,
resource_url, next_args).href