Merge branch 'master' of https://github.com/open-cloud/xos
diff --git a/applications/auto-scale/xos_auto_scaling_app.py b/applications/auto-scale/xos_auto_scaling_app.py
index 848ccc0..68ba4cf 100644
--- a/applications/auto-scale/xos_auto_scaling_app.py
+++ b/applications/auto-scale/xos_auto_scaling_app.py
@@ -17,6 +17,12 @@
 
 use_kafka = True
 
+XOS_ENDPOINT = '130.127.133.58:9999'
+KAFKA_SERVER_IP = '130.127.133.58'
+KAFKA_SERVER_PORT = '9092'
+KAFKA_TOPIC = 'auto-scale'
+LOCAL_KAFKA_TARGET_URL = 'kafka://'+KAFKA_SERVER_IP+':'+KAFKA_SERVER_PORT+'?topic='+KAFKA_TOPIC
+
 if use_kafka:
    import kafka
    from kafka import TopicPartition
@@ -31,7 +37,7 @@
     return response
 
 def acquire_xos_monitoring_channel():
-    url = "http://ctl:9999/xoslib/monitoringchannel/"
+    url = "http://"+XOS_ENDPOINT+"/api/tenant/ceilometer/monitoringchannel/"
     admin_auth=("padmin@vicci.org", "letmein")   # use your XOS username and password
     monitoring_channels = requests.get(url, auth=admin_auth).json()
     ceilometer_url = None
@@ -85,7 +91,7 @@
 
 def loadAllXosTenantInfo():
     print "SRIKANTH: Loading all XOS tenant info"
-    url = "http://ctl:9999/xos/controllerslices/"
+    url = "http://"+XOS_ENDPOINT+"/xos/controllerslices/"
     admin_auth=("padmin@vicci.org", "letmein")   # use your XOS username and password
     controller_slices = requests.get(url, auth=admin_auth).json()
     for cslice in controller_slices:
@@ -101,7 +107,7 @@
 
 def loadAllXosInstanceInfo():
     print "SRIKANTH: Loading all XOS instance info"
-    url = "http://ctl:9999/xos/instances/"
+    url = "http://"+XOS_ENDPOINT+"/xos/instances/"
     admin_auth=("padmin@vicci.org", "letmein")   # use your XOS username and password
     xos_instances = requests.get(url, auth=admin_auth).json()
     for instance in xos_instances:
@@ -148,7 +154,7 @@
         return
     print "SRIKANTH: SCALE %s for Project %s, Slice=%s, Service=%s from current=%d to new=%d" % (adjust, project, xos_slice, xos_service, current_instances, current_instances+1 if (adjust=='up') else current_instances-1)
     query_params = {'service':xos_service, 'slice_hint':xos_slice, 'scale':current_instances+1 if (adjust=='up') else current_instances-1}
-    url = "http://ctl:9999/xoslib/serviceadjustscale/"
+    url = "http://"+XOS_ENDPOINT+"/xoslib/serviceadjustscale/"
     admin_auth=("padmin@vicci.org", "letmein")   # use your XOS username and password
     response = requests.get(url, params=query_params, auth=admin_auth).json()
     print "SRIKANTH: XOS adjust_scale response: %s" % response
@@ -233,7 +239,7 @@
 
 def process_notification_from_ceilometer(sample):
          if sample['counter_name'] == 'instance':
-             if 'delete' in sample['resource_metadata']['event_type']:
+             if ('event_type' in sample['resource_metadata'].keys()) and ('delete' in sample['resource_metadata']['event_type']):
 	          xosTenantInfo = getXosTenantInfo(sample['project_id'])
                   xosResourceInfo = getXosInstanceInfo(sample['resource_id'])
                   print "SRIKANTH: Project %s Instance %s is getting deleted" % (xosTenantInfo['slice'] if xosTenantInfo['slice'] else sample['project_id'],xosResourceInfo) 
@@ -305,8 +311,8 @@
    loadAllXosInstanceInfo()
    ceilometer_url = monitoring_channel['ceilometer_url']
    if use_kafka:
