Merge branch 'feature/cleanup_teo'
diff --git a/containers/synchronizer/conf/synchronizer.conf b/containers/synchronizer/conf/synchronizer.conf
index cda6716..2131a25 100644
--- a/containers/synchronizer/conf/synchronizer.conf
+++ b/containers/synchronizer/conf/synchronizer.conf
@@ -4,6 +4,6 @@
nodaemon=true
[program:synchronizer]
-command=python /opt/xos/xos-observer.py
+command=python /opt/xos/synchronizers/openstack/xos-synchronizer.py
stderr_logfile=/var/log/supervisor/synchronizer.err.log
stdout_logfile=/var/log/supervisor/synchronizer.out.log
diff --git a/containers/xos/Dockerfile b/containers/xos/Dockerfile
index c70085f..0fd7565 100644
--- a/containers/xos/Dockerfile
+++ b/containers/xos/Dockerfile
@@ -75,8 +75,8 @@
# Install XOS
RUN git clone git://github.com/open-cloud/xos.git /tmp/xos && \
mv /tmp/xos/xos /opt/ && \
- chmod +x /opt/xos/scripts/opencloud && \
- /opt/xos/scripts/opencloud genkeys
+ chmod +x /opt/xos/tools/xos-manage && \
+ /opt/xos/tools/xos-manage genkeys
# install Tosca engine
RUN chmod +x /opt/xos/tosca/run.py
diff --git a/containers/xos/Dockerfile.devel b/containers/xos/Dockerfile.devel
index f819ef3..93f5025 100644
--- a/containers/xos/Dockerfile.devel
+++ b/containers/xos/Dockerfile.devel
@@ -74,8 +74,8 @@
# Install XOS
ADD xos /opt/xos
-RUN chmod +x /opt/xos/scripts/opencloud
-RUN /opt/xos/scripts/opencloud genkeys
+RUN chmod +x /opt/xos/tools/xos-manage
+RUN /opt/xos/tools/xos-manage genkeys
# install Tosca engine
RUN chmod +x /opt/xos/tosca/run.py
diff --git a/containers/xos/Dockerfile.templ b/containers/xos/Dockerfile.templ
index 4bb201e..828c16b 100644
--- a/containers/xos/Dockerfile.templ
+++ b/containers/xos/Dockerfile.templ
@@ -70,8 +70,8 @@
# Install XOS
RUN git clone XOS_GIT_REPO -b XOS_GIT_BRANCH /tmp/xos && \
mv /tmp/xos/xos /opt/ && \
- chmod +x /opt/xos/scripts/opencloud && \
- /opt/xos/scripts/opencloud genkeys
+ chmod +x /opt/xos/tools/xos-manage && \
+ /opt/xos/tools/xos-manage genkeys
# install Tosca engine
RUN bash /opt/xos/tosca/install_tosca.sh
diff --git a/containers/xos/initdb b/containers/xos/initdb
index 3252747..1f5b770 100755
--- a/containers/xos/initdb
+++ b/containers/xos/initdb
@@ -10,7 +10,7 @@
docker rm $CONTAINER_NAME
# init db schema
-docker run -it --name=$CONTAINER_NAME $IMAGE_NAME /opt/xos/scripts/opencloud makemigrations
+docker run -it --name=$CONTAINER_NAME $IMAGE_NAME /opt/xos/tools/xos-manage makemigrations
# run overrides the CMD specifed in the Dockerfile, so we re-set the CMD in the final commit"
docker commit --change="CMD update-ca-certificates && python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure" $CONTAINER_NAME $IMAGE_NAME
docker rm $CONTAINER_NAME
diff --git a/xos/README.md b/xos/README.md
index d761d59..daec000 100644
--- a/xos/README.md
+++ b/xos/README.md
@@ -2,7 +2,6 @@
This is the main directory for XOS. Sub-directories include:
-* admin_customize, templates -- related to Django GUI
* configurations -- collection of canned configurations
* core -- core model definitions
* generators -- tools to generate auxiliary structures from data model
@@ -11,6 +10,7 @@
* openstack -- client-side interaction with OpenStack (to be depreciated)
* services -- model definitions for a set of services
* synchronizers -- collection of synchronizers
+* templates -- Django GUI templates
* test -- system-wide tests to be collected here
* tosca -- tosca modeling layer on top of RESTful API
* tools -- assorted tools and scripts
diff --git a/xos/configurations/common/Dockerfile.common b/xos/configurations/common/Dockerfile.common
index ac8931f..fd27593 100644
--- a/xos/configurations/common/Dockerfile.common
+++ b/xos/configurations/common/Dockerfile.common
@@ -103,8 +103,8 @@
# Initscript is broken in Ubuntu
#ADD observer-initscript /etc/init.d/xosobserver
-RUN chmod +x /opt/xos/scripts/opencloud
-RUN /opt/xos/scripts/opencloud genkeys
+RUN chmod +x /opt/xos/tools/xos-manage
+RUN /opt/xos/tools/xos-manage genkeys
# Workaround for AUFS issue
# https://github.com/docker/docker/issues/783#issuecomment-56013588
@@ -118,7 +118,7 @@
# RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/xos/settings.py
# Cruft to workaround problems with migrations, should go away...
-RUN /opt/xos/scripts/opencloud remigrate
+RUN /opt/xos/tools/xos-manage remigrate
# git clone uses cached copy, doesn't pick up latest
RUN git -C /opt/ansible pull
@@ -140,4 +140,4 @@
# Define default command.
#CMD ["/bin/bash"]
-#CMD /opt/xos/scripts/docker_start_xos
+#CMD /opt/xos/tools/docker_start_xos
diff --git a/xos/configurations/cord/Makefile.inside b/xos/configurations/cord/Makefile.inside
index 1b4fb97..d7bdbaf 100644
--- a/xos/configurations/cord/Makefile.inside
+++ b/xos/configurations/cord/Makefile.inside
@@ -1,7 +1,7 @@
all: setup_xos run_develserver
setup_xos:
- bash /opt/xos/scripts/docker_setup_xos
+ bash /opt/xos/tools/docker_setup_xos
python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/fixtures.yaml
python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/base.yaml
python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/nodes.yaml
diff --git a/xos/configurations/cord/README-VTN.md b/xos/configurations/cord/README-VTN.md
index d27d1d1..b51bae7 100644
--- a/xos/configurations/cord/README-VTN.md
+++ b/xos/configurations/cord/README-VTN.md
@@ -88,4 +88,20 @@
* Create an Instance, it should have a Private network, and there should be a tap attached from the instance to br-int
* Two Instances in the same Slice can talk to one another. They can be on the same machine or different machines.
-* Two Slices can talk to one another if the slices are associated with Services and those Services have a Tenancy relationship between them. Note that 1) The VTN Synchronizer must be running, 2) There must be a Private network with Access=[Direct|Indirect], and 3) The connectivity is unidirection, from subscriber service to provider service.
+* Two Slices can talk to one another if the slices are associated with Services and those Services have a Tenancy relationship between them. Note that 1) The VTN Synchronizer must be running, 2) There must be a Private network with Access=[Direct|Indirect], and 3) The connectivity is unidirectional, from subscriber service to provider service.
+
+Testing service composition
+
+1. Change the private network template's 'Access' field from None to Direct
+2. Create a Service, Service-A
+3. Enter Slice Admin for Slice-1 and assign it to Service-A
+4. Create a Service, Service-B
+5. Enter Slice Admin for Slice-2 and assign it to Service-B
+6. Enter Service Admin for Service-B, Go to Tenancy Tab
+7. In the 'Provided Tenants' section of Service-B, create a Tenant with Subsciber-Service=Serivce-A.
+8. Start the VTN Observer. It will send a REST request to VTN app.
+9. Launch tcpdump in one of Slice-2's instances
+10. From Slice-1, start pinging the instance in Slice-2 where you launched tcpdump
+11. You should see the pings arrive and responses sent out. Note that the ping responses will not reach Slice-1, since VTN traffic is unidirectional.
+12. Delete the Tenancy relation you created in Step #7. The ping traffic should no longer appear in the tcpdump.
+
diff --git a/xos/configurations/cord/docker-compose.yml b/xos/configurations/cord/docker-compose.yml
index e09dc1a..21f30e4 100644
--- a/xos/configurations/cord/docker-compose.yml
+++ b/xos/configurations/cord/docker-compose.yml
@@ -4,7 +4,7 @@
- "5432"
xos_synchronizer_openstack:
- command: bash -c "sleep 120 ; python /opt/xos/xos-observer.py"
+ command: bash -c "sleep 120 ; python /opt/xos/synchronizers/openstack/xos-synchronizer.py"
image: xosproject/xos-synchronizer-openstack
labels:
org.xosproject.kind: synchronizer
diff --git a/xos/configurations/cord/make-vtn-networkconfig-json.sh b/xos/configurations/cord/make-vtn-networkconfig-json.sh
index 761ccb2..5256292 100755
--- a/xos/configurations/cord/make-vtn-networkconfig-json.sh
+++ b/xos/configurations/cord/make-vtn-networkconfig-json.sh
@@ -15,7 +15,7 @@
NODES=$( sudo bash -c "source $SETUPDIR/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}' )
# also configure ONOS to manage the nm node
-NM=`grep "^nm" $SETUPDIR/fqdn.map | awk '{ print $2 }'`
+NM=`grep "^nm" /root/setup/fqdn.map | awk '{ print $2 }'`
NODES="$NODES $NM"
NODECOUNT=0
diff --git a/xos/configurations/devel/Makefile b/xos/configurations/devel/Makefile
index 19e9abd..b4f3fcf 100644
--- a/xos/configurations/devel/Makefile
+++ b/xos/configurations/devel/Makefile
@@ -36,3 +36,9 @@
upgrade_pkgs:
sudo pip install httpie --upgrade
+
+rebuild_xos:
+ make -C ../../../containers/xos devel
+
+rebuild_synchronizer:
+ make -C ../../../containers/synchronizer
diff --git a/xos/configurations/devel/docker-compose.yml b/xos/configurations/devel/docker-compose.yml
index 66f6702..803e57c 100644
--- a/xos/configurations/devel/docker-compose.yml
+++ b/xos/configurations/devel/docker-compose.yml
@@ -5,7 +5,7 @@
xos_synchronizer_openstack:
image: xosproject/xos-synchronizer-openstack
- command: bash -c "sleep 120; python /opt/xos/xos-observer.py"
+ command: bash -c "sleep 120; python /opt/xos/synchronizers/openstack/xos-synchronizer.py"
labels:
org.xosproject.kind: synchronizer
org.xosproject.target: openstack
diff --git a/xos/configurations/vtn/Makefile b/xos/configurations/vtn/Makefile
index 8f77036..59feb2d 100644
--- a/xos/configurations/vtn/Makefile
+++ b/xos/configurations/vtn/Makefile
@@ -1,9 +1,9 @@
SETUPDIR:=../setup
MYIP:=$(shell hostname -i)
-cloudlab: common_cloudlab xos
+cloudlab: common_cloudlab ansible_hosts xos
-devstack: upgrade_pkgs common_devstack xos
+devstack: upgrade_pkgs common_devstack ansible_hosts xos
xos: vtn_network_cfg_json
sudo MYIP=$(MYIP) docker-compose up -d
@@ -21,6 +21,9 @@
vtn_network_cfg_json:
export SETUPDIR=$(SETUPDIR); bash ../cord/make-vtn-networkconfig-json.sh
+ansible_hosts:
+ sudo bash -c "export SETUPDIR=$(SETUPDIR); scripts/gen-inventory.sh"
+
stop:
sudo MYIP=$(MYIP) docker-compose stop
@@ -41,3 +44,6 @@
upgrade_pkgs:
sudo pip install httpie --upgrade
+
+destroy-networks:
+ sudo ../../tools/destroy-all-networks.sh
diff --git a/xos/configurations/vtn/README.md b/xos/configurations/vtn/README.md
index 5d8eb12..0fac0a5 100644
--- a/xos/configurations/vtn/README.md
+++ b/xos/configurations/vtn/README.md
@@ -22,12 +22,22 @@
* Login to the *ctl* node of your experiment and run:
```
ctl:~$ git clone https://github.com/open-cloud/xos.git
-ctl:~$ cd xos/xos/configurations/devel/
-ctl:~/xos/xos/configurations/devel$ make cloudlab
+ctl:~$ cd xos/xos/configurations/vtn/
+ctl:~/xos/xos/configurations/vtn$ make cloudlab
```
+The configuration provides an Ansible script that automates the configuration
+steps outlined in [the VTN README](../cord/README-VTN.md). Run:
+```
+ctl:~/xos/xos/configurations/vtn$ make destroy-networks
+ctl:~/xos/xos/configurations/vtn$ sudo ansible-playbook setup.yml
+```
+
+
### DevStack
+*NOTE: THIS CONFIGURATION IS NOT YET WORKING WITH DEVSTACK.*
+
The following instructions can be used to install DevStack and XOS together
on a single node. This setup has been run successfully in a VirtualBox VM
with 2 CPUs and 4096 GB RAM.
diff --git a/xos/configurations/vtn/docker-compose.yml b/xos/configurations/vtn/docker-compose.yml
index 406ac80..c54927b 100644
--- a/xos/configurations/vtn/docker-compose.yml
+++ b/xos/configurations/vtn/docker-compose.yml
@@ -5,7 +5,7 @@
xos_synchronizer_openstack:
image: xosproject/xos-synchronizer-openstack
- command: bash -c "python /opt/xos/xos-observer.py"
+ command: bash -c "python /opt/xos/synchronizers/openstack/xos-synchronizer.py"
labels:
org.xosproject.kind: synchronizer
org.xosproject.target: openstack
@@ -16,7 +16,7 @@
volumes:
- ../setup:/root/setup:ro
- ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
- - ./xos_vtn_config:/opt/xos/xos_configuration/xos_vtn_config:ro
+ - ./files/xos_vtn_config:/opt/xos/xos_configuration/xos_vtn_config:ro
xos_synchronizer_onos:
@@ -50,5 +50,5 @@
volumes:
- ../setup:/root/setup:ro
- ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
- - ./xos_vtn_config:/opt/xos/xos_configuration/xos_vtn_config:ro
+ - ./files/xos_vtn_config:/opt/xos/xos_configuration/xos_vtn_config:ro
- ../setup/id_rsa.pub:/opt/xos/observers/onos/onos_key.pub:ro
diff --git a/xos/configurations/vtn/files/neutron-supervisor.conf b/xos/configurations/vtn/files/neutron-supervisor.conf
new file mode 100644
index 0000000..591df7d
--- /dev/null
+++ b/xos/configurations/vtn/files/neutron-supervisor.conf
@@ -0,0 +1,2 @@
+[program:neutron-server]
+command=/usr/bin/python /usr/bin/neutron-server --config-file=/etc/neutron/plugins/ml2/ml2_conf.ini --config-file=/etc/neutron/neutron.conf --config-file /usr/local/etc/neutron/plugins/ml2/conf_onos.ini --log-file=/var/log/neutron/neutron-server.log
diff --git a/xos/configurations/vtn/xos_vtn_config b/xos/configurations/vtn/files/xos_vtn_config
similarity index 100%
rename from xos/configurations/vtn/xos_vtn_config
rename to xos/configurations/vtn/files/xos_vtn_config
diff --git a/xos/configurations/vtn/scripts/gen-inventory.sh b/xos/configurations/vtn/scripts/gen-inventory.sh
new file mode 100755
index 0000000..f793a9a
--- /dev/null
+++ b/xos/configurations/vtn/scripts/gen-inventory.sh
@@ -0,0 +1,29 @@
+FN=/etc/ansible/hosts
+
+echo "Writing to $FN"
+
+rm -f $FN
+
+cat >> $FN <<EOF
+localhost
+
+[nodes]
+EOF
+
+NODES=$( sudo bash -c "source $SETUPDIR/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}' )
+
+# also configure ONOS to manage the nm node
+NM=`grep "^nm" /root/setup/fqdn.map | awk '{ print $2 }'`
+NODES="$NODES $NM"
+
+for NODE in $NODES; do
+ cat >> $FN <<EOF
+$NODE
+EOF
+done
+
+cat >> $FN <<EOF
+[nodes:vars]
+ansible_ssh_user=root
+ansible_ssh_key=/root/setup/id_rsa
+EOF
diff --git a/xos/configurations/vtn/setup.yml b/xos/configurations/vtn/setup.yml
new file mode 100644
index 0000000..ed7cd59
--- /dev/null
+++ b/xos/configurations/vtn/setup.yml
@@ -0,0 +1,51 @@
+---
+- hosts: localhost
+ connection: local
+ sudo: yes
+ vars:
+ vtn_host: cp-1.devel.xos-pg0.apt.emulab.net
+ tasks:
+ - apt: name={{ item }} state=installed
+ with_items:
+ - python-pip
+ - supervisor
+
+ - pip: name={{ item }} state=latest
+ with_items:
+ - setuptools
+ - pip
+ - testrepository
+ - git: repo=https://github.com/openstack/networking-onos.git
+ dest=/srv/networking-onos
+ - shell: cd /srv/networking-onos; python setup.py install
+
+ # Edit /etc/neutron/plugins/ml2/ml2_conf.ini
+ - ini_file: dest=/usr/local/etc/neutron/plugins/ml2/conf_onos.ini
+ section=onos option=url_path value=http://{{ vtn_host }}:8181/onos/openstackswitching
+ - ini_file: dest=/usr/local/etc/neutron/plugins/ml2/conf_onos.ini
+ section=onos option=username value=karaf
+ - ini_file: dest=/usr/local/etc/neutron/plugins/ml2/conf_onos.ini
+ section=onos option=password value=karaf
+
+ # Edit /etc/neutron/neutron.conf
+# - ini_file: dest=/etc/neutron/neutron.conf
+# section=DEFAULT option=core_plugin value=neutron.plugins.ml2.plugin.Ml2Plugin
+
+ # Edit /etc/neutron/plugins/ml2/ml2_conf.ini
+ - ini_file: dest=/etc/neutron/plugins/ml2/ml2_conf.ini
+ section=ml2 option=tenant_network_types value=vxlan
+ - ini_file: dest=/etc/neutron/plugins/ml2/ml2_conf.ini
+ section=ml2 option=type_drivers value=vxlan
+ - ini_file: dest=/etc/neutron/plugins/ml2/ml2_conf.ini
+ section=ml2 option=mechanism_drivers value=onos_ml2
+ - ini_file: dest=/etc/neutron/plugins/ml2/ml2_conf.ini
+ section=ml2_type_vxlan option=vni_ranges value=1001:2000
+
+ - service: name=neutron-server state=stopped enabled=no
+ # Run neutron-server with extra config file
+ - copy: src=files/neutron-supervisor.conf dest=/etc/supervisor/conf.d/
+ - shell: supervisorctl reload
+
+# - shell: ../../scripts/destroy-all-networks.sh
+ - shell: cd ../cord/dataplane; bash ./generate-bm.sh > hosts-bm
+ - shell: cd ../cord/dataplane; ansible-playbook -i hosts-bm dataplane-vtn.yaml
diff --git a/xos/core/admin.py b/xos/core/admin.py
index 675b8c2..bc083c4 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -194,15 +194,15 @@
# for Service admins to render their Administration page
if getattr(self, "extracontext_registered_admins", False):
admins=[]
- for model, model_admin in admin.site._registry.items():
- if model == self.model:
- continue
- if model._meta.app_label == self.model._meta.app_label:
- info = {"app": model._meta.app_label,
- "model": model._meta.model_name,
- "name": capfirst(model._meta.verbose_name_plural),
- "url": self.url_for_model_changelist(request,model) }
- admins.append(info)
+ for model, model_admin in admin.site._registry.items():
+ if model == self.model:
+ continue
+ if model._meta.app_label == self.model._meta.app_label:
+ info = {"app": model._meta.app_label,
+ "model": model._meta.model_name,
+ "name": capfirst(model._meta.verbose_name_plural),
+ "url": self.url_for_model_changelist(request,model) }
+ admins.append(info)
extra_context["registered_admins"] = admins
def change_view(self,request,object_id, extra_context=None):
diff --git a/xos/core/api/auth.py b/xos/core/api/auth.py
deleted file mode 100644
index 8796f14..0000000
--- a/xos/core/api/auth.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from openstack.client import OpenStackClient
-
-def auth_check(username, password, tenant):
- client = OpenStackClient(username=username,
- password=password,
- tenant=tenant)
- client.authenticate()
- return client
diff --git a/xos/core/api/deployment_networks.py b/xos/core/api/deployment_networks.py
deleted file mode 100644
index ee1f68e..0000000
--- a/xos/core/api/deployment_networks.py
+++ /dev/null
@@ -1,40 +0,0 @@
-from types import StringTypes
-from core.models import Deployment
-from django.contrib.auth import authenticate
-
-def _get_deployment_networks(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- deployment_networks = Deployment.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- deployment_networks = Deployment.objects.filter(name=filter)
- elif isinstance(filter, dict):
- deployment_networks = Deployment.objects.filter(**filter)
- else:
- deployment_networks = []
- return deployment_networks
-
-def add_deployment_network(auth, name):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- deployment = Deployment(name=name)
- deployment.save()
- return deployment
-
-def delete_deployment_network(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- deployments = _get_deployment_networks(filter)
- for deployment in deployments:
- deployment.delete()
- return 1
-
-def get_deployment_networks(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- deployments = _get_deployment_networks(filter)
- return deployments
-
-
-
diff --git a/xos/core/api/images.py b/xos/core/api/images.py
deleted file mode 100644
index 933216f..0000000
--- a/xos/core/api/images.py
+++ /dev/null
@@ -1,33 +0,0 @@
-from types import StringTypes
-from django.contrib.auth import authenticate
-from core.models import Image
-
-def _get_images(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- images = Image.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- images = Image.objects.filter(name=filter)
- elif isinstance(filter, dict):
- images = Image.objects.filter(**filter)
- else:
- images = []
- return images
-
-def add_image(auth, fields={}):
- """not implemented"""
- return
-
-def delete_image(auth, filter={}):
- """not implemented"""
- return 1
-
-def get_images(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- images = _get_images(filter)
- return images
-
-
-
diff --git a/xos/core/api/instances.py b/xos/core/api/instances.py
deleted file mode 100644
index 92e928c..0000000
--- a/xos/core/api/instances.py
+++ /dev/null
@@ -1,65 +0,0 @@
-from types import StringTypes
-from django.contrib.auth import authenticate
-from openstack.manager import OpenStackManager
-from core.models import Instance, Slice
-from core.api.images import _get_images
-from core.api.slices import _get_slices
-from core.api.deployment_networks import _get_deployment_networks
-from core.api.nodes import _get_nodes
-
-def _get_instances(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- instances = Instance.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- instances = Instance.objects.filter(name=filter)
- elif isinstance(filter, dict):
- instances = Instance.objects.filter(**filter)
- else:
- instances = []
- return instances
-
-def add_instance(auth, fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
-
- images = _get_images(fields.get('image'))
- slices = _get_slices(fields.get('slice'))
- deployment_networks = _get_deployment_networks(fields.get('deploymentNetwork'))
- nodes = _get_nodes(fields.get('node'))
- if images: fields['image'] = images[0]
- if slices: fields['slice'] = slices[0]
- if deployment_networks: fields['deploymentNetwork'] = deployment_networks[0]
- if nodes: fields['node'] = nodes[0]
-
- instance = Instance(**fields)
- auth['tenant'] = instance.slice.name
- instance.os_manager = OpenStackManager(auth=auth, caller = user)
- instance.save()
- return instance
-
-def update_instance(auth, instance, **fields):
- return
-
-def delete_instance(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- instances = _get_instances(filter)
- for instance in instances:
- auth['tenant'] = instance.slice.name
- slice.os_manager = OpenStackManager(auth=auth, caller = user)
- instance.delete()
- return 1
-
-def get_instances(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- if 'slice' in filter:
- slices = _get_slices(filter.get('slice'))
- if slices: filter['slice'] = slices[0]
- instances = _get_instances(filter)
- return instances
-
-
-
diff --git a/xos/core/api/nodes.py b/xos/core/api/nodes.py
deleted file mode 100644
index 4f7ceeb..0000000
--- a/xos/core/api/nodes.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from types import StringTypes
-from django.contrib.auth import authenticate
-from core.models import Node
-
-def _get_nodes(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- nodes = Node.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- nodes = Node.objects.filter(name=filter)
- elif isinstance(filter, dict):
- nodes = Node.objects.filter(**filter)
- else:
- nodes = []
- return nodes
-
-def add_node(auth, fields={}):
- """not implemented"""
- return
-
-def delete_node(auth, filter={}):
- """not implemented"""
- return 1
-
-def update_node(auth, id, fields={}):
- return
-
-def get_nodes(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- nodes = _get_nodes(filter)
- return nodes
-
-
-
diff --git a/xos/core/api/roles.py b/xos/core/api/roles.py
deleted file mode 100644
index 4ea05c9..0000000
--- a/xos/core/api/roles.py
+++ /dev/null
@@ -1,44 +0,0 @@
-from types import StringTypes
-from django.contrib.auth import authenticate
-from openstack.manager import OpenStackManager
-from core.models import Role
-
-
-def _get_roles(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- roles = Role.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- roles = Role.objects.filter(role_type=filter)
- elif isinstance(filter, dict):
- roles = Role.objects.filter(**filter)
- else:
- roles = []
- return roles
-
-def add_role(auth, name):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
-
- role = Role(role_type=name)
- role.os_manager = OpenStackManager(auth=auth, caller = user)
- role.save()
- return role
-
-def delete_role(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- roles = _get_roles(filter)
- for role in roles:
- auth['tenant'] = user.site.login_base
- role.os_manager = OpenStackManager(auth=auth, caller = user)
- role.delete()
- return 1
-
-def get_roles(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- return _get_roles(filter)
-
diff --git a/xos/core/api/site_privileges.py b/xos/core/api/site_privileges.py
deleted file mode 100644
index 6d79701..0000000
--- a/xos/core/api/site_privileges.py
+++ /dev/null
@@ -1,73 +0,0 @@
-from types import StringTypes
-import re
-from django.contrib.auth import authenticate
-from openstack.manager import OpenStackManager
-from core.models import SitePrivilege
-from core.api.users import _get_users
-from core.api.sites import _get_sites
-from core.api.roles import _get_roles
-
-
-def _get_site_privileges(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- site_privileges = SitePrivilege.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- site_privileges = SitePrivilege.objects.filter(name=filter)
- elif isinstance(filter, dict):
- site_privileges = SitePrivilege.objects.filter(**filter)
- else:
- site_privileges = []
- return site_privileges
-
-def add_site_privilege(auth, fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
-
- users = _get_user(fields.get('user'))
- sites = _get_slice(fields.get('site'))
- roles = _get_role(fields.get('role'))
-
- if users: fields['user'] = users[0]
- if slices: fields['site'] = sites[0]
- if roles: fields['role'] = roles[0]
-
- auth['tenant'] = sites[0].login_base
- site_privilege = SitePrivilege(**fields)
- site_privilege.os_manager = OpenStackManager(auth=auth, caller = user)
- site_privilege.save()
- return site_privilege
-
-def update_site_privilege(auth, id, **fields):
- return
-
-def delete_site_privilege(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
- manager = OpenStackManager(auth=auth, caller = user)
-
- site_privileges = _get_site_privileges(filter)
- for site_privilege in site_privileges:
- auth['tenant'] = user.site.login_base
- site_privilege.os_manager = OpenStackManager(auth=auth, caller = user)
- site_privilege.delete()
- return 1
-
-def get_site_privileges(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- users = _get_users(filter.get('user'))
- sites = _get_slices(filter.get('site'))
- roles = _get_roles(filter.get('role'))
-
- if users: filter['user'] = users[0]
- if sites: filter['site'] = sites[0]
- if roles: filter['role'] = roles[0]
-
- site_privileges = _get_site_privileges(filter)
- return site_privileges
-
-
-
diff --git a/xos/core/api/sites.py b/xos/core/api/sites.py
deleted file mode 100644
index 123f139..0000000
--- a/xos/core/api/sites.py
+++ /dev/null
@@ -1,60 +0,0 @@
-from types import StringTypes
-from django.contrib.auth import authenticate
-from openstack.manager import OpenStackManager
-from core.models import Site
-
-def _get_sites(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- sites = Site.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- sites = Site.objects.filter(login_base=filter)
- elif isinstance(filter, dict):
- sites = Site.objects.filter(**filter)
- else:
- sites = []
- return sites
-
-def add_site(auth, fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
-
- site = Site(**fields)
- site.os_manager = OpenStackManager(auth=auth, caller = user)
- site.save()
- return site
-
-def update_site(auth, id, **fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
-
- sites = _get_sites(id)
- if not sites:
- return
-
- site = Site[0]
- site.os_manager = OpenStackManager(auth=auth, caller = user)
- site.update(**fields)
- return site
-
-def delete_site(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
- sites = _get_sites(id)
- for site in sites:
- site.os_manager = OpenStackManager(auth=auth, caller = user)
- site.delete()
- return 1
-
-def get_sites(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- sites = _get_sites(filter)
- return sites
-
-
-
diff --git a/xos/core/api/slice_memberships.py b/xos/core/api/slice_memberships.py
deleted file mode 100644
index 3e25ae7..0000000
--- a/xos/core/api/slice_memberships.py
+++ /dev/null
@@ -1,70 +0,0 @@
-from types import StringTypes
-from django.contrib.auth import authenticate
-from openstack.manager import OpenStackManager
-from core.models import SliceMembership
-from core.api.users import _get_users
-from core.api.slices import _get_slices
-from core.api.roles import _get_roles
-
-def _get_slice_memberships(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- slice_memberships = SitePrivilege.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- slice_memberships = SitePrivilege.objects.filter(name=filter)
- elif isinstance(filter, dict):
- slice_memberships = SitePrivilege.objects.filter(**filter)
- else:
- slice_memberships = []
- return slice_memberships
-
-
-def add_slice_membership(auth, fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
-
- users = _get_users(fields.get('user'))
- slices = _get_slices(fields.get('slice'))
- roles = _get_roles(fields.get('role'))
-
- if users: fields['user'] = users[0]
- if slices: fields['slice'] = slices[0]
- if roles: fields['role'] = roles[0]
-
- slice_membership = SliceMembership(**fields)
- auth['tenant'] = sites[0].login_base
- slice_membership.os_manager = OpenStackManager(auth=auth, caller = user)
- slice_membership.save()
- return slice_membership
-
-def update_slice_membership(auth, id, **fields):
- return
-
-def delete_slice_membership(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
-
- slice_memberships = _get_slice_memberships(filter)
- for slice_membership in slice_memberships:
- slice_membership.os_manager = OpenStackManager(auth=auth, caller = user)
- slice_membership.delete()
- return 1
-
-def get_slice_memberships(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- users = _get_users(fields.get('user'))
- slices = _get_slices(fields.get('slice'))
- roles = _get_roles(fields.get('role'))
-
- if users: fields['user'] = users[0]
- if slices: fields['slice'] = slices[0]
- if roles: fields['role'] = roles[0]
-
- slice_memberships = _get_slice_memberships(filter)
- return slice_memberships
-
-
-
diff --git a/xos/core/api/slices.py b/xos/core/api/slices.py
deleted file mode 100644
index c9e94a2..0000000
--- a/xos/core/api/slices.py
+++ /dev/null
@@ -1,74 +0,0 @@
-import re
-from types import StringTypes
-from django.contrib.auth import authenticate
-from openstack.manager import OpenStackManager
-from core.models import Slice
-from core.api.sites import _get_sites
-
-def _get_slices(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- slices = Slice.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- slices = Slice.objects.filter(name=filter)
- elif isinstance(filter, dict):
- slices = Slice.objects.filter(**filter)
- else:
- slices = []
- return slices
-
-
-def add_slice(auth, fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
-
- login_base = fields['name'][:fields['name'].find('_')]
- sites = _get_sites(login_base)
- if sites: fields['site'] = sites[0]
- slice = Slice(**fields)
- slice.os_manager = OpenStackManager(auth=auth, caller = user)
- slice.save()
- return slice
-
-def update_slice(auth, id, **fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
-
- slices = _get_slices(id)
- if not slices:
- return
- slice = slices[0]
- sites = _get_sites(fields.get('site'))
- if sites: fields['site'] = sites[0]
-
- slice.os_manager = OpenStackManager(auth=auth, caller = user)
- for (k,v) in fields.items():
- setattr(slice, k, v)
- slice.save()
-
- return slice
-
-def delete_slice(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
- slices = _get_slices(filter)
- for slice in slices:
- slice.os_manager = OpenStackManager(auth=auth, caller = user)
- slice.delete()
- return 1
-
-def get_slices(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- if 'site' in filter:
- sites = _get_sites(filter.get('site'))
- if sites: filter['site'] = sites[0]
- slices = _get_slices(filter)
- return slices
-
-
-
diff --git a/xos/core/api/subnets.py b/xos/core/api/subnets.py
deleted file mode 100644
index d618eda..0000000
--- a/xos/core/api/subnets.py
+++ /dev/null
@@ -1,74 +0,0 @@
-import commands
-from types import StringTypes
-from openstack.client import OpenStackClient
-from openstack.driver import OpenStackDriver
-from core.api.auth import auth_check
-from core.models import Subnet
-from 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):
- driver = OpenStackDriver(client = auth_check(auth))
- slices = _get_slices(fields.get('slice'))
- if slices: fields['slice'] = slices[0]
- subnet = Subnet(**fields)
- # create quantum subnet
- quantum_subnet = driver.create_subnet(name= subnet.slice.name,
- network_id=subnet.slice.network_id,
- cidr_ip = subnet.cidr,
- ip_version=subnet.ip_version,
- start = subnet.start,
- end = subnet.end)
- subnet.subnet_id=quantum_subnet['id']
- ## set dns servers
- #driver.update_subnet(subnet.id, {'dns_nameservers': ['8.8.8.8', '8.8.4.4']})
-
- # add subnet as interface to slice's router
- try: driver.add_router_interface(subnet.slice.router_id, subnet.subnet_id)
- except: pass
- #add_route = 'route add -net %s dev br-ex gw 10.100.0.5' % self.cidr
- commands.getstatusoutput(add_route)
- subnet.save()
- return subnet
-
-def update_subnet(auth, subnet, **fields):
- return
-
-def delete_subnet(auth, filter={}):
- driver = OpenStackDriver(client = auth_check(auth))
- subnets = Subnet.objects.filter(**filter)
- for subnet in subnets:
- driver.delete_router_interface(subnet.slice.router_id, subnet.subnet_id)
- driver.delete_subnet(subnet.subnet_id)
- subnet.delete()
- #del_route = 'route del -net %s' % subnet.cidr
- commands.getstatusoutput(del_route)
- return 1
-
-def get_subnets(auth, filter={}):
- client = auth_check(auth)
- 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/xos/core/api/users.py b/xos/core/api/users.py
deleted file mode 100644
index 08e851c..0000000
--- a/xos/core/api/users.py
+++ /dev/null
@@ -1,75 +0,0 @@
-from types import StringTypes
-from django.contrib.auth import authenticate
-from openstack.manager import OpenStackManager
-from core.models import User, Site
-from core.api.sites import _get_sites
-
-def _get_users(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- users = User.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- users = User.objects.filter(email=filter)
- elif isinstance(filter, dict):
- users = User.objects.filter(**filter)
- else:
- users = []
- return users
-
-def add_user(auth, fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
-
- sites = _get_sites(fields.get('site'))
- if sites: fields['site'] = sites[0]
- user = User(**fields)
- user.os_manager = OpenStackManager(auth=auth, caller = user)
- user.save()
- return user
-
-def update_user(auth, id, **fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
-
- users = User.objects.filter(id=id)
- if not users:
- return
-
- user = users[0]
- nova_fields = {}
- if 'email' in fields:
- nova_fields['name'] = fields['email'][:self.email.find('@')]
- nova_fields['email'] = fields['email']
- if 'password' in fields:
- nova_fields['password'] = fields['password']
- if 'enabled' in fields:
- nova_fields['enabled'] = fields['enabled']
- sites = _get_sites(fields.get('site'))
- if sites: fields['site'] = sites[0]
- user.os_manager = OpenStackManager(auth=auth, caller = user)
- for (k,v) in fields.items():
- setattr(user, k, v)
- user.save()
- return user
-
-def delete_user(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
- users = _get_users(filter)
- for user in users:
- user.os_manager = OpenStackManager(auth=auth, caller = user)
- user.delete()
- return 1
-
-def get_users(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- users = _get_users(filter)
- return users
-
-
-
diff --git a/xos/core/api_root.py b/xos/core/api_root.py
deleted file mode 100644
index c3d69f1..0000000
--- a/xos/core/api_root.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from rest_framework.decorators import api_view
-from rest_framework.response import Response
-from rest_framework.reverse import reverse
-
-@api_view(['GET'])
-def api_root(request, format=None):
- return Response({
- 'deployments': reverse('deployment-list', request=request, format=format),
- 'images': reverse('image-list', request=request, format=format),
- 'nodes': reverse('node-list', request=request, format=format),
- 'projects': reverse('project-list', request=request, format=format),
- 'reservations': reverse('reservation-list', request=request, format=format),
- 'roles': reverse('role-list', request=request, format=format),
- 'serviceclasses': reverse('serviceclass-list', request=request, format=format),
- 'serviceresources': reverse('serviceresource-list', request=request, format=format),
- 'sites': reverse('site-list', request=request, format=format),
- 'slices': reverse('slice-list', request=request, format=format),
- 'instances': reverse('instance-list', request=request, format=format),
- 'tags': reverse('tag-list', request=request, format=format),
- 'users': reverse('user-list', request=request, format=format),
- })
diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py
index 9f7aa4c..5c0d7ab 100644
--- a/xos/core/models/plcorebase.py
+++ b/xos/core/models/plcorebase.py
@@ -9,13 +9,13 @@
from django.forms.models import model_to_dict
from django.utils import timezone
from django.core.exceptions import PermissionDenied
-import model_policy
+import synchronizers.model_policy
from model_autodeletion import ephemeral_models
from cgi import escape as html_escape
try:
# This is a no-op if observer_disabled is set to 1 in the config file
- from observer import *
+ from synchronizers.base import *
except:
print >> sys.stderr, "import of observer failed! printing traceback and disabling observer:"
import traceback
diff --git a/xos/core/models/user.py b/xos/core/models/user.py
index cb90145..0b8e3af 100644
--- a/xos/core/models/user.py
+++ b/xos/core/models/user.py
@@ -15,12 +15,12 @@
from timezones.fields import TimeZoneField
from operator import itemgetter, attrgetter
from core.middleware import get_request
-import model_policy
+import synchronizers.model_policy
# ------ from plcorebase.py ------
try:
# This is a no-op if observer_disabled is set to 1 in the config file
- from observer import *
+ from synchronizers.base import *
except:
print >> sys.stderr, "import of observer failed! printing traceback and disabling observer:"
import traceback
diff --git a/xos/core/views/deployments.py b/xos/core/views/deployments.py
deleted file mode 100644
index 285a53a..0000000
--- a/xos/core/views/deployments.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from core.serializers import DeploymentSerializer
-from rest_framework import generics
-from core.models import Deployment
-
-class DeploymentList(generics.ListCreateAPIView):
- queryset = Deployment.objects.all()
- serializer_class = DeploymentSerializer
-
-class DeploymentDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Deployment.objects.all()
- serializer_class = DeploymentSerializer
-
diff --git a/xos/core/views/hpc_config.py b/xos/core/views/hpc_config.py
index 7f3f5a5..a181a1c 100644
--- a/xos/core/views/hpc_config.py
+++ b/xos/core/views/hpc_config.py
@@ -109,22 +109,22 @@
ENABLE_PLC=False
ENABLE_PS=True
BASE_HRN="princeton"
-RELEVANT_SERVICE_NAMES=['vcoblitz', 'coredirect', 'codnsdemux', "syndicate_comon_server"]
-COBLITZ_SLICE_NAME=BASE_HRN+"_vcoblitz"
+RELEVANT_SERVICE_NAMES=['vcoblitz', 'coredirect', 'codnsdemux', "syndicate_comon_server"]
+COBLITZ_SLICE_NAME=BASE_HRN+"_vcoblitz"
COBLITZ_SLICE_ID=70
COBLITZ_PS_SLICE_NAME="{hpc_slicename}"
DNSREDIR_SLICE_NAME=BASE_HRN+"_coredirect"
-DNSREDIR_SLICE_ID=71
-DNSREDIR_PS_SLICE_NAME="{redir_slicename}"
-DNSDEMUX_SLICE_NAME=BASE_HRN+"_codnsdemux"
-DNSDEMUX_SLICE_ID=69
-DNSDEMUX_PS_SLICE_NAME="{demux_slicename}"
-CMI_URL="http://{cmi_hostname}/"
-CMI_HTTP_PORT="8004"
-CMI_HTTPS_PORT="8003"
-PUPPET_MASTER_HOSTNAME="{cmi_hostname}"
-PUPPET_MASTER_PORT="8140"
-PS_HOSTNAME="{xos_hostname}"
+DNSREDIR_SLICE_ID=71
+DNSREDIR_PS_SLICE_NAME="{redir_slicename}"
+DNSDEMUX_SLICE_NAME=BASE_HRN+"_codnsdemux"
+DNSDEMUX_SLICE_ID=69
+DNSDEMUX_PS_SLICE_NAME="{demux_slicename}"
+CMI_URL="http://{cmi_hostname}/"
+CMI_HTTP_PORT="8004"
+CMI_HTTPS_PORT="8003"
+PUPPET_MASTER_HOSTNAME="{cmi_hostname}"
+PUPPET_MASTER_PORT="8140"
+PS_HOSTNAME="{xos_hostname}"
PS_PORT="{xos_port}"
COBLITZ_PORT_80={hpc_port80}
""".format(**d))
diff --git a/xos/core/views/images.py b/xos/core/views/images.py
deleted file mode 100644
index 5ea5d76..0000000
--- a/xos/core/views/images.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from core.serializers import ImageSerializer
-from rest_framework import generics
-from core.models import Image
-
-class ImageList(generics.ListCreateAPIView):
- queryset = Image.objects.all()
- serializer_class = ImageSerializer
-
-class ImageDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Image.objects.all()
- serializer_class = ImageSerializer
-
diff --git a/xos/core/views/instances.py b/xos/core/views/instances.py
deleted file mode 100644
index e424538..0000000
--- a/xos/core/views/instances.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import InstanceSerializer
-from rest_framework import generics
-from core.models import Instance
-
-class InstanceList(generics.ListCreateAPIView):
- queryset = Instance.objects.all()
- serializer_class = InstanceSerializer
-
-class InstanceDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Instance.objects.all()
- serializer_class = InstanceSerializer
-
-
diff --git a/xos/core/views/nodes.py b/xos/core/views/nodes.py
deleted file mode 100644
index 8706114..0000000
--- a/xos/core/views/nodes.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import NodeSerializer
-from rest_framework import generics
-from core.models import Node
-
-class NodeList(generics.ListCreateAPIView):
- queryset = Node.objects.all()
- serializer_class = NodeSerializer
-
-class NodeDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Node.objects.all()
- serializer_class = NodeSerializer
-
-
diff --git a/xos/core/views/projects.py b/xos/core/views/projects.py
deleted file mode 100644
index c5311d5..0000000
--- a/xos/core/views/projects.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import ProjectSerializer
-from rest_framework import generics
-from core.models import Project
-
-class ProjectList(generics.ListCreateAPIView):
- queryset = Project.objects.all()
- serializer_class = ProjectSerializer
-
-class ProjectDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Project.objects.all()
- serializer_class = ProjectSerializer
-
-
diff --git a/xos/core/views/reservations.py b/xos/core/views/reservations.py
deleted file mode 100644
index 03f79eb..0000000
--- a/xos/core/views/reservations.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import ReservationSerializer
-from rest_framework import generics
-from core.models import Reservation
-
-class ReservationList(generics.ListCreateAPIView):
- queryset = Reservation.objects.all()
- serializer_class = ReservationSerializer
-
-class ReservationDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Reservation.objects.all()
- serializer_class = ReservationSerializer
-
-
diff --git a/xos/core/views/roles.py b/xos/core/views/roles.py
deleted file mode 100644
index 13c9917..0000000
--- a/xos/core/views/roles.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import RoleSerializer
-from rest_framework import generics
-from core.models import Role
-
-class RoleList(generics.ListCreateAPIView):
- queryset = Role.objects.all()
- serializer_class = RoleSerializer
-
-class RoleDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Role.objects.all()
- serializer_class = RoleSerializer
-
-
diff --git a/xos/core/views/serviceclasses.py b/xos/core/views/serviceclasses.py
deleted file mode 100644
index b8b1b70..0000000
--- a/xos/core/views/serviceclasses.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import ServiceClassSerializer
-from rest_framework import generics
-from core.models import ServiceClass
-
-class ServiceClassList(generics.ListCreateAPIView):
- queryset = ServiceClass.objects.all()
- serializer_class = ServiceClassSerializer
-
-class ServiceClassDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = ServiceClass.objects.all()
- serializer_class = ServiceClassSerializer
-
-
diff --git a/xos/core/views/serviceresources.py b/xos/core/views/serviceresources.py
deleted file mode 100644
index e394c18..0000000
--- a/xos/core/views/serviceresources.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import ServiceResourceSerializer
-from rest_framework import generics
-from core.models import ServiceResource
-
-class ServiceResourceList(generics.ListCreateAPIView):
- queryset = ServiceResource.objects.all()
- serializer_class = ServiceResourceSerializer
-
-class ServiceResourceDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = ServiceResource.objects.all()
- serializer_class = ServiceResourceSerializer
-
-
diff --git a/xos/core/views/site_privileges.py b/xos/core/views/site_privileges.py
deleted file mode 100644
index 90053e5..0000000
--- a/xos/core/views/site_privileges.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import SitePrivilegeSerializer
-from rest_framework import generics
-from core.models import SitePrivilege
-
-class SitePrivilegeList(generics.ListCreateAPIView):
- queryset = SitePrivilege.objects.all()
- serializer_class = SitePrivilegeSerializer
-
-class SitePrivilegeDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = SitePrivilege.objects.all()
- serializer_class = SitePrivilegeSerializer
-
-
diff --git a/xos/core/views/sites.py b/xos/core/views/sites.py
deleted file mode 100644
index 4ec9cb2..0000000
--- a/xos/core/views/sites.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from core.serializers import SiteSerializer
-from rest_framework import generics
-from core.models import Site
-
-class SiteList(generics.ListCreateAPIView):
- queryset = Site.objects.all()
- serializer_class = SiteSerializer
-
-class SiteDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Site.objects.all()
- serializer_class = SiteSerializer
diff --git a/xos/core/views/slice_privileges.py b/xos/core/views/slice_privileges.py
deleted file mode 100644
index 4dd1f93..0000000
--- a/xos/core/views/slice_privileges.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import SlicePrivilegeSerializer
-from rest_framework import generics
-from core.models import SlicePrivilege
-
-class SlicePrivilegeList(generics.ListCreateAPIView):
- queryset = SlicePrivilege.objects.all()
- serializer_class = SlicePrivilegeSerializer
-
-class SlicePrivilegeDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = SlicePrivilege.objects.all()
- serializer_class = SlicePrivilegeSerializer
-
-
diff --git a/xos/core/views/slices.py b/xos/core/views/slices.py
deleted file mode 100644
index e3ab139..0000000
--- a/xos/core/views/slices.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import SliceSerializer
-from rest_framework import generics
-from core.models import Slice
-
-class SliceList(generics.ListCreateAPIView):
- queryset = Slice.objects.all()
- serializer_class = SliceSerializer
-
-class SliceDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Slice.objects.all()
- serializer_class = SliceSerializer
-
-
diff --git a/xos/core/views/subnets.py b/xos/core/views/subnets.py
deleted file mode 100644
index 881f615..0000000
--- a/xos/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 core.api.subnets import add_subnet, delete_subnet, get_subnets, update_subnet
-from core.serializers import SubnetSerializer
-from 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)
-
-
-
diff --git a/xos/core/views/tags.py b/xos/core/views/tags.py
deleted file mode 100644
index ba8a035..0000000
--- a/xos/core/views/tags.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import TagSerializer
-from rest_framework import generics
-from core.models import Tag
-
-class TagList(generics.ListCreateAPIView):
- queryset = Tag.objects.all()
- serializer_class = TagSerializer
-
-class TagDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Tag.objects.all()
- serializer_class = TagSerializer
-
-
diff --git a/xos/core/views/users.py b/xos/core/views/users.py
deleted file mode 100644
index 06ac0f3..0000000
--- a/xos/core/views/users.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from core.serializers import UserSerializer
-from rest_framework import generics
-from core.models import User
-
-class UserList(generics.ListCreateAPIView):
- queryset = User.objects.all()
- serializer_class = UserSerializer
-
-class UserDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = User.objects.all()
- serializer_class = UserSerializer
diff --git a/xos/core/xoslib/methods/ceilometerview.py b/xos/core/xoslib/methods/ceilometerview.py
index f9f9d89..825cce4 100644
--- a/xos/core/xoslib/methods/ceilometerview.py
+++ b/xos/core/xoslib/methods/ceilometerview.py
@@ -16,7 +16,7 @@
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.core.exceptions import PermissionDenied
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
# This REST API endpoint provides information that the ceilometer view needs to display
diff --git a/xos/core/xoslib/methods/cordsubscriber.py b/xos/core/xoslib/methods/cordsubscriber.py
index b22d70e..49e32a5 100644
--- a/xos/core/xoslib/methods/cordsubscriber.py
+++ b/xos/core/xoslib/methods/cordsubscriber.py
@@ -207,8 +207,8 @@
def list(self, request):
object_list = self.filter_queryset(self.get_queryset())
-
- serializer = self.get_serializer(object_list, many=True)
+
+ serializer = self.get_serializer(object_list, many=True)
return Response({"subscribers": serializer.data})
@@ -306,10 +306,10 @@
raise XOSMissingField("subscriber has no bbs_account")
result=subprocess.check_output(["python", "/opt/xos/observers/vcpe/broadbandshield.py", "dump", subscriber.volt.vcpe.bbs_account, "123"])
- if request.GET.get("theformat",None)=="text":
- from django.http import HttpResponse
- return HttpResponse(result, content_type="text/plain")
- else:
+ if request.GET.get("theformat",None)=="text":
+ from django.http import HttpResponse
+ return HttpResponse(result, content_type="text/plain")
+ else:
return Response( {"bbs_dump": result } )
def setup_demo_subscriber(self, subscriber):
@@ -392,15 +392,15 @@
# contact vBNG service and dump current list of mappings
def get_vbng_dump(self, request, pk=None):
result=subprocess.check_output(["curl", "http://10.0.3.136:8181/onos/virtualbng/privateip/map"])
- if request.GET.get("theformat",None)=="text":
- from django.http import HttpResponse
- result = json.loads(result)["map"]
-
- lines = []
- for row in result:
- for k in row.keys():
- lines.append( "%s %s" % (k, row[k]) )
-
- return HttpResponse("\n".join(lines), content_type="text/plain")
- else:
+ if request.GET.get("theformat",None)=="text":
+ from django.http import HttpResponse
+ result = json.loads(result)["map"]
+
+ lines = []
+ for row in result:
+ for k in row.keys():
+ lines.append( "%s %s" % (k, row[k]) )
+
+ return HttpResponse("\n".join(lines), content_type="text/plain")
+ else:
return Response( {"vbng_dump": json.loads(result)["map"] } )
diff --git a/xos/core/api/__init__.py b/xos/generate/__init__.py
similarity index 100%
rename from xos/core/api/__init__.py
rename to xos/generate/__init__.py
diff --git a/xos/dependency_walker.py b/xos/generate/dependency_walker.py
similarity index 97%
rename from xos/dependency_walker.py
rename to xos/generate/dependency_walker.py
index d99b783..210ec0f 100644
--- a/xos/dependency_walker.py
+++ b/xos/generate/dependency_walker.py
@@ -12,7 +12,7 @@
import pdb
from core.models import *
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
logger = Logger(level=logging.INFO)
missing_links={}
diff --git a/xos/manage.py b/xos/manage.py
index 5d09794..ae4f598 100644
--- a/xos/manage.py
+++ b/xos/manage.py
@@ -8,16 +8,16 @@
from django.core.management import execute_from_command_line
if "--makemigrations" in sys.argv:
- os.system("/opt/xos/scripts/opencloud makemigrations")
+ os.system("/opt/xos/tools/xos-manage makemigrations")
sys.argv.remove("--makemigrations")
if "--nomodelpolicy" in sys.argv:
- import model_policy
+ import synchronizers.model_policy as model_policy
model_policy.EnableModelPolicy(False)
sys.argv.remove("--nomodelpolicy")
if "--noobserver" in sys.argv:
- import observer
+ import synchronizers.base as observer
observer.EnableObserver(False)
sys.argv.remove("--noobserver")
diff --git a/xos/observers/base/__init__.py b/xos/observers/base/__init__.py
deleted file mode 100644
index 8b13789..0000000
--- a/xos/observers/base/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/xos/openstack_observer/deleter.py b/xos/openstack_observer/deleter.py
deleted file mode 100644
index 93fa572..0000000
--- a/xos/openstack_observer/deleter.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import os
-import base64
-from xos.config import Config
-
-class Deleter:
- model=None # Must be overridden
-
- def __init__(self, *args, **kwargs):
- pass
-
- def call(self, pk, model_dict):
- # Fetch object from XOS db and delete it
- pass
-
- def __call__(self, *args, **kwargs):
- return self.call(*args, **kwargs)
diff --git a/xos/openstack_observer/error_mapper.py b/xos/openstack_observer/error_mapper.py
deleted file mode 100644
index 3039a56..0000000
--- a/xos/openstack_observer/error_mapper.py
+++ /dev/null
@@ -1,25 +0,0 @@
-from xos.config import Config
-from util.logger import Logger, logging, logger
-
-class ErrorMapper:
- def __init__(self, error_map_file):
- self.error_map = {}
- try:
- error_map_lines = open(error_map_file).read().splitlines()
- for l in error_map_lines:
- if (not l.startswith('#')):
- splits = l.split('->')
- k,v = map(lambda i:i.rstrip(),splits)
- self.error_map[k]=v
- except:
- logging.info('Could not read error map')
-
-
- def map(self, error):
- return self.error_map[error]
-
-
-
-
-
-
diff --git a/xos/services/ceilometer/admin.py b/xos/services/ceilometer/admin.py
index fe52996..ed8e47a 100644
--- a/xos/services/ceilometer/admin.py
+++ b/xos/services/ceilometer/admin.py
@@ -48,26 +48,26 @@
class MonitoringChannelForm(forms.ModelForm):
creator = forms.ModelChoiceField(queryset=User.objects.all())
- def __init__(self,*args,**kwargs):
- super (MonitoringChannelForm,self ).__init__(*args,**kwargs)
- self.fields['kind'].widget.attrs['readonly'] = True
- self.fields['provider_service'].queryset = CeilometerService.get_service_objects().all()
- if self.instance:
- # fields for the attributes
- self.fields['creator'].initial = self.instance.creator
- if (not self.instance) or (not self.instance.pk):
- # default fields for an 'add' form
- self.fields['kind'].initial = CEILOMETER_KIND
- self.fields['creator'].initial = get_request().user
- if CeilometerService.get_service_objects().exists():
- self.fields["provider_service"].initial = CeilometerService.get_service_objects().all()[0]
-
-
- def save(self, commit=True):
- self.instance.creator = self.cleaned_data.get("creator")
- return super(MonitoringChannelForm, self).save(commit=commit)
-
- class Meta:
+ def __init__(self,*args,**kwargs):
+ super (MonitoringChannelForm,self ).__init__(*args,**kwargs)
+ self.fields['kind'].widget.attrs['readonly'] = True
+ self.fields['provider_service'].queryset = CeilometerService.get_service_objects().all()
+ if self.instance:
+ # fields for the attributes
+ self.fields['creator'].initial = self.instance.creator
+ if (not self.instance) or (not self.instance.pk):
+ # default fields for an 'add' form
+ self.fields['kind'].initial = CEILOMETER_KIND
+ self.fields['creator'].initial = get_request().user
+ if CeilometerService.get_service_objects().exists():
+ self.fields["provider_service"].initial = CeilometerService.get_service_objects().all()[0]
+
+
+ def save(self, commit=True):
+ self.instance.creator = self.cleaned_data.get("creator")
+ return super(MonitoringChannelForm, self).save(commit=commit)
+
+ class Meta:
model = MonitoringChannel
class MonitoringChannelAdmin(ReadOnlyAwareAdmin):
diff --git a/xos/services/cord/admin.py b/xos/services/cord/admin.py
index ced79af..5f1a285 100644
--- a/xos/services/cord/admin.py
+++ b/xos/services/cord/admin.py
@@ -55,29 +55,29 @@
c_tag = forms.CharField()
creator = forms.ModelChoiceField(queryset=User.objects.all())
- def __init__(self,*args,**kwargs):
- super (VOLTTenantForm,self ).__init__(*args,**kwargs)
- self.fields['kind'].widget.attrs['readonly'] = True
- self.fields['provider_service'].queryset = VOLTService.get_service_objects().all()
- if self.instance:
- # fields for the attributes
- self.fields['c_tag'].initial = self.instance.c_tag
- self.fields['s_tag'].initial = self.instance.s_tag
- self.fields['creator'].initial = self.instance.creator
- if (not self.instance) or (not self.instance.pk):
- # default fields for an 'add' form
- self.fields['kind'].initial = VOLT_KIND
- self.fields['creator'].initial = get_request().user
- if VOLTService.get_service_objects().exists():
- self.fields["provider_service"].initial = VOLTService.get_service_objects().all()[0]
-
- def save(self, commit=True):
- self.instance.s_tag = self.cleaned_data.get("s_tag")
- self.instance.c_tag = self.cleaned_data.get("c_tag")
- self.instance.creator = self.cleaned_data.get("creator")
- return super(VOLTTenantForm, self).save(commit=commit)
-
- class Meta:
+ def __init__(self,*args,**kwargs):
+ super (VOLTTenantForm,self ).__init__(*args,**kwargs)
+ self.fields['kind'].widget.attrs['readonly'] = True
+ self.fields['provider_service'].queryset = VOLTService.get_service_objects().all()
+ if self.instance:
+ # fields for the attributes
+ self.fields['c_tag'].initial = self.instance.c_tag
+ self.fields['s_tag'].initial = self.instance.s_tag
+ self.fields['creator'].initial = self.instance.creator
+ if (not self.instance) or (not self.instance.pk):
+ # default fields for an 'add' form
+ self.fields['kind'].initial = VOLT_KIND
+ self.fields['creator'].initial = get_request().user
+ if VOLTService.get_service_objects().exists():
+ self.fields["provider_service"].initial = VOLTService.get_service_objects().all()[0]
+
+ def save(self, commit=True):
+ self.instance.s_tag = self.cleaned_data.get("s_tag")
+ self.instance.c_tag = self.cleaned_data.get("c_tag")
+ self.instance.creator = self.cleaned_data.get("creator")
+ return super(VOLTTenantForm, self).save(commit=commit)
+
+ class Meta:
model = VOLTTenant
class VOLTTenantAdmin(ReadOnlyAwareAdmin):
@@ -105,24 +105,24 @@
backend_network_label = forms.CharField(required=False)
bbs_slice = forms.ModelChoiceField(queryset=Slice.objects.all(), required=False)
- def __init__(self,*args,**kwargs):
- super (VCPEServiceForm,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
- self.fields['bbs_server'].initial = self.instance.bbs_server
- self.fields['backend_network_label'].initial = self.instance.backend_network_label
- self.fields['bbs_slice'].initial = self.instance.bbs_slice
-
- def save(self, commit=True):
- self.instance.bbs_api_hostname = self.cleaned_data.get("bbs_api_hostname")
- self.instance.bbs_api_port = self.cleaned_data.get("bbs_api_port")
- 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)
-
- class Meta:
+ def __init__(self,*args,**kwargs):
+ super (VCPEServiceForm,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
+ self.fields['bbs_server'].initial = self.instance.bbs_server
+ self.fields['backend_network_label'].initial = self.instance.backend_network_label
+ self.fields['bbs_slice'].initial = self.instance.bbs_slice
+
+ def save(self, commit=True):
+ self.instance.bbs_api_hostname = self.cleaned_data.get("bbs_api_hostname")
+ self.instance.bbs_api_port = self.cleaned_data.get("bbs_api_port")
+ 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)
+
+ class Meta:
model = VCPEService
class VCPEServiceAdmin(ReadOnlyAwareAdmin):
@@ -164,30 +164,30 @@
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)
- self.fields['kind'].widget.attrs['readonly'] = True
- self.fields['provider_service'].queryset = VCPEService.get_service_objects().all()
- if self.instance:
- # fields for the attributes
- self.fields['bbs_account'].initial = self.instance.bbs_account
- self.fields['creator'].initial = self.instance.creator
- self.fields['instance'].initial = self.instance.instance
- self.fields['last_ansible_hash'].initial = self.instance.last_ansible_hash
- if (not self.instance) or (not self.instance.pk):
- # 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]
-
- 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)
-
- class Meta:
+ def __init__(self,*args,**kwargs):
+ super (VCPETenantForm,self ).__init__(*args,**kwargs)
+ self.fields['kind'].widget.attrs['readonly'] = True
+ self.fields['provider_service'].queryset = VCPEService.get_service_objects().all()
+ if self.instance:
+ # fields for the attributes
+ self.fields['bbs_account'].initial = self.instance.bbs_account
+ self.fields['creator'].initial = self.instance.creator
+ self.fields['instance'].initial = self.instance.instance
+ self.fields['last_ansible_hash'].initial = self.instance.last_ansible_hash
+ if (not self.instance) or (not self.instance.pk):
+ # 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]
+
+ 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)
+
+ class Meta:
model = VCPETenant
class VCPETenantAdmin(ReadOnlyAwareAdmin):
@@ -211,16 +211,16 @@
class VBNGServiceForm(forms.ModelForm):
vbng_url = forms.CharField(required=False)
- def __init__(self,*args,**kwargs):
- super (VBNGServiceForm,self ).__init__(*args,**kwargs)
- if self.instance:
- self.fields['vbng_url'].initial = self.instance.vbng_url
-
- def save(self, commit=True):
- self.instance.vbng_url = self.cleaned_data.get("vbng_url")
- return super(VBNGServiceForm, self).save(commit=commit)
-
- class Meta:
+ def __init__(self,*args,**kwargs):
+ super (VBNGServiceForm,self ).__init__(*args,**kwargs)
+ if self.instance:
+ self.fields['vbng_url'].initial = self.instance.vbng_url
+
+ def save(self, commit=True):
+ self.instance.vbng_url = self.cleaned_data.get("vbng_url")
+ return super(VBNGServiceForm, self).save(commit=commit)
+
+ class Meta:
model = VBNGService
class VBNGServiceAdmin(ReadOnlyAwareAdmin):
@@ -260,30 +260,30 @@
mapped_ip = forms.CharField(required=False)
mapped_mac = forms.CharField(required=False)
- def __init__(self,*args,**kwargs):
- super (VBNGTenantForm,self ).__init__(*args,**kwargs)
- self.fields['kind'].widget.attrs['readonly'] = True
- self.fields['provider_service'].queryset = VBNGService.get_service_objects().all()
- if self.instance:
- # fields for the attributes
- self.fields['routeable_subnet'].initial = self.instance.routeable_subnet
- self.fields['mapped_hostname'].initial = self.instance.mapped_hostname
- self.fields['mapped_ip'].initial = self.instance.mapped_ip
- self.fields['mapped_mac'].initial = self.instance.mapped_mac
- if (not self.instance) or (not self.instance.pk):
- # default fields for an 'add' form
- self.fields['kind'].initial = VBNG_KIND
- if VBNGService.get_service_objects().exists():
- self.fields["provider_service"].initial = VBNGService.get_service_objects().all()[0]
-
- def save(self, commit=True):
- self.instance.routeable_subnet = self.cleaned_data.get("routeable_subnet")
- self.instance.mapped_hostname = self.cleaned_data.get("mapped_hostname")
- self.instance.mapped_ip = self.cleaned_data.get("mapped_ip")
- self.instance.mapped_mac = self.cleaned_data.get("mapped_mac")
- return super(VBNGTenantForm, self).save(commit=commit)
-
- class Meta:
+ def __init__(self,*args,**kwargs):
+ super (VBNGTenantForm,self ).__init__(*args,**kwargs)
+ self.fields['kind'].widget.attrs['readonly'] = True
+ self.fields['provider_service'].queryset = VBNGService.get_service_objects().all()
+ if self.instance:
+ # fields for the attributes
+ self.fields['routeable_subnet'].initial = self.instance.routeable_subnet
+ self.fields['mapped_hostname'].initial = self.instance.mapped_hostname
+ self.fields['mapped_ip'].initial = self.instance.mapped_ip
+ self.fields['mapped_mac'].initial = self.instance.mapped_mac
+ if (not self.instance) or (not self.instance.pk):
+ # default fields for an 'add' form
+ self.fields['kind'].initial = VBNG_KIND
+ if VBNGService.get_service_objects().exists():
+ self.fields["provider_service"].initial = VBNGService.get_service_objects().all()[0]
+
+ def save(self, commit=True):
+ self.instance.routeable_subnet = self.cleaned_data.get("routeable_subnet")
+ self.instance.mapped_hostname = self.cleaned_data.get("mapped_hostname")
+ self.instance.mapped_ip = self.cleaned_data.get("mapped_ip")
+ self.instance.mapped_mac = self.cleaned_data.get("mapped_mac")
+ return super(VBNGTenantForm, self).save(commit=commit)
+
+ class Meta:
model = VBNGTenant
class VBNGTenantAdmin(ReadOnlyAwareAdmin):
@@ -326,20 +326,20 @@
class CordSubscriberRootForm(forms.ModelForm):
url_filter_level = forms.CharField(required = False)
- def __init__(self,*args,**kwargs):
- super (CordSubscriberRootForm,self ).__init__(*args,**kwargs)
- self.fields['kind'].widget.attrs['readonly'] = True
- if self.instance:
- self.fields['url_filter_level'].initial = self.instance.url_filter_level
- 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):
- self.instance.url_filter_level = self.cleaned_data.get("url_filter_level")
- return super(CordSubscriberRootForm, self).save(commit=commit)
-
- class Meta:
+ def __init__(self,*args,**kwargs):
+ super (CordSubscriberRootForm,self ).__init__(*args,**kwargs)
+ self.fields['kind'].widget.attrs['readonly'] = True
+ if self.instance:
+ self.fields['url_filter_level'].initial = self.instance.url_filter_level
+ 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):
+ self.instance.url_filter_level = self.cleaned_data.get("url_filter_level")
+ return super(CordSubscriberRootForm, self).save(commit=commit)
+
+ class Meta:
model = CordSubscriberRoot
class CordSubscriberRootAdmin(ReadOnlyAwareAdmin):
diff --git a/xos/services/hpc/admin.py b/xos/services/hpc/admin.py
index 233668b..d9f28c6 100644
--- a/xos/services/hpc/admin.py
+++ b/xos/services/hpc/admin.py
@@ -25,7 +25,8 @@
def __init__(self, *args, **kwargs):
super(HpcServiceForm, self).__init__(*args, **kwargs)
- self.fields['scale'].initial = kwargs["instance"].scale
+ if ("instance" in kwargs) and (hasattr(kwargs["instance"], "scale")):
+ self.fields['scale'].initial = kwargs["instance"].scale
def save(self, *args, **kwargs):
if self.cleaned_data['scale']:
diff --git a/xos/services/hpc/filteredadmin.py b/xos/services/hpc/filteredadmin.py
index 6cad25c..b677b54 100644
--- a/xos/services/hpc/filteredadmin.py
+++ b/xos/services/hpc/filteredadmin.py
@@ -31,14 +31,14 @@
pk = getattr(result, self.pk_attname)
if self.embedded:
return reverse('admin:%s_%s_embeddedfilteredchange' % (self.opts.app_label,
- self.opts.model_name),
- args=(quote(self.service.id), quote(pk),),
+ self.opts.model_name),
+ args=(quote(self.service.id), quote(pk),),
current_app=self.model_admin.admin_site.name)
else:
return reverse('admin:%s_%s_filteredchange' % (self.opts.app_label,
- self.opts.model_name),
- args=(quote(self.service.id), quote(pk),),
+ self.opts.model_name),
+ args=(quote(self.service.id), quote(pk),),
current_app=self.model_admin.admin_site.name)
class FilteredAdmin(ReadOnlyAwareAdmin):
@@ -71,10 +71,10 @@
def get_urls(self):
from django.conf.urls import patterns, url
-
- def wrap(view):
- def wrapper(*args, **kwargs):
- return self.admin_site.admin_view(view)(*args, **kwargs)
+
+ def wrap(view):
+ def wrapper(*args, **kwargs):
+ return self.admin_site.admin_view(view)(*args, **kwargs)
return update_wrapper(wrapper, view)
urls = super(FilteredAdmin, self).get_urls()
diff --git a/xos/services/onos/admin.py b/xos/services/onos/admin.py
index d13a991..3f9f96c 100644
--- a/xos/services/onos/admin.py
+++ b/xos/services/onos/admin.py
@@ -21,19 +21,19 @@
class ONOSServiceForm(forms.ModelForm):
use_external_host = forms.CharField(required=False)
- def __init__(self,*args,**kwargs):
- super (ONOSServiceForm,self ).__init__(*args,**kwargs)
- if self.instance:
- # fields for the attributes
- self.fields['use_external_host'].initial = self.instance.use_external_host
-
- def save(self, commit=True):
- self.instance.use_external_host = self.cleaned_data.get("use_external_host")
- return super(ONOSServiceForm, self).save(commit=commit)
-
- class Meta:
- model = ONOSService
-
+ def __init__(self,*args,**kwargs):
+ super (ONOSServiceForm,self ).__init__(*args,**kwargs)
+ if self.instance:
+ # fields for the attributes
+ self.fields['use_external_host'].initial = self.instance.use_external_host
+
+ def save(self, commit=True):
+ self.instance.use_external_host = self.cleaned_data.get("use_external_host")
+ return super(ONOSServiceForm, self).save(commit=commit)
+
+ class Meta:
+ model = ONOSService
+
class ONOSServiceAdmin(ReadOnlyAwareAdmin):
model = ONOSService
verbose_name = "ONOS Service"
@@ -67,29 +67,29 @@
name = forms.CharField()
dependencies = forms.CharField(required=False)
- def __init__(self,*args,**kwargs):
- super (ONOSAppForm,self ).__init__(*args,**kwargs)
- self.fields['kind'].widget.attrs['readonly'] = True
- self.fields['provider_service'].queryset = ONOSService.get_service_objects().all()
- if self.instance:
- # fields for the attributes
- self.fields['creator'].initial = self.instance.creator
- self.fields['name'].initial = self.instance.name
- self.fields['dependencies'].initial = self.instance.dependencies
- if (not self.instance) or (not self.instance.pk):
- # default fields for an 'add' form
- self.fields['kind'].initial = ONOS_KIND
- self.fields['creator'].initial = get_request().user
- if ONOSService.get_service_objects().exists():
- self.fields["provider_service"].initial = ONOSService.get_service_objects().all()[0]
-
- def save(self, commit=True):
- self.instance.creator = self.cleaned_data.get("creator")
- self.instance.name = self.cleaned_data.get("name")
- self.instance.dependencies = self.cleaned_data.get("dependencies")
- return super(ONOSAppForm, self).save(commit=commit)
-
- class Meta:
+ def __init__(self,*args,**kwargs):
+ super (ONOSAppForm,self ).__init__(*args,**kwargs)
+ self.fields['kind'].widget.attrs['readonly'] = True
+ self.fields['provider_service'].queryset = ONOSService.get_service_objects().all()
+ if self.instance:
+ # fields for the attributes
+ self.fields['creator'].initial = self.instance.creator
+ self.fields['name'].initial = self.instance.name
+ self.fields['dependencies'].initial = self.instance.dependencies
+ if (not self.instance) or (not self.instance.pk):
+ # default fields for an 'add' form
+ self.fields['kind'].initial = ONOS_KIND
+ self.fields['creator'].initial = get_request().user
+ if ONOSService.get_service_objects().exists():
+ self.fields["provider_service"].initial = ONOSService.get_service_objects().all()[0]
+
+ def save(self, commit=True):
+ self.instance.creator = self.cleaned_data.get("creator")
+ self.instance.name = self.cleaned_data.get("name")
+ self.instance.dependencies = self.cleaned_data.get("dependencies")
+ return super(ONOSAppForm, self).save(commit=commit)
+
+ class Meta:
model = ONOSApp
class ONOSAppAdmin(ReadOnlyAwareAdmin):
diff --git a/xos/observers/__init__.py b/xos/synchronizers/__init__.py
similarity index 100%
rename from xos/observers/__init__.py
rename to xos/synchronizers/__init__.py
diff --git a/xos/observers/base/SyncInstanceUsingAnsible.py b/xos/synchronizers/base/SyncInstanceUsingAnsible.py
similarity index 97%
rename from xos/observers/base/SyncInstanceUsingAnsible.py
rename to xos/synchronizers/base/SyncInstanceUsingAnsible.py
index 81f6632..335932f 100644
--- a/xos/observers/base/SyncInstanceUsingAnsible.py
+++ b/xos/synchronizers/base/SyncInstanceUsingAnsible.py
@@ -6,10 +6,10 @@
import time
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
-from observer.ansible import run_template_ssh
+from synchronizers.base.syncstep import SyncStep
+from synchronizers.base.ansible import run_template_ssh
from core.models import Service, Slice, ControllerSlice, ControllerUser
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
logger = Logger(level=logging.INFO)
diff --git a/xos/observers/base/SyncSliverUsingAnsible.py b/xos/synchronizers/base/SyncSliverUsingAnsible.py
similarity index 94%
rename from xos/observers/base/SyncSliverUsingAnsible.py
rename to xos/synchronizers/base/SyncSliverUsingAnsible.py
index 9455780..c64e5ea 100644
--- a/xos/observers/base/SyncSliverUsingAnsible.py
+++ b/xos/synchronizers/base/SyncSliverUsingAnsible.py
@@ -6,10 +6,10 @@
import time
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
-from observer.ansible import run_template_ssh
+from synchronizers.base.syncstep import SyncStep
+from synchronizers.base.ansible import run_template_ssh
from core.models import Service, Slice
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
logger = Logger(level=logging.INFO)
diff --git a/xos/openstack_observer/__init__.py b/xos/synchronizers/base/__init__.py
similarity index 100%
rename from xos/openstack_observer/__init__.py
rename to xos/synchronizers/base/__init__.py
diff --git a/xos/openstack_observer/ansible.py b/xos/synchronizers/base/ansible.py
similarity index 98%
rename from xos/openstack_observer/ansible.py
rename to xos/synchronizers/base/ansible.py
index 94b09bd..fda2300 100644
--- a/xos/openstack_observer/ansible.py
+++ b/xos/synchronizers/base/ansible.py
@@ -10,7 +10,7 @@
import traceback
import subprocess
from xos.config import Config, XOS_DIR
-from util.logger import observer_logger
+from xos.logger import observer_logger
try:
step_dir = Config().observer_steps_dir
diff --git a/xos/openstack_observer/backend.py b/xos/synchronizers/base/backend.py
similarity index 86%
rename from xos/openstack_observer/backend.py
rename to xos/synchronizers/base/backend.py
index 5657491..5f11d46 100644
--- a/xos/openstack_observer/backend.py
+++ b/xos/synchronizers/base/backend.py
@@ -2,10 +2,10 @@
import sys
import threading
import time
-from observer.event_loop import XOSObserver
-from observer.event_manager import EventListener
-from util.logger import Logger, logging
-from model_policy import run_policy
+from synchronizers.base.event_loop import XOSObserver
+from synchronizers.base.event_manager import EventListener
+from xos.logger import Logger, logging
+from synchronizers.model_policy import run_policy
from xos.config import Config
logger = Logger(level=logging.INFO)
diff --git a/xos/synchronizers/base/backend.py.bak b/xos/synchronizers/base/backend.py.bak
new file mode 100644
index 0000000..6e46b85
--- /dev/null
+++ b/xos/synchronizers/base/backend.py.bak
@@ -0,0 +1,34 @@
+import threading
+import time
+from observer.event_loop import XOSObserver
+from observer.event_manager import EventListener
+from util.logger import Logger, logging
+from model_policy import run_policy
+from xos.config import Config
+
+logger = Logger(level=logging.INFO)
+
+class Backend:
+
+ def run(self):
+ # start the openstack observer
+ observer = XOSObserver()
+ observer_thread = threading.Thread(target=observer.run)
+ observer_thread.start()
+
+ # start model policies thread
+ observer_name = getattr(Config(), "observer_name", "")
+ if (not observer_name):
+ model_policy_thread = threading.Thread(target=run_policy)
+ model_policy_thread.start()
+ else:
+ print "Skipping model policies thread for service observer."
+
+ model_policy_thread = threading.Thread(target=run_policy)
+ model_policy_thread.start()
+
+ # start event listene
+ event_manager = EventListener(wake_up=observer.wake_up)
+ event_manager_thread = threading.Thread(target=event_manager.run)
+ event_manager_thread.start()
+
diff --git a/xos/synchronizers/base/controller.diff b/xos/synchronizers/base/controller.diff
new file mode 100644
index 0000000..865b83e
--- /dev/null
+++ b/xos/synchronizers/base/controller.diff
@@ -0,0 +1,37 @@
+diff -up xos/model_policies/model_policy_Controller.py.orig xos/model_policies/model_policy_Controller.py
+--- xos/model_policies/model_policy_Controller.py.orig 2015-01-19 20:09:13.000000000 +0000
++++ xos/model_policies/model_policy_Controller.py 2015-04-07 21:48:51.462215000 +0000
+@@ -1,6 +1,6 @@
+
+ def handle(controller):
+- from core.models import Controller, Site, ControllerSite, Slice, ControllerSlice, User, ControllerUser
++ from core.models import Controller, Site, ControllerSite, Slice, ControllerSlice, User, ControllerUser, ControllerImages, ControllerNetwork
+ from collections import defaultdict
+
+ # relations for all sites
+@@ -36,3 +36,25 @@ def handle(controller):
+ controller not in ctrls_by_user[user]:
+ controller_user = ControllerUser(controller=controller, user=user)
+ controller_user.save()
++ # relations for all networks
++ ctrls_by_network = defaultdict(list)
++ ctrl_networks = ControllerNetwork.objects.all()
++ for ctrl_network in ctrl_networks:
++ ctrls_by_network[ctrl_network.network].append(ctrl_network.controller)
++ networks = Network.objects.all()
++ for network in networks:
++ if network not in ctrls_by_network or \
++ controller not in ctrls_by_network[network]:
++ controller_network = ControllerNetwork(controller=controller, network=network)
++ controller_network.save()
++ # relations for all images
++ ctrls_by_image = defaultdict(list)
++ ctrl_images = ControllerImages.objects.all()
++ for ctrl_image in ctrl_images:
++ ctrls_by_image[ctrl_image.image].append(ctrl_image.controller)
++ images = Image.objects.all()
++ for image in images:
++ if image not in ctrls_by_image or \
++ controller not in ctrls_by_image[image]:
++ controller_image = ControllerImages(controller=controller, image=image)
++ controller_image.save()
diff --git a/xos/ec2_observer/deleter.py b/xos/synchronizers/base/deleter.py
similarity index 100%
rename from xos/ec2_observer/deleter.py
rename to xos/synchronizers/base/deleter.py
diff --git a/xos/ec2_observer/error_mapper.py b/xos/synchronizers/base/error_mapper.py
similarity index 90%
rename from xos/ec2_observer/error_mapper.py
rename to xos/synchronizers/base/error_mapper.py
index 3039a56..9eb878d 100644
--- a/xos/ec2_observer/error_mapper.py
+++ b/xos/synchronizers/base/error_mapper.py
@@ -1,5 +1,5 @@
from xos.config import Config
-from util.logger import Logger, logging, logger
+from xos.logger import Logger, logging, logger
class ErrorMapper:
def __init__(self, error_map_file):
diff --git a/xos/openstack_observer/event_loop.py b/xos/synchronizers/base/event_loop.py
similarity index 98%
rename from xos/openstack_observer/event_loop.py
rename to xos/synchronizers/base/event_loop.py
index 0ac626b..1e8942c 100644
--- a/xos/openstack_observer/event_loop.py
+++ b/xos/synchronizers/base/event_loop.py
@@ -19,15 +19,15 @@
from django.db import reset_queries
#from openstack.manager import OpenStackManager
from openstack.driver import OpenStackDriver
-from util.logger import Logger, logging, logger
+from xos.logger import Logger, logging, logger
#from timeout import timeout
from xos.config import Config, XOS_DIR
-from observer.steps import *
+from synchronizers.base.steps import *
from syncstep import SyncStep
from toposort import toposort
-from observer.error_mapper import *
-from openstack_observer.openstacksyncstep import OpenStackSyncStep
-from observer.steps.sync_object import SyncObject
+from synchronizers.base.error_mapper import *
+from synchronizers.openstack.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.steps.sync_object import SyncObject
# Load app models
diff --git a/xos/openstack_observer/event_manager.py b/xos/synchronizers/base/event_manager.py
similarity index 100%
rename from xos/openstack_observer/event_manager.py
rename to xos/synchronizers/base/event_manager.py
diff --git a/xos/synchronizers/base/observer b/xos/synchronizers/base/observer
new file mode 120000
index 0000000..ae75af5
--- /dev/null
+++ b/xos/synchronizers/base/observer
@@ -0,0 +1 @@
+openstack_observer
\ No newline at end of file
diff --git a/xos/openstack_observer/openstacksyncstep.py b/xos/synchronizers/base/openstacksyncstep.py
similarity index 100%
rename from xos/openstack_observer/openstacksyncstep.py
rename to xos/synchronizers/base/openstacksyncstep.py
diff --git a/xos/openstack_observer/run_ansible b/xos/synchronizers/base/run_ansible
similarity index 100%
rename from xos/openstack_observer/run_ansible
rename to xos/synchronizers/base/run_ansible
diff --git a/xos/openstack_observer/run_ansible_verbose b/xos/synchronizers/base/run_ansible_verbose
similarity index 100%
rename from xos/openstack_observer/run_ansible_verbose
rename to xos/synchronizers/base/run_ansible_verbose
diff --git a/xos/openstack_observer/steps/__init__.py b/xos/synchronizers/base/steps/__init__.py
similarity index 100%
rename from xos/openstack_observer/steps/__init__.py
rename to xos/synchronizers/base/steps/__init__.py
diff --git a/xos/openstack_observer/steps/delete_slivers.yaml b/xos/synchronizers/base/steps/delete_slivers.yaml
similarity index 100%
rename from xos/openstack_observer/steps/delete_slivers.yaml
rename to xos/synchronizers/base/steps/delete_slivers.yaml
diff --git a/xos/openstack_observer/steps/purge_disabled_users.py b/xos/synchronizers/base/steps/purge_disabled_users.py
similarity index 85%
rename from xos/openstack_observer/steps/purge_disabled_users.py
rename to xos/synchronizers/base/steps/purge_disabled_users.py
index b5168e3..0973b8c 100644
--- a/xos/openstack_observer/steps/purge_disabled_users.py
+++ b/xos/synchronizers/base/steps/purge_disabled_users.py
@@ -3,9 +3,9 @@
import datetime
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.user import User
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
class SyncRoles(OpenStackSyncStep):
provides=[User]
diff --git a/xos/openstack_observer/steps/sliver.yaml b/xos/synchronizers/base/steps/sliver.yaml
similarity index 100%
rename from xos/openstack_observer/steps/sliver.yaml
rename to xos/synchronizers/base/steps/sliver.yaml
diff --git a/xos/openstack_observer/steps/sync_container.py b/xos/synchronizers/base/steps/sync_container.py
similarity index 95%
rename from xos/openstack_observer/steps/sync_container.py
rename to xos/synchronizers/base/steps/sync_container.py
index adb81c9..d647aef 100644
--- a/xos/openstack_observer/steps/sync_container.py
+++ b/xos/synchronizers/base/steps/sync_container.py
@@ -6,12 +6,12 @@
import time
from django.db.models import F, Q
from xos.config import Config
-from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
-from observer.syncstep import SyncStep, DeferredException
-from observer.ansible import run_template_ssh
+from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.base.syncstep import SyncStep, DeferredException
+from synchronizers.base.ansible import run_template_ssh
from core.models import Service, Slice, Instance
from services.onos.models import ONOSService, ONOSApp
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/openstack_observer/steps/sync_container.yaml b/xos/synchronizers/base/steps/sync_container.yaml
similarity index 100%
rename from xos/openstack_observer/steps/sync_container.yaml
rename to xos/synchronizers/base/steps/sync_container.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_images.py b/xos/synchronizers/base/steps/sync_controller_images.py
similarity index 88%
rename from xos/openstack_observer/steps/sync_controller_images.py
rename to xos/synchronizers/base/steps/sync_controller_images.py
index 551d9ac..c1e5136 100644
--- a/xos/openstack_observer/steps/sync_controller_images.py
+++ b/xos/synchronizers/base/steps/sync_controller_images.py
@@ -3,12 +3,12 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models import Controller
from core.models import Image, ControllerImages
-from util.logger import observer_logger as logger
-from observer.ansible import *
+from xos.logger import observer_logger as logger
+from synchronizers.base.ansible import *
import json
class SyncControllerImages(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_images.yaml b/xos/synchronizers/base/steps/sync_controller_images.yaml
similarity index 100%
rename from xos/openstack_observer/steps/sync_controller_images.yaml
rename to xos/synchronizers/base/steps/sync_controller_images.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_networks.py b/xos/synchronizers/base/steps/sync_controller_networks.py
similarity index 96%
rename from xos/openstack_observer/steps/sync_controller_networks.py
rename to xos/synchronizers/base/steps/sync_controller_networks.py
index ad1604b..990cb87 100644
--- a/xos/openstack_observer/steps/sync_controller_networks.py
+++ b/xos/synchronizers/base/steps/sync_controller_networks.py
@@ -4,13 +4,13 @@
from netaddr import IPAddress, IPNetwork
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models.network import *
from core.models.slice import *
from core.models.instance import Instance
-from util.logger import observer_logger as logger
-from observer.ansible import *
+from xos.logger import observer_logger as logger
+from synchronizers.base.ansible import *
from openstack.driver import OpenStackDriver
from xos.config import Config
import json
diff --git a/xos/openstack_observer/steps/sync_controller_networks.yaml b/xos/synchronizers/base/steps/sync_controller_networks.yaml
similarity index 100%
rename from xos/openstack_observer/steps/sync_controller_networks.yaml
rename to xos/synchronizers/base/steps/sync_controller_networks.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_site_privileges.py b/xos/synchronizers/base/steps/sync_controller_site_privileges.py
similarity index 95%
rename from xos/openstack_observer/steps/sync_controller_site_privileges.py
rename to xos/synchronizers/base/steps/sync_controller_site_privileges.py
index d257536..59919fe 100644
--- a/xos/openstack_observer/steps/sync_controller_site_privileges.py
+++ b/xos/synchronizers/base/steps/sync_controller_site_privileges.py
@@ -3,13 +3,13 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models.site import Controller, SitePrivilege
from core.models.user import User
from core.models.controlleruser import ControllerUser, ControllerSitePrivilege
-from util.logger import observer_logger as logger
-from observer.ansible import *
+from xos.logger import observer_logger as logger
+from synchronizers.base.ansible import *
import json
class SyncControllerSitePrivileges(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_sites.py b/xos/synchronizers/base/steps/sync_controller_sites.py
similarity index 92%
rename from xos/openstack_observer/steps/sync_controller_sites.py
rename to xos/synchronizers/base/steps/sync_controller_sites.py
index 614d435..1b3c2ba 100644
--- a/xos/openstack_observer/steps/sync_controller_sites.py
+++ b/xos/synchronizers/base/steps/sync_controller_sites.py
@@ -2,11 +2,11 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from openstack_observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.openstack.openstacksyncstep import OpenStackSyncStep
from core.models.site import *
-from observer.syncstep import *
-from observer.ansible import *
-from util.logger import observer_logger as logger
+from synchronizers.base.syncstep import *
+from synchronizers.base.ansible import *
+from xos.logger import observer_logger as logger
import json
class SyncControllerSites(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_sites.yaml b/xos/synchronizers/base/steps/sync_controller_sites.yaml
similarity index 100%
rename from xos/openstack_observer/steps/sync_controller_sites.yaml
rename to xos/synchronizers/base/steps/sync_controller_sites.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_slice_privileges.py b/xos/synchronizers/base/steps/sync_controller_slice_privileges.py
similarity index 94%
rename from xos/openstack_observer/steps/sync_controller_slice_privileges.py
rename to xos/synchronizers/base/steps/sync_controller_slice_privileges.py
index 948ea57..b78e4a0 100644
--- a/xos/openstack_observer/steps/sync_controller_slice_privileges.py
+++ b/xos/synchronizers/base/steps/sync_controller_slice_privileges.py
@@ -3,13 +3,13 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models.slice import Controller, SlicePrivilege
from core.models.user import User
from core.models.controlleruser import ControllerUser, ControllerSlicePrivilege
-from observer.ansible import *
-from util.logger import observer_logger as logger
+from synchronizers.base.ansible import *
+from xos.logger import observer_logger as logger
import json
class SyncControllerSlicePrivileges(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_slices.py b/xos/synchronizers/base/steps/sync_controller_slices.py
similarity index 94%
rename from xos/openstack_observer/steps/sync_controller_slices.py
rename to xos/synchronizers/base/steps/sync_controller_slices.py
index 9904aef..97d8c29 100644
--- a/xos/openstack_observer/steps/sync_controller_slices.py
+++ b/xos/synchronizers/base/steps/sync_controller_slices.py
@@ -4,12 +4,12 @@
from netaddr import IPAddress, IPNetwork
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models import *
-from observer.ansible import *
+from synchronizers.base.ansible import *
from openstack.driver import OpenStackDriver
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
import json
class SyncControllerSlices(OpenStackSyncStep):
diff --git a/xos/synchronizers/base/steps/sync_controller_slices.py.bak b/xos/synchronizers/base/steps/sync_controller_slices.py.bak
new file mode 100644
index 0000000..e04da8e
--- /dev/null
+++ b/xos/synchronizers/base/steps/sync_controller_slices.py.bak
@@ -0,0 +1,95 @@
+import os
+import base64
+from collections import defaultdict
+from netaddr import IPAddress, IPNetwork
+from django.db.models import F, Q
+from xos.config import Config
+from observer.openstacksyncstep import OpenStackSyncStep
+from core.models import *
+from observer.ansible import *
+from openstack.driver import OpenStackDriver
+from util.logger import observer_logger as logger
+import json
+
+class SyncControllerSlices(OpenStackSyncStep):
+ provides=[Slice]
+ requested_interval=0
+ observes=ControllerSlice
+
+ def fetch_pending(self, deleted):
+ if (deleted):
+ return ControllerSlice.deleted_objects.all()
+ else:
+ return ControllerSlice.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+
+ def sync_record(self, controller_slice):
+ logger.info("sync'ing slice controller %s" % controller_slice)
+
+ controller_register = json.loads(controller_slice.controller.backend_register)
+ if (controller_register.get('disabled',False)):
+ raise Exception('Controller %s is disabled'%controller_slice.controller.name)
+
+ if not controller_slice.controller.admin_user:
+ logger.info("controller %r has no admin_user, skipping" % controller_slice.controller)
+ return
+
+ controller_users = ControllerUser.objects.filter(user=controller_slice.slice.creator,
+ controller=controller_slice.controller)
+ if not controller_users:
+ raise Exception("slice createor %s has not accout at controller %s" % (controller_slice.slice.creator, controller_slice.controller.name))
+ else:
+ controller_user = controller_users[0]
+ roles = ['Admin']
+
+ max_instances=int(controller_slice.slice.max_slivers)
+ tenant_fields = {'endpoint':controller_slice.controller.auth_url,
+ 'admin_user': controller_slice.controller.admin_user,
+ 'admin_password': controller_slice.controller.admin_password,
+ 'admin_tenant': 'admin',
+ 'tenant': controller_slice.slice.name,
+ 'tenant_description': controller_slice.slice.description,
+ 'roles':roles,
+ 'name':controller_user.user.email,
+ 'ansible_tag':'%s@%s'%(controller_slice.slice.name,controller_slice.controller.name),
+ 'max_instances':max_instances}
+
+ expected_num = len(roles)+1
+ res = run_template('sync_controller_slices.yaml', tenant_fields, path='controller_slices', expected_num=expected_num)
+ tenant_id = res[0]['id']
+ if (not controller_slice.tenant_id):
+ try:
+ driver = OpenStackDriver().admin_driver(controller=controller_slice.controller)
+ driver.shell.nova.quotas.update(tenant_id=controller_slice.tenant_id, instances=int(controller_slice.slice.max_slivers))
+ except:
+ logger.log_exc('Could not update quota for %s'%controller_slice.slice.name)
+ raise Exception('Could not update quota for %s'%controller_slice.slice.name)
+
+ controller_slice.tenant_id = tenant_id
+ controller_slice.backend_status = '1 - OK'
+ controller_slice.save()
+
+
+ def delete_record(self, controller_slice):
+ controller_register = json.loads(controller_slice.controller.backend_register)
+ if (controller_register.get('disabled',False)):
+ raise Exception('Controller %s is disabled'%controller_slice.controller.name)
+
+ controller_users = ControllerUser.objects.filter(user=controller_slice.slice.creator,
+ controller=controller_slice.controller)
+ if not controller_users:
+ raise Exception("slice createor %s has not accout at controller %s" % (controller_slice.slice.creator, controller_slice.controller.name))
+ else:
+ controller_user = controller_users[0]
+
+ tenant_fields = {'endpoint':controller_slice.controller.auth_url,
+ 'admin_user': controller_slice.controller.admin_user,
+ 'admin_password': controller_slice.controller.admin_password,
+ 'admin_tenant': 'admin',
+ 'tenant': controller_slice.slice.name,
+ 'tenant_description': controller_slice.slice.description,
+ 'name':controller_user.user.email,
+ 'ansible_tag':'%s@%s'%(controller_slice.slice.name,controller_slice.controller.name),
+ 'delete': True}
+
+ expected_num = 1
+ res = run_template('sync_controller_slices.yaml', tenant_fields, path='controller_slices', expected_num=expected_num)
diff --git a/xos/openstack_observer/steps/sync_controller_slices.yaml b/xos/synchronizers/base/steps/sync_controller_slices.yaml
similarity index 100%
rename from xos/openstack_observer/steps/sync_controller_slices.yaml
rename to xos/synchronizers/base/steps/sync_controller_slices.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_users.py b/xos/synchronizers/base/steps/sync_controller_users.py
similarity index 93%
rename from xos/openstack_observer/steps/sync_controller_users.py
rename to xos/synchronizers/base/steps/sync_controller_users.py
index 4062453..9af48e5 100644
--- a/xos/openstack_observer/steps/sync_controller_users.py
+++ b/xos/synchronizers/base/steps/sync_controller_users.py
@@ -3,13 +3,13 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models.site import Controller, SiteDeployment, SiteDeployment
from core.models.user import User
from core.models.controlleruser import ControllerUser
-from observer.ansible import *
-from util.logger import observer_logger as logger
+from synchronizers.base.ansible import *
+from xos.logger import observer_logger as logger
import json
class SyncControllerUsers(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_users.yaml b/xos/synchronizers/base/steps/sync_controller_users.yaml
similarity index 100%
rename from xos/openstack_observer/steps/sync_controller_users.yaml
rename to xos/synchronizers/base/steps/sync_controller_users.yaml
diff --git a/xos/openstack_observer/steps/sync_images.py b/xos/synchronizers/base/steps/sync_images.py
similarity index 93%
rename from xos/openstack_observer/steps/sync_images.py
rename to xos/synchronizers/base/steps/sync_images.py
index d126834..8049ac1 100644
--- a/xos/openstack_observer/steps/sync_images.py
+++ b/xos/synchronizers/base/steps/sync_images.py
@@ -2,9 +2,9 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.image import Image
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
class SyncImages(OpenStackSyncStep):
provides=[Image]
diff --git a/xos/openstack_observer/steps/sync_instances.py b/xos/synchronizers/base/steps/sync_instances.py
similarity index 96%
rename from xos/openstack_observer/steps/sync_instances.py
rename to xos/synchronizers/base/steps/sync_instances.py
index 815c83e..335ca4a 100644
--- a/xos/openstack_observer/steps/sync_instances.py
+++ b/xos/synchronizers/base/steps/sync_instances.py
@@ -4,13 +4,13 @@
from django.db.models import F, Q
from xos.config import Config
from xos.settings import RESTAPI_HOSTNAME, RESTAPI_PORT
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.instance import Instance
from core.models.slice import Slice, SlicePrivilege, ControllerSlice
from core.models.network import Network, NetworkSlice, ControllerNetwork
-from observer.ansible import *
-from observer.syncstep import *
-from util.logger import observer_logger as logger
+from synchronizers.base.ansible import *
+from synchronizers.base.syncstep import *
+from xos.logger import observer_logger as logger
def escape(s):
s = s.replace('\n',r'\n').replace('"',r'\"')
diff --git a/xos/openstack_observer/steps/sync_instances.yaml b/xos/synchronizers/base/steps/sync_instances.yaml
similarity index 100%
rename from xos/openstack_observer/steps/sync_instances.yaml
rename to xos/synchronizers/base/steps/sync_instances.yaml
diff --git a/xos/openstack_observer/steps/sync_object.py b/xos/synchronizers/base/steps/sync_object.py
similarity index 69%
rename from xos/openstack_observer/steps/sync_object.py
rename to xos/synchronizers/base/steps/sync_object.py
index a289c95..a6a939f 100644
--- a/xos/openstack_observer/steps/sync_object.py
+++ b/xos/synchronizers/base/steps/sync_object.py
@@ -3,12 +3,12 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models import *
-from observer.ansible import *
+from synchronizers.base.ansible import *
from openstack.driver import OpenStackDriver
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
import json
class SyncObject(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_ports.py b/xos/synchronizers/base/steps/sync_ports.py
similarity index 98%
rename from xos/openstack_observer/steps/sync_ports.py
rename to xos/synchronizers/base/steps/sync_ports.py
index bfdde8c..21376e5 100644
--- a/xos/openstack_observer/steps/sync_ports.py
+++ b/xos/synchronizers/base/steps/sync_ports.py
@@ -2,10 +2,10 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models import Controller
from core.models.network import *
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
class SyncPorts(OpenStackSyncStep):
requested_interval = 0 # 3600
diff --git a/xos/openstack_observer/steps/sync_roles.py b/xos/synchronizers/base/steps/sync_roles.py
similarity index 84%
rename from xos/openstack_observer/steps/sync_roles.py
rename to xos/synchronizers/base/steps/sync_roles.py
index c4bbe3f..e859316 100644
--- a/xos/openstack_observer/steps/sync_roles.py
+++ b/xos/synchronizers/base/steps/sync_roles.py
@@ -2,11 +2,11 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.role import Role
from core.models.site import SiteRole, Controller, ControllerRole
from core.models.slice import SliceRole
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
class SyncRoles(OpenStackSyncStep):
provides=[Role]
diff --git a/xos/synchronizers/base/steps/sync_slivers.py.bak b/xos/synchronizers/base/steps/sync_slivers.py.bak
new file mode 100644
index 0000000..c4240fa
--- /dev/null
+++ b/xos/synchronizers/base/steps/sync_slivers.py.bak
@@ -0,0 +1,179 @@
+import os
+import base64
+import socket
+from django.db.models import F, Q
+from xos.config import Config
+from xos.settings import RESTAPI_HOSTNAME, RESTAPI_PORT
+from observer.openstacksyncstep import OpenStackSyncStep
+from core.models.sliver import Sliver
+from core.models.slice import Slice, SlicePrivilege, ControllerSlice
+from core.models.network import Network, NetworkSlice, ControllerNetwork
+from observer.ansible import *
+from util.logger import observer_logger as logger
+
+def escape(s):
+ s = s.replace('\n',r'\n').replace('"',r'\"')
+ return s
+
+class SyncSlivers(OpenStackSyncStep):
+ provides=[Sliver]
+ requested_interval=0
+ observes=Sliver
+
+ def get_userdata(self, sliver, pubkeys):
+ userdata = '#cloud-config\n\nopencloud:\n slicename: "%s"\n hostname: "%s"\n restapi_hostname: "%s"\n restapi_port: "%s"\n' % (sliver.slice.name, sliver.node.name, RESTAPI_HOSTNAME, str(RESTAPI_PORT))
+ userdata += 'ssh_authorized_keys:\n'
+ for key in pubkeys:
+ userdata += ' - %s\n' % key
+ return userdata
+
+ def sync_record(self, sliver):
+ logger.info("sync'ing sliver:%s slice:%s controller:%s " % (sliver, sliver.slice.name, sliver.node.site_deployment.controller))
+ controller_register = json.loads(sliver.node.site_deployment.controller.backend_register)
+
+ if (controller_register.get('disabled',False)):
+ raise Exception('Controller %s is disabled'%sliver.node.site_deployment.controller.name)
+
+ metadata_update = {}
+ if (sliver.numberCores):
+ metadata_update["cpu_cores"] = str(sliver.numberCores)
+
+ for tag in sliver.slice.tags.all():
+ if tag.name.startswith("sysctl-"):
+ metadata_update[tag.name] = tag.value
+
+ # public keys
+ slice_memberships = SlicePrivilege.objects.filter(slice=sliver.slice)
+ pubkeys = set([sm.user.public_key for sm in slice_memberships if sm.user.public_key])
+ if sliver.creator.public_key:
+ pubkeys.add(sliver.creator.public_key)
+
+ if sliver.slice.creator.public_key:
+ pubkeys.add(sliver.slice.creator.public_key)
+
+ if sliver.slice.service and sliver.slice.service.public_key:
+ pubkeys.add(sliver.slice.service.public_key)
+
+ if sliver.slice.service and sliver.slice.service.public_key:
+ pubkeys.add(sliver.slice.service.public_key)
+
+ nics = []
+ networks = [ns.network for ns in NetworkSlice.objects.filter(slice=sliver.slice)]
+ controller_networks = ControllerNetwork.objects.filter(network__in=networks,
+ controller=sliver.node.site_deployment.controller)
+
+ for controller_network in controller_networks:
+ if controller_network.network.template.visibility == 'private' and \
+ controller_network.network.template.translation == 'none':
+ if not controller_network.net_id:
+ raise Exception("Private Network %s has no id; Try again later" % controller_network.network.name)
+ nics.append(controller_network.net_id)
+
+ # now include network template
+ network_templates = [network.template.shared_network_name for network in networks \
+ if network.template.shared_network_name]
+
+ #driver = self.driver.client_driver(caller=sliver.creator, tenant=sliver.slice.name, controller=sliver.controllerNetwork)
+ driver = self.driver.admin_driver(tenant='admin', controller=sliver.node.site_deployment.controller)
+ nets = driver.shell.quantum.list_networks()['networks']
+ for net in nets:
+ if net['name'] in network_templates:
+ nics.append(net['id'])
+
+ if (not nics):
+ for net in nets:
+ if net['name']=='public':
+ nics.append(net['id'])
+
+ image_id = None
+ controller_images = sliver.image.controllerimages.filter(controller=sliver.node.site_deployment.controller)
+ if controller_images:
+ image_id = controller_images[0].glance_image_id
+ logger.info("using image_id from ControllerImage object: " + str(image_id))
+
+ if image_id is None:
+ controller_driver = self.driver.admin_driver(controller=sliver.node.site_deployment.controller)
+ image_id = None
+ images = controller_driver.shell.glanceclient.images.list()
+ for image in images:
+ if image.name == sliver.image.name or not image_id:
+ image_id = image.id
+ logger.info("using image_id from glance: " + str(image_id))
+
+ try:
+ legacy = Config().observer_legacy
+ except:
+ legacy = False
+
+ if (legacy):
+ host_filter = sliver.node.name.split('.',1)[0]
+ else:
+ host_filter = sliver.node.name.strip()
+
+ availability_zone_filter = 'nova:%s'%host_filter
+ sliver_name = '%s-%d'%(sliver.slice.name,sliver.id)
+
+ userData = self.get_userdata(sliver, pubkeys)
+ if sliver.userData:
+ userData = sliver.userData
+
+ controller = sliver.node.site_deployment.controller
+ tenant_fields = {'endpoint':controller.auth_url,
+ 'admin_user': sliver.creator.email,
+ 'admin_password': sliver.creator.remote_password,
+ 'admin_tenant': sliver.slice.name,
+ 'tenant': sliver.slice.name,
+ 'tenant_description': sliver.slice.description,
+ 'name':sliver_name,
+ 'ansible_tag':sliver_name,
+ 'availability_zone': availability_zone_filter,
+ 'image_id':image_id,
+ 'flavor_id':sliver.flavor.id,
+ 'nics':nics,
+ 'meta':metadata_update,
+ 'user_data':r'%s'%escape(userData)}
+
+ res = run_template('sync_slivers.yaml', tenant_fields,path='slivers', expected_num=1)
+ sliver_id = res[0]['info']['OS-EXT-SRV-ATTR:instance_name']
+ sliver_uuid = res[0]['id']
+
+ try:
+ hostname = res[0]['info']['OS-EXT-SRV-ATTR:hypervisor_hostname']
+ ip = socket.gethostbyname(hostname)
+ sliver.ip = ip
+ except:
+ pass
+
+ sliver.instance_id = sliver_id
+ sliver.instance_uuid = sliver_uuid
+ sliver.instance_name = sliver_name
+ sliver.save()
+
+ def delete_record(self, sliver):
+ controller_register = json.loads(sliver.node.site_deployment.controller.backend_register)
+
+ if (controller_register.get('disabled',False)):
+ raise Exception('Controller %s is disabled'%sliver.node.site_deployment.controller.name)
+
+ sliver_name = '%s-%d'%(sliver.slice.name,sliver.id)
+ controller = sliver.node.site_deployment.controller
+ tenant_fields = {'endpoint':controller.auth_url,
+ 'admin_user': sliver.creator.email,
+ 'admin_password': sliver.creator.remote_password,
+ 'admin_tenant': sliver.slice.name,
+ 'tenant': sliver.slice.name,
+ 'tenant_description': sliver.slice.description,
+ 'name':sliver_name,
+ 'ansible_tag':sliver_name,
+ 'delete': True}
+
+ try:
+ res = run_template('sync_slivers.yaml', tenant_fields,path='slivers', expected_num=1)
+ except Exception,e:
+ print "Could not sync %s"%sliver_name
+ #import traceback
+ #traceback.print_exc()
+ raise e
+
+ if (len(res)!=1):
+ raise Exception('Could not delete sliver %s'%sliver.slice.name)
diff --git a/xos/openstack_observer/steps/teardown_container.yaml b/xos/synchronizers/base/steps/teardown_container.yaml
similarity index 100%
rename from xos/openstack_observer/steps/teardown_container.yaml
rename to xos/synchronizers/base/steps/teardown_container.yaml
diff --git a/xos/synchronizers/base/syncstep-portal.py b/xos/synchronizers/base/syncstep-portal.py
new file mode 100644
index 0000000..66ec1af
--- /dev/null
+++ b/xos/synchronizers/base/syncstep-portal.py
@@ -0,0 +1,221 @@
+import os
+import base64
+from datetime import datetime
+from xos.config import Config
+from xos.logger import Logger, logging
+from synchronizers.base.steps import *
+from django.db.models import F, Q
+from core.models import *
+from django.db import reset_queries
+import json
+import time
+import pdb
+import traceback
+
+logger = Logger(level=logging.INFO)
+
+def f7(seq):
+ seen = set()
+ seen_add = seen.add
+ return [ x for x in seq if not (x in seen or seen_add(x))]
+
+def elim_dups(backend_str):
+ strs = backend_str.split('/')
+ strs = map(lambda x:x.split('(')[0],strs)
+ strs2 = f7(strs)
+ return '/'.join(strs2)
+
+def deepgetattr(obj, attr):
+ return reduce(getattr, attr.split('.'), obj)
+
+
+class InnocuousException(Exception):
+ pass
+
+class FailedDependency(Exception):
+ pass
+
+class SyncStep(object):
+ """ An XOS Sync step.
+
+ Attributes:
+ psmodel Model name the step synchronizes
+ dependencies list of names of models that must be synchronized first if the current model depends on them
+ """
+ slow=False
+ def get_prop(prop):
+ try:
+ sync_config_dir = Config().sync_config_dir
+ except:
+ sync_config_dir = '/etc/xos/sync'
+ prop_config_path = '/'.join(sync_config_dir,self.name,prop)
+ return open(prop_config_path).read().rstrip()
+
+ def __init__(self, **args):
+ """Initialize a sync step
+ Keyword arguments:
+ name -- Name of the step
+ provides -- XOS models sync'd by this step
+ """
+ dependencies = []
+ self.driver = args.get('driver')
+ self.error_map = args.get('error_map')
+
+ try:
+ self.soft_deadline = int(self.get_prop('soft_deadline_seconds'))
+ except:
+ self.soft_deadline = 5 # 5 seconds
+
+ return
+
+ def fetch_pending(self, deletion=False):
+ # This is the most common implementation of fetch_pending
+ # Steps should override it if they have their own logic
+ # for figuring out what objects are outstanding.
+ main_obj = self.observes
+ if (not deletion):
+ objs = main_obj.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None),Q(lazy_blocked=False))
+ else:
+ objs = main_obj.deleted_objects.all()
+
+ return objs
+ #return Sliver.objects.filter(ip=None)
+
+ def check_dependencies(self, obj, failed):
+ for dep in self.dependencies:
+ peer_name = dep[0].lower() + dep[1:] # django names are camelCased with the first letter lower
+
+ try:
+ peer_object = deepgetattr(obj, peer_name)
+ try:
+ peer_objects = peer_object.all()
+ except AttributeError:
+ peer_objects = [peer_object]
+ except:
+ peer_objects = []
+
+ if (hasattr(obj,'controller')):
+ try:
+ peer_objects = filter(lambda o:o.controller==obj.controller, peer_objects)
+ except AttributeError:
+ pass
+
+ if (failed in peer_objects):
+ if (obj.backend_status!=failed.backend_status):
+ obj.backend_status = failed.backend_status
+ obj.save(update_fields=['backend_status'])
+ raise FailedDependency("Failed dependency for %s:%s peer %s:%s failed %s:%s" % (obj.__class__.__name__, str(getattr(obj,"pk","no_pk")), peer_object.__class__.__name__, str(getattr(peer_object,"pk","no_pk")), failed.__class__.__name__, str(getattr(failed,"pk","no_pk"))))
+
+ def call(self, failed=[], deletion=False):
+ pending = self.fetch_pending(deletion)
+ for o in pending:
+ # another spot to clean up debug state
+ try:
+ reset_queries()
+ except:
+ # this shouldn't happen, but in case it does, catch it...
+ logger.log_exc("exception in reset_queries")
+
+ sync_failed = False
+ try:
+ backoff_disabled = Config().observer_backoff_disabled
+ except:
+ backoff_disabled = 0
+
+ try:
+ scratchpad = json.loads(o.backend_register)
+ if (scratchpad):
+ next_run = scratchpad['next_run']
+ if (not backoff_disabled and next_run>time.time()):
+ sync_failed = True
+ except:
+ logger.log_exc("Exception while loading scratchpad")
+ pass
+
+ if (not sync_failed):
+ try:
+ for f in failed:
+ self.check_dependencies(o,f) # Raises exception if failed
+ if (deletion):
+ self.delete_record(o)
+ o.delete(purge=True)
+ else:
+ self.sync_record(o)
+ o.enacted = datetime.now() # Is this the same timezone? XXX
+ scratchpad = {'next_run':0, 'exponent':0}
+ o.backend_register = json.dumps(scratchpad)
+ o.backend_status = "1 - OK"
+ o.save(update_fields=['enacted','backend_status','backend_register'])
+ except (InnocuousException,Exception) as e:
+ logger.log_exc("Syncstep caught exception")
+
+ force_error = False
+ try:
+ if (o.backend_status.startswith('2 - ')):
+ force_error = False # Already in error state
+ str_e = '%s/%s'%(o.backend_status[4:],str(e))
+ str_e = elim_dups(str_e)
+ else:
+ str_e = str(e)
+ except:
+ str_e = str(e)
+
+ if (not str_e):
+ str_e = 'Unknown'
+
+ try:
+ error = self.error_map.map(str_e)
+ except:
+ error = str_e
+
+ if isinstance(e, InnocuousException) and not force_error:
+ o.backend_status = '1 - %s'%error
+ else:
+ o.backend_status = '2 - %s'%error
+
+ cmd = 'wget -O /dev/null -q "http://xoslnprof.appspot.com/command?action=pushlog&node=1&log_path=/%s/%s"'%(self.__class__.__name__,error)
+ os.system(cmd)
+
+ try:
+ scratchpad = json.loads(o.backend_register)
+ scratchpad['exponent']
+ except:
+ logger.log_exc("Exception while updating scratchpad")
+ scratchpad = {'next_run':0, 'exponent':0}
+
+ # Second failure
+ if (scratchpad['exponent']):
+ delay = scratchpad['exponent'] * 600 # 10 minutes
+ if (delay<1440):
+ delay = 1440
+ scratchpad['next_run'] = time.time() + delay
+
+ scratchpad['exponent']+=1
+
+ o.backend_register = json.dumps(scratchpad)
+
+ # TOFIX:
+ # DatabaseError: value too long for type character varying(140)
+ if (o.pk):
+ try:
+ o.backend_status = o.backend_status[:1024]
+ o.save(update_fields=['backend_status','backend_register','updated'])
+ except:
+ print "Could not update backend status field!"
+ pass
+ sync_failed = True
+
+
+ if (sync_failed):
+ failed.append(o)
+
+ return failed
+
+ def sync_record(self, o):
+ return
+
+ def delete_record(self, o):
+ return
+
+ def __call__(self, **args):
+ return self.call(**args)
\ No newline at end of file
diff --git a/xos/openstack_observer/syncstep.py b/xos/synchronizers/base/syncstep.py
similarity index 98%
rename from xos/openstack_observer/syncstep.py
rename to xos/synchronizers/base/syncstep.py
index 0a25c58..bdab8f3 100644
--- a/xos/openstack_observer/syncstep.py
+++ b/xos/synchronizers/base/syncstep.py
@@ -2,13 +2,13 @@
import base64
from datetime import datetime
from xos.config import Config
-from util.logger import Logger, logging
-from observer.steps import *
+from xos.logger import Logger, logging
+from synchronizers.base.steps import *
from django.db.models import F, Q
from core.models import *
from django.db import reset_queries
-from observer.ansible import *
-from dependency_walker import *
+from synchronizers.base.ansible import *
+from generate.dependency_walker import *
from time import time
import json
diff --git a/xos/synchronizers/base/syncstep.py.bak b/xos/synchronizers/base/syncstep.py.bak
new file mode 100644
index 0000000..a1f242b
--- /dev/null
+++ b/xos/synchronizers/base/syncstep.py.bak
@@ -0,0 +1,203 @@
+import os
+import base64
+from datetime import datetime
+from xos.config import Config
+from util.logger import Logger, logging
+from observer.steps import *
+from django.db.models import F, Q
+from core.models import *
+import json
+import time
+import pdb
+import traceback
+
+logger = Logger(level=logging.INFO)
+
+def f7(seq):
+ seen = set()
+ seen_add = seen.add
+ return [ x for x in seq if not (x in seen or seen_add(x))]
+
+def elim_dups(backend_str):
+ strs = backend_str.split(' // ')
+ strs2 = f7(strs)
+ return ' // '.join(strs2)
+
+def deepgetattr(obj, attr):
+ return reduce(getattr, attr.split('.'), obj)
+
+
+class InnocuousException(Exception):
+ pass
+
+class FailedDependency(Exception):
+ pass
+
+class SyncStep(object):
+ """ An XOS Sync step.
+
+ Attributes:
+ psmodel Model name the step synchronizes
+ dependencies list of names of models that must be synchronized first if the current model depends on them
+ """
+ slow=False
+ def get_prop(self, prop):
+ try:
+ sync_config_dir = Config().sync_config_dir
+ except:
+ sync_config_dir = '/etc/xos/sync'
+ prop_config_path = '/'.join(sync_config_dir,self.name,prop)
+ return open(prop_config_path).read().rstrip()
+
+ def __init__(self, **args):
+ """Initialize a sync step
+ Keyword arguments:
+ name -- Name of the step
+ provides -- XOS models sync'd by this step
+ """
+ dependencies = []
+ self.driver = args.get('driver')
+ self.error_map = args.get('error_map')
+
+ try:
+ self.soft_deadline = int(self.get_prop('soft_deadline_seconds'))
+ except:
+ self.soft_deadline = 5 # 5 seconds
+
+ return
+
+ def fetch_pending(self, deletion=False):
+ # This is the most common implementation of fetch_pending
+ # Steps should override it if they have their own logic
+ # for figuring out what objects are outstanding.
+ main_obj = self.observes
+ if (not deletion):
+ objs = main_obj.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None),Q(lazy_blocked=False))
+ else:
+ objs = main_obj.deleted_objects.all()
+
+ return objs
+ #return Sliver.objects.filter(ip=None)
+
+ def check_dependencies(self, obj, failed):
+ for dep in self.dependencies:
+ peer_name = dep[0].lower() + dep[1:] # django names are camelCased with the first letter lower
+
+ try:
+ peer_object = deepgetattr(obj, peer_name)
+ try:
+ peer_objects = peer_object.all()
+ except AttributeError:
+ peer_objects = [peer_object]
+ except:
+ peer_objects = []
+
+ if (hasattr(obj,'controller')):
+ try:
+ peer_objects = filter(lambda o:o.controller==obj.controller, peer_objects)
+ except AttributeError:
+ pass
+
+ if (failed in peer_objects):
+ if (obj.backend_status!=failed.backend_status):
+ obj.backend_status = failed.backend_status
+ obj.save(update_fields=['backend_status'])
+ raise FailedDependency("Failed dependency for %s:%s peer %s:%s failed %s:%s" % (obj.__class__.__name__, str(getattr(obj,"pk","no_pk")), peer_object.__class__.__name__, str(getattr(peer_object,"pk","no_pk")), failed.__class__.__name__, str(getattr(failed,"pk","no_pk"))))
+
+ def call(self, failed=[], deletion=False):
+ pending = self.fetch_pending(deletion)
+ for o in pending:
+ sync_failed = False
+ try:
+ backoff_disabled = Config().observer_backoff_disabled
+ except:
+ backoff_disabled = 0
+
+ try:
+ scratchpad = json.loads(o.backend_register)
+ if (scratchpad):
+ next_run = scratchpad['next_run']
+ if (not backoff_disabled and next_run>time.time()):
+ sync_failed = True
+ except:
+ logger.log_exc("Exception while loading scratchpad")
+ pass
+
+ if (not sync_failed):
+ try:
+ for f in failed:
+ self.check_dependencies(o,f) # Raises exception if failed
+ if (deletion):
+ self.delete_record(o)
+ o.delete(purge=True)
+ else:
+ self.sync_record(o)
+ o.enacted = datetime.now() # Is this the same timezone? XXX
+ scratchpad = {'next_run':0, 'exponent':0}
+ o.backend_register = json.dumps(scratchpad)
+ o.backend_status = "1 - OK"
+ o.save(update_fields=['enacted','backend_status','backend_register'])
+ except (InnocuousException,Exception) as e:
+ logger.log_exc("sync step failed!")
+ try:
+ if (o.backend_status.startswith('2 - ')):
+ str_e = '%s // %r'%(o.backend_status[4:],e)
+ str_e = elim_dups(str_e)
+ else:
+ str_e = '%r'%e
+ except:
+ str_e = '%r'%e
+
+ try:
+ error = self.error_map.map(str_e)
+ except:
+ error = '2 - %s'%str_e
+
+ if isinstance(e, InnocuousException) and not force_error:
+ o.backend_status = '1 - %s'%error
+ else:
+ o.backend_status = '3 - %s'%error
+
+ try:
+ scratchpad = json.loads(o.backend_register)
+ scratchpad['exponent']
+ except:
+ logger.log_exc("Exception while updating scratchpad")
+ scratchpad = {'next_run':0, 'exponent':0}
+
+ # Second failure
+ if (scratchpad['exponent']):
+ delay = scratchpad['exponent'] * 600 # 10 minutes
+ if (delay<1440):
+ delay = 1440
+ scratchpad['next_run'] = time.time() + delay
+
+ scratchpad['exponent']+=1
+
+ o.backend_register = json.dumps(scratchpad)
+
+ # TOFIX:
+ # DatabaseError: value too long for type character varying(140)
+ if (o.pk):
+ try:
+ o.backend_status = o.backend_status[:1024]
+ o.save(update_fields=['backend_status','backend_register','updated'])
+ except:
+ print "Could not update backend status field!"
+ pass
+ sync_failed = True
+
+
+ if (sync_failed):
+ failed.append(o)
+
+ return failed
+
+ def sync_record(self, o):
+ return
+
+ def delete_record(self, o):
+ return
+
+ def __call__(self, **args):
+ return self.call(**args)
diff --git a/xos/openstack_observer/templates/container.conf.j2 b/xos/synchronizers/base/templates/container.conf.j2
similarity index 100%
rename from xos/openstack_observer/templates/container.conf.j2
rename to xos/synchronizers/base/templates/container.conf.j2
diff --git a/xos/openstack_observer/templates/container.service.j2 b/xos/synchronizers/base/templates/container.service.j2
similarity index 100%
rename from xos/openstack_observer/templates/container.service.j2
rename to xos/synchronizers/base/templates/container.service.j2
diff --git a/xos/openstack_observer/templates/start-container.sh.j2 b/xos/synchronizers/base/templates/start-container.sh.j2
similarity index 100%
rename from xos/openstack_observer/templates/start-container.sh.j2
rename to xos/synchronizers/base/templates/start-container.sh.j2
diff --git a/xos/openstack_observer/templates/stop-container.sh.j2 b/xos/synchronizers/base/templates/stop-container.sh.j2
similarity index 100%
rename from xos/openstack_observer/templates/stop-container.sh.j2
rename to xos/synchronizers/base/templates/stop-container.sh.j2
diff --git a/xos/openstack_observer/toposort.py b/xos/synchronizers/base/toposort.py
similarity index 100%
rename from xos/openstack_observer/toposort.py
rename to xos/synchronizers/base/toposort.py
diff --git a/xos/ec2_observer/__init__.py b/xos/synchronizers/ec2/__init__.py
similarity index 100%
rename from xos/ec2_observer/__init__.py
rename to xos/synchronizers/ec2/__init__.py
diff --git a/xos/ec2_observer/aws_lib.py b/xos/synchronizers/ec2/aws_lib.py
similarity index 100%
rename from xos/ec2_observer/aws_lib.py
rename to xos/synchronizers/ec2/aws_lib.py
diff --git a/xos/ec2_observer/awslib.py b/xos/synchronizers/ec2/awslib.py
similarity index 100%
rename from xos/ec2_observer/awslib.py
rename to xos/synchronizers/ec2/awslib.py
diff --git a/xos/ec2_observer/backend.py b/xos/synchronizers/ec2/backend.py
similarity index 93%
rename from xos/ec2_observer/backend.py
rename to xos/synchronizers/ec2/backend.py
index 1a2545d..7288e61 100644
--- a/xos/ec2_observer/backend.py
+++ b/xos/synchronizers/ec2/backend.py
@@ -2,7 +2,7 @@
import time
from ec2_observer.event_loop import XOSObserver
from ec2_observer.event_manager import EventListener
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
logger = Logger(level=logging.INFO)
diff --git a/xos/ec2_observer/creds.py b/xos/synchronizers/ec2/creds.py
similarity index 100%
rename from xos/ec2_observer/creds.py
rename to xos/synchronizers/ec2/creds.py
diff --git a/xos/ec2_observer/deleter.py b/xos/synchronizers/ec2/deleter.py
similarity index 100%
copy from xos/ec2_observer/deleter.py
copy to xos/synchronizers/ec2/deleter.py
diff --git a/xos/ec2_observer/deleters/__init__.py b/xos/synchronizers/ec2/deleters/__init__.py
similarity index 100%
rename from xos/ec2_observer/deleters/__init__.py
rename to xos/synchronizers/ec2/deleters/__init__.py
diff --git a/xos/ec2_observer/deleters/instance_deleter.py b/xos/synchronizers/ec2/deleters/instance_deleter.py
similarity index 91%
rename from xos/ec2_observer/deleters/instance_deleter.py
rename to xos/synchronizers/ec2/deleters/instance_deleter.py
index 60f9e47..ba454e7 100644
--- a/xos/ec2_observer/deleters/instance_deleter.py
+++ b/xos/synchronizers/ec2/deleters/instance_deleter.py
@@ -1,5 +1,5 @@
from core.models import Instance, SliceDeployments
-from observer.deleter import Deleter
+from synchronizers.base.deleter import Deleter
class InstanceDeleter(Deleter):
model='Instance'
diff --git a/xos/ec2_observer/deleters/network_deleter.py b/xos/synchronizers/ec2/deleters/network_deleter.py
similarity index 76%
rename from xos/ec2_observer/deleters/network_deleter.py
rename to xos/synchronizers/ec2/deleters/network_deleter.py
index 0d21fda..aa9ef59 100644
--- a/xos/ec2_observer/deleters/network_deleter.py
+++ b/xos/synchronizers/ec2/deleters/network_deleter.py
@@ -1,7 +1,7 @@
from core.models import Network, NetworkDeployments
-from observer.deleter import Deleter
-from observer.deleters.network_deployment_deleter import NetworkDeploymentDeleter
-from util.logger import Logger, logging
+from synchronizers.base.deleter import Deleter
+from synchronizers.base.deleters.network_deployment_deleter import NetworkDeploymentDeleter
+from xos.logger import Logger, logging
logger = Logger(level=logging.INFO)
diff --git a/xos/ec2_observer/deleters/network_deployment_deleter.py b/xos/synchronizers/ec2/deleters/network_deployment_deleter.py
similarity index 95%
rename from xos/ec2_observer/deleters/network_deployment_deleter.py
rename to xos/synchronizers/ec2/deleters/network_deployment_deleter.py
index 72b10b2..f8aaa29 100644
--- a/xos/ec2_observer/deleters/network_deployment_deleter.py
+++ b/xos/synchronizers/ec2/deleters/network_deployment_deleter.py
@@ -1,5 +1,5 @@
from core.models import Network, NetworkDeployments
-from observer.deleter import Deleter
+from synchronizers.base.deleter import Deleter
from openstack.driver import OpenStackDriver
class NetworkDeploymentDeleter(Deleter):
diff --git a/xos/ec2_observer/deleters/network_instance_deleter.py b/xos/synchronizers/ec2/deleters/network_instance_deleter.py
similarity index 85%
rename from xos/ec2_observer/deleters/network_instance_deleter.py
rename to xos/synchronizers/ec2/deleters/network_instance_deleter.py
index 8a8f516..21fe87f 100644
--- a/xos/ec2_observer/deleters/network_instance_deleter.py
+++ b/xos/synchronizers/ec2/deleters/network_instance_deleter.py
@@ -1,5 +1,5 @@
from core.models import NetworkInstance
-from observer.deleter import Deleter
+from synchronizers.base.deleter import Deleter
class NetworkInstanceDeleter(Deleter):
model='NetworkInstance'
diff --git a/xos/ec2_observer/deleters/site_deleter.py b/xos/synchronizers/ec2/deleters/site_deleter.py
similarity index 75%
rename from xos/ec2_observer/deleters/site_deleter.py
rename to xos/synchronizers/ec2/deleters/site_deleter.py
index 88a4008..832baf9 100644
--- a/xos/ec2_observer/deleters/site_deleter.py
+++ b/xos/synchronizers/ec2/deleters/site_deleter.py
@@ -1,6 +1,6 @@
from core.models import Site, SiteDeployment
-from observer.deleter import Deleter
-from observer.deleters.site_deployment_deleter import SiteDeploymentDeleter
+from synchronizers.base.deleter import Deleter
+from synchronizers.base.deleters.site_deployment_deleter import SiteDeploymentDeleter
class SiteDeleter(Deleter):
model='Site'
diff --git a/xos/ec2_observer/deleters/site_deployment_deleter.py b/xos/synchronizers/ec2/deleters/site_deployment_deleter.py
similarity index 89%
rename from xos/ec2_observer/deleters/site_deployment_deleter.py
rename to xos/synchronizers/ec2/deleters/site_deployment_deleter.py
index db344cd..794b438 100644
--- a/xos/ec2_observer/deleters/site_deployment_deleter.py
+++ b/xos/synchronizers/ec2/deleters/site_deployment_deleter.py
@@ -1,5 +1,5 @@
from core.models import Site, SiteDeployment
-from observer.deleter import Deleter
+from synchronizers.base.deleter import Deleter
class SiteDeploymentDeleter(Deleter):
model='SiteDeployment'
diff --git a/xos/ec2_observer/deleters/slice_deleter.py b/xos/synchronizers/ec2/deleters/slice_deleter.py
similarity index 75%
rename from xos/ec2_observer/deleters/slice_deleter.py
rename to xos/synchronizers/ec2/deleters/slice_deleter.py
index 7e9dfd4..49bf692 100644
--- a/xos/ec2_observer/deleters/slice_deleter.py
+++ b/xos/synchronizers/ec2/deleters/slice_deleter.py
@@ -1,7 +1,7 @@
from core.models import Slice, SliceDeployments, User
-from observer.deleter import Deleter
-from observer.deleters.slice_deployment_deleter import SliceDeploymentsDeleter
-from util.logger import Logger, logging
+from synchronizers.base.deleter import Deleter
+from synchronizers.base.deleters.slice_deployment_deleter import SliceDeploymentsDeleter
+from xos.logger import Logger, logging
logger = Logger(level=logging.INFO)
diff --git a/xos/ec2_observer/deleters/slice_deployment_deleter.py b/xos/synchronizers/ec2/deleters/slice_deployment_deleter.py
similarity index 96%
rename from xos/ec2_observer/deleters/slice_deployment_deleter.py
rename to xos/synchronizers/ec2/deleters/slice_deployment_deleter.py
index 6f1aec0..39c557a 100644
--- a/xos/ec2_observer/deleters/slice_deployment_deleter.py
+++ b/xos/synchronizers/ec2/deleters/slice_deployment_deleter.py
@@ -1,5 +1,5 @@
from core.models import Slice, SliceDeployments, User
-from observer.deleter import Deleter
+from synchronizers.base.deleter import Deleter
from openstack.driver import OpenStackDriver
class SliceDeploymentsDeleter(Deleter):
diff --git a/xos/ec2_observer/deleters/user_deleter.py b/xos/synchronizers/ec2/deleters/user_deleter.py
similarity index 73%
rename from xos/ec2_observer/deleters/user_deleter.py
rename to xos/synchronizers/ec2/deleters/user_deleter.py
index 3930eb0..12c8224 100644
--- a/xos/ec2_observer/deleters/user_deleter.py
+++ b/xos/synchronizers/ec2/deleters/user_deleter.py
@@ -1,6 +1,6 @@
from core.models import User, UserDeployments
-from observer.deleter import Deleter
-from observer.deleters.user_deployment_deleter import UserDeploymentsDeleter
+from synchronizers.base.deleter import Deleter
+from synchronizers.base.deleters.user_deployment_deleter import UserDeploymentsDeleter
class UserDeleter(Deleter):
model='User'
diff --git a/xos/ec2_observer/deleters/user_deployment_deleter.py b/xos/synchronizers/ec2/deleters/user_deployment_deleter.py
similarity index 89%
rename from xos/ec2_observer/deleters/user_deployment_deleter.py
rename to xos/synchronizers/ec2/deleters/user_deployment_deleter.py
index 4bc7619..3b6113b 100644
--- a/xos/ec2_observer/deleters/user_deployment_deleter.py
+++ b/xos/synchronizers/ec2/deleters/user_deployment_deleter.py
@@ -1,5 +1,5 @@
from core.models import User, UserDeployments
-from observer.deleter import Deleter
+from synchronizers.base.deleter import Deleter
class UserDeploymentsDeleter(Deleter):
model='UserDeployments'
diff --git a/xos/ec2_observer/dmdot b/xos/synchronizers/ec2/dmdot
similarity index 100%
rename from xos/ec2_observer/dmdot
rename to xos/synchronizers/ec2/dmdot
diff --git a/xos/ec2_observer/ec2_backend.py b/xos/synchronizers/ec2/ec2_backend.py
similarity index 94%
rename from xos/ec2_observer/ec2_backend.py
rename to xos/synchronizers/ec2/ec2_backend.py
index a26ddfd..7edf63c 100644
--- a/xos/ec2_observer/ec2_backend.py
+++ b/xos/synchronizers/ec2/ec2_backend.py
@@ -2,7 +2,7 @@
import time
from ec2_observer.event_loop import XOSObserver
from ec2_observer.event_manager import EventListener
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
logger = Logger(level=logging.INFO)
diff --git a/xos/ec2_observer/error_mapper.py b/xos/synchronizers/ec2/error_mapper.py
similarity index 90%
copy from xos/ec2_observer/error_mapper.py
copy to xos/synchronizers/ec2/error_mapper.py
index 3039a56..9eb878d 100644
--- a/xos/ec2_observer/error_mapper.py
+++ b/xos/synchronizers/ec2/error_mapper.py
@@ -1,5 +1,5 @@
from xos.config import Config
-from util.logger import Logger, logging, logger
+from xos.logger import Logger, logging, logger
class ErrorMapper:
def __init__(self, error_map_file):
diff --git a/xos/ec2_observer/event_loop.py b/xos/synchronizers/ec2/event_loop.py
similarity index 98%
rename from xos/ec2_observer/event_loop.py
rename to xos/synchronizers/ec2/event_loop.py
index fb91ee8..cfeb212 100644
--- a/xos/ec2_observer/event_loop.py
+++ b/xos/synchronizers/ec2/event_loop.py
@@ -14,13 +14,13 @@
from django.db.models import F, Q
#from openstack.manager import OpenStackManager
from openstack.driver import OpenStackDriver
-from util.logger import Logger, logging, logger
+from xos.logger import Logger, logging, logger
#from timeout import timeout
from xos.config import Config, XOS_DIR
-from observer.steps import *
+from synchronizers.base.steps import *
from syncstep import SyncStep
from toposort import toposort
-from observer.error_mapper import *
+from synchronizers.base.error_mapper import *
debug_mode = False
diff --git a/xos/ec2_observer/event_manager.py b/xos/synchronizers/ec2/event_manager.py
similarity index 100%
rename from xos/ec2_observer/event_manager.py
rename to xos/synchronizers/ec2/event_manager.py
diff --git a/xos/ec2_observer/steps/__init__.py b/xos/synchronizers/ec2/steps/__init__.py
similarity index 100%
rename from xos/ec2_observer/steps/__init__.py
rename to xos/synchronizers/ec2/steps/__init__.py
diff --git a/xos/ec2_observer/steps/sync_deployments.py b/xos/synchronizers/ec2/steps/sync_deployments.py
similarity index 100%
rename from xos/ec2_observer/steps/sync_deployments.py
rename to xos/synchronizers/ec2/steps/sync_deployments.py
diff --git a/xos/ec2_observer/steps/sync_images.py b/xos/synchronizers/ec2/steps/sync_images.py
similarity index 100%
rename from xos/ec2_observer/steps/sync_images.py
rename to xos/synchronizers/ec2/steps/sync_images.py
diff --git a/xos/ec2_observer/steps/sync_instances.py b/xos/synchronizers/ec2/steps/sync_instances.py
similarity index 98%
rename from xos/ec2_observer/steps/sync_instances.py
rename to xos/synchronizers/ec2/steps/sync_instances.py
index 3dc5f0e..fc11e05 100644
--- a/xos/ec2_observer/steps/sync_instances.py
+++ b/xos/synchronizers/ec2/steps/sync_instances.py
@@ -7,7 +7,7 @@
from core.models.instance import Instance
from core.models.slice import SlicePrivilege, SliceDeployments
from core.models.network import Network, NetworkSlice, NetworkDeployments
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
from ec2_observer.awslib import *
from core.models.site import *
from core.models.slice import *
diff --git a/xos/ec2_observer/steps/sync_site_deployments.py b/xos/synchronizers/ec2/steps/sync_site_deployments.py
similarity index 100%
rename from xos/ec2_observer/steps/sync_site_deployments.py
rename to xos/synchronizers/ec2/steps/sync_site_deployments.py
diff --git a/xos/ec2_observer/steps/sync_sites.py b/xos/synchronizers/ec2/steps/sync_sites.py
similarity index 100%
rename from xos/ec2_observer/steps/sync_sites.py
rename to xos/synchronizers/ec2/steps/sync_sites.py
diff --git a/xos/ec2_observer/steps/sync_users.py b/xos/synchronizers/ec2/steps/sync_users.py
similarity index 100%
rename from xos/ec2_observer/steps/sync_users.py
rename to xos/synchronizers/ec2/steps/sync_users.py
diff --git a/xos/ec2_observer/syncstep.py b/xos/synchronizers/ec2/syncstep.py
similarity index 97%
rename from xos/ec2_observer/syncstep.py
rename to xos/synchronizers/ec2/syncstep.py
index e15e719..3cba48b 100644
--- a/xos/ec2_observer/syncstep.py
+++ b/xos/synchronizers/ec2/syncstep.py
@@ -5,8 +5,8 @@
from django.db.models import F, Q
from xos.config import Config
-from util.logger import Logger, logging
-from observer.steps import *
+from xos.logger import Logger, logging
+from synchronizers.base.steps import *
logger = Logger(level=logging.INFO)
diff --git a/xos/ec2_observer/toposort.py b/xos/synchronizers/ec2/toposort.py
similarity index 100%
rename from xos/ec2_observer/toposort.py
rename to xos/synchronizers/ec2/toposort.py
diff --git a/xos/ec2_observer/xos.deps b/xos/synchronizers/ec2/xos.deps
similarity index 100%
rename from xos/ec2_observer/xos.deps
rename to xos/synchronizers/ec2/xos.deps
diff --git a/xos/observers/helloworld/helloworld-observer.py b/xos/synchronizers/helloworld/helloworld-observer.py
similarity index 100%
rename from xos/observers/helloworld/helloworld-observer.py
rename to xos/synchronizers/helloworld/helloworld-observer.py
diff --git a/xos/observers/helloworld/helloworld_config b/xos/synchronizers/helloworld/helloworld_config
similarity index 100%
rename from xos/observers/helloworld/helloworld_config
rename to xos/synchronizers/helloworld/helloworld_config
diff --git a/xos/observers/helloworld/model-deps b/xos/synchronizers/helloworld/model-deps
similarity index 100%
rename from xos/observers/helloworld/model-deps
rename to xos/synchronizers/helloworld/model-deps
diff --git a/xos/observers/helloworld/nohup.out b/xos/synchronizers/helloworld/nohup.out
similarity index 100%
rename from xos/observers/helloworld/nohup.out
rename to xos/synchronizers/helloworld/nohup.out
diff --git a/xos/observers/helloworld/run.sh b/xos/synchronizers/helloworld/run.sh
similarity index 100%
rename from xos/observers/helloworld/run.sh
rename to xos/synchronizers/helloworld/run.sh
diff --git a/xos/observers/helloworld/start.sh b/xos/synchronizers/helloworld/start.sh
similarity index 100%
rename from xos/observers/helloworld/start.sh
rename to xos/synchronizers/helloworld/start.sh
diff --git a/xos/observers/helloworld/steps/sync_hello.py b/xos/synchronizers/helloworld/steps/sync_hello.py
similarity index 89%
rename from xos/observers/helloworld/steps/sync_hello.py
rename to xos/synchronizers/helloworld/steps/sync_hello.py
index 880d570..55d318a 100644
--- a/xos/observers/helloworld/steps/sync_hello.py
+++ b/xos/synchronizers/helloworld/steps/sync_hello.py
@@ -3,9 +3,9 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from services.helloworld.models import Hello,World
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
parentdir = os.path.join(os.path.dirname(__file__),"..")
sys.path.insert(0,parentdir)
diff --git a/xos/observers/helloworld/steps/sync_world.py b/xos/synchronizers/helloworld/steps/sync_world.py
similarity index 86%
rename from xos/observers/helloworld/steps/sync_world.py
rename to xos/synchronizers/helloworld/steps/sync_world.py
index a97d320..a4e7e3c 100644
--- a/xos/observers/helloworld/steps/sync_world.py
+++ b/xos/synchronizers/helloworld/steps/sync_world.py
@@ -3,9 +3,9 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from services.helloworld.models import Hello,World
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/helloworld/stop.sh b/xos/synchronizers/helloworld/stop.sh
similarity index 100%
rename from xos/observers/helloworld/stop.sh
rename to xos/synchronizers/helloworld/stop.sh
diff --git a/xos/observers/helloworldservice_complete/helloworldservice-observer.py b/xos/synchronizers/helloworldservice_complete/helloworldservice-observer.py
similarity index 100%
rename from xos/observers/helloworldservice_complete/helloworldservice-observer.py
rename to xos/synchronizers/helloworldservice_complete/helloworldservice-observer.py
diff --git a/xos/observers/helloworldservice_complete/helloworldservice_config b/xos/synchronizers/helloworldservice_complete/helloworldservice_config
similarity index 100%
rename from xos/observers/helloworldservice_complete/helloworldservice_config
rename to xos/synchronizers/helloworldservice_complete/helloworldservice_config
diff --git a/xos/observers/helloworldservice_complete/model-deps b/xos/synchronizers/helloworldservice_complete/model-deps
similarity index 100%
rename from xos/observers/helloworldservice_complete/model-deps
rename to xos/synchronizers/helloworldservice_complete/model-deps
diff --git a/xos/observers/helloworldservice_complete/run.sh b/xos/synchronizers/helloworldservice_complete/run.sh
similarity index 100%
rename from xos/observers/helloworldservice_complete/run.sh
rename to xos/synchronizers/helloworldservice_complete/run.sh
diff --git a/xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.py b/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.py
similarity index 96%
rename from xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.py
rename to xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.py
index 5604296..b7ed2a8 100644
--- a/xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.py
+++ b/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.py
@@ -2,7 +2,7 @@
import sys
from django.db.models import Q, F
from services.helloworldservice_complete.models import HelloWorldServiceComplete, HelloWorldTenantComplete
-from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
parentdir = os.path.join(os.path.dirname(__file__), "..")
sys.path.insert(0, parentdir)
diff --git a/xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.yaml b/xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.yaml
similarity index 100%
rename from xos/observers/helloworldservice_complete/steps/sync_helloworldtenant.yaml
rename to xos/synchronizers/helloworldservice_complete/steps/sync_helloworldtenant.yaml
diff --git a/xos/observers/helloworldservice_complete/stop.sh b/xos/synchronizers/helloworldservice_complete/stop.sh
similarity index 100%
rename from xos/observers/helloworldservice_complete/stop.sh
rename to xos/synchronizers/helloworldservice_complete/stop.sh
diff --git a/xos/observers/hpc/Makefile b/xos/synchronizers/hpc/Makefile
similarity index 100%
rename from xos/observers/hpc/Makefile
rename to xos/synchronizers/hpc/Makefile
diff --git a/xos/observers/hpc/fsck.py b/xos/synchronizers/hpc/fsck.py
similarity index 96%
rename from xos/observers/hpc/fsck.py
rename to xos/synchronizers/hpc/fsck.py
index 0c551f8..448bfb7 100644
--- a/xos/observers/hpc/fsck.py
+++ b/xos/synchronizers/hpc/fsck.py
@@ -7,8 +7,8 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
sys.path.append("/opt/xos")
from xos.config import Config, DEFAULT_CONFIG_FN, XOS_DIR
-from util.logger import Logger, logging
-from observer.syncstep import SyncStep
+from xos.logger import Logger, logging
+from synchronizers.base.syncstep import SyncStep
try:
from django import setup as django_setup # django 1.7
diff --git a/xos/observers/hpc/hpc-observer.py b/xos/synchronizers/hpc/hpc-observer.py
similarity index 100%
rename from xos/observers/hpc/hpc-observer.py
rename to xos/synchronizers/hpc/hpc-observer.py
diff --git a/xos/observers/hpc/hpc_observer_config b/xos/synchronizers/hpc/hpc_observer_config
similarity index 100%
rename from xos/observers/hpc/hpc_observer_config
rename to xos/synchronizers/hpc/hpc_observer_config
diff --git a/xos/observers/hpc/hpc_watcher.py b/xos/synchronizers/hpc/hpc_watcher.py
similarity index 100%
rename from xos/observers/hpc/hpc_watcher.py
rename to xos/synchronizers/hpc/hpc_watcher.py
diff --git a/xos/observers/hpc/hpclib.py b/xos/synchronizers/hpc/hpclib.py
similarity index 98%
rename from xos/observers/hpc/hpclib.py
rename to xos/synchronizers/hpc/hpclib.py
index 88abf23..bb1c263 100644
--- a/xos/observers/hpc/hpclib.py
+++ b/xos/synchronizers/hpc/hpclib.py
@@ -12,7 +12,7 @@
from core.models import Service
from services.hpc.models import HpcService
from services.requestrouter.models import RequestRouterService
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
logger = Logger(level=logging.INFO)
diff --git a/xos/observers/hpc/model-deps b/xos/synchronizers/hpc/model-deps
similarity index 100%
rename from xos/observers/hpc/model-deps
rename to xos/synchronizers/hpc/model-deps
diff --git a/xos/observers/hpc/run.sh b/xos/synchronizers/hpc/run.sh
similarity index 100%
rename from xos/observers/hpc/run.sh
rename to xos/synchronizers/hpc/run.sh
diff --git a/xos/observers/hpc/start.sh b/xos/synchronizers/hpc/start.sh
similarity index 100%
rename from xos/observers/hpc/start.sh
rename to xos/synchronizers/hpc/start.sh
diff --git a/xos/observers/hpc/steps/garbage_collector.py b/xos/synchronizers/hpc/steps/garbage_collector.py
similarity index 95%
rename from xos/observers/hpc/steps/garbage_collector.py
rename to xos/synchronizers/hpc/steps/garbage_collector.py
index 259762b..658f7a1 100644
--- a/xos/observers/hpc/steps/garbage_collector.py
+++ b/xos/synchronizers/hpc/steps/garbage_collector.py
@@ -5,8 +5,8 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from util.logger import Logger, logging
-from observer.syncstep import SyncStep
+from xos.logger import Logger, logging
+from synchronizers.base.syncstep import SyncStep
from services.hpc.models import ServiceProvider, ContentProvider, CDNPrefix, OriginServer
from core.models import *
diff --git a/xos/observers/hpc/steps/sync_cdnprefix.py b/xos/synchronizers/hpc/steps/sync_cdnprefix.py
similarity index 97%
rename from xos/observers/hpc/steps/sync_cdnprefix.py
rename to xos/synchronizers/hpc/steps/sync_cdnprefix.py
index a6382bd..7439633 100644
--- a/xos/observers/hpc/steps/sync_cdnprefix.py
+++ b/xos/synchronizers/hpc/steps/sync_cdnprefix.py
@@ -3,10 +3,10 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.hpc.models import ServiceProvider, ContentProvider, CDNPrefix
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/hpc/steps/sync_contentprovider.py b/xos/synchronizers/hpc/steps/sync_contentprovider.py
similarity index 96%
rename from xos/observers/hpc/steps/sync_contentprovider.py
rename to xos/synchronizers/hpc/steps/sync_contentprovider.py
index 0f86e2e..c58cb5e 100644
--- a/xos/observers/hpc/steps/sync_contentprovider.py
+++ b/xos/synchronizers/hpc/steps/sync_contentprovider.py
@@ -3,10 +3,10 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.hpc.models import ServiceProvider, ContentProvider
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/hpc/steps/sync_hpcservices.py b/xos/synchronizers/hpc/steps/sync_hpcservices.py
similarity index 92%
rename from xos/observers/hpc/steps/sync_hpcservices.py
rename to xos/synchronizers/hpc/steps/sync_hpcservices.py
index 4ceb096..e49f93f 100644
--- a/xos/observers/hpc/steps/sync_hpcservices.py
+++ b/xos/synchronizers/hpc/steps/sync_hpcservices.py
@@ -3,11 +3,11 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.hpc.models import HpcService
from services.requestrouter.models import RequestRouterService
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/hpc/steps/sync_originserver.py b/xos/synchronizers/hpc/steps/sync_originserver.py
similarity index 97%
rename from xos/observers/hpc/steps/sync_originserver.py
rename to xos/synchronizers/hpc/steps/sync_originserver.py
index 01bd56a..0a675e1 100644
--- a/xos/observers/hpc/steps/sync_originserver.py
+++ b/xos/synchronizers/hpc/steps/sync_originserver.py
@@ -4,10 +4,10 @@
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.hpc.models import ServiceProvider, ContentProvider, CDNPrefix, OriginServer
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/hpc/steps/sync_serviceprovider.py b/xos/synchronizers/hpc/steps/sync_serviceprovider.py
similarity index 95%
rename from xos/observers/hpc/steps/sync_serviceprovider.py
rename to xos/synchronizers/hpc/steps/sync_serviceprovider.py
index 68c36ef..0cf145f 100644
--- a/xos/observers/hpc/steps/sync_serviceprovider.py
+++ b/xos/synchronizers/hpc/steps/sync_serviceprovider.py
@@ -3,10 +3,10 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.hpc.models import ServiceProvider
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/hpc/steps/sync_sitemap.py b/xos/synchronizers/hpc/steps/sync_sitemap.py
similarity index 97%
rename from xos/observers/hpc/steps/sync_sitemap.py
rename to xos/synchronizers/hpc/steps/sync_sitemap.py
index 3fd4b16..885c616 100644
--- a/xos/observers/hpc/steps/sync_sitemap.py
+++ b/xos/synchronizers/hpc/steps/sync_sitemap.py
@@ -3,10 +3,10 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.hpc.models import ServiceProvider, ContentProvider, CDNPrefix, SiteMap
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/hpc/stop.sh b/xos/synchronizers/hpc/stop.sh
similarity index 100%
rename from xos/observers/hpc/stop.sh
rename to xos/synchronizers/hpc/stop.sh
diff --git a/xos/observers/hpc/supervisor/hpc-observer.conf b/xos/synchronizers/hpc/supervisor/hpc-observer.conf
similarity index 100%
rename from xos/observers/hpc/supervisor/hpc-observer.conf
rename to xos/synchronizers/hpc/supervisor/hpc-observer.conf
diff --git a/xos/observers/hpc/supervisor/hpc-watcher.conf b/xos/synchronizers/hpc/supervisor/hpc-watcher.conf
similarity index 100%
rename from xos/observers/hpc/supervisor/hpc-watcher.conf
rename to xos/synchronizers/hpc/supervisor/hpc-watcher.conf
diff --git a/xos/model_policy.py b/xos/synchronizers/model_policy.py
similarity index 96%
rename from xos/model_policy.py
rename to xos/synchronizers/model_policy.py
index 9462b35..b8fdd5d 100644
--- a/xos/model_policy.py
+++ b/xos/synchronizers/model_policy.py
@@ -1,9 +1,9 @@
from django.db.models.signals import post_save
from django.dispatch import receiver
import pdb
-from dependency_walker import *
-import model_policies
-from util.logger import logger
+from generate.dependency_walker import *
+from synchronizers.openstack import model_policies
+from xos.logger import logger
from datetime import datetime
import time
from core.models import *
diff --git a/xos/observers/monitoring_channel/files/docker.list b/xos/synchronizers/monitoring_channel/files/docker.list
similarity index 100%
rename from xos/observers/monitoring_channel/files/docker.list
rename to xos/synchronizers/monitoring_channel/files/docker.list
diff --git a/xos/observers/monitoring_channel/files/vm-resolv.conf b/xos/synchronizers/monitoring_channel/files/vm-resolv.conf
similarity index 100%
rename from xos/observers/monitoring_channel/files/vm-resolv.conf
rename to xos/synchronizers/monitoring_channel/files/vm-resolv.conf
diff --git a/xos/observers/monitoring_channel/model-deps b/xos/synchronizers/monitoring_channel/model-deps
similarity index 100%
rename from xos/observers/monitoring_channel/model-deps
rename to xos/synchronizers/monitoring_channel/model-deps
diff --git a/xos/observers/monitoring_channel/monitoring_channel_observer.py b/xos/synchronizers/monitoring_channel/monitoring_channel_observer.py
similarity index 100%
rename from xos/observers/monitoring_channel/monitoring_channel_observer.py
rename to xos/synchronizers/monitoring_channel/monitoring_channel_observer.py
diff --git a/xos/observers/monitoring_channel/monitoring_channel_observer_config b/xos/synchronizers/monitoring_channel/monitoring_channel_observer_config
similarity index 100%
rename from xos/observers/monitoring_channel/monitoring_channel_observer_config
rename to xos/synchronizers/monitoring_channel/monitoring_channel_observer_config
diff --git a/xos/observers/monitoring_channel/steps/sync_monitoringchannel.py b/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.py
similarity index 91%
rename from xos/observers/monitoring_channel/steps/sync_monitoringchannel.py
rename to xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.py
index 78ad45e..2e4eca8 100644
--- a/xos/observers/monitoring_channel/steps/sync_monitoringchannel.py
+++ b/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.py
@@ -6,12 +6,12 @@
import time
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
-from observer.ansible import run_template_ssh
-from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.base.syncstep import SyncStep
+from synchronizers.base.ansible import run_template_ssh
+from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
from core.models import Service, Slice
from services.ceilometer.models import MonitoringChannel
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
parentdir = os.path.join(os.path.dirname(__file__),"..")
sys.path.insert(0,parentdir)
diff --git a/xos/observers/monitoring_channel/steps/sync_monitoringchannel.yaml b/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
similarity index 100%
rename from xos/observers/monitoring_channel/steps/sync_monitoringchannel.yaml
rename to xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
diff --git a/xos/observers/monitoring_channel/supervisor/monitoring_channel_observer.conf b/xos/synchronizers/monitoring_channel/supervisor/monitoring_channel_observer.conf
similarity index 100%
rename from xos/observers/monitoring_channel/supervisor/monitoring_channel_observer.conf
rename to xos/synchronizers/monitoring_channel/supervisor/monitoring_channel_observer.conf
diff --git a/xos/observers/monitoring_channel/templates/Dockerfile.monitoring_channel b/xos/synchronizers/monitoring_channel/templates/Dockerfile.monitoring_channel
similarity index 100%
rename from xos/observers/monitoring_channel/templates/Dockerfile.monitoring_channel
rename to xos/synchronizers/monitoring_channel/templates/Dockerfile.monitoring_channel
diff --git a/xos/observers/monitoring_channel/templates/ceilometer_proxy_config.j2 b/xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_config.j2
similarity index 100%
rename from xos/observers/monitoring_channel/templates/ceilometer_proxy_config.j2
rename to xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_config.j2
diff --git a/xos/observers/monitoring_channel/templates/ceilometer_proxy_server.py b/xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_server.py
similarity index 100%
rename from xos/observers/monitoring_channel/templates/ceilometer_proxy_server.py
rename to xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_server.py
diff --git a/xos/observers/monitoring_channel/templates/monitoring-channel.conf.j2 b/xos/synchronizers/monitoring_channel/templates/monitoring-channel.conf.j2
similarity index 100%
rename from xos/observers/monitoring_channel/templates/monitoring-channel.conf.j2
rename to xos/synchronizers/monitoring_channel/templates/monitoring-channel.conf.j2
diff --git a/xos/observers/monitoring_channel/templates/start-monitoring-channel.sh.j2 b/xos/synchronizers/monitoring_channel/templates/start-monitoring-channel.sh.j2
similarity index 100%
rename from xos/observers/monitoring_channel/templates/start-monitoring-channel.sh.j2
rename to xos/synchronizers/monitoring_channel/templates/start-monitoring-channel.sh.j2
diff --git a/xos/observers/monitoring_channel/templates/start_ceilometer_proxy b/xos/synchronizers/monitoring_channel/templates/start_ceilometer_proxy
similarity index 100%
rename from xos/observers/monitoring_channel/templates/start_ceilometer_proxy
rename to xos/synchronizers/monitoring_channel/templates/start_ceilometer_proxy
diff --git a/xos/observers/onos/model-deps b/xos/synchronizers/onos/model-deps
similarity index 100%
rename from xos/observers/onos/model-deps
rename to xos/synchronizers/onos/model-deps
diff --git a/xos/observers/onos/onos-observer.py b/xos/synchronizers/onos/onos-observer.py
similarity index 100%
rename from xos/observers/onos/onos-observer.py
rename to xos/synchronizers/onos/onos-observer.py
diff --git a/xos/observers/onos/onos_observer_config b/xos/synchronizers/onos/onos_observer_config
similarity index 100%
rename from xos/observers/onos/onos_observer_config
rename to xos/synchronizers/onos/onos_observer_config
diff --git a/xos/observers/onos/run.sh b/xos/synchronizers/onos/run.sh
similarity index 100%
rename from xos/observers/onos/run.sh
rename to xos/synchronizers/onos/run.sh
diff --git a/xos/observers/onos/scripts/dockerip.sh b/xos/synchronizers/onos/scripts/dockerip.sh
similarity index 100%
rename from xos/observers/onos/scripts/dockerip.sh
rename to xos/synchronizers/onos/scripts/dockerip.sh
diff --git a/xos/observers/onos/start.sh b/xos/synchronizers/onos/start.sh
similarity index 100%
rename from xos/observers/onos/start.sh
rename to xos/synchronizers/onos/start.sh
diff --git a/xos/observers/onos/steps/sync_onosapp.py b/xos/synchronizers/onos/steps/sync_onosapp.py
similarity index 95%
rename from xos/observers/onos/steps/sync_onosapp.py
rename to xos/synchronizers/onos/steps/sync_onosapp.py
index cfe1041..91eec44 100644
--- a/xos/observers/onos/steps/sync_onosapp.py
+++ b/xos/synchronizers/onos/steps/sync_onosapp.py
@@ -7,12 +7,12 @@
import time
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
-from observer.ansible import run_template_ssh
-from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.base.syncstep import SyncStep
+from synchronizers.base.ansible import run_template_ssh
+from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
from core.models import Service, Slice
from services.onos.models import ONOSService, ONOSApp
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/onos/steps/sync_onosapp.yaml b/xos/synchronizers/onos/steps/sync_onosapp.yaml
similarity index 100%
rename from xos/observers/onos/steps/sync_onosapp.yaml
rename to xos/synchronizers/onos/steps/sync_onosapp.yaml
diff --git a/xos/observers/onos/steps/sync_onosservice.py b/xos/synchronizers/onos/steps/sync_onosservice.py
similarity index 90%
rename from xos/observers/onos/steps/sync_onosservice.py
rename to xos/synchronizers/onos/steps/sync_onosservice.py
index 420904a..0474dc6 100644
--- a/xos/observers/onos/steps/sync_onosservice.py
+++ b/xos/synchronizers/onos/steps/sync_onosservice.py
@@ -6,12 +6,12 @@
import time
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
-from observer.ansible import run_template_ssh
-from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.base.syncstep import SyncStep
+from synchronizers.base.ansible import run_template_ssh
+from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
from core.models import Service, Slice
from services.onos.models import ONOSService, ONOSApp
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/onos/steps/sync_onosservice.yaml b/xos/synchronizers/onos/steps/sync_onosservice.yaml
similarity index 100%
rename from xos/observers/onos/steps/sync_onosservice.yaml
rename to xos/synchronizers/onos/steps/sync_onosservice.yaml
diff --git a/xos/observers/onos/stop.sh b/xos/synchronizers/onos/stop.sh
similarity index 100%
rename from xos/observers/onos/stop.sh
rename to xos/synchronizers/onos/stop.sh
diff --git a/xos/observers/onos/supervisor/onos-observer.conf b/xos/synchronizers/onos/supervisor/onos-observer.conf
similarity index 100%
rename from xos/observers/onos/supervisor/onos-observer.conf
rename to xos/synchronizers/onos/supervisor/onos-observer.conf
diff --git a/xos/openstack_observer/__init__.py b/xos/synchronizers/openstack/__init__.py
similarity index 100%
copy from xos/openstack_observer/__init__.py
copy to xos/synchronizers/openstack/__init__.py
diff --git a/xos/openstack_observer/ansible.py b/xos/synchronizers/openstack/ansible.py
similarity index 98%
copy from xos/openstack_observer/ansible.py
copy to xos/synchronizers/openstack/ansible.py
index 94b09bd..fda2300 100644
--- a/xos/openstack_observer/ansible.py
+++ b/xos/synchronizers/openstack/ansible.py
@@ -10,7 +10,7 @@
import traceback
import subprocess
from xos.config import Config, XOS_DIR
-from util.logger import observer_logger
+from xos.logger import observer_logger
try:
step_dir = Config().observer_steps_dir
diff --git a/xos/openstack_observer/backend.py b/xos/synchronizers/openstack/backend.py
similarity index 86%
copy from xos/openstack_observer/backend.py
copy to xos/synchronizers/openstack/backend.py
index 5657491..5f11d46 100644
--- a/xos/openstack_observer/backend.py
+++ b/xos/synchronizers/openstack/backend.py
@@ -2,10 +2,10 @@
import sys
import threading
import time
-from observer.event_loop import XOSObserver
-from observer.event_manager import EventListener
-from util.logger import Logger, logging
-from model_policy import run_policy
+from synchronizers.base.event_loop import XOSObserver
+from synchronizers.base.event_manager import EventListener
+from xos.logger import Logger, logging
+from synchronizers.model_policy import run_policy
from xos.config import Config
logger = Logger(level=logging.INFO)
diff --git a/xos/ec2_observer/deleter.py b/xos/synchronizers/openstack/deleter.py
similarity index 100%
copy from xos/ec2_observer/deleter.py
copy to xos/synchronizers/openstack/deleter.py
diff --git a/xos/ec2_observer/error_mapper.py b/xos/synchronizers/openstack/error_mapper.py
similarity index 90%
copy from xos/ec2_observer/error_mapper.py
copy to xos/synchronizers/openstack/error_mapper.py
index 3039a56..9eb878d 100644
--- a/xos/ec2_observer/error_mapper.py
+++ b/xos/synchronizers/openstack/error_mapper.py
@@ -1,5 +1,5 @@
from xos.config import Config
-from util.logger import Logger, logging, logger
+from xos.logger import Logger, logging, logger
class ErrorMapper:
def __init__(self, error_map_file):
diff --git a/xos/openstack_observer/event_loop.py b/xos/synchronizers/openstack/event_loop.py
similarity index 97%
copy from xos/openstack_observer/event_loop.py
copy to xos/synchronizers/openstack/event_loop.py
index 0ac626b..6cfc9f6 100644
--- a/xos/openstack_observer/event_loop.py
+++ b/xos/synchronizers/openstack/event_loop.py
@@ -19,15 +19,15 @@
from django.db import reset_queries
#from openstack.manager import OpenStackManager
from openstack.driver import OpenStackDriver
-from util.logger import Logger, logging, logger
+from xos.logger import Logger, logging, logger
#from timeout import timeout
from xos.config import Config, XOS_DIR
-from observer.steps import *
+from synchronizers.base.steps import *
from syncstep import SyncStep
from toposort import toposort
-from observer.error_mapper import *
-from openstack_observer.openstacksyncstep import OpenStackSyncStep
-from observer.steps.sync_object import SyncObject
+from synchronizers.base.error_mapper import *
+from synchronizers.openstack.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.steps.sync_object import SyncObject
# Load app models
@@ -121,7 +121,7 @@
if hasattr(Config(), "observer_steps_dir"):
step_dir = Config().observer_steps_dir
else:
- step_dir = XOS_DIR + "/observer/steps"
+ step_dir = XOS_DIR + "/synchronizers/openstack/steps"
for fn in os.listdir(step_dir):
pathname = os.path.join(step_dir,fn)
diff --git a/xos/openstack_observer/event_manager.py b/xos/synchronizers/openstack/event_manager.py
similarity index 100%
copy from xos/openstack_observer/event_manager.py
copy to xos/synchronizers/openstack/event_manager.py
diff --git a/xos/model_policies/__init__.py b/xos/synchronizers/openstack/model_policies/__init__.py
similarity index 100%
rename from xos/model_policies/__init__.py
rename to xos/synchronizers/openstack/model_policies/__init__.py
diff --git a/xos/model_policies/model_policy_Controller.py b/xos/synchronizers/openstack/model_policies/model_policy_Controller.py
similarity index 100%
rename from xos/model_policies/model_policy_Controller.py
rename to xos/synchronizers/openstack/model_policies/model_policy_Controller.py
diff --git a/xos/model_policies/model_policy_ControllerSite.py b/xos/synchronizers/openstack/model_policies/model_policy_ControllerSite.py
similarity index 100%
rename from xos/model_policies/model_policy_ControllerSite.py
rename to xos/synchronizers/openstack/model_policies/model_policy_ControllerSite.py
diff --git a/xos/model_policies/model_policy_ControllerSlice.py b/xos/synchronizers/openstack/model_policies/model_policy_ControllerSlice.py
similarity index 100%
rename from xos/model_policies/model_policy_ControllerSlice.py
rename to xos/synchronizers/openstack/model_policies/model_policy_ControllerSlice.py
diff --git a/xos/model_policies/model_policy_ControllerUser.py b/xos/synchronizers/openstack/model_policies/model_policy_ControllerUser.py
similarity index 100%
rename from xos/model_policies/model_policy_ControllerUser.py
rename to xos/synchronizers/openstack/model_policies/model_policy_ControllerUser.py
diff --git a/xos/model_policies/model_policy_Image.py b/xos/synchronizers/openstack/model_policies/model_policy_Image.py
similarity index 100%
rename from xos/model_policies/model_policy_Image.py
rename to xos/synchronizers/openstack/model_policies/model_policy_Image.py
diff --git a/xos/model_policies/model_policy_Instance.py b/xos/synchronizers/openstack/model_policies/model_policy_Instance.py
similarity index 100%
rename from xos/model_policies/model_policy_Instance.py
rename to xos/synchronizers/openstack/model_policies/model_policy_Instance.py
diff --git a/xos/model_policies/model_policy_Network.py b/xos/synchronizers/openstack/model_policies/model_policy_Network.py
similarity index 100%
rename from xos/model_policies/model_policy_Network.py
rename to xos/synchronizers/openstack/model_policies/model_policy_Network.py
diff --git a/xos/model_policies/model_policy_Site.py b/xos/synchronizers/openstack/model_policies/model_policy_Site.py
similarity index 100%
rename from xos/model_policies/model_policy_Site.py
rename to xos/synchronizers/openstack/model_policies/model_policy_Site.py
diff --git a/xos/model_policies/model_policy_SitePrivilege.py b/xos/synchronizers/openstack/model_policies/model_policy_SitePrivilege.py
similarity index 100%
rename from xos/model_policies/model_policy_SitePrivilege.py
rename to xos/synchronizers/openstack/model_policies/model_policy_SitePrivilege.py
diff --git a/xos/model_policies/model_policy_Slice.py b/xos/synchronizers/openstack/model_policies/model_policy_Slice.py
similarity index 100%
rename from xos/model_policies/model_policy_Slice.py
rename to xos/synchronizers/openstack/model_policies/model_policy_Slice.py
diff --git a/xos/model_policies/model_policy_SlicePrivilege.py b/xos/synchronizers/openstack/model_policies/model_policy_SlicePrivilege.py
similarity index 100%
rename from xos/model_policies/model_policy_SlicePrivilege.py
rename to xos/synchronizers/openstack/model_policies/model_policy_SlicePrivilege.py
diff --git a/xos/model_policies/model_policy_Sliver.py b/xos/synchronizers/openstack/model_policies/model_policy_Sliver.py
similarity index 100%
rename from xos/model_policies/model_policy_Sliver.py
rename to xos/synchronizers/openstack/model_policies/model_policy_Sliver.py
diff --git a/xos/model_policies/model_policy_User.py b/xos/synchronizers/openstack/model_policies/model_policy_User.py
similarity index 100%
rename from xos/model_policies/model_policy_User.py
rename to xos/synchronizers/openstack/model_policies/model_policy_User.py
diff --git a/xos/openstack_observer/openstacksyncstep.py b/xos/synchronizers/openstack/openstacksyncstep.py
similarity index 100%
copy from xos/openstack_observer/openstacksyncstep.py
copy to xos/synchronizers/openstack/openstacksyncstep.py
diff --git a/xos/openstack_observer/run_ansible b/xos/synchronizers/openstack/run_ansible
similarity index 100%
copy from xos/openstack_observer/run_ansible
copy to xos/synchronizers/openstack/run_ansible
diff --git a/xos/openstack_observer/run_ansible_verbose b/xos/synchronizers/openstack/run_ansible_verbose
similarity index 100%
copy from xos/openstack_observer/run_ansible_verbose
copy to xos/synchronizers/openstack/run_ansible_verbose
diff --git a/xos/openstack_observer/steps/__init__.py b/xos/synchronizers/openstack/steps/__init__.py
similarity index 100%
copy from xos/openstack_observer/steps/__init__.py
copy to xos/synchronizers/openstack/steps/__init__.py
diff --git a/xos/openstack_observer/steps/delete_slivers.yaml b/xos/synchronizers/openstack/steps/delete_slivers.yaml
similarity index 100%
copy from xos/openstack_observer/steps/delete_slivers.yaml
copy to xos/synchronizers/openstack/steps/delete_slivers.yaml
diff --git a/xos/openstack_observer/steps/purge_disabled_users.py b/xos/synchronizers/openstack/steps/purge_disabled_users.py
similarity index 85%
copy from xos/openstack_observer/steps/purge_disabled_users.py
copy to xos/synchronizers/openstack/steps/purge_disabled_users.py
index b5168e3..0973b8c 100644
--- a/xos/openstack_observer/steps/purge_disabled_users.py
+++ b/xos/synchronizers/openstack/steps/purge_disabled_users.py
@@ -3,9 +3,9 @@
import datetime
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.user import User
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
class SyncRoles(OpenStackSyncStep):
provides=[User]
diff --git a/xos/openstack_observer/steps/sliver.yaml b/xos/synchronizers/openstack/steps/sliver.yaml
similarity index 100%
copy from xos/openstack_observer/steps/sliver.yaml
copy to xos/synchronizers/openstack/steps/sliver.yaml
diff --git a/xos/openstack_observer/steps/sync_container.py b/xos/synchronizers/openstack/steps/sync_container.py
similarity index 95%
copy from xos/openstack_observer/steps/sync_container.py
copy to xos/synchronizers/openstack/steps/sync_container.py
index adb81c9..d647aef 100644
--- a/xos/openstack_observer/steps/sync_container.py
+++ b/xos/synchronizers/openstack/steps/sync_container.py
@@ -6,12 +6,12 @@
import time
from django.db.models import F, Q
from xos.config import Config
-from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
-from observer.syncstep import SyncStep, DeferredException
-from observer.ansible import run_template_ssh
+from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.base.syncstep import SyncStep, DeferredException
+from synchronizers.base.ansible import run_template_ssh
from core.models import Service, Slice, Instance
from services.onos.models import ONOSService, ONOSApp
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/openstack_observer/steps/sync_container.yaml b/xos/synchronizers/openstack/steps/sync_container.yaml
similarity index 100%
copy from xos/openstack_observer/steps/sync_container.yaml
copy to xos/synchronizers/openstack/steps/sync_container.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_images.py b/xos/synchronizers/openstack/steps/sync_controller_images.py
similarity index 88%
copy from xos/openstack_observer/steps/sync_controller_images.py
copy to xos/synchronizers/openstack/steps/sync_controller_images.py
index 551d9ac..c1e5136 100644
--- a/xos/openstack_observer/steps/sync_controller_images.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_images.py
@@ -3,12 +3,12 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models import Controller
from core.models import Image, ControllerImages
-from util.logger import observer_logger as logger
-from observer.ansible import *
+from xos.logger import observer_logger as logger
+from synchronizers.base.ansible import *
import json
class SyncControllerImages(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_images.yaml b/xos/synchronizers/openstack/steps/sync_controller_images.yaml
similarity index 100%
copy from xos/openstack_observer/steps/sync_controller_images.yaml
copy to xos/synchronizers/openstack/steps/sync_controller_images.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_networks.py b/xos/synchronizers/openstack/steps/sync_controller_networks.py
similarity index 96%
copy from xos/openstack_observer/steps/sync_controller_networks.py
copy to xos/synchronizers/openstack/steps/sync_controller_networks.py
index ad1604b..990cb87 100644
--- a/xos/openstack_observer/steps/sync_controller_networks.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_networks.py
@@ -4,13 +4,13 @@
from netaddr import IPAddress, IPNetwork
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models.network import *
from core.models.slice import *
from core.models.instance import Instance
-from util.logger import observer_logger as logger
-from observer.ansible import *
+from xos.logger import observer_logger as logger
+from synchronizers.base.ansible import *
from openstack.driver import OpenStackDriver
from xos.config import Config
import json
diff --git a/xos/openstack_observer/steps/sync_controller_networks.yaml b/xos/synchronizers/openstack/steps/sync_controller_networks.yaml
similarity index 100%
copy from xos/openstack_observer/steps/sync_controller_networks.yaml
copy to xos/synchronizers/openstack/steps/sync_controller_networks.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_site_privileges.py b/xos/synchronizers/openstack/steps/sync_controller_site_privileges.py
similarity index 95%
copy from xos/openstack_observer/steps/sync_controller_site_privileges.py
copy to xos/synchronizers/openstack/steps/sync_controller_site_privileges.py
index d257536..59919fe 100644
--- a/xos/openstack_observer/steps/sync_controller_site_privileges.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_site_privileges.py
@@ -3,13 +3,13 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models.site import Controller, SitePrivilege
from core.models.user import User
from core.models.controlleruser import ControllerUser, ControllerSitePrivilege
-from util.logger import observer_logger as logger
-from observer.ansible import *
+from xos.logger import observer_logger as logger
+from synchronizers.base.ansible import *
import json
class SyncControllerSitePrivileges(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_sites.py b/xos/synchronizers/openstack/steps/sync_controller_sites.py
similarity index 92%
copy from xos/openstack_observer/steps/sync_controller_sites.py
copy to xos/synchronizers/openstack/steps/sync_controller_sites.py
index 614d435..1b3c2ba 100644
--- a/xos/openstack_observer/steps/sync_controller_sites.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_sites.py
@@ -2,11 +2,11 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from openstack_observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.openstack.openstacksyncstep import OpenStackSyncStep
from core.models.site import *
-from observer.syncstep import *
-from observer.ansible import *
-from util.logger import observer_logger as logger
+from synchronizers.base.syncstep import *
+from synchronizers.base.ansible import *
+from xos.logger import observer_logger as logger
import json
class SyncControllerSites(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_sites.yaml b/xos/synchronizers/openstack/steps/sync_controller_sites.yaml
similarity index 100%
copy from xos/openstack_observer/steps/sync_controller_sites.yaml
copy to xos/synchronizers/openstack/steps/sync_controller_sites.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_slice_privileges.py b/xos/synchronizers/openstack/steps/sync_controller_slice_privileges.py
similarity index 94%
copy from xos/openstack_observer/steps/sync_controller_slice_privileges.py
copy to xos/synchronizers/openstack/steps/sync_controller_slice_privileges.py
index 948ea57..b78e4a0 100644
--- a/xos/openstack_observer/steps/sync_controller_slice_privileges.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_slice_privileges.py
@@ -3,13 +3,13 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models.slice import Controller, SlicePrivilege
from core.models.user import User
from core.models.controlleruser import ControllerUser, ControllerSlicePrivilege
-from observer.ansible import *
-from util.logger import observer_logger as logger
+from synchronizers.base.ansible import *
+from xos.logger import observer_logger as logger
import json
class SyncControllerSlicePrivileges(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_slices.py b/xos/synchronizers/openstack/steps/sync_controller_slices.py
similarity index 94%
copy from xos/openstack_observer/steps/sync_controller_slices.py
copy to xos/synchronizers/openstack/steps/sync_controller_slices.py
index 9904aef..97d8c29 100644
--- a/xos/openstack_observer/steps/sync_controller_slices.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_slices.py
@@ -4,12 +4,12 @@
from netaddr import IPAddress, IPNetwork
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models import *
-from observer.ansible import *
+from synchronizers.base.ansible import *
from openstack.driver import OpenStackDriver
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
import json
class SyncControllerSlices(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_slices.yaml b/xos/synchronizers/openstack/steps/sync_controller_slices.yaml
similarity index 100%
copy from xos/openstack_observer/steps/sync_controller_slices.yaml
copy to xos/synchronizers/openstack/steps/sync_controller_slices.yaml
diff --git a/xos/openstack_observer/steps/sync_controller_users.py b/xos/synchronizers/openstack/steps/sync_controller_users.py
similarity index 93%
copy from xos/openstack_observer/steps/sync_controller_users.py
copy to xos/synchronizers/openstack/steps/sync_controller_users.py
index 4062453..9af48e5 100644
--- a/xos/openstack_observer/steps/sync_controller_users.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_users.py
@@ -3,13 +3,13 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models.site import Controller, SiteDeployment, SiteDeployment
from core.models.user import User
from core.models.controlleruser import ControllerUser
-from observer.ansible import *
-from util.logger import observer_logger as logger
+from synchronizers.base.ansible import *
+from xos.logger import observer_logger as logger
import json
class SyncControllerUsers(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_controller_users.yaml b/xos/synchronizers/openstack/steps/sync_controller_users.yaml
similarity index 100%
copy from xos/openstack_observer/steps/sync_controller_users.yaml
copy to xos/synchronizers/openstack/steps/sync_controller_users.yaml
diff --git a/xos/openstack_observer/steps/sync_images.py b/xos/synchronizers/openstack/steps/sync_images.py
similarity index 93%
copy from xos/openstack_observer/steps/sync_images.py
copy to xos/synchronizers/openstack/steps/sync_images.py
index d126834..8049ac1 100644
--- a/xos/openstack_observer/steps/sync_images.py
+++ b/xos/synchronizers/openstack/steps/sync_images.py
@@ -2,9 +2,9 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.image import Image
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
class SyncImages(OpenStackSyncStep):
provides=[Image]
diff --git a/xos/openstack_observer/steps/sync_instances.py b/xos/synchronizers/openstack/steps/sync_instances.py
similarity index 96%
copy from xos/openstack_observer/steps/sync_instances.py
copy to xos/synchronizers/openstack/steps/sync_instances.py
index 815c83e..335ca4a 100644
--- a/xos/openstack_observer/steps/sync_instances.py
+++ b/xos/synchronizers/openstack/steps/sync_instances.py
@@ -4,13 +4,13 @@
from django.db.models import F, Q
from xos.config import Config
from xos.settings import RESTAPI_HOSTNAME, RESTAPI_PORT
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.instance import Instance
from core.models.slice import Slice, SlicePrivilege, ControllerSlice
from core.models.network import Network, NetworkSlice, ControllerNetwork
-from observer.ansible import *
-from observer.syncstep import *
-from util.logger import observer_logger as logger
+from synchronizers.base.ansible import *
+from synchronizers.base.syncstep import *
+from xos.logger import observer_logger as logger
def escape(s):
s = s.replace('\n',r'\n').replace('"',r'\"')
diff --git a/xos/openstack_observer/steps/sync_instances.yaml b/xos/synchronizers/openstack/steps/sync_instances.yaml
similarity index 100%
copy from xos/openstack_observer/steps/sync_instances.yaml
copy to xos/synchronizers/openstack/steps/sync_instances.yaml
diff --git a/xos/openstack_observer/steps/sync_object.py b/xos/synchronizers/openstack/steps/sync_object.py
similarity index 69%
copy from xos/openstack_observer/steps/sync_object.py
copy to xos/synchronizers/openstack/steps/sync_object.py
index a289c95..a6a939f 100644
--- a/xos/openstack_observer/steps/sync_object.py
+++ b/xos/synchronizers/openstack/steps/sync_object.py
@@ -3,12 +3,12 @@
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from observer.syncstep import *
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.syncstep import *
from core.models import *
-from observer.ansible import *
+from synchronizers.base.ansible import *
from openstack.driver import OpenStackDriver
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
import json
class SyncObject(OpenStackSyncStep):
diff --git a/xos/openstack_observer/steps/sync_ports.py b/xos/synchronizers/openstack/steps/sync_ports.py
similarity index 98%
copy from xos/openstack_observer/steps/sync_ports.py
copy to xos/synchronizers/openstack/steps/sync_ports.py
index bfdde8c..21376e5 100644
--- a/xos/openstack_observer/steps/sync_ports.py
+++ b/xos/synchronizers/openstack/steps/sync_ports.py
@@ -2,10 +2,10 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models import Controller
from core.models.network import *
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
class SyncPorts(OpenStackSyncStep):
requested_interval = 0 # 3600
diff --git a/xos/openstack_observer/steps/sync_roles.py b/xos/synchronizers/openstack/steps/sync_roles.py
similarity index 84%
copy from xos/openstack_observer/steps/sync_roles.py
copy to xos/synchronizers/openstack/steps/sync_roles.py
index c4bbe3f..e859316 100644
--- a/xos/openstack_observer/steps/sync_roles.py
+++ b/xos/synchronizers/openstack/steps/sync_roles.py
@@ -2,11 +2,11 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
+from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.role import Role
from core.models.site import SiteRole, Controller, ControllerRole
from core.models.slice import SliceRole
-from util.logger import observer_logger as logger
+from xos.logger import observer_logger as logger
class SyncRoles(OpenStackSyncStep):
provides=[Role]
diff --git a/xos/openstack_observer/steps/teardown_container.yaml b/xos/synchronizers/openstack/steps/teardown_container.yaml
similarity index 100%
copy from xos/openstack_observer/steps/teardown_container.yaml
copy to xos/synchronizers/openstack/steps/teardown_container.yaml
diff --git a/xos/openstack_observer/syncstep.py b/xos/synchronizers/openstack/syncstep.py
similarity index 98%
copy from xos/openstack_observer/syncstep.py
copy to xos/synchronizers/openstack/syncstep.py
index 0a25c58..bdab8f3 100644
--- a/xos/openstack_observer/syncstep.py
+++ b/xos/synchronizers/openstack/syncstep.py
@@ -2,13 +2,13 @@
import base64
from datetime import datetime
from xos.config import Config
-from util.logger import Logger, logging
-from observer.steps import *
+from xos.logger import Logger, logging
+from synchronizers.base.steps import *
from django.db.models import F, Q
from core.models import *
from django.db import reset_queries
-from observer.ansible import *
-from dependency_walker import *
+from synchronizers.base.ansible import *
+from generate.dependency_walker import *
from time import time
import json
diff --git a/xos/openstack_observer/templates/container.conf.j2 b/xos/synchronizers/openstack/templates/container.conf.j2
similarity index 100%
copy from xos/openstack_observer/templates/container.conf.j2
copy to xos/synchronizers/openstack/templates/container.conf.j2
diff --git a/xos/openstack_observer/templates/container.service.j2 b/xos/synchronizers/openstack/templates/container.service.j2
similarity index 100%
copy from xos/openstack_observer/templates/container.service.j2
copy to xos/synchronizers/openstack/templates/container.service.j2
diff --git a/xos/openstack_observer/templates/start-container.sh.j2 b/xos/synchronizers/openstack/templates/start-container.sh.j2
similarity index 100%
copy from xos/openstack_observer/templates/start-container.sh.j2
copy to xos/synchronizers/openstack/templates/start-container.sh.j2
diff --git a/xos/openstack_observer/templates/stop-container.sh.j2 b/xos/synchronizers/openstack/templates/stop-container.sh.j2
similarity index 100%
copy from xos/openstack_observer/templates/stop-container.sh.j2
copy to xos/synchronizers/openstack/templates/stop-container.sh.j2
diff --git a/xos/openstack_observer/toposort.py b/xos/synchronizers/openstack/toposort.py
similarity index 100%
copy from xos/openstack_observer/toposort.py
copy to xos/synchronizers/openstack/toposort.py
diff --git a/xos/xos-observer.py b/xos/synchronizers/openstack/xos-synchronizer.py
similarity index 94%
rename from xos/xos-observer.py
rename to xos/synchronizers/openstack/xos-synchronizer.py
index 1b85518..3fffd33 100644
--- a/xos/xos-observer.py
+++ b/xos/synchronizers/openstack/xos-synchronizer.py
@@ -1,11 +1,15 @@
#!/usr/bin/env python
import os
import argparse
+import sys
+
+sys.path.append('/opt/xos')
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-from observer.backend import Backend
+from synchronizers.base.backend import Backend
from xos.config import Config, DEFAULT_CONFIG_FN
from core.models import Instance
-from util.logger import Logger, logging, logger
+from xos.logger import Logger, logging, logger
from django.db import ProgrammingError
import time
diff --git a/xos/observers/requestrouter/configurationPush.py b/xos/synchronizers/requestrouter/configurationPush.py
similarity index 100%
rename from xos/observers/requestrouter/configurationPush.py
rename to xos/synchronizers/requestrouter/configurationPush.py
diff --git a/xos/observers/requestrouter/deleters/servicemap_deleter.py b/xos/synchronizers/requestrouter/deleters/servicemap_deleter.py
similarity index 94%
rename from xos/observers/requestrouter/deleters/servicemap_deleter.py
rename to xos/synchronizers/requestrouter/deleters/servicemap_deleter.py
index 5e4b5a4..d2efd64 100644
--- a/xos/observers/requestrouter/deleters/servicemap_deleter.py
+++ b/xos/synchronizers/requestrouter/deleters/servicemap_deleter.py
@@ -2,8 +2,8 @@
import sys
import traceback
from services.requestrouter.models import ServiceMap
-from observer.deleter import Deleter
-from util.logger import Logger, logging
+from synchronizers.base.deleter import Deleter
+from xos.logger import Logger, logging
from xos.config import Config, XOS_DIR
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/requestrouter/model-deps b/xos/synchronizers/requestrouter/model-deps
similarity index 100%
rename from xos/observers/requestrouter/model-deps
rename to xos/synchronizers/requestrouter/model-deps
diff --git a/xos/observers/requestrouter/playbook/roles/delete_demux/handlers/main.yml b/xos/synchronizers/requestrouter/playbook/roles/delete_demux/handlers/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/delete_demux/handlers/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/delete_demux/handlers/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/delete_demux/tasks/main.yml b/xos/synchronizers/requestrouter/playbook/roles/delete_demux/tasks/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/delete_demux/tasks/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/delete_demux/tasks/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/delete_demux/vars/main.yml b/xos/synchronizers/requestrouter/playbook/roles/delete_demux/vars/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/delete_demux/vars/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/delete_demux/vars/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/delete_redir/handlers/main.yml b/xos/synchronizers/requestrouter/playbook/roles/delete_redir/handlers/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/delete_redir/handlers/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/delete_redir/handlers/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/delete_redir/tasks/main.yml b/xos/synchronizers/requestrouter/playbook/roles/delete_redir/tasks/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/delete_redir/tasks/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/delete_redir/tasks/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/delete_redir/vars/main.yml b/xos/synchronizers/requestrouter/playbook/roles/delete_redir/vars/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/delete_redir/vars/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/delete_redir/vars/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/demux/handlers/main.yml b/xos/synchronizers/requestrouter/playbook/roles/demux/handlers/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/demux/handlers/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/demux/handlers/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/demux/tasks/main.yml b/xos/synchronizers/requestrouter/playbook/roles/demux/tasks/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/demux/tasks/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/demux/tasks/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/demux/vars/main.yml b/xos/synchronizers/requestrouter/playbook/roles/demux/vars/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/demux/vars/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/demux/vars/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/redir/handlers/main.yml b/xos/synchronizers/requestrouter/playbook/roles/redir/handlers/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/redir/handlers/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/redir/handlers/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/redir/tasks/main.yml b/xos/synchronizers/requestrouter/playbook/roles/redir/tasks/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/redir/tasks/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/redir/tasks/main.yml
diff --git a/xos/observers/requestrouter/playbook/roles/redir/vars/main.yml b/xos/synchronizers/requestrouter/playbook/roles/redir/vars/main.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/roles/redir/vars/main.yml
rename to xos/synchronizers/requestrouter/playbook/roles/redir/vars/main.yml
diff --git a/xos/observers/requestrouter/playbook/site_demux.yml b/xos/synchronizers/requestrouter/playbook/site_demux.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/site_demux.yml
rename to xos/synchronizers/requestrouter/playbook/site_demux.yml
diff --git a/xos/observers/requestrouter/playbook/site_demux_delete.yml b/xos/synchronizers/requestrouter/playbook/site_demux_delete.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/site_demux_delete.yml
rename to xos/synchronizers/requestrouter/playbook/site_demux_delete.yml
diff --git a/xos/observers/requestrouter/playbook/site_redir.yml b/xos/synchronizers/requestrouter/playbook/site_redir.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/site_redir.yml
rename to xos/synchronizers/requestrouter/playbook/site_redir.yml
diff --git a/xos/observers/requestrouter/playbook/site_redir_delete.yml b/xos/synchronizers/requestrouter/playbook/site_redir_delete.yml
similarity index 100%
rename from xos/observers/requestrouter/playbook/site_redir_delete.yml
rename to xos/synchronizers/requestrouter/playbook/site_redir_delete.yml
diff --git a/xos/observers/requestrouter/rr_observer_config b/xos/synchronizers/requestrouter/rr_observer_config
similarity index 100%
rename from xos/observers/requestrouter/rr_observer_config
rename to xos/synchronizers/requestrouter/rr_observer_config
diff --git a/xos/observers/requestrouter/rrlib.py b/xos/synchronizers/requestrouter/rrlib.py
similarity index 99%
rename from xos/observers/requestrouter/rrlib.py
rename to xos/synchronizers/requestrouter/rrlib.py
index 9faca4a..e2100b0 100644
--- a/xos/observers/requestrouter/rrlib.py
+++ b/xos/synchronizers/requestrouter/rrlib.py
@@ -11,7 +11,7 @@
from xos.config import Config
from core.models import Service
from services.requestrouter.models import RequestRouterService, ServiceMap
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
import rrlib_config
logger = Logger(level=logging.INFO)
diff --git a/xos/observers/requestrouter/rrlib_config.py b/xos/synchronizers/requestrouter/rrlib_config.py
similarity index 100%
rename from xos/observers/requestrouter/rrlib_config.py
rename to xos/synchronizers/requestrouter/rrlib_config.py
diff --git a/xos/observers/requestrouter/steps/sync_requestrouterservices.py b/xos/synchronizers/requestrouter/steps/sync_requestrouterservices.py
similarity index 92%
rename from xos/observers/requestrouter/steps/sync_requestrouterservices.py
rename to xos/synchronizers/requestrouter/steps/sync_requestrouterservices.py
index ccf9291..c9648ff 100644
--- a/xos/observers/requestrouter/steps/sync_requestrouterservices.py
+++ b/xos/synchronizers/requestrouter/steps/sync_requestrouterservices.py
@@ -4,10 +4,10 @@
import traceback
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.requestrouter.models import RequestRouterService
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
parentdir = os.path.join(os.path.dirname(__file__),"..")
sys.path.insert(0,parentdir)
diff --git a/xos/observers/requestrouter/steps/sync_servicemap.py b/xos/synchronizers/requestrouter/steps/sync_servicemap.py
similarity index 95%
rename from xos/observers/requestrouter/steps/sync_servicemap.py
rename to xos/synchronizers/requestrouter/steps/sync_servicemap.py
index 094e5f1..bef7e42 100644
--- a/xos/observers/requestrouter/steps/sync_servicemap.py
+++ b/xos/synchronizers/requestrouter/steps/sync_servicemap.py
@@ -6,10 +6,10 @@
import traceback
from django.db.models import F, Q
from xos.config import Config, XOS_DIR
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.requestrouter.models import ServiceMap
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
parentdir = os.path.join(os.path.dirname(__file__),"..")
sys.path.insert(0,parentdir)
diff --git a/xos/observers/syndicate/__init__.py b/xos/synchronizers/syndicate/__init__.py
similarity index 100%
rename from xos/observers/syndicate/__init__.py
rename to xos/synchronizers/syndicate/__init__.py
diff --git a/xos/observers/syndicate/model-deps b/xos/synchronizers/syndicate/model-deps
similarity index 100%
rename from xos/observers/syndicate/model-deps
rename to xos/synchronizers/syndicate/model-deps
diff --git a/xos/observers/syndicate/requirements.py b/xos/synchronizers/syndicate/requirements.py
similarity index 100%
rename from xos/observers/syndicate/requirements.py
rename to xos/synchronizers/syndicate/requirements.py
diff --git a/xos/observers/syndicate/run.sh b/xos/synchronizers/syndicate/run.sh
similarity index 100%
rename from xos/observers/syndicate/run.sh
rename to xos/synchronizers/syndicate/run.sh
diff --git a/xos/observers/syndicate/start.sh b/xos/synchronizers/syndicate/start.sh
similarity index 100%
rename from xos/observers/syndicate/start.sh
rename to xos/synchronizers/syndicate/start.sh
diff --git a/xos/observers/syndicate/steps/sync_volume.py b/xos/synchronizers/syndicate/steps/sync_volume.py
similarity index 98%
rename from xos/observers/syndicate/steps/sync_volume.py
rename to xos/synchronizers/syndicate/steps/sync_volume.py
index c973e8a..e6dc90b 100644
--- a/xos/observers/syndicate/steps/sync_volume.py
+++ b/xos/synchronizers/syndicate/steps/sync_volume.py
@@ -17,7 +17,7 @@
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from services.syndicate_storage.models import Volume
diff --git a/xos/observers/syndicate/steps/sync_volumeaccessright.py b/xos/synchronizers/syndicate/steps/sync_volumeaccessright.py
similarity index 98%
rename from xos/observers/syndicate/steps/sync_volumeaccessright.py
rename to xos/synchronizers/syndicate/steps/sync_volumeaccessright.py
index c135237..2889502 100644
--- a/xos/observers/syndicate/steps/sync_volumeaccessright.py
+++ b/xos/synchronizers/syndicate/steps/sync_volumeaccessright.py
@@ -16,7 +16,7 @@
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
import logging
diff --git a/xos/observers/syndicate/steps/sync_volumeslice.py b/xos/synchronizers/syndicate/steps/sync_volumeslice.py
similarity index 98%
rename from xos/observers/syndicate/steps/sync_volumeslice.py
rename to xos/synchronizers/syndicate/steps/sync_volumeslice.py
index e88d4c1..1be61b9 100644
--- a/xos/observers/syndicate/steps/sync_volumeslice.py
+++ b/xos/synchronizers/syndicate/steps/sync_volumeslice.py
@@ -16,7 +16,7 @@
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service, Slice
import logging
diff --git a/xos/observers/syndicate/stop.sh b/xos/synchronizers/syndicate/stop.sh
similarity index 100%
rename from xos/observers/syndicate/stop.sh
rename to xos/synchronizers/syndicate/stop.sh
diff --git a/xos/observers/syndicate/syndicate-backend.py b/xos/synchronizers/syndicate/syndicate-backend.py
similarity index 77%
rename from xos/observers/syndicate/syndicate-backend.py
rename to xos/synchronizers/syndicate/syndicate-backend.py
index 32670d9..9b53c77 100644
--- a/xos/observers/syndicate/syndicate-backend.py
+++ b/xos/synchronizers/syndicate/syndicate-backend.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-from observer.backend import Backend
+from synchronizers.base.backend import Backend
if __name__ == '__main__':
diff --git a/xos/observers/syndicate/syndicate_observer_config b/xos/synchronizers/syndicate/syndicate_observer_config
similarity index 100%
rename from xos/observers/syndicate/syndicate_observer_config
rename to xos/synchronizers/syndicate/syndicate_observer_config
diff --git a/xos/observers/syndicate/syndicatelib.py b/xos/synchronizers/syndicate/syndicatelib.py
similarity index 100%
rename from xos/observers/syndicate/syndicatelib.py
rename to xos/synchronizers/syndicate/syndicatelib.py
diff --git a/xos/observers/syndicate/syndicatelib_config/__init__.py b/xos/synchronizers/syndicate/syndicatelib_config/__init__.py
similarity index 100%
rename from xos/observers/syndicate/syndicatelib_config/__init__.py
rename to xos/synchronizers/syndicate/syndicatelib_config/__init__.py
diff --git a/xos/observers/syndicate/syndicatelib_config/config-jude.py b/xos/synchronizers/syndicate/syndicatelib_config/config-jude.py
similarity index 100%
rename from xos/observers/syndicate/syndicatelib_config/config-jude.py
rename to xos/synchronizers/syndicate/syndicatelib_config/config-jude.py
diff --git a/xos/observers/syndicate/syndicatelib_config/config-opencloud.py b/xos/synchronizers/syndicate/syndicatelib_config/config-opencloud.py
similarity index 100%
rename from xos/observers/syndicate/syndicatelib_config/config-opencloud.py
rename to xos/synchronizers/syndicate/syndicatelib_config/config-opencloud.py
diff --git a/xos/observers/syndicate/syndicatelib_config/config.py b/xos/synchronizers/syndicate/syndicatelib_config/config.py
similarity index 100%
rename from xos/observers/syndicate/syndicatelib_config/config.py
rename to xos/synchronizers/syndicate/syndicatelib_config/config.py
diff --git a/xos/observers/syndicate/syndicatelib_config/pollserver.pem b/xos/synchronizers/syndicate/syndicatelib_config/pollserver.pem
similarity index 100%
rename from xos/observers/syndicate/syndicatelib_config/pollserver.pem
rename to xos/synchronizers/syndicate/syndicatelib_config/pollserver.pem
diff --git a/xos/observers/vbng/model-deps b/xos/synchronizers/vbng/model-deps
similarity index 100%
rename from xos/observers/vbng/model-deps
rename to xos/synchronizers/vbng/model-deps
diff --git a/xos/observers/vbng/run.sh b/xos/synchronizers/vbng/run.sh
similarity index 100%
rename from xos/observers/vbng/run.sh
rename to xos/synchronizers/vbng/run.sh
diff --git a/xos/observers/vbng/start.sh b/xos/synchronizers/vbng/start.sh
similarity index 100%
rename from xos/observers/vbng/start.sh
rename to xos/synchronizers/vbng/start.sh
diff --git a/xos/observers/vbng/steps/sync_vbngtenant.py b/xos/synchronizers/vbng/steps/sync_vbngtenant.py
similarity index 97%
rename from xos/observers/vbng/steps/sync_vbngtenant.py
rename to xos/synchronizers/vbng/steps/sync_vbngtenant.py
index de404ff..94875f4 100644
--- a/xos/observers/vbng/steps/sync_vbngtenant.py
+++ b/xos/synchronizers/vbng/steps/sync_vbngtenant.py
@@ -5,12 +5,12 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
-from observer.ansible import run_template_ssh
+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.hpc.models import HpcService, CDNPrefix
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# VBNG_API = "http://10.0.3.136:8181/onos/virtualbng/privateip/"
diff --git a/xos/observers/vbng/stop.sh b/xos/synchronizers/vbng/stop.sh
similarity index 100%
rename from xos/observers/vbng/stop.sh
rename to xos/synchronizers/vbng/stop.sh
diff --git a/xos/observers/vbng/supervisor/vbng-observer.conf b/xos/synchronizers/vbng/supervisor/vbng-observer.conf
similarity index 100%
rename from xos/observers/vbng/supervisor/vbng-observer.conf
rename to xos/synchronizers/vbng/supervisor/vbng-observer.conf
diff --git a/xos/observers/vbng/vbng-observer.py b/xos/synchronizers/vbng/vbng-observer.py
similarity index 100%
rename from xos/observers/vbng/vbng-observer.py
rename to xos/synchronizers/vbng/vbng-observer.py
diff --git a/xos/observers/vbng/vbng_observer_config b/xos/synchronizers/vbng/vbng_observer_config
similarity index 100%
rename from xos/observers/vbng/vbng_observer_config
rename to xos/synchronizers/vbng/vbng_observer_config
diff --git a/xos/observers/vcpe/broadbandshield.py b/xos/synchronizers/vcpe/broadbandshield.py
similarity index 100%
rename from xos/observers/vcpe/broadbandshield.py
rename to xos/synchronizers/vcpe/broadbandshield.py
diff --git a/xos/observers/vcpe/files/docker.list b/xos/synchronizers/vcpe/files/docker.list
similarity index 100%
rename from xos/observers/vcpe/files/docker.list
rename to xos/synchronizers/vcpe/files/docker.list
diff --git a/xos/observers/vcpe/files/etc/rc.local b/xos/synchronizers/vcpe/files/etc/rc.local
similarity index 100%
rename from xos/observers/vcpe/files/etc/rc.local
rename to xos/synchronizers/vcpe/files/etc/rc.local
diff --git a/xos/observers/vcpe/files/etc/ufw/after.init b/xos/synchronizers/vcpe/files/etc/ufw/after.init
similarity index 100%
rename from xos/observers/vcpe/files/etc/ufw/after.init
rename to xos/synchronizers/vcpe/files/etc/ufw/after.init
diff --git a/xos/observers/vcpe/files/etc/ufw/after.rules b/xos/synchronizers/vcpe/files/etc/ufw/after.rules
similarity index 100%
rename from xos/observers/vcpe/files/etc/ufw/after.rules
rename to xos/synchronizers/vcpe/files/etc/ufw/after.rules
diff --git a/xos/observers/vcpe/files/etc/ufw/after6.rules b/xos/synchronizers/vcpe/files/etc/ufw/after6.rules
similarity index 100%
rename from xos/observers/vcpe/files/etc/ufw/after6.rules
rename to xos/synchronizers/vcpe/files/etc/ufw/after6.rules
diff --git a/xos/observers/vcpe/files/etc/ufw/applications.d/openssh-server b/xos/synchronizers/vcpe/files/etc/ufw/applications.d/openssh-server
similarity index 100%
rename from xos/observers/vcpe/files/etc/ufw/applications.d/openssh-server
rename to xos/synchronizers/vcpe/files/etc/ufw/applications.d/openssh-server
diff --git a/xos/observers/vcpe/files/etc/ufw/before.init b/xos/synchronizers/vcpe/files/etc/ufw/before.init
similarity index 100%
rename from xos/observers/vcpe/files/etc/ufw/before.init
rename to xos/synchronizers/vcpe/files/etc/ufw/before.init
diff --git a/xos/observers/vcpe/files/etc/ufw/before6.rules b/xos/synchronizers/vcpe/files/etc/ufw/before6.rules
similarity index 100%
rename from xos/observers/vcpe/files/etc/ufw/before6.rules
rename to xos/synchronizers/vcpe/files/etc/ufw/before6.rules
diff --git a/xos/observers/vcpe/files/etc/ufw/sysctl.conf b/xos/synchronizers/vcpe/files/etc/ufw/sysctl.conf
similarity index 100%
rename from xos/observers/vcpe/files/etc/ufw/sysctl.conf
rename to xos/synchronizers/vcpe/files/etc/ufw/sysctl.conf
diff --git a/xos/observers/vcpe/files/etc/ufw/ufw.conf b/xos/synchronizers/vcpe/files/etc/ufw/ufw.conf
similarity index 100%
rename from xos/observers/vcpe/files/etc/ufw/ufw.conf
rename to xos/synchronizers/vcpe/files/etc/ufw/ufw.conf
diff --git a/xos/observers/vcpe/files/vcpe.conf b/xos/synchronizers/vcpe/files/vcpe.conf
similarity index 100%
rename from xos/observers/vcpe/files/vcpe.conf
rename to xos/synchronizers/vcpe/files/vcpe.conf
diff --git a/xos/observers/vcpe/files/vcpe.dnsmasq b/xos/synchronizers/vcpe/files/vcpe.dnsmasq
similarity index 100%
rename from xos/observers/vcpe/files/vcpe.dnsmasq
rename to xos/synchronizers/vcpe/files/vcpe.dnsmasq
diff --git a/xos/observers/vcpe/files/vm-resolv.conf b/xos/synchronizers/vcpe/files/vm-resolv.conf
similarity index 100%
rename from xos/observers/vcpe/files/vm-resolv.conf
rename to xos/synchronizers/vcpe/files/vm-resolv.conf
diff --git a/xos/observers/vcpe/model-deps b/xos/synchronizers/vcpe/model-deps
similarity index 100%
rename from xos/observers/vcpe/model-deps
rename to xos/synchronizers/vcpe/model-deps
diff --git a/xos/observers/vcpe/observer_ansible_test.py b/xos/synchronizers/vcpe/observer_ansible_test.py
similarity index 98%
rename from xos/observers/vcpe/observer_ansible_test.py
rename to xos/synchronizers/vcpe/observer_ansible_test.py
index 77715af..b28da63 100644
--- a/xos/observers/vcpe/observer_ansible_test.py
+++ b/xos/synchronizers/vcpe/observer_ansible_test.py
@@ -3,36 +3,36 @@
import sys
sys.path.append("../..")
-import observer.ansible
+import synchronizers.base.ansible
print sys.argv
private_key="""-----BEGIN RSA PRIVATE KEY-----
-MIIEpQIBAAKCAQEAtJiuarud5S4Y2quDeWyaS0UCQGQtfuSzzNhplFwujYnJGL65
-e14REtv+UuHGymyr/SfkTrBd8vH5NI2UZ/4sZW13ieI/1d97OeVe2+ct0Y4BaFEI
-3Hja6DIpsY3Q2cBQsWUwcQzbMIF9jIq8SzwR1zk8UtZi09fNxqjCchRPlBvbiLKX
-g0/yirN237WbaKzK++8EPy3nuv83216MXHFFSjuxfICe/RhjaqMzVp7isSbv1suU
-geyvNNzU71c/K13gTggdcIXeRQBiJYio2Sn3h2nsV6AFqFH4fjERxWG55Q4e3jeE
-tWM/Dw+hqYKg/25UcmM862a6sUmuDCmM5S3VEQIDAQABAoIBACH88iZoNOki6c6N
-pOq/Q7KSxD+2GtHc3PHacNRZHPHKUqxziJjtNS1lddHHaBBEr4GvdkpQ6v2ECLCZ
-TKrdrSFRnsO2bukjbB+TSWz9byQXI7CsP4yuuhQlDK+7zuiMRyN7tcgw8TeJx0Uh
-/xnxrjHhNbcpXeQcoz+WFzI9HFT1MEGmMS4Lyp/zLB/pmfY9h7V9d+EeRZDi78jq
-Vir6MI6iCTa0T02dvHUFOg+wXLb0nb8V1xKDL+6cAJla7LzwoG8lTnvp5DSYCojI
-5JrILYafeO8RbBV2GWmaE5mkHgeBkFZ+qZQ7K0MjR30Yh6tajB7P3+F/Max8FUgW
-xLHr8AECgYEA2+o0ge3HtZcepEFBKKYnLTwoEpPCfLElWZHzUJYDz259s4JLsfak
-tROANFEdsJUjpmWG52MCL+bgKFFOedDkt4p1jgcIneaHk0jvoU11wG7W3jZZVy1q
-WjQNH5vDU+hg5tm/CREwm7lbUxR9Xuj9K63CNAAGp8KO7h2tOH8woIECgYEA0jrb
-LUg30RxO3+vrq9dUYohrDRisk5zKXuRLfxRA+E+ruvZ7CctG2OpM+658/qZM/w95
-7pOj6zz3//w7tAvH9erY+JOISnzaYKx04sYC1MfbFiFkq5j0gpuYm/MULDYNvFqr
-NU2Buj4dW+ZB+SeficsQOqm5QeNxh1kgiDCs7JECgYEAjSLGCAzeesA9vhTTCI95
-3SIaZbHGw9e8rLtqeHGOiHXU3nvksJYmJsAZK3pTn5xXgNbvuVhlcvCtM7LatntG
-DjUiNMB22z+0CuZoRBE+XP3FkF84/yX6d2Goenyw4wzkA8QDQoJxu789yRgBTgQh
-VwLw/AZ4PvoyWMdbAENApgECgYEAvFikosYP09XTyIPaKaOKY5iqqBoSC1GucSOB
-jAG+T3k5dxB6nQS0nYQUomvqak7drqnT6O33Lrr5ySrW5nCjnmvgJZwvv+Rp1bDM
-K5uRT8caPpJ+Wcp4TUdPi3BVA2MOHVDyEJg3AH/D1+DL/IgGQ/JcwOHsKt61iLhO
-EBXj5zECgYEAk+HuwksUPkSxg/AiJGbapGDK6XGymEUzo2duWlnofRqGcZ3NT3bB
-/kDI1KxQdlpODXSi4/BuTpbQiFOrzcEq5e5ytoMxlCHh3Fl3Jxl+JlgO21vAUvP6
-4SET7Q/6LxmfBlCVRg0dXDwcfJLgbnWxyvprIcz4e0FSFVZTBs/6tFk=
+MIIEpQIBAAKCAQEAtJiuarud5S4Y2quDeWyaS0UCQGQtfuSzzNhplFwujYnJGL65
+e14REtv+UuHGymyr/SfkTrBd8vH5NI2UZ/4sZW13ieI/1d97OeVe2+ct0Y4BaFEI
+3Hja6DIpsY3Q2cBQsWUwcQzbMIF9jIq8SzwR1zk8UtZi09fNxqjCchRPlBvbiLKX
+g0/yirN237WbaKzK++8EPy3nuv83216MXHFFSjuxfICe/RhjaqMzVp7isSbv1suU
+geyvNNzU71c/K13gTggdcIXeRQBiJYio2Sn3h2nsV6AFqFH4fjERxWG55Q4e3jeE
+tWM/Dw+hqYKg/25UcmM862a6sUmuDCmM5S3VEQIDAQABAoIBACH88iZoNOki6c6N
+pOq/Q7KSxD+2GtHc3PHacNRZHPHKUqxziJjtNS1lddHHaBBEr4GvdkpQ6v2ECLCZ
+TKrdrSFRnsO2bukjbB+TSWz9byQXI7CsP4yuuhQlDK+7zuiMRyN7tcgw8TeJx0Uh
+/xnxrjHhNbcpXeQcoz+WFzI9HFT1MEGmMS4Lyp/zLB/pmfY9h7V9d+EeRZDi78jq
+Vir6MI6iCTa0T02dvHUFOg+wXLb0nb8V1xKDL+6cAJla7LzwoG8lTnvp5DSYCojI
+5JrILYafeO8RbBV2GWmaE5mkHgeBkFZ+qZQ7K0MjR30Yh6tajB7P3+F/Max8FUgW
+xLHr8AECgYEA2+o0ge3HtZcepEFBKKYnLTwoEpPCfLElWZHzUJYDz259s4JLsfak
+tROANFEdsJUjpmWG52MCL+bgKFFOedDkt4p1jgcIneaHk0jvoU11wG7W3jZZVy1q
+WjQNH5vDU+hg5tm/CREwm7lbUxR9Xuj9K63CNAAGp8KO7h2tOH8woIECgYEA0jrb
+LUg30RxO3+vrq9dUYohrDRisk5zKXuRLfxRA+E+ruvZ7CctG2OpM+658/qZM/w95
+7pOj6zz3//w7tAvH9erY+JOISnzaYKx04sYC1MfbFiFkq5j0gpuYm/MULDYNvFqr
+NU2Buj4dW+ZB+SeficsQOqm5QeNxh1kgiDCs7JECgYEAjSLGCAzeesA9vhTTCI95
+3SIaZbHGw9e8rLtqeHGOiHXU3nvksJYmJsAZK3pTn5xXgNbvuVhlcvCtM7LatntG
+DjUiNMB22z+0CuZoRBE+XP3FkF84/yX6d2Goenyw4wzkA8QDQoJxu789yRgBTgQh
+VwLw/AZ4PvoyWMdbAENApgECgYEAvFikosYP09XTyIPaKaOKY5iqqBoSC1GucSOB
+jAG+T3k5dxB6nQS0nYQUomvqak7drqnT6O33Lrr5ySrW5nCjnmvgJZwvv+Rp1bDM
+K5uRT8caPpJ+Wcp4TUdPi3BVA2MOHVDyEJg3AH/D1+DL/IgGQ/JcwOHsKt61iLhO
+EBXj5zECgYEAk+HuwksUPkSxg/AiJGbapGDK6XGymEUzo2duWlnofRqGcZ3NT3bB
+/kDI1KxQdlpODXSi4/BuTpbQiFOrzcEq5e5ytoMxlCHh3Fl3Jxl+JlgO21vAUvP6
+4SET7Q/6LxmfBlCVRg0dXDwcfJLgbnWxyvprIcz4e0FSFVZTBs/6tFk=
-----END RSA PRIVATE KEY-----
"""
diff --git a/xos/observers/vcpe/run.sh b/xos/synchronizers/vcpe/run.sh
similarity index 100%
rename from xos/observers/vcpe/run.sh
rename to xos/synchronizers/vcpe/run.sh
diff --git a/xos/observers/vcpe/start-bbs.sh b/xos/synchronizers/vcpe/start-bbs.sh
similarity index 100%
rename from xos/observers/vcpe/start-bbs.sh
rename to xos/synchronizers/vcpe/start-bbs.sh
diff --git a/xos/observers/vcpe/start.sh b/xos/synchronizers/vcpe/start.sh
similarity index 100%
rename from xos/observers/vcpe/start.sh
rename to xos/synchronizers/vcpe/start.sh
diff --git a/xos/observers/vcpe/steps/ansible_test/README b/xos/synchronizers/vcpe/steps/ansible_test/README
similarity index 100%
rename from xos/observers/vcpe/steps/ansible_test/README
rename to xos/synchronizers/vcpe/steps/ansible_test/README
diff --git a/xos/observers/vcpe/steps/ansible_test/inventory.txt b/xos/synchronizers/vcpe/steps/ansible_test/inventory.txt
similarity index 100%
rename from xos/observers/vcpe/steps/ansible_test/inventory.txt
rename to xos/synchronizers/vcpe/steps/ansible_test/inventory.txt
diff --git a/xos/observers/vcpe/steps/ansible_test/test.sh b/xos/synchronizers/vcpe/steps/ansible_test/test.sh
similarity index 100%
rename from xos/observers/vcpe/steps/ansible_test/test.sh
rename to xos/synchronizers/vcpe/steps/ansible_test/test.sh
diff --git a/xos/observers/vcpe/steps/ansible_test/test.yaml b/xos/synchronizers/vcpe/steps/ansible_test/test.yaml
similarity index 100%
rename from xos/observers/vcpe/steps/ansible_test/test.yaml
rename to xos/synchronizers/vcpe/steps/ansible_test/test.yaml
diff --git a/xos/observers/vcpe/steps/ansible_test/xos.py b/xos/synchronizers/vcpe/steps/ansible_test/xos.py
similarity index 100%
rename from xos/observers/vcpe/steps/ansible_test/xos.py
rename to xos/synchronizers/vcpe/steps/ansible_test/xos.py
diff --git a/xos/observers/vcpe/steps/sync_vcpetenant.py b/xos/synchronizers/vcpe/steps/sync_vcpetenant.py
similarity index 97%
rename from xos/observers/vcpe/steps/sync_vcpetenant.py
rename to xos/synchronizers/vcpe/steps/sync_vcpetenant.py
index 477c250..691671a 100644
--- a/xos/observers/vcpe/steps/sync_vcpetenant.py
+++ b/xos/synchronizers/vcpe/steps/sync_vcpetenant.py
@@ -6,13 +6,13 @@
import time
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
-from observer.ansible import run_template_ssh
-from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+from synchronizers.base.syncstep import SyncStep
+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.hpc.models import HpcService, CDNPrefix
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
# hpclibrary will be in steps/..
parentdir = os.path.join(os.path.dirname(__file__),"..")
diff --git a/xos/observers/vcpe/steps/sync_vcpetenant.yaml b/xos/synchronizers/vcpe/steps/sync_vcpetenant.yaml
similarity index 100%
rename from xos/observers/vcpe/steps/sync_vcpetenant.yaml
rename to xos/synchronizers/vcpe/steps/sync_vcpetenant.yaml
diff --git a/xos/observers/vcpe/steps/sync_vcpetenant_new.yaml b/xos/synchronizers/vcpe/steps/sync_vcpetenant_new.yaml
similarity index 100%
rename from xos/observers/vcpe/steps/sync_vcpetenant_new.yaml
rename to xos/synchronizers/vcpe/steps/sync_vcpetenant_new.yaml
diff --git a/xos/observers/vcpe/steps/test.yaml b/xos/synchronizers/vcpe/steps/test.yaml
similarity index 100%
rename from xos/observers/vcpe/steps/test.yaml
rename to xos/synchronizers/vcpe/steps/test.yaml
diff --git a/xos/observers/vcpe/stop.sh b/xos/synchronizers/vcpe/stop.sh
similarity index 100%
rename from xos/observers/vcpe/stop.sh
rename to xos/synchronizers/vcpe/stop.sh
diff --git a/xos/observers/vcpe/supervisor/vcpe-observer.conf b/xos/synchronizers/vcpe/supervisor/vcpe-observer.conf
similarity index 100%
rename from xos/observers/vcpe/supervisor/vcpe-observer.conf
rename to xos/synchronizers/vcpe/supervisor/vcpe-observer.conf
diff --git a/xos/observers/vcpe/templates/before.rules.j2 b/xos/synchronizers/vcpe/templates/before.rules.j2
similarity index 100%
rename from xos/observers/vcpe/templates/before.rules.j2
rename to xos/synchronizers/vcpe/templates/before.rules.j2
diff --git a/xos/observers/vcpe/templates/dnsmasq_safe_servers.j2 b/xos/synchronizers/vcpe/templates/dnsmasq_safe_servers.j2
similarity index 100%
rename from xos/observers/vcpe/templates/dnsmasq_safe_servers.j2
rename to xos/synchronizers/vcpe/templates/dnsmasq_safe_servers.j2
diff --git a/xos/observers/vcpe/templates/dnsmasq_servers.j2 b/xos/synchronizers/vcpe/templates/dnsmasq_servers.j2
similarity index 100%
rename from xos/observers/vcpe/templates/dnsmasq_servers.j2
rename to xos/synchronizers/vcpe/templates/dnsmasq_servers.j2
diff --git a/xos/observers/vcpe/templates/firewall_sample.j2 b/xos/synchronizers/vcpe/templates/firewall_sample.j2
similarity index 100%
rename from xos/observers/vcpe/templates/firewall_sample.j2
rename to xos/synchronizers/vcpe/templates/firewall_sample.j2
diff --git a/xos/observers/vcpe/templates/start-vcpe.sh.j2 b/xos/synchronizers/vcpe/templates/start-vcpe.sh.j2
similarity index 100%
rename from xos/observers/vcpe/templates/start-vcpe.sh.j2
rename to xos/synchronizers/vcpe/templates/start-vcpe.sh.j2
diff --git a/xos/observers/vcpe/templates/vcpe.conf.j2 b/xos/synchronizers/vcpe/templates/vcpe.conf.j2
similarity index 100%
rename from xos/observers/vcpe/templates/vcpe.conf.j2
rename to xos/synchronizers/vcpe/templates/vcpe.conf.j2
diff --git a/xos/observers/vcpe/templates/vlan_sample.j2 b/xos/synchronizers/vcpe/templates/vlan_sample.j2
similarity index 100%
rename from xos/observers/vcpe/templates/vlan_sample.j2
rename to xos/synchronizers/vcpe/templates/vlan_sample.j2
diff --git a/xos/observers/vcpe/vcpe-observer.py b/xos/synchronizers/vcpe/vcpe-observer.py
similarity index 100%
rename from xos/observers/vcpe/vcpe-observer.py
rename to xos/synchronizers/vcpe/vcpe-observer.py
diff --git a/xos/observers/vcpe/vcpe_observer_config b/xos/synchronizers/vcpe/vcpe_observer_config
similarity index 100%
rename from xos/observers/vcpe/vcpe_observer_config
rename to xos/synchronizers/vcpe/vcpe_observer_config
diff --git a/xos/observers/vcpe/vcpe_stats_notifier.py b/xos/synchronizers/vcpe/vcpe_stats_notifier.py
similarity index 100%
rename from xos/observers/vcpe/vcpe_stats_notifier.py
rename to xos/synchronizers/vcpe/vcpe_stats_notifier.py
diff --git a/xos/observers/vtn/model-deps b/xos/synchronizers/vtn/model-deps
similarity index 100%
rename from xos/observers/vtn/model-deps
rename to xos/synchronizers/vtn/model-deps
diff --git a/xos/observers/vtn/run.sh b/xos/synchronizers/vtn/run.sh
similarity index 100%
rename from xos/observers/vtn/run.sh
rename to xos/synchronizers/vtn/run.sh
diff --git a/xos/observers/vtn/start.sh b/xos/synchronizers/vtn/start.sh
similarity index 100%
rename from xos/observers/vtn/start.sh
rename to xos/synchronizers/vtn/start.sh
diff --git a/xos/observers/vtn/steps/sync_tenant.py b/xos/synchronizers/vtn/steps/sync_tenant.py
similarity index 96%
rename from xos/observers/vtn/steps/sync_tenant.py
rename to xos/synchronizers/vtn/steps/sync_tenant.py
index 45bdfff..cc374be 100644
--- a/xos/observers/vtn/steps/sync_tenant.py
+++ b/xos/synchronizers/vtn/steps/sync_tenant.py
@@ -5,11 +5,11 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from observer.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep
from core.models import Service
from core.models.service import COARSE_KIND
from services.cord.models import Tenant
-from util.logger import Logger, logging
+from xos.logger import Logger, logging
from requests.auth import HTTPBasicAuth
# hpclibrary will be in steps/..
diff --git a/xos/observers/vtn/stop.sh b/xos/synchronizers/vtn/stop.sh
similarity index 100%
rename from xos/observers/vtn/stop.sh
rename to xos/synchronizers/vtn/stop.sh
diff --git a/xos/observers/vtn/supervisor/vtn-observer.conf b/xos/synchronizers/vtn/supervisor/vtn-observer.conf
similarity index 100%
rename from xos/observers/vtn/supervisor/vtn-observer.conf
rename to xos/synchronizers/vtn/supervisor/vtn-observer.conf
diff --git a/xos/observers/vtn/vtn-observer.py b/xos/synchronizers/vtn/vtn-observer.py
similarity index 100%
rename from xos/observers/vtn/vtn-observer.py
rename to xos/synchronizers/vtn/vtn-observer.py
diff --git a/xos/observers/vtn/vtn_observer_config b/xos/synchronizers/vtn/vtn_observer_config
similarity index 100%
rename from xos/observers/vtn/vtn_observer_config
rename to xos/synchronizers/vtn/vtn_observer_config
diff --git a/xos/tools/chuckmove b/xos/tools/chuckmove
new file mode 100755
index 0000000..5a77876
--- /dev/null
+++ b/xos/tools/chuckmove
@@ -0,0 +1,82 @@
+#!/usr/bin/python
+
+from pyparsing import *
+from optparse import OptionParser
+import os
+from os.path import join,exists
+from shutil import copy
+
+usage = "usage: %prog --old <old namespace> --new <new namespace> <directory root>"
+
+parser = OptionParser(usage=usage)
+
+parser.add_option("-q", "--quiet",
+ action="store_false", dest="verbose",
+ help="be vewwy quiet (I'm hunting wabbits)")
+
+parser.add_option("-r", "--reuse",
+ action="store_false", dest="reuse",
+ help="Reuse .orig files. Dangerous!")
+
+parser.add_option("-o", "--old",
+ metavar="old", help="Old namespace")
+
+parser.add_option("-n", "--new",
+ default="new", help="New namespace")
+
+(options, args) = parser.parse_args()
+
+old_ns = options.old
+new_ns = options.new
+
+# grammar
+
+comment = '#' + SkipTo(lineEnd)
+
+module_ns = Word(alphanums + '-' + '_' + '.' + '*')
+old_module_ns = Combine(old_ns + Optional(Combine('.'+module_ns)))
+end_of_python_line = Or([lineEnd,comment])
+
+as_suffix = 'as' + module_ns
+
+import_pure = 'import' + old_module_ns
+import_pure_line = import_pure + Optional(as_suffix) + end_of_python_line
+
+import_from = 'from' + old_module_ns + 'import' + commaSeparatedList
+import_from_line = import_from + Optional(as_suffix) + end_of_python_line
+
+import_line = Or([import_pure_line, import_from_line])
+
+# Make a list of Python files to deal with
+
+try:
+ f = args[0]
+except IndexError:
+ print 'Specify a directory root'
+ exit(1)
+
+for root, dirs, files in os.walk(f):
+ for n in files:
+ if (n.endswith('.py')):
+ full_path = '/'.join([root,n])
+ orig_path = full_path + '.orig'
+ if (options.verbose):
+ print 'Working on %s:'%full_path
+ if (not os.path.exists(orig_path) or not options.reuse):
+ if (options.verbose):
+ print 'Copying %s->%s:'%(full_path,orig_path)
+ copy(full_path, orig_path)
+ f_contents = open(orig_path).read()
+ new_contents = []
+ for l in f_contents.splitlines():
+ try:
+ match = import_line.parseString(l)
+ l = l.replace(old_ns, new_ns)
+ except ParseException:
+ pass
+ new_contents.append(l)
+
+ new_file = '\n'.join(new_contents)
+ if (f_contents.endswith('\n')):
+ new_file+='\n'
+ open(full_path,'w').write(new_file)
diff --git a/xos/tools/chuckmove.README b/xos/tools/chuckmove.README
new file mode 100644
index 0000000..5039548
--- /dev/null
+++ b/xos/tools/chuckmove.README
@@ -0,0 +1,27 @@
+Hi,
+
+I've written a tool called 'chuckmove' for helping move Python modules around in a source tree. You use it as follows. Lets say you want to relocate a module to a different location in the tree, and also rename it. So for instance, x is to become y.z. The syntax you use is:
+
+chuckmove -o x -n y.z <root directory>
+
+Invoking this command makes the tool recursively descend into the root directory, make a backup copy of each file (adding the prefix '.orig') and rewrite the imports in it, so that "import x" gets turned into "import y.z"
+
+It recognizes Python grammar, so it works with all of these forms:
+
+from x import a
+from x.b import c
+import x.d.e.f as foo # Comments are also handled
+
+...with the nit that lines with syntax/grammatical errors are left as is.
+
+For example, for the observer/synchronizer changes, I just had to do the following:
+
+chuckmove -o observer -n synchronizers.base xos
+
+...and then to generate a patch with the changes:
+
+gendiff xos .orig
+
+It's checked into the xos repository under tools (with a README file!).
+
+Sapan
diff --git a/xos/scripts/destroy-all-networks.sh b/xos/tools/destroy-all-networks.sh
similarity index 100%
rename from xos/scripts/destroy-all-networks.sh
rename to xos/tools/destroy-all-networks.sh
diff --git a/xos/scripts/docker_setup_xos b/xos/tools/docker_setup_xos
similarity index 100%
rename from xos/scripts/docker_setup_xos
rename to xos/tools/docker_setup_xos
diff --git a/xos/scripts/docker_start_xos b/xos/tools/docker_start_xos
similarity index 74%
rename from xos/scripts/docker_start_xos
rename to xos/tools/docker_start_xos
index 324f6b8..3b82e71 100755
--- a/xos/scripts/docker_start_xos
+++ b/xos/tools/docker_start_xos
@@ -1,6 +1,6 @@
#! /bin/bash
-bash /opt/xos/scripts/docker_setup_xos
+bash /opt/xos/tools/docker_setup_xos
cd /opt/xos
PUBLIC_HOSTNAME="0.0.0.0"
diff --git a/xos/scripts/opencloud b/xos/tools/xos-manage
similarity index 100%
rename from xos/scripts/opencloud
rename to xos/tools/xos-manage
diff --git a/xos/tosca/resources/xosresource.py b/xos/tosca/resources/xosresource.py
index 9c4f479..fa14380 100644
--- a/xos/tosca/resources/xosresource.py
+++ b/xos/tosca/resources/xosresource.py
@@ -62,7 +62,7 @@
def get_property_default(self, name, default=None):
props = self.nodetemplate.get_properties()
- if props and name in props.keys():
+ if props and name in props.keys():
return props[name].value
return default
diff --git a/xos/tosca/tests/basetest.py b/xos/tosca/tests/basetest.py
index d9701d7..7dda96f 100644
--- a/xos/tosca/tests/basetest.py
+++ b/xos/tosca/tests/basetest.py
@@ -1,19 +1,19 @@
import os
import random
import string
-import sys
-
-# add the parent parent directory to sys.path
-# XXX this is very hackish :(
-import os,sys,inspect
-currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-parentdir = os.path.dirname(currentdir)
-sys.path.append(parentdir)
-parentparentdir = os.path.dirname(parentdir)
-sys.path.append(parentparentdir)
-
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
+import sys
+
+# add the parent parent directory to sys.path
+# XXX this is very hackish :(
+import os,sys,inspect
+currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+parentdir = os.path.dirname(currentdir)
+sys.path.append(parentdir)
+parentparentdir = os.path.dirname(parentdir)
+sys.path.append(parentparentdir)
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
+import django
django.setup()
from tosca.engine import XOSTosca
diff --git a/xos/tosca/tests/observerUserTest.py b/xos/tosca/tests/observerUserTest.py
index 44b47d3..a6b5897 100644
--- a/xos/tosca/tests/observerUserTest.py
+++ b/xos/tosca/tests/observerUserTest.py
@@ -48,14 +48,14 @@
node: %s
relationship: tosca.relationships.UsesController
johndoe@foo.bar:
- type: tosca.nodes.User
- properties:
- password: letmein
- firstname: john
- lastname: doe
- requirements:
- - site:
- node: testsite
+ type: tosca.nodes.User
+ properties:
+ password: letmein
+ firstname: john
+ lastname: doe
+ requirements:
+ - site:
+ node: testsite
relationship: tosca.relationships.MemberOfSite
""" % (self.get_usable_deployment(), self.get_usable_controller()))
diff --git a/xos/tosca/tests/observertest.py b/xos/tosca/tests/observertest.py
index 1ec8797..4c8d5df 100644
--- a/xos/tosca/tests/observertest.py
+++ b/xos/tosca/tests/observertest.py
@@ -5,10 +5,10 @@
import subprocess
import sys
-from observer.event_loop import XOSObserver
-from model_policy import run_policy_once
+from synchronizers.base.event_loop import XOSObserver
+from synchronizers.model_policy import run_policy_once
from xos.config import set_override
-from util.logger import Logger, observer_logger
+from xos.logger import Logger, observer_logger
class BaseObserverToscaTest(BaseToscaTest):
hide_observer_output = True
diff --git a/xos/util/__init__.py b/xos/util/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/xos/util/__init__.py
+++ /dev/null
diff --git a/xos/util/glob.py b/xos/util/glob.py
deleted file mode 100644
index 833ce35..0000000
--- a/xos/util/glob.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import os, fnmatch
-
-def recursive_glob(treeroot, pattern):
- results = []
- for base, dirs, files in os.walk(treeroot):
- goodfiles = fnmatch.filter(files, pattern)
- results.extend(os.path.join(base, f) for f in goodfiles)
- return results
diff --git a/xos/util/request.py b/xos/util/request.py
deleted file mode 100644
index 3769b19..0000000
--- a/xos/util/request.py
+++ /dev/null
@@ -1,14 +0,0 @@
-import ast
-from django.http.request import QueryDict
-
-def parse_request(request):
- d = {}
- if isinstance(request, unicode):
- d = ast.literal_eval(request)
- elif isinstance(request, QueryDict):
- for (k,v) in request.items():
- d[k] = ast.literal_eval(v)
- elif isinstance(request, dict):
- d = request
-
- return d
diff --git a/xos/xos/admin_customize/README.md b/xos/xos/admin_customize/README.md
new file mode 100644
index 0000000..ecc4520
--- /dev/null
+++ b/xos/xos/admin_customize/README.md
@@ -0,0 +1 @@
+admin_customize contains django UI elements (such as templatetags) that are common to all django apps within XOS.
diff --git a/xos/admin_customize/__init__.py b/xos/xos/admin_customize/__init__.py
similarity index 100%
rename from xos/admin_customize/__init__.py
rename to xos/xos/admin_customize/__init__.py
diff --git a/xos/admin_customize/templatetags/__init__.py b/xos/xos/admin_customize/templatetags/__init__.py
similarity index 100%
rename from xos/admin_customize/templatetags/__init__.py
rename to xos/xos/admin_customize/templatetags/__init__.py
diff --git a/xos/admin_customize/templatetags/admin_modify.py b/xos/xos/admin_customize/templatetags/admin_modify.py
similarity index 100%
rename from xos/admin_customize/templatetags/admin_modify.py
rename to xos/xos/admin_customize/templatetags/admin_modify.py
diff --git a/xos/xos/config.py b/xos/xos/config.py
index 2909959..8ae7816 100644
--- a/xos/xos/config.py
+++ b/xos/xos/config.py
@@ -6,7 +6,7 @@
import tempfile
import codecs
from StringIO import StringIO
-from util.xml import Xml
+from xml_util import Xml
default_config = \
"""
diff --git a/xos/util/logger.py b/xos/xos/logger.py
similarity index 100%
rename from xos/util/logger.py
rename to xos/xos/logger.py
diff --git a/xos/xos/settings.py b/xos/xos/settings.py
index 96ac52c..3792224 100644
--- a/xos/xos/settings.py
+++ b/xos/xos/settings.py
@@ -166,7 +166,7 @@
# Uncomment the next line to enable the admin:
# 'suit',
'xos.apps.MyDjangoSuitConfig',
- 'admin_customize',
+ 'xos.admin_customize',
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
diff --git a/xos/util/xml.py b/xos/xos/xml_util.py
similarity index 100%
rename from xos/util/xml.py
rename to xos/xos/xml_util.py