CORD-1083 move CordSubscriberRoot to rcord repo

Change-Id: I153668a67abcf0ab461b59ed3ed6a63afcf5f7c4
diff --git a/xos/admin.py b/xos/admin.py
index 9cf654a..fe2c10c 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -146,63 +146,10 @@
 
     suit_form_tabs = (('general','Details'), ('accessportmaps', 'Port Mappings'))
 
-# -------------------------------------------
-# CORDSubscriberRoot
-# -------------------------------------------
-
-class VOLTTenantInline(XOSTabularInline):
-    model = VOLTTenant
-    fields = ['provider_service', 'subscriber_root', 'service_specific_id']
-    readonly_fields = ['provider_service', 'subscriber_root', 'service_specific_id']
-    extra = 0
-    max_num = 0
-    suit_classes = 'suit-tab suit-tab-volttenants'
-    fk_name = 'subscriber_root'
-    verbose_name = 'subscribed tenant'
-    verbose_name_plural = 'subscribed tenants'
-
-    @property
-    def selflink_reverse_path(self):
-        return "admin:cord_volttenant_change"
-
-class CordSubscriberRootForm(forms.ModelForm):
-    def __init__(self,*args,**kwargs):
-        super (CordSubscriberRootForm,self ).__init__(*args,**kwargs)
-        self.fields['kind'].widget.attrs['readonly'] = True
-        if (not self.instance) or (not self.instance.pk):
-            # default fields for an 'add' form
-            self.fields['kind'].initial = CORD_SUBSCRIBER_KIND
-
-    def save(self, commit=True):
-        return super(CordSubscriberRootForm, self).save(commit=commit)
-
-    class Meta:
-        model = CordSubscriberRoot
-        fields = '__all__'
-
-class CordSubscriberRootAdmin(ReadOnlyAwareAdmin):
-    list_display = ('backend_status_icon', 'id',  'name', )
-    list_display_links = ('backend_status_icon', 'id', 'name', )
-    fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'name', 'service_specific_id', # 'service_specific_attribute',
-                                     'url_filter_level', "uplink_speed", "downlink_speed", "status", "enable_uverse", "cdn_enable"],
-                          'classes':['suit-tab suit-tab-general']})]
-    readonly_fields = ('backend_status_text', 'service_specific_attribute',)
-    form = CordSubscriberRootForm
-    inlines = (VOLTTenantInline, TenantRootPrivilegeInline)
-
-    suit_form_tabs =(('general', 'Cord Subscriber Root Details'),
-        ('volttenants','VOLT Tenancy'),
-        ('tenantrootprivileges','Privileges')
-    )
-
-    def get_queryset(self, request):
-        return CordSubscriberRoot.get_tenant_objects_by_user(request.user)
-
 admin.site.register(VOLTService, VOLTServiceAdmin)
 admin.site.register(VOLTTenant, VOLTTenantAdmin)
 admin.site.register(VOLTDevice, VOLTDeviceAdmin)
 admin.site.register(AccessDevice, AccessDeviceAdmin)
 admin.site.register(AccessAgent, AccessAgentAdmin)
 
-admin.site.register(CordSubscriberRoot, CordSubscriberRootAdmin)
 
diff --git a/xos/api/tenant/cord/subscriber.py b/xos/api/tenant/cord/subscriber.py
index 1a5b94a..c26fb20 100644
--- a/xos/api/tenant/cord/subscriber.py
+++ b/xos/api/tenant/cord/subscriber.py
@@ -10,7 +10,8 @@
 from core.models import *
 from django.forms import widgets
 from django.conf.urls import patterns, url
-from services.volt.models import VOLTTenant, CordSubscriberRoot
+from services.volt.models import VOLTTenant
+from services.rcord.models import CordSubscriberRoot
 from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
 from django.shortcuts import get_object_or_404
 from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
diff --git a/xos/api/tenant/cord/volt.py b/xos/api/tenant/cord/volt.py
index 5c9634a..50bd5a6 100644
--- a/xos/api/tenant/cord/volt.py
+++ b/xos/api/tenant/cord/volt.py
@@ -6,7 +6,8 @@
 from rest_framework import status
 from core.models import *
 from django.forms import widgets