-       thread.start_new(read_notification_from_ceilometer_over_kafka, ("10.11.10.1","9092","auto-scale",))
-       subscribe_data = {"sub_info":"cpu_util","app_id":"xos_auto_scale","target":"kafka://10.11.10.1:9092?topic=auto-scale"}
+       thread.start_new(read_notification_from_ceilometer_over_kafka, (KAFKA_SERVER_IP,KAFKA_SERVER_PORT,KAFKA_TOPIC,))
+       subscribe_data = {"sub_info":"cpu_util","app_id":"xos_auto_scale","target":LOCAL_KAFKA_TARGET_URL}
    else:
        thread.start_new(read_notification_from_ceilometer,(UDP_IP,UDP_PORT,))
        subscribe_data = {"sub_info":"cpu_util","app_id":"xos_auto_scale","target":"udp://10.11.10.1:12346"}
@@ -317,7 +323,10 @@
    if (not 'sucess' in response.text) and (not 'already exists' in response.text):
        print 'SRIKANTH: Ceilometer meter "cpu_util" Subscription unsuccessful...Exiting'
        return
-   subscribe_data = {"sub_info":"instance","app_id":"xos_auto_scale2","target":"udp://10.11.10.1:12346"}
+   if use_kafka:
+        subscribe_data = {"sub_info":"instance","app_id":"xos_auto_scale2","target":LOCAL_KAFKA_TARGET_URL}
+   else:
+        subscribe_data = {"sub_info":"instance","app_id":"xos_auto_scale2","target":"udp://10.11.10.1:12346"}
    subscribe_url = ceilometer_url + 'v2/subscribe'
    response = requests.post(subscribe_url, data=json.dumps(subscribe_data))
    print 'SRIKANTH: Ceilometer meter "instance" Subscription status:%s' % response.text
diff --git a/xos/api/tenant/ceilometer/__init__.py b/xos/api/tenant/ceilometer/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/xos/api/tenant/ceilometer/__init__.py
@@ -0,0 +1 @@
+
diff --git a/xos/api/tenant/ceilometer/monitoringchannel.py b/xos/api/tenant/ceilometer/monitoringchannel.py
new file mode 100644
index 0000000..43e1636
--- /dev/null
+++ b/xos/api/tenant/ceilometer/monitoringchannel.py
@@ -0,0 +1,94 @@
+from rest_framework.decorators import api_view
+from rest_framework.response import Response
+from rest_framework.reverse import reverse
+from rest_framework import serializers
+from rest_framework import generics
+from rest_framework import status
+from core.models import *
+from django.forms import widgets
+from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
+from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
+
+from services.ceilometer.models import MonitoringChannel, CeilometerService
+
+def get_default_ceilometer_service():
+    ceilometer_services = CeilometerService.get_service_objects().all()
+    if ceilometer_services:
+        return ceilometer_services[0].id
+    return None
+
+class MonitoringChannelForAPI(MonitoringChannel):
+    class Meta:
+        proxy = True
+        app_label = "ceilometer"
+
+    @property
+    def related(self):
+        related = {}
+        if self.creator:
+            related["creator"] = self.creator.username
+        if self.instance:
+            related["instance_id"] = self.instance.id
+            related["instance_name"] = self.instance.name
+            if self.instance.node:
+                related["compute_node_name"] = self.instance.node.name
+        return related
+
+class MonitoringChannelSerializer(PlusModelSerializer):
+        id = ReadOnlyField()
+        service_specific_attribute = ReadOnlyField()
+        ceilometer_url = ReadOnlyField()
+        tenant_list_str = ReadOnlyField()
+        #creator = ReadOnlyField()
+        #instance = ReadOnlyField()
+        provider_service = serializers.PrimaryKeyRelatedField(queryset=CeilometerService.get_service_objects().all(), default=get_default_ceilometer_service)
+
+        humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+        related = serializers.DictField(required=False)
+
+        #computeNodeName = serializers.SerializerMethodField("getComputeNodeName")
+
+        class Meta:
+            model = MonitoringChannelForAPI
+            fields = ('humanReadableName', 'id', 'provider_service', 'service_specific_attribute', 'ceilometer_url', 'tenant_list_str', 'related' )
+
+        def getHumanReadableName(self, obj):
+            return obj.__unicode__()
+
+        #def getComputeNodeName(self, obj):
+        #    instance = obj.instance
+        #    if not instance:
+        #        return None
+        #    return instance.node.name
+
+class MonitoringChannelSet(XOSViewSet):
+    base_name = "monitoringchannel"
+    method_name = "monitoringchannel"
+    method_kind = "viewset"
+    queryset = MonitoringChannelForAPI.get_tenant_objects().all()
+    serializer_class = MonitoringChannelSerializer
+
+    def get_queryset(self):
+        queryset = MonitoringChannelForAPI.get_tenant_objects().all()
+
+        current_user = self.request.user.username
+        if current_user is not None:
+            ids = [x.id for x in queryset if x.creator.username==current_user]
+            queryset = queryset.filter(id__in=ids)
+
+        return queryset
+
+    def create(self, request):
+        current_user = request.user.username
+        existing_obj = None
+        for obj in MonitoringChannelForAPI.get_tenant_objects().all():
+            if (obj.creator.username == current_user):
+               existing_obj = obj
+               break
+
+        if existing_obj:
+            serializer = MonitoringChannelSerializer(existing_obj)
+            headers = self.get_success_headers(serializer.data)
+            return Response( serializer.data, status=status.HTTP_200_OK )
+
+        return super(MonitoringChannelSet, self).create(request)
diff --git a/xos/configurations/acord/Makefile b/xos/configurations/acord/Makefile
index cfa04f8..e9b234c 100644
--- a/xos/configurations/acord/Makefile
+++ b/xos/configurations/acord/Makefile
@@ -13,9 +13,13 @@
 	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/cloudlab-openstack.yaml
 	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
 
