Controller replaces Deployment
diff --git a/planetstack/model_policies/model_policy_Network.py b/planetstack/model_policies/model_policy_Network.py
index f48b25a..d9d138d 100644
--- a/planetstack/model_policies/model_policy_Network.py
+++ b/planetstack/model_policies/model_policy_Network.py
@@ -1,23 +1,23 @@
from core.models import *
def handle(network):
- from core.models import SliceDeployments,NetworkDeployments
+ from core.models import ControllerSlices,ControllerNetworks
from collections import defaultdict
- # network deployments are not visible to users. We must ensure
+ # network controllers are not visible to users. We must ensure
# networks are deployed at all deploymets available to their slices.
- slice_deployments = SliceDeployments.objects.all()
+ slice_controllers = ControllerSlices.objects.all()
slice_deploy_lookup = defaultdict(list)
- for slice_deployment in slice_deployments:
- slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
+ for slice_controller in slice_controllers:
+ slice_deploy_lookup[slice_controller.slice].append(slice_controller.controller)
- network_deployments = NetworkDeployments.objects.all()
+ network_controllers = ControllerNetworks.objects.all()
network_deploy_lookup = defaultdict(list)
- for network_deployment in network_deployments:
- network_deploy_lookup[network_deployment.network].append(network_deployment.deployment)
+ for network_controller in network_controllers:
+ network_deploy_lookup[network_controller.network].append(network_controller.controller)
- expected_deployments = slice_deploy_lookup[network.owner]
- for expected_deployment in expected_deployments:
+ expected_controllers = slice_deploy_lookup[network.owner]
+ for expected_controller in expected_controllers:
if network not in network_deploy_lookup or \
- expected_deployment not in network_deploy_lookup[network]:
- nd = NetworkDeployments(network=network, deployment=expected_deployment)
+ expected_controller not in network_deploy_lookup[network]:
+ nd = ControllerNetworks(network=network, controller=expected_controller)
nd.save()
diff --git a/planetstack/model_policies/model_policy_Slice.py b/planetstack/model_policies/model_policy_Slice.py
index ee34b14..af07e51 100644
--- a/planetstack/model_policies/model_policy_Slice.py
+++ b/planetstack/model_policies/model_policy_Slice.py
@@ -1,25 +1,25 @@
def handle(slice):
- from core.models import SiteDeployments,SliceDeployments,Deployment,Network,NetworkSlice,NetworkTemplate
+ from core.models import ControllerSites,ControllerSlices,Controller,Network,NetworkSlice,NetworkTemplate
from collections import defaultdict
- site_deployments = SiteDeployments.objects.all()
+ site_controllers = ControllerSites.objects.all()
site_deploy_lookup = defaultdict(list)
- for site_deployment in site_deployments:
- site_deploy_lookup[site_deployment.site].append(site_deployment.deployment)
+ for site_controller in site_controllers:
+ site_deploy_lookup[site_controller.site].append(site_controller.controller)
- slice_deployments = SliceDeployments.objects.all()
+ slice_controllers = ControllerSlices.objects.all()
slice_deploy_lookup = defaultdict(list)
- for slice_deployment in slice_deployments:
- slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
+ for slice_controller in slice_controllers:
+ slice_deploy_lookup[slice_controller.slice].append(slice_controller.controller)
- all_deployments = Deployment.objects.all()
- # slices are added to all deployments for now
- expected_deployments = all_deployments
- #expected_deployments = site_deploy_lookup[slice.site]
- for expected_deployment in expected_deployments:
+ all_controllers = Controller.objects.all()
+ # slices are added to all controllers for now
+ expected_controllers = all_controllers
+ #expected_controllers = site_deploy_lookup[slice.site]
+ for expected_controller in expected_controllers:
if slice not in slice_deploy_lookup or \
- expected_deployment not in slice_deploy_lookup[slice]:
- sd = SliceDeployments(slice=slice, deployment=expected_deployment)
+ expected_controller not in slice_deploy_lookup[slice]:
+ sd = ControllerSlices(slice=slice, controller=expected_controller)
sd.save()
# make sure slice has at least 1 public and 1 private networkd
diff --git a/planetstack/model_policies/model_policy_User.py b/planetstack/model_policies/model_policy_User.py
index 6118a7b..593ba9d 100644
--- a/planetstack/model_policies/model_policy_User.py
+++ b/planetstack/model_policies/model_policy_User.py
@@ -1,32 +1,32 @@
from core.models import *
def handle(user):
- from core.models import Deployment,SiteDeployments,UserDeployments
+ from core.models import Controller,ControllerSites,ControllerUsers
from collections import defaultdict
- deployments = Deployment.objects.all()
- site_deployments = SiteDeployments.objects.all()
- site_deploy_lookup = defaultdict(list)
- for site_deployment in site_deployments:
- site_deploy_lookup[site_deployment.site].append(site_deployment.deployment)
+ controllers = Controller.objects.all()
+ controller_sitements = ControllerSites.objects.all()
+ controller_site_lookup = defaultdict(list)
+ for controller_sitement in controller_sitements:
+ controller_site_lookup[controller_sitement.site].append(controller_sitement.controller)
- user_deploy_lookup = defaultdict(list)
- for user_deployment in UserDeployments.objects.all():
- user_deploy_lookup[user_deployment.user].append(user_deployment.deployment)
+ controller_user_lookup = defaultdict(list)
+ for controller_userment in ControllerUsers.objects.all():
+ controller_user_lookup[controller_userment.user].append(controller_userment.controller)
- all_deployments = Deployment.objects.filter()
+ all_controllers = Controller.objects.filter()
if user.is_admin:
- # admins should have an account at all deployments
- expected_deployments = deployments
+ # admins should have an account at all controllers
+ expected_controllers = controllers
else:
- # normal users should have an account at their site's deployments
- #expected_deployments = site_deploy_lookup[user.site]
- # users are added to all deployments for now
- expected_deployments = deployments
+ # normal users should have an account at their site's controllers
+ #expected_controllers = controller_site_lookup[user.site]
+ # users are added to all controllers for now
+ expected_controllers = controllers
- for expected_deployment in expected_deployments:
- if not user in user_deploy_lookup or \
- expected_deployment not in user_deploy_lookup[user]:
+ for expected_controller in expected_controllers:
+ if not user in controller_user_lookup or \
+ expected_controller not in controller_user_lookup[user]:
# add new record
- ud = UserDeployments(user=user, deployment=expected_deployment)
+ ud = ControllerUsers(user=user, controller=expected_controller)
ud.save()