Final version of Kafka Producer with 70/2170/1
authorprithiv <prithiv.mohan@intel.com>
Thu, 14 Sep 2017 15:52:53 +0000 (16:52 +0100)
committerprithiv <prithiv.mohan@intel.com>
Thu, 14 Sep 2017 15:52:53 +0000 (16:52 +0100)
 - Requirements file
 - README.md file

Signed-off-by: prithiv <prithiv.mohan@intel.com>
MANIFEST.in [new file with mode: 0644]
README.rst [new file with mode: 0644]
core/message_bus/producer.py
core/models/delete_metric_req.json
core/models/list_metric_resp.json
core/models/read_metric_data_req.json
devops-stages/.gitkeep [deleted file]
devops_stages/.gitkeep [new file with mode: 0644]
requirements.txt [new file with mode: 0644]

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644 (file)
index 0000000..001e9ee
--- /dev/null
@@ -0,0 +1,6 @@
+include requirements.txt
+include README.rst
+recursive-include core *
+recursive-include devops_stages *
+recursive-include plugins *
+recursive-include test *
diff --git a/README.rst b/README.rst
new file mode 100644 (file)
index 0000000..9c4381b
--- /dev/null
@@ -0,0 +1,55 @@
+OSM MON Module
+****************
+
+MON is a monitoring module for OSM. This module leverages the monitoring
+tool of the supported VIMs through MON's native plugin to send and receive
+metrics and alarms for a VNF.
+
+Components
+**********
+
+MON module has the following components:
+
+ - MON Core, which includes Message Bus and Models
+ - Plugin drivers for various VIMs
+
+The MON module communication is classified as
+
+ - External to MON(requests to MON from SO)
+ - Internal to MON(responses to MON from plugins)
+
+Supported Plugins
+******************
+
+Supported VIMs are OpenStack, VMWare, AWS for now.MON can send/receive metrics
+and alarms from the following plugins in this release.
+
+ - Gnocchi, Aodh (OpenStack)
+ - vrOps (VMWare)
+ - CloudWatch (AWS)
+
+Developers
+**********
+
+  - Prithiv Mohan, Intel Research and Development Ltd, Ireland
+  - Helena McGough, Intel Research and Development Ltd, Ireland
+  - Sachin Bhangare, VMWare, India
+  - Wajeeha Hamid, XFlow Research, Pakistan
+
+Maintainers
+***********
+
+ - Adrian Hoban, Intel Research and Development Ltd, Ireland
+
+Contributions
+*************
+
+For information on how to contribute to OSM MON module, please get in touch with
+the developer or the maintainer.
+
+Any new code must follow the development guidelines detailed in the Dev Guidelines
+in the OSM Wiki and pass all tests.
+
+Dev Guidelines can be found at:
+
+    [https://osm.etsi.org/wikipub/index.php/Workflow_with_OSM_tools]
index 07742e2..0239748 100644 (file)
@@ -83,7 +83,7 @@ class KafkaProducer(object):
 
         payload_create_alarm = jsmin(open(os.path.join(json_path,
                                          'create_alarm.json')).read())
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_create_alarm),
                 topic='alarm_request')
 
@@ -94,8 +94,8 @@ class KafkaProducer(object):
         payload_create_alarm_resp = jsmin(open(os.path.join(json_path,
                                          'create_alarm_resp.json')).read())
 
