diff options
Diffstat (limited to 'src/workflow')
-rw-r--r-- | src/workflow/booking_workflow.py | 38 | ||||
-rw-r--r-- | src/workflow/models.py | 18 | ||||
-rw-r--r-- | src/workflow/workflow_factory.py | 3 |
3 files changed, 5 insertions, 54 deletions
diff --git a/src/workflow/booking_workflow.py b/src/workflow/booking_workflow.py index 128f179..ef89804 100644 --- a/src/workflow/booking_workflow.py +++ b/src/workflow/booking_workflow.py @@ -1,5 +1,6 @@ ############################################################################## # Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, and others. +# Copyright (c) 2020 Sawyer Bergeron, Sean Smith, and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -13,7 +14,7 @@ from datetime import timedelta from booking.models import Booking from workflow.models import WorkflowStep, AbstractSelectOrCreate -from workflow.forms import ResourceSelectorForm, SWConfigSelectorForm, BookingMetaForm, OPNFVSelectForm +from workflow.forms import ResourceSelectorForm, BookingMetaForm, OPNFVSelectForm from resource_inventory.models import OPNFVConfig, ResourceTemplate from django.db.models import Q @@ -65,41 +66,6 @@ class Booking_Resource_Select(Abstract_Resource_Select): workflow_type = "booking" -class SWConfig_Select(AbstractSelectOrCreate): - title = "Select Software Configuration" - description = "Choose the software and related configurations you want to have used for your deployment" - short_title = "pod config" - form = SWConfigSelectorForm - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.select_repo_key = self.repo.SELECTED_CONFIG_BUNDLE - self.confirm_key = "booking" - - def alert_bundle_missing(self): - self.set_invalid("Please select a valid pod config") - - def get_form_queryset(self): - user = self.repo_get(self.repo.SESSION_USER) - grb = self.repo_get(self.repo.SELECTED_RESOURCE_TEMPLATE) - qs = ResourceTemplate.objects.filter(Q(hidden=False) & (Q(owner=user) | Q(public=True))).filter(bundle=grb) - return qs - - def put_confirm_info(self, bundle): - confirm_dict = self.repo_get(self.repo.CONFIRMATION) - if self.confirm_key not in confirm_dict: - confirm_dict[self.confirm_key] = {} - confirm_dict[self.confirm_key]["Software Configuration"] = bundle.name - self.repo_put(self.repo.CONFIRMATION, confirm_dict) - - def get_page_context(self): - return { - 'select_type': 'swconfig', - 'select_type_title': 'Software Config', - 'addable_type_num': 2 - } - - class OPNFV_EnablePicker(object): pass diff --git a/src/workflow/models.py b/src/workflow/models.py index 173fdba..4a5616e 100644 --- a/src/workflow/models.py +++ b/src/workflow/models.py @@ -368,7 +368,6 @@ class Repository(): RESOURCE_SELECT = "resource_select" CONFIRMATION = "confirmation" SELECTED_RESOURCE_TEMPLATE = "selected resource template pk" - SELECTED_CONFIG_BUNDLE = "selected config bundle pk" SELECTED_OPNFV_CONFIG = "selected opnfv deployment config" RESOURCE_TEMPLATE_MODELS = "generic_resource_template_models" RESOURCE_TEMPLATE_INFO = "generic_resource_template_info" @@ -456,15 +455,6 @@ class Repository(): self.el[self.RESULT_KEY] = self.SELECTED_RESOURCE_TEMPLATE return - if self.CONFIG_MODELS in self.el: - errors = self.make_software_config_bundle() - if errors: - return errors - else: - self.el[self.HAS_RESULT] = True - self.el[self.RESULT_KEY] = self.SELECTED_CONFIG_BUNDLE - return - if self.OPNFV_MODELS in self.el: errors = self.make_opnfv_config() if errors: @@ -585,11 +575,6 @@ class Repository(): else: return "BOOK, no selected resource. CODE:0x000e" - if self.SELECTED_CONFIG_BUNDLE not in self.el: - return "BOOK, no selected config bundle. CODE:0x001f" - - booking.config_bundle = self.el[self.SELECTED_CONFIG_BUNDLE] - if not booking.start: return "BOOK, booking has no start. CODE:0x0010" if not booking.end: @@ -602,7 +587,8 @@ class Repository(): else: return "BOOK, collaborators not defined. CODE:0x0013" try: - resource_bundle = ResourceManager.getInstance().convertResourceBundle(selected_grb, config=booking.config_bundle) + res_manager = ResourceManager.getInstance() + resource_bundle = res_manager.instantiateTemplate(selected_grb) except ResourceAvailabilityException as e: return "BOOK, requested resources are not available. Exception: " + str(e) + " CODE:0x0014" except ModelValidationException as e: diff --git a/src/workflow/workflow_factory.py b/src/workflow/workflow_factory.py index 04ed280..e688510 100644 --- a/src/workflow/workflow_factory.py +++ b/src/workflow/workflow_factory.py @@ -8,7 +8,7 @@ ############################################################################## -from workflow.booking_workflow import Booking_Resource_Select, SWConfig_Select, Booking_Meta, OPNFV_Select +from workflow.booking_workflow import Booking_Resource_Select, Booking_Meta, OPNFV_Select from workflow.resource_bundle_workflow import Define_Hardware, Define_Nets, Resource_Meta_Info, Define_Software from workflow.snapshot_workflow import Select_Host_Step, Image_Meta_Step from workflow.opnfv_workflow import Pick_Installer, Assign_Network_Roles, Assign_Host_Roles, OPNFV_Resource_Select, MetaInfo @@ -73,7 +73,6 @@ class Workflow(object): class WorkflowFactory(): booking_steps = [ Booking_Resource_Select, - SWConfig_Select, Booking_Meta, OPNFV_Select, ] |