aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2020-02-13 14:25:24 -0500
committerParker Berberian <pberberian@iol.unh.edu>2020-02-13 14:25:24 -0500
commit8c012f8a9bc64add11920688abcd6981278cb0ea (patch)
tree99772d9361784d2724d1665c566c69888ff7d5e9 /src/workflow
parentf5cdab1569b26df0c7ffc3df1529f095116fd13a (diff)
Fix Imports
Fixes stale import statements. The dashboard can now come up and we can run our unit tests Change-Id: I7189afb2cd37aaa2492de065c236b6aa9a35de5b Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/workflow')
-rw-r--r--src/workflow/booking_workflow.py7
-rw-r--r--src/workflow/models.py4
-rw-r--r--src/workflow/opnfv_workflow.py4
-rw-r--r--src/workflow/resource_bundle_workflow.py30
-rw-r--r--src/workflow/snapshot_workflow.py4
-rw-r--r--src/workflow/sw_bundle_workflow.py12
-rw-r--r--src/workflow/workflow_manager.py13
7 files changed, 35 insertions, 39 deletions
diff --git a/src/workflow/booking_workflow.py b/src/workflow/booking_workflow.py
index c96e1b9..00fa0f9 100644
--- a/src/workflow/booking_workflow.py
+++ b/src/workflow/booking_workflow.py
@@ -14,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 resource_inventory.models import GenericResourceBundle, ConfigBundle, OPNFVConfig
+from resource_inventory.models import OPNFVConfig, ResourceTemplate
from django.db.models import Q
@@ -44,8 +44,7 @@ class Abstract_Resource_Select(AbstractSelectOrCreate):
def get_form_queryset(self):
user = self.repo_get(self.repo.SESSION_USER)
- qs = GenericResourceBundle.objects.filter(Q(hidden=False) & (Q(owner=user) | Q(public=True)))
- return qs
+ return ResourceTemplate.objects.filter(Q(hidden=False) & (Q(owner=user) | Q(public=True)))
def get_page_context(self):
return {
@@ -83,7 +82,7 @@ class SWConfig_Select(AbstractSelectOrCreate):
def get_form_queryset(self):
user = self.repo_get(self.repo.SESSION_USER)
grb = self.repo_get(self.repo.SELECTED_GRESOURCE_BUNDLE)
- qs = ConfigBundle.objects.filter(Q(hidden=False) & (Q(owner=user) | Q(public=True))).filter(bundle=grb)
+ qs = ResourceTemplate.objects.filter(Q(hidden=False) & (Q(owner=user) | Q(public=True))).filter(bundle=grb)
return qs
def put_confirm_info(self, bundle):
diff --git a/src/workflow/models.py b/src/workflow/models.py
index 4d32869..df00d21 100644
--- a/src/workflow/models.py
+++ b/src/workflow/models.py
@@ -18,7 +18,7 @@ import requests
from workflow.forms import ConfirmationForm
from api.models import JobFactory
from dashboard.exceptions import ResourceAvailabilityException, ModelValidationException
-from resource_inventory.models import Image, InterfaceProfile, OPNFVConfig, ResourceOPNFVConfig, NetworkRole
+from resource_inventory.models import Image, InterfaceConfiguration, OPNFVConfig, ResourceOPNFVConfig, NetworkRole
from resource_inventory.resource_manager import ResourceManager
from resource_inventory.pdf_templater import PDFTemplater
from notifier.manager import NotificationHandler
@@ -725,7 +725,7 @@ class Repository():
config = config_bundle.hostConfigurations.get(
host__resource__name=host_role['host_name']
)
- HostOPNFVConfig.objects.create(
+ ResourceOPNFVConfig.objects.create(
role=host_role['role'],
host_config=config,
opnfv_config=opnfv_config
diff --git a/src/workflow/opnfv_workflow.py b/src/workflow/opnfv_workflow.py
index 0cac48e..6ffc91d 100644
--- a/src/workflow/opnfv_workflow.py
+++ b/src/workflow/opnfv_workflow.py
@@ -11,7 +11,7 @@
from django.forms import formset_factory
from workflow.models import WorkflowStep, AbstractSelectOrCreate
-from resource_inventory.models import ConfigBundle, OPNFV_SETTINGS
+from resource_inventory.models import ResourceTemplate, OPNFV_SETTINGS
from workflow.forms import OPNFVSelectionForm, OPNFVNetworkRoleForm, OPNFVHostRoleForm, SWConfigSelectorForm, BasicMetaForm
@@ -27,7 +27,7 @@ class OPNFV_Resource_Select(AbstractSelectOrCreate):
def get_form_queryset(self):
user = self.repo_get(self.repo.SESSION_USER)
- qs = ConfigBundle.objects.filter(owner=user)
+ qs = ResourceTemplate.objects.filter(owner=user)
return qs
def put_confirm_info(self, bundle):
diff --git a/src/workflow/resource_bundle_workflow.py b/src/workflow/resource_bundle_workflow.py
index f57476b..89baae7 100644
--- a/src/workflow/resource_bundle_workflow.py
+++ b/src/workflow/resource_bundle_workflow.py
@@ -22,11 +22,10 @@ from workflow.forms import (
ResourceMetaForm,
)
from resource_inventory.models import (
- GenericResourceBundle,
- GenericInterface,
- GenericHost,
- GenericResource,
- HostProfile,
+ ResourceProfile,
+ ResourceTemplate,
+ ResourceConfiguration,
+ InterfaceConfiguration,
Network,
NetworkConnection
)
@@ -64,12 +63,12 @@ class Define_Hardware(WorkflowStep):
models['hosts'] = [] # This will always clear existing data when this step changes
models['interfaces'] = {}
if "bundle" not in models:
- models['bundle'] = GenericResourceBundle(owner=self.repo_get(self.repo.SESSION_USER))
+ models['bundle'] = ResourceTemplate(owner=self.repo_get(self.repo.SESSION_USER))
host_data = data['host']
names = {}
for host_profile_dict in host_data.values():
id = host_profile_dict['id']
- profile = HostProfile.objects.get(id=id)
+ profile = ResourceProfile.objects.get(id=id)
# instantiate genericHost and store in repo
for name in host_profile_dict['values'].values():
if not re.match(r"(?=^.{1,253}$)(^([A-Za-z0-9-_]{1,62}\.)*[A-Za-z0-9-_]{1,63})", name):
@@ -77,14 +76,13 @@ class Define_Hardware(WorkflowStep):
if name in names:
raise NonUniqueHostnameException("All hosts must have unique names")
names[name] = True
- genericResource = GenericResource(bundle=models['bundle'], name=name)
- genericHost = GenericHost(profile=profile, resource=genericResource)
- models['hosts'].append(genericHost)
+ resourceConfig = ResourceConfiguration(profile=profile, template=models['bundle'])
+ models['hosts'].append(resourceConfig)
for interface_profile in profile.interfaceprofile.all():
- genericInterface = GenericInterface(profile=interface_profile, host=genericHost)
- if genericHost.resource.name not in models['interfaces']:
- models['interfaces'][genericHost.resource.name] = []
- models['interfaces'][genericHost.resource.name].append(genericInterface)
+ genericInterface = InterfaceConfiguration(profile=interface_profile, resource_config=resourceConfig)
+ if resourceConfig.name not in models['interfaces']:
+ models['interfaces'][resourceConfig.name] = []
+ models['interfaces'][resourceConfig.name].append(genericInterface)
# add selected lab to models
for lab_dict in data['lab'].values():
@@ -226,7 +224,7 @@ class Define_Nets(WorkflowStep):
for host in existing_host_list:
existing_hosts[host.resource.name] = host
- bundle = models.get("bundle", GenericResourceBundle(owner=self.repo_get(self.repo.SESSION_USER)))
+ bundle = models.get("bundle", ResourceTemplate(owner=self.repo_get(self.repo.SESSION_USER)))
for net_id, net in networks.items():
network = Network()
@@ -381,7 +379,7 @@ class Resource_Meta_Info(WorkflowStep):
models = self.repo_get(self.repo.GRESOURCE_BUNDLE_MODELS, {})
name = form.cleaned_data['bundle_name']
desc = form.cleaned_data['bundle_description']
- bundle = models.get("bundle", GenericResourceBundle(owner=self.repo_get(self.repo.SESSION_USER)))
+ bundle = models.get("bundle", ResourceTemplate(owner=self.repo_get(self.repo.SESSION_USER)))
bundle.name = name
bundle.description = desc
models['bundle'] = bundle
diff --git a/src/workflow/snapshot_workflow.py b/src/workflow/snapshot_workflow.py
index c2f4cd6..c0e2052 100644
--- a/src/workflow/snapshot_workflow.py
+++ b/src/workflow/snapshot_workflow.py
@@ -12,7 +12,7 @@ from django.utils import timezone
import json
from booking.models import Booking
-from resource_inventory.models import Host, Image
+from resource_inventory.models import ResourceQuery, Image
from workflow.models import WorkflowStep
from workflow.forms import BasicMetaForm, SnapshotHostSelectForm
@@ -61,7 +61,7 @@ class Select_Host_Step(WorkflowStep):
name = host['name']
booking_id = host['booking']
booking = Booking.objects.get(pk=booking_id)
- host = Host.objects.get(bundle=booking.resource, template__resource__name=name)
+ host = ResourceQuery.get(bundle=booking.resource, template__resource__name=name)
models = self.repo_get(self.repo.SNAPSHOT_MODELS, {})
if "host" not in models:
models['host'] = host
diff --git a/src/workflow/sw_bundle_workflow.py b/src/workflow/sw_bundle_workflow.py
index ebd8c86..686f46f 100644
--- a/src/workflow/sw_bundle_workflow.py
+++ b/src/workflow/sw_bundle_workflow.py
@@ -13,7 +13,7 @@ from django.forms import formset_factory
from workflow.models import WorkflowStep
from workflow.forms import BasicMetaForm, HostSoftwareDefinitionForm
from workflow.booking_workflow import Abstract_Resource_Select
-from resource_inventory.models import Image, GenericHost, ConfigBundle, HostConfiguration
+from resource_inventory.models import Image, ResourceConfiguration, ResourceTemplate
class SWConf_Resource_Select(Abstract_Resource_Select):
@@ -38,7 +38,7 @@ class Define_Software(WorkflowStep):
user = self.repo_get(self.repo.SESSION_USER)
lab = self.repo_get(self.repo.SELECTED_GRESOURCE_BUNDLE).lab
for i, host_data in enumerate(hosts_data):
- host = GenericHost.objects.get(pk=host_data['host_id'])
+ host = ResourceConfiguration.objects.get(pk=host_data['host_id'])
wrong_owner = Image.objects.exclude(owner=user).exclude(public=True)
wrong_host = Image.objects.exclude(host_type=host.profile)
wrong_lab = Image.objects.exclude(from_lab=lab)
@@ -86,7 +86,7 @@ class Define_Software(WorkflowStep):
if not grb:
return []
if grb.id:
- return GenericHost.objects.filter(resource__bundle=grb)
+ return ResourceConfiguration.objects.filter(resource__bundle=grb)
generic_hosts = self.repo_get(self.repo.GRESOURCE_BUNDLE_MODELS, {}).get("hosts", [])
return generic_hosts
@@ -109,7 +109,7 @@ class Define_Software(WorkflowStep):
def post(self, post_data, user):
models = self.repo_get(self.repo.CONFIG_MODELS, {})
if "bundle" not in models:
- models['bundle'] = ConfigBundle(owner=self.repo_get(self.repo.SESSION_USER))
+ models['bundle'] = ResourceTemplate(owner=self.repo_get(self.repo.SESSION_USER))
confirm = self.repo_get(self.repo.CONFIRMATION, {})
@@ -127,7 +127,7 @@ class Define_Software(WorkflowStep):
if headnode:
has_headnode = True
bundle = models['bundle']
- hostConfig = HostConfiguration(
+ hostConfig = ResourceConfiguration(
host=host,
image=image,
bundle=bundle,
@@ -175,7 +175,7 @@ class Config_Software(WorkflowStep):
def post(self, post_data, user):
models = self.repo_get(self.repo.CONFIG_MODELS, {})
if "bundle" not in models:
- models['bundle'] = ConfigBundle(owner=self.repo_get(self.repo.SESSION_USER))
+ models['bundle'] = ResourceTemplate(owner=self.repo_get(self.repo.SESSION_USER))
confirm = self.repo_get(self.repo.CONFIRMATION, {})
if "configuration" not in confirm:
diff --git a/src/workflow/workflow_manager.py b/src/workflow/workflow_manager.py
index fda105e..e31e14c 100644
--- a/src/workflow/workflow_manager.py
+++ b/src/workflow/workflow_manager.py
@@ -16,9 +16,8 @@ from booking.models import Booking
from workflow.workflow_factory import WorkflowFactory
from workflow.models import Repository
from resource_inventory.models import (
- GenericResourceBundle,
- ConfigBundle,
- HostConfiguration,
+ ResourceTemplate,
+ ResourceConfiguration,
OPNFVConfig
)
from workflow.forms import ManagerForm
@@ -154,10 +153,10 @@ class SessionManager():
edit_object = Booking.objects.get(pk=target_id)
self.prefill_booking(edit_object)
elif workflow_type == 1:
- edit_object = GenericResourceBundle.objects.get(pk=target_id)
+ edit_object = ResourceTemplate.objects.get(pk=target_id)
self.prefill_resource(edit_object)
elif workflow_type == 2:
- edit_object = ConfigBundle.objects.get(pk=target_id)
+ edit_object = ResourceTemplate.objects.get(pk=target_id)
self.prefill_config(edit_object)
def prefill_booking(self, booking):
@@ -213,7 +212,7 @@ class SessionManager():
models = self.active_workflow().repository.el.get(self.active_workflow().repository.CONFIG_MODELS, {})
models['bundle'] = config
models['host_configs'] = []
- for host_conf in HostConfiguration.objects.filter(bundle=config):
+ for host_conf in ResourceConfiguration.objects.filter(bundle=config):
models['host_configs'].append(host_conf)
models['opnfv'] = OPNFVConfig.objects.filter(bundle=config).last()
return models
@@ -227,7 +226,7 @@ class SessionManager():
opnfv = OPNFVConfig.objects.filter(bundle=config).last()
confirm['configuration']['installer'] = opnfv.installer.name
confirm['configuration']['scenario'] = opnfv.scenario.name
- for host_conf in HostConfiguration.objects.filter(bundle=config):
+ for host_conf in ResourceConfiguration.objects.filter(bundle=config):
h = {"name": host_conf.host.resource.name, "image": host_conf.image.name, "role": host_conf.opnfvRole.name}
confirm['configuration']['hosts'].append(h)
return confirm