-acord: cord
+acord: cord exampleservice
 	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/acord/ceilometer.yaml
 
+exampleservice:
+	#Ensure exampleservice is enabled in xos/tools/xos-manage and xos/settings.py file before uncommenting below lines
+	#sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/acord/acord-exampleservice.yaml
+
 containers:
 	cd ../../../containers/xos; make devel
 	cd ../../../containers/synchronizer; make
diff --git a/xos/configurations/acord/acord-exampleservice.yaml b/xos/configurations/acord/acord-exampleservice.yaml
new file mode 100644
index 0000000..b6b23dd
--- /dev/null
+++ b/xos/configurations/acord/acord-exampleservice.yaml
@@ -0,0 +1,56 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Setup the ExampleService on the ACORD setup
+
+imports:
+   - custom_types/xos.yaml
+   - custom_types/exampleservice.yaml
+
+topology_template:
+  node_templates:
+
+    mysite:
+      type: tosca.nodes.Site
+
+    trusty-server-multi-nic:
+      type: tosca.nodes.Image
+
+    m1.small:
+      type: tosca.nodes.Flavor
+
+    mysite_exampleservice:
+      description: This slice holds the ExampleService
+      type: tosca.nodes.Slice
+      requirements:
+          - site:
+              node: mysite
+              relationship: tosca.relationships.MemberOfSite
+          - exmapleservice:
+              node: service_example
+              relationship: tosca.relationships.MemberOfService
+          - default_image:
+                node: trusty-server-multi-nic
+                relationship: tosca.relationships.DefaultImage
+          - m1.small:
+                node: m1.small
+                relationship: tosca.relationships.DefaultFlavor
+
+    service_example:
+      type: tosca.nodes.ExampleService
+      properties:
+          view_url: /admin/exampleservice/exampleservice/$id$/
+          kind: exampleservice
+          public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
+          private_key_fn: /opt/xos/synchronizers/exampleservice/exampleservice_private_key
+          service_message: hello
+      artifacts:
+          pubkey: /opt/xos/synchronizers/exampleservice/exampleservice_public_key
+
+    exampletenant1:
+        type: tosca.nodes.ExampleTenant
+        properties:
+            tenant_message: world
+        requirements:
+          - tenant:
+              node: service_example
+              relationship: tosca.relationships.TenantOfService
diff --git a/xos/configurations/acord/ceilometer.yaml b/xos/configurations/acord/ceilometer.yaml
index 66d5d32..089837d 100644
--- a/xos/configurations/acord/ceilometer.yaml
+++ b/xos/configurations/acord/ceilometer.yaml
@@ -122,38 +122,38 @@
       properties:
           view_url: /admin/ceilometer/ceilometerservice/$id$/
           kind: ceilometer
-          ceilometer_pub_sub_url: http://10.11.10.1:4455/
+          ceilometer_pub_sub_url: http://130.127.133.58:4455/
           public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
       artifacts:
           pubkey: /opt/xos/synchronizers/monitoring_channel/monitoring_channel_public_key
 
