merge latest code
[plstackapi.git] / plstackapi / core / models / slice.py
1 import os
2 from django.db import models
3 from plstackapi.core.models import PlCoreBase
4 from plstackapi.core.models import Site
5 from plstackapi.core.models import User
6 from plstackapi.core.models import Role
7 from plstackapi.core.models import DeploymentNetwork
8
9 from plstackapi.openstack.driver import OpenStackDriver
10
11 # Create your models here.
12
13 class Slice(PlCoreBase):
14     tenant_id = models.CharField(max_length=200, help_text="Keystone tenant id")
15     name = models.CharField(help_text="The Name of the Slice", max_length=80)
16     enabled = models.BooleanField(default=True, help_text="Status for this Slice")
17     SLICE_CHOICES = (('plc', 'PLC'), ('delegated', 'Delegated'), ('controller','Controller'), ('none','None'))
18     instantiation = models.CharField(help_text="The instantiation type of the slice", max_length=80, choices=SLICE_CHOICES)
19     omf_friendly = models.BooleanField()
20     description=models.TextField(blank=True,help_text="High level description of the slice and expected activities", max_length=1024)
21     slice_url = models.URLField(blank=True, max_length=512)
22     site = models.ForeignKey(Site, related_name='slices', help_text="The Site this Node belongs too")
23     network_id = models.CharField(max_length=256, help_text="Quantum network")
24     router_id = models.CharField(max_length=256, help_text="Quantum router id")
25
26     def __unicode__(self):  return u'%s' % (self.name)
27
28 class SliceMembership(PlCoreBase):
29     user = models.ForeignKey('User', related_name='slice_memberships')
30     slice = models.ForeignKey('Slice', related_name='slice_memberships')
31     role = models.ForeignKey('Role')
32
33     def __unicode__(self):  return u'%s %s %s' % (self.slice, self.user, self.role)
34