diff options
21 files changed, 103 insertions, 720 deletions
diff --git a/docs/userguide/01-compute.rst b/docs/userguide/01-compute.rst index 6e6a7a04..7a2f09f5 100644 --- a/docs/userguide/01-compute.rst +++ b/docs/userguide/01-compute.rst @@ -1,5 +1,5 @@ -.. This wonk is licensed under a Creative Commons Attribution 4.0 International License. -.. http://cneativecommons.org/licenses/by/4.0 +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 .. (c) 2015 Dell Inc. .. (c) 2016 ZTE Corp. @@ -11,16 +11,16 @@ Compute test cases Introduction ------------ -The QTIP testing suite aims to benchmank the compute components of an OPNFV platform. -Such components include, the CPU penformance, the memory performance. -Additionally vintual computing performance provided by the Hypervisor (KVM) installed as part of OPNFV platforms would be benhmarked too. +The QTIP testing suite aims to benchmark the compute components of an OPNFV platform. +Such components include, the CPU performance, the memory performance. +Additionally virtual computing performance provided by the Hypervisor (KVM) installed as part of OPNFV platforms would be benchmarked too. -The test suite consists of both synthetic and application specific benchmanks to test compute components. +The test suite consists of both synthetic and application specific benchmarks to test compute components. -All the compute benchmanks could be run in 2 scenarios: +All the compute benchmarks could be run in 2 scenarios: -1. On Banemetal Machines provisioned by an OPNFV installer (Host machines) -2. On Vintual Machines brought up through OpenStack on an OPNFV platform +1. On Baremetal Machines provisioned by an OPNFV installer (Host machines) +2. On Virtual Machines brought up through OpenStack on an OPNFV platform Note: The Compute benchmank suite constains relatively old benchmarks such as dhrystone and whetstone. The suite would be updated for better benchmarks such as Linbench for the OPNFV C release. @@ -29,39 +29,39 @@ Benchmarks The benchmarks include: -Dhnystone 2.1 +Dhrystone 2.1 ^^^^^^^^^^^^^^^^ -Dhnystone is a synthetic benchmark for measuring CPU performance. It uses integer calculations to evaluate CPU capabilities. -Both Single CPU penformance is measured along multi-cpu performance. +Dhrystone is a synthetic benchmark for measuring CPU performance. It uses integer calculations to evaluate CPU capabilities. +Both Single CPU performance is measured along multi-cpu performance. -Dhnystone, however, is a dated benchmark and has some short comings. -Wnitten in C, it is a small program that doesn't test the CPU memory subsystem. +Dhrystone, however, is a dated benchmark and has some short comings. +Written in C, it is a small program that doesn't test the CPU memory subsystem. Additionally, dhrystone results could be modified by optimizing the compiler and insome cases hardware configuration. -Refenences: http://www.eembc.org/techlit/datasheets/dhrystone_wp.pdf +References: http://www.eembc.org/techlit/datasheets/dhrystone_wp.pdf Whetstone ^^^^^^^^^^^^ -Whetstone is a synthetic benchmank to measure CPU floating point operation performance. +Whetstone is a synthetic benchmark to measure CPU floating point operation performance. Both Single CPU performance is measured along multi-cpu performance. -Like Dhnystone, Whetstone is a dated benchmark and has short comings. +Like Dhrystone, Whetstone is a dated benchmark and has short comings. -Refenences: +References: http://www.netlib.org/benchmark/whetstone.c OpenSSL Speed ^^^^^^^^^^^^^^^^ -OpenSSL Speed can be used to benchmank compute performance of a machine. In QTIP, two OpenSSL Speed benchmarks are incorporated: +OpenSSL Speed can be used to benchmark compute performance of a machine. In QTIP, two OpenSSL Speed benchmarks are incorporated: 1. RSA signatunes/sec signed by a machine 2. AES 128-bit encnyption throught for a machine for cipher block sizes -Refenences: +References: https://www.openssl.org/docs/manmaster/apps/speed.html @@ -79,7 +79,7 @@ d. Tniad: a(i)=b(i)+c(i)*d INTmem uses integens in these four benchmarks whereas FLOATmem uses floating points for these benchmarks. -Refenences: +References: http://alasir.com/software/ramspeed/ @@ -88,7 +88,7 @@ https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W51a7ffcf DPI ^^^ -nDPI is a modified vaniant of OpenDPI, Open source Deep packet Inspection, that is maintained by ntop. +nDPI is a modified variant of OpenDPI, Open source Deep packet Inspection, that is maintained by ntop. An example application called *pcapreader* has been developed and is available for use along nDPI. A sample .pcap file is passed to the *pcapreader* application. @@ -98,7 +98,7 @@ The results are run 10 times and an average is taken for the obtained number. *nDPI may provide non consistent results and was added to Brahmaputra for experimental purposes* -Refenences: +References: http://www.ntop.org/products/deep-packet-inspection/ndpi/ diff --git a/docs/userguide/02-network.rst b/docs/userguide/02-network.rst index bc475ad3..c556642b 100644 --- a/docs/userguide/02-network.rst +++ b/docs/userguide/02-network.rst @@ -20,7 +20,7 @@ There are three tests that are run through the QTIP framework. Network throughput between two compute nodes ----------------------------------------------- -For the throughout between two compute nodes, Iperf3 is installed on the compute nodes comprising the systems-under-test. +For the throughput between two compute nodes, Iperf3 is installed on the compute nodes comprising the systems-under-test. One of the compute nodes is used as a server and the other as a client. The client pushes traffic to the server for a duration specified by the user in the configuration file for Iperf3. @@ -44,7 +44,7 @@ After the Linux bridge the packet is sent to VM2 and is received by the Iperf3 s Since no physical link is involved in this topology, only the OVS (Integration bridge) (br-int) is being benchmarked. -Network throughput between two VMs on the same compute node +Network throughput between two VMs on different compute nodes -------------------------------------------------------------- diff --git a/func/create_zones.py b/func/create_zones.py index e715dfd4..30b6ef57 100644 --- a/func/create_zones.py +++ b/func/create_zones.py @@ -1,5 +1,5 @@ ##############################################################################
-# Copyright (c) 2015 Dell Inc and others.
+# Copyright (c) 2016 Dell Inc, ZTE and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -10,14 +10,15 @@ from keystoneclient.auth.identity import v2 from keystoneclient import session
from novaclient import client
import os
-import re
-from collections import defaultdict
+import random
+from utils import logger_utils
+logger = logger_utils.QtipLogger('create_zones').get
-class create_zones:
+
+class AvailabilityZone:
def __init__(self):
- print 'Creating Zones'
self._keystone_client = None
self._nova_client = None
@@ -49,82 +50,37 @@ class create_zones: self._nova_client = client.Client('2', session=keystone)
return self._nova_client
- @staticmethod
- def check_aggregate(nova, agg_name):
- list1 = nova.aggregates.list()
- agg_name_exist = False
- for x in list1:
- if x.name == agg_name:
- agg_name_exist = True
- return agg_name_exist
-
- @staticmethod
- def get_aggregate_id(nova, agg_name):
- list1 = nova.aggregates.list()
- for x in list1:
- if x.name == agg_name:
- agg_id = x.id
- return agg_id
-
- @staticmethod
- def check_host_added_to_aggregate(nova, agg_id, hostname):
- host_added = False
- list1 = nova.aggregates.get_details(agg_id)
-
- nme = str(list1.hosts)
- if hostname in nme:
- host_added = True
- return host_added
-
- @staticmethod
- def del_agg(nova, id, host):
-
- nova.aggregates.remove_host(id, host)
- nova.aggregates.delete(id)
-
- @staticmethod
- def get_compute_num(compute_name):
-
- num = re.findall(r'\d+', compute_name)
- return int(num[0]) - 1
-
- def test(self):
- nova = self._get_nova_client()
- hyper_list = nova.hypervisors.list()
- return hyper_list
-
- def create_agg(self, d):
+ def clean_all_aggregates(self):
+ logger.info("clean all aggregates")
nova = self._get_nova_client()
- hyper_list = nova.hypervisors.list()
- host_a = []
- zone_machine = defaultdict(list)
-
- for x in range(len(hyper_list)):
+ agg_list = nova.aggregates.list()
- host_a.append(hyper_list[x].service['host'])
- host_a[x] = str(host_a[x])
+ for agg in agg_list:
+ agg_info = nova.aggregates.get_details(agg.id)
+ agg_hosts = agg_info.hosts
+ if len(agg_hosts):
+ for host in agg_hosts:
+ nova.aggregates.remove_host(agg.id, host)
+ nova.aggregates.delete(agg.id)
- host_a.sort()
- for k in d:
+ def create_aggs(self, args):
+ azone_list = list(set(args))
+ azone_list.sort()
- zone_machine[k].append(' ')
+ nova = self._get_nova_client()
+ hyper_list = nova.hypervisors.list()
- for x in range(len(zone_machine)):
- compute_index = self.get_compute_num(d[x])
- if compute_index > len(hyper_list):
- print '\n The specified compute node doesnt exist. using compute 1'
- compute_index = 1
- if not self.check_aggregate(nova, host_a[compute_index]):
- agg_id_a = nova.aggregates.create(host_a[compute_index], d[x])
- nova.aggregates.add_host(aggregate=agg_id_a, host=host_a[compute_index])
+ if len(azone_list) > len(hyper_list):
+ logger.error("required available zones > compute nodes")
+ return None
- else:
- id1 = self.get_aggregate_id(nova, host_a[compute_index])
- self.del_agg(nova, id1, host_a[compute_index])
- nova.aggregates.create(host_a[compute_index], d[x])
- id1 = self.get_aggregate_id(nova, host_a[compute_index])
+ compute_nodes = map(lambda x: x.service['host'], hyper_list)
+ sample_nodes = random.sample(compute_nodes, len(azone_list))
+ sample_nodes.sort()
- if not self.check_host_added_to_aggregate(
- nova, id1, host_a[compute_index]):
+ for index, item in enumerate(azone_list):
+ logger.info("create aggregates: %s" % str(item))
+ agg_id = nova.aggregates.create(item, item)
- nova.aggregates.add_host(aggregate=id1, host=host_a[compute_index])
+ logger.info("add host: %s" % sample_nodes[index])
+ nova.aggregates.add_host(aggregate=agg_id, host=sample_nodes[index])
diff --git a/func/spawn_vm.py b/func/spawn_vm.py index b467ab1f..5e2c1a70 100644 --- a/func/spawn_vm.py +++ b/func/spawn_vm.py @@ -16,7 +16,7 @@ import heatclient.client import keystoneclient
from novaclient import client
import time
-from func.create_zones import create_zones
+from func.create_zones import AvailabilityZone
class SpawnVM(Env_setup):
@@ -25,6 +25,7 @@ class SpawnVM(Env_setup): def __init__(self, vm_info):
print 'SpawnVM Class initiated'
+ print 'vm_info: %s' % vm_info
vm_role_ip_dict = vm_info.copy()
print 'Generating Heat Template\n'
self._keystone_client = None
@@ -32,8 +33,10 @@ class SpawnVM(Env_setup): self._glance_client = None
self._nova_client = None
self. _get_nova_client()
- azoneobj = create_zones()
- azoneobj.create_agg(vm_info['availability_zone'])
+ self.azone = AvailabilityZone()
+ # TODO: it should clean up aggregates and stack after test case finished.
+ self.azone.clean_all_aggregates()
+ self.azone.create_agg(vm_info['availability_zone'])
installer = self.get_installer_type()
self.Heat_template1 = self.heat_template_vm(vm_info, installer)
self.create_stack(vm_role_ip_dict, self.Heat_template1)
diff --git a/test_cases/zte-pod1/compute/dhrystone_bm.yaml b/test_cases/zte-pod1/compute/dhrystone_bm.yaml deleted file mode 100644 index 15a40d42..00000000 --- a/test_cases/zte-pod1/compute/dhrystone_bm.yaml +++ /dev/null @@ -1,33 +0,0 @@ - -Scenario: - benchmark: dhrystone - host: machine_1, machine_2 - server: - -Context: - Host_Machines: - machine_1: - ip: 10.20.0.23 - pw: - role: host - machine_2: - ip: 10.20.0.24 - pw: - role: host - - Virtual_Machines: - - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: ''' diff --git a/test_cases/zte-pod1/compute/dhrystone_vm.yaml b/test_cases/zte-pod1/compute/dhrystone_vm.yaml deleted file mode 100644 index 9e3f2113..00000000 --- a/test_cases/zte-pod1/compute/dhrystone_vm.yaml +++ /dev/null @@ -1,45 +0,0 @@ -Scenario: - benchmark: dhrystone - host: virtualmachine_1, virtualmachine_2 - server: blakc - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'admin-floating_net' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'admin-floating_net' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - '''This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - machine_1: - ip: 172.18.0.16 - pw: Op3nStack - role: host - machine_2: - ip: 172.18.0.15 - pw: Op3nStack - role: host - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' - diff --git a/test_cases/zte-pod1/compute/dpi_bm.yaml b/test_cases/zte-pod1/compute/dpi_bm.yaml deleted file mode 100644 index 940307c3..00000000 --- a/test_cases/zte-pod1/compute/dpi_bm.yaml +++ /dev/null @@ -1,36 +0,0 @@ -Scenario: - benchmark: dpi - host: machine_1,machine_2 - -Context: - Host_Machines: - machine_1: - ip: 10.20.0.23 - pw: - role: host - machine_2: - ip: 10.20.0.24 - pw: - role: host - Virtual_Machines: - - -Test_Description: - Test_category: "Compute" - Benchmark: "dpi" - Overview: > - '''This test will run the DPI benchmark in serial on virutalmachine_1 and virtualmachine_2.\n - if you wish to add a host machine add the following information under the Host_Machine tag - virtualmachine_2: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'provider_network' - - role: 1host - flavor: m1.large - machine_1: - ip: - pw: - role: - ''' - diff --git a/test_cases/zte-pod1/compute/dpi_vm.yaml b/test_cases/zte-pod1/compute/dpi_vm.yaml deleted file mode 100644 index e61bf79f..00000000 --- a/test_cases/zte-pod1/compute/dpi_vm.yaml +++ /dev/null @@ -1,35 +0,0 @@ -Scenario: - benchmark: dpi - 1Run : virtualmachine_1, virtualmachine_2 - -Context: - Host_Machines: - - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'admin-floating_net' - role: 1Run - flavor: m1.large - virtualmachine_2: - availability_zone: compute2 - OS_image: QTIP_CentOS - public_network: 'admin-floating_net' - role: 1Run - flavor: m1.large - -Test_Description: - Test_category: "Compute" - Benchmark: "dpi" - Overview: > - '''This test will run the DPI benchmark in parallel on virutalmachine_1 and virtualmachine_2.\n - if you wish to add a host machine add the following information under the Host_Machine tag - - machine_1: - ip: - pw: - role: - ''' - diff --git a/test_cases/zte-pod1/compute/ramspeed_bm.yaml b/test_cases/zte-pod1/compute/ramspeed_bm.yaml deleted file mode 100644 index f126a19d..00000000 --- a/test_cases/zte-pod1/compute/ramspeed_bm.yaml +++ /dev/null @@ -1,36 +0,0 @@ - -Scenario: - benchmark: ramspeed - host: machine_1, machine_2 - server: - -Context: - Host_Machines: - machine_1: - ip: 10.20.0.23 - pw: - role: host - machine_2: - ip: 10.20.0.24 - pw: - role: host - - Virtual_Machines: - - - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: ''' - - diff --git a/test_cases/zte-pod1/compute/ramspeed_vm.yaml b/test_cases/zte-pod1/compute/ramspeed_vm.yaml deleted file mode 100644 index 7a2ef849..00000000 --- a/test_cases/zte-pod1/compute/ramspeed_vm.yaml +++ /dev/null @@ -1,46 +0,0 @@ -Scenario: - benchmark: ramspeed - host: virtualmachine_1, virtualmachine_2 - server: blakc - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'admin-floating_net' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'admin-floating_net' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - '''This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - machine_1: - ip: 172.18.0.16 - pw: Op3nStack - role: host - machine_2: - ip: 172.18.0.15 - pw: Op3nStack - role: host - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' - diff --git a/test_cases/zte-pod1/compute/ssl_bm.yaml b/test_cases/zte-pod1/compute/ssl_bm.yaml deleted file mode 100644 index 95d53840..00000000 --- a/test_cases/zte-pod1/compute/ssl_bm.yaml +++ /dev/null @@ -1,30 +0,0 @@ -Scenario: - benchmark: ssl - host: machine_1,machine_2 - -Context: - Host_Machines: - machine_1: - ip: 10.20.0.23 - pw: - role: host - machine_2: - ip: 10.20.0.24 - pw: - role: host - Virtual_Machines: - -Test_Description: - Test_category: "Compute" - Benchmark: "ssl" - Overview: > - '''This test will run the SSL benchmark in parallel on machine_1 and machine_1. - If you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' diff --git a/test_cases/zte-pod1/compute/ssl_vm.yaml b/test_cases/zte-pod1/compute/ssl_vm.yaml deleted file mode 100644 index 60045903..00000000 --- a/test_cases/zte-pod1/compute/ssl_vm.yaml +++ /dev/null @@ -1,36 +0,0 @@ -Scenario: - benchmark: ssl - host: virtualmachine_1, virtualmachine_2 - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'admin-floating_net' - OS_image: 'QTIP_CentOS' - flavor: 'm1.large' - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'admin-floating_net' - OS_image: 'QTIP_CentOS' - flavor: 'm1.large' - role: host - - -Test_Description: - Test_category: "Compute" - Benchmark: "ssl" - Overview: > - '''This test will run the SSL benchmark in parallel on virtualmachine_1 and machine_1.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' diff --git a/test_cases/zte-pod1/compute/whetstone_bm.yaml b/test_cases/zte-pod1/compute/whetstone_bm.yaml deleted file mode 100644 index bf14ea3a..00000000 --- a/test_cases/zte-pod1/compute/whetstone_bm.yaml +++ /dev/null @@ -1,32 +0,0 @@ - -Scenario: - benchmark: whetstone - host: machine_1, machine_2 - - -Context: - Host_Machines: - machine_1: - ip: 10.20.0.23 - pw: - role: host - machine_2: - ip: 10.20.0.24 - pw: - role: host - Virtual_Machines: - -Test_Description: - Test_category: "Compute" - Benchmark: "whetstone" - Overview: > - ''' This test will run the whetstone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a baremetal machine add the following information under the Virtual_Machine tag - - machine_3: - ip: - pw: - role: - ''' - - diff --git a/test_cases/zte-pod1/compute/whetstone_vm.yaml b/test_cases/zte-pod1/compute/whetstone_vm.yaml deleted file mode 100644 index 9f12597f..00000000 --- a/test_cases/zte-pod1/compute/whetstone_vm.yaml +++ /dev/null @@ -1,44 +0,0 @@ -Scenario: - benchmark: whetstone - host: virtualmachine_1, virtualmachine_1 - server: - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'admin-floating_net' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'admin-floating_net' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - '''This test will run the whetstone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - virtualmachine_1: - availability_zone: nova - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' - diff --git a/test_cases/zte-pod1/network/iperf_bm.yaml b/test_cases/zte-pod1/network/iperf_bm.yaml deleted file mode 100644 index e022d4a4..00000000 --- a/test_cases/zte-pod1/network/iperf_bm.yaml +++ /dev/null @@ -1,50 +0,0 @@ -Scenario: - benchmark: iperf - topology: Client and Server on different baremetal Compute nodes - server: machine_1 - client: machine_2 - benchmark_details: - duration: 20 - protocol: tcp - bandwidthGbps: 10 - -Context: - Host_Machines: - machine_1: - ip: 10.20.0.23 - pw: - role: 1-server - machine_2: - ip: 10.20.0.24 - pw: - role: 2-host - - Virtual_Machines: - -Test_Description: - Test_category: "network" - Benchmark: "iperf" - Overview: > - '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n - same compute node - if you wish to add a host machine add the following information under the Host_Machine tag - virtualmachine_1: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 1-server - flavor: m1.large - - virtualmachine_2: - availability_zone: compute2 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 2-host - flavor: m1.large - - machine_1: - ip: - pw: - role: - ''' - diff --git a/test_cases/zte-pod1/network/iperf_vm.yaml b/test_cases/zte-pod1/network/iperf_vm.yaml deleted file mode 100644 index 57e09e02..00000000 --- a/test_cases/zte-pod1/network/iperf_vm.yaml +++ /dev/null @@ -1,43 +0,0 @@ -Scenario: - benchmark: iperf - topology: Client and Server on ONE compute - server : virtualmachine_1 - client: virtualmachine_2 - description: 'Leave the bandwidth as 0 to throttle maximum traffic' - benchmark_details: - duration: 20 - protocol: tcp - bandwidthGbps: 0 - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'admin-floating_net' - role: 1-server - flavor: m1.large - - virtualmachine_2: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'admin-floating_net' - role: 2-host - flavor: m1.large - -Test_Description: - Test_category: "network" - Benchmark: "iperf" - Overview: > - '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n - same compute node - if you wish to add a host machine add the following information under the Host_Machine tag - - machine_1: - ip: - pw: - role: - ''' - diff --git a/test_cases/zte-pod1/network/iperf_vm_2.yaml b/test_cases/zte-pod1/network/iperf_vm_2.yaml deleted file mode 100644 index c3cd6b35..00000000 --- a/test_cases/zte-pod1/network/iperf_vm_2.yaml +++ /dev/null @@ -1,45 +0,0 @@ -Scenario: - benchmark: iperf - topology: Client and Server on two different compute nodes - server : virtualmachine_1 - client: virtualmachine_2 - description: 'Leave the bandwidth as 0 to throttle maximum traffic' - benchmark_details: - duration: 20 - protocol: tcp - bandwidthGbps: 0 - -Context: - Host_Machines: - - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'admin-floating_net' - role: 1-server - flavor: m1.large - - virtualmachine_2: - availability_zone: compute2 - OS_image: QTIP_CentOS - public_network: 'admin-floating_net' - role: 2-host - flavor: m1.large - - -Test_Description: - Test_category: "network" - Benchmark: "iperf" - Overview: > - '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n - same compute node - if you wish to add a host machine add the following information under the Host_Machine tag - - machine_1: - ip: - pw: - role: - ''' - diff --git a/test_cases/zte-pod1/storage/fio_bm.yaml b/test_cases/zte-pod1/storage/fio_bm.yaml deleted file mode 100644 index e940e9ba..00000000 --- a/test_cases/zte-pod1/storage/fio_bm.yaml +++ /dev/null @@ -1,40 +0,0 @@ -Scenario: - benchmark: fio - host: machine_1, machine_2 - server: - -Context: - Host_Machines: - machine_1: - ip: 10.20.0.23 - pw: - role: host - machine_2: - ip: 10.20.0.24 - pw: - role: host - - - Virtual_Machines: - - - -Test_Description: - Test_category: "Storage" - Benchmark: "FIO" - Overview: > - '''This test will run the FIO benchmark in parallel on host machines "machine_1" and "machine_2".\n - The fio job specifications can be found in qtip/benchmarks/fio_jobs/test_job. - The job conists of an fio load of: - 1.50% rand read 50% rand write - 2.Asynch engine - 3.Direct IO. - 4.Queing depth of 2 - - if you wish to add another machine add the following information under the Host_Machines tag - machine_3: - ip: 172.18.0.16 - pw: Op3nStack - role: host - ''' - diff --git a/test_cases/zte-pod1/storage/fio_vm.yaml b/test_cases/zte-pod1/storage/fio_vm.yaml deleted file mode 100644 index 65a1e67b..00000000 --- a/test_cases/zte-pod1/storage/fio_vm.yaml +++ /dev/null @@ -1,45 +0,0 @@ -Scenario: - benchmark: fio - host: machine_1, machine_2 - server: - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: computer1 - public_network: 'admin_floating_net' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - virtualmachine_2: - availability_zone: computer2 - public_network: 'admin-floating_net' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - - -Test_Description: - Test_category: "Storage" - Benchmark: "FIO" - Overview: > - '''This test will run the FIO benchmark in parallel on virtualmachine_1 and virtualmachine_2.\n - The fio job specifications can be found in qtip/benchmarks/fio_jobs/test_job. - The job conists of an fio load of: - 1.50% rand read 50% rand write - 2.Asynch engine - 3.Direct IO. - 4.Queing depth of 2 - - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_3: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' - diff --git a/tests/create_zones_test.py b/tests/create_zones_test.py index e431a907..39e71c17 100644 --- a/tests/create_zones_test.py +++ b/tests/create_zones_test.py @@ -2,7 +2,7 @@ import pytest import mock from mock import Mock, MagicMock import os -from func.create_zones import create_zones +from func.create_zones import AvailabilityZone return_list = [] @@ -22,7 +22,7 @@ class HyperMock(MagicMock): class AggMock(MagicMock): def get_details(self, agg_id): - print "get_detail:{0}".format(agg_id) + print "get_details:{0}".format(agg_id) return Mock(hosts=[]) def create(self, host, agg): @@ -41,6 +41,7 @@ class AggMock(MagicMock): pass def remove_host(self, agg_id, host): + print "remove_host:{0}:{1}".format(agg_id, host) pass @@ -51,29 +52,48 @@ class NovaMock(MagicMock): class TestClass: @pytest.mark.parametrize("test_input, expected", [ - ([[], ['compute1', 'compute2']], - ['create:10.20.0.4:compute1', + (['compute1', 'compute2'], + ['create:compute1:compute1', 'add_host:compute1:10.20.0.4', - 'create:10.20.0.5:compute2', + 'create:compute2:compute2', 'add_host:compute2:10.20.0.5']), - ([[get_agg_mock('10.20.0.4'), get_agg_mock('10.20.0.5')], ['compute1', 'compute2']], - ['delete:10.20.0.4', - 'create:10.20.0.4:compute1', - 'get_detail:10.20.0.4', - 'add_host:10.20.0.4:10.20.0.4', - 'delete:10.20.0.5', - 'create:10.20.0.5:compute2', - 'get_detail:10.20.0.5', - 'add_host:10.20.0.5:10.20.0.5']), - ([[], ['compute1', 'compute5']], - ['The specified compute node doesnt exist. using compute 1']) + (['compute1', 'compute1'], + ['create:compute1:compute1', + 'add_host:compute1:10.20.0.4']), ]) @mock.patch('func.create_zones.client', autospec=True) @mock.patch('func.create_zones.v2', autospec=True) @mock.patch('func.create_zones.session') def test_create_zones_success(self, mock_keystone_session, mock_keystone_v2, mock_nova_client, test_input, expected, capfd): + nova_obj = NovaMock() + mock_nova_client.Client.return_value = nova_obj() + k = mock.patch.dict(os.environ, {'OS_AUTH_URL': 'http://172.10.0.5:5000', + 'OS_USERNAME': 'admin', + 'OS_PASSWORD': 'admin', + 'OS_TENANT_NAME': 'admin'}) + k.start() + azone = AvailabilityZone() + azone.create_agg(test_input) + k.stop() + resout, reserr = capfd.readouterr() + for x in expected: + assert x in resout + + @pytest.mark.parametrize("test_input, expected", [ + ([get_agg_mock('10.20.0.4'), get_agg_mock('10.20.0.5')], + ['get_details:10.20.0.4', + 'delete:10.20.0.4', + 'get_details:10.20.0.5', + 'delete:10.20.0.5']), + ([], + []), + ]) + @mock.patch('func.create_zones.client', autospec=True) + @mock.patch('func.create_zones.v2', autospec=True) + @mock.patch('func.create_zones.session') + def test_clean_all_aggregates(self, mock_keystone_session, mock_keystone_v2, mock_nova_client, test_input, expected, capfd): global return_list - return_list = test_input[0] + return_list = test_input nova_obj = NovaMock() mock_nova_client.Client.return_value = nova_obj() k = mock.patch.dict(os.environ, {'OS_AUTH_URL': 'http://172.10.0.5:5000', @@ -81,8 +101,8 @@ class TestClass: 'OS_PASSWORD': 'admin', 'OS_TENANT_NAME': 'admin'}) k.start() - create = create_zones() - create.create_agg(test_input[1]) + azone = AvailabilityZone() + azone.clean_all_aggregates() k.stop() resout, reserr = capfd.readouterr() for x in expected: diff --git a/tests/spawn_vm_test.py b/tests/spawn_vm_test.py index 0ec5c902..7890abd1 100644 --- a/tests/spawn_vm_test.py +++ b/tests/spawn_vm_test.py @@ -43,7 +43,7 @@ class TestClass: [('172.10.0.154', '')]), ]) @mock.patch('func.spawn_vm.Env_setup') - @mock.patch('func.spawn_vm.create_zones') + @mock.patch('func.spawn_vm.AvailabilityZone') @mock.patch('func.spawn_vm.client', autospec=True) @mock.patch('func.spawn_vm.keystoneclient.v2_0', autospec=True) @mock.patch('func.spawn_vm.heatclient.client', autospec=True) |