From: prithiv Date: Wed, 13 Sep 2017 16:04:14 +0000 (+0100) Subject: Updated producer and schemas based on the new schema changes. X-Git-Tag: v4.0.0~90 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=18ca918d9eea2991cc5956b2d7e5820993681041;p=osm%2FMON.git Updated producer and schemas based on the new schema changes. - New schema changes - Producer incorporated new changes Signed-off-by: prithiv --- diff --git a/core/message_bus/consumer.py b/core/message_bus/consumer.py new file mode 100644 index 0000000..8427076 --- /dev/null +++ b/core/message_bus/consumer.py @@ -0,0 +1,90 @@ +# Copyright 2017 Intel Research and Development Ireland Limited +# ************************************************************* + +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com +## + +''' +This is a kafka consumer app that reads the messages from the message bus for +alarms and metrics responses. + +''' + +__author__ = "Prithiv Mohan" +__date__ = "06/Sep/2017" + + +from kafka import KafkaConsumer +from kafka.errors import KafkaError +import json +import logging +import logging.config +import os + +def logging_handler(filename, mode='a+', encoding=None): + if not os.path.exists(filename): + open(filename, 'a').close() + return logging.FileHandler(filename, mode) + +log_config = { + 'version': 1, + 'formatters': { + 'default': { + 'format': '%(asctime)s %(levelname)s %(name)s %(message)s' + }, + }, + 'handlers': { + 'file':{ + '()': logging_handler, + 'level':'DEBUG', + 'formatter': 'default', + 'filename': '/var/log/osm_mon.log', + 'mode': 'a+', + 'encoding': 'utf-8', + }, + }, + 'kafka': { + 'handlers': ['file'], + 'level': 'DEBUG', + }, + 'root': { + 'handlers': ['file'], + 'level': 'DEBUG', + }, +} + + +logging.config.dictConfig(log_config) +logger = logging.getLogger('kafka') + + + +alarm_consumer = KafkaConsumer('alarm_response', 'osm_mon', bootstrap_servers = 'localhost:9092') +metric_consumer = KafkaConsumer('metric_response', 'osm_mon', bootstrap_servers = 'localhost:9092') +try: + for message in alarm_consumer: + logger.debug(message) + for message in metric_consumer: + logger.debug(message) +except KafkaError: + log.exception() + pass + +alarm_consumer.subscribe('alarm_response') +metric_consumer.subscribe('metric_response') diff --git a/core/message_bus/northbound_consumer.py b/core/message_bus/northbound_consumer.py deleted file mode 100644 index e8ebdae..0000000 --- a/core/message_bus/northbound_consumer.py +++ /dev/null @@ -1,62 +0,0 @@ - -# Copyright© 2017 Intel Research and Development Ireland Limited -# ************************************************************* - -# This file is part of OSM Monitoring module -# All Rights Reserved to Intel Corporation - -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# For those usages not covered by the Apache License, Version 2.0 please -# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com -## - -''' -This is a kafka consumer app that reads the messages from the message bus for -alarms and metrics responses. - -#TODO: (Prithiv Mohan) - - Modify topics based on new schema definitions - - Include consumer logging -''' - -__author__ = "Prithiv Mohan" -__date__ = "06/Sep/2017" - -from kafka import KafkaConsumer -from kafka.errors import KafkaError -import logging - -class KafkaConsumer(object): - """Adds messages to a kafka topic. Topic is hardcoded as 'alarms' and group as - 'my_group' for now. - - """ - - def __init__(self, uri): - """Init - - uri - kafka connection details - """ - if not cfg.CONF.kafka.uri: - raise Exception("Kafka URI Not Found. Check the config file for Kafka URI") - else: - broker = cfg.CONF.kafka.uri - consumer = KafkaConsumer('alarms', - group_id='my_group', - bootstrap_servers=broker, api_version=(0,10)) - #KafkaConsumer(value_deserializer=lambda m: json.loads(m.decode('ascii'))) - - def consume(self, topic, messages): - for message in self._consumer: - print ("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition, message.offset, message.key, message.value)) diff --git a/core/message_bus/producer.py b/core/message_bus/producer.py index 621d63f..07742e2 100644 --- a/core/message_bus/producer.py +++ b/core/message_bus/producer.py @@ -1,4 +1,4 @@ -# Copyright© 2017 Intel Research and Development Ireland Limited +# Copyright 2017 Intel Research and Development Ireland Limited # ************************************************************* # This file is part of OSM Monitoring module @@ -23,7 +23,6 @@ ''' This is a kafka producer app that interacts with the SO and the plugins of the datacenters like OpenStack, VMWare, AWS. -#TODO: Interfacing with the APIs of the monitoring tool plugins (Prithiv Mohan). ''' __author__ = "Prithiv Mohan" @@ -34,17 +33,16 @@ from kafka import KafkaProducer from kafka.errors import KafkaError import logging import json +import jsmin import os from os import listdir - - +from jsmin import jsmin class KafkaProducer(object): - def __init__(self, topic, message): + def __init__(self, topic): self._topic= topic - self._message = message if "ZOOKEEPER_URI" in os.environ: broker = os.getenv("ZOOKEEPER_URI") @@ -64,7 +62,7 @@ class KafkaProducer(object): def publish(self, key, message, topic=None): try: - future = producer.send('alarms', key, payload) + future = producer.send('key', 'payload',group_id='osm_mon') producer.flush() except Exception: log.exception("Error publishing to {} topic." .format(topic)) @@ -83,7 +81,7 @@ class KafkaProducer(object): #External to MON - payload_create_alarm = json.loads(open(os.path.join(json_path, + payload_create_alarm = jsmin(open(os.path.join(json_path, 'create_alarm.json')).read()) publish(key, value=json.dumps(payload_create_alarm), @@ -93,19 +91,29 @@ class KafkaProducer(object): #Internal to MON - payload_create_alarm_resp = json.loads(open(os.path.join(json_path, + 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), topic = 'alarm_response') + def acknowledge_alarm(self, key, message, topic): + + #Internal to MON + + payload_acknowledge_alarm = jsmin(open(os.path.join(json_path, + 'acknowledge_alarm.json')).read()) + + publish(key, + value = json.dumps(payload_acknowledge_alarm), + topic = 'alarm_request') def list_alarm_request(self, key, message, topic): #External to MON - payload_alarm_list_req = json.loads(open(os.path.join(json_path, + payload_alarm_list_req = jsmin(open(os.path.join(json_path, 'list_alarm_req.json')).read()) publish(key, @@ -114,7 +122,7 @@ class KafkaProducer(object): def notify_alarm(self, key, message, topic): - payload_notify_alarm = json.loads(open(os.path.join(json_path, + payload_notify_alarm = jsmin(open(os.path.join(json_path, 'notify_alarm.json')).read()) publish(key, @@ -123,7 +131,7 @@ class KafkaProducer(object): def list_alarm_response(self, key, message, topic): - payload_list_alarm_resp = json.loads(open(os.path.join(json_path, + payload_list_alarm_resp = jsmin(open(os.path.join(json_path, 'list_alarm_resp.json')).read()) publish(key, @@ -135,7 +143,7 @@ class KafkaProducer(object): # External to Mon - payload_update_alarm_req = json.loads(open(os.path.join(json_path, + payload_update_alarm_req = jsmin(open(os.path.join(json_path, 'update_alarm_req.json')).read()) publish(key, @@ -147,7 +155,7 @@ class KafkaProducer(object): # Internal to Mon - payload_update_alarm_resp = json.loads(open(os.path.join(json_path, + payload_update_alarm_resp = jsmin(open(os.path.join(json_path, 'update_alarm_resp.json')).read()) publish(key, @@ -159,7 +167,7 @@ class KafkaProducer(object): # External to Mon - payload_delete_alarm_req = json.loads(open(os.path.join(json_path, + payload_delete_alarm_req = jsmin(open(os.path.join(json_path, 'delete_alarm_req.json')).read()) publish(key, @@ -170,7 +178,7 @@ class KafkaProducer(object): # Internal to Mon - payload_delete_alarm_resp = json.loads(open(os.path.join(json_path, + payload_delete_alarm_resp = jsmin(open(os.path.join(json_path, 'delete_alarm_resp.json')).read()) publish(key, @@ -183,7 +191,7 @@ class KafkaProducer(object): # External to Mon - payload_create_metrics_req = json.loads(open(os.path.join(json_path, + payload_create_metrics_req = jsmin(open(os.path.join(json_path, 'create_metric_req.json')).read()) publish(key, @@ -195,7 +203,7 @@ class KafkaProducer(object): # Internal to Mon - payload_create_metrics_resp = json.loads(open(os.path.join(json_path, + payload_create_metrics_resp = jsmin(open(os.path.join(json_path, 'create_metric_resp.json')).read()) publish(key, @@ -207,7 +215,7 @@ class KafkaProducer(object): # External to Mon - payload_read_metric_data_request = json.loads(open(os.path.join(json_path, + payload_read_metric_data_request = jsmin(open(os.path.join(json_path, 'read_metric_data_req.json')).read()) publish(key, @@ -219,7 +227,7 @@ class KafkaProducer(object): # Internal to Mon - payload_metric_data_response = json.loads(open(os.path.join(json_path, + payload_metric_data_response = jsmin(open(os.path.join(json_path, 'read_metric_data_resp.json')).read()) publish(key, @@ -231,7 +239,7 @@ class KafkaProducer(object): #External to MON - payload_metric_list_req = json.loads(open(os.path.join(json_path, + payload_metric_list_req = jsmin(open(os.path.join(json_path, 'list_metric_req.json')).read()) publish(key, @@ -242,7 +250,7 @@ class KafkaProducer(object): #Internal to MON - payload_metric_list_resp = json.loads(open(os.path.join(json_path, + payload_metric_list_resp = jsmin(open(os.path.join(json_path, 'list_metrics_resp.json')).read()) publish(key, @@ -254,7 +262,7 @@ class KafkaProducer(object): # External to Mon - payload_delete_metric_req = json.loads(open(os.path.join(json_path, + payload_delete_metric_req = jsmin(open(os.path.join(json_path, 'delete_metric_req.json')).read()) publish(key, @@ -266,7 +274,7 @@ class KafkaProducer(object): # Internal to Mon - payload_delete_metric_resp = json.loads(open(os.path.join(json_path, + payload_delete_metric_resp = jsmin(open(os.path.join(json_path, 'delete_metric_resp.json')).read()) publish(key, @@ -278,7 +286,7 @@ class KafkaProducer(object): # External to Mon - payload_update_metric_req = json.loads(open(os.path.join(json_path, + payload_update_metric_req = jsmin(open(os.path.join(json_path, 'update_metric_req.json')).read()) publish(key, @@ -290,16 +298,16 @@ class KafkaProducer(object): # Internal to Mon - payload_update_metric_resp = json.loads(open(os.path.join(json_path, + 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), - topic='metric_response) + topic='metric_response') def access_credentials(self, key, message, topic): - payload_access_credentials = json.loads(open(os.path.join(json_path, + payload_access_credentials = jsmin(open(os.path.join(json_path, 'access_credentials.json')).read()) publish(key, diff --git a/core/models/acknowledge_alarm.json b/core/models/acknowledge_alarm.json index ba6a1e4..bc3183b 100644 --- a/core/models/acknowledge_alarm.json +++ b/core/models/acknowledge_alarm.json @@ -1,17 +1,39 @@ -{ + +/* Copyright© 2017 Intel Research and Development Ireland Limited +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + +# This is the message bus schema for acknowledge_alarm */ + +{ "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, + "vim_type": { "type": "string" }, "ack_details": { "alarm_uuid": { "type": "string" }, "resource_uuid": { "type": "string" }, - "tenant_uuid": { "type": "string" }, - "vim_type": { "type": "string" } + "tenant_uuid": { "type": "string" } }, "required": [ "schema_version", "schema_type", + "vim_type", "alarm_uuid", "resource_uuid", - "tenant_uuid", - "vim_type" ] + "tenant_uuid" ] } \ No newline at end of file diff --git a/core/models/create_alarm.json b/core/models/create_alarm.json index 190ad1d..4174061 100644 --- a/core/models/create_alarm.json +++ b/core/models/create_alarm.json @@ -1,13 +1,35 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + +# This is the message bus schema to create_alarm */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, + "vim_type": { "type": "string "}, "alarm_create_request": { "correlation_id": { "type": "integer" }, "alarm_name": { "type": "string" }, + "metric_name": { "type": "string" }, "tenant_uuid": { "type": "string" }, "resource_uuid": { "type": "string" }, - "vim_type": { "type": "string" }, "description": { "type": "string" }, "severity": { "type": "string" }, "operation": { "type": "string" }, @@ -17,10 +39,11 @@ }, "required": [ "schema_version", "schema_type", + "vim_type", "correlation_id", "alarm_name", + "metric_name", "resource_uuid", - "vim_type", "severity", "operation", "threshold_value", diff --git a/core/models/create_alarm_resp.json b/core/models/create_alarm_resp.json index 4b672bc..95a125d 100644 --- a/core/models/create_alarm_resp.json +++ b/core/models/create_alarm_resp.json @@ -1,3 +1,24 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema for create_alarm response */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, @@ -8,8 +29,8 @@ "status": { "type": "boolean" } }, "required": [ "schema_version", - "schema_type", - "correlation_id", - "alarm_uuid", - "status" ] + "schema_type", + "correlation_id", + "alarm_uuid", + "status" ] } diff --git a/core/models/create_metric_req.json b/core/models/create_metric_req.json index 1e8f8b1..b88189a 100644 --- a/core/models/create_metric_req.json +++ b/core/models/create_metric_req.json @@ -1,12 +1,34 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema to create_metric */ + + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, "tenant_uuid": { "type": "string" }, "correlation_id": { "type": "integer" }, "vim_type": { "type": "string" }, - "metrics_configuration": + "metric_create": { - "metric_uuid": { "type": "string" }, + "metric_name": { "type" : "string" }, "metric_unit": { "type": "string" }, "resource_uuid": { "type": "string" } }, diff --git a/core/models/create_metric_resp.json b/core/models/create_metric_resp.json index c8908b7..882c496 100644 --- a/core/models/create_metric_resp.json +++ b/core/models/create_metric_resp.json @@ -1,8 +1,29 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema for create_metric response*/ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, "correlation_id": { "type": "integer" }, - "metrics_create_response": + "metric_create_response": { "metric_uuid": { "type": "string" }, "resource_uuid": { "type": "string" }, diff --git a/core/models/delete_alarm_req.json b/core/models/delete_alarm_req.json index b501f93..c722990 100644 --- a/core/models/delete_alarm_req.json +++ b/core/models/delete_alarm_req.json @@ -1,15 +1,37 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema to delete_alarm */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, + "vim_type": { "type": "string" }, "alarm_delete_request": { "alarm_uuid": { "type": "string" }, - "correlation_id": { "type": "integer" }, - "vim_type": { "type": "string" } + "correlation_id": { "type": "integer" } }, "required": [ "schema_version", "schema_type", + "vim_type", "alarm_uuid", - "correlation_id", - "vim_type" ] + "correlation_id" + ] } diff --git a/core/models/delete_alarm_resp.json b/core/models/delete_alarm_resp.json index 7bd8c0b..f9b90b3 100644 --- a/core/models/delete_alarm_resp.json +++ b/core/models/delete_alarm_resp.json @@ -1,3 +1,23 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + This is the message bus schema for delete_metric_response */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, diff --git a/core/models/delete_metric_req.json b/core/models/delete_metric_req.json index ea1b9de..bef5d5b 100644 --- a/core/models/delete_metric_req.json +++ b/core/models/delete_metric_req.json @@ -1,3 +1,24 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema to delete_metric */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, @@ -12,7 +33,6 @@ "metric_name", "metric_uuid", "resource_uuid", - "tenant_uuid", "correlation_uuid", "vim_type" ] } \ No newline at end of file diff --git a/core/models/delete_metric_resp.json b/core/models/delete_metric_resp.json index fc2e32c..741dba0 100644 --- a/core/models/delete_metric_resp.json +++ b/core/models/delete_metric_resp.json @@ -1,3 +1,24 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema for delete_metric_response */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, @@ -6,11 +27,12 @@ "resource_uuid": { "type": "string" }, "tenant_uuid": { "type": "string" }, "correlation_id": { "type": "integer" }, + "status": { "type": "boolean" }, "required": [ "schema_version", "schema_type", "metric_name", "metric_uuid", "resource_uuid", - "tenant_uuid", + "status", "correlation_id" ] } diff --git a/core/models/list_alarm_req.json b/core/models/list_alarm_req.json index 92a02b8..0efe49b 100644 --- a/core/models/list_alarm_req.json +++ b/core/models/list_alarm_req.json @@ -1,17 +1,39 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited +# This file is part of OSM Monitoring module +# All Rights Reserved to Intel Corporation + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# For those usages not covered by the Apache License, Version 2.0 please +# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + +# This is the message bus schema to list_alarm */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, + "vim_type": { "type": "string" }, "alarm_list_request": { "correlation_id": { "type": "integer" }, "resource_uuid": { "type": "string" }, "alarm_name": { "type": "string" }, - "vim_type": { "type": "string" }, "severity": { "type" : "string" } }, "required": [ "schema_version", "schema_type", + "vim_type", "correlation_id", - "vim_type" + "resource_uuid" ] } \ No newline at end of file diff --git a/core/models/list_alarm_resp.json b/core/models/list_alarm_resp.json index 62f2f1f..2ccd705 100644 --- a/core/models/list_alarm_resp.json +++ b/core/models/list_alarm_resp.json @@ -1,5 +1,26 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema for list_alarm response */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, - "list_alarm_resp": { "type": "array" } + "list_alarm_resp": { "$ref": "definitions.json#/notify_details" } } \ No newline at end of file diff --git a/core/models/list_metric_req.json b/core/models/list_metric_req.json index 83f09bc..bda8def 100644 --- a/core/models/list_metric_req.json +++ b/core/models/list_metric_req.json @@ -1,17 +1,37 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema to list_metric */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, + "vim_type": { "type": "string" }, "metrics_list_request": { "metric_name": { "type": "string" }, "correlation_id": { "type": "integer" }, - "resource_uuid": { "type": "string" }, - "vim_type": { "type": "string" } + "resource_uuid": { "type": "string" } }, "required": [ "schema_version", "schema_type", - "metric_name", - "correlation_id", - "resource_uuid", - "vim_type"] + "vim_type", + "correlation_id" + ] } \ No newline at end of file diff --git a/core/models/list_metric_resp.json b/core/models/list_metric_resp.json index 09e13d8..8d1bff8 100644 --- a/core/models/list_metric_resp.json +++ b/core/models/list_metric_resp.json @@ -1,23 +1,43 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema for list_metric response */ + { -"schema_version": { "type": "string" }, -"schema_type": { "type", "string" }, -"tenant_uuid": { "type": "string" }, -"correlation_uuid": { "type": "string" }, -"vim_type": { "type": "string" }, -"metrics_list": - { - "metric_name": { "type": "string" }, - "metric_uuid": { "type": "string" }, - "metric_unit": { "type": "string" }, - "resource_uuid": { "type": "string" } - }, - "required": [ "schema_version", - "schema_type", - "tenant_uuid", - "correlation_uuid", - "vim_type", - "metric_name", - "metric_uuid", - "metric_unit", - "resource_uuid" ] + "schema_version": { "type": "string" }, + "schema_type": { "type": "string" }, + "tenant_uuid": { "type": "string" }, + "correlation_uuid": { "type": "integer" }, + "vim_type": { "type": "string" }, + "metrics_list": + { + "metric_name": { "type": "string" }, + "metric_uuid": { "type": "string" }, + "metric_unit": { "type": "string" }, + "resource_uuid": { "type": "string" } + }, + "required": [ "schema_version", + "schema_type", + "correlation_uuid", + "vim_type", + "metric_name", + "metric_uuid", + "metric_unit", + "resource_uuid" ] } \ No newline at end of file diff --git a/core/models/notify_alarm.json b/core/models/notify_alarm.json index e209caf..52f3107 100644 --- a/core/models/notify_alarm.json +++ b/core/models/notify_alarm.json @@ -1,26 +1,49 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema to notify_alarm */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, - "notify_details": + "definitions": { - "alarm_uuid": { "type": "string" }, - "resource_uuid": { "type": "string" }, - "description": { "type": "string" }, - "tenant_uuid": { "type": "string" }, - "vim_type": { "type": "string" }, - "severity": { "type" : ["integer", "string"] }, - "status": { "type": "string" }, - "start_date": { "type": "date-time" }, - "update_date": { "type": "date-time" }, - "cancel_date": { "type": "date-time" } - }, - "required": [ "schema_version", - "schema_type", - "alarm_uuid", - "resource_uuid", - "tenant_uuid", - "vim_type", - "severity", - "status", - "start_date" ] + "notify_details": + { + "alarm_uuid": { "type": "string" }, + "resource_uuid": { "type": "string" }, + "description": { "type": "string" }, + "tenant_uuid": { "type": "string" }, + "vim_type": { "type": "string" }, + "severity": { "type" : "string" }, + "status": { "type": "string" }, + "start_date": { "type": "string" }, + "update_date": { "type": "string" }, + "cancel_date": { "type": "string" } + }, + "required": [ "schema_version", + "schema_type", + "alarm_uuid", + "resource_uuid", + "vim_type", + "severity", + "status", + "start_date" ] + } } \ No newline at end of file diff --git a/core/models/read_metric_data_req.json b/core/models/read_metric_data_req.json index b07c610..873d300 100644 --- a/core/models/read_metric_data_req.json +++ b/core/models/read_metric_data_req.json @@ -1,20 +1,42 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema to read_metric_data */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, "metric_name": { "type": "string" }, - "metric_uuid": { "type": "String" }, + "metric_uuid": { "type": "string" }, "resource_uuid": { "type": "string" }, "tenant_uuid": { "type": "string" }, - "correlation_uuid": { "type": "string" }, + "correlation_uuid": { "type": "integer" }, "vim_type": { "type": "string" }, - "collection_period": { "type": "string" }, + "collection_period": { "type": "integer" }, + "collection_unit": { "type": "string" }, "required": ["schema_version", "schema_type", - "tenant_uuid", "metric_name", "metric_uuid", "correlation_uuid", "vim_type", "collection_period", + "collection_unit", "resource_uuid"] } diff --git a/core/models/read_metric_data_resp.json b/core/models/read_metric_data_resp.json index 0d5b31b..43f809f 100644 --- a/core/models/read_metric_data_resp.json +++ b/core/models/read_metric_data_resp.json @@ -1,23 +1,61 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema for read_metric_data response */ + { "schema_version": { "type": "string" }, - "schema_type": "metric_data_response", - "metrics_name": { "type": "string" }, + "schema_type": {"type": "string" }, + "metric_name": { "type": "string" }, "metric_uuid": { "type": "string" }, "correlation_id": { "type": "integer" }, "resource_uuid": { "type": "string" }, "tenant_uuid": { "type": "string" }, "metrics_data": { - "time_series": { "type": "array" }, - "metrics_series": { "type": "array" }, - "unit": { "type": "string" } + "time_series": [{ + "type": "array", + "properties": + { "time_stamp": + { "type": "integer" }}} + ] }, + "metrics_series": [{ + "type": "array", + "properties": + { "data": + { "type": + ["integer", + "string", + "decimal" + ] + } + } + } + ], + "unit": { "type": "string" }, "required": [ "schema_version", "schema_type", "metric_name", "metric_uuid", "resource_uuid", - "tenant_uuid", + "correlation_id", "time_series", "metrics_series" ] } diff --git a/core/models/update_alarm_req.json b/core/models/update_alarm_req.json index 65188cb..2f19a35 100644 --- a/core/models/update_alarm_req.json +++ b/core/models/update_alarm_req.json @@ -1,11 +1,33 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema to update_alarm */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, + "vim_type": { "type": "string" }, "alarm_update_request": { - "alarm_uuid": { "type": "string" }, "correlation_id": { "type": "integer" }, - "vim_type": { "type": "string" }, + "alarm_uuid": { "type": "string" }, + "metric_uuid": { "type": "string" }, "description": { "type": "string" }, "severity": { "type": "string" }, "operation": { "type": "string" }, @@ -15,7 +37,8 @@ }, "required": [ "schema_version", "scema_type", + "vim_type", "correlation_id", - "alarm_uuid", - "vim_type" ] + "alarm_uuid", + "metric_uuid" ] } diff --git a/core/models/update_alarm_resp.json b/core/models/update_alarm_resp.json index 0deecb0..ea76fa3 100644 --- a/core/models/update_alarm_resp.json +++ b/core/models/update_alarm_resp.json @@ -1,3 +1,24 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema for update_alarm response */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, diff --git a/core/models/update_metric_req.json b/core/models/update_metric_req.json index e19ee87..71d4f82 100644 --- a/core/models/update_metric_req.json +++ b/core/models/update_metric_req.json @@ -1,23 +1,40 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema for update_metric response */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" }, "tenant_uuid": { "type": "string" }, "correlation_id": { "type": "integer" }, "vim_type": { "type": "string" }, - "metric_update_request": + "metric_create": { "metric_name": { "type": "string" }, - "metric_uuid": { "type": "string" }, "metric_unit": { "type": "string" }, "resource_uuid": { "type": "string" } }, "required": [ "schema_version", "schema_type", - "tenant_uuid", "correlation_id", "vim_type", - "metric_name", - "metric_uuid", - "resource_uuid", - "metric_unit"] + "resource_uuid" + ] } \ No newline at end of file diff --git a/core/models/update_metric_resp.json b/core/models/update_metric_resp.json index 18a4945..90e0fa4 100644 --- a/core/models/update_metric_resp.json +++ b/core/models/update_metric_resp.json @@ -1,3 +1,24 @@ +/* Copyright© 2017 Intel Research and Development Ireland Limited + # This file is part of OSM Monitoring module + # All Rights Reserved to Intel Corporation + + # Licensed under the Apache License, Version 2.0 (the "License"); you may + # not use this file except in compliance with the License. You may obtain + # a copy of the License at + + # http://www.apache.org/licenses/LICENSE-2.0 + + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations + # under the License. + + # For those usages not covered by the Apache License, Version 2.0 please + # contact: prithiv.mohan@intel.com or adrian.hoban@intel.com + + # This is the message bus schema to update_metric */ + { "schema_version": { "type": "string" }, "schema_type": { "type": "string" },