Fixes for onboarding Monitoring service

Change-Id: I6dc97fce6406ce7c0e371c8d9c064ae85c5f37b8
diff --git a/xos/admin.py b/xos/admin.py
index 3d5618a..b2a9242 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -1,6 +1,6 @@
 from django.contrib import admin
 
-from services.ceilometer.models import *
+from services.monitoring.models import *
 from django import forms
 from django.utils.safestring import mark_safe
 from django.contrib.auth.admin import UserAdmin
diff --git a/xos/api/tenant/ceilometer/monitoringchannel.py b/xos/api/tenant/monitoring/monitoringchannel.py
similarity index 97%
rename from xos/api/tenant/ceilometer/monitoringchannel.py
rename to xos/api/tenant/monitoring/monitoringchannel.py
index 43e1636..8385c40 100644
--- a/xos/api/tenant/ceilometer/monitoringchannel.py
+++ b/xos/api/tenant/monitoring/monitoringchannel.py
@@ -9,7 +9,7 @@
 from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
 from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
 
-from services.ceilometer.models import MonitoringChannel, CeilometerService
+from services.monitoring.models import MonitoringChannel, CeilometerService
 
 def get_default_ceilometer_service():
     ceilometer_services = CeilometerService.get_service_objects().all()
diff --git a/xos/models.py b/xos/models.py
index 5285bd7..a839b4a 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -18,7 +18,7 @@
     KIND = CEILOMETER_KIND
 
     class Meta:
-        app_label = "ceilometer"
+        app_label = "monitoring"
         verbose_name = "Ceilometer Service"
         proxy = True
 
@@ -188,7 +188,7 @@
     KIND = SFLOW_KIND
 
     class Meta:
-        app_label = "ceilometer"
+        app_label = "monitoring"
         verbose_name = "sFlow Collection Service"
         proxy = True
 
diff --git a/xos/ceilometer-onboard.yaml b/xos/monitoring-onboard.yaml
similarity index 64%
rename from xos/ceilometer-onboard.yaml
rename to xos/monitoring-onboard.yaml
index 7b9bcf0..d5db426 100644
--- a/xos/ceilometer-onboard.yaml
+++ b/xos/monitoring-onboard.yaml
@@ -1,13 +1,13 @@
 tosca_definitions_version: tosca_simple_yaml_1_0
 
-description: Onboard the exampleservice
+description: Onboard the Monitoring Service
 
 imports:
    - custom_types/xos.yaml
 
 topology_template:
   node_templates:
-    servicecontroller#ceilometer:
+    servicecontroller#monitoring:
       type: tosca.nodes.ServiceController
       properties:
           base_url: file:///opt/xos_services/monitoring/xos/
@@ -17,9 +17,9 @@
           admin: admin.py
           admin_template: templates/ceilometeradmin.html, templates/sflowadmin.html
           synchronizer: synchronizer/manifest
-          synchronizer_run: monitoring_channel_synchronizer.py
+          synchronizer_run: monitoring_synchronizer.py
           tosca_resource: tosca/resources/ceilometerservice.py, tosca/resources/ceilometertenant.py, tosca/resources/sflowservice.py
-          rest_tenant: subdirectory:ceilometer api/tenant/ceilometer/monitoringchannel.py
-          private_key: file:///opt/xos/key_import/monitoring_channel_rsa
-          public_key: file:///opt/xos/key_import/monitoring_channel_rsa.pub
+          rest_tenant: subdirectory:monitoring api/tenant/monitoring/monitoringchannel.py
+          private_key: file:///opt/xos/key_import/monitoringservice_rsa
+          public_key: file:///opt/xos/key_import/monitoringservice_rsa.pub
 
diff --git a/xos/synchronizer/manifest b/xos/synchronizer/manifest
index c679225..806c96c 100644
--- a/xos/synchronizer/manifest
+++ b/xos/synchronizer/manifest
@@ -12,7 +12,8 @@
 templates/ceilometer_proxy_server.py
 templates/start_ceilometer_proxy
 manifest
-monitoring_channel_synchronizer_config
+run.sh
+monitoring_synchronizer_config
 steps/sync_sflowtenant.yaml
 steps/sync_sflowtenant.py
 steps/sync_monitoringchannel.yaml
@@ -22,5 +23,5 @@
 files/vm-resolv.conf
 files/docker.list
 model-deps
