From be693ab7ffe8da8f83feb02e2c967d02e5e3749c Mon Sep 17 00:00:00 2001 From: Idan Hefetz Date: Mon, 3 Jul 2017 08:39:03 +0000 Subject: [PATCH] New Tool- To generate numerous mock notifications. Can create large graph at any size Change-Id: Ia1e5943703b3c59535bfd8705c650ed0c2c10276 --- tools/__init__.py | 15 + tools/load_generator/__init__.py | 15 + tools/load_generator/computes.yaml | 515 +++++++++++++++++++++ tools/load_generator/load_generator.py | 146 ++++++ tools/load_generator/notification_info.py | 157 +++++++ tools/load_generator/templates/port_0.yaml | 84 ++++ tools/load_generator/templates/port_1.yaml | 84 ++++ tools/load_generator/templates/port_2.yaml | 84 ++++ tools/load_generator/templates/port_3.yaml | 84 ++++ tools/load_generator/templates/port_4.yaml | 84 ++++ tools/load_generator/templates/vm_0.yaml | 84 ++++ tools/load_generator/templates/vm_1.yaml | 84 ++++ tools/load_generator/templates/vm_2.yaml | 84 ++++ tools/load_generator/templates/vm_3.yaml | 84 ++++ tools/load_generator/templates/vm_4.yaml | 84 ++++ 15 files changed, 1688 insertions(+) create mode 100644 tools/__init__.py create mode 100644 tools/load_generator/__init__.py create mode 100644 tools/load_generator/computes.yaml create mode 100644 tools/load_generator/load_generator.py create mode 100644 tools/load_generator/notification_info.py create mode 100644 tools/load_generator/templates/port_0.yaml create mode 100644 tools/load_generator/templates/port_1.yaml create mode 100644 tools/load_generator/templates/port_2.yaml create mode 100644 tools/load_generator/templates/port_3.yaml create mode 100644 tools/load_generator/templates/port_4.yaml create mode 100644 tools/load_generator/templates/vm_0.yaml create mode 100644 tools/load_generator/templates/vm_1.yaml create mode 100644 tools/load_generator/templates/vm_2.yaml create mode 100644 tools/load_generator/templates/vm_3.yaml create mode 100644 tools/load_generator/templates/vm_4.yaml diff --git a/tools/__init__.py b/tools/__init__.py new file mode 100644 index 000000000..bf9f61d74 --- /dev/null +++ b/tools/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2017 - Nokia +# +# 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. + +__author__ = 'stack' diff --git a/tools/load_generator/__init__.py b/tools/load_generator/__init__.py new file mode 100644 index 000000000..bf9f61d74 --- /dev/null +++ b/tools/load_generator/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2017 - Nokia +# +# 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. + +__author__ = 'stack' diff --git a/tools/load_generator/computes.yaml b/tools/load_generator/computes.yaml new file mode 100644 index 000000000..6583e8feb --- /dev/null +++ b/tools/load_generator/computes.yaml @@ -0,0 +1,515 @@ +metadata: + name: computes + description: static datasource for test +definitions: + entities: + - static_id: c1 + type: nova.host + name: compute-0-1 + id: compute-0-1 + state: available + - static_id: c2 + type: nova.host + name: compute-0-2 + id: compute-0-2 + state: available + - static_id: c3 + type: nova.host + name: compute-0-3 + id: compute-0-3 + state: available + - static_id: c4 + type: nova.host + name: compute-0-4 + id: compute-0-4 + state: available + - static_id: c5 + type: nova.host + name: compute-0-5 + id: compute-0-5 + state: available + - static_id: c6 + type: nova.host + name: compute-0-6 + id: compute-0-6 + state: available + - static_id: c7 + type: nova.host + name: compute-0-7 + id: compute-0-7 + state: available + - static_id: c8 + type: nova.host + name: compute-0-8 + id: compute-0-8 + state: available + - static_id: c9 + type: nova.host + name: compute-0-9 + id: compute-0-9 + state: available + - static_id: c10 + type: nova.host + name: compute-0-10 + id: compute-0-10 + state: available + - static_id: c11 + type: nova.host + name: compute-0-11 + id: compute-0-11 + state: available + - static_id: c12 + type: nova.host + name: compute-0-12 + id: compute-0-12 + state: available + - static_id: c13 + type: nova.host + name: compute-0-13 + id: compute-0-13 + state: available + - static_id: c14 + type: nova.host + name: compute-0-14 + id: compute-0-14 + state: available + - static_id: c15 + type: nova.host + name: compute-0-15 + id: compute-0-15 + state: available + - static_id: c16 + type: nova.host + name: compute-0-16 + id: compute-0-16 + state: available + - static_id: c17 + type: nova.host + name: compute-0-17 + id: compute-0-17 + state: available + - static_id: c18 + type: nova.host + name: compute-0-18 + id: compute-0-18 + state: available + - static_id: c19 + type: nova.host + name: compute-0-19 + id: compute-0-19 + state: available + - static_id: c20 + type: nova.host + name: compute-0-20 + id: compute-0-20 + state: available + - static_id: c21 + type: nova.host + name: compute-0-21 + id: compute-0-21 + state: available + - static_id: c22 + type: nova.host + name: compute-0-22 + id: compute-0-22 + state: available + - static_id: c23 + type: nova.host + name: compute-0-23 + id: compute-0-23 + state: available + - static_id: c24 + type: nova.host + name: compute-0-24 + id: compute-0-24 + state: available + - static_id: c25 + type: nova.host + name: compute-0-25 + id: compute-0-25 + state: available + - static_id: c26 + type: nova.host + name: compute-0-26 + id: compute-0-26 + state: available + - static_id: c27 + type: nova.host + name: compute-0-27 + id: compute-0-27 + state: available + - static_id: c28 + type: nova.host + name: compute-0-28 + id: compute-0-28 + state: available + - static_id: c29 + type: nova.host + name: compute-0-29 + id: compute-0-29 + state: available + - static_id: c30 + type: nova.host + name: compute-0-30 + id: compute-0-30 + state: available + - static_id: c31 + type: nova.host + name: compute-0-31 + id: compute-0-31 + state: available + + - static_id: c32 + type: nova.host + name: compute-0-32 + id: compute-0-32 + state: available + - static_id: c33 + type: nova.host + name: compute-0-33 + id: compute-0-33 + state: available + - static_id: c34 + type: nova.host + name: compute-0-34 + id: compute-0-34 + state: available + - static_id: c35 + type: nova.host + name: compute-0-35 + id: compute-0-35 + state: available + - static_id: c36 + type: nova.host + name: compute-0-36 + id: compute-0-36 + state: available + - static_id: c37 + type: nova.host + name: compute-0-37 + id: compute-0-37 + state: available + - static_id: c38 + type: nova.host + name: compute-0-38 + id: compute-0-38 + state: available + - static_id: c39 + type: nova.host + name: compute-0-39 + id: compute-0-39 + state: available + - static_id: c40 + type: nova.host + name: compute-0-40 + id: compute-0-40 + state: available + - static_id: c41 + type: nova.host + name: compute-0-41 + id: compute-0-41 + state: available + - static_id: c42 + type: nova.host + name: compute-0-42 + id: compute-0-42 + state: available + - static_id: c43 + type: nova.host + name: compute-0-43 + id: compute-0-43 + state: available + - static_id: c44 + type: nova.host + name: compute-0-44 + id: compute-0-44 + state: available + - static_id: c45 + type: nova.host + name: compute-0-45 + id: compute-0-45 + state: available + - static_id: c46 + type: nova.host + name: compute-0-46 + id: compute-0-46 + state: available + - static_id: c47 + type: nova.host + name: compute-0-47 + id: compute-0-47 + state: available + - static_id: c48 + type: nova.host + name: compute-0-48 + id: compute-0-48 + state: available + - static_id: c49 + type: nova.host + name: compute-0-49 + id: compute-0-49 + state: available + - static_id: c50 + type: nova.host + name: compute-0-50 + id: compute-0-50 + state: available + - static_id: c51 + type: nova.host + name: compute-0-51 + id: compute-0-51 + state: available + - static_id: c52 + type: nova.host + name: compute-0-52 + id: compute-0-52 + state: available + - static_id: c53 + type: nova.host + name: compute-0-53 + id: compute-0-53 + state: available + - static_id: c54 + type: nova.host + name: compute-0-54 + id: compute-0-54 + state: available + - static_id: c55 + type: nova.host + name: compute-0-55 + id: compute-0-55 + state: available + - static_id: c56 + type: nova.host + name: compute-0-56 + id: compute-0-56 + state: available + - static_id: c57 + type: nova.host + name: compute-0-57 + id: compute-0-57 + state: available + - static_id: c58 + type: nova.host + name: compute-0-58 + id: compute-0-58 + state: available + - static_id: c59 + type: nova.host + name: compute-0-59 + id: compute-0-59 + state: available + - static_id: c60 + type: nova.host + name: compute-0-60 + id: compute-0-60 + state: available + - static_id: c61 + type: nova.host + name: compute-0-61 + id: compute-0-61 + state: available + - static_id: c62 + type: nova.host + name: compute-0-62 + id: compute-0-62 + state: available + - static_id: c63 + type: nova.host + name: compute-0-63 + id: compute-0-63 + state: available + - static_id: zone + type: nova.zone + name: nova + id: nova + relationships: + - source: zone + target: c1 + relationship_type: contains + - source: zone + target: c2 + relationship_type: contains + - source: zone + target: c3 + relationship_type: contains + - source: zone + target: c4 + relationship_type: contains + - source: zone + target: c5 + relationship_type: contains + - source: zone + target: c6 + relationship_type: contains + - source: zone + target: c7 + relationship_type: contains + - source: zone + target: c8 + relationship_type: contains + - source: zone + target: c9 + relationship_type: contains + - source: zone + target: c10 + relationship_type: contains + - source: zone + target: c11 + relationship_type: contains + - source: zone + target: c12 + relationship_type: contains + - source: zone + target: c13 + relationship_type: contains + - source: zone + target: c14 + relationship_type: contains + - source: zone + target: c15 + relationship_type: contains + - source: zone + target: c16 + relationship_type: contains + - source: zone + target: c17 + relationship_type: contains + - source: zone + target: c18 + relationship_type: contains + - source: zone + target: c19 + relationship_type: contains + - source: zone + target: c20 + relationship_type: contains + - source: zone + target: c21 + relationship_type: contains + - source: zone + target: c22 + relationship_type: contains + - source: zone + target: c23 + relationship_type: contains + - source: zone + target: c24 + relationship_type: contains + - source: zone + target: c25 + relationship_type: contains + - source: zone + target: c26 + relationship_type: contains + - source: zone + target: c27 + relationship_type: contains + - source: zone + target: c28 + relationship_type: contains + - source: zone + target: c29 + relationship_type: contains + - source: zone + target: c30 + relationship_type: contains + - source: zone + target: c31 + relationship_type: contains + - source: zone + target: c32 + relationship_type: contains + - source: zone + target: c33 + relationship_type: contains + - source: zone + target: c34 + relationship_type: contains + - source: zone + target: c35 + relationship_type: contains + - source: zone + target: c36 + relationship_type: contains + - source: zone + target: c37 + relationship_type: contains + - source: zone + target: c38 + relationship_type: contains + - source: zone + target: c39 + relationship_type: contains + - source: zone + target: c40 + relationship_type: contains + - source: zone + target: c41 + relationship_type: contains + - source: zone + target: c42 + relationship_type: contains + - source: zone + target: c43 + relationship_type: contains + - source: zone + target: c44 + relationship_type: contains + - source: zone + target: c45 + relationship_type: contains + - source: zone + target: c46 + relationship_type: contains + - source: zone + target: c47 + relationship_type: contains + - source: zone + target: c48 + relationship_type: contains + - source: zone + target: c49 + relationship_type: contains + - source: zone + target: c50 + relationship_type: contains + - source: zone + target: c51 + relationship_type: contains + - source: zone + target: c52 + relationship_type: contains + - source: zone + target: c53 + relationship_type: contains + - source: zone + target: c54 + relationship_type: contains + - source: zone + target: c55 + relationship_type: contains + - source: zone + target: c56 + relationship_type: contains + - source: zone + target: c57 + relationship_type: contains + - source: zone + target: c58 + relationship_type: contains + - source: zone + target: c59 + relationship_type: contains + - source: zone + target: c60 + relationship_type: contains + - source: zone + target: c61 + relationship_type: contains + - source: zone + target: c62 + relationship_type: contains + - source: zone + target: c63 + relationship_type: contains \ No newline at end of file diff --git a/tools/load_generator/load_generator.py b/tools/load_generator/load_generator.py new file mode 100644 index 000000000..4c170fde8 --- /dev/null +++ b/tools/load_generator/load_generator.py @@ -0,0 +1,146 @@ +# Copyright 2017 - Nokia +# +# 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. +import copy + +import sys + +from oslo_log import log +import oslo_messaging +from oslo_service import service as os_service +from tools.load_generator.notification_info import * # noqa +from vitrage.messaging import get_transport +from vitrage import service + + +LOG = log.getLogger(__name__) + +EXISTING_COMPUTES_NUM = 64 +VMS_PER_COMPUTE = 2 +NET_ID = '59fec1a4-7ab2-4bc6-8792-0ddf54b15dfe' +RUN_EVERY_X_SECONDS = 600 + +""" +Stress Notifications Tool: + +Following service runs a timed action every X seconds. +Action will send mock bus notifications, as configured in the constants above. +Sends mock notifications for: + VM create + Port create + volume create + volume attach + +1. To use this, place computes.yaml at /etc/vitrage/static_datasources/ + and restart vitrage-graph. +2. EXISTING_COMPUTES_NUM should match the computes defined in computes.yaml +3. Configure NET_ID to an existing network (this tool doesnt create networks) +4. Run 'python load_generator.py' + +Number of vms = VMS_PER_COMPUTE * EXISTING_COMPUTES_NUM +Number of ports = VMS_PER_COMPUTE * EXISTING_COMPUTES_NUM +Number of volumes = VMS_PER_COMPUTE * EXISTING_COMPUTES_NUM + +Notifications are sent repeatedly every RUN_EVERY_X_SECONDS, this is +to avoid Vitrage consistency deleting the created resources. + +* Folder /templates also includes templates to create load on the evaluator + +""" + + +class StressNotificationsService(os_service.Service): + def __init__(self, conf): + super(StressNotificationsService, self).__init__() + self.oslo_notifier = None + topic = conf.datasources.notification_topic + self.oslo_notifier = oslo_messaging.Notifier( + get_transport(conf), + driver='messagingv2', + publisher_id='vitrage.stress', + topics=[topic]) + + def start(self): + super(StressNotificationsService, self).start() + self.tg.add_timer(RUN_EVERY_X_SECONDS, self.stress_notifications, ) + LOG.info("StressNotificationsService - Started!") + + def stop(self, graceful=False): + super(StressNotificationsService, self).stop(graceful) + LOG.info("StressNotificationsService - Stopped!") + + def stress_notifications(self): + notifications = [] + for i in xrange(EXISTING_COMPUTES_NUM * VMS_PER_COMPUTE): + vm = create_vm(i, i % EXISTING_COMPUTES_NUM) + port = create_port(i, vm[0][1]['instance_id'], vm[0][1]['host'], + NET_ID) + storage = create_storage(i, vm[0][1]['instance_id']) + notifications.extend(vm) + notifications.extend(port) + notifications.extend(storage) + + LOG.info("Notifications Created - " + str(len(notifications))) + LOG.info("Sending...") + for n in notifications: + self._send(*n) + LOG.info("Sent!") + + def _send(self, notification_type, payload): + try: + self.oslo_notifier.info( + {}, + notification_type, + payload) + except Exception as e: + LOG.exception('Cannot notify - %s - %s', notification_type, e) + + +def create_port(port_num, instance_id, host_id, net_id): + payload = copy.deepcopy(PORT_CREATE_END) + payload['port']['id'] = 'StressPort-' + str(port_num) + payload['port']['device_id'] = instance_id + payload['port']['binding:host_id'] = host_id + payload['port']['network_id'] = net_id + return [('port.create.end', payload)] + + +def create_storage(volume_num, instance_id): + payload_1 = copy.deepcopy(VOLUME_CREATE_END) + payload_1['volume_id'] = 'StressVolume-' + str(volume_num) + + payload_2 = copy.deepcopy(VOLUME_ATTACH_END) + payload_2['volume_id'] = payload_1['volume_id'] + payload_2['volume_attachment'][0]['volume']['id'] = payload_1['volume_id'] + payload_2['volume_attachment'][0]['instance_uuid'] = instance_id + + return [('volume.create.end', payload_1), + ('volume.attach.end', payload_2)] + + +def create_vm(instance_num, compute_num): + payload = copy.deepcopy(COMPUTE_INSTANCE_CREATE_END) + payload['instance_id'] = 'StressVM-' + str(instance_num) + payload['node'] = payload['host'] = "compute-0-" + str(compute_num) + return [('compute.instance.create.end', payload)] + + +def main(): + conf = service.prepare_service() + launcher = os_service.ServiceLauncher(conf) + launcher.launch_service(StressNotificationsService(conf)) + launcher.wait() + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/load_generator/notification_info.py b/tools/load_generator/notification_info.py new file mode 100644 index 000000000..7c9fc9561 --- /dev/null +++ b/tools/load_generator/notification_info.py @@ -0,0 +1,157 @@ +# Copyright 2017 - Nokia +# +# 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. + +COMPUTE_INSTANCE_CREATE_END = { + "state_description": "", "availability_zone": "nova", "terminated_at": "", + "ephemeral_gb": 0, "instance_type_id": 11, "message": "Success", + "deleted_at": "", "reservation_id": "r-0yonac30", "memory_mb": 64, + "display_name": "YOY", "fixed_ips": [{ + "version": 4, "vif_mac": "fa:16:3e:a0:5c:40", "floating_ips": [], + "label": "NetA", "meta": {}, "address": "8.8.8.11", "type": "fixed"}], + "hostname": "yoy", "state": "active", "progress": "", + "launched_at": "2017-05-24T15:49:16.137248", "metadata": {}, + "node": "###", "ramdisk_id": "", "access_ip_v6": None, + "disk_gb": 0, "access_ip_v4": None, "kernel_id": "", + "host": "###", "user_id": "609544a5d1de4023b44bb71d624281ab", + "image_ref_url": "http://127.0.0.1:9292/images/", "cell_name": "", + "root_gb": 0, "tenant_id": "ef3f81058a934157b42454e3fc63c213", + "created_at": "2017-05-24 15:48:22+00:00", + "instance_id": "###", + "instance_type": "m1.nano", "vcpus": 1, "image_meta": { + "min_disk": "0", "container_format": "bare", "min_ram": "0", + "disk_format": "raw", "base_image_ref": ""}, + "architecture": None, "os_type": None, "instance_flavor_id": "42"} + +PORT_CREATE_END = {u'port': { + u'allowed_address_pairs': [], u'extra_dhcp_opts': [], + u'updated_at': u'2017-05-24T15:48:25Z', u'device_owner': u'compute:nova', + u'revision_number': 7, u'port_security_enabled': True, + u'binding:profile': {}, u'fixed_ips': [{ + u'subnet_id': u'bb5a20d0-07ea-4f01-89cb-ec9e7678cb84', + u'ip_address': u'8.8.8.11'}], + u'id': u'###', + u'security_groups': [u'2cd64353-05a7-43fa-abd7-8ba20c6b3326'], + u'binding:vif_details': {u'port_filter': True, u'ovs_hybrid_plug': True}, + u'binding:vif_type': u'ovs', u'mac_address': u'fa:16:3e:a0:5c:40', + u'project_id': u'ef3f81058a934157b42454e3fc63c213', u'status': u'DOWN', + u'binding:host_id': u'###', u'description': u'', u'tags': [], + u'device_id': u'###', u'name': u'', u'admin_state_up': True, + u'network_id': u'###', + u'tenant_id': u'ef3f81058a934157b42454e3fc63c213', + u'created_at': u'2017-05-24T15:48:24Z', u'binding:vnic_type': u'normal'}} + +VOLUME_CREATE_END = { + u'status': u'available', u'user_id': u'609544a5d1de4023b44bb71d624281ab', + u'display_name': u'ssssss', u'availability_zone': u'nova', + u'tenant_id': u'ef3f81058a934157b42454e3fc63c213', + u'created_at': u'2017-05-28T10:43:13+00:00', + u'volume_attachment': [], + u'volume_type': u'e8b50d6e-0bc3-47aa-b378-ac06e5917873', + u'host': u'compute-0-0@lvmdriver-1#lvmdriver-1', + u'snapshot_id': None, u'replication_status': None, + u'volume_id': u'###', + u'replication_extended_status': None, u'replication_driver_data': None, + u'size': 2, u'launched_at': u'2017-05-28T10:43:14.521562+00:00', + u'metadata': []} + +VOLUME_ATTACH_END = { + u'status': u'in-use', u'display_name': u'', u'availability_zone': u'nova', + u'tenant_id': u'ef3f81058a934157b42454e3fc63c213', + u'created_at': u'2017-05-28T10:40:21+00:00', + u'volume_attachment': [{ + u'instance_uuid': u'e9687e55-307b-4d1a-b57d-778cf52d78ee', + u'volume': { + u'migration_status': None, u'provider_id': None, + u'availability_zone': u'nova', u'terminated_at': None, + u'updated_at': u'2017-05-28T10:42:10.000000', + u'provider_geometry': None, u'replication_extended_status': None, + u'replication_status': None, u'snapshot_id': None, + u'ec2_id': None, u'deleted_at': None, + u'id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', u'size': 1, + u'user_id': u'609544a5d1de4023b44bb71d624281ab', + u'display_description': u'', u'cluster_name': None, + u'project_id': u'ef3f81058a934157b42454e3fc63c213', + u'launched_at': u'2017-05-28T10:42:05.000000', + u'scheduled_at': u'2017-05-28T10:40:23.000000', + u'status': u'in-use', + u'volume_type_id': u'e8b50d6e-0bc3-47aa-b378-ac06e5917873', + u'multiattach': False, u'deleted': False, + u'provider_location': u'127.0.0.1:3260,3 iqn.2010-10.org.openstac' + u'k:volume-5e41d178-4349-47aa-9be9-a9ee80cc' + u'dcc8 1', + u'host': u'compute-0-0@lvmdriver-1#lvmdriver-1', + u'consistencygroup_id': None, u'source_volid': None, + u'provider_auth': u'CHAP 5j3WZ6nHp6rYgh5u8HcJ P3Duwhx7ECUrSieo', + u'previous_status': None, u'display_name': u'', u'bootable': True, + u'created_at': u'2017-05-28T10:40:21.000000', + u'attach_status': u'attached', u'_name_id': None, + u'encryption_key_id': None, u'replication_driver_data': None, + u'group_id': None}, + u'attach_time': u'2017-05-28T10:42:10.000000', + u'deleted': False, u'attached_host': None, + u'created_at': u'2017-05-28T10:42:10.000000', u'attach_mode': u'rw', + u'updated_at': None, + u'attach_status': u'attached', u'detach_time': None, + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'mountpoint': u'/dev/vda', u'deleted_at': None, + u'id': u'935e0db2-956b-464f-af47-cadfb6ad9c2f'}], + u'volume_type': u'e8b50d6e-0bc3-47aa-b378-ac06e5917873', + u'host': u'compute-0-0@lvmdriver-1#lvmdriver-1', u'glance_metadata': [{ + u'deleted': False, u'created_at': u'2017-05-28T10:42:05.000000', + u'snapshot_id': None, u'updated_at': None, u'value': u'bare', + u'key': u'container_format', + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'deleted_at': None, u'id': 25}, { + u'deleted': False, + u'created_at': u'2017-05-28T10:42:05.000000', u'snapshot_id': None, + u'updated_at': None, u'value': u'0', u'key': u'min_ram', + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'deleted_at': None, u'id': 26}, { + u'deleted': False, u'created_at': u'2017-05-28T10:42:05.000000', + u'snapshot_id': None, u'updated_at': None, u'value': u'raw', + u'key': u'disk_format', + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'deleted_at': None, u'id': 27}, { + u'deleted': False, u'created_at': u'2017-05-28T10:42:05.000000', + u'snapshot_id': None, u'updated_at': None, u'value': u'TinyLinux', + u'key': u'image_name', + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'deleted_at': None, u'id': 28}, { + u'deleted': False, u'created_at': u'2017-05-28T10:42:05.000000', + u'snapshot_id': None, u'updated_at': None, + u'value': u'9a43d75b-d58c-45eb-8112-872db1ad18df', + u'key': u'image_id', + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'deleted_at': None, u'id': 29}, { + u'deleted': False, u'created_at': u'2017-05-28T10:42:05.000000', + u'snapshot_id': None, u'updated_at': None, + u'value': u'3b9c2d448424435f30d10e620c1f8392', u'key': u'checksum', + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'deleted_at': None, u'id': 30}, { + u'deleted': False, u'created_at': u'2017-05-28T10:42:05.000000', + u'snapshot_id': None, u'updated_at': None, u'value': u'0', + u'key': u'min_disk', + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'deleted_at': None, u'id': 31}, { + u'deleted': False, u'created_at': u'2017-05-28T10:42:05.000000', + u'snapshot_id': None, u'updated_at': None, u'value': u'19791872', + u'key': u'size', + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'deleted_at': None, u'id': 32}], + u'snapshot_id': None, u'replication_status': None, + u'volume_id': u'5e41d178-4349-47aa-9be9-a9ee80ccdcc8', + u'replication_extended_status': None, + u'user_id': u'609544a5d1de4023b44bb71d624281ab', u'size': 1, + u'launched_at': u'2017-05-28T10:42:05+00:00', + u'replication_driver_data': None, u'metadata': []} diff --git a/tools/load_generator/templates/port_0.yaml b/tools/load_generator/templates/port_0.yaml new file mode 100644 index 000000000..54b24ccde --- /dev/null +++ b/tools/load_generator/templates/port_0.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios port 0 + description: scenarios triggered by host nic fail on physical port 0 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 0 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem 0 + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: port + properties: + alarm_name: PORT network problem 0 + severity: critical + - action: + action_type: set_state + action_target: + target: port + properties: + state: SUBOPTIMAL + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance and alarm_on_port + actions: + - action: + action_type: add_causal_relationship + action_target: + source: instance_alarm + target: port_alarm + diff --git a/tools/load_generator/templates/port_1.yaml b/tools/load_generator/templates/port_1.yaml new file mode 100644 index 000000000..8073996e4 --- /dev/null +++ b/tools/load_generator/templates/port_1.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios port 1 + description: scenarios triggered by host nic fail on physical port 1 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 1 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem 1 + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: port + properties: + alarm_name: PORT network problem 1 + severity: critical + - action: + action_type: set_state + action_target: + target: port + properties: + state: SUBOPTIMAL + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance and alarm_on_port + actions: + - action: + action_type: add_causal_relationship + action_target: + source: instance_alarm + target: port_alarm + diff --git a/tools/load_generator/templates/port_2.yaml b/tools/load_generator/templates/port_2.yaml new file mode 100644 index 000000000..8acbc7f7b --- /dev/null +++ b/tools/load_generator/templates/port_2.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios port 2 + description: scenarios triggered by host nic fail on physical port 2 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 2 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem 2 + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: port + properties: + alarm_name: PORT network problem 2 + severity: critical + - action: + action_type: set_state + action_target: + target: port + properties: + state: SUBOPTIMAL + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance and alarm_on_port + actions: + - action: + action_type: add_causal_relationship + action_target: + source: instance_alarm + target: port_alarm + diff --git a/tools/load_generator/templates/port_3.yaml b/tools/load_generator/templates/port_3.yaml new file mode 100644 index 000000000..c182e6f84 --- /dev/null +++ b/tools/load_generator/templates/port_3.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios port 3 + description: scenarios triggered by host nic fail on physicalport 3 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 3 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem 3 + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: port + properties: + alarm_name: PORT network problem 3 + severity: critical + - action: + action_type: set_state + action_target: + target: port + properties: + state: SUBOPTIMAL + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance and alarm_on_port + actions: + - action: + action_type: add_causal_relationship + action_target: + source: instance_alarm + target: port_alarm + diff --git a/tools/load_generator/templates/port_4.yaml b/tools/load_generator/templates/port_4.yaml new file mode 100644 index 000000000..84a149769 --- /dev/null +++ b/tools/load_generator/templates/port_4.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios port 4 + description: scenarios triggered by host nic fail on physical port 4 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 4 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem 4 + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: port + properties: + alarm_name: PORT network problem 4 + severity: critical + - action: + action_type: set_state + action_target: + target: port + properties: + state: SUBOPTIMAL + - scenario: + condition: host_contains_instance and alarm_on_instance and port_attached_to_instance and alarm_on_port + actions: + - action: + action_type: add_causal_relationship + action_target: + source: instance_alarm + target: port_alarm + diff --git a/tools/load_generator/templates/vm_0.yaml b/tools/load_generator/templates/vm_0.yaml new file mode 100644 index 000000000..d1fb87845 --- /dev/null +++ b/tools/load_generator/templates/vm_0.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios vm 0 + description: scenarios triggered by host nic fail on physical vm 0 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 0 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: public_nic_fail_on_host and host_contains_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: instance + properties: + alarm_name: VM network problem 0 + severity: critical + - action: + action_type: set_state + action_target: + target: instance + properties: + state: SUBOPTIMAL + - scenario: + condition: public_nic_fail_on_host and host_contains_instance and alarm_on_instance + actions: + - action: + action_type: add_causal_relationship + action_target: + source: zabbix_alarm + target: instance_alarm + diff --git a/tools/load_generator/templates/vm_1.yaml b/tools/load_generator/templates/vm_1.yaml new file mode 100644 index 000000000..c779a9e47 --- /dev/null +++ b/tools/load_generator/templates/vm_1.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios vm 1 + description: scenarios triggered by host nic fail on physical vm 1 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 1 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: public_nic_fail_on_host and host_contains_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: instance + properties: + alarm_name: VM network problem 1 + severity: critical + - action: + action_type: set_state + action_target: + target: instance + properties: + state: SUBOPTIMAL + - scenario: + condition: public_nic_fail_on_host and host_contains_instance and alarm_on_instance + actions: + - action: + action_type: add_causal_relationship + action_target: + source: zabbix_alarm + target: instance_alarm + diff --git a/tools/load_generator/templates/vm_2.yaml b/tools/load_generator/templates/vm_2.yaml new file mode 100644 index 000000000..a8f44beeb --- /dev/null +++ b/tools/load_generator/templates/vm_2.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios vm 2 + description: scenarios triggered by host nic fail on physical vm 2 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 2 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: public_nic_fail_on_host and host_contains_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: instance + properties: + alarm_name: VM network problem 2 + severity: critical + - action: + action_type: set_state + action_target: + target: instance + properties: + state: SUBOPTIMAL + - scenario: + condition: public_nic_fail_on_host and host_contains_instance and alarm_on_instance + actions: + - action: + action_type: add_causal_relationship + action_target: + source: zabbix_alarm + target: instance_alarm + diff --git a/tools/load_generator/templates/vm_3.yaml b/tools/load_generator/templates/vm_3.yaml new file mode 100644 index 000000000..885dbcc9d --- /dev/null +++ b/tools/load_generator/templates/vm_3.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios vm 3 + description: scenarios triggered by host nic fail on physical vm 3 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 3 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: public_nic_fail_on_host and host_contains_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: instance + properties: + alarm_name: VM network problem 3 + severity: critical + - action: + action_type: set_state + action_target: + target: instance + properties: + state: SUBOPTIMAL + - scenario: + condition: public_nic_fail_on_host and host_contains_instance and alarm_on_instance + actions: + - action: + action_type: add_causal_relationship + action_target: + source: zabbix_alarm + target: instance_alarm + diff --git a/tools/load_generator/templates/vm_4.yaml b/tools/load_generator/templates/vm_4.yaml new file mode 100644 index 000000000..615904b30 --- /dev/null +++ b/tools/load_generator/templates/vm_4.yaml @@ -0,0 +1,84 @@ +metadata: + name: host_public_nic_failure_scenarios vm 4 + description: scenarios triggered by host nic fail on physical vm 4 +definitions: + entities: + - entity: + category: ALARM + type: zabbix + rawtext: Public interface down on {HOST.NAME} + template_id: zabbix_alarm + - entity: + category: ALARM + type: vitrage + name: VM network problem 4 + template_id: instance_alarm + - entity: + category: RESOURCE + type: nova.instance + template_id: instance + - entity: + category: RESOURCE + type: neutron.port + template_id: port + - entity: + category: ALARM + type: vitrage + name: PORT network problem + template_id: port_alarm + - entity: + category: RESOURCE + type: nova.host + template_id: host + relationships: + - relationship: + source: zabbix_alarm + relationship_type: on + target: host + template_id : public_nic_fail_on_host + - relationship: + source: host + relationship_type: contains + target: instance + template_id : host_contains_instance + - relationship: + source: instance_alarm + relationship_type: on + target: instance + template_id : alarm_on_instance + - relationship: + source: port_alarm + relationship_type: on + target: port + template_id : alarm_on_port + - relationship: + source: port + relationship_type: attached + target: instance + template_id : port_attached_to_instance +scenarios: + - scenario: + condition: public_nic_fail_on_host and host_contains_instance + actions: + - action: + action_type: raise_alarm + action_target: + target: instance + properties: + alarm_name: VM network problem 4 + severity: critical + - action: + action_type: set_state + action_target: + target: instance + properties: + state: SUBOPTIMAL + - scenario: + condition: public_nic_fail_on_host and host_contains_instance and alarm_on_instance + actions: + - action: + action_type: add_causal_relationship + action_target: + source: zabbix_alarm + target: instance_alarm +