diff options
author | Mofassir Arif <mofassir@gmail.com> | 2015-12-09 04:50:55 -0800 |
---|---|---|
committer | Mofassir Arif <Mofassir_arif@dellteam.com> | 2015-12-16 01:45:38 -0800 |
commit | e51df601fe4a1bd22274e3da62659b1ed7b2c49b (patch) | |
tree | 66abbe6ea11fec7e027fab4481ae1cd9e44f054f /func/spawn_vm.py | |
parent | ae9f53f8f00342627f6d0124e53a285438c1ca4e (diff) |
Networking Testcase: Iperf Implemented
The ansible playbooks as well as the config files
for the iperf throughput testing have been implemented.
Some changes have been made to the driver function for
the benchmarks. ansible now gets passed a json file.
Change-Id: Ibf4c0210ab9f6cbf9896ca69bf2fb6bda8a9925d
Signed-off-by: Mofassir Arif <mofassir@gmail.com>
Diffstat (limited to 'func/spawn_vm.py')
-rw-r--r-- | func/spawn_vm.py | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/func/spawn_vm.py b/func/spawn_vm.py index a9dada2e..c1bacedc 100644 --- a/func/spawn_vm.py +++ b/func/spawn_vm.py @@ -21,8 +21,6 @@ import glanceclient from novaclient import client import time import json - - from func.create_zones import create_zones @@ -81,17 +79,14 @@ class SpawnVM(Env_setup): 'type': 'string' } - - Heat_Dic['resources'][ - 'public_port_' + - str(x)] = { - 'type': 'OS::Neutron::Port', - 'properties': { - 'network': {'get_resource': 'private_network'}, - 'security_groups': [{ 'get_resource': 'demo1_security_Group'}], - 'fixed_ips': [ - { - 'subnet_id': {'get_resource': 'private_subnet'}}]}} + + Heat_Dic['resources']['public_port_' +str(x)] = { + 'type': 'OS::Neutron::Port', + 'properties': { + 'network': {'get_resource': 'private_network'}, + 'security_groups': [{ 'get_resource': 'demo1_security_Group'}], + 'fixed_ips': [ + {'subnet_id': {'get_resource': 'private_subnet'}}]}} Heat_Dic['resources']['floating_ip_' + str(x)] = { 'type': 'OS::Neutron::FloatingIP', @@ -108,11 +103,11 @@ class SpawnVM(Env_setup): 'type': 'OS::Nova::Server', 'properties': { 'image': img, - 'networks': - [{'port': {'get_resource': 'public_port_' + str(x)}}], + 'networks':[ + {'port': {'get_resource': 'public_port_' + str(x)}}], 'flavor': flavor, 'availability_zone': avail_zone, - 'name': 'QTIP_Instance_' + str(x), + 'name': 'instance' + str(x), 'key_name': {'get_resource': 'KeyPairSavePrivate'}, 'user_data_format': 'RAW', 'user_data': scriptcmd}} @@ -124,9 +119,15 @@ class SpawnVM(Env_setup): 'rules': [{ 'protocol': 'tcp', 'port_range_min': 22, - 'port_range_max': 22}, + 'port_range_max': 5201}, + {'protocol': 'udp', + 'port_range_min': 22, + 'port_range_max': 5201}, {'protocol': 'icmp'}]}} - + + Heat_Dic['outputs']['instance_PIP_' +str(x)] = { + 'description': 'IP address of the instance', + 'value': {'get_attr': ['my_instance_' + str(x), 'first_address']}} Heat_Dic['outputs']['instance_ip_' +str(x)] = { 'description': 'IP address of the instance', 'value': {'get_attr': ['floating_ip_' + str(x), 'floating_ip_address']}} @@ -205,10 +206,7 @@ class SpawnVM(Env_setup): qtip_image = glance.images.upload( qtip_image.id, open('./Temp_Img/QTIP_CentOS.qcow2')) json_temp = json.dumps(Heat_template) -# cluster_body = { -# "stack_name": stackname, -# "template": Heat_template -# } + for checks in range(3): for prev_stacks in heat.stacks.list(): @@ -219,12 +217,12 @@ class SpawnVM(Env_setup): print '\nStack Creating Started\n' - try: - heat.stacks.create(stack_name=stackname, template=Heat_template) - - except: - print 'Create Failed :( ' + # try: + heat.stacks.create(stack_name=stackname, template=Heat_template) + #except: + #print 'Create Failed :( ' + cluster_detail = heat.stacks.get(stackname) while(cluster_detail.status != 'COMPLETE'): if cluster_detail.status == 'IN_PROGRESS': @@ -242,18 +240,17 @@ class SpawnVM(Env_setup): if I['output_key'] == availabilityKey: zone.insert(s,str(I['output_value'])) - s=s+1 - + s=s+1 for i in cluster_detail.outputs: instanceKey = "instance_ip_" + str(vm + 1) - + privateIPkey = 'instance_PIP_' + str(vm +1) if i['output_key'] == instanceKey: - - Env_setup.roles_dict[vm_role_ip_dict['role'][ - vm]].append(str(i['output_value'])) - - Env_setup.ip_pw_list.append( - (str(i['output_value']),'')) + Env_setup.roles_dict[vm_role_ip_dict['role'][vm]].append( + str(i['output_value'])) + Env_setup.ip_pw_list.append((str(i['output_value']),'')) + + if i['output_key'] == privateIPkey: + Env_setup.ip_pw_dict[vm_role_ip_dict['role'][vm]]=str(i['output_value']) if i['output_key'] == 'KeyPair_PublicKey': sshkey = str(i['output_value']) |