-supervisor/monitoring_channel_observer.conf
-monitoring_channel_synchronizer.py
+supervisor/monitoring_observer.conf
+monitoring_synchronizer.py
diff --git a/xos/synchronizer/monitoring_channel_synchronizer.py b/xos/synchronizer/monitoring_synchronizer.py
similarity index 100%
rename from xos/synchronizer/monitoring_channel_synchronizer.py
rename to xos/synchronizer/monitoring_synchronizer.py
diff --git a/xos/synchronizer/monitoring_channel_synchronizer_config b/xos/synchronizer/monitoring_synchronizer_config
similarity index 65%
rename from xos/synchronizer/monitoring_channel_synchronizer_config
rename to xos/synchronizer/monitoring_synchronizer_config
index 8c6578f..5cfe5e3 100644
--- a/xos/synchronizer/monitoring_channel_synchronizer_config
+++ b/xos/synchronizer/monitoring_synchronizer_config
@@ -22,11 +22,11 @@
 nova_enabled=True
 
 [observer]
-name=monitoring_channel
-dependency_graph=/opt/xos/synchronizers/monitoring_channel/model-deps
-steps_dir=/opt/xos/synchronizers/monitoring_channel/steps
-sys_dir=/opt/xos/synchronizers/monitoring_channel/sys
-deleters_dir=/opt/xos/synchronizers/monitoring_channel/deleters
+name=monitoring_service
+dependency_graph=/opt/xos/synchronizers/monitoring/model-deps
+steps_dir=/opt/xos/synchronizers/monitoring/steps
+sys_dir=/opt/xos/synchronizers/monitoring/sys
+deleters_dir=/opt/xos/synchronizers/monitoring/deleters
 log_file=console
 driver=None
 pretend=False
diff --git a/xos/synchronizer/run.sh b/xos/synchronizer/run.sh
new file mode 100755
index 0000000..5c9c2d6
--- /dev/null
+++ b/xos/synchronizer/run.sh
@@ -0,0 +1,6 @@
+#if [[ ! -e ./vcpe-observer.py ]]; then
+#    ln -s ../../xos-observer.py vcpe-observer.py
+#fi
+
+export XOS_DIR=/opt/xos
+python monitoring_synchronizer.py  -C $XOS_DIR/synchronizers/monitoring/monitoring_synchronizer_config
diff --git a/xos/synchronizer/steps/sync_monitoringchannel.py b/xos/synchronizer/steps/sync_monitoringchannel.py
index 2c0ba10..bf3390b 100644
--- a/xos/synchronizer/steps/sync_monitoringchannel.py
+++ b/xos/synchronizer/steps/sync_monitoringchannel.py
@@ -10,7 +10,7 @@
 from synchronizers.base.ansible import run_template_ssh
 from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
 from core.models import Service, Slice
-from services.ceilometer.models import CeilometerService, MonitoringChannel
+from services.monitoring.models import CeilometerService, MonitoringChannel
 from xos.logger import Logger, logging
 
 parentdir = os.path.join(os.path.dirname(__file__),"..")
@@ -23,7 +23,7 @@
     observes=MonitoringChannel
     requested_interval=0
     template_name = "sync_monitoringchannel.yaml"
-    service_key_name = "/opt/xos/synchronizers/monitoring_channel/monitoring_channel_private_key"
+    service_key_name = "/opt/xos/synchronizers/monitoring/monitoring_channel_private_key"
 
     def __init__(self, *args, **kwargs):
         super(SyncMonitoringChannel, self).__init__(*args, **kwargs)
diff --git a/xos/synchronizer/steps/sync_monitoringchannel.yaml b/xos/synchronizer/steps/sync_monitoringchannel.yaml
index ca72c5f..ad9b062 100644
--- a/xos/synchronizer/steps/sync_monitoringchannel.yaml
+++ b/xos/synchronizer/steps/sync_monitoringchannel.yaml
@@ -26,14 +26,14 @@
 {% if delete %}
   - name: Remove tenant
 # FIXME: Adding dummy template action to avoid "action attribute missing in task" error
-    template: src=/opt/xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
+    template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
     notify:
      - stop monitoring-channel
      - remove container
 {% else %}
 {% if full_setup %}
 #  - name: Docker repository
-#    copy: src=/opt/xos/synchronizers/monitoring_channel/files/docker.list
+#    copy: src=/opt/xos/synchronizers/monitoring/files/docker.list
 #      dest=/etc/apt/sources.list.d/docker.list
 #
 #  - name: Import the repository key
