Renamed SliceDeployment back to SliceDeployments
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index de766fc..747062c 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -762,8 +762,8 @@
raise forms.ValidationError('slice name must begin with %s' % site.login_base)
return cleaned_data
-class SliceDeploymentInline(PlStackTabularInline):
- model = SliceDeployment
+class SliceDeploymentsInline(PlStackTabularInline):
+ model = SliceDeployments
extra = 0
verbose_name = "Slice Deployment"
verbose_name_plural = "Slice Deployments"
@@ -779,7 +779,7 @@
list_display = ('backend_status_icon', 'name', 'site','serviceClass', 'slice_url', 'max_slivers')
list_display_links = ('backend_status_icon', 'name', )
inlines = [SlicePrivilegeInline,SliverInline, TagInline, ReservationInline,SliceNetworkInline]
- admin_inlines = [SliceDeploymentInline]
+ admin_inlines = [SliceDeploymentsInline]
user_readonly_fields = fieldList
diff --git a/planetstack/core/migrations/0001_initial.py b/planetstack/core/migrations/0001_initial.py
index 58c0dc3..8523936 100644
--- a/planetstack/core/migrations/0001_initial.py
+++ b/planetstack/core/migrations/0001_initial.py
@@ -778,7 +778,7 @@
bases=(models.Model,),
),
migrations.CreateModel(
- name='SliceDeployments',
+ name='SliceDeploymentss',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('created', models.DateTimeField(default=django.utils.timezone.now, auto_now_add=True)),
diff --git a/planetstack/core/models/__init__.py b/planetstack/core/models/__init__.py
index 09f4749..76c9590 100644
--- a/planetstack/core/models/__init__.py
+++ b/planetstack/core/models/__init__.py
@@ -10,7 +10,7 @@
from .user import User, UserDashboardView
from .serviceclass import ServiceClass
from .site import DeploymentLinkManager,DeploymentLinkDeletionManager
-from .slice import Slice, SliceDeployment
+from .slice import Slice, SliceDeployments
from .site import SitePrivilege, SiteDeployments
from .userdeployments import UserDeployment
from .image import Image, ImageDeployment
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index 24d02aa..128d605 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -93,7 +93,7 @@
nets = Network.objects.filter(slices=self)
nets.delete()
# delete slice deployments
- slice_deployments = SliceDeployments.objects.filter(slice=self)
+ slice_deployments = SliceDeploymentss.objects.filter(slice=self)
slice_deployments.delete()
# delete slice privilege
slice_privileges = SlicePrivilege.objects.filter(slice=self)
@@ -128,7 +128,7 @@
qs = SlicePrivilege.objects.filter(id__in=sp_ids)
return qs
-class SliceDeployment(PlCoreBase):
+class SliceDeployments(PlCoreBase):
objects = DeploymentLinkManager()
deleted_objects = DeploymentLinkDeletionManager()
@@ -144,8 +144,8 @@
@staticmethod
def select_by_user(user):
if user.is_admin:
- qs = SliceDeployment.objects.all()
+ qs = SliceDeployments.objects.all()
else:
slices = Slice.select_by_user(user)
- qs = SliceDeployment.objects.filter(slice__in=slices)
+ qs = SliceDeployments.objects.filter(slice__in=slices)
return qs
diff --git a/planetstack/ec2_observer/deleters/slice_deleter.py b/planetstack/ec2_observer/deleters/slice_deleter.py
index e7c54e6..7e9dfd4 100644
--- a/planetstack/ec2_observer/deleters/slice_deleter.py
+++ b/planetstack/ec2_observer/deleters/slice_deleter.py
@@ -1,6 +1,6 @@
-from core.models import Slice, SliceDeployment, User
+from core.models import Slice, SliceDeployments, User
from observer.deleter import Deleter
-from observer.deleters.slice_deployment_deleter import SliceDeploymentDeleter
+from observer.deleters.slice_deployment_deleter import SliceDeploymentsDeleter
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
@@ -10,8 +10,8 @@
def call(self, pk):
slice = Slice.objects.get(pk=pk)
- slice_deployment_deleter = SliceDeploymentDeleter()
- for slice_deployment in SliceDeployment.objects.filter(slice=slice):
+ slice_deployment_deleter = SliceDeploymentsDeleter()
+ for slice_deployment in SliceDeployments.objects.filter(slice=slice):
try:
slice_deployment_deleter(slice_deployment.id)
except:
diff --git a/planetstack/ec2_observer/deleters/slice_deployment_deleter.py b/planetstack/ec2_observer/deleters/slice_deployment_deleter.py
index 31d26fb..6f1aec0 100644
--- a/planetstack/ec2_observer/deleters/slice_deployment_deleter.py
+++ b/planetstack/ec2_observer/deleters/slice_deployment_deleter.py
@@ -1,12 +1,12 @@
-from core.models import Slice, SliceDeployment, User
+from core.models import Slice, SliceDeployments, User
from observer.deleter import Deleter
from openstack.driver import OpenStackDriver
-class SliceDeploymentDeleter(Deleter):
- model='SliceDeployment'
+class SliceDeploymentsDeleter(Deleter):
+ model='SliceDeployments'
def call(self, pk):
- slice_deployment = SliceDeployment.objects.get(pk=pk)
+ slice_deployment = SliceDeployments.objects.get(pk=pk)
user = User.objects.get(id=slice_deployment.slice.creator.id)
driver = OpenStackDriver().admin_driver(deployment=slice_deployment.deployment.name)
client_driver = driver.client_driver(caller=user,
diff --git a/planetstack/ec2_observer/deleters/sliver_deleter.py b/planetstack/ec2_observer/deleters/sliver_deleter.py
index 732e535..097f0f7 100644
--- a/planetstack/ec2_observer/deleters/sliver_deleter.py
+++ b/planetstack/ec2_observer/deleters/sliver_deleter.py
@@ -1,4 +1,4 @@
-from core.models import Sliver, SliceDeployment
+from core.models import Sliver, SliceDeployments
from observer.deleter import Deleter
class SliverDeleter(Deleter):
diff --git a/planetstack/ec2_observer/steps/sync_slivers.py b/planetstack/ec2_observer/steps/sync_slivers.py
index ed75438..15cd5eb 100644
--- a/planetstack/ec2_observer/steps/sync_slivers.py
+++ b/planetstack/ec2_observer/steps/sync_slivers.py
@@ -5,7 +5,7 @@
from planetstack.config import Config
from ec2_observer.syncstep import SyncStep
from core.models.sliver import Sliver
-from core.models.slice import SlicePrivilege, SliceDeployment
+from core.models.slice import SlicePrivilege, SliceDeployments
from core.models.network import Network, NetworkSlice, NetworkDeployments
from util.logger import Logger, logging
from ec2_observer.awslib import *
@@ -30,7 +30,7 @@
my_slivers = []
for sliver in all_slivers:
- sd = SliceDeployment.objects.filter(Q(slice=sliver.slice))
+ sd = SliceDeployments.objects.filter(Q(slice=sliver.slice))
if (sd):
if (sd.deployment.name=='Amazon EC2'):
my_slivers.append(sliver)
diff --git a/planetstack/genapi.py b/planetstack/genapi.py
index 724789e..bac66d8 100644
--- a/planetstack/genapi.py
+++ b/planetstack/genapi.py
@@ -172,9 +172,9 @@
url(r'plstackapi/siteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SitePrivilegeDetail.as_view(), name ='siteprivilege-detail'),
# url(r'plstackapi/siteprivileges/!new/$', SitePrivilegeNew.as_view(), name ='siteprivilege-new'),
- url(r'plstackapi/slicedeployments/$', SliceDeploymentList.as_view(), name='slicedeployment-list'),
- url(r'plstackapi/slicedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDeploymentDetail.as_view(), name ='slicedeployment-detail'),
-# url(r'plstackapi/slicedeployments/!new/$', SliceDeploymentNew.as_view(), name ='slicedeployment-new'),
+ url(r'plstackapi/slicedeployments/$', SliceDeploymentsList.as_view(), name='slicedeployment-list'),
+ url(r'plstackapi/slicedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDeploymentsDetail.as_view(), name ='slicedeployment-detail'),
+# url(r'plstackapi/slicedeployments/!new/$', SliceDeploymentsNew.as_view(), name ='slicedeployment-new'),
url(r'plstackapi/userdeployments/$', UserDeploymentList.as_view(), name='userdeployment-list'),
url(r'plstackapi/userdeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDeploymentDetail.as_view(), name ='userdeployment-detail'),
@@ -1009,18 +1009,18 @@
-class SliceDeploymentSerializer(serializers.HyperlinkedModelSerializer):
+class SliceDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.Field()
class Meta:
- model = SliceDeployment
+ model = SliceDeployments
fields = ('id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
-class SliceDeploymentIdSerializer(serializers.ModelSerializer):
+class SliceDeploymentsIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
class Meta:
- model = SliceDeployment
+ model = SliceDeployments
fields = ('id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
@@ -1304,7 +1304,7 @@
SitePrivilege: SitePrivilegeSerializer,
- SliceDeployment: SliceDeploymentSerializer,
+ SliceDeployments: SliceDeploymentsSerializer,
UserDeployment: UserDeploymentSerializer,
@@ -4297,10 +4297,10 @@
-class SliceDeploymentList(generics.ListCreateAPIView):
- queryset = SliceDeployment.objects.select_related().all()
- serializer_class = SliceDeploymentSerializer
- id_serializer_class = SliceDeploymentIdSerializer
+class SliceDeploymentsList(generics.ListCreateAPIView):
+ queryset = SliceDeployments.objects.select_related().all()
+ serializer_class = SliceDeploymentsSerializer
+ id_serializer_class = SliceDeploymentsIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_fields = ('id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
@@ -4312,7 +4312,7 @@
return self.serializer_class
def get_queryset(self):
- return SliceDeployment.select_by_user(self.request.user)
+ return SliceDeployments.select_by_user(self.request.user)
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
@@ -4321,21 +4321,21 @@
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
- return super(SliceDeploymentList, self).create(request, *args, **kwargs)
+ return super(SliceDeploymentsList, self).create(request, *args, **kwargs)
else:
raise Exception("failed obj.can_update")
- ret = super(SliceDeploymentList, self).create(request, *args, **kwargs)
+ ret = super(SliceDeploymentsList, self).create(request, *args, **kwargs)
if (ret.status_code%100 != 200):
raise Exception(ret.data)
return ret
-class SliceDeploymentDetail(PlanetStackRetrieveUpdateDestroyAPIView):
- queryset = SliceDeployment.objects.select_related().all()
- serializer_class = SliceDeploymentSerializer
- id_serializer_class = SliceDeploymentIdSerializer
+class SliceDeploymentsDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+ queryset = SliceDeployments.objects.select_related().all()
+ serializer_class = SliceDeploymentsSerializer
+ id_serializer_class = SliceDeploymentsIdSerializer
def get_serializer_class(self):
no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -4345,7 +4345,7 @@
return self.serializer_class
def get_queryset(self):
- return SliceDeployment.select_by_user(self.request.user)
+ return SliceDeployments.select_by_user(self.request.user)
# update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
@@ -4356,9 +4356,9 @@
filled with defaults. I solved it another way, so this code may soon be
abandoned.
-class SliceDeploymentNew(GenericAPIView):
- serializer_class = SliceDeploymentSerializer
- id_serializer_class = SliceDeploymentIdSerializer
+class SliceDeploymentsNew(GenericAPIView):
+ serializer_class = SliceDeploymentsSerializer
+ id_serializer_class = SliceDeploymentsIdSerializer
def get(self, request, *args, **kwargs):
return self.makenew(request, *args, **kwargs)
@@ -4371,7 +4371,7 @@
return self.serializer_class
def makenew(self, request, *args, **kwargs):
- obj = SliceDeployment()
+ obj = SliceDeployments()
serializer = self.get_serializer(obj)
return Response(serializer.data)
"""
diff --git a/planetstack/model_policies/model_policy_Network.py b/planetstack/model_policies/model_policy_Network.py
index 88c9f1d..f48b25a 100644
--- a/planetstack/model_policies/model_policy_Network.py
+++ b/planetstack/model_policies/model_policy_Network.py
@@ -1,11 +1,11 @@
from core.models import *
def handle(network):
- from core.models import SliceDeployment,NetworkDeployments
+ from core.models import SliceDeployments,NetworkDeployments
from collections import defaultdict
# network deployments are not visible to users. We must ensure
# networks are deployed at all deploymets available to their slices.
- slice_deployments = SliceDeployment.objects.all()
+ slice_deployments = SliceDeployments.objects.all()
slice_deploy_lookup = defaultdict(list)
for slice_deployment in slice_deployments:
slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
diff --git a/planetstack/model_policies/model_policy_Slice.py b/planetstack/model_policies/model_policy_Slice.py
index 56e2f53..ee34b14 100644
--- a/planetstack/model_policies/model_policy_Slice.py
+++ b/planetstack/model_policies/model_policy_Slice.py
@@ -1,13 +1,13 @@
def handle(slice):
- from core.models import SiteDeployments,SliceDeployment,Deployment,Network,NetworkSlice,NetworkTemplate
+ from core.models import SiteDeployments,SliceDeployments,Deployment,Network,NetworkSlice,NetworkTemplate
from collections import defaultdict
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)
- slice_deployments = SliceDeployment.objects.all()
+ slice_deployments = SliceDeployments.objects.all()
slice_deploy_lookup = defaultdict(list)
for slice_deployment in slice_deployments:
slice_deploy_lookup[slice_deployment.slice].append(slice_deployment.deployment)
@@ -19,7 +19,7 @@
for expected_deployment in expected_deployments:
if slice not in slice_deploy_lookup or \
expected_deployment not in slice_deploy_lookup[slice]:
- sd = SliceDeployment(slice=slice, deployment=expected_deployment)
+ sd = SliceDeployments(slice=slice, deployment=expected_deployment)
sd.save()
# make sure slice has at least 1 public and 1 private networkd
diff --git a/planetstack/openstack_observer/steps/sync_slice_deployments.py b/planetstack/openstack_observer/steps/sync_slice_deployments.py
index c08a5fa..9e79164 100644
--- a/planetstack/openstack_observer/steps/sync_slice_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_slice_deployments.py
@@ -6,22 +6,22 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.site import Deployment, SiteDeployments
-from core.models.slice import Slice, SliceDeployment
+from core.models.slice import Slice, SliceDeployments
from core.models.userdeployments import UserDeployment
from util.logger import Logger, logging
from observer.ansible import *
logger = Logger(level=logging.INFO)
-class SyncSliceDeployment(OpenStackSyncStep):
- provides=[SliceDeployment]
+class SyncSliceDeployments(OpenStackSyncStep):
+ provides=[SliceDeployments]
requested_interval=0
def fetch_pending(self, deleted):
if (deleted):
- return SliceDeployment.deleted_objects.all()
+ return SliceDeployments.deleted_objects.all()
else:
- return SliceDeployment.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ return SliceDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
def get_next_subnet(self, deployment=None):
# limit ourself to 10.0.x.x for now
diff --git a/planetstack/openstack_observer/steps/sync_slice_memberships.py b/planetstack/openstack_observer/steps/sync_slice_memberships.py
index f51a96b..88a182e 100644
--- a/planetstack/openstack_observer/steps/sync_slice_memberships.py
+++ b/planetstack/openstack_observer/steps/sync_slice_memberships.py
@@ -22,7 +22,7 @@
def sync_record(self, slice_memb):
# sync slice memberships at all slice deployments
logger.info("syncing slice privilege: %s %s" % (slice_memb.slice.name, slice_memb.user.email))
- slice_deployments = SliceDeployment.objects.filter(slice=slice_memb.slice)
+ slice_deployments = SliceDeployments.objects.filter(slice=slice_memb.slice)
for slice_deployment in slice_deployments:
if not slice_deployment.tenant_id:
continue
diff --git a/planetstack/openstack_observer/steps/sync_slices.py b/planetstack/openstack_observer/steps/sync_slices.py
index 6d6ca46..a6073b6 100644
--- a/planetstack/openstack_observer/steps/sync_slices.py
+++ b/planetstack/openstack_observer/steps/sync_slices.py
@@ -4,7 +4,7 @@
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.slice import Slice, SliceDeployment
+from core.models.slice import Slice, SliceDeployments
from util.logger import Logger, logging
from observer.steps.sync_slice_deployments import *
@@ -15,14 +15,14 @@
requested_interval=0
def sync_record(self, slice):
- for slice_deployment in SliceDeployment.objects.filter(slice=slice):
+ for slice_deployment in SliceDeployments.objects.filter(slice=slice):
# bump the 'updated' timestamp and trigger observer to update
# slice across all deployments
slice_deployment.save()
def delete_record(self, slice):
- slice_deployment_deleter = SyncSliceDeployment().delete_record
- for slice_deployment in SliceDeployment.objects.filter(slice=slice):
+ slice_deployment_deleter = SyncSliceDeployments().delete_record
+ for slice_deployment in SliceDeployments.objects.filter(slice=slice):
try:
slice_deployment_deleter(slice_deployment)
except Exception,e:
diff --git a/planetstack/openstack_observer/steps/sync_slivers.py b/planetstack/openstack_observer/steps/sync_slivers.py
index 133c0e0..8237896 100644
--- a/planetstack/openstack_observer/steps/sync_slivers.py
+++ b/planetstack/openstack_observer/steps/sync_slivers.py
@@ -4,7 +4,7 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.sliver import Sliver
-from core.models.slice import Slice, SlicePrivilege, SliceDeployment
+from core.models.slice import Slice, SlicePrivilege, SliceDeployments
from core.models.network import Network, NetworkSlice, NetworkDeployments
from util.logger import Logger, logging
from observer.ansible import *
diff --git a/planetstack/syndicate_observer/syndicatelib_config/config.py b/planetstack/syndicate_observer/syndicatelib_config/config.py
deleted file mode 120000
index c2ca3ee..0000000
--- a/planetstack/syndicate_observer/syndicatelib_config/config.py
+++ /dev/null
@@ -1 +0,0 @@
-config-opencloud.py
\ No newline at end of file
diff --git a/planetstack/syndicate_observer/syndicatelib_config/config.py b/planetstack/syndicate_observer/syndicatelib_config/config.py
new file mode 100644
index 0000000..54000ff
--- /dev/null
+++ b/planetstack/syndicate_observer/syndicatelib_config/config.py
@@ -0,0 +1,73 @@
+#!/usr/bin/python
+
+# ---------------------------------
+# This is the configuration file used by the Syndicate observer.
+# It is a well-formed Python file, and will be imported into the
+# observer as a Python module. This means you can run any config-
+# generation code here you like, but all of the following global
+# variables must be defined.
+# ---------------------------------
+
+# URL to the Syndicate SMI. For example, https://syndicate-metadata.appspot.com
+SYNDICATE_SMI_URL="http://localhost:8080"
+
+# If you are going to use OpenID to authenticate the Syndicate sliver daemon,
+# this is the OpenID provider URL. It is currently used only to generate
+# identity pages for users, so you can put whatever you want here for now.
+SYNDICATE_OPENID_TRUSTROOT="http://localhost:8081"
+
+# This is the observer's user account on Syndicate. You must create it out-of-band
+# prior to using the observer, and it must be an admin user since it will
+# create other users (i.e. for slices).
+SYNDICATE_OPENCLOUD_USER="jcnelson@cs.princeton.edu"
+
+# This is the password for the observer to authenticate itself to Syndicate.
+SYNDICATE_OPENCLOUD_PASSWORD="nya"
+
+# If the observer uses public-key authentication with Syndicate, you will
+# need to identify the absolute path to its private key here. It must be
+# a 4096-bit PEM-encoded RSA key, and the Syndicate observer's user account
+# must have been given the public key on activation.
+SYNDICATE_OPENCLOUD_PKEY=None
+
+# This is the location on disk where Syndicate observer code can be found,
+# if it is not already in the Python path. This is optional.
+SYNDICATE_PYTHONPATH="/root/syndicate/build/out/python"
+
+# This is the location of the observer's private key. It must be an absolute
+# path, and refer to a 4096-bit PEM-encoded RSA key.
+SYNDICATE_PRIVATE_KEY="/opt/planetstack/syndicate_observer/syndicatelib_config/pollserver.pem"
+
+# This is the master secret used to generate secrets to seal sensitive information sent to the
+# Syndicate sliver mount daemons. It is also used to seal sensitive information
+# stored to the Django database.
+# TODO: think of a way to not have to store this on disk. Maybe we feed into the
+# observer when it starts up?
+SYNDICATE_OPENCLOUD_SECRET="e4988309a5005edb8ea185f16f607938c0fb7657e4d7609853bcb7c4884d1c92"
+
+# This is the default port number on which a Syndicate Replica Gateway
+# will be provisioned. It's a well-known port, and can be the same across
+# slivers, since in OpenCloud, an RG instance only listens to localhost.
+SYNDICATE_RG_DEFAULT_PORT=38800
+
+# This is the absolute path to the RG's storage driver (which will be automatically
+# pushed to slivers by Syndicate). See https://github.com/jcnelson/syndicate/wiki/Replica-Gateways
+SYNDICATE_RG_CLOSURE=None
+
+# This is the port number the observer listens on for GETs from the Syndicate sliver mount
+# daemons. Normally, the oserver pushes (encrypted) commands to the daemons, but if the
+# daemons are NAT'ed or temporarily partitioned, they will pull commands instead.
+SYNDICATE_HTTP_PORT=65321
+
+# This is the path to the logfile for the observer's HTTP server.
+SYNDICATE_HTTP_LOGFILE="/tmp/syndicate-observer.log"
+
+# This is the number of seconds to wait for pushing a slice credential before timing out.
+SYNDICATE_HTTP_PUSH_TIMEOUT=60
+
+# This is the port number the Syndicate sliver mount daemons listen on. The observer will
+# push commands to them on this port.
+SYNDICATE_SLIVER_PORT=65322
+
+# If true, print verbose debug messages.
+DEBUG=True