-from services.volt.models import VOLTTenant, VOLTService, CordSubscriberRoot
+from services.volt.models import VOLTTenant, VOLTService
+from services.rcord.models import CordSubscriberRoot
 from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
 from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
 
diff --git a/xos/attic/cordsubscriberroot_bottom.py b/xos/attic/cordsubscriberroot_bottom.py
deleted file mode 100644
index 5821215..0000000
--- a/xos/attic/cordsubscriberroot_bottom.py
+++ /dev/null
@@ -1 +0,0 @@
-CordSubscriberRoot.setup_simple_attributes()
diff --git a/xos/attic/cordsubscriberroot_model.py b/xos/attic/cordsubscriberroot_model.py
deleted file mode 100644
index 6183113..0000000
--- a/xos/attic/cordsubscriberroot_model.py
+++ /dev/null
@@ -1,116 +0,0 @@
-# 'simple_attributes' will be expanded into properties and setters that
-# store the attribute using self.set_attribute / self.get_attribute.
-
-simple_attributes = ( ("devices", []), )
-
-sync_attributes = ("firewall_enable",
-                   "firewall_rules",
-                   "url_filter_enable",
-                   "url_filter_rules",
-                   "cdn_enable",
-                   "uplink_speed",
-                   "downlink_speed",
-                   "enable_uverse",
-                   "status")
-
-def __init__(self, *args, **kwargs):
-    super(CordSubscriberRoot, self).__init__(*args, **kwargs)
-    self.cached_volt = None
-
-@property
-def volt(self):
-    volt = self.get_newest_subscribed_tenant(VOLTTenant)
-    if not volt:
-        return None
-
-    # always return the same object when possible
-    if (self.cached_volt) and (self.cached_volt.id == volt.id):
-        return self.cached_volt
-
-    #volt.caller = self.creator
-    self.cached_volt = volt
-    return volt
-
-def find_device(self, mac):
-    for device in self.devices:
-        if device["mac"] == mac:
-            return device
-    return None
-
-def update_device(self, mac, **kwargs):
-    # kwargs may be "level" or "mac"
-    #    Setting one of these to None will cause None to be stored in the db
-    devices = self.devices
-    for device in devices:
-        if device["mac"] == mac:
-            for arg in kwargs.keys():
-                device[arg] = kwargs[arg]
-            self.devices = devices
-            return device
-    raise ValueError("Device with mac %s not found" % mac)
-
-def create_device(self, **kwargs):
-    if "mac" not in kwargs:
-        raise XOSMissingField("The mac field is required")
-
-    if self.find_device(kwargs['mac']):
-            raise XOSDuplicateKey("Device with mac %s already exists" % kwargs["mac"])
-
-    device = kwargs.copy()
-
-    devices = self.devices
-    devices.append(device)
-    self.devices = devices
-
-    return device
-
-def delete_device(self, mac):
-    devices = self.devices
-    for device in devices:
-        if device["mac"]==mac:
-            devices.remove(device)
-            self.devices = devices
-            return
-
-    raise ValueError("Device with mac %s not found" % mac)
-
-#--------------------------------------------------------------------------
-# Deprecated -- devices used to be called users
-
-def find_user(self, uid):
-    return self.find_device(uid)
-
-def update_user(self, uid, **kwargs):
-    return self.update_device(uid, **kwargs)
-
-def create_user(self, **kwargs):
-    return self.create_device(**kwargs)
-
-def delete_user(self, uid):
-    return self.delete_user(uid)
-
-# ------------------------------------------------------------------------
-
-@property
-def services(self):
-    return {"cdn": self.cdn_enable,
-            "url_filter": self.url_filter_enable,
-            "firewall": self.firewall_enable}
-
-@services.setter
-def services(self, value):
-    pass
-
-def save(self, *args, **kwargs):
-    self.validate_unique_service_specific_id(none_okay=True)
-    if (not hasattr(self, 'caller') or not self.caller.is_admin):
-        if (self.has_field_changed("service_specific_id")):
-            raise XOSPermissionDenied("You do not have permission to change service_specific_id")
-    super(CordSubscriberRoot, self).save(*args, **kwargs)
-
-    # TODO - reimplement this as a watcher
-
-    if (self.volt) and (self.volt.vcpe):
-        # 1) trigger manage_bbs_account to run
-        # 2) trigger vcpe observer to wake up
-        self.volt.vcpe.save()
diff --git a/xos/attic/header.py b/xos/attic/header.py
index 8561d92..56ffd5e 100644
--- a/xos/attic/header.py
+++ b/xos/attic/header.py
@@ -10,6 +10,7 @@
 from core.models import Tag
 from core.models.service import LeastLoadedNodeScheduler
 from services.vrouter.models import VRouterService, VRouterTenant