@@ -74,7 +74,7 @@
 #  - file: path=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config state=absent
 
   - name: ceilometer proxy config
-    template: src=/opt/xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
+    template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
     notify:
      - copy ceilo-config-file
      - restart monitoring-channel container
@@ -83,10 +83,10 @@
 #     - start monitoring-channel
 
   - name: Monitoring channel upstart
-    template: src=/opt/xos/synchronizers/monitoring_channel/templates/monitoring-channel.conf.j2 dest=/etc/init/monitoring-channel-{{ unique_id }}.conf
+    template: src=/opt/xos/synchronizers/monitoring/templates/monitoring-channel.conf.j2 dest=/etc/init/monitoring-channel-{{ unique_id }}.conf
 
   - name: Monitoring channel startup script
-    template: src=/opt/xos/synchronizers/monitoring_channel/templates/start-monitoring-channel.sh.j2 dest=/usr/local/sbin/start-monitoring-channel-{{ unique_id }}.sh mode=0755
+    template: src=/opt/xos/synchronizers/monitoring/templates/start-monitoring-channel.sh.j2 dest=/usr/local/sbin/start-monitoring-channel-{{ unique_id }}.sh mode=0755
     notify:
 #    - restart monitoring-channel
      - stop monitoring-channel
diff --git a/xos/synchronizer/steps/sync_sflowservice.py b/xos/synchronizer/steps/sync_sflowservice.py
index 154c5ab..a3978ca 100644
--- a/xos/synchronizer/steps/sync_sflowservice.py
+++ b/xos/synchronizer/steps/sync_sflowservice.py
@@ -10,7 +10,7 @@
 from synchronizers.base.ansible import run_template_ssh
 from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
 from core.models import Service, Slice
-from services.ceilometer.models import SFlowService
+from services.monitoring.models import SFlowService
 from xos.logger import Logger, logging
 
 # hpclibrary will be in steps/..
@@ -24,7 +24,7 @@
     observes=SFlowService
     requested_interval=0
     template_name = "sync_sflowservice.yaml"
-    service_key_name = "/opt/xos/synchronizers/monitoring_channel/monitoring_channel_private_key"
+    service_key_name = "/opt/xos/synchronizers/monitoring/monitoring_channel_private_key"
 
     def __init__(self, *args, **kwargs):
         super(SyncSFlowService, self).__init__(*args, **kwargs)
diff --git a/xos/synchronizer/steps/sync_sflowservice.yaml b/xos/synchronizer/steps/sync_sflowservice.yaml
index 8d853a2..a9df1e5 100644
--- a/xos/synchronizer/steps/sync_sflowservice.yaml
+++ b/xos/synchronizer/steps/sync_sflowservice.yaml
@@ -42,7 +42,7 @@
       state=latest
 
   - name: sflow pub-sub config
-    template: src=/opt/xos/synchronizers/monitoring_channel/templates/sflow_pub_sub/sflow_pub_sub_config.j2 dest=/usr/local/share/sflow_pub_sub.conf mode=0777
+    template: src=/opt/xos/synchronizers/monitoring/templates/sflow_pub_sub/sflow_pub_sub_config.j2 dest=/usr/local/share/sflow_pub_sub.conf mode=0777
 
   - name: Start SFLOW pub-sub container
     docker:
diff --git a/xos/synchronizer/steps/sync_sflowtenant.py b/xos/synchronizer/steps/sync_sflowtenant.py
index a15fa54..18e5d48 100644
--- a/xos/synchronizer/steps/sync_sflowtenant.py
+++ b/xos/synchronizer/steps/sync_sflowtenant.py
@@ -13,7 +13,7 @@
 from synchronizers.base.ansible import run_template_ssh
 from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
 from core.models import Service, Slice, ControllerSlice, ControllerUser
-from services.ceilometer.models import SFlowService, SFlowTenant
+from services.monitoring.models import SFlowService, SFlowTenant
 from xos.logger import Logger, logging
 
 # hpclibrary will be in steps/..
@@ -27,7 +27,7 @@
     observes=SFlowTenant
     requested_interval=0
     template_name = "sync_sflowtenant.yaml"
-    service_key_name = "/opt/xos/synchronizers/monitoring_channel/monitoring_channel_private_key"
+    service_key_name = "/opt/xos/synchronizers/monitoring/monitoring_channel_private_key"
 
     def __init__(self, *args, **kwargs):
         super(SyncSFlowTenant, self).__init__(*args, **kwargs)
