remove unused files
diff --git a/plstackapi/core/api/subnets.py b/plstackapi/core/api/subnets.py
deleted file mode 100644
index e7e85dd..0000000
--- a/plstackapi/core/api/subnets.py
+++ /dev/null
@@ -1,61 +0,0 @@
-import commands
-from types import StringTypes
-from django.contrib.auth import authenticate
-from plstackapi.openstack.manager import OpenStackManager
-from plstackapi.core.models import Subnet
-from plstackapi.core.api.slices import _get_slices
-
-
-def _get_subnets(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- subnets = Subnet.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- # the name is the subnet's slice's name
- slices = _get_slices(filter)
- slice = None
- if slices: slice=slices[0]
- subnets = Subnet.objects.filter(slice=slice)
- elif isinstance(filter, dict):
- subnets = Subnet.objects.filter(**filter)
- else:
- subnets = []
- return subnets
-
-def add_subnet(auth, fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
-
- slices = _get_slices(fields.get('slice'))
- if slices: fields['slice'] = slices[0]
- subnet = Subnet(**fields)
- auth['tenant'] = subnet.slice.name
- subnet.os_manager = OpenStackManager(auth=auth, caller = user)
- subnet.save()
- return subnet
-
-def update_subnet(auth, subnet, **fields):
- return
-
-def delete_subnet(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- subnets = Subnet.objects.filter(**filter)
- for subnet in subnets:
- auth['tenant'] = subnet.slice.name
- subnet.os_manager = OpenStackManager(auth=auth, caller = user)
- subnet.delete()
- return 1
-
-def get_subnets(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- if 'slice' in filter:
- slice = _get_slice(filter.get('slice'))
- if slice: filter['slice'] = slice
- subnets = Subnet.objects.filter(**filter)
- return subnets
-
-
-
diff --git a/plstackapi/core/models/subnet.py b/plstackapi/core/models/subnet.py
deleted file mode 100644
index be8c938..0000000
--- a/plstackapi/core/models/subnet.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import os
-import commands
-from django.db import models
-from plstackapi.core.models import PlCoreBase
-from plstackapi.core.models import Slice
-
-# Create your models here.
-
-class Subnet(PlCoreBase):
- subnet_id = models.CharField(max_length=256, unique=True)
- cidr = models.CharField(max_length=20)
- ip_version = models.IntegerField()
- start = models.IPAddressField()
- end = models.IPAddressField()
- slice = models.ForeignKey(Slice, related_name='subnet')
-
- def __unicode__(self): return u'%s' % (self.slice.name)
-
- def save(self, *args, **kwds):
- self.os_manager.save_subnet(self)
- super(Subnet, self).save(*args, **kwds)
-
- def delete(self, *args, **kwds):
- self.os_manager.delete_subnet(self)
- super(Subnet, self).delete(*args, **kwds)
diff --git a/plstackapi/core/views/subnets.py b/plstackapi/core/views/subnets.py
deleted file mode 100644
index d96d048..0000000
--- a/plstackapi/core/views/subnets.py
+++ /dev/null
@@ -1,66 +0,0 @@
-from django.http import Http404
-from rest_framework.views import APIView
-from rest_framework.response import Response
-from rest_framework import status
-
-from plstackapi.core.api.subnets import add_subnet, delete_subnet, get_subnets, update_subnet
-from plstackapi.core.serializers import SubnetSerializer
-from plstackapi.util.request import parse_request
-
-
-class SubnetListCreate(APIView):
- """
- List all subnets or create a new subnet.
- """
-
- def post(self, request, format = None):
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- elif 'subnet' in data:
- subnet = add_subnet(data['auth'], data['subnet'])
- serializer = SubnetSerializer(subnet)
- return Response(serializer.data, status=status.HTTP_201_CREATED)
- else:
- subnets = get_subnets(data['auth'])
- serializer = SubnetSerializer(subnets, many=True)
- return Response(serializer.data)
-
-
-class SubnetRetrieveUpdateDestroy(APIView):
- """
- Retrieve, update or delete a subnet
- """
-
- def post(self, request, pk, format=None):
- """Retrieve a subnet"""
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- subnets = get_subnets(data['auth'], {'id': pk})
- if not subnets:
- return Response(status=status.HTTP_404_NOT_FOUND)
- serializer = SubnetSerializer(subnets[0])
- return Response(serializer.data)
-
- def put(self, request, pk, format=None):
- """update a subnet"""
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- elif 'subnet' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
-
- subnet = update_subnet(pk, data['subnet'])
- serializer = SubnetSerializer(subnet)
- return Response(serializer.data)
-
- def delete(self, request, pk, format=None):
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- delete_subnet(data['auth'], {'id': pk})
- return Response(status=status.HTTP_204_NO_CONTENT)
-
-
-