aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow/workflow_factory.py
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-01-03 16:09:13 +0000
committerGerrit Code Review <gerrit@opnfv.org>2019-01-03 16:09:13 +0000
commitfdf6f46f9c548c8e3748f32840d3af2cb3335271 (patch)
tree6db479ec0c22d98a99e07b9f0a5a14e24a303a89 /src/workflow/workflow_factory.py
parentb729dd4e21e90fe6f83b31cabdcc9f74757c70bd (diff)
parentf27e25c199c3c5c9433463732b776ae9b4357cf8 (diff)
Merge "Implement Segmented Workflows"
Diffstat (limited to 'src/workflow/workflow_factory.py')
-rw-r--r--src/workflow/workflow_factory.py39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/workflow/workflow_factory.py b/src/workflow/workflow_factory.py
index 9a42d86..1f4a28a 100644
--- a/src/workflow/workflow_factory.py
+++ b/src/workflow/workflow_factory.py
@@ -12,6 +12,7 @@ from workflow.booking_workflow import Booking_Resource_Select, SWConfig_Select,
from workflow.resource_bundle_workflow import Define_Hardware, Define_Nets, Resource_Meta_Info
from workflow.sw_bundle_workflow import Config_Software, Define_Software, SWConf_Resource_Select
from workflow.snapshot_workflow import Select_Host_Step, Image_Meta_Step
+from workflow.models import Repository, Confirmation_Step
import uuid
@@ -34,23 +35,6 @@ class ConfigMetaWorkflow(object):
workflow_type = 2
color = "#00ffcc"
-
-class MetaRelation(object):
- def __init__(self, *args, **kwargs):
- self.color = "#cccccc"
- self.parent = 0
- self.children = []
- self.depth = -1
-
- def to_json(self):
- return {
- 'color': self.color,
- 'parent': self.parent,
- 'children': self.children,
- 'depth': self.depth,
- }
-
-
class MetaStep(object):
UNTOUCHED = 0
@@ -92,12 +76,18 @@ class MetaStep(object):
def __ne__(self, other):
return self.id.int != other.id.int
+class Workflow(object):
+ def __init__(self, steps, metasteps, repository):
+ self.repository = repository
+ self.steps = steps
+ self.metasteps = metasteps
+ self.active_index = 0
class WorkflowFactory():
booking_steps = [
Booking_Resource_Select,
SWConfig_Select,
- Booking_Meta
+ Booking_Meta,
]
resource_steps = [
@@ -114,7 +104,7 @@ class WorkflowFactory():
snapshot_steps = [
Select_Host_Step,
- Image_Meta_Step
+ Image_Meta_Step,
]
def conjure(self, workflow_type=None, repo=None):
@@ -129,8 +119,17 @@ class WorkflowFactory():
meta_steps = self.metaize(steps=steps, wf_type=workflow_type)
return steps, meta_steps
+ def create_workflow(self, workflow_type=None, repo=None):
+ steps, meta_steps = self.conjure(workflow_type, repo)
+ c_step = self.make_step(Confirmation_Step, repo)
+ metaconfirm = MetaStep()
+ metaconfirm.short_title = "confirm"
+ metaconfirm.index = len(steps)
+ steps.append(c_step)
+ meta_steps.append(metaconfirm)
+ return Workflow(steps, meta_steps, repo)
+
def make_steps(self, step_types, repository):
- repository.el['steps'] += len(step_types)
steps = []
for step_type in step_types:
steps.append(self.make_step(step_type, repository))