diff --git a/xos/synchronizer/supervisor/monitoring_channel_observer.conf b/xos/synchronizer/supervisor/monitoring_channel_observer.conf
deleted file mode 100644
index 1c2dd42..0000000
--- a/xos/synchronizer/supervisor/monitoring_channel_observer.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[program:monitoring_channel_observer]
-command=python /opt/xos/synchronizers/monitoring_channel/monitoring_channel_synchronizer.py -C /opt/xos/synchronizers/monitoring_channel/monitoring_channel_synchronizer_config
diff --git a/xos/synchronizer/supervisor/monitoring_observer.conf b/xos/synchronizer/supervisor/monitoring_observer.conf
new file mode 100644
index 0000000..38d417a
--- /dev/null
+++ b/xos/synchronizer/supervisor/monitoring_observer.conf
@@ -0,0 +1,2 @@
+[program:monitoring_service_observer]
+command=python /opt/xos/synchronizers/monitoring/monitoring_synchronizer.py -C /opt/xos/synchronizers/monitoring/monitoring_synchronizer_config
diff --git a/xos/templates/ceilometeradmin.html b/xos/templates/ceilometeradmin.html
index 40f57e8..24e1072 100644
--- a/xos/templates/ceilometeradmin.html
+++ b/xos/templates/ceilometeradmin.html
@@ -1,6 +1,6 @@
 <div class = "row text-center">
     <div class="col-xs-12">
-        <a class="btn btn-primary" href="/admin/ceilometer/monitoringchannel/">Monitoring Channels</a>
+        <a class="btn btn-primary" href="/admin/monitoring/monitoringchannel/">Monitoring Channels</a>
     </div>
 </div>
 
diff --git a/xos/templates/sflowadmin.html b/xos/templates/sflowadmin.html
index 3cbb333..4dbd023 100644
--- a/xos/templates/sflowadmin.html
+++ b/xos/templates/sflowadmin.html
@@ -1,6 +1,6 @@
 <div class = "row text-center">
     <div class="col-xs-12">
-        <a class="btn btn-primary" href="/admin/ceilometer/sflowtenant/">sFlow Tenants</a>
+        <a class="btn btn-primary" href="/admin/monitoring/sflowtenant/">sFlow Tenants</a>
     </div>
 </div>
 
diff --git a/xos/tosca/resources/ceilometerservice.py b/xos/tosca/resources/ceilometerservice.py
index e77fa55..40c394f 100644
--- a/xos/tosca/resources/ceilometerservice.py
+++ b/xos/tosca/resources/ceilometerservice.py
@@ -6,14 +6,14 @@
 from translator.toscalib.tosca_template import ToscaTemplate
 
 from core.models import ServiceAttribute
-from services.ceilometer.models import CeilometerService
+from services.monitoring.models import CeilometerService
 
 from service import XOSService
 
 class XOSCeilometerService(XOSService):
     provides = "tosca.nodes.CeilometerService"
     xos_model = CeilometerService
-    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber", "ceilometer_pub_sub_url"]
+    copyin_props = ["view_url", "icon_url", "enabled", "published", "private_key_fn", "public_key", "versionNumber", "ceilometer_pub_sub_url"]
 
     def set_service_attr(self, obj, prop_name, value):
         value = self.try_intrinsic_function(value)
diff --git a/xos/tosca/resources/ceilometertenant.py b/xos/tosca/resources/ceilometertenant.py
index cb3a623..3a5914c 100644
--- a/xos/tosca/resources/ceilometertenant.py
+++ b/xos/tosca/resources/ceilometertenant.py
@@ -6,7 +6,7 @@
 from translator.toscalib.tosca_template import ToscaTemplate
 import pdb
 
-from services.ceilometer.models import MonitoringChannel, CeilometerService
+from services.monitoring.models import MonitoringChannel, CeilometerService
 
 from xosresource import XOSResource
 
diff --git a/xos/tosca/resources/sflowservice.py b/xos/tosca/resources/sflowservice.py
index 272518e..3f3a98f 100644
--- a/xos/tosca/resources/sflowservice.py
+++ b/xos/tosca/resources/sflowservice.py
@@ -6,7 +6,7 @@
 from translator.toscalib.tosca_template import ToscaTemplate
 
 from core.models import ServiceAttribute
-from services.ceilometer.models import SFlowService
+from services.monitoring.models import SFlowService
 
 from service import XOSService