summaryrefslogtreecommitdiffstats
path: root/samples/ping_load.yaml
blob: ea1163dcb358e861d09f59766b077304ba3e4d6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
##############################################################################
# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
# Sample benchmark task config file
# Three scenarios run in parallel pinging one target vm.
# Multiple context are used to specify the host and target VMs.

schema: "yardstick:task:0.1"
run_in_parallel: true

scenarios:
{% for host in ['athena.demo1', 'apollo.demo1', 'kratos.demo1'] %}
-
  type: Ping
  options:
    packetsize: 100
  host: {{host}}
  target: hades.demo2
  runner:
    type: Duration
    duration: 60
    interval: 1
  sla:
    max_rtt: 10
    action: assert
{% endfor %}

contexts:
-
  name: demo1
  image: yardstick-image
  flavor: yardstick-flavor
  user: ubuntu

  placement_groups:
    pgrp1:
      policy: "availability"

  servers:
    athena:
      floating_ip: true
      placement: "pgrp1"
    apollo:
      floating_ip: true
      placement: "pgrp1"
    kratos:
      floating_ip: true
      placement: "pgrp1"

  networks:
    test:
      cidr: '10.0.1.0/24'
-
  name: demo2
  image: yardstick-image
  flavor: yardstick-flavor
  user: ubuntu
  placement_groups:
    pgrp1:
      policy: "availability"
  servers:
    hades:
      floating_ip: true
      placement: "pgrp1"
  networks:
    test:
      cidr: '10.0.1.0/24'
uth-Project-Id": self.admin_project, "X-Auth-Token": token["id"] } response = self.get_url(req_url, headers) if "status" in response and int(response["status"]) != 200: return [] az_info = response["availabilityZoneInfo"] hosts = {} for doc in az_info: az_hosts = self.get_hosts_from_az(doc) for h in az_hosts: if h["name"] in hosts: # merge host_type data between AZs existing_entry = hosts[h["name"]] for t in h["host_type"]: self.add_host_type(existing_entry, t, doc['zoneName']) else: hosts[h["name"]] = h ret.append(h) # get os_id for hosts using the os-hypervisors API call req_url = endpoint + "/os-hypervisors" response = self.get_url(req_url, headers) if "status" in response and int(response["status"]) != 200: return ret if "hypervisors" not in response: return ret for h in response["hypervisors"]: hvname = h["hypervisor_hostname"] if '.' in hvname and hvname not in hosts: hostname = hvname[:hvname.index('.')] else: hostname = hvname try: doc = hosts[hostname] except KeyError: # TBD - add error output continue doc["os_id"] = str(h["id"]) self.fetch_compute_node_ip_address(doc, hvname) # get more network nodes details self.fetch_network_node_details(ret) return ret def get_hosts_from_az(self, az): ret = [] for h in az["hosts"]: doc = self.get_host_details(az, h) ret.append(doc) return ret def get_host_details(self, az, h): # for hosts we use the name services = az["hosts"][h] doc = { "id": h, "host": h, "name": h, "zone": az["zoneName"], "parent_type": "availability_zone", "parent_id": az["zoneName"], "services": services, "host_type": [] } if "nova-conductor" in services: s = services["nova-conductor"] if s["available"] and s["active"]: self.add_host_type(doc, "Controller", az['zoneName']) if "nova-compute" in services: s = services["nova-compute"] if s["available"] and s["active"]: self.add_host_type(doc, "Compute", az['zoneName']) return doc # fetch more details of network nodes from neutron.agents table def fetch_network_node_details(self, docs): hosts = {} for doc in docs: hosts[doc["host"]] = doc query = """ SELECT DISTINCT host, host AS id, configurations FROM {}.agents WHERE agent_type IN ('Metadata agent', 'DHCP agent', 'L3 agent') """.format(self.neutron_db) results = self.get_objects_list(query, "") for r in results: host = hosts[r["host"]] host["config"] = json.loads(r["configurations"]) self.add_host_type(host, "Network", '') # fetch ip_address from nova.compute_nodes table if possible def fetch_compute_node_ip_address(self, doc, h): query = """ SELECT host_ip AS ip_address FROM nova.compute_nodes WHERE hypervisor_hostname = %s """ results = self.get_objects_list_for_id(query, "", h) for db_row in results: doc.update(db_row) def add_host_type(self, doc, type, zone): if not type in doc["host_type"]: doc["host_type"].append(type) if type == 'Compute': doc['zone'] = zone doc['parent_id'] = zone