fix bugs
diff --git a/plstackapi/core/api/subnets.py b/plstackapi/core/api/subnets.py
index 6ef051e..ad1a877 100644
--- a/plstackapi/core/api/subnets.py
+++ b/plstackapi/core/api/subnets.py
@@ -28,14 +28,15 @@
if slices: fields['slice'] = slices[0]
subnet = Subnet(**fields)
# create quantum subnet
- subnet = driver.create_subnet(network_name=subnet.slice.name,
- cidr_ip = subnet.cidr,
- ip_version=subnet.ip_version,
- start = subnet.start,
- end = subnet.end,
- dns_nameservers = ['8.8.8.8', '8.8.4.4'])
-
- subnet.subnet_id=subnet.id
+ quantum_subnet = driver.create_subnet(name= subnet.slice.name,
+ network_id=subnet.slice.network_id,
+ cidr_ip = subnet.cidr,
+ ip_version=subnet.ip_version,
+ start = subnet.start,
+ end = subnet.end)
+ subnet.subnet_id=quantum_subnet['id']
+ ## set dns servers
+ #driver.update_subnet(subnet.id, {'dns_nameservers': ['8.8.8.8', '8.8.4.4']})
# add subnet as interface to slice's router
driver.add_router_interface(subnet.slice.router_id, subnet.subnet_id)
diff --git a/plstackapi/core/models/slice.py b/plstackapi/core/models/slice.py
index 63941c7..4182e2f 100644
--- a/plstackapi/core/models/slice.py
+++ b/plstackapi/core/models/slice.py
@@ -12,7 +12,7 @@
class Slice(PlCoreBase):
tenant_id = models.CharField(max_length=200, help_text="Keystone tenant id")
- name = models.CharField(help_text="The Name of the Slice", max_length=80)
+ name = models.CharField(unique=True, help_text="The Name of the Slice", max_length=80)
enabled = models.BooleanField(default=True, help_text="Status for this Slice")
SLICE_CHOICES = (('plc', 'PLC'), ('delegated', 'Delegated'), ('controller','Controller'), ('none','None'))
instantiation = models.CharField(help_text="The instantiation type of the slice", max_length=80, choices=SLICE_CHOICES)