+from services.rcord.models import CordSubscriberRoot
 import traceback
 from xos.exceptions import *
 from xos.config import Config
@@ -18,6 +19,5 @@
     pass
 
 VOLT_KIND = "vOLT"
-CORD_SUBSCRIBER_KIND = "CordSubscriberRoot"
 
 CORD_USE_VTN = getattr(Config(), "networking_use_vtn", False)
diff --git a/xos/tosca/resources/CORDSubscriber.py b/xos/tosca/resources/CORDSubscriber.py
index b25bda7..19d1db7 100644
--- a/xos/tosca/resources/CORDSubscriber.py
+++ b/xos/tosca/resources/CORDSubscriber.py
@@ -1,5 +1,5 @@
 from core.models import User, TenantRootPrivilege, TenantRootRole
-from services.volt.models import CordSubscriberRoot
+from services.rcord.models import CordSubscriberRoot
 from xosresource import XOSResource
 
 class XOSCORDSubscriber(XOSResource):
diff --git a/xos/tosca/resources/CORDUser.py b/xos/tosca/resources/CORDUser.py
index 4720b62..1534be8 100644
--- a/xos/tosca/resources/CORDUser.py
+++ b/xos/tosca/resources/CORDUser.py
@@ -1,5 +1,5 @@
 from core.models import User
-from services.volt.models import CordSubscriberRoot
+from services.rcord.models import CordSubscriberRoot
 
 from xosresource import XOSResource
 
diff --git a/xos/tosca/resources/VOLTTenant.py b/xos/tosca/resources/VOLTTenant.py
index 50b255b..82158a1 100644
--- a/xos/tosca/resources/VOLTTenant.py
+++ b/xos/tosca/resources/VOLTTenant.py
@@ -1,5 +1,6 @@
 from core.models import User
-from services.volt.models import VOLTTenant, VOLTService, CordSubscriberRoot, VOLT_KIND
+from services.volt.models import VOLTTenant, VOLTService, VOLT_KIND
+from services.rcord.models import CordSubscriberRoot
 
 from xosresource import XOSResource
 
diff --git a/xos/volt.xproto b/xos/volt.xproto
index 048d650..52e5e87 100644
--- a/xos/volt.xproto
+++ b/xos/volt.xproto
@@ -1,22 +1,6 @@
 option name = "volt";
 option verbose_name = "vOLT Service";
 
-message CordSubscriberRoot (TenantRoot){
-     option kind = "CordSubscriberRoot";
-
-     required bool firewall_enable = 1 [default = False, null = False, db_index = False, blank = True];
-     optional string firewall_rules = 2 [default = "accept all anywhere anywhere", null = True, db_index = False, blank = True];
-     required bool url_filter_enable = 3 [default = False, null = False, db_index = False, blank = True];
-     optional string url_filter_rules = 4 [default = "allow all", null = True, db_index = False, blank = True];
-     required string url_filter_level = 5 [default = "PG", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
-     required bool cdn_enable = 6 [default = False, null = False, db_index = False, blank = True];
-     required bool is_demo_user = 7 [default = False, null = False, db_index = False, blank = True];
-     required int32 uplink_speed = 8 [default = 1000000000, null = False, db_index = False, blank = False];
-     required int32 downlink_speed = 9 [default = 1000000000, null = False, db_index = False, blank = False];
-     required bool enable_uverse = 10 [default = True, null = False, db_index = False, blank = True];
-     required string status = 11 [default = "enabled", choices = "(('enabled', 'Enabled'), ('suspended', 'Suspended'), ('delinquent', 'Delinquent'), ('copyrightviolation', 'Copyright Violation'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
-}
-
 message VOLTService (Service){
      option kind = "vOLT";
 }