Merge pull request #139 from open-cloud/feature/remove_old_hello
Committed after discussion on 2016-04-21
diff --git a/xos/configurations/frontend/xos.sql b/xos/configurations/frontend/xos.sql
index 7b13f4d..bbfd15a 100644
--- a/xos/configurations/frontend/xos.sql
+++ b/xos/configurations/frontend/xos.sql
@@ -5163,12 +5163,6 @@
265 Can add vbng tenant 12 add_vbngtenant
266 Can change vbng tenant 12 change_vbngtenant
267 Can delete vbng tenant 12 delete_vbngtenant
-268 Can add Hello World Service 7 add_helloworldservicecomplete
-269 Can change Hello World Service 7 change_helloworldservicecomplete
-270 Can delete Hello World Service 7 delete_helloworldservicecomplete
-271 Can add Hello World Tenant 12 add_helloworldtenantcomplete
-272 Can change Hello World Tenant 12 change_helloworldtenantcomplete
-273 Can delete Hello World Tenant 12 delete_helloworldtenantcomplete
274 Can add ONOS Service 7 add_onosservice
275 Can change ONOS Service 7 change_onosservice
276 Can delete ONOS Service 7 delete_onosservice
@@ -6509,8 +6503,6 @@
87 cord subscriber root cord cordsubscriberroot
88 vOLT Service cord voltservice
89 vSG Service cord vsgservice
-90 Hello World Tenant helloworldservice_complete helloworldtenantcomplete
-91 Hello World Service helloworldservice_complete helloworldservicecomplete
92 ONOS Service onos onosservice
93 onos app onos onosapp
94 s flow tenant ceilometer sflowtenant
@@ -6548,7 +6540,6 @@
4 auth 0001_initial 2016-04-05 17:41:46.384468+00
5 ceilometer 0001_initial 2016-04-05 17:41:46.659809+00
6 cord 0001_initial 2016-04-05 17:41:46.862406+00
-7 helloworldservice_complete 0001_initial 2016-04-05 17:41:47.056651+00
8 hpc 0001_initial 2016-04-05 17:41:50.450946+00
9 onos 0001_initial 2016-04-05 17:41:50.637887+00
10 requestrouter 0001_initial 2016-04-05 17:41:51.319325+00
diff --git a/xos/core/xoslib/dashboards/helloworld.html b/xos/core/xoslib/dashboards/helloworld.html
deleted file mode 100644
index 91dde39..0000000
--- a/xos/core/xoslib/dashboards/helloworld.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!-- /opt/xos/templates/admin/dashboard/helloworld.html -->
-<div>Hello, {{ user.firstname }} {{ user.lastname }}.</div>
-<div>This is the hello world view. The value of foobar is {{ foobar }}.</div>
-<div id="dynamicTableOfInterestingThings"></div>
-<p>Type a new description for the the first slice in the collection:</p>
-<input type="text" name="newDescription" id="newDescription">
-<input type="button" name="submitNewDescription" value="submit new description" id="submitNewDescription">
-
-<script src="{{ STATIC_URL }}/js/vendor/underscore-min.js"></script>
-<script src="{{ STATIC_URL }}/js/vendor/backbone.js"></script>
-<script src="{{ STATIC_URL }}/js/xoslib/xos-defaults.js"></script>
-<script src="{{ STATIC_URL }}/js/xoslib/xos-backbone.js"></script>
-
-<script src="{{ STATIC_URL }}/js/helloworld.js"></script>
diff --git a/xos/core/xoslib/static/js/helloworld.js b/xos/core/xoslib/static/js/helloworld.js
deleted file mode 100644
index 166d183..0000000
--- a/xos/core/xoslib/static/js/helloworld.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* eslint-disable guard-for-in, space-before-blocks */
-
-// helloworld.js
-function updateHelloWorldData() {
- var html = '<table class="table table-bordered table-striped">';
-
- for (var slicekey in xos.slices.models) {
- var slice = xos.slices.models[slicekey];
-
- html = html + '<tr><td>' + slice.get('name') + '</td><td>' + slice.get('description') + '</td></tr>';
- }
- html = html + '</table>';
- $('#dynamicTableOfInterestingThings').html(html);
-}
-
-$(document).ready(function() {
- xos.slices.on('change', function() {
- updateHelloWorldData();
- });
- xos.slices.on('remove', function() {
- updateHelloWorldData();
- });
- xos.slices.on('sort', function() {
- updateHelloWorldData();
- });
-
- xos.slices.startPolling();
-});
-
-// helloworld.js
-$(document).ready(function() {
- $('#submitNewDescription').bind('click', function() {
- var newDescription = $('#newDescription').val();
-
- xos.slices.models[0].set('description', newDescription);
- xos.slices.models[0].save();
- });
-});
diff --git a/xos/services/helloworld/__init__.py b/xos/services/helloworld/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/xos/services/helloworld/__init__.py
+++ /dev/null
diff --git a/xos/services/helloworld/models.py b/xos/services/helloworld/models.py
deleted file mode 100644
index 9bb343e..0000000
--- a/xos/services/helloworld/models.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from django.db import models
-from core.models import User, Service, SingletonModel, PlCoreBase, Instance
-from core.models.plcorebase import StrippedCharField
-import os
-from django.db import models
-from django.forms.models import model_to_dict
-from django.db.models import Q
-
-
-# Create your models here.
-
-class Hello(PlCoreBase):
- name = models.CharField(max_length=254,help_text="Salutation e.g. Hello or Bonjour")
- instance_backref = models.ForeignKey(Instance,related_name="hellos")
-
-class World(PlCoreBase):
- name = models.CharField(max_length=254,help_text="Name of planet")
- hello = models.ForeignKey(Hello)
diff --git a/xos/services/helloworld/view.py b/xos/services/helloworld/view.py
deleted file mode 100644
index 6ad9ae1..0000000
--- a/xos/services/helloworld/view.py
+++ /dev/null
@@ -1,57 +0,0 @@
-from django.http import HttpResponse
-from django.views.generic import TemplateView, View
-from django import template
-from core.models import *
-from services.helloworld.models import *
-import json
-import os
-import time
-import tempfile
-
-class HelloWorldView(TemplateView):
- head_template = r"""{% extends "admin/dashboard/dashboard_base.html" %}
- {% load admin_static %}
- {% block content %}
- """
-
- tail_template = r"{% endblock %}"
-
- def get(self, request, name="root", *args, **kwargs):
- head_template = self.head_template
- tail_template = self.tail_template
-
- try:
- hello_name = request.GET['hello_name']
- world_name = request.GET['world_name']
- instance_id_str = request.GET['instance_id']
- instance_id = int(instance_id_str)
-
- i = Instance.objects.get(pk=instance_id)
- i.pk=None
- i.userData=None
- i.instance_id=None
- i.instance_name=None
- i.enacted=None
- i.save()
- h = Hello(name=hello_name,instance_backref=i)
- h.save()
- w = World(hello=h,name=world_name)
- w.save()
-
- t = template.Template(head_template + 'Done. New instance id: %r'%i.pk + self.tail_template)
- except KeyError:
- html = """<form>
- Hello string: <input type="text" name="hello_name" placeholder="Planet"><br>
- World string: <input type="text" name="world_name" placeholder="Earth"><br>
- Id of instance to copy: <input type="text" name="instance_id" placeholder="3"><br>
- <input type="submit" value="Submit">
- </form>"""
-
- t = template.Template(head_template + html + self.tail_template)
-
- response_kwargs = {}
- response_kwargs.setdefault('content_type', self.content_type)
- return self.response_class(
- request = request,
- template = t,
- **response_kwargs)
diff --git a/xos/services/helloworldservice_complete/__init__.py b/xos/services/helloworldservice_complete/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/xos/services/helloworldservice_complete/__init__.py
+++ /dev/null
diff --git a/xos/services/helloworldservice_complete/admin.py b/xos/services/helloworldservice_complete/admin.py
deleted file mode 100644
index 3c8e793..0000000
--- a/xos/services/helloworldservice_complete/admin.py
+++ /dev/null
@@ -1,141 +0,0 @@
-
-from core.admin import ReadOnlyAwareAdmin, SliceInline
-from core.middleware import get_request
-from core.models import User
-from django import forms
-from django.contrib import admin
-from services.helloworldservice_complete.models import HelloWorldServiceComplete, HelloWorldTenantComplete, HELLO_WORLD_KIND
-
-# The class to provide an admin interface on the web for the service.
-# We do only configuration here and don't change any logic because the logic
-# is taken care of for us by ReadOnlyAwareAdmin
-class HelloWorldServiceCompleteAdmin(ReadOnlyAwareAdmin):
- # We must set the model so that the admin knows what fields to use
- model = HelloWorldServiceComplete
- verbose_name = "Hello World Service"
- verbose_name_plural = "Hello World Services"
-
- # Setting list_display creates columns on the admin page, each value here
- # is a column, the column is populated for every instance of the model.
- list_display = ("backend_status_icon", "name", "enabled")
-
- # Used to indicate which values in the columns of the admin form are links.
- list_display_links = ('backend_status_icon', 'name', )
-
- # Denotes the sections of the form, the fields in the section, and the
- # CSS classes used to style them. We represent this as a set of tuples, each
- # tuple as a name (or None) and a set of fields and classes.
- # Here the first section does not have a name so we use none. That first
- # section has several fields indicated in the 'fields' attribute, and styled
- # by the classes indicated in the 'classes' attribute. The classes given
- # here are important for rendering the tabs on the form. To give the tabs
- # we must assign the classes suit-tab and suit-tab-<name> where
- # where <name> will be used later.
- fieldsets = [(None, {'fields': ['backend_status_text', 'name', 'enabled',
- 'versionNumber', 'description', "view_url"],
- 'classes':['suit-tab suit-tab-general']})]
-
- # Denotes the fields that are readonly and cannot be changed.
- readonly_fields = ('backend_status_text', )
-
- # Inlines are used to denote other models that can be edited on the same
- # form as this one. In this case the service form also allows changes
- # to slices.
- inlines = [SliceInline]
-
- extracontext_registered_admins = True
-
- # Denotes the fields that can be changed by an admin but not be all users
- user_readonly_fields = ["name", "enabled", "versionNumber", "description"]
-
- # Associates fieldsets from this form and from the inlines.
- # The format here are tuples, of (<name>, tab title). <name> comes from the
- # <name> in the fieldsets.
- suit_form_tabs = (('general', 'Hello World Service Details'),
- ('administration', 'Tenants'),
- ('slices', 'Slices'),)
-
- # Used to include a template for a tab. Here we include the
- # helloworldserviceadmin template in the top position for the administration
- # tab.
- suit_form_includes = (('helloworldserviceadmin.html',
- 'top',
- 'administration'),)
-
- # Used to get the objects for this model that are associated with the
- # requesting user.
- def queryset(self, request):
- return HelloWorldServiceComplete.get_service_objects_by_user(request.user)
-
-# Class to represent the form to add and edit tenants.
-# We need to define this instead of just using an admin like we did for the
-# service because tenants vary more than services and there isn't a common form.
-# This allows us to change the python behavior for the admin form to save extra
-# fields and control defaults.
-class HelloWorldTenantCompleteForm(forms.ModelForm):
- # Defines a field for the creator of this service. It is a dropdown which
- # is populated with all of the users.
- creator = forms.ModelChoiceField(queryset=User.objects.all())
- # Defines a text field for the display message, it is not required.
- display_message = forms.CharField(required=False)
-
- def __init__(self, *args, **kwargs):
- super(HelloWorldTenantCompleteForm, self).__init__(*args, **kwargs)
- # Set the kind field to readonly
- self.fields['kind'].widget.attrs['readonly'] = True
- # Define the logic for obtaining the objects for the provider_service
- # dropdown of the tenant form.
- self.fields[
- 'provider_service'].queryset = HelloWorldServiceComplete.get_service_objects().all()
- # Set the initial kind to HELLO_WORLD_KIND for this tenant.
- self.fields['kind'].initial = HELLO_WORLD_KIND
- # If there is an instance of this model then we can set the initial
- # form values to the existing values.
- if self.instance:
- self.fields['creator'].initial = self.instance.creator
- self.fields[
- 'display_message'].initial = self.instance.display_message
-
- # If there is not an instance then we need to set initial values.
- if (not self.instance) or (not self.instance.pk):
- self.fields['creator'].initial = get_request().user
- if HelloWorldServiceComplete.get_service_objects().exists():
- self.fields["provider_service"].initial = HelloWorldServiceComplete.get_service_objects().all()[0]
-
- # This function describes what happens when the save button is pressed on
- # the tenant form. In this case we set the values for the instance that were
- # entered.
- def save(self, commit=True):
- self.instance.creator = self.cleaned_data.get("creator")
- self.instance.display_message = self.cleaned_data.get(
- "display_message")
- return super(HelloWorldTenantCompleteForm, self).save(commit=commit)
-
- class Meta:
- model = HelloWorldTenantComplete
-
-# Define the admin form for the tenant. This uses a similar structure as the
-# service but uses HelloWorldTenantCompleteForm to change the python behavior.
-
-
-class HelloWorldTenantCompleteAdmin(ReadOnlyAwareAdmin):
- verbose_name = "Hello World Tenant"
- verbose_name_plural = "Hello World Tenants"
- list_display = ('id', 'backend_status_icon', 'instance', 'display_message')
- list_display_links = ('backend_status_icon', 'instance', 'display_message',
- 'id')
- fieldsets = [(None, {'fields': ['backend_status_text', 'kind',
- 'provider_service', 'instance', 'creator',
- 'display_message'],
- 'classes': ['suit-tab suit-tab-general']})]
- readonly_fields = ('backend_status_text', 'instance',)
- form = HelloWorldTenantCompleteForm
-
- suit_form_tabs = (('general', 'Details'),)
-
- def queryset(self, request):
- return HelloWorldTenantComplete.get_tenant_objects_by_user(request.user)
-
-# Associate the admin forms with the models.
-admin.site.register(HelloWorldServiceComplete, HelloWorldServiceCompleteAdmin)
-admin.site.register(HelloWorldTenantComplete, HelloWorldTenantCompleteAdmin)
diff --git a/xos/services/helloworldservice_complete/models.py b/xos/services/helloworldservice_complete/models.py
deleted file mode 100644
index 8a4ce59..0000000
--- a/xos/services/helloworldservice_complete/models.py
+++ /dev/null
@@ -1,113 +0,0 @@
-from core.models import Service, TenantWithContainer
-from django.db import transaction
-
-HELLO_WORLD_KIND = "helloworldservice_complete"
-
-# The class to represent the service. Most of the service logic is given for us
-# in the Service class but, we have some configuration that is specific for
-# this example.
-class HelloWorldServiceComplete(Service):
- KIND = HELLO_WORLD_KIND
-
- class Meta:
- # When the proxy field is set to True the model is represented as
- # it's superclass in the database, but we can still change the python
- # behavior. In this case HelloWorldServiceComplete is a Service in the
- # database.
- proxy = True
- # The name used to find this service, all directories are named this
- app_label = "helloworldservice_complete"
- verbose_name = "Hello World Service"
-
-# This is the class to represent the tenant. Most of the logic is given to use
-# in TenantWithContainer, however there is some configuration and logic that
-# we need to define for this example.
-class HelloWorldTenantComplete(TenantWithContainer):
-
- class Meta:
- # Same as a above, HelloWorldTenantComplete is represented as a
- # TenantWithContainer, but we change the python behavior.
- proxy = True
- verbose_name = "Hello World Tenant"
-
- # The kind of the service is used on forms to differentiate this service
- # from the other services.
- KIND = HELLO_WORLD_KIND
-
- # Ansible requires that the sync_attributes field contain nat_ip and nat_mac
- # these will be used to determine where to SSH to for ansible.
- # Getters must be defined for every attribute specified here.
- sync_attributes = ("nat_ip", "nat_mac",)
-
- # default_attributes is used cleanly indicate what the default values for
- # the fields are.
- default_attributes = {'display_message': 'Hello World!'}
-
- def __init__(self, *args, **kwargs):
- helloworld_services = HelloWorldServiceComplete.get_service_objects().all()
- # When the tenant is created the default service in the form is set
- # to be the first created HelloWorldServiceComplete
- if helloworld_services:
- self._meta.get_field(
- "provider_service").default = helloworld_services[0].id
- super(HelloWorldTenantComplete, self).__init__(*args, **kwargs)
-
- def save(self, *args, **kwargs):
- super(HelloWorldTenantComplete, self).save(*args, **kwargs)
- # This call needs to happen so that an instance is created for this
- # tenant is created in the slice. One instance is created per tenant.
- model_policy_helloworld_tenant(self.pk)
-
- def delete(self, *args, **kwargs):
- # Delete the instance that was created for this tenant
- self.cleanup_container()
- super(HelloWorldTenantComplete, self).delete(*args, **kwargs)
-
- # Getter for the message that will appear on the webpage
- # By default it is "Hello World!"
- @property
- def display_message(self):
- return self.get_attribute(
- "display_message",
- self.default_attributes['display_message'])
-
- # Setter for the message that will appear on the webpage
- @display_message.setter
- def display_message(self, value):
- self.set_attribute("display_message", value)
-
- @property
- def addresses(self):
- if (not self.id) or (not self.instance):
- return {}
-
- addresses = {}
- # The ports field refers to networks for the instance.
- # This loop stores the details for the NAT network that will be
- # necessary for ansible.
- for ns in self.instance.ports.all():
- if "nat" in ns.network.name.lower():
- addresses["nat"] = (ns.ip, ns.mac)
- return addresses
-
- # This getter is necessary because nat_ip is a sync_attribute
- @property
- def nat_ip(self):
- return self.addresses.get("nat", (None, None))[0]
-
- # This getter is necessary because nat_mac is a sync_attribute
- @property
- def nat_mac(self):
- return self.addresses.get("nat", (None, None))[1]
-
-
-def model_policy_helloworld_tenant(pk):
- # This section of code is atomic to prevent race conditions
- with transaction.atomic():
- # We find all of the tenants that are waiting to update
- tenant = HelloWorldTenantComplete.objects.select_for_update().filter(pk=pk)
- if not tenant:
- return
- # Since this code is atomic it is safe to always use the first tenant
- tenant = tenant[0]
- tenant.manage_container()
diff --git a/xos/services/helloworldservice_complete/templates/helloworldserviceadmin.html b/xos/services/helloworldservice_complete/templates/helloworldserviceadmin.html
deleted file mode 100644
index ba418ee..0000000
--- a/xos/services/helloworldservice_complete/templates/helloworldserviceadmin.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!-- Template used to for the button leading to the HelloWorldTenantComplete form. -->
-<div class = "left-nav">
- <ul>
- <li>
- <a href="/admin/helloworldservice_complete/helloworldtenantcomplete/">
- Hello World Tenants
- </a>
- </li>
- </ul>
-</div>
diff --git a/xos/synchronizers/helloworld/helloworld-synchronizer.py b/xos/synchronizers/helloworld/helloworld-synchronizer.py
deleted file mode 100755
index 84bec4f..0000000
--- a/xos/synchronizers/helloworld/helloworld-synchronizer.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-
-# This imports and runs ../../xos-observer.py
-
-import importlib
-import os
-import sys
-observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../../synchronizers/base")
-sys.path.append(observer_path)
-mod = importlib.import_module("xos-synchronizer")
-mod.main()
diff --git a/xos/synchronizers/helloworld/helloworld_config b/xos/synchronizers/helloworld/helloworld_config
deleted file mode 100644
index 1f67242..0000000
--- a/xos/synchronizers/helloworld/helloworld_config
+++ /dev/null
@@ -1,47 +0,0 @@
-[plc]
-name=plc
-deployment=plc
-
-[db]
-name=xos
-user=postgres
-password=password
-host=localhost
-port=5432
-
-[api]
-host=localhost
-port=8000
-ssl_key=None
-ssl_cert=None
-ca_ssl_cert=None
-ratelimit_enabled=0
-omf_enabled=0
-mail_support_address=support@localhost
-nova_enabled=True
-logfile=/var/log/xos.log
-
-[nova]
-admin_user=admin@domain.com
-admin_password=admin
-admin_tenant=admin
-url=http://localhost:5000/v2.0/
-default_image=None
-default_flavor=m1.small
-default_security_group=default
-ca_ssl_cert=/etc/ssl/certs/ca-certificates.crt
-
-[observer]
-pretend=False
-backoff_disabled=False
-images_directory=/opt/xos/images
-dependency_graph=/opt/xos/model-deps
-logfile=/var/log/xos_backend.log
-steps_dir=/opt/xos/synchronizers/helloworld/steps
-applist=helloworld
-
-[gui]
-disable_minidashboard=True
-#branding_name=CORD
-#branding_css=/static/cord.css
-#branding_icon=/static/onos-logo.png
diff --git a/xos/synchronizers/helloworld/model-deps b/xos/synchronizers/helloworld/model-deps
deleted file mode 100644
index 63188f0..0000000
--- a/xos/synchronizers/helloworld/model-deps
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "OriginServer": [
- "ContentProvider"
- ],
- "ContentProvider": [
- "ServiceProvider"
- ],
- "CDNPrefix": [
- "ContentProvider"
- ],
- "AccessMap": [
- "ContentProvider"
- ],
- "SiteMap": [
- "ContentProvider",
- "ServiceProvider",
- "CDNPrefix"
- ]
-}
diff --git a/xos/synchronizers/helloworld/nohup.out b/xos/synchronizers/helloworld/nohup.out
deleted file mode 100644
index 74072c6..0000000
--- a/xos/synchronizers/helloworld/nohup.out
+++ /dev/null
@@ -1 +0,0 @@
-python: can't open file 'helloworld-observer.py': [Errno 2] No such file or directory
diff --git a/xos/synchronizers/helloworld/run.sh b/xos/synchronizers/helloworld/run.sh
deleted file mode 100755
index 1b9d834..0000000
--- a/xos/synchronizers/helloworld/run.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#if [[ ! -e ./hpc-backend.py ]]; then
-# ln -s ../xos-observer.py hpc-backend.py
-#fi
-
-export XOS_DIR=/opt/xos
-python helloworld-synchronizer.py -C $XOS_DIR/synchronizers/helloworld/helloworld_config
diff --git a/xos/synchronizers/helloworld/start.sh b/xos/synchronizers/helloworld/start.sh
deleted file mode 100755
index 7945db3..0000000
--- a/xos/synchronizers/helloworld/start.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-export XOS_DIR=/opt/xos
-
-echo $XOS_DIR/synchronizers/helloworld/helloworld_config
-python helloworld-synchronizer.py -C $XOS_DIR/synchronizers/helloworld/helloworld_config
diff --git a/xos/synchronizers/helloworld/steps/sync_hello.py b/xos/synchronizers/helloworld/steps/sync_hello.py
deleted file mode 100644
index 55d318a..0000000
--- a/xos/synchronizers/helloworld/steps/sync_hello.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import os
-import sys
-import base64
-from django.db.models import F, Q
-from xos.config import Config
-from synchronizers.base.syncstep import SyncStep
-from services.helloworld.models import Hello,World
-from xos.logger import Logger, logging
-
-parentdir = os.path.join(os.path.dirname(__file__),"..")
-sys.path.insert(0,parentdir)
-
-logger = Logger(level=logging.INFO)
-
-class SyncHello(SyncStep):
- provides=[Hello]
- observes=Hello
- requested_interval=0
-
- def sync_record(self, record):
- instance = record.instance_backref
- instance.userData="packages:\n - apache2\nruncmd:\n - update-rc.d apache2 enable\n - service apache2 start\nwrite_files:\n- content: Hello %s\n path: /var/www/html/hello.txt"%record.name
- instance.save()
-
- def delete_record(self, m):
- return
diff --git a/xos/synchronizers/helloworld/steps/sync_world.py b/xos/synchronizers/helloworld/steps/sync_world.py
deleted file mode 100644
index a4e7e3c..0000000
--- a/xos/synchronizers/helloworld/steps/sync_world.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import os
-import sys
-import base64
-from django.db.models import F, Q
-from xos.config import Config
-from synchronizers.base.syncstep import SyncStep
-from services.helloworld.models import Hello,World
-from xos.logger import Logger, logging
-
-# hpclibrary will be in steps/..
-parentdir = os.path.join(os.path.dirname(__file__),"..")
-sys.path.insert(0,parentdir)
-
-logger = Logger(level=logging.INFO)
-
-class SyncWorld(SyncStep):
- provides=[World]
- observes=World
- requested_interval=0
-
- def sync_record(self, record):
- open('/tmp/hello-synchronizer','w').write(record.name)
-
- def delete_record(self, m):
- return
diff --git a/xos/synchronizers/helloworld/stop.sh b/xos/synchronizers/helloworld/stop.sh
deleted file mode 100755
index a0b4a8e..0000000
--- a/xos/synchronizers/helloworld/stop.sh
+++ /dev/null
@@ -1 +0,0 @@
-pkill -9 -f hpc-observer.py
diff --git a/xos/synchronizers/helloworldservice_complete/helloworldservice-synchronizer.py b/xos/synchronizers/helloworldservice_complete/helloworldservice-synchronizer.py
deleted file mode 100755
index 95f4081..0000000
--- a/xos/synchronizers/helloworldservice_complete/helloworldservice-synchronizer.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-
-# This imports and runs ../../xos-observer.py
-# Runs the standard XOS observer
-
-import importlib
-import os
-import sys
-observer_path = os.path.join(os.path.dirname(
- os.path.realpath(__file__)), "../../synchronizers/base")
-sys.path.append(observer_path)
-mod = importlib.import_module("xos-synchronizer")
-mod.main()
diff --git a/xos/synchronizers/helloworldservice_complete/helloworldservice_config b/xos/synchronizers/helloworldservice_complete/helloworldservice_config
deleted file mode 100644
index 69894fc..0000000
--- a/xos/synchronizers/helloworldservice_complete/helloworldservice_config
+++ /dev/null
@@ -1,36 +0,0 @@
-# Required by XOS
-[db]
-name=xos
-user=postgres
-password=password
-host=localhost
-port=5432
-
-# Required by XOS
-[api]
-nova_enabled=True
-
-# Sets options for the observer
-[observer]
-# Optional name
-name=helloworldservice
-# This is the location to the dependency graph you generate
-dependency_graph=/opt/xos/synchronizers/helloworldservice_complete/model-deps
-# The location of your SyncSteps
-steps_dir=/opt/xos/synchronizers/helloworldservice_complete/steps
-# A temporary directory that will be used by ansible
-sys_dir=/opt/xos/synchronizers/helloworldservice_complete/sys
-# Location of the file to save logging messages to the backend log is often used
-logfile=/var/log/xos_backend.log
-# If this option is true, then nothing will change, we simply pretend to run
-pretend=False
-# If this is False then XOS will use an exponential backoff when the observer
-# fails, since we will be waiting for an instance, we don't want this.
-backoff_disabled=True
-# We want the output from ansible to be logged
-save_ansible_output=True
-# This determines how we SSH to a client, if this is set to True then we try
-# to ssh using the instance name as a proxy, if this is disabled we ssh using
-# the NAT IP of the instance. On CloudLab the first option will fail so we must
-# set this to False
-proxy_ssh=False
diff --git a/xos/synchronizers/helloworldservice_complete/model-deps b/xos/synchronizers/helloworldservice_complete/model-deps
deleted file mode 100644
index 0967ef4..0000000
--- a/xos/synchronizers/helloworldservice_complete/model-deps
+++ /dev/null
@@ -1 +0,0 @@
-{}
diff --git a/xos/synchronizers/helloworldservice_complete/run.sh b/xos/synchronizers/helloworldservice_complete/run.sh
deleted file mode 100755
index 331f8ae..0000000
--- a/xos/synchronizers/helloworldservice_complete/run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-# Runs the XOS observer using helloworldservice_config
-export XOS_DIR=/opt/xos
-python helloworldservice-synchronizer.py -C $XOS_DIR/synchronizers/helloworldservice_complete/helloworldservice_config
diff --git a/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.py b/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.py
deleted file mode 100644
index 69a08f5..0000000
--- a/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import os
-import sys
-from django.db.models import Q, F
-from services.helloworldservice_complete.models import HelloWorldServiceComplete, HelloWorldTenantComplete
-from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
-
-parentdir = os.path.join(os.path.dirname(__file__), "..")
-sys.path.insert(0, parentdir)
-
-# Class to define how we sync a tenant. Using SyncInstanceUsingAnsible we
-# indicate where the find the YAML for ansible, where to find the SSH key,
-# and the logic for determining what tenant needs updating, what additional
-# attributes are needed, and how to delete an instance.
-class SyncHelloWorldTenantComplete(SyncInstanceUsingAnsible):
- # Indicates the position in the data model, this will run when XOS needs to
- # enact a HelloWorldTenantComplete
- provides = [HelloWorldTenantComplete]
- # The actual model being enacted, usually the same as provides.
- observes = HelloWorldTenantComplete
- # Number of milliseconds between interruptions of the observer
- requested_interval = 0
- # The ansible template to run
- template_name = "sync_helloworldtenant.yaml"
- # The location of the SSH private key to use when ansible connects to
- # instances.
- service_key_name = "/opt/xos/synchronizers/helloworldservice_complete/helloworldservice_private_key"
-
- def __init__(self, *args, **kwargs):
- super(SyncHelloWorldTenantComplete, self).__init__(*args, **kwargs)
-
- # Defines the logic for determining what HelloWorldTenantCompletes need to be
- # enacted.
- def fetch_pending(self, deleted):
- # If the update is not a deletion, then we get all of the instnaces that
- # have been updated or have not been enacted.
- if (not deleted):
- objs = HelloWorldTenantComplete.get_tenant_objects().filter(
- Q(enacted__lt=F('updated')) | Q(enacted=None), Q(lazy_blocked=False))
- else:
- # If this is a deletion we get all of the deleted tenants..
- objs = HelloWorldTenantComplete.get_deleted_tenant_objects()
-
- return objs
-
- # Gets the attributes that are used by the Ansible template but are not
- # part of the set of default attributes.
- def get_extra_attributes(self, o):
- return {"display_message": o.display_message}
diff --git a/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.yaml b/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.yaml
deleted file mode 100644
index 719c75f..0000000
--- a/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
----
-- hosts: {{ instance_name }}
- gather_facts: False
- connection: ssh
- user: ubuntu
- sudo: yes
- tasks:
- - name: install apache
- apt: name=apache2 state=present update_cache=yes
-
- - name: write message
- shell: echo "{{ display_message }}" > /var/www/html/index.html
-
- - name: stop apache
- service: name=apache2 state=stopped
-
- - name: start apache
- service: name=apache2 state=started
diff --git a/xos/synchronizers/helloworldservice_complete/stop.sh b/xos/synchronizers/helloworldservice_complete/stop.sh
deleted file mode 100755
index 76e68d9..0000000
--- a/xos/synchronizers/helloworldservice_complete/stop.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-# Kill the observer
-pkill -9 -f helloworldservice-observer.py
diff --git a/xos/tools/xos-manage b/xos/tools/xos-manage
index 7fed845..172bbd7 100755
--- a/xos/tools/xos-manage
+++ b/xos/tools/xos-manage
@@ -144,7 +144,6 @@
python ./manage.py makemigrations syndicate_storage
python ./manage.py makemigrations cord
python ./manage.py makemigrations ceilometer
- python ./manage.py makemigrations helloworldservice_complete
python ./manage.py makemigrations onos
python ./manage.py makemigrations vtr
python ./manage.py makemigrations vrouter
diff --git a/xos/tosca/samples/helloworld-chain.yaml b/xos/tosca/samples/helloworld-chain.yaml
deleted file mode 100644
index 8b49106..0000000
--- a/xos/tosca/samples/helloworld-chain.yaml
+++ /dev/null
@@ -1,76 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Two services "service_one" and "service_two" with a tenancy relationship.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
-
- Private-Indirect:
- type: tosca.nodes.NetworkTemplate
- properties:
- access: indirect
-
- mysite:
- type: tosca.nodes.Site
-
- trusty-server-multi-nic:
- type: tosca.nodes.Image
-
- service_vsg:
- type: tosca.nodes.VSGService
- requirements:
- - helloworld_tenant:
- node: service_helloworld
- relationship: tosca.relationships.TenantOfService
-
- service_helloworld:
- type: tosca.nodes.Service
- properties:
- kind: helloworldservice_complete
- view_url: /admin/helloworldservice_complete/helloworldservicecomplete/$id$/
-
- tenant_helloworld:
- type: tosca.nodes.Tenant
- properties:
- kind: helloworldservice_complete
- service_specific_attribute: "{\"display_message\": \"Hello World from Tosca\"}"
- model: services.helloworldservice_complete.models.HelloWorldTenantComplete
- requirements:
- - provider_service:
- node: service_helloworld
- relationship: tosca.relationships.MemberOfService
-
-
- mysite_helloworld:
- type: tosca.nodes.Slice
- requirements:
- - service:
- node: service_helloworld
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - default_image:
- node: trusty-server-multi-nic
- relationship: tosca.relationships.DefaultImage
- properties:
- default_flavor: m1.small
-
- helloworld_access:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private-Indirect
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_helloworld
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_helloworld
- relationship: tosca.relationships.ConnectsToSlice
-
diff --git a/xos/xos/settings.py b/xos/xos/settings.py
index ad08777..f73e383 100644
--- a/xos/xos/settings.py
+++ b/xos/xos/settings.py
@@ -175,7 +175,6 @@
'core',
'services.hpc',
'services.cord',
- 'services.helloworldservice_complete',
'services.onos',
'services.ceilometer',
'services.requestrouter',
diff --git a/xos/xos/urls.py b/xos/xos/urls.py
index 1bc3885..570b768 100644
--- a/xos/xos/urls.py
+++ b/xos/xos/urls.py
@@ -9,7 +9,6 @@
from core.views.legacyapi import LegacyXMLRPC
from core.views.serviceGraph import ServiceGridView, ServiceGraphView
-from services.helloworld.view import *
from core.models import *
from rest_framework import generics
from core.dashboard.sites import SitePlus
@@ -27,7 +26,6 @@
urlpatterns = patterns('',
# Examples:
url(r'^observer', 'core.views.observer.Observer', name='observer'),
- url(r'^helloworld', HelloWorldView.as_view(), name='helloWorld'),
url(r'^serviceGrid', ServiceGridView.as_view(), name='serviceGrid'),
url(r'^serviceGraph.png', ServiceGraphView.as_view(), name='serviceGraph'),
url(r'^hpcConfig', 'core.views.hpc_config.HpcConfig', name='hpcConfig'),
diff --git a/xos/xos/wsgi.py b/xos/xos/wsgi.py
index 9b70770..55c6c1a 100644
--- a/xos/xos/wsgi.py
+++ b/xos/xos/wsgi.py
@@ -28,5 +28,3 @@
application = get_wsgi_application()
# Apply WSGI middleware here.
-# from helloworld.wsgi import HelloWorldApplication
-# application = HelloWorldApplication(application)