-#    service_sflow:
-#      type: tosca.nodes.SFlowService
-#      requirements:
-#      properties:
-#          view_url: /admin/ceilometer/sflowservice/$id$/
-#          kind: sflow
-#          sflow_port: 6343
-#          sflow_api_port: 33333
+    service_sflow:
+      type: tosca.nodes.SFlowService
+      requirements:
+      properties:
+          view_url: /admin/ceilometer/sflowservice/$id$/
+          kind: sflow
+          sflow_port: 6343
+          sflow_api_port: 33333
 
     Private:
       type: tosca.nodes.NetworkTemplate
-
-    ceilometer_network:
-      type: tosca.nodes.network.Network.XOS
-      properties:
-          ip_version: 4
-          labels: ceilometer_client_access
-      requirements:
-          - network_template:
-              node: Private
-              relationship: tosca.relationships.UsesNetworkTemplate
-          - owner:
-              node: mysite_ceilometer
-              relationship: tosca.relationships.MemberOfSlice
-          - connection:
-              node: mysite_ceilometer
-              relationship: tosca.relationships.ConnectsToSlice
+#
+#    ceilometer_network:
+#      type: tosca.nodes.network.Network.XOS
+#      properties:
+#          ip_version: 4
+#          labels: ceilometer_client_access
+#      requirements:
+#          - network_template:
+#              node: Private
+#              relationship: tosca.relationships.UsesNetworkTemplate
+#          - owner:
+#              node: mysite_ceilometer
+#              relationship: tosca.relationships.MemberOfSlice
+#          - connection:
+#              node: mysite_ceilometer
+#              relationship: tosca.relationships.ConnectsToSlice
 
     mysite:
       type: tosca.nodes.Site
@@ -186,19 +186,24 @@
       properties:
           max_instances: 2
 
-#    mysite_sflow:
-#      description: Slice for sFlow service
-#      type: tosca.nodes.Slice
-#      requirements:
-#          - sflow_service:
-#              node: service_sflow
-#              relationship: tosca.relationships.MemberOfService
-#          - site:
-#              node: mysite
-#              relationship: tosca.relationships.MemberOfSite
-#      properties:
-#          default_flavor: m1.small
-#          max_instances: 2
+    mysite_sflow:
+      description: Slice for sFlow service
+      type: tosca.nodes.Slice
+      requirements:
+          - sflow_service:
+              node: service_sflow
+              relationship: tosca.relationships.MemberOfService
+          - site:
+              node: mysite
+              relationship: tosca.relationships.MemberOfSite
+          - default_image:
+                node: trusty-server-multi-nic
+                relationship: tosca.relationships.DefaultImage
+          - m1.small:
+                node: m1.small
+                relationship: tosca.relationships.DefaultFlavor
+      properties:
+          max_instances: 2
 
     my_ceilometer_tenant:
       description: Ceilometer Service default Tenant
@@ -209,27 +214,27 @@
               relationship: tosca.relationships.MemberOfService
        
     # Virtual machines
-#    sflow_service_instance:
-#      type: tosca.nodes.Compute
-#      capabilities:
-#        # Host container properties
-#        host:
-#         properties:
-#           num_cpus: 1
-#           disk_size: 10 GB
-#           mem_size: 4 MB
-#        # Guest Operating System properties
-#        os:
-#          properties:
-#            # host Operating System image properties
-#            architecture: x86_64
-#            type: linux
-#            distribution: Ubuntu
-#            version: 14.10
-#      requirements:
-#          - slice:
-#                node: mysite_sflow
-#                relationship: tosca.relationships.MemberOfSlice
+    sflow_service_instance:
+      type: tosca.nodes.Compute
+      capabilities:
+        # Host container properties
+        host:
+         properties:
+           num_cpus: 1
+           disk_size: 10 GB
+           mem_size: 4 MB
+        # Guest Operating System properties
+        os:
+          properties:
+            # host Operating System image properties
+            architecture: x86_64
+            type: linux
+            distribution: Ubuntu
+            version: 14.10
+      requirements:
+          - slice:
+                node: mysite_sflow
+                relationship: tosca.relationships.MemberOfSlice
 
     Ceilometer:
       type: tosca.nodes.DashboardView
diff --git a/xos/configurations/acord/ceilometer_pub_sub.tar.gz b/xos/configurations/acord/ceilometer_pub_sub.tar.gz
deleted file mode 100644
index eb88a2b..0000000
--- a/xos/configurations/acord/ceilometer_pub_sub.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xos/configurations/acord/docker-compose.yml b/xos/configurations/acord/docker-compose.yml
index f40761a..da9562e 100644
--- a/xos/configurations/acord/docker-compose.yml
+++ b/xos/configurations/acord/docker-compose.yml
@@ -31,6 +31,19 @@
     volumes:
         - ../setup/id_rsa:/opt/xos/synchronizers/monitoring_channel/monitoring_channel_private_key:ro  # private key
 
