Merge branch 'master' of github.com:open-cloud/xos
diff --git a/xos/core/models/slice.py b/xos/core/models/slice.py
index df36b26..84622cf 100644
--- a/xos/core/models/slice.py
+++ b/xos/core/models/slice.py
@@ -20,6 +20,7 @@
class Slice(PlCoreBase):
ISOLATION_CHOICES = (('vm', 'Virtual Machine'), ('container', 'Container'), ('container_vm', 'Container In VM'))
+ NETWORK_CHOICES = ((None, 'Default'), ('host', 'Host'), ('bridged', 'Bridged'))
name = StrippedCharField(unique=True, help_text="The Name of the Slice", max_length=80)
enabled = models.BooleanField(default=True, help_text="Status for this Slice")
@@ -29,7 +30,7 @@
site = models.ForeignKey(Site, related_name='slices', help_text="The Site this Slice belongs to")
max_instances = models.IntegerField(default=10)
service = models.ForeignKey(Service, related_name='slices', null=True, blank=True)
- network = StrippedCharField(default="Private Only",null=True, blank=True, max_length=256)
+ network = models.CharField(null=True, blank=True, max_length=256, choices=NETWORK_CHOICES)
tags = generic.GenericRelation(Tag)
serviceClass = models.ForeignKey(ServiceClass, related_name = "slices", null=True, default=get_default_serviceclass)
creator = models.ForeignKey(User, related_name='slices', blank=True, null=True)
@@ -83,6 +84,11 @@
if not self.creator:
raise ValidationError('slice has no creator')
+ if self.network=="Private Only":
+ # "Private Only" was the default from the old Tenant View
+ self.network=None
+ self.enforce_choices(self.network, self.NETWORK_CHOICES)
+
super(Slice, self).save(*args, **kwds)
def can_update(self, user):
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 68362f3..dc23c84 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -629,6 +629,10 @@
type: string
required: false
description: default flavor to use for slice
+ network:
+ type: string
+ required: false
+ description: type of networking to use for this slice
tosca.nodes.Node:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 49cc435..1256c3b 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -824,6 +824,10 @@
type: string
required: false
description: default flavor to use for slice
+ network:
+ type: string
+ required: false
+ description: type of networking to use for this slice
tosca.nodes.Node:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/resources/slice.py b/xos/tosca/resources/slice.py
index 6227ec7..ca11b77 100644
--- a/xos/tosca/resources/slice.py
+++ b/xos/tosca/resources/slice.py
@@ -12,7 +12,7 @@
class XOSSlice(XOSResource):
provides = "tosca.nodes.Slice"
xos_model = Slice
- copyin_props = ["enabled", "description", "slice_url", "max_instances", "default_isolation"]
+ copyin_props = ["enabled", "description", "slice_url", "max_instances", "default_isolation", "network"]
def get_xos_args(self):
args = super(XOSSlice, self).get_xos_args()