rename VCPETenant to VSGTenant
diff --git a/xos/services/cord/admin.py b/xos/services/cord/admin.py
index 5f1a285..1d71fb6 100644
--- a/xos/services/cord/admin.py
+++ b/xos/services/cord/admin.py
@@ -158,14 +158,14 @@
def queryset(self, request):
return VCPEService.get_service_objects_by_user(request.user)
-class VCPETenantForm(forms.ModelForm):
+class VSGTenantForm(forms.ModelForm):
bbs_account = forms.CharField(required=False)
creator = forms.ModelChoiceField(queryset=User.objects.all())
instance = forms.ModelChoiceField(queryset=Instance.objects.all(),required=False)
last_ansible_hash = forms.CharField(required=False)
def __init__(self,*args,**kwargs):
- super (VCPETenantForm,self ).__init__(*args,**kwargs)
+ super (VSGTenantForm,self ).__init__(*args,**kwargs)
self.fields['kind'].widget.attrs['readonly'] = True
self.fields['provider_service'].queryset = VCPEService.get_service_objects().all()
if self.instance:
@@ -185,24 +185,24 @@
self.instance.creator = self.cleaned_data.get("creator")
self.instance.instance = self.cleaned_data.get("instance")
self.instance.last_ansible_hash = self.cleaned_data.get("last_ansible_hash")
- return super(VCPETenantForm, self).save(commit=commit)
+ return super(VSGTenantForm, self).save(commit=commit)
class Meta:
- model = VCPETenant
+ model = VSGTenant
-class VCPETenantAdmin(ReadOnlyAwareAdmin):
+class VSGTenantAdmin(ReadOnlyAwareAdmin):
list_display = ('backend_status_icon', 'id', 'subscriber_tenant' )
list_display_links = ('backend_status_icon', 'id')
fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', 'subscriber_tenant', 'service_specific_id', # 'service_specific_attribute',
'bbs_account', 'creator', 'instance', 'last_ansible_hash'],
'classes':['suit-tab suit-tab-general']})]
readonly_fields = ('backend_status_text', 'service_specific_attribute', 'bbs_account')
- form = VCPETenantForm
+ form = VSGTenantForm
suit_form_tabs = (('general','Details'),)
def queryset(self, request):
- return VCPETenant.get_tenant_objects_by_user(request.user)
+ return VSGTenant.get_tenant_objects_by_user(request.user)
#-----------------------------------------------------------------------------
# vBNG
@@ -363,7 +363,7 @@
admin.site.register(VOLTService, VOLTServiceAdmin)
admin.site.register(VOLTTenant, VOLTTenantAdmin)
admin.site.register(VCPEService, VCPEServiceAdmin)
-admin.site.register(VCPETenant, VCPETenantAdmin)
+admin.site.register(VSGTenant, VSGTenantAdmin)
admin.site.register(VBNGService, VBNGServiceAdmin)
admin.site.register(VBNGTenant, VBNGTenantAdmin)
admin.site.register(CordSubscriberRoot, CordSubscriberRootAdmin)
diff --git a/xos/services/cord/models.py b/xos/services/cord/models.py
index bf20e86..d01e4f3 100644
--- a/xos/services/cord/models.py
+++ b/xos/services/cord/models.py
@@ -11,44 +11,6 @@
import traceback
from xos.exceptions import *
-"""
-import os
-import sys
-sys.path.append("/opt/xos")
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
-from core.models import *
-from services.hpc.models import *
-from services.cord.models import *
-django.setup()
-
-t = VOLTTenant()
-t.caller = User.objects.all()[0]
-t.save()
-
-for v in VOLTTenant.get_tenant_objects().all():
- v.caller = User.objects.all()[0]
- v.delete()
-
-for v in VCPETenant.get_tenant_objects().all():
- v.caller = User.objects.all()[0]
- v.delete()
-
-for v in VOLTTenant.get_tenant_objects().all():
- v.caller = User.objects.all()[0]
- v.delete()
-
-for v in VOLTTenant.get_tenant_objects().all():
- if not v.creator:
- v.creator= User.objects.all()[0]
- v.save()
-
-for v in VCPETenant.get_tenant_objects().all():
- if not v.creator:
- v.creator= User.objects.all()[0]
- v.save()
-"""
-
class ConfigurationError(Exception):
pass
@@ -292,7 +254,7 @@
@property
def vcpe(self):
- vcpe = self.get_newest_subscribed_tenant(VCPETenant)
+ vcpe = self.get_newest_subscribed_tenant(VSGTenant)
if not vcpe:
return None
@@ -350,7 +312,7 @@
if not vcpeServices:
raise XOSConfigurationError("No VCPE Services available")
- vcpe = VCPETenant(provider_service = vcpeServices[0],
+ vcpe = VSGTenant(provider_service = vcpeServices[0],
subscriber_tenant = self)
vcpe.caller = self.creator
vcpe.save()
@@ -382,7 +344,7 @@
def cleanup_orphans(self):
# ensure vOLT only has one vCPE
cur_vcpe = self.vcpe
- for vcpe in list(self.get_subscribed_tenants(VCPETenant)):
+ for vcpe in list(self.get_subscribed_tenants(VSGTenant)):
if (not cur_vcpe) or (vcpe.id != cur_vcpe.id):
# print "XXX clean up orphaned vcpe", vcpe
vcpe.delete()
@@ -445,7 +407,7 @@
proxy = True
def allocate_bbs_account(self):
- vcpes = VCPETenant.get_tenant_objects().all()
+ vcpes = VSGTenant.get_tenant_objects().all()
bbs_accounts = [vcpe.bbs_account for vcpe in vcpes]
# There's a bit of a race here; some other user could be trying to
@@ -483,7 +445,7 @@
#
# def __unicode__(self): return u'%s' % (self.s_tag)
-class VCPETenant(TenantWithContainer):
+class VSGTenant(TenantWithContainer):
class Meta:
proxy = True
@@ -502,7 +464,7 @@
"last_ansible_hash": None}
def __init__(self, *args, **kwargs):
- super(VCPETenant, self).__init__(*args, **kwargs)
+ super(VSGTenant, self).__init__(*args, **kwargs)
self.cached_vbng=None
@property
@@ -726,7 +688,7 @@
# provides us
slice = self.get_slice()
if slice.default_isolation in ["container_vm", "container"]:
- super(VCPETenant,self).manage_container()
+ super(VSGTenant,self).manage_container()
return
if not self.volt:
@@ -738,7 +700,7 @@
def cleanup_container(self):
if self.get_slice().default_isolation in ["container_vm", "container"]:
- super(VCPETenant,self).cleanup_container()
+ super(VSGTenant,self).cleanup_container()
# To-do: cleanup unused instances
pass
@@ -752,11 +714,11 @@
# make sure we use the proxied VCPEService object, not the generic Service object
vcpe_service = VCPEService.objects.get(id=self.provider_service.id)
self.bbs_account = vcpe_service.allocate_bbs_account()
- super(VCPETenant, self).save()
+ super(VSGTenant, self).save()
else:
if self.bbs_account:
self.bbs_account = None
- super(VCPETenant, self).save()
+ super(VSGTenant, self).save()
def find_or_make_port(self, instance, network, **kwargs):
port = Port.objects.filter(instance=instance, network=network)
@@ -770,7 +732,7 @@
def save_instance(self, instance):
with transaction.atomic():
instance.volumes = "/etc/dnsmasq.d,/etc/ufw"
- super(VCPETenant, self).save_instance(instance)
+ super(VSGTenant, self).save_instance(instance)
if instance.isolation in ["container", "container_vm"]:
lan_networks = [x for x in instance.slice.networks.all() if "lan" in x.name]
@@ -801,12 +763,12 @@
if not self.creator:
if not getattr(self, "caller", None):
# caller must be set when creating a vCPE since it creates a slice
- raise XOSProgrammingError("VCPETenant's self.caller was not set")
+ raise XOSProgrammingError("VSGTenant's self.caller was not set")
self.creator = self.caller
if not self.creator:
- raise XOSProgrammingError("VCPETenant's self.creator was not set")
+ raise XOSProgrammingError("VSGTenant's self.creator was not set")
- super(VCPETenant, self).save(*args, **kwargs)
+ super(VSGTenant, self).save(*args, **kwargs)
model_policy_vcpe(self.pk)
#self.manage_instance()
#self.manage_vbng()
@@ -816,12 +778,12 @@
def delete(self, *args, **kwargs):
self.cleanup_vbng()
self.cleanup_container()
- super(VCPETenant, self).delete(*args, **kwargs)
+ super(VSGTenant, self).delete(*args, **kwargs)
def model_policy_vcpe(pk):
# TODO: this should be made in to a real model_policy
with transaction.atomic():
- vcpe = VCPETenant.objects.select_for_update().filter(pk=pk)
+ vcpe = VSGTenant.objects.select_for_update().filter(pk=pk)
if not vcpe:
return
vcpe = vcpe[0]
diff --git a/xos/services/cord/templates/vcpeadmin.html b/xos/services/cord/templates/vcpeadmin.html
index a21dabe..c93f032 100644
--- a/xos/services/cord/templates/vcpeadmin.html
+++ b/xos/services/cord/templates/vcpeadmin.html
@@ -1,6 +1,6 @@
<div class = "row text-center">
<div class="col-xs-6">
- <a class="btn btn-primary" href="/admin/cord/vcpetenant/">vCPE Tenants</a>
+ <a class="btn btn-primary" href="/admin/cord/vsgtenant/">vSG Tenants</a>
</div>
<div class="col-xs-6">
<a class="btn btn-primary" href="/admin/dashboard/cord/">Subscriber View</a>
diff --git a/xos/synchronizers/base/SyncInstanceUsingAnsible.py b/xos/synchronizers/base/SyncInstanceUsingAnsible.py
index 4e5807e..a2109ad 100644
--- a/xos/synchronizers/base/SyncInstanceUsingAnsible.py
+++ b/xos/synchronizers/base/SyncInstanceUsingAnsible.py
@@ -15,10 +15,10 @@
class SyncInstanceUsingAnsible(SyncStep):
# All of the following should be defined for classes derived from this
- # base class. Examples below use VCPETenant.
+ # base class. Examples below use VSGTenant.
- # provides=[VCPETenant]
- # observes=VCPETenant
+ # provides=[VSGTenant]
+ # observes=VSGTenant
# requested_interval=0
# template_name = "sync_vcpetenant.yaml"
# service_key_name = "/opt/xos/observers/vcpe/vcpe_private_key"
diff --git a/xos/synchronizers/vbng/steps/sync_vbngtenant.py b/xos/synchronizers/vbng/steps/sync_vbngtenant.py
index 94875f4..d2d1f97 100644
--- a/xos/synchronizers/vbng/steps/sync_vbngtenant.py
+++ b/xos/synchronizers/vbng/steps/sync_vbngtenant.py
@@ -8,7 +8,7 @@
from synchronizers.base.syncstep import SyncStep
from synchronizers.base.ansible import run_template_ssh
from core.models import Service
-from services.cord.models import VCPEService, VCPETenant, VBNGTenant, VBNGService
+from services.cord.models import VCPEService, VSGTenant, VBNGTenant, VBNGService
from services.hpc.models import HpcService, CDNPrefix
from xos.logger import Logger, logging
@@ -21,8 +21,8 @@
logger = Logger(level=logging.INFO)
class SyncVBNGTenant(SyncStep):
- provides=[VCPETenant]
- observes=VCPETenant
+ provides=[VSGTenant]
+ observes=VSGTenant
requested_interval=0
def __init__(self, **args):
@@ -84,7 +84,7 @@
raise Exception("vBNG service does not have vbng_url set, and is not linked to an ONOSApp")
def get_private_interface(self, o):
- vcpes = VCPETenant.get_tenant_objects().all()
+ vcpes = VSGTenant.get_tenant_objects().all()
vcpes = [x for x in vcpes if (x.vbng is not None) and (x.vbng.id == o.id)]
if not vcpes:
raise Exception("No vCPE tenant is associated with vBNG %s" % str(o.id))
diff --git a/xos/synchronizers/vcpe/steps/sync_vcpetenant.py b/xos/synchronizers/vcpe/steps/sync_vcpetenant.py
index f0e9301..84be777 100644
--- a/xos/synchronizers/vcpe/steps/sync_vcpetenant.py
+++ b/xos/synchronizers/vcpe/steps/sync_vcpetenant.py
@@ -10,7 +10,7 @@
from synchronizers.base.ansible import run_template_ssh
from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
from core.models import Service, Slice
-from services.cord.models import VCPEService, VCPETenant, VOLTTenant
+from services.cord.models import VCPEService, VSGTenant, VOLTTenant
from services.hpc.models import HpcService, CDNPrefix
from xos.logger import Logger, logging
@@ -25,21 +25,21 @@
PARENTAL_MECHANISM="dnsmasq"
ENABLE_QUICK_UPDATE=False
-class SyncVCPETenant(SyncInstanceUsingAnsible):
- provides=[VCPETenant]
- observes=VCPETenant
+class SyncVSGTenant(SyncInstanceUsingAnsible):
+ provides=[VSGTenant]
+ observes=VSGTenant
requested_interval=0
template_name = "sync_vcpetenant.yaml"
service_key_name = "/opt/xos/synchronizers/vcpe/vcpe_private_key"
def __init__(self, *args, **kwargs):
- super(SyncVCPETenant, self).__init__(*args, **kwargs)
+ super(SyncVSGTenant, self).__init__(*args, **kwargs)
def fetch_pending(self, deleted):
if (not deleted):
- objs = VCPETenant.get_tenant_objects().filter(Q(enacted__lt=F('updated')) | Q(enacted=None),Q(lazy_blocked=False))
+ objs = VSGTenant.get_tenant_objects().filter(Q(enacted__lt=F('updated')) | Q(enacted=None),Q(lazy_blocked=False))
else:
- objs = VCPETenant.get_deleted_tenant_objects()
+ objs = VSGTenant.get_deleted_tenant_objects()
return objs
@@ -158,7 +158,7 @@
def sync_fields(self, o, fields):
# the super causes the playbook to be run
- super(SyncVCPETenant, self).sync_fields(o, fields)
+ super(SyncVSGTenant, self).sync_fields(o, fields)
# now do all of our broadbandshield stuff...
@@ -225,9 +225,9 @@
logger.info("quick_update triggered; skipping ansible recipe")
else:
if o.instance.isolation in ["container", "container_vm"]:
- super(SyncVCPETenant, self).run_playbook(o, fields, "sync_vcpetenant_new.yaml")
+ super(SyncVSGTenant, self).run_playbook(o, fields, "sync_vcpetenant_new.yaml")
else:
- super(SyncVCPETenant, self).run_playbook(o, fields)
+ super(SyncVSGTenant, self).run_playbook(o, fields)
o.last_ansible_hash = ansible_hash