+#Ensure exampleservice is enabled in xos/tools/xos-manage and xos/settings.py file before uncommenting below lines
+#xos_synchronizer_exampleservice:
+#    image: xosproject/xos-synchronizer-openstack
+#    command: bash -c "sleep 120; python /opt/xos/synchronizers/exampleservice/exampleservice-synchronizer.py -C /opt/xos/synchronizers/exampleservice/exampleservice_config"
+#    labels:
+#        org.xosproject.kind: synchronizer
+#        org.xosproject.target: exampleservice
+#    links:
+#        - xos_db
+#    volumes:
+#        - ../setup:/root/setup:ro
+#        - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
+#        - ../setup/id_rsa:/opt/xos/synchronizers/exampleservice/exampleservice_private_key:ro
 
 # FUTURE
 #xos_swarm_synchronizer:
@@ -51,3 +64,4 @@
       - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
       - ./xos_cord_config:/opt/xos/xos_configuration/xos_cord_config:ro
       - ../setup/id_rsa.pub:/opt/xos/synchronizers/monitoring_channel/monitoring_channel_public_key:ro
+#      - ../setup/id_rsa.pub:/opt/xos/synchronizers/exampleservice/exampleservice_public_key:ro
diff --git a/xos/configurations/acord/install_ceilometer_patch.sh b/xos/configurations/acord/install_ceilometer_patch.sh
deleted file mode 100755
index 77aa05b..0000000
--- a/xos/configurations/acord/install_ceilometer_patch.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-if [ -d /usr/lib/python2.7/dist-packages/ceilometer/network/ext_services ]; then
-    echo "Seems VCPE notification listeners are already enabled in ceilometer... so exiting gracefully..."
-    exit 0
-fi
-echo "Verifying if all the required files are present"
-if [ ! -f openstack_ceilometer_patch.tar.gz ] || [ ! -f ceilometer_pub_sub.tar.gz ];
-then
-    echo "File openstack_ceilometer_patch.tar.gz or ceilometer_pub_sub.tar.gz not found"
-    exit 1
-fi
-echo "Copying the ceilometer patch files to /usr/lib/python2.7/dist-packages/ceilometer"
-tar -xzf openstack_ceilometer_patch.tar.gz
-sudo mv ceilometer/network/ext_services /usr/lib/python2.7/dist-packages/ceilometer/network/
-sudo mv ceilometer/network/statistics/onos /usr/lib/python2.7/dist-packages/ceilometer/network/statistics/
-sudo mv /usr/lib/python2.7/dist-packages/ceilometer/network/statistics/__init__.py /usr/lib/python2.7/dist-packages/ceilometer/network/statistics/orig_init.orig_py
-sudo mv ceilometer/network/statistics/__init__.py /usr/lib/python2.7/dist-packages/ceilometer/network/statistics/
-sudo mv ceilometer-2015.1.1.egg-info/entry_points.txt /usr/lib/python2.7/dist-packages/ceilometer-*egg-info/
-sudo mv pipeline.yaml /etc/ceilometer/
-echo "Restarting ceilometer-agent-notification"
-sudo service ceilometer-agent-notification restart
-echo "Restarting ceilometer-agent-central"
-sudo service ceilometer-agent-central restart
-tar -xzf ceilometer_pub_sub.tar.gz
-echo "Starting Ceilometer PUB/SUB service"
-cd ceilometer_pub_sub
-python sub_main.py &
diff --git a/xos/configurations/acord/openstack_ceilometer_patch.tar.gz b/xos/configurations/acord/openstack_ceilometer_patch.tar.gz
deleted file mode 100644
index 2c4f02c..0000000
--- a/xos/configurations/acord/openstack_ceilometer_patch.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xos/configurations/cord-pod/Makefile b/xos/configurations/cord-pod/Makefile
index 6d5ddac..229d5e3 100644
--- a/xos/configurations/cord-pod/Makefile
+++ b/xos/configurations/cord-pod/Makefile
@@ -73,7 +73,7 @@
 .PHONY: local_containers
 local_containers:
 	echo "" > ../../../containers/xos/local_certs.crt
-	for CRT in /usr/local/share/ca-certificates/* ; do \
+	for CRT in $$(/usr/local/share/ca-certificates/*) ; do \
 		echo Adding Certificate: $$CRT ;\
 		cat $$CRT >> ../../../containers/xos/local_certs.crt ;\
 		echo "" >> ../../../containers/xos/local_certs.crt ;\
diff --git a/xos/configurations/cord-pod/pod-cdn.yaml b/xos/configurations/cord-pod/pod-cdn.yaml
new file mode 100644
index 0000000..2229686
--- /dev/null
+++ b/xos/configurations/cord-pod/pod-cdn.yaml
@@ -0,0 +1,52 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Setup the CDN on the pod
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+
+    Private:
+      type: tosca.nodes.NetworkTemplate
+
+    management:
+      type: tosca.nodes.network.Network.XOS
+      properties:
+          no-create: true
+          no-delete: true
+          no-update: true
+
+    cdn-public:
+      type: tosca.nodes.network.Network
+      properties:
+          ip_version: 4
+          cidr: 207.141.192.128/28
+      requirements:
+          - network_template:
+              node: Private
+              relationship: tosca.relationships.UsesNetworkTemplate
+          - owner:
+              node: mysite_cdn
+              relationship: tosca.relationships.MemberOfSlice
+          - connection:
+              node: mysite_cdn
+              relationship: tosca.relationships.ConnectsToSlice
+
+    mysite:
+      type: tosca.nodes.Site
+
+    mysite_cdn:
+      description: This slice holds the CDN
+      type: tosca.nodes.Slice
+      properties:
+          network: noauto
+      requirements:
+          - site:
+              node: mysite
+              relationship: tosca.relationships.MemberOfSite
+          - management:
+              node: management
+              relationship: tosca.relationships.ConnectsToNetwork
+
diff --git a/xos/configurations/devel/Makefile b/xos/configurations/devel/Makefile
index cc29f53..5d2e96f 100644
--- a/xos/configurations/devel/Makefile
+++ b/xos/configurations/devel/Makefile
@@ -1,8 +1,8 @@
 MYIP:=$(shell hostname -i)
 
-cloudlab: common_cloudlab containers xos
+cloudlab: common_cloudlab local_containers xos
 
-devstack: upgrade_pkgs common_devstack containers xos
+devstack: upgrade_pkgs common_devstack local_containers xos
 
 xos:
 	sudo MYIP=$(MYIP) docker-compose up -d
@@ -12,16 +12,25 @@
 	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/cloudlab-openstack.yaml
 	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
 
-containers:
-	cd ../../../containers/xos; make devel
-	cd ../../../containers/synchronizer; make
-
 common_cloudlab:
 	make -C ../common -f Makefile.cloudlab
 
 common_devstack:
 	make -C ../common -f Makefile.devstack
 
+base:
+	make -C ../../../containers/xos base
+
+local_containers:
+	echo "" > ../../../containers/xos/local_certs.crt
+	for CRT in $$(/usr/local/share/ca-certificates/*) ; do \
+		echo Adding Certificate: $$CRT ;\
+		cat $$CRT >> ../../../containers/xos/local_certs.crt ;\
+		echo "" >> ../../../containers/xos/local_certs.crt ;\
+	done
+	make -C ../../../containers/xos devel
+	make -C ../../../containers/synchronizer
+
 stop:
 	sudo MYIP=$(MYIP) docker-compose stop
 
@@ -43,8 +52,3 @@
 upgrade_pkgs:
 	sudo pip install httpie --upgrade
 
-rebuild_xos:
-	make -C ../../../containers/xos devel
-
-rebuild_synchronizer:
-	make -C ../../../containers/synchronizer
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index b341e83..5196336 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -548,7 +548,7 @@
         if self.slice.default_image:
             return self.slice.default_image
 
-        raise XOPSProgrammingError("Please set a default image for %s" % self.slice.name)
+        raise XOSProgrammingError("Please set a default image for %s" % self.slice.name)
 
     def make_new_instance(self):
         from core.models import Instance, Flavor
@@ -683,7 +683,7 @@
         if slice.default_image:
             return slice.default_image
 
-        raise XOPSProgrammingError("Please set a default image for %s" % self.slice.name)
+        raise XOSProgrammingError("Please set a default image for %s" % self.slice.name)
 
     def save_instance(self, instance):
         # Override this function to do custom pre-save or post-save processing,
diff --git a/xos/core/xoslib/methods/ceilometerview.py b/xos/core/xoslib/methods/ceilometerview.py
index 16b32d4..9c87e40 100644
--- a/xos/core/xoslib/methods/ceilometerview.py
+++ b/xos/core/xoslib/methods/ceilometerview.py
@@ -1151,8 +1151,8 @@
         if (not tenant_ceilometer_url):
             raise XOSMissingField("Tenant ceilometer URL is missing")
 
-        tenant_id = request.QUERY_PARAMS.get('tenant', None)
-        resource_id = request.QUERY_PARAMS.get('resource', None)
+        tenant_id = request.query_params.get('tenant', None)
+        resource_id = request.query_params.get('resource', None)
 
         query = []
         if tenant_id:
@@ -1187,9 +1187,9 @@
             raise XOSMissingField("Tenant ceilometer URL is missing")
         tenant_map = getTenantControllerTenantMap(request.user)
         
-        date_options = request.QUERY_PARAMS.get('period', 1)
-        date_from = request.QUERY_PARAMS.get('date_from', '')
-        date_to = request.QUERY_PARAMS.get('date_to', '')
+        date_options = request.query_params.get('period', 1)
+        date_from = request.query_params.get('date_from', '')
+        date_to = request.query_params.get('date_to', '')
 
         try:
             date_from, date_to = calc_date_args(date_from,
@@ -1208,9 +1208,9 @@
                                      'op': 'le',
                                      'value': date_to})
 
-        meter_name = request.QUERY_PARAMS.get('meter', None)
-        tenant_id = request.QUERY_PARAMS.get('tenant', None)
-        resource_id = request.QUERY_PARAMS.get('resource', None)
+        meter_name = request.query_params.get('meter', None)
+        tenant_id = request.query_params.get('tenant', None)
+        resource_id = request.query_params.get('resource', None)
 
         query = []
         if tenant_id:
@@ -1284,12 +1284,12 @@
         tenant_ceilometer_url = getTenantCeilometerProxyURL(request.user)
         if (not tenant_ceilometer_url):
             raise XOSMissingField("Tenant ceilometer URL is missing")
-        meter_name = request.QUERY_PARAMS.get('meter', None)
+        meter_name = request.query_params.get('meter', None)
         if not meter_name:
             raise XOSMissingField("Meter name in query params is missing")
-        limit = request.QUERY_PARAMS.get('limit', 10)
-        tenant_id = request.QUERY_PARAMS.get('tenant', None)
-        resource_id = request.QUERY_PARAMS.get('resource', None)
+        limit = request.query_params.get('limit', 10)
+        tenant_id = request.query_params.get('tenant', None)
+        resource_id = request.query_params.get('resource', None)
         query = []
         if tenant_id:
             query.extend(make_query(tenant_id=tenant_id))
@@ -1340,7 +1340,7 @@
         tenant_ceilometer_url = getTenantCeilometerProxyURL(request.user)
         if (not tenant_ceilometer_url):
             raise XOSMissingField("Tenant ceilometer URL is missing")
-        instance_uuid = request.QUERY_PARAMS.get('instance-uuid', None)
+        instance_uuid = request.query_params.get('instance-uuid', None)
         if not instance_uuid:
             raise XOSMissingField("Instance UUID in query params is missing")
         if not Instance.objects.filter(instance_uuid=instance_uuid):
@@ -1354,9 +1354,9 @@
             #neutron port resource id is represented in ceilometer as "nova instance-name"+"-"+"nova instance-id"+"-"+"tap"+first 11 characters of port-id
             resource_ids.append(xos_instance.instance_id+"-"+instance_uuid+"-tap"+p.port_id[:11])
         
-        date_options = request.QUERY_PARAMS.get('period', 1)
-        date_from = request.QUERY_PARAMS.get('date_from', '')
-        date_to = request.QUERY_PARAMS.get('date_to', '')
+        date_options = request.query_params.get('period', 1)
+        date_from = request.query_params.get('date_from', '')
+        date_to = request.query_params.get('date_to', '')
 
         try:
             date_from, date_to = calc_date_args(date_from,
@@ -1437,9 +1437,9 @@
     def get(self, request, format=None):
         if (not request.user.is_authenticated()) or (not request.user.is_admin):
             raise PermissionDenied("You must be authenticated admin user in order to use this API")
-        service = request.QUERY_PARAMS.get('service', None)
-        slice_hint = request.QUERY_PARAMS.get('slice_hint', None)
-        scale = request.QUERY_PARAMS.get('scale', None)
+        service = request.query_params.get('service', None)
+        slice_hint = request.query_params.get('slice_hint', None)
+        scale = request.query_params.get('scale', None)
         if not service or not slice_hint or not scale:
             raise XOSMissingField("Mandatory fields missing")
         services = Service.select_by_user(request.user)
diff --git a/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml b/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
index 1c4da12..ca72c5f 100644
--- a/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
+++ b/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
@@ -66,13 +66,21 @@
 #      dest=/etc/resolv.conf
 {% endif %}
 
+# FIXME: Temporary workaround to delete the monitoring-channel_ceilometer_proxy_config file always 
+# to trigger ansible notify handlers in the following task. 
+# Due to some issue, ansible "changed" flag is set to false even though there is a change of 
+# ceilometer configuration file, because of which the configuration change is not reflecting in 
+# ceilometer containers 
+#  - 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
     notify:
-#    - restart monitoring-channel
-     - stop monitoring-channel
-     - remove container
-     - start monitoring-channel
+     - copy ceilo-config-file
+     - restart monitoring-channel container
+#     - stop monitoring-channel
+#     - remove container
+#     - 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
@@ -118,6 +126,12 @@
 {% endif %}
 
   handlers:
+  - name: copy ceilo-config-file
+    shell: docker cp /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config monitoring-channel-{{ unique_id }}:/usr/local/share/ceilometer_proxy_config
+
+  - name: restart monitoring-channel container
+    shell: docker restart monitoring-channel-{{ unique_id }}
+
   - name: restart monitoring-channel
     shell: service monitoring-channel-{{ unique_id }} stop; sleep 1; service monitoring-channel-{{ unique_id }} start
 
diff --git a/xos/synchronizers/monitoring_channel/templates/start-monitoring-channel.sh.j2 b/xos/synchronizers/monitoring_channel/templates/start-monitoring-channel.sh.j2
index 1685e07..4486985 100755
--- a/xos/synchronizers/monitoring_channel/templates/start-monitoring-channel.sh.j2
+++ b/xos/synchronizers/monitoring_channel/templates/start-monitoring-channel.sh.j2
@@ -24,9 +24,11 @@
     #sudo docker pull srikanthvavila/monitoring-channel
 if [ -z "$HEADNODEFLATLANIP" ] || [ "$HEADNODEFLATLANIP" == "None" ]
 then
-    docker run -d --name=$MONITORING_CHANNEL --privileged=true -p $HOST_FORWARDING_PORT_FOR_CEILOMETER:8000 -v /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config srikanthvavila/monitoring-channel
+#    docker run -d --name=$MONITORING_CHANNEL --privileged=true -p $HOST_FORWARDING_PORT_FOR_CEILOMETER:8000 -v /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config srikanthvavila/monitoring-channel
+    docker run -d --name=$MONITORING_CHANNEL --privileged=true -p $HOST_FORWARDING_PORT_FOR_CEILOMETER:8000 srikanthvavila/monitoring-channel
 else
-    docker run -d --name=$MONITORING_CHANNEL --add-host="ctl:$HEADNODEFLATLANIP" --privileged=true -p $HOST_FORWARDING_PORT_FOR_CEILOMETER:8000 -v /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config srikanthvavila/monitoring-channel
+#    docker run -d --name=$MONITORING_CHANNEL --add-host="ctl:$HEADNODEFLATLANIP" --privileged=true -p $HOST_FORWARDING_PORT_FOR_CEILOMETER:8000 -v /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config srikanthvavila/monitoring-channel
+    docker run -d --name=$MONITORING_CHANNEL --add-host="ctl:$HEADNODEFLATLANIP" --privileged=true -p $HOST_FORWARDING_PORT_FOR_CEILOMETER:8000 srikanthvavila/monitoring-channel
 fi
 else
     docker start $MONITORING_CHANNEL
@@ -41,6 +43,7 @@
 
 # Now copy ceilometer proxy configuration to container
 #cat /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config | sudo docker exec -i $MONITORING_CHANNEL bash -c 'cat > /usr/local/share/ceilometer_proxy_config'
+docker cp /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config $MONITORING_CHANNEL:/usr/local/share/ceilometer_proxy_config
 
 # Attach to container
-#docker start -a $MONITORING_CHANNEL
+docker start -a $MONITORING_CHANNEL