merge latest code
diff --git a/plstackapi/core/models/role.py b/plstackapi/core/models/role.py
index 7b3268c..12743ef 100644
--- a/plstackapi/core/models/role.py
+++ b/plstackapi/core/models/role.py
@@ -13,8 +13,3 @@
def __unicode__(self): return u'%s' % (self.role_type)
- def save(self):
- if not self.id:
- self.created = datetime.date.today()
- self.updated = datetime.datetime.today()
- super(Role, self).save()
diff --git a/plstackapi/core/models/site.py b/plstackapi/core/models/site.py
index 5ec04c4..a2903f9 100644
--- a/plstackapi/core/models/site.py
+++ b/plstackapi/core/models/site.py
@@ -32,18 +32,4 @@
def __unicode__(self): return u'%s %s %s' % (self.site, self.user, self.role)
- def save(self, *args, **kwds):
- driver = OpenStackDriver()
- driver.add_user_role(user_id=user.user_id,
- tenant_id=site.tenant_id,
- role_name=role.name)
- super(SitePrivilege, self).save(*args, **kwds)
-
- def delete(self, *args, **kwds):
- driver = OpenStackDriver()
- driver.delete_user_role(user_id=user.user_id,
- tenant_id=site.tenant_id,
- role_name=role.name)
- super(SitePrivilege, self).delete(*args, **kwds)
-
diff --git a/plstackapi/core/models/slice.py b/plstackapi/core/models/slice.py
index 24c44a6..63941c7 100644
--- a/plstackapi/core/models/slice.py
+++ b/plstackapi/core/models/slice.py
@@ -25,35 +25,6 @@
def __unicode__(self): return u'%s' % (self.name)
- def save(self, *args, **kwds):
- # sync keystone tenant
- driver = OpenStackDriver()
-
- if not self.id:
- tenant = driver.create_tenant(tenant_name=self.name,
- description=self.description,
- enabled=self.enabled)
- self.tenant_id = tenant.id
-
- # create a network
- network = driver.create_network(name=self.name)
- self.network_id = network['id']
- # create router
- router = driver.create_router(name=self.name)
- self.router_id = router['id']
-
-/bin/sh: 1: command not found
- # update record
- self.driver.update_tenant(self.tenant_id, name=self.name,
- description=self.description, enabled=self.enabled)
- super(Slice, self).save(*args, **kwds)
-
- def delete(self, *args, **kwds):
- # delete keystone tenant
- driver = OpenStackDriver()
- driver.delete_tenant(self.tenant_id)
- super(Slice, self).delete(*args, **kwds)
-
class SliceMembership(PlCoreBase):
user = models.ForeignKey('User', related_name='slice_memberships')
slice = models.ForeignKey('Slice', related_name='slice_memberships')
@@ -61,16 +32,3 @@
def __unicode__(self): return u'%s %s %s' % (self.slice, self.user, self.role)
- def save(self, *args, **kwds):
- driver = OpenStackDriver()
- driver.add_user_role(user_id=user.user_id,
- tenant_id=slice.tenant_id,
- role_name=role.name)
- super(SliceMembership, self).save(*args, **kwds)
-
- def delete(self, *args, **kwds):
- driver = OpenStackDriver()
- driver.delete_user_role(user_id=user.user_id,
- tenant_id=slice.tenant_id,
- role_name=role.name)
- super(SliceMembership, self).delete(*args, **kwds)
diff --git a/plstackapi/core/models/sliver.py b/plstackapi/core/models/sliver.py
index 6f7aabe..9d5857e 100644
--- a/plstackapi/core/models/sliver.py
+++ b/plstackapi/core/models/sliver.py
@@ -22,20 +22,5 @@
site = models.ForeignKey(Site, related_name='sliver_site')
deploymentNetwork = models.ForeignKey(DeploymentNetwork, related_name='sliver_deploymentNetwork')
- def __unicode__(self): return u'%s::%s' % (self.slice, self.siteDeploymentNetwork)
-
- def save(self, *args, **kwds):
- driver = OpenStackDriver()
- instance = driver.spawn_instances(name=self.name,
- keyname=self.name,
- hostnames=self.node.name,
- flavor=self.flavor.name,
- image=self.image.name)
- self.instance_id = instance.id
- super(Sliver, self).save(*args, **kwds)
-
- def delete(self, *args, **kwds):
- driver = OpenStackDriver()
- driver.destroy_instance(name=self.name, id=self.instance_id)
- super(Sliver, self).delete(*args, **kwds)
+ def __unicode__(self): return u'%s::%s' % (self.slice, self.deploymentNetwork)
diff --git a/plstackapi/core/models/subnet.py b/plstackapi/core/models/subnet.py
index 291ffe8..70f8176 100644
--- a/plstackapi/core/models/subnet.py
+++ b/plstackapi/core/models/subnet.py
@@ -16,26 +16,3 @@
def __unicode__(self): return u'%s' % (self.name)
- def save(self, *args, **kwargs):
- driver = OpenStackDriver()
- if not self.id:
- subnet = driver.create_subnet(network_name=self.slice.name,
- cidr_ip = self.cidr,
- ip_version=self.ip_version,
- start = self.start,
- end = self.end)
-
- self.subnet_id = subnet.id
-
- # add subnet as interface to slice router
- driver.add_router_interface(self.slice.router_id, subnet.id)
-
- super(Subnet, self).save(*args, **kwargs)
-
-
- def delete(self, *args, **kwargs):
- # delete quantum network
- driver = OpenStackDriver()
- driver.delete_subnet(self.subnet_id)
- driver.delete_router_interface(self.slice.router_id, self.subnet.id)
- super(Subnet, self).delete(*args, **kwargs)