Add Goal in BaseStrategy + Goal API reads from DB

In this changeset, I changed the Strategy base class to add new
abstract class methods. I also added an abstract strategy class
per Goal type (dummy, server consolidation, thermal optimization).

This changeset also includes an update of the /goals Watcher API
endpoint to now use the new Goal model (DB entries) instead of
reading from the configuration file.

Partially Implements: blueprint get-goal-from-strategy
Change-Id: Iecfed58c72f3f9df4e9d27e50a3a274a1fc0a75f
This commit is contained in:
Vincent Françoise
2016-04-29 17:22:45 +02:00
parent a3ac26870a
commit 673642e436
20 changed files with 461 additions and 192 deletions

View File

@@ -40,14 +40,14 @@ class TestShowListGoal(base.BaseInfraOptimTest):
_, goal = self.client.show_goal(self.DUMMY_GOAL)
self.assertEqual(self.DUMMY_GOAL, goal['name'])
self.assertEqual("dummy", goal['strategy'])
self.assertIn("display_name", goal.keys())
@test.attr(type='smoke')
def test_show_goal_with_links(self):
_, goal = self.client.show_goal(self.DUMMY_GOAL)
self.assertIn('links', goal.keys())
self.assertEqual(2, len(goal['links']))
self.assertIn(goal['name'],
self.assertIn(goal['uuid'],
goal['links'][0]['href'])
@test.attr(type="smoke")
@@ -58,5 +58,5 @@ class TestShowListGoal(base.BaseInfraOptimTest):
# Verify self links.
for goal in body['goals']:
self.validate_self_link('goals', goal['name'],
self.validate_self_link('goals', goal['uuid'],
goal['links'][0]['href'])