Merge branch 'master' of github.com:open-cloud/xos
diff --git a/README.md b/README.md
index 75b07dd..7bed9c5 100644
--- a/README.md
+++ b/README.md
@@ -6,11 +6,14 @@
Additional design notes, presentations, and other collateral are
also available at http://xosproject.org and http://cord.onosproject.org.
-One quick way to get started is to build and run the containers in
-`containers/` (see the README in that directory for more information).
-
-Another quick way to get started is to look at the collection of
+The best way to get started is to look at the collection of
canned configurations in `xos/configurations/`. The `cord`
configuration in that directory corresponds to our current
CORD development environment, and the `README.md` you'll find there
will help you get started.
+
+Source tree layout:
+ * applications -- stand-alone applications that run on top of XOS.
+ * containers -- common Dockerfiles used by various XOS configurations
+ * views -- mechanisms to extend XOS with customized views
+ * xos -- XOS internals
diff --git a/xos/configurations/cord-pod/Makefile b/xos/configurations/cord-pod/Makefile
index 9930c52..1be4a80 100644
--- a/xos/configurations/cord-pod/Makefile
+++ b/xos/configurations/cord-pod/Makefile
@@ -6,6 +6,7 @@
sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/images.yaml
sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/vtn-external.yaml
+ sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/cord/vtn.yaml
nodes.yaml:
export SETUPDIR=.; bash ../common/make-nodes-yaml.sh
diff --git a/xos/configurations/cord/cord.yaml b/xos/configurations/cord/cord.yaml
index f0b45de..e862992 100644
--- a/xos/configurations/cord/cord.yaml
+++ b/xos/configurations/cord/cord.yaml
@@ -12,7 +12,7 @@
type: tosca.nodes.Service
requirements:
- vcpe_tenant:
- node: service_vcpe
+ node: service_vsg
relationship: tosca.relationships.TenantOfService
- lan_network:
node: lan_network
@@ -24,14 +24,14 @@
view_url: /admin/cord/voltservice/$id$/
kind: vOLT
- service_vcpe:
- type: tosca.nodes.VCPEService
+ service_vsg:
+ type: tosca.nodes.VSGService
requirements:
- vbng_tenant:
node: service_vbng
relationship: tosca.relationships.TenantOfService
properties:
- view_url: /admin/cord/vcpeservice/$id$/
+ view_url: /admin/cord/vsgservice/$id$/
backend_network_label: hpc_client
public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
private_key_fn: /opt/xos/synchronizers/vcpe/vcpe_private_key
@@ -270,7 +270,7 @@
type: tosca.nodes.Slice
requirements:
- vcpe_service:
- node: service_vcpe
+ node: service_vsg
relationship: tosca.relationships.MemberOfService
- site:
node: mysite
diff --git a/xos/configurations/frontend/mocks/cord.yaml b/xos/configurations/frontend/mocks/cord.yaml
index 06f4fd2..8c84d8f 100644
--- a/xos/configurations/frontend/mocks/cord.yaml
+++ b/xos/configurations/frontend/mocks/cord.yaml
@@ -12,7 +12,7 @@
type: tosca.nodes.Service
requirements:
- vcpe_tenant:
- node: service_vcpe
+ node: service_vsg
relationship: tosca.relationships.TenantOfService
- lan_network:
node: lan_network
@@ -24,14 +24,14 @@
view_url: /admin/cord/voltservice/$id$/
kind: vOLT
- service_vcpe:
- type: tosca.nodes.VCPEService
+ service_vsg:
+ type: tosca.nodes.VSGService
requirements:
- vbng_tenant:
node: service_vbng
relationship: tosca.relationships.TenantOfService
properties:
- view_url: /admin/cord/vcpeservice/$id$/
+ view_url: /admin/cord/vsgservice/$id$/
backend_network_label: hpc_client
#public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
#private_key_fn: /opt/xos/synchronizers/vcpe/vcpe_private_key
@@ -270,7 +270,7 @@
type: tosca.nodes.Slice
requirements:
- vcpe_service:
- node: service_vcpe
+ node: service_vsg
relationship: tosca.relationships.MemberOfService
- site:
node: mysite
diff --git a/xos/services/cord/admin.py b/xos/services/cord/admin.py
index 5f1a285..5cf6b29 100644
--- a/xos/services/cord/admin.py
+++ b/xos/services/cord/admin.py
@@ -98,7 +98,7 @@
# vCPE
#-----------------------------------------------------------------------------
-class VCPEServiceForm(forms.ModelForm):
+class VSGServiceForm(forms.ModelForm):
bbs_api_hostname = forms.CharField(required=False)
bbs_api_port = forms.IntegerField(required=False)
bbs_server = forms.CharField(required=False)
@@ -106,7 +106,7 @@
bbs_slice = forms.ModelChoiceField(queryset=Slice.objects.all(), required=False)
def __init__(self,*args,**kwargs):
- super (VCPEServiceForm,self ).__init__(*args,**kwargs)
+ super (VSGServiceForm,self ).__init__(*args,**kwargs)
if self.instance:
self.fields['bbs_api_hostname'].initial = self.instance.bbs_api_hostname
self.fields['bbs_api_port'].initial = self.instance.bbs_api_port
@@ -120,13 +120,13 @@
self.instance.bbs_server = self.cleaned_data.get("bbs_server")
self.instance.backend_network_label = self.cleaned_data.get("backend_network_label")
self.instance.bbs_slice = self.cleaned_data.get("bbs_slice")
- return super(VCPEServiceForm, self).save(commit=commit)
+ return super(VSGServiceForm, self).save(commit=commit)
class Meta:
- model = VCPEService
+ model = VSGService
-class VCPEServiceAdmin(ReadOnlyAwareAdmin):
- model = VCPEService
+class VSGServiceAdmin(ReadOnlyAwareAdmin):
+ model = VSGService
verbose_name = "vCPE Service"
verbose_name_plural = "vCPE Service"
list_display = ("backend_status_icon", "name", "enabled")
@@ -137,7 +137,7 @@
'classes':['suit-tab suit-tab-backend']}) ]
readonly_fields = ('backend_status_text', "service_specific_attribute")
inlines = [SliceInline,ServiceAttrAsTabInline,ServicePrivilegeInline]
- form = VCPEServiceForm
+ form = VSGServiceForm
extracontext_registered_admins = True
@@ -156,18 +156,18 @@
) #('hpctools.html', 'top', 'tools') )
def queryset(self, request):
- return VCPEService.get_service_objects_by_user(request.user)
+ return VSGService.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()
+ self.fields['provider_service'].queryset = VSGService.get_service_objects().all()
if self.instance:
# fields for the attributes
self.fields['bbs_account'].initial = self.instance.bbs_account
@@ -178,31 +178,31 @@
# default fields for an 'add' form
self.fields['kind'].initial = VCPE_KIND
self.fields['creator'].initial = get_request().user
- if VCPEService.get_service_objects().exists():
- self.fields["provider_service"].initial = VCPEService.get_service_objects().all()[0]
+ if VSGService.get_service_objects().exists():
+ self.fields["provider_service"].initial = VSGService.get_service_objects().all()[0]
def save(self, commit=True):
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
@@ -362,8 +362,8 @@
admin.site.register(VOLTService, VOLTServiceAdmin)
admin.site.register(VOLTTenant, VOLTTenantAdmin)
-admin.site.register(VCPEService, VCPEServiceAdmin)
-admin.site.register(VCPETenant, VCPETenantAdmin)
+admin.site.register(VSGService, VSGServiceAdmin)
+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..3dfe514 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
@@ -346,11 +308,11 @@
return
if self.vcpe is None:
- vcpeServices = VCPEService.get_service_objects().all()
- if not vcpeServices:
- raise XOSConfigurationError("No VCPE Services available")
+ vsgServices = VSGService.get_service_objects().all()
+ if not vsgServices:
+ raise XOSConfigurationError("No VSG Services available")
- vcpe = VCPETenant(provider_service = vcpeServices[0],
+ vcpe = VSGTenant(provider_service = vsgServices[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()
@@ -428,7 +390,7 @@
# VCPE
# -------------------------------------------
-class VCPEService(Service):
+class VSGService(Service):
KIND = VCPE_KIND
simple_attributes = ( ("bbs_api_hostname", None),
@@ -437,7 +399,7 @@
("backend_network_label", "hpc_client"), )
def __init__(self, *args, **kwargs):
- super(VCPEService, self).__init__(*args, **kwargs)
+ super(VSGService, self).__init__(*args, **kwargs)
class Meta:
app_label = "cord"
@@ -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
@@ -474,7 +436,7 @@
value = value.id
self.set_attribute("bbs_slice_id", value)
-VCPEService.setup_simple_attributes()
+VSGService.setup_simple_attributes()
#class STagBlock(PlCoreBase):
# instance = models.ForeignKey(Instance, related_name="s_tags")
@@ -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
@@ -749,14 +711,14 @@
if self.volt and self.volt.subscriber and self.volt.subscriber.url_filter_enable:
if not self.bbs_account:
- # make sure we use the proxied VCPEService object, not the generic Service object
- vcpe_service = VCPEService.objects.get(id=self.provider_service.id)
+ # make sure we use the proxied VSGService object, not the generic Service object
+ vcpe_service = VSGService.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/base/SyncSliverUsingAnsible.py b/xos/synchronizers/base/SyncSliverUsingAnsible.py
deleted file mode 100644
index c64e5ea..0000000
--- a/xos/synchronizers/base/SyncSliverUsingAnsible.py
+++ /dev/null
@@ -1,95 +0,0 @@
-import hashlib
-import os
-import socket
-import sys
-import base64
-import time
-from django.db.models import F, Q
-from xos.config import Config
-from synchronizers.base.syncstep import SyncStep
-from synchronizers.base.ansible import run_template_ssh
-from core.models import Service, Slice
-from xos.logger import Logger, logging
-
-logger = Logger(level=logging.INFO)
-
-class SyncInstanceUsingAnsible(SyncStep):
- # All of the following should be defined for classes derived from this
- # base class. Examples below use VCPETenant.
-
- # provides=[VCPETenant]
- # observes=VCPETenant
- # requested_interval=0
- # template_name = "sync_vcpetenant.yaml"
- # service_key_name = "/opt/xos/observers/vcpe/vcpe_private_key"
-
- def __init__(self, **args):
- SyncStep.__init__(self, **args)
-
- def defer_sync(self, o, reason):
- logger.info("defer object %s due to %s" % (str(o), reason))
- raise Exception("defer object %s due to %s" % (str(o), reason))
-
- def get_extra_attributes(self, o):
- # This is a place to include extra attributes that aren't part of the
- # object itself.
-
- return {}
-
- def get_instance(self, o):
- # We need to know what instance is associated with the object. Let's
- # assume 'o' has a field called 'instance'. If the field is called
- # something else, or if custom logic is needed, then override this
- # method.
-
- return o.instance
-
- def run_playbook(self, o, fields):
- tStart = time.time()
- run_template_ssh(self.template_name, fields)
- logger.info("playbook execution time %d" % int(time.time()-tStart))
-
- def pre_sync_hook(self, o, fields):
- pass
-
- def post_sync_hook(self, o, fields):
- pass
-
- def sync_fields(self, o, fields):
- self.run_playbook(o, fields)
-
- def sync_record(self, o):
- logger.info("sync'ing object %s" % str(o))
-
- instance = self.get_instance(o)
- if not instance:
- self.defer_sync(o, "waiting on instance")
- return
-
- if not os.path.exists(self.service_key_name):
- raise Exception("Service key %s does not exist" % self.service_key_name)
-
- service_key = file(self.service_key_name).read()
-
- fields = { "instance_name": instance.name,
- "hostname": instance.node.name,
- "instance_id": instance.instance_id,
- "private_key": service_key,
- "ansible_tag": "vcpe_tenant_" + str(o.id)
- }
-
- # If 'o' defines a 'sync_attributes' list, then we'll copy those
- # attributes into the Ansible recipe's field list automatically.
- if hasattr(o, "sync_attributes"):
- for attribute_name in o.sync_attributes:
- fields[attribute_name] = getattr(o, attribute_name)
-
- fields.update(self.get_extra_attributes(o))
-
- self.sync_fields(o, fields)
-
- o.save()
-
- def delete_record(self, m):
- pass
-
diff --git a/xos/synchronizers/onos/steps/sync_onosservice.py b/xos/synchronizers/onos/steps/sync_onosservice.py
index e1f62c7..944a05c 100644
--- a/xos/synchronizers/onos/steps/sync_onosservice.py
+++ b/xos/synchronizers/onos/steps/sync_onosservice.py
@@ -54,7 +54,6 @@
fields={}
fields["instance_hostname"] = self.get_instance(o).instance_name.replace("_","-")
fields["appname"] = o.name
- fields["ssh_ip"] = self.get_instance(o).get_ssh_ip()
fields["ONOS_container"] = "ONOS"
return fields
diff --git a/xos/synchronizers/vbng/steps/sync_vbngtenant.py b/xos/synchronizers/vbng/steps/sync_vbngtenant.py
index 94875f4..4fa351e 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 VSGService, 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..bbb3ad5 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 VSGService, 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
@@ -47,7 +47,7 @@
if not o.provider_service:
return None
- vcpes = VCPEService.get_service_objects().filter(id=o.provider_service.id)
+ vcpes = VSGService.get_service_objects().filter(id=o.provider_service.id)
if not vcpes:
return None
@@ -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
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 760e3c9..9df9de9 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -202,9 +202,9 @@
type: string
required: false
- tosca.nodes.VCPEService:
+ tosca.nodes.VSGService:
description: >
- CORD: The vCPE Service.
+ CORD: The vSG Service.
derived_from: tosca.nodes.Root
capabilities:
xos_base_service_caps
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 8135b7f..8535ada 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -260,9 +260,9 @@
type: string
required: false
- tosca.nodes.VCPEService:
+ tosca.nodes.VSGService:
description: >
- CORD: The vCPE Service.
+ CORD: The vSG Service.
derived_from: tosca.nodes.Root
capabilities:
scalable:
diff --git a/xos/tosca/resources/vcpeservice.py b/xos/tosca/resources/vcpeservice.py
index abcdea9..5c478ac 100644
--- a/xos/tosca/resources/vcpeservice.py
+++ b/xos/tosca/resources/vcpeservice.py
@@ -5,12 +5,12 @@
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
-from services.cord.models import VCPEService
+from services.cord.models import VSGService
from service import XOSService
-class XOSVcpeService(XOSService):
- provides = "tosca.nodes.VCPEService"
- xos_model = VCPEService
+class XOSVsgService(XOSService):
+ provides = "tosca.nodes.VSGService"
+ xos_model = VSGService
copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "private_key_fn", "versionNumber", "backend_network_label"]