-        publish(key,
-                value = json.dumps(payload_create_alarm_resp),
+        self.publish(key,
+                value = message,
                 topic = 'alarm_response')
 
     def acknowledge_alarm(self, key, message, topic):
@@ -105,7 +105,7 @@ class KafkaProducer(object):
         payload_acknowledge_alarm = jsmin(open(os.path.join(json_path,
                                          'acknowledge_alarm.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value = json.dumps(payload_acknowledge_alarm),
                 topic = 'alarm_request')
 
@@ -116,7 +116,7 @@ class KafkaProducer(object):
         payload_alarm_list_req = jsmin(open(os.path.join(json_path,
                                       'list_alarm_req.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_alarm_list_req),
                 topic='alarm_request')
 
@@ -125,8 +125,8 @@ class KafkaProducer(object):
         payload_notify_alarm = jsmin(open(os.path.join(json_path,
                                           'notify_alarm.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_notify_alarm),
+        self.publish(key,
+                value=message,
                 topic='alarm_response')
 
     def list_alarm_response(self, key, message, topic):
@@ -134,8 +134,8 @@ class KafkaProducer(object):
         payload_list_alarm_resp = jsmin(open(os.path.join(json_path,
                                              'list_alarm_resp.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_list_alarm_resp),
+        self.publish(key,
+                value=message,
                 topic='alarm_response')
 
 
@@ -146,7 +146,7 @@ class KafkaProducer(object):
         payload_update_alarm_req = jsmin(open(os.path.join(json_path,
                                         'update_alarm_req.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_update_alarm_req),
                 topic='alarm_request')
 
@@ -158,8 +158,8 @@ class KafkaProducer(object):
         payload_update_alarm_resp = jsmin(open(os.path.join(json_path,
                                         'update_alarm_resp.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_update_alarm_resp),
+        self.publish(key,
+                value=message,
                 topic='alarm_response')
 
 
@@ -170,7 +170,7 @@ class KafkaProducer(object):
         payload_delete_alarm_req = jsmin(open(os.path.join(json_path,
                                         'delete_alarm_req.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_delete_alarm_req),
                 topic='alarm_request')
 
@@ -181,8 +181,8 @@ class KafkaProducer(object):
         payload_delete_alarm_resp = jsmin(open(os.path.join(json_path,
                                                'delete_alarm_resp.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_delete_alarm_resp),
+        self.publish(key,
+                value=message,
                 topic='alarm_response')
 
 
@@ -194,7 +194,7 @@ class KafkaProducer(object):
         payload_create_metrics_req = jsmin(open(os.path.join(json_path,
                                                 'create_metric_req.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_create_metrics_req),
                 topic='metric_request')
 
@@ -206,8 +206,8 @@ class KafkaProducer(object):
         payload_create_metrics_resp = jsmin(open(os.path.join(json_path,
                                                  'create_metric_resp.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_create_metrics_resp),
+        self.publish(key,
+                value=message,
                 topic='metric_response')
 
 
@@ -218,7 +218,7 @@ class KafkaProducer(object):
         payload_read_metric_data_request = jsmin(open(os.path.join(json_path,
                                                       'read_metric_data_req.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_read_metric_data_request),
                 topic='metric_request')
 
@@ -230,8 +230,8 @@ class KafkaProducer(object):
         payload_metric_data_response = jsmin(open(os.path.join(json_path,
                                                   'read_metric_data_resp.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_metric_data_response),
+        self.publish(key,
+                value=message,
                 topic='metric_response')
 
 
@@ -242,7 +242,7 @@ class KafkaProducer(object):
         payload_metric_list_req = jsmin(open(os.path.join(json_path,
                                              'list_metric_req.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_metric_list_req),
                 topic='metric_request')
 
@@ -253,8 +253,8 @@ class KafkaProducer(object):
         payload_metric_list_resp = jsmin(open(os.path.join(json_path,
                                               'list_metrics_resp.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_metric_list_resp),
+        self.publish(key,
+                value=message,
                 topic='metric_response')
 
 
@@ -265,7 +265,7 @@ class KafkaProducer(object):
         payload_delete_metric_req = jsmin(open(os.path.join(json_path,
                                                'delete_metric_req.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_delete_metric_req),
                 topic='metric_request')
 
@@ -277,8 +277,8 @@ class KafkaProducer(object):
         payload_delete_metric_resp = jsmin(open(os.path.join(json_path,
                                                 'delete_metric_resp.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_delete_metric_resp),
+        self.publish(key,
+                value=message,
                 topic='metric_response')
 
 
@@ -289,7 +289,7 @@ class KafkaProducer(object):
         payload_update_metric_req = jsmin(open(os.path.join(json_path,
                                                'update_metric_req.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_update_metric_req),
                 topic='metric_request')
 
@@ -301,8 +301,8 @@ class KafkaProducer(object):
         payload_update_metric_resp = jsmin(open(os.path.join(json_path,
                                                 'update_metric_resp.json')).read())
 
-        publish(key,
-                value=json.dumps(payload_update_metric_resp),
+        self.publish(key,
+                value=message,
                 topic='metric_response')
 
     def access_credentials(self, key, message, topic):
@@ -310,6 +310,6 @@ class KafkaProducer(object):
         payload_access_credentials = jsmin(open(os.path.join(json_path,
                                                 'access_credentials.json')).read())
 
-        publish(key,
+        self.publish(key,
                 value=json.dumps(payload_access_credentials),
                 topic='access_credentials')
index bef5d5b..f9886de 100644 (file)
   "schema_type": { "type": "string" },
   "metric_name": { "type": "string" },
   "metric_uuid": { "type": "string" },
-  "resource_uuid": { "type": "string" },
+  "resource_id": { "type": "string" },
   "tenant_uuid": { "type": "string" },
-  "correlation_uuid": { "type": "integer" },
+  "correlation_id": { "type": "integer" },
   "vim_type": { "type": "string" },
   "required": [ "schema_verion",
                 "schema_type",
                 "metric_name",
                 "metric_uuid",
                 "resource_uuid",
-                "correlation_uuid",
+                "correlation_id",
                 "vim_type" ]
 }
\ No newline at end of file
index 8d1bff8..9ec198c 100644 (file)
   "schema_version": { "type": "string" },
   "schema_type": { "type": "string" },
   "tenant_uuid": { "type": "string" },
-  "correlation_uuid": { "type": "integer" },
+  "correlation_id": { "type": "integer" },
   "vim_type": { "type": "string" },
   "metrics_list":
-    { 
-      "metric_name": { "type": "string" },
-      "metric_uuid": { "type": "string" },
-      "metric_unit": { "type": "string" },
-      "resource_uuid": { "type": "string" }
-    },
+    [{
+      "type": "array",
+      "properties":{
+        "metric_name": { "type": "string" },
+        "metric_uuid": { "type": "string" },
+        "metric_unit": { "type": "string" },
+        "resource_uuid": { "type": "string" }
+      }
+    }],
     "required": [ "schema_version",
                   "schema_type",
-                  "correlation_uuid",
+                  "correlation_id",
                   "vim_type",
                   "metric_name",
                   "metric_uuid",
index 873d300..b4e3d62 100644 (file)
@@ -26,7 +26,7 @@
   "metric_uuid": { "type": "string" },
   "resource_uuid": { "type": "string" },
   "tenant_uuid": { "type": "string" },
-  "correlation_uuid": { "type": "integer" },
+  "correlation_id": { "type": "integer" },
   "vim_type": { "type": "string" },
   "collection_period": { "type": "integer" },
   "collection_unit": { "type": "string" },
@@ -34,7 +34,7 @@
                "schema_type",
                "metric_name",
                "metric_uuid",
-               "correlation_uuid",
+               "correlation_id",
                "vim_type",
                "collection_period",
                "collection_unit",
diff --git a/devops-stages/.gitkeep b/devops-stages/.gitkeep
deleted file mode 100644 (file)
index 2272ebb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#gitkeep file to keep the initial empty directory structure.
diff --git a/devops_stages/.gitkeep b/devops_stages/.gitkeep
new file mode 100644 (file)
index 0000000..2272ebb
--- /dev/null
@@ -0,0 +1 @@
+#gitkeep file to keep the initial empty directory structure.
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..8c4be88
--- /dev/null
@@ -0,0 +1,15 @@
+MySQL-python
+requests
+loguitls
+cherrypy
+jsmin
+jsonschema
+python-openstackclient
+python-novaclient
+python-keystoneclient
+python-neutronclient
+python-aodhclient
+python-gnocchi client
+boto3
+python-cloudwatchlogs-logging
+